Browse Source

Fix SSC's calculation of energy estimations

master
Apostolos Fanakis 6 years ago
parent
commit
ebaf623ab4
  1. 4
      Level_1/SSC.m
  2. 2
      Level_2/SSC.m

4
Level_1/SSC.m

@ -3,7 +3,7 @@ function frameType = SSC(~, nextFrameT, prevFrameType)
% Usage frameType = SSC(frameT, nextFrameT, prevFrameType), where: % Usage frameType = SSC(frameT, nextFrameT, prevFrameType), where:
% Inputs % Inputs
% - frameT is a frame in the time domain, containing both channels of % - frameT is a frame in the time domain, containing both channels of
% the audio stored in an array of dimensions 2048X2 % the audio stored in an array of dimensions 2048X2
% - nextFrameT is the next frame in the time domain, containing both % - nextFrameT is the next frame in the time domain, containing both
% channels of the audio stored in an array of dimensions 2048X2 % channels of the audio stored in an array of dimensions 2048X2
% - prevFrameType is the type of the previous frame in string % - prevFrameType is the type of the previous frame in string
@ -33,7 +33,7 @@ function frameType = SSC(~, nextFrameT, prevFrameType)
channelFrameType = {'nan', 'nan'}; channelFrameType = {'nan', 'nan'};
for channel = 1:2 for channel = 1:2
% Calculates sub-frame energy estimation % Calculates sub-frame energy estimation
[subFrames, ~] = buffer(nextFrameT(449:end - 448, channel), 256, 128, 'nodelay'); [subFrames, ~] = buffer(nextFrameT(577:end - 448, channel), 128, 0, 'nodelay');
energyEstimations = sum(subFrames .^ 2, 1); energyEstimations = sum(subFrames .^ 2, 1);
% Calculates the ratio of the sub-frame energy to the average energy of % Calculates the ratio of the sub-frame energy to the average energy of

2
Level_2/SSC.m

@ -33,7 +33,7 @@ function frameType = SSC(~, nextFrameT, prevFrameType)
channelFrameType = {'nan', 'nan'}; channelFrameType = {'nan', 'nan'};
for channel = 1:2 for channel = 1:2
% Calculates sub-frame energy estimation % Calculates sub-frame energy estimation
[subFrames, ~] = buffer(nextFrameT(449:end - 448, channel), 256, 128, 'nodelay'); [subFrames, ~] = buffer(nextFrameT(577:end - 448, channel), 128, 0, 'nodelay');
energyEstimations = sum(subFrames .^ 2, 1); energyEstimations = sum(subFrames .^ 2, 1);
% Calculates the ratio of the sub-frame energy to the average energy of % Calculates the ratio of the sub-frame energy to the average energy of

Loading…
Cancel
Save