Browse Source

Cleanup

master
Apostolos Fanakis 6 years ago
parent
commit
8401137f1a
  1. 11
      Level_1/AACoder1.m
  2. 2
      Level_1/SSC.m
  3. 29
      Level_1/demoAAC1.m
  4. 6
      Level_1/filterbank.m
  5. 6
      Level_1/iFilterbank.m
  6. 11
      Level_2/AACoder2.m
  7. 2
      Level_2/SSC.m
  8. 4
      Level_2/TNS.m
  9. 29
      Level_2/demoAAC2.m
  10. 6
      Level_2/filterbank.m
  11. 6
      Level_2/iFilterbank.m
  12. 2
      Level_3/SSC.m
  13. 4
      Level_3/TNS.m
  14. 29
      Level_3/demoAAC3.m
  15. BIN
      Level_3/encoded.mat
  16. 6
      Level_3/filterbank.m
  17. 6
      Level_3/iFilterbank.m

11
Level_1/AACoder1.m

@ -47,15 +47,4 @@ function AACSeq1 = AACoder1(fNameIn)
AACSeq1(i + 1).chl.frameF = frameF(:, 1); AACSeq1(i + 1).chl.frameF = frameF(:, 1);
AACSeq1(i + 1).chr.frameF = frameF(:, 2); AACSeq1(i + 1).chr.frameF = frameF(:, 2);
end end
if false
[idx,label] = grp2idx(sort(frameTypes));
hist(idx,unique(idx));
set(gca,'xTickLabel',label)
sum(idx(:) == 1)
sum(idx(:) == 2)
sum(idx(:) == 3)
sum(idx(:) == 4)
end
end end

2
Level_1/SSC.m

@ -64,7 +64,7 @@ function frameType = SSC(~, nextFrameT, prevFrameType)
% Joins decision for both channels % Joins decision for both channels
if strcmp(channelFrameType{1}, 'nan') || strcmp(channelFrameType{2}, 'nan') if strcmp(channelFrameType{1}, 'nan') || strcmp(channelFrameType{2}, 'nan')
error('SSC, l[73]: Internal error occurred!') error('SSC, l[67]: Internal error occurred!')
end end
if strcmp(channelFrameType{1}, 'OLS') if strcmp(channelFrameType{1}, 'OLS')
frameType = channelFrameType{2}; frameType = channelFrameType{2};

29
Level_1/demoAAC1.m

@ -15,34 +15,7 @@ function SNR = demoAAC1(fNameIn, fNameOut)
[audioData, ~] = audioread(fNameIn); [audioData, ~] = audioread(fNameIn);
% figure()
% plot(audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1))
% for frame = 1:length(AACSeq1)
% if strcmp(AACSeq1(frame).frameType, 'LSS') || strcmp(AACSeq1(frame).frameType, 'LPS')
% % Add lines
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]);
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]);
% % Set properties of lines
% set([h1 h2],'Color','y','LineWidth',2)
% % Add a patch
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'y')
% elseif strcmp(AACSeq1(frame).frameType, 'ESH')
% % Add lines
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]);
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]);
% % Set properties of lines
% set([h1 h2],'Color','r','LineWidth',2)
% % Add a patch
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'r')
% end
% end
% set(gca,'children',flipud(get(gca,'children')))
%
% figure()
% plot(audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2))
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 = 10*log10((sum(audioData(1025:length(decodedAudio)-1024, :)) .^ 2) ./ ... SNR = snr(audioData(1025:length(decodedAudio)-1024, :), audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :));
(sum(audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :)) .^ 2));
end end

6
Level_1/filterbank.m

@ -48,7 +48,7 @@ function frameF = filterbank(frameT, frameType, winType)
elseif strcmp(winType, 'SIN') elseif strcmp(winType, 'SIN')
frameT = bsxfun(@times, frameT, sinWindowLong); frameT = bsxfun(@times, frameT, sinWindowLong);
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[51]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);
@ -62,7 +62,7 @@ function frameF = filterbank(frameT, frameType, winType)
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)); frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end));
frameT(1601:end, :) = 0; frameT(1601:end, :) = 0;
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[65]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);
@ -76,7 +76,7 @@ function frameF = filterbank(frameT, frameType, winType)
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)); frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128));
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)); frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end));
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[79]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);

6
Level_1/iFilterbank.m

@ -50,7 +50,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
elseif strcmp(winType, 'SIN') elseif strcmp(winType, 'SIN')
frameT = bsxfun(@times, frameT, sinWindowLong); frameT = bsxfun(@times, frameT, sinWindowLong);
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[53]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'LSS') elseif strcmp(frameType, 'LSS')
frameT = imdct4(frameF); frameT = imdct4(frameF);
@ -64,7 +64,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)); frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end));
frameT(1601:end, :) = 0; frameT(1601:end, :) = 0;
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[67]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'LPS') elseif strcmp(frameType, 'LPS')
frameT = imdct4(frameF); frameT = imdct4(frameF);
@ -78,7 +78,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)); frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128));
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)); frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end));
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[81]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'ESH') elseif strcmp(frameType, 'ESH')
for channel=1:2 for channel=1:2

11
Level_2/AACoder2.m

@ -54,15 +54,4 @@ function AACSeq2 = AACoder2(fNameIn)
AACSeq2(i + 1).chl.frameF = frameF(:, 1); AACSeq2(i + 1).chl.frameF = frameF(:, 1);
AACSeq2(i + 1).chr.frameF = frameF(:, 2); AACSeq2(i + 1).chr.frameF = frameF(:, 2);
end end
if false
[idx,label] = grp2idx(sort(frameTypes));
hist(idx,unique(idx));
set(gca,'xTickLabel',label)
sum(idx(:) == 1)
sum(idx(:) == 2)
sum(idx(:) == 3)
sum(idx(:) == 4)
end
end end

2
Level_2/SSC.m

@ -64,7 +64,7 @@ function frameType = SSC(~, nextFrameT, prevFrameType)
% Joins decision for both channels % Joins decision for both channels
if strcmp(channelFrameType{1}, 'nan') || strcmp(channelFrameType{2}, 'nan') if strcmp(channelFrameType{1}, 'nan') || strcmp(channelFrameType{2}, 'nan')
error('SSC, l[73]: Internal error occurred!') error('SSC, l[67]: Internal error occurred!')
end end
if strcmp(channelFrameType{1}, 'OLS') if strcmp(channelFrameType{1}, 'OLS')
frameType = channelFrameType{2}; frameType = channelFrameType{2};

4
Level_2/TNS.m

@ -65,7 +65,7 @@ function [frameFout, TNScoeffs] = TNS(frameFin, frameType)
% Filters MDCT coefficients % Filters MDCT coefficients
if ~isstable(1, quantizedLinPredCoeff) if ~isstable(1, quantizedLinPredCoeff)
error('TNS, l[79]: Inverse filter not stable!'); error('TNS, l[68]: Inverse filter not stable!');
else else
TNScoeffs = quantizedLinPredCoeff(2:end)'; TNScoeffs = quantizedLinPredCoeff(2:end)';
frameFout = filter(quantizedLinPredCoeff, 1, frameFin); frameFout = filter(quantizedLinPredCoeff, 1, frameFin);
@ -110,7 +110,7 @@ function [frameFout, TNScoeffs] = TNS(frameFin, frameType)
% Filters MDCT coefficients % Filters MDCT coefficients
if ~isstable(1, quantizedLinPredCoeff) if ~isstable(1, quantizedLinPredCoeff)
error('TNS, l[79]: Inverse filter not stable!'); error('TNS, l[113]: Inverse filter not stable!');
else else
TNScoeffs((subFrameIndex - 1) * 4 + 1:subFrameIndex * 4) = quantizedLinPredCoeff(2:end); TNScoeffs((subFrameIndex - 1) * 4 + 1:subFrameIndex * 4) = quantizedLinPredCoeff(2:end);
frameFout((subFrameIndex - 1) * 128 + 1:subFrameIndex * 128) = ... frameFout((subFrameIndex - 1) * 128 + 1:subFrameIndex * 128) = ...

29
Level_2/demoAAC2.m

@ -15,34 +15,7 @@ function SNR = demoAAC2(fNameIn, fNameOut)
[audioData, ~] = audioread(fNameIn); [audioData, ~] = audioread(fNameIn);
% figure()
% plot(audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1))
% for frame = 1:length(AACSeq1)
% if strcmp(AACSeq1(frame).frameType, 'LSS') || strcmp(AACSeq1(frame).frameType, 'LPS')
% % Add lines
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]);
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]);
% % Set properties of lines
% set([h1 h2],'Color','y','LineWidth',2)
% % Add a patch
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'y')
% elseif strcmp(AACSeq1(frame).frameType, 'ESH')
% % Add lines
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]);
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]);
% % Set properties of lines
% set([h1 h2],'Color','r','LineWidth',2)
% % Add a patch
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'r')
% end
% end
% set(gca,'children',flipud(get(gca,'children')))
%
% figure()
% plot(audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2))
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 = 10*log10((sum(audioData(1025:length(decodedAudio)-1024, :)) .^ 2) ./ ... SNR = snr(audioData(1025:length(decodedAudio)-1024, :), audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :));
(sum(audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :)) .^ 2));
end end

6
Level_2/filterbank.m

@ -48,7 +48,7 @@ function frameF = filterbank(frameT, frameType, winType)
elseif strcmp(winType, 'SIN') elseif strcmp(winType, 'SIN')
frameT = bsxfun(@times, frameT, sinWindowLong); frameT = bsxfun(@times, frameT, sinWindowLong);
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[51]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);
@ -62,7 +62,7 @@ function frameF = filterbank(frameT, frameType, winType)
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)); frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end));
frameT(1601:end, :) = 0; frameT(1601:end, :) = 0;
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[65]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);
@ -76,7 +76,7 @@ function frameF = filterbank(frameT, frameType, winType)
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)); frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128));
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)); frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end));
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[79]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);

6
Level_2/iFilterbank.m

@ -50,7 +50,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
elseif strcmp(winType, 'SIN') elseif strcmp(winType, 'SIN')
frameT = bsxfun(@times, frameT, sinWindowLong); frameT = bsxfun(@times, frameT, sinWindowLong);
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[53]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'LSS') elseif strcmp(frameType, 'LSS')
frameT = imdct4(frameF); frameT = imdct4(frameF);
@ -64,7 +64,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)); frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end));
frameT(1601:end, :) = 0; frameT(1601:end, :) = 0;
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[67]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'LPS') elseif strcmp(frameType, 'LPS')
frameT = imdct4(frameF); frameT = imdct4(frameF);
@ -78,7 +78,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)); frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128));
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)); frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end));
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[81]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'ESH') elseif strcmp(frameType, 'ESH')
for channel=1:2 for channel=1:2

2
Level_3/SSC.m

@ -64,7 +64,7 @@ function frameType = SSC(~, nextFrameT, prevFrameType)
% Joins decision for both channels % Joins decision for both channels
if strcmp(channelFrameType{1}, 'nan') || strcmp(channelFrameType{2}, 'nan') if strcmp(channelFrameType{1}, 'nan') || strcmp(channelFrameType{2}, 'nan')
error('SSC, l[73]: Internal error occurred!') error('SSC, l[67]: Internal error occurred!')
end end
if strcmp(channelFrameType{1}, 'OLS') if strcmp(channelFrameType{1}, 'OLS')
frameType = channelFrameType{2}; frameType = channelFrameType{2};

4
Level_3/TNS.m

@ -65,7 +65,7 @@ function [frameFout, TNScoeffs] = TNS(frameFin, frameType)
% Filters MDCT coefficients % Filters MDCT coefficients
if ~isstable(1, quantizedLinPredCoeff) if ~isstable(1, quantizedLinPredCoeff)
error('TNS, l[79]: Inverse filter not stable!'); error('TNS, l[68]: Inverse filter not stable!');
else else
TNScoeffs = quantizedLinPredCoeff(2:end)'; TNScoeffs = quantizedLinPredCoeff(2:end)';
frameFout = filter(quantizedLinPredCoeff, 1, frameFin); frameFout = filter(quantizedLinPredCoeff, 1, frameFin);
@ -110,7 +110,7 @@ function [frameFout, TNScoeffs] = TNS(frameFin, frameType)
% Filters MDCT coefficients % Filters MDCT coefficients
if ~isstable(1, quantizedLinPredCoeff) if ~isstable(1, quantizedLinPredCoeff)
error('TNS, l[79]: Inverse filter not stable!'); error('TNS, l[113]: Inverse filter not stable!');
else else
TNScoeffs((subFrameIndex - 1) * 4 + 1:subFrameIndex * 4) = quantizedLinPredCoeff(2:end); TNScoeffs((subFrameIndex - 1) * 4 + 1:subFrameIndex * 4) = quantizedLinPredCoeff(2:end);
frameFout((subFrameIndex - 1) * 128 + 1:subFrameIndex * 128) = ... frameFout((subFrameIndex - 1) * 128 + 1:subFrameIndex * 128) = ...

29
Level_3/demoAAC3.m

@ -20,34 +20,7 @@ function [SNR, bitrate, compression] = demoAAC3(fNameIn, fNameOut, frameAACoded)
[audioData, ~] = audioread(fNameIn); [audioData, ~] = audioread(fNameIn);
% figure()
% plot(audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1))
% for frame = 1:length(AACSeq3)
% if strcmp(AACSeq3(frame).frameType, 'LSS') || strcmp(AACSeq3(frame).frameType, 'LPS')
% % Add lines
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]);
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]);
% % Set properties of lines
% set([h1 h2],'Color','y','LineWidth',2)
% % Add a patch
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'y')
% elseif strcmp(AACSeq3(frame).frameType, 'ESH')
% % Add lines
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]);
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]);
% % Set properties of lines
% set([h1 h2],'Color','r','LineWidth',2)
% % Add a patch
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'r')
% end
% end
% set(gca,'children',flipud(get(gca,'children')))
%
% figure()
% plot(audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2))
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 = 10*log10((sum(audioData(1025:length(decodedAudio)-1024, :)) .^ 2) ./ ... SNR = snr(audioData(1025:length(decodedAudio)-1024, :), audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, :));
(sum(audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :)) .^ 2));
end end

BIN
Level_3/encoded.mat

Binary file not shown.

6
Level_3/filterbank.m

@ -48,7 +48,7 @@ function frameF = filterbank(frameT, frameType, winType)
elseif strcmp(winType, 'SIN') elseif strcmp(winType, 'SIN')
frameT = bsxfun(@times, frameT, sinWindowLong); frameT = bsxfun(@times, frameT, sinWindowLong);
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[51]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);
@ -62,7 +62,7 @@ function frameF = filterbank(frameT, frameType, winType)
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)); frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end));
frameT(1601:end, :) = 0; frameT(1601:end, :) = 0;
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[65]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);
@ -76,7 +76,7 @@ function frameF = filterbank(frameT, frameType, winType)
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)); frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128));
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)); frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end));
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[79]: Unsupported window type input!')
end end
frameF = mdct4(frameT); frameF = mdct4(frameT);

6
Level_3/iFilterbank.m

@ -50,7 +50,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
elseif strcmp(winType, 'SIN') elseif strcmp(winType, 'SIN')
frameT = bsxfun(@times, frameT, sinWindowLong); frameT = bsxfun(@times, frameT, sinWindowLong);
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[53]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'LSS') elseif strcmp(frameType, 'LSS')
frameT = imdct4(frameF); frameT = imdct4(frameF);
@ -64,7 +64,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)); frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end));
frameT(1601:end, :) = 0; frameT(1601:end, :) = 0;
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[67]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'LPS') elseif strcmp(frameType, 'LPS')
frameT = imdct4(frameF); frameT = imdct4(frameF);
@ -78,7 +78,7 @@ function frameT = iFilterbank(frameF, frameType, winType)
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)); frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128));
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)); frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end));
else else
error('filterbank, l[20]: Unsupported window type input!') error('filterbank, l[81]: Unsupported window type input!')
end end
elseif strcmp(frameType, 'ESH') elseif strcmp(frameType, 'ESH')
for channel=1:2 for channel=1:2

Loading…
Cancel
Save