Commit 204a38f3 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

- fix ref-using-main for split rend CI job

- add a script to get loudspeaker positions
- remove python related comments in matlab scripts
parent 477f0f38
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -626,6 +626,7 @@ split-rendering-pytest-on-merge-request:
    - make -j INCLUDE_SPLIT=1

    ### Run test using scripts and input from main
    - if [ $ref_using_main == 1 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts
    - if [ $ref_using_main == 1 ]; then git checkout $target_commit; fi

    # run test
+3 −10
Original line number Diff line number Diff line
@@ -39,23 +39,16 @@ function IR_cldfb = SD_2_ROM( rom_c_file, sofa_file)
[thispath,~,~] = fileparts(mfilename('fullpath'));
thispath = [thispath,filesep];

%py_path = 'C:\Users\xxxx\AppData\Local\Programs\Python\Python39\python.exe'; % may look like this
if ~exist('sofa_file','var') || isempty(sofa_file)
   sofa_file = fullfile(thispath,'..','HRIRs_sofa','HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa');
end
%% load SD HRIRs
% requires:
% python -m pip install sofar
% python -m pip install numpy

% Fetch the HRTFs
H = hrtf_library_loader();
H.readSOFA(char(sofa_file));
Azi_combined = deg2rad([30, -30, 0, 135, -135, 110, -110, 90, -90, 30, -30, 110, -110, 135, -135]);
Ele_combined = deg2rad([ 0,   0, 0,   0,   0,    0,    0,  0,   0, 35,  35,  35,   35,  35,   35]);
IR_SD = H.XYZ_to_IR_SD([Azi_combined; Ele_combined]);
ls_struct = get_ls_layout_config('Combined');
IR_SD = H.XYZ_to_IR_SD([deg2rad(ls_struct.azi); deg2rad(ls_struct.ele)]);

%% SHD -> CLDFB via least squares error optimization
%% SD -> CLDFB via least squares error optimization
[~,num_ears,num_ch] = size(IR_SD);
num_cldfb_taps = 3;
IR_cldfb = zeros(60,num_cldfb_taps,num_ears,num_ch); % 60 frequency bands
+0 −6
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ function IR_cldfb = SHD_2_ROM( rom_c_file, sofa_file, ambi_order, hrir_len )
[thispath,~,~] = fileparts(mfilename('fullpath'));
thispath = [thispath,filesep];

%py_path = 'C:\Users\xxxx\AppData\Local\Programs\Python\Python39\python.exe'; % may look like this
if ~exist('sofa_file','var') || isempty(sofa_file)
   sofa_file = fullfile(thispath,'..','HRIRs_sofa','HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa');
end
@@ -50,11 +49,6 @@ if ~exist('hrir_len','var')
   hrir_len = 128;
end
%% convert sphere-sampled HRIRs to SHD HRIRs
% requires:
% python -m pip install sofar
% python -m pip install numpy

% convert sphere-sampled HRIRs to SHD HRIRs
[sofa_path,sofa_name, sofa_ext] = fileparts(sofa_file);
IR = generate_HOA_HRIRs_MOD_lens(ambi_order, sofa_path, [sofa_name,sofa_ext], hrir_len);

+136 −0
Original line number Diff line number Diff line
function ls_struct = get_ls_layout_config(ls_layout_config)

ls_struct = struct;
switch ls_layout_config
  case 'FOA'
    ls_struct.name = 'FOA';
    ls_struct.nb_channel = 4;
    ls_struct.azi = [0 0 0 0];
    ls_struct.ele = [0 0 0 0];
    ls_struct.isloudspeaker = 0;
    ls_struct.sba_order = 1;
    ls_struct.num_lfe = 0;
    ls_struct.lfe_index = zeros(0,0);
  case 'HOA2'
    ls_struct.name = 'HOA2';
    ls_struct.nb_channel = 9;
    ls_struct.azi = [0 0 0 0 0 0 0 0 0];
    ls_struct.ele = [0 0 0 0 0 0 0 0 0];
    ls_struct.isloudspeaker = 0;
    ls_struct.sba_order = 2;
    ls_struct.num_lfe = 0;
    ls_struct.lfe_index = zeros(0,0);
  case 'HOA3'
    ls_struct.name = 'HOA3';
    ls_struct.nb_channel = 16;
    ls_struct.azi = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
    ls_struct.ele = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
    ls_struct.isloudspeaker = 0;
    ls_struct.sba_order = 3;
    ls_struct.num_lfe = 0;
    ls_struct.lfe_index = zeros(0,0);
  case {'CICP2', '2d0'}
    ls_struct.name = 'CICP2';
    ls_struct.nb_channel = 2;
    ls_struct.azi = [30 -30];
    ls_struct.ele = [0 0];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 0;
    ls_struct.lfe_index = zeros(0,0);
  case {'CICP6', 'cicp6', '5d1'}
    ls_struct.name = 'CICP6';
    ls_struct.nb_channel = 6;
    ls_struct.azi = [30 -30 0 0 110 -110];
    ls_struct.ele = [0 0 0 0 0 0];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 1;
    ls_struct.lfe_index = [4];
  case {'CICP12', 'cicp12', '7d1'} % 3 front, 4 surround + 1LFE
    ls_struct.name = 'CICP12';
    ls_struct.nb_channel = 8;
    ls_struct.azi = [30 -30 0 0 110 -110 135 -135];
    ls_struct.ele = [0 0 0 0 0 0 0 0];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 1;
    ls_struct.lfe_index = [4];    
  case {'CICP16', 'cicp16', '5d1p4'}
    ls_struct.name = 'CICP16';
    ls_struct.nb_channel = 10;
    ls_struct.azi = [30 -30 0 0 110 -110 30 -30 110 -110];
    ls_struct.ele = [0 0 0 0 0 0 35 35 35 35];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 1;
    ls_struct.lfe_index = [4];
  case {'CICP13', 'cicp13','22d2'}
    ls_struct.name = 'CICP13';
    ls_struct.nb_channel = 24;
    ls_struct.azi = [60 -60 0 0 135 -135 30 -30 180 0 90 -90 45 -45 0 0 135 -135 90 -90 180 0 45 -45];
    ls_struct.ele = [0 0 0 0 0 0 0 0 0 0 0 0 35 35 35 90 35 35 35 35 35 -15 -15 -15];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 2;
    ls_struct.lfe_index = [4 10];
  case {'CICP19', 'cicp19','7d1p4'}
    ls_struct.name = 'CICP19';
    ls_struct.nb_channel = 12;
    ls_struct.azi = [30 -30 0 0 135 -135 90 -90 30 -30 135 -135];
    ls_struct.ele = [0 0 0 0 0 0 0 0 35 35 35 35];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 1;
    ls_struct.lfe_index = [4];
  case {'Combined'}
    ls_struct.name = 'Combined';
    ls_struct.nb_channel = 15;
    ls_struct.azi = [30 -30 0 135 -135 110 -110 90 -90 30 -30 110 -110 135 -135];
    ls_struct.ele = [0 0 0 0 0 0 0 0 0 35 35 35 35 35 35];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 0;
  case {'Lebedev_26'}
    ls_struct.name = 'Leb26';
    ls_struct.nb_channel = 26;
    ls_struct.azi = [0 180.0 90.0 270.0  0     0   90.0  90.0  270.0  270.0  0     0   180.0  180.0  45.0  315.0  135.0  225.0 45.0  45.0   315.0  315.0  135.0  135.0  225.0 225.0];
    ls_struct.ele = [0   0    0     0   90.0 -90.0 45.0 -45.0   45.0  -45.0 45.0 -45.0  45.0  -45.0   0      0      0      0   35.3 -35.3    35.3  -35.3   35.3  -35.3   35.3 -35.3];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 0;
  case {'cube_8'}
    ls_struct.name = 'Cub8';
    ls_struct.nb_channel = 8;
    ls_struct.azi = [45 45 135 135 225 225 315 315];
    ls_struct.ele = [35.3 -35.3 35.3 -35.3 35.3 -35.3 35.3 -35.3];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 0;
  case {'BINAURAL', 'BINAURAL_ROOM'}
    ls_struct.name = 'BINAURAL';
    ls_struct.nb_channel = 2;
    ls_struct.azi = [90 -90];
    ls_struct.ele = [0 0];
    ls_struct.isloudspeaker = 2;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 0;
  case {'STEREO'}
    ls_struct.name = 'STEREO';
    ls_struct.nb_channel = 2;
    ls_struct.azi = [90 -90];
    ls_struct.ele = [0 0];
    ls_struct.isloudspeaker = 2;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 0;
  case {'MONO'}
    ls_struct.name = 'MONO';
    ls_struct.nb_channel = 1;
    ls_struct.azi = [0];
    ls_struct.ele = [0];
    ls_struct.isloudspeaker = 1;
    ls_struct.sba_order = -1;
    ls_struct.num_lfe = 0;
  otherwise
    error('Loudspeaker layout not supported!');
end