|
|
@ -48,50 +48,39 @@ function x = iAACoder3(AACSeq3, fNameOut) |
|
|
|
currFrameStart = i * 1024 + 1; |
|
|
|
currFrameStop = currFrameStart + 2047; |
|
|
|
|
|
|
|
if i < 2 |
|
|
|
continue; |
|
|
|
frameF(:, 1) = iTNS(AACSeq3(i + 1).chl.stream, ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
|
AACSeq3(i + 1).chl.TNScoeffs); |
|
|
|
frameF(:, 2) = iTNS(AACSeq3(i + 1).chr.stream, ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
|
AACSeq3(i + 1).chr.TNScoeffs); |
|
|
|
SL = decodeHuff(AACSeq3(i + 1).chl.stream, ... |
|
|
|
AACSeq3(i + 1).chl.codebook, huffLUT); |
|
|
|
SR = decodeHuff(AACSeq3(i + 1).chr.stream, ... |
|
|
|
AACSeq3(i + 1).chr.codebook, huffLUT); |
|
|
|
|
|
|
|
frameT = iFilterbank(frameF, AACSeq3(i+1).frameType, AACSeq3(i+1).winType); |
|
|
|
sfcL = decodeHuff(AACSeq3(i + 1).chl.sfc, 12, huffLUT)'; |
|
|
|
sfcR = decodeHuff(AACSeq3(i + 1).chr.sfc, 12, huffLUT)'; |
|
|
|
if strcmp(AACSeq3(i+1).frameType, 'ESH') |
|
|
|
sfcDeHuffL(42, 8) = 0; |
|
|
|
sfcDeHuffR(42, 8) = 0; |
|
|
|
sfcDeHuffL(2:end, :) = reshape(sfcL, [41 8]); |
|
|
|
sfcDeHuffR(2:end, :) = reshape(sfcR, [41 8]); |
|
|
|
sfcDeHuffL(1, :) = AACSeq3(i+1).chl.G; |
|
|
|
sfcDeHuffR(1, :) = AACSeq3(i+1).chr.G; |
|
|
|
else |
|
|
|
SL = decodeHuff(AACSeq3(i + 1).chl.stream, ... |
|
|
|
AACSeq3(i + 1).chl.codebook, huffLUT); |
|
|
|
SR = decodeHuff(AACSeq3(i + 1).chr.stream, ... |
|
|
|
AACSeq3(i + 1).chr.codebook, huffLUT); |
|
|
|
sfcDeHuffL = [AACSeq3(i+1).chl.G; sfcL]; |
|
|
|
sfcDeHuffR = [AACSeq3(i+1).chr.G; sfcR]; |
|
|
|
end |
|
|
|
|
|
|
|
sfcL = decodeHuff(AACSeq3(i + 1).chl.sfc, 12, huffLUT)'; |
|
|
|
sfcR = decodeHuff(AACSeq3(i + 1).chr.sfc, 12, huffLUT)'; |
|
|
|
if strcmp(AACSeq3(i+1).frameType, 'ESH') |
|
|
|
sfcDeHuffL(42, 8) = 0; |
|
|
|
sfcDeHuffR(42, 8) = 0; |
|
|
|
sfcDeHuffL(2:end, :) = reshape(sfcL, [41 8]); |
|
|
|
sfcDeHuffR(2:end, :) = reshape(sfcR, [41 8]); |
|
|
|
sfcDeHuffL(1, :) = AACSeq3(i+1).chl.G; |
|
|
|
sfcDeHuffR(1, :) = AACSeq3(i+1).chr.G; |
|
|
|
else |
|
|
|
sfcDeHuffL = [AACSeq3(i+1).chl.G; sfcL]; |
|
|
|
sfcDeHuffR = [AACSeq3(i+1).chr.G; sfcR]; |
|
|
|
end |
|
|
|
frameF(:, 1) = iAACquantizer(SL, sfcDeHuffL, ... |
|
|
|
AACSeq3(i + 1).chl.G, AACSeq3(i+1).frameType); |
|
|
|
frameF(:, 2) = iAACquantizer(SR, sfcDeHuffR, ... |
|
|
|
AACSeq3(i + 1).chr.G, AACSeq3(i+1).frameType); |
|
|
|
|
|
|
|
frameF(:, 1) = iAACquantizer(SL, sfcDeHuffL, ... |
|
|
|
AACSeq3(i + 1).chl.G, AACSeq3(i+1).frameType); |
|
|
|
frameF(:, 2) = iAACquantizer(SR, sfcDeHuffR, ... |
|
|
|
AACSeq3(i + 1).chr.G, AACSeq3(i+1).frameType); |
|
|
|
frameF(:, 1) = iTNS(frameF(:, 1), ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
|
AACSeq3(i + 1).chl.TNScoeffs); |
|
|
|
frameF(:, 2) = iTNS(frameF(:, 2), ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
|
AACSeq3(i + 1).chr.TNScoeffs); |
|
|
|
|
|
|
|
frameF(:, 1) = iTNS(frameF(:, 1), ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
|
AACSeq3(i + 1).chl.TNScoeffs); |
|
|
|
frameF(:, 2) = iTNS(frameF(:, 2), ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
|
AACSeq3(i + 1).chr.TNScoeffs); |
|
|
|
frameT = iFilterbank(frameF, AACSeq3(i+1).frameType, AACSeq3(i+1).winType); |
|
|
|
|
|
|
|
frameT = iFilterbank(frameF, AACSeq3(i+1).frameType, AACSeq3(i+1).winType); |
|
|
|
end |
|
|
|
|
|
|
|
decodedAudio(currFrameStart:currFrameStop, :) = decodedAudio(currFrameStart:currFrameStop, :) + frameT; |
|
|
|
|
|
|
|