}
private void decodePulseData(BitStream in) throws AACException {
pulseCount = in.readBits(2)+1;
pulseStartSWB = in.readBits(6);
if(pulseStartSWB>=info.getSWBCount()) throw new AACException("pulse SWB out of range: "+pulseStartSWB+" > "+info.getSWBCount());
if(pulseOffset==null||pulseCount!=pulseOffset.length) {
//only reallocate if needed
pulseOffset = new int[pulseCount];
pulseAmp = new int[pulseCount];
}
pulseOffset[0] = info.getSWBOffsets()[pulseStartSWB];
pulseOffset[0] += in.readBits(5);
pulseAmp[0] = in.readBits(4);
for(int i = 1; i<pulseCount; i++) {
pulseOffset[i] = in.readBits(5)+pulseOffset[i-1];
if(pulseOffset[i]>1023) throw new AACException("pulse offset out of range: "+pulseOffset[0]);
pulseAmp[i] = in.readBits(4);
}
}