-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Audio: TDFB: Tune: Move beamformer setup scripts to module directory
The change is done to consolidate the files belonging to the module. The files are moved from directory tools/tune/tdfb into src/audio/tdfb/tune. There are no functional changes but the impacts of naming the scripts with sof prefix and move of directory locations is fixed. A new script sof_bf_paths is added to make add and remove needed paths more convenient. Signed-off-by: Seppo Ingalsuo <[email protected]>
- Loading branch information
Showing
20 changed files
with
135 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_array_circ(bf) | ||
% bf = sof_bf_array_circ(bf) | ||
% | ||
% Inputs | ||
% bf.mic_n ... number of microphones | ||
|
@@ -15,7 +15,7 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_array_circ(bf) | ||
function bf = sof_bf_array_circ(bf) | ||
|
||
bf.mic_angle = (0:bf.mic_n-1)*360/bf.mic_n; % Mic 1 at 0 deg | ||
idx = find(bf.mic_angle > 180); % wrap > 180 deg to -180 .. 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_array_line(bf) | ||
% bf = sof_bf_array_line(bf) | ||
% | ||
% Inputs | ||
% bf.mic_n ... number of microphones | ||
|
@@ -15,7 +15,7 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_array_line(bf) | ||
function bf = sof_bf_array_line(bf) | ||
|
||
bf.mic_y = linspace(0, -(bf.mic_n-1) * bf.mic_d, bf.mic_n) ... | ||
+ (bf.mic_n-1) * bf.mic_d / 2; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_array_lshape(bf) | ||
% bf = sof_bf_array_lshape(bf) | ||
% | ||
% Inputs | ||
% bf.mic_nxy ... vector of two with number of microphones along x and y | ||
|
@@ -15,7 +15,7 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_array_lshape(bf) | ||
function bf = sof_bf_array_lshape(bf) | ||
|
||
bf.mic_x = []; | ||
bf.mic_y = []; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_array_rect(bf) | ||
% bf = sof_bf_array_rect(bf) | ||
% | ||
% Inputs | ||
% bf.mic_nxy ... vector of two with number of microphones along x and y | ||
|
@@ -15,7 +15,7 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_array_rect(bf) | ||
function bf = sof_bf_array_rect(bf) | ||
|
||
bf.mic_x = []; | ||
bf.mic_y = []; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_array_rot(bf) | ||
% bf = sof_bf_array_rot(bf) | ||
% | ||
% Inputs | ||
% bf.array_angle ... three element vector for x, y, z rotation [degrees] | ||
|
@@ -17,7 +17,7 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_array_rot(bf) | ||
function bf = sof_bf_array_rot(bf) | ||
|
||
% Equations reference | ||
% https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_array_xyz(bf) | ||
% bf = sof_bf_array_xyz(bf) | ||
% | ||
% Inputs | ||
% bf.mic_x ... x coordinates [m] | ||
|
@@ -17,7 +17,7 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_array_xyz(bf) | ||
function bf = sof_bf_array_xyz(bf) | ||
|
||
bf.mic_n = length(bf.mic_x); | ||
bf.mic_x = bf.mic_x - mean(bf.mic_x); | ||
|
2 changes: 1 addition & 1 deletion
2
tools/tune/tdfb/bf_blob_pack.m → src/audio/tdfb/tune/sof_bf_blob_pack.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_design(bf) | ||
% bf = sof_bf_design(bf) | ||
% | ||
% This script calculates beamformer filters with superdirective design | ||
% criteria. | ||
|
@@ -9,10 +9,9 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_design(bf) | ||
function bf = sof_bf_design(bf) | ||
|
||
addpath('../../test/audio/test_utils'); | ||
addpath('../../test/audio/std_utils'); | ||
sof_bf_paths(true); | ||
mkdir_check('plots'); | ||
mkdir_check('data'); | ||
|
||
|
@@ -30,15 +29,15 @@ | |
|
||
switch lower(bf.array) | ||
case 'line' | ||
bf = bf_array_line(bf); | ||
bf = sof_bf_array_line(bf); | ||
case 'circular' | ||
bf = bf_array_circ(bf); | ||
bf = sof_bf_array_circ(bf); | ||
case 'rectangle' | ||
bf = bf_array_rect(bf); | ||
bf = sof_bf_array_rect(bf); | ||
case 'lshape' | ||
bf = bf_array_lshape(bf); | ||
bf = sof_bf_array_lshape(bf); | ||
case 'xyz' | ||
bf = bf_array_xyz(bf); | ||
bf = sof_bf_array_xyz(bf); | ||
otherwise | ||
error('Invalid array type') | ||
end | ||
|
@@ -51,7 +50,7 @@ | |
end | ||
end | ||
|
||
bf = bf_array_rot(bf); | ||
bf = sof_bf_array_rot(bf); | ||
|
||
% The design function handles only single (az, el) value, so need to | ||
% loop every steer angle. | ||
|
@@ -88,11 +87,11 @@ | |
bf.mat_fn = all_mat_fn; | ||
bf.w = w_all; | ||
|
||
sof_bf_paths(false); | ||
end | ||
|
||
function bf = bf_one_design(bf) | ||
|
||
|
||
%% Defaults | ||
j = complex(0,-1); | ||
fs = bf.fs; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf_export(bf) | ||
% sof_bf_export(bf) | ||
% | ||
% Inputs | ||
% bf.sofctl3_fn .... filename of ascii text format blob | ||
|
@@ -13,12 +13,10 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_export(bf) | ||
function bf = sof_bf_export(bf) | ||
|
||
% Use functionc from common, test utils | ||
addpath('../common'); | ||
addpath('../eq'); | ||
addpath('../../test/audio/test_utils'); | ||
% Use functions from common, test utils | ||
sof_bf_paths(true); | ||
|
||
%% Add needed default controls if missing | ||
|
||
|
@@ -60,24 +58,24 @@ | |
for j=1:bf.num_angles | ||
for i=1:bf.num_filters | ||
coefs = squeeze(bf.w(:,i,j)); | ||
bq = eq_fir_blob_quant(coefs, 16, 0); | ||
bq = sof_eq_fir_blob_quant(coefs, 16, 0); | ||
filters = [filters bq ]; | ||
end | ||
end | ||
|
||
%% Add beam-off preset | ||
if bf.beam_off_defined | ||
b_pass = [1]; | ||
bq = eq_fir_blob_quant(b_pass, 16, 0); | ||
bq = sof_eq_fir_blob_quant(b_pass, 16, 0); | ||
for i=1:bf.num_filters | ||
filters = [filters bq ]; | ||
end | ||
end | ||
|
||
%% Build blob | ||
bf.all_filters = filters; | ||
bp3 = bf_blob_pack(bf, 3); | ||
bp4 = bf_blob_pack(bf, 4); | ||
bp3 = sof_bf_blob_pack(bf, 3); | ||
bp4 = sof_bf_blob_pack(bf, 4); | ||
|
||
%% Export | ||
if isempty(bf.sofctl3_fn) | ||
|
@@ -118,8 +116,6 @@ | |
tplg2_write(bf.tplg2_fn, bp4, "tdfb_config", export_note, bf.export_howto); | ||
end | ||
|
||
rmpath('../../test/audio/test_utils'); | ||
rmpath('../eq'); | ||
rmpath('../common'); | ||
sof_bf_paths(false); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
% bf = bf_filenames_helper(bf, id) | ||
% bf = sof_bf_filenames_helper(bf, id) | ||
% | ||
% Automatically defines output files names based on array geometry | ||
% and steer angle. | ||
|
@@ -9,7 +9,7 @@ | |
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bf = bf_filenames_helper(bf, id) | ||
function bf = sof_bf_filenames_helper(bf, id) | ||
|
||
switch lower(bf.array) | ||
case {'rectangle' 'lshape'} | ||
|
4 changes: 2 additions & 2 deletions
4
tools/tune/tdfb/bf_merge.m → src/audio/tdfb/tune/sof_bf_merge.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
% bfm = bf_merge(bf1, bf2) | ||
% bfm = sof_bf_merge(bf1, bf2) | ||
|
||
% SPDX-License-Identifier: BSD-3-Clause | ||
% | ||
% Copyright (c) 2020, Intel Corporation. All rights reserved. | ||
% | ||
% Author: Seppo Ingalsuo <[email protected]> | ||
|
||
function bfm = bf_merge(bf1, bf2) | ||
function bfm = sof_bf_merge(bf1, bf2) | ||
|
||
if nargin > 2 | ||
error('Current implementation can merge only two beams configuration'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function sof_bf_paths(enable) | ||
|
||
% sof_bf_paths(enable) | ||
% enable - set to true to enable needed search path | ||
% set to false to disable the search paths | ||
% | ||
|
||
% SPDX-License-Identifier: BSD-3-Clause | ||
% | ||
% Copyright (c) 2024, Intel Corporation. | ||
|
||
sof_tools = '../../../../tools'; | ||
sof_modules = '../..'; | ||
common = fullfile(sof_tools, 'tune/common'); | ||
eq = fullfile(sof_modules, 'eq_iir/tune'); | ||
test_utils = fullfile(sof_tools, 'test/audio/test_utils'); | ||
std_utils = fullfile(sof_tools, 'test/audio/std_utils'); | ||
if enable | ||
addpath(common); | ||
addpath(eq); | ||
addpath(test_utils); | ||
addpath(std_utils); | ||
else | ||
rmpath(common); | ||
rmpath(eq); | ||
rmpath(test_utils); | ||
rmpath(std_utils); | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.