ltpData2Present = false;
}
/* ========== decoding ========== */
public void decode(BitStream in, DecoderConfig conf, boolean commonWindow) throws AACException {
final SampleFrequency sf = conf.getSampleFrequency();
if(sf.equals(SampleFrequency.SAMPLE_FREQUENCY_NONE)) throw new AACException("invalid sample frequency");
in.skipBit(); //reserved
windowSequence = WindowSequence.forInt(in.readBits(2));
windowShape[PREVIOUS] = windowShape[CURRENT];
windowShape[CURRENT] = in.readBit();
windowGroupCount = 1;
windowGroupLength[0] = 1;
if(windowSequence.equals(WindowSequence.EIGHT_SHORT_SEQUENCE)) {
maxSFB = in.readBits(4);
int i;
for(i = 0; i<7; i++) {
if(in.readBool()) windowGroupLength[windowGroupCount-1]++;
else {
windowGroupCount++;
windowGroupLength[windowGroupCount-1] = 1;
}
}
windowCount = 8;
swbOffsets = SWB_OFFSET_SHORT_WINDOW[sf.getIndex()];
swbCount = SWB_SHORT_WINDOW_COUNT[sf.getIndex()];
predictionDataPresent = false;
}
else {
maxSFB = in.readBits(6);
windowCount = 1;
swbOffsets = SWB_OFFSET_LONG_WINDOW[sf.getIndex()];
swbCount = SWB_LONG_WINDOW_COUNT[sf.getIndex()];
predictionDataPresent = in.readBool();
if(predictionDataPresent) readPredictionData(in, conf.getProfile(), sf, commonWindow);
}
}