mirror of https://github.com/thesofproject/sof.git
Tools: Tune: SRC: Allow pass of desired gain to src_generate()
There's need to have a 0 dB gain SRC conversion matrix while earlier all defaulted to -1 dB. With this change the parameter cfg.gain can be used with src_generate() function. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
parent
91afe67ae5
commit
a0ff2bb277
|
@ -13,6 +13,7 @@ function src_generate(fs_in, fs_out, fs_inout, cfg);
|
|||
% profile - differentiate set with identifier, e.g. 'std'
|
||||
% quality - quality factor, usually 1.0
|
||||
% speed - optimize speed, gives higher RAM size, usually 0
|
||||
% gain - overal filter gain, defaults to -1 dB if empty
|
||||
%
|
||||
% If fs_inout matrix is omitted this script will compute coefficients
|
||||
% for all fs_in <-> fs_out combinations.
|
||||
|
@ -34,6 +35,7 @@ if nargin < 4
|
|||
cfg.profile = 'std';
|
||||
cfg.quality = 1.0;
|
||||
cfg.speed = 0;
|
||||
cfg.gain = -1;
|
||||
end
|
||||
if nargin < 3
|
||||
fs_inout = ones(length(fs_in), length(fs_out));
|
||||
|
@ -108,8 +110,8 @@ for b = 1:nfso
|
|||
m2 = 1;
|
||||
end
|
||||
fs3 = fs1*l1/m1;
|
||||
cnv1 = src_param(fs1, fs3, coef_bits, cfg.quality);
|
||||
cnv2 = src_param(fs3, fs2, coef_bits, cfg.quality);
|
||||
cnv1 = src_param(fs1, fs3, coef_bits, cfg.quality, cfg.gain);
|
||||
cnv2 = src_param(fs3, fs2, coef_bits, cfg.quality, cfg.gain);
|
||||
if (fs2 < fs1)
|
||||
% When decimating 1st stage passband can be limited
|
||||
% for wider transition band
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function cnv = src_param(fs1, fs2, coef_bits, q)
|
||||
function cnv = src_param(fs1, fs2, coef_bits, q, gain)
|
||||
|
||||
% src_param - get converter parameters
|
||||
%
|
||||
|
@ -9,6 +9,7 @@ function cnv = src_param(fs1, fs2, coef_bits, q)
|
|||
% coef_bits - word length identifier
|
||||
% q - quality scale filter bandwidth and stopband attenuation,
|
||||
% 1 is default
|
||||
% gain - overall gain of SRC, defaults to -1 (dB) if omitted
|
||||
%
|
||||
|
||||
% Copyright (c) 2016, Intel Corporation
|
||||
|
@ -44,6 +45,10 @@ function cnv = src_param(fs1, fs2, coef_bits, q)
|
|||
% Both give about -80 dB THD+N with 24 bit coefficients. With 16 bit
|
||||
% coefficients THD+N is limited to about -76 dB.
|
||||
|
||||
if nargin < 5
|
||||
gain = -1;
|
||||
end
|
||||
|
||||
if nargin < 4
|
||||
q = 1.0;
|
||||
end
|
||||
|
@ -62,7 +67,8 @@ cnv.c_sb = 0.5; % Start stopband at Fs/2
|
|||
cnv.rs = 70; % Stopband attenuation in dB
|
||||
cnv.rp = 0.1; % Passband ripple in dB
|
||||
cnv.rp_tot = 0.1; % Max +/- passband ripple allowed, used in test script only
|
||||
cnv.gain = -1; % Gain in decibels at 0 Hz
|
||||
cnv.gain = gain; % Gain in decibels at 0 Hz
|
||||
|
||||
|
||||
%% Constrain sub-filter lengths. Make subfilters lengths multiple of four
|
||||
% is a good assumption for processors.
|
||||
|
|
Loading…
Reference in New Issue