Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/audio/src/src.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -196,6 +196,7 @@ int src_buffer_lengths(struct src_param *a, int fs_in, int fs_out, int nch,
* there is no equation known for minimum size.
*/
a->sbuf_length = 2 * nch * stage1->blk_out * r1;
a->sbuf_length += a->sbuf_length >> 3;
}

a->src_multich = a->fir_s1 + a->fir_s2 + a->out_s1 + a->out_s2;
Expand DownExpand Up@@ -855,7 +856,7 @@ static int src_get_copy_limits(struct comp_data *cd,
sp->blk_out = sp->stage1_times * s1->blk_out;
}

if (sp->blk_in == 0 || sp->blk_out == 0)
if (sp->blk_in == 0 && sp->blk_out == 0)
return -EIO;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/audio/src/src_generic.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -408,7 +408,7 @@ void src_polyphase_stage_cir_s16(struct src_stage_prm *s)
n_min = (m < n_min) ? m : n_min;
m -= n_min;
for (i = 0; i < n_min; i++) {
*y_wptr = Q_SHIFT_RND(*fir->out_rp, 31, 15);
*y_wptr = sat_int16(Q_SHIFT_RND(*fir->out_rp, 31, 15));
y_wptr++;
fir->out_rp++;
}
Expand Down
25 changes: 17 additions & 8 deletions tools/test/audio/src_test.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,8 +7,8 @@
%
% bits_in - input word length
% bits_out - output word length
% fs_in - vector of rates in
% fs_out - vector of rates out
% fs_in - vector of rates in, default 8 to 192 kHz
% fs_out - vector of rates out, default 8 to 192 kHz
% full_test - set to 0 for chirp only, 1 for all, default 1
% show_plots - set to 1 to see plots, default 0
%
Expand All@@ -27,26 +27,32 @@
mkdir_check('reports');

%% Defaults for call parameters
default_in = [ 8 11.025 12 16 18.9 22.050 24 32 37.8 44.1 48 50 64 88.2 96 176.4 192] * 1e3;
default_out = [ 8 11.025 12 16 22.05 24 32 44.1 48 50 64 88.2 96 176.4 192] * 1e3;
if nargin < 1
bits_in = 32;
end
if nargin < 2
bits_out = 32;
end
if nargin < 3
fs_in_list = [ 8 11.025 12 16 18.9 22.050 24 32 37.8 44.1 48 ...
50 64 88.2 96 176.4 192] * 1e3;
fs_in_list = default_in;
end
if nargin < 4
fs_out_list = [ 8 11.025 12 16 22.05 24 32 44.1 48 ...
50 64 88.2 96 176.4 192] * 1e3;
fs_out_list = default_out;
end
if nargin < 5
full_test = 1;
end
if nargin < 6
show_plots = 0;
end
if isempty(fs_in_list)
fs_in_list = default_in;
end
if isempty(fs_out_list)
fs_out_list = default_out;
end

%% Generic test pass/fail criteria
% Note that AAP and AIP are relaxed a bit from THD+N due to inclusion
Expand DownExpand Up@@ -413,7 +419,9 @@
%% Analyze
test.fs = t.fs2;
test = chirp_test_analyze(test);
src_test_result_print(t, 'Chirp', 'chirpf');
if test.fail >= 0
src_test_result_print(t, 'Chirp', 'chirpf');
end

% Delete files unless e.g. debugging and need data to run
delete_check(t.files_delete, test.fn_in);
Expand DownExpand Up@@ -456,13 +464,14 @@
function test = test_run_src(test, t)
test.fs_in = test.fs1;
test.fs_out = test.fs2;
test.extra_opts = '-C 300000'; % Limit to 5 min max, assume 1 ms scheduling
delete_check(1, test.fn_out);
test = test_run(test);
end

function src_test_result_print(t, testverbose, testacronym, ph)
tstr = sprintf('%s SRC %d, %d', testverbose, t.fs1, t.fs2);
if nargin > 3
if nargin > 3 && ~isempty(ph)
title(ph, tstr);
else
title(tstr);
Expand Down
6 changes: 5 additions & 1 deletion tools/test/audio/std_utils/aap_test_measure.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,8 @@
%% Reference: AES17 6.6.6 Attenuation of alias products
% http://www.aes.org/publications/standards/

debug = 0;

%% Load output file
[x, nx] = load_test_output(test);
if nx == 0
Expand All@@ -21,7 +23,9 @@
win = hamming(nt_use);
m0 = zeros(test.nf,1);
for n=1:test.nf
fprintf('Measuring %.0f Hz ...\n', test.f(n));
if debug
fprintf('Measuring %.0f Hz ...\n', test.f(n));
end
i1 = d+(n-1)*nt+nt_skip;
i2 = i1+nt_use-1;
m0(n) = level_dbfs(x(i1:i2).*win);
Expand Down
6 changes: 5 additions & 1 deletion tools/test/audio/std_utils/aip_test_measure.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,8 @@
%% Reference: AES17 6.6.7 Attenuation of image products
% http://www.aes.org/publications/standards/

debug = 0;

%% Load output file
[x, nx] = load_test_output(test);
if nx == 0
Expand All@@ -25,7 +27,9 @@
b_lpf = stdlpf_get(test.fu, test.fs); % Get LPF coef
b_hpf = stdhpf_get(test.fu, test.fs); % Get HPF coef
for n=1:test.nf
fprintf('Measuring %.0f Hz ...\n', test.f(n));
if debug
fprintf('Measuring %.0f Hz ...\n', test.f(n));
end
% Get notch coef for this frequency
[b_notch, a_notch] = stdnotch_get(test.f(n), test.fs);
i1 = d+(n-1)*nt+nt_skip;
Expand Down
6 changes: 5 additions & 1 deletion tools/test/audio/std_utils/fr_test_measure.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,8 @@
% Copyright(c) 2017 Intel Corporation. All rights reserved.
% Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>

debug = 0;

%% Check if upper and lower mask is defined
if length(test.fr_mask_flo) || length(test.fr_mask_fhi)
test.fr_lo = 0;
Expand DownExpand Up@@ -74,7 +76,9 @@
win = hamming(nt_use);
m0 = zeros(test.nf,1);
for n=1:test.nf
fprintf('Measuring %.0f Hz ...\n', test.f(n));
if debug
fprintf('Measuring %.0f Hz ...\n', test.f(n));
end
i1 = d+(n-1)*nt+nt_skip;
i2 = i1+nt_use-1;
m0(n) = level_dbfs(x(i1:i2,j).*win) -test.a_db;
Expand Down
5 changes: 4 additions & 1 deletion tools/test/audio/std_utils/thdnf_test_measure.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@
% Copyright(c) 2017 Intel Corporation. All rights reserved.
% Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>

debug = 0;
test.ph = [];
test.fh = [];

Expand DownExpand Up@@ -62,7 +63,9 @@
nn = 1;
for m=1:test.na
for n=1:test.nf
fprintf('Measuring %.0f Hz ...\n', test.f(n));
if debug
fprintf('Measuring %.0f Hz ...\n', test.f(n));
end
i1 = d+(nn-1)*nt+nt_skip;
i2 = i1+nt_use-1;
nn = nn+1;
Expand Down
6 changes: 5 additions & 1 deletion tools/test/audio/test_utils/mix_sweep.m
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,8 @@
% Copyright(c) 2017 Intel Corporation. All rights reserved.
% Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>

debug = 0;

%% Adjust tone lengt to integer number of samples
test.nt = round(test.tl*test.fs); % Make number of samples per tone
test.tl = test.nt/test.fs; % an integer by adjusting tl.
Expand DownExpand Up@@ -59,7 +61,9 @@
else
a = test.a;
end
fprintf('Mixing %.0f Hz %.1f dBFS sine ...\n', f, 20*log10(a));
if debug
fprintf('Mixing %.0f Hz %.1f dBFS sine ...\n', f, 20*log10(a));
end
s = multitone(test.fs, f, a, test.tl);
for ch=test.ch
x(i1:i2, ch) = dither_and_quantize(s.*win, test.bits_in);
Expand Down