📄 decimation.m
字号:
function [DFlags, DTonal_list, DNon_tonal_list] = Decimation(Tonal_list, ... Non_tonal_list, Flags)%% Authors: Fabien A.P. Petitcolas (fapp2@cl.cam.ac.uk)% Teddy Furon (furont@thmulti.com)%% Corrections:% Michael Arnold (arnold@igd.fhg.de)% Fraunhofer Institute for Computer Graphics (IGD) % % References: % [1] Information technology -- Coding of moving pictures and associated % audio for digital storage media at up to 1,5 Mbits/s -- Part3: audio. % British standard. BSI, London. October 1993.Implementation of % ISO/IEC 11172-3:1993. BSI, London. First edition 1993-08-01. %% Legal notice: % This computer program is based on ISO/IEC 11172-3:1993, Information % technology -- Coding of moving pictures and associated audio for digital % storage media at up to about 1,5 Mbit/s -- Part 3: Audio, with the % permission of ISO. Copies of this standards can be purchased from the % British Standards Institution, 389 Chiswick High Road, GB-London W4 4AL, % Telephone:+ 44 181 996 90 00, Telefax:+ 44 181 996 74 00 or from ISO, % postal box 56, CH-1211 Geneva 20, Telephone +41 22 749 0111, Telefax % +4122 734 1079. Copyright remains with ISO. %----------------------------------------------------------------------------%% [DFlags, DTonal_list, DNon_tonal_list]= ...% Decimation(Tonal_list, Non_tonal_list, Flags)%% Components which are below the auditory threshold OR are less than one % half of a critical band width from a neighbouring component are% eliminated [1, pp. 113].%% -- INPUT --% Flags: Vector of size FFT_SIZE/2 containing the markers TONAL or NON_TONAL. %% Tonal_list: Matrix with two columns for the TONAL components. The first% column are the frequency indexes (INDEX) in linear scale, the second one% is the sound pressure level (SPL) [dB].%% Non_tonal_list: Matrix with two columns for the NON_TONAL components. The% meaning of the columns is the same as in the Tonal_list case.%% -- OUTPUT --% DFlags: Vector of size FFT_SIZE/2 containing the decimated markers TONAL or% NON_TONAL.%% DTonal_list: Matrix with two columns for the decimated TONAL components. The% meaning of the columns is the same as in the Tonal_list case. %% DNon_tonal_list: Matrix with two columns for the decimated NON_TONAL% components. The meaning of the columns is the same as in the Tonal_list case.% -------------%% See also Find_tonal_components%---------------------------------------------------------------------------- global SPL INDEX ATH IRRELEVANT BARK Map TH% Preset decimated FlagsDFlags = Flags; % Tonal or non-tonal components are not considered if lower than the absolute% threshold of hearing found in TH(:, ATH). pp. 113 Step 5a % -- Non tonal case --% Preset decimated non tonal listDNon_tonal_list = Non_tonal_list; if not(isempty(Non_tonal_list)) % Map linear frequency index to non-linear to index absolute threshold in % table TH. K = Non_tonal_list(:, SPL) < TH(Map(Non_tonal_list(:, INDEX)), ATH); Kf = find(K)'; if Kf, % Set irrelevant flag for non-tonal components. DFlags(Non_tonal_list(Kf, INDEX)) = IRRELEVANT; % Delete rows in the non-tonal-list for the irrelevant non tonal % components. DNon_tonal_list(Kf, :) = []; end end % --------------------% -- Tonal case -- % Part I% Preset decimated tonal listDTonal_list = Tonal_list; if not(isempty(Tonal_list)) % Map linear frequency index to non-linear to index absolute threshold in % table TH. K = Tonal_list(:, SPL) < TH(Map(Tonal_list(:, INDEX)), ATH); Kf = find(K)'; if Kf, % Set irrelevant flag for tonal components. DFlags(Tonal_list(Kf, INDEX)) = IRRELEVANT; % Delete rows containing information about irrelevant tonal components. DTonal_list(Kf,:) = []; end end% Part II % Eliminate tonal components that are less than one half of critical band% width from a neighbouring component AND their SPL is lower % (pp. 113 Step 5b). if not(isempty(DTonal_list)) i = 1; while (i < length(DTonal_list(:, 1))), k = DTonal_list(i, INDEX); k_next = DTonal_list(i + 1, INDEX); if (TH(Map(k_next), BARK) - TH(Map(k), BARK) < 0.5) % Shortening of DTonal_list. No increment of loop index in order to % test the next component of already reduced list. if (DTonal_list(i, SPL) < DTonal_list(i + 1, SPL)) DTonal_list = ... DTonal_list([1:i - 1, i + 1:length(DTonal_list(:, 1))], :); DFlags(k) = IRRELEVANT; else DTonal_list = ... DTonal_list([1:i, i + 2:length(DTonal_list(:, 1))], :); DFlags(k_next) = IRRELEVANT; end % NEW code for index increment in order to implement sliding window. % Increment loop index i only if tonal components are not within a range % of 0.5 BARK! else i = i + 1; end % OLD code % i = i + 1; end % End loop over DTonal_listend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -