GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge remote-tracking branch 'origin/stjs-prepare' into h264decode_optim · codice/jcodec@485ceb3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/main/java
    • net/sourceforge/jaad/aac
      • DecoderConfig.java
      • Profile.java
      • syntax
        • ICSInfo.java
    • org/jcodec
      • codecs
        • aac/blocks
          • BlockPCE.java
          • RawDataBlockType.java
        • h264/io/model
          • SliceType.java
        • prores
          • ProresEncoder.java
      • containers
        • mkv
          • MKVType.java
        • mp4/boxes/channel
          • ChannelLayout.java
          • Label.java
        • mps
          • MTSUtils.java
        • mxf
          • MXFConst.java
          • MXFDemuxer.java
      • movtool/streaming/tracks
        • Prores2AVCTrack.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/net/sourceforge/jaad/aac/DecoderConfig.java‎

Copy file name to clipboardExpand all lines: src/main/java/net/sourceforge/jaad/aac/DecoderConfig.java
+45-51Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.sourceforge.jaad.aac;
22

3+
import static net.sourceforge.jaad.aac.Profile.*;
4+
35
import net.sourceforge.jaad.aac.syntax.BitStream;
46
import net.sourceforge.jaad.aac.syntax.SyntaxConstants;
57
import net.sourceforge.jaad.aac.syntax.IBitStream;
@@ -154,57 +156,49 @@ public static DecoderConfig parseMP4DecoderSpecificInfo(byte[] data) throws AACE
154156
else config.sampleFrequency = SampleFrequency.forInt(sf);
155157
config.channelConfiguration = ChannelConfiguration.forInt(_in.readBits(4));
156158

157-
switch(config.profile) {
158-
case AAC_SBR:
159-
config.extProfile = config.profile;
160-
config.sbrPresent = true;
161-
sf = _in.readBits(4);
162-
//TODO: 24 bits already read; read again?
163-
//if(sf==0xF) config.sampleFrequency = SampleFrequency.forFrequency(_in.readBits(24));
164-
//if sample frequencies are the same: downsample SBR
165-
config.downSampledSBR = config.sampleFrequency.getIndex()==sf;
166-
config.sampleFrequency = SampleFrequency.forInt(sf);
167-
config.profile = readProfile(_in);
168-
break;
169-
case AAC_MAIN:
170-
case AAC_LC:
171-
case AAC_SSR:
172-
case AAC_LTP:
173-
case ER_AAC_LC:
174-
case ER_AAC_LTP:
175-
case ER_AAC_LD:
176-
//ga-specific info:
177-
config.frameLengthFlag = _in.readBool();
178-
if(config.frameLengthFlag) throw new AACException("config uses 960-sample frames, not yet supported"); //TODO: are 960-frames working yet?
179-
config.dependsOnCoreCoder = _in.readBool();
180-
if(config.dependsOnCoreCoder) config.coreCoderDelay = _in.readBits(14);
181-
else config.coreCoderDelay = 0;
182-
config.extensionFlag = _in.readBool();
183-
184-
if(config.extensionFlag) {
185-
if(config.profile.isErrorResilientProfile()) {
186-
config.sectionDataResilience = _in.readBool();
187-
config.scalefactorResilience = _in.readBool();
188-
config.spectralDataResilience = _in.readBool();
189-
}
190-
//extensionFlag3
191-
_in.skipBit();
192-
}
193-
194-
if(config.channelConfiguration==ChannelConfiguration.CHANNEL_CONFIG_NONE) {
195-
//TODO: is this working correct? -> ISO 14496-3 part 1: 1.A.4.3
196-
_in.skipBits(3); //PCE
197-
PCE pce = new PCE();
198-
pce.decode(_in);
199-
config.profile = pce.getProfile();
200-
config.sampleFrequency = pce.getSampleFrequency();
201-
config.channelConfiguration = ChannelConfiguration.forInt(pce.getChannelCount());
202-
}
203-
204-
if(_in.getBitsLeft()>10) readSyncExtension(_in, config);
205-
break;
206-
default:
207-
throw new AACException("profile not supported: "+config.profile.getIndex());
159+
Profile cp = config.profile;
160+
if (AAC_SBR == cp) {
161+
config.extProfile = cp;
162+
config.sbrPresent = true;
163+
sf = _in.readBits(4);
164+
//TODO: 24 bits already read; read again?
165+
//if(sf==0xF) config.sampleFrequency = SampleFrequency.forFrequency(_in.readBits(24));
166+
//if sample frequencies are the same: downsample SBR
167+
config.downSampledSBR = config.sampleFrequency.getIndex()==sf;
168+
config.sampleFrequency = SampleFrequency.forInt(sf);
169+
config.profile = readProfile(_in);
170+
} else if (AAC_MAIN == cp || AAC_LC == cp || AAC_SSR == cp || AAC_LTP == cp || ER_AAC_LC == cp || ER_AAC_LTP == cp || ER_AAC_LD == cp ) {
171+
//ga-specific info:
172+
config.frameLengthFlag = _in.readBool();
173+
if(config.frameLengthFlag) throw new AACException("config uses 960-sample frames, not yet supported"); //TODO: are 960-frames working yet?
174+
config.dependsOnCoreCoder = _in.readBool();
175+
if(config.dependsOnCoreCoder) config.coreCoderDelay = _in.readBits(14);
176+
else config.coreCoderDelay = 0;
177+
config.extensionFlag = _in.readBool();
178+
179+
if(config.extensionFlag) {
180+
if(cp.isErrorResilientProfile()) {
181+
config.sectionDataResilience = _in.readBool();
182+
config.scalefactorResilience = _in.readBool();
183+
config.spectralDataResilience = _in.readBool();
184+
}
185+
//extensionFlag3
186+
_in.skipBit();
187+
}
188+
189+
if(config.channelConfiguration==ChannelConfiguration.CHANNEL_CONFIG_NONE) {
190+
//TODO: is this working correct? -> ISO 14496-3 part 1: 1.A.4.3
191+
_in.skipBits(3); //PCE
192+
PCE pce = new PCE();
193+
pce.decode(_in);
194+
config.profile = pce.getProfile();
195+
config.sampleFrequency = pce.getSampleFrequency();
196+
config.channelConfiguration = ChannelConfiguration.forInt(pce.getChannelCount());
197+
}
198+
199+
if(_in.getBitsLeft()>10) readSyncExtension(_in, config);
200+
} else {
201+
throw new AACException("profile not supported: "+cp.getIndex());
208202
}
209203
return config;
210204
}
Collapse file

‎src/main/java/net/sourceforge/jaad/aac/Profile.java‎

Copy file name to clipboardExpand all lines: src/main/java/net/sourceforge/jaad/aac/Profile.java
+18-17Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@
1111
* More precisely, the ISO standard calls these 'object types'.
1212
* @author in-somnia
1313
*/
14-
public enum Profile {
14+
public final class Profile {
1515

16-
UNKNOWN(-1, "unknown", false),
17-
AAC_MAIN(1, "AAC Main Profile", true),
18-
AAC_LC(2, "AAC Low Complexity", true),
19-
AAC_SSR(3, "AAC Scalable Sample Rate", false),
20-
AAC_LTP(4, "AAC Long Term Prediction", false),
21-
AAC_SBR(5, "AAC SBR", true),
22-
AAC_SCALABLE(6, "Scalable AAC", false),
23-
TWIN_VQ(7, "TwinVQ", false),
24-
AAC_LD(11, "AAC Low Delay", false),
25-
ER_AAC_LC(17, "Error Resilient AAC Low Complexity", true),
26-
ER_AAC_SSR(18, "Error Resilient AAC SSR", false),
27-
ER_AAC_LTP(19, "Error Resilient AAC Long Term Prediction", false),
28-
ER_AAC_SCALABLE(20, "Error Resilient Scalable AAC", false),
29-
ER_TWIN_VQ(21, "Error Resilient TwinVQ", false),
30-
ER_BSAC(22, "Error Resilient BSAC", false),
31-
ER_AAC_LD(23, "Error Resilient AAC Low Delay", false);
16+
public final static Profile UNKNOWN = new Profile(-1, "unknown", false);
17+
public final static Profile AAC_MAIN = new Profile(1, "AAC Main Profile", true);
18+
public final static Profile AAC_LC = new Profile(2, "AAC Low Complexity", true);
19+
public final static Profile AAC_SSR = new Profile(3, "AAC Scalable Sample Rate", false);
20+
public final static Profile AAC_LTP = new Profile(4, "AAC Long Term Prediction", false);
21+
public final static Profile AAC_SBR = new Profile(5, "AAC SBR", true);
22+
public final static Profile AAC_SCALABLE = new Profile(6, "Scalable AAC", false);
23+
public final static Profile TWIN_VQ = new Profile(7, "TwinVQ", false);
24+
public final static Profile AAC_LD = new Profile(11, "AAC Low Delay", false);
25+
public final static Profile ER_AAC_LC = new Profile(17, "Error Resilient AAC Low Complexity", true);
26+
public final static Profile ER_AAC_SSR = new Profile(18, "Error Resilient AAC SSR", false);
27+
public final static Profile ER_AAC_LTP = new Profile(19, "Error Resilient AAC Long Term Prediction", false);
28+
public final static Profile ER_AAC_SCALABLE = new Profile(20, "Error Resilient Scalable AAC", false);
29+
public final static Profile ER_TWIN_VQ = new Profile(21, "Error Resilient TwinVQ", false);
30+
public final static Profile ER_BSAC = new Profile(22, "Error Resilient BSAC", false);
31+
public final static Profile ER_AAC_LD = new Profile(23, "Error Resilient AAC Low Delay", false);
32+
3233
private static final Profile[] ALL = {
3334
AAC_MAIN, AAC_LC, AAC_SSR, AAC_LTP, AAC_SBR, AAC_SCALABLE, TWIN_VQ,
3435
null, null, null, AAC_LD, null, null, null, null, null, ER_AAC_LC, ER_AAC_SSR,
Collapse file

‎src/main/java/net/sourceforge/jaad/aac/syntax/ICSInfo.java‎

Copy file name to clipboardExpand all lines: src/main/java/net/sourceforge/jaad/aac/syntax/ICSInfo.java
+26-28Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.sourceforge.jaad.aac.syntax;
22

3+
import static net.sourceforge.jaad.aac.Profile.*;
4+
35
import org.jcodec.platform.Platform;
46

57
import net.sourceforge.jaad.aac.AACException;
@@ -101,34 +103,30 @@ public void decode(IBitStream _in, DecoderConfig conf, boolean commonWindow) thr
101103
}
102104

103105
private void readPredictionData(IBitStream _in, Profile profile, SampleFrequency sf, boolean commonWindow) throws AACException {
104-
switch(profile) {
105-
case AAC_MAIN:
106-
if(icPredict==null) icPredict = new ICPrediction();
107-
icPredict.decode(_in, maxSFB, sf);
108-
break;
109-
case AAC_LTP:
110-
if(ltpData1Present = _in.readBool()) {
111-
if(ltPredict1==null) ltPredict1 = new LTPrediction(frameLength);
112-
ltPredict1.decode(_in, this, profile);
113-
}
114-
if(commonWindow) {
115-
if(ltpData2Present = _in.readBool()) {
116-
if(ltPredict2==null) ltPredict2 = new LTPrediction(frameLength);
117-
ltPredict2.decode(_in, this, profile);
118-
}
119-
}
120-
break;
121-
case ER_AAC_LTP:
122-
if(!commonWindow) {
123-
if(ltpData1Present = _in.readBool()) {
124-
if(ltPredict1==null) ltPredict1 = new LTPrediction(frameLength);
125-
ltPredict1.decode(_in, this, profile);
126-
}
127-
}
128-
break;
129-
default:
130-
throw new AACException("unexpected profile for LTP: "+profile);
131-
}
106+
if (AAC_MAIN == profile) {
107+
if(icPredict==null) icPredict = new ICPrediction();
108+
icPredict.decode(_in, maxSFB, sf);
109+
} else if (AAC_LTP == profile) {
110+
if(ltpData1Present = _in.readBool()) {
111+
if(ltPredict1==null) ltPredict1 = new LTPrediction(frameLength);
112+
ltPredict1.decode(_in, this, profile);
113+
}
114+
if(commonWindow) {
115+
if(ltpData2Present = _in.readBool()) {
116+
if(ltPredict2==null) ltPredict2 = new LTPrediction(frameLength);
117+
ltPredict2.decode(_in, this, profile);
118+
}
119+
}
120+
} else if(ER_AAC_LTP == profile) {
121+
if(!commonWindow) {
122+
if(ltpData1Present = _in.readBool()) {
123+
if(ltPredict1==null) ltPredict1 = new LTPrediction(frameLength);
124+
ltPredict1.decode(_in, this, profile);
125+
}
126+
}
127+
} else {
128+
throw new AACException("unexpected profile for LTP: "+profile);
129+
}
132130
}
133131

134132
/* =========== gets ============ */
Collapse file

‎src/main/java/org/jcodec/codecs/aac/blocks/BlockPCE.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/aac/blocks/BlockPCE.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private void decodeChannelMap(ChannelMapping layout_map[], int offset, ChannelPo
8989
case AAC_CHANNEL_FRONT:
9090
case AAC_CHANNEL_BACK:
9191
case AAC_CHANNEL_SIDE:
92-
syn_ele = RawDataBlockType.fromOrdinal(_in.read1Bit());
92+
syn_ele = RawDataBlockType.values()[_in.read1Bit()];
9393
break;
9494
case AAC_CHANNEL_CC:
9595
_in.read1Bit();
Collapse file

‎src/main/java/org/jcodec/codecs/aac/blocks/RawDataBlockType.java‎

Copy file name to clipboard
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.jcodec.codecs.aac.blocks;
22

3-
import java.util.EnumSet;
4-
53
/**
64
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
75
* under FreeBSD License
@@ -10,13 +8,5 @@
108
*
119
*/
1210
public enum RawDataBlockType {
13-
TYPE_SCE, TYPE_CPE, TYPE_CCE, TYPE_LFE, TYPE_DSE, TYPE_PCE, TYPE_FIL, TYPE_END;
14-
15-
public static RawDataBlockType fromOrdinal(int ordinal) {
16-
for (RawDataBlockType val : EnumSet.allOf(RawDataBlockType.class)) {
17-
if (val.ordinal() == ordinal)
18-
return val;
19-
}
20-
return null;
21-
}
11+
TYPE_SCE, TYPE_CPE, TYPE_CCE, TYPE_LFE, TYPE_DSE, TYPE_PCE, TYPE_FIL, TYPE_END
2212
}
Collapse file

‎src/main/java/org/jcodec/codecs/h264/io/model/SliceType.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/h264/io/model/SliceType.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
*
99
*/
1010
public final class SliceType {
11+
private final static SliceType _values[] = new SliceType[5];
1112
public final static SliceType P = new SliceType("P", 0);
1213
public final static SliceType B = new SliceType("B", 1);
1314
public final static SliceType I = new SliceType("I", 2);
1415
public final static SliceType SP = new SliceType("SP", 3);
1516
public final static SliceType SI = new SliceType("SI", 4);
1617
private String _name;
1718
private int _ordinal;
18-
private final static SliceType _values[] = new SliceType[5];
1919

2020
private SliceType(String name, int ordinal) {
2121
this._name = name;
Collapse file

‎src/main/java/org/jcodec/codecs/prores/ProresEncoder.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/jcodec/codecs/prores/ProresEncoder.java
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ public class ProresEncoder extends VideoEncoder {
4545
private static final int LOG_DEFAULT_SLICE_MB_WIDTH = 3;
4646
private static final int DEFAULT_SLICE_MB_WIDTH = 1 << LOG_DEFAULT_SLICE_MB_WIDTH;
4747

48-
public static enum Profile {
49-
PROXY(QMAT_LUMA_APCO, QMAT_CHROMA_APCO, "apco", 1000, 4, 8), LT(QMAT_LUMA_APCS, QMAT_CHROMA_APCS, "apcs", 2100,
50-
1, 9), STANDARD(QMAT_LUMA_APCN, QMAT_CHROMA_APCN, "apcn", 3500, 1, 6), HQ(QMAT_LUMA_APCH,
51-
QMAT_CHROMA_APCH, "apch", 5400, 1, 6);
48+
public final static class Profile {
49+
public final static Profile PROXY = new Profile(QMAT_LUMA_APCO, QMAT_CHROMA_APCO, "apco", 1000, 4, 8);
50+
public final static Profile LT = new Profile(QMAT_LUMA_APCS, QMAT_CHROMA_APCS, "apcs", 2100, 1, 9);
51+
public final static Profile STANDARD = new Profile(QMAT_LUMA_APCN, QMAT_CHROMA_APCN, "apcn", 3500, 1, 6);
52+
public final static Profile HQ = new Profile(QMAT_LUMA_APCH, QMAT_CHROMA_APCH, "apch", 5400, 1, 6);
53+
54+
private final static Profile[] _values = new Profile[] { PROXY, LT, STANDARD, HQ };
55+
56+
public static Profile[] values() {
57+
return _values;
58+
}
5259

5360
final int[] qmatLuma;
5461
final int[] qmatChroma;
@@ -66,6 +73,7 @@ private Profile(int[] qmatLuma, int[] qmatChroma, String fourcc, int bitrate, in
6673
this.firstQp = firstQp;
6774
this.lastQp = lastQp;
6875
}
76+
6977
};
7078

7179
protected Profile profile;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.