Tools: Tune: Fix beamformer rotate and diffuse simulation data generate

This patch fixes the incorrect delaying of simulation input signal to
microphones. Instead of delaying the old code advanced the input the
more the larger the input is. E.g. It caused the tests for line arrays
to show a mirrored beam pattern.

The num_filters is replaced by mic_n (microphones count). It is the
correct count to use here though usually filters count is the same.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2020-12-21 18:25:37 +02:00 committed by Liam Girdwood
parent 53c7ea6dd1
commit 92ddb0d137
1 changed files with 7 additions and 7 deletions

View File

@ -327,17 +327,17 @@ else
test_n = length(test_az); test_n = length(test_az);
test_el = zeros(1, test_n); test_el = zeros(1, test_n);
[test_x, test_y, test_z] = source_xyz(bf.steer_r, test_az, test_el); [test_x, test_y, test_z] = source_xyz(bf.steer_r, test_az, test_el);
td = zeros(test_n * nt, bf.num_filters); td = zeros(test_n * nt, bf.mic_n);
for i = 1:length(test_az) for i = 1:length(test_az)
dt = delay_from_source(bf, test_x(i), test_y(i), test_z(i)); dt = delay_from_source(bf, test_x(i), test_y(i), test_z(i));
dn = round(dt / ti); dn = round(dt / ti);
mi = zeros(nti, bf.num_filters); mi = zeros(nti, bf.num_filters);
for j = 1:bf.num_filters for j = 1:bf.mic_n
mi(:,j) = mi(:,j) + si(dn(j):dn(j) + nti -1); mi(:,j) = mi(:,j) + si(end-dn(j)-nti+1:end-dn(j));
end end
i1 = (i - 1) * nt + 1; i1 = (i - 1) * nt + 1;
i2 = i1 + nt -1; i2 = i1 + nt -1;
for j = 1:bf.num_filters for j = 1:bf.mic_n
m = mi(1:p:end, j) .* win; m = mi(1:p:end, j) .* win;
td(i1:i2, j) = m; td(i1:i2, j) = m;
end end
@ -366,9 +366,9 @@ else
dn = round(dt / ti); dn = round(dt / ti);
ns = rand(n0, 1) + rand(n0, 1) - 1; ns = rand(n0, 1) + rand(n0, 1) - 1;
nsi = interp(ns, p); nsi = interp(ns, p);
nmi = zeros(nti, bf.num_filters); nmi = zeros(nti, bf.mic_n);
for j = 1:bf.num_filters for j = 1:bf.mic_n
nmi(:,j) = nmi(:,j) + nsi(dn(j):dn(j) + nti -1); nmi(:,j) = nmi(:,j) + nsi(end-dn(j)-nti+1:end-dn(j));
end end
end end
nm = nmi(1:p:end, :); nm = nmi(1:p:end, :);