|
|
@ -49,6 +49,7 @@ function x = iAACoder3(AACSeq3, fNameOut) |
|
|
|
currFrameStop = currFrameStart + 2047; |
|
|
|
|
|
|
|
if i < 2 |
|
|
|
continue; |
|
|
|
frameF(:, 1) = iTNS(AACSeq3(i + 1).chl.stream, ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
|
AACSeq3(i + 1).chl.TNScoeffs); |
|
|
@ -58,22 +59,29 @@ function x = iAACoder3(AACSeq3, fNameOut) |
|
|
|
|
|
|
|
frameT = iFilterbank(frameF, AACSeq3(i+1).frameType, AACSeq3(i+1).winType); |
|
|
|
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); |
|
|
|
% |
|
|
|
% sfcL = decodeHuff(AACSeq3(i + 1).chl.sfc, 12, huffLUT); |
|
|
|
% sfcR = decodeHuff(AACSeq3(i + 1).chr.sfc, 12, huffLUT); |
|
|
|
|
|
|
|
frameF(:, 1) = iAACquantizer(AACSeq3(i + 1).chl.stream, ... |
|
|
|
AACSeq3(i + 1).chl.sfc, ... |
|
|
|
AACSeq3(i + 1).chl.G, ... |
|
|
|
AACSeq3(i+1).frameType); |
|
|
|
frameF(:, 2) = iAACquantizer(AACSeq3(i + 1).chr.stream, ... |
|
|
|
AACSeq3(i + 1).chr.sfc, ... |
|
|
|
AACSeq3(i + 1).chr.G, ... |
|
|
|
AACSeq3(i+1).frameType); |
|
|
|
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); |
|
|
|
|
|
|
|
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) = iTNS(frameF(:, 1), ... |
|
|
|
AACSeq3(i+1).frameType, ... |
|
|
@ -86,6 +94,8 @@ function x = iAACoder3(AACSeq3, fNameOut) |
|
|
|
end |
|
|
|
|
|
|
|
decodedAudio(currFrameStart:currFrameStop, :) = decodedAudio(currFrameStart:currFrameStop, :) + frameT; |
|
|
|
|
|
|
|
clearvars sfcDeHuffL sfcDeHuffR |
|
|
|
end |
|
|
|
|
|
|
|
audiowrite(fNameOut, decodedAudio, 48000); |
|
|
|