|
@ -16,11 +16,26 @@ function [SNR, bitrate, compression] = demoAAC3(fNameIn, fNameOut, frameAACoded) |
|
|
% the bitrate after it |
|
|
% the bitrate after it |
|
|
|
|
|
|
|
|
AACSeq3 = AACoder3(fNameIn, frameAACoded); |
|
|
AACSeq3 = AACoder3(fNameIn, frameAACoded); |
|
|
|
|
|
|
|
|
|
|
|
totalSize = 0; |
|
|
|
|
|
for frameIndex = 1:length(AACSeq3) |
|
|
|
|
|
totalSize = totalSize + 2; % frameType |
|
|
|
|
|
totalSize = totalSize + 2 * 4; % TNS coefficients |
|
|
|
|
|
totalSize = totalSize + length(AACSeq3(frameIndex).chl.G) * 4; |
|
|
|
|
|
totalSize = totalSize + length(AACSeq3(frameIndex).chr.G) * 4; |
|
|
|
|
|
totalSize = totalSize + length(AACSeq3(frameIndex).chl.sfc); |
|
|
|
|
|
totalSize = totalSize + length(AACSeq3(frameIndex).chr.sfc); |
|
|
|
|
|
totalSize = totalSize + length(AACSeq3(frameIndex).chl.stream); |
|
|
|
|
|
totalSize = totalSize + length(AACSeq3(frameIndex).chr.stream); |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
decodedAudio = iAACoder3(AACSeq3, fNameOut); |
|
|
decodedAudio = iAACoder3(AACSeq3, fNameOut); |
|
|
|
|
|
bitrate = totalSize / (length(decodedAudio) / 48000); |
|
|
|
|
|
|
|
|
[audioData, ~] = audioread(fNameIn); |
|
|
[audioData, ~] = audioread(fNameIn); |
|
|
|
|
|
compression = (length(audioData) * 64) / totalSize; |
|
|
|
|
|
|
|
|
snr(audioData(1025:length(decodedAudio)-1024, 1), audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1)) |
|
|
snr(audioData(1025:length(decodedAudio)-1024, 1), audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1)) |
|
|
snr(audioData(1025:length(decodedAudio)-1024, 2), audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2)) |
|
|
snr(audioData(1025:length(decodedAudio)-1024, 2), audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2)) |
|
|
SNR = snr(audioData(1025:length(decodedAudio)-1024, :), audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, :)); |
|
|
SNR = snr(audioData(1025:length(decodedAudio)-1024, :), audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :)); |
|
|
end |
|
|
end |
|
|