diff --git a/apps/decoder.c b/apps/decoder.c index e8831449874ca1ba669116675dedf66428a12d97..d2260713c28f0b618033d3d2229c77794147b1dc 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -267,19 +267,50 @@ int main( /*------------------------------------------------------------------------------------------* * Open reference rotation file *------------------------------------------------------------------------------------------*/ + if ( arg.enableReferenceRotation ) { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + + /* sanity check */ + if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF ) + { + fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" ); + goto cleanup; + } + if ( ( error = HeadRotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open reference rotation file %s \n\n", arg.refrotTrajFileName ); goto cleanup; } } + /*------------------------------------------------------------------------------------------* * Open reference vector trajectory file *------------------------------------------------------------------------------------------*/ + if ( arg.enableReferenceVectorTracking ) { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + + /* sanity check */ + if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC && arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ) + { + fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" ); + goto cleanup; + } + if ( ( error = Vector3PairFileReader_open( arg.referenceVectorTrajFileName, &referenceVectorReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open reference vector trajectory file %s \n\n", arg.referenceVectorTrajFileName ); @@ -873,9 +904,7 @@ static bool parseCmdlIVAS_dec( } #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK - /*-----------------------------------------------------------------* - * Define additional subfolder for debug info output in ./res - *-----------------------------------------------------------------*/ + /* Define additional subfolder for debug info output in ./res */ else if ( strcmp( argv_to_upper, "-INFO" ) == 0 ) { extern char infoFolder[FILENAME_MAX]; @@ -1153,8 +1182,19 @@ static void usage_dec( void ) fprintf( stdout, " Format files, the magic word in the mime file is used to determine\n" ); fprintf( stdout, " which of the two supported formats is in use.\n" ); fprintf( stdout, " default bitstream file format is G.192\n" ); - fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); fprintf( stdout, "-hrtf File : HRTF filter File used in BINAURAL output configuration\n" ); + fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); + fprintf( stdout, "-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' \n" ); + fprintf( stdout, " or 'ref_vec_lev' (only for binaural rendering)\n" ); + fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with '-otr ref' mode \n" ); + fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); + fprintf( stdout, "-render_config File : Renderer configuration File\n" ); + fprintf( stdout, "-no_diegetic_pan : panning mono non-diegetic sound to stereo -1<= pan <=1,\n" ); + fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); + fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); + fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUGGING fprintf( stdout, "-FEC X : Insert frame erasures, X = 0-10 is the percentage\n" ); fprintf( stdout, " of erased frames, or X may be the name of binary file or \n" ); @@ -1163,16 +1203,6 @@ static void usage_dec( void ) fprintf( stdout, " default is OFF, if this option is not used\n" ); fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif - fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'none', 'ref' or 'avg' (only for binaural rendering)\n" ); - fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); - fprintf( stdout, " works only in combination with -otr ref mode\n" ); - fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); - fprintf( stdout, " works only in combination with -otr ref_vec and ref_vec_lev modes\n" ); - fprintf( stdout, "-render_config file : Renderer configuration file\n" ); - fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); - fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); - fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); - fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info : specify subfolder name for debug output\n" ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f95f18ae194bb4e3074af06a954c588fd339be27..0497a0a71306aa79412085382e7bb9c0ba8f0b55 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1990,6 +1990,25 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "Head rotation: ON\n" ); } + + if ( st_ivas->hDecoderConfig->orientation_tracking != IVAS_ORIENT_TRK_NONE ) + { + switch ( st_ivas->hDecoderConfig->orientation_tracking ) + { + case IVAS_ORIENT_TRK_AVG: + fprintf( stdout, "Orientation tracking: AVG\n" ); + break; + case IVAS_ORIENT_TRK_REF: + fprintf( stdout, "Orientation tracking: REF\n" ); + break; + case IVAS_ORIENT_TRK_REF_VEC: + fprintf( stdout, "Orientation tracking: REF_VEC\n" ); + break; + case IVAS_ORIENT_TRK_REF_VEC_LEV: + fprintf( stdout, "Orientation tracking: REF_VEC_LEV\n" ); + break; + } + } } return IVAS_ERR_OK; diff --git a/readme.txt b/readme.txt index eeaea0f84a668c66907d2758d7566e778d49c188..c566c78ea233901d72fc367809458787ddc2e9fa 100644 --- a/readme.txt +++ b/readme.txt @@ -255,20 +255,26 @@ Options: Format files, the magic word in the mime file is used to determine which of the two supported formats is in use. default bitstream file format is G.192 --T File : Head rotation specified by external trajectory File -hrtf File : HRTF filter File used in ISm format and BINAURAL output configuration +-T File : Head rotation specified by external trajectory File +-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' + or 'ref_vec_lev' (only for binaural rendering) +-rf File : Reference rotation specified by external trajectory file + works only in combination with '-otr ref' mode +-rvf File : Reference vector specified by external trajectory file + works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes +-render_config File : Renderer configuration option File +-no_diegetic_pan : panning mono non-diegetic sound to stereo -1<= pan <=1, + left or l or 1->left, right or r or -1->right, center or c or 0->middle +-q : Quiet mode, no frame counter + default is deactivated -FEC X : Insert frame erasures, X = 0-10 is the percentage of erased frames, or X may be the name of binary file or file with G192 headers indicating GOOD FRAME or BAD FRAME containing FEC pattern (short values of 0 (good) or 1 (bad)) default is OFF, if this option is not used -force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND), --otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering) --render_config File : Renderer configuration option File --no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1, - left or l or 1->left, right or r or -1->right, center or c or 0->middle --q : Quiet mode, no frame counter - default is deactivated + MULTICHANNEL LOUDSPEAKER INPUT / OUTPUT CONFIGURATIONS diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index f26fba423a82d7dca5c8efc18dcea8af36752b84..84581809fe52841fcde71a1628598d07a489e7d5 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -408,6 +408,10 @@ ../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stv4ISM48s.wav bit ../IVAS_dec 5_1 48 bit testv/stv4ISM48s.wav_512000_48-48_5_1.tst +// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst + // 1 ISM with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on ../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.wav bit ../IVAS_dec MONO 32 bit testv/stv32c.wav_brate_sw_32-32_mono_dtx.tst @@ -421,7 +425,6 @@ ../IVAS_dec HOA3 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_DTX_hoa3.tst - // SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out ../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_HOA3.tst @@ -454,6 +457,10 @@ ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot.tst +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst + // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_FEC5.tst @@ -498,6 +505,18 @@ ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst + // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% ../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit ../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst @@ -554,6 +573,10 @@ ../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst + // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% ../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.wav_SBA_192000_48-48_HOA2_FEC5.tst @@ -688,6 +711,10 @@ ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 48000 48 testv/stv1MASA2TC48c.wav bit ../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA2TC48c.wav_48000_48-48_7_1_4_FEC5.tst @@ -826,6 +853,10 @@ ../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot.tst +// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst + // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.wav_MC51_384000_48-48_5_1.tst diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index 3625a9307e9a947dc478b0eab8b2c661456e6973..e29696adec8b0e1b58a74c69d4939bca4c8faaea 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -193,6 +193,10 @@ HR_TRAJECTORIES_TO_TEST = [ "rotate_yaw_pitch_roll1", ] +CONFIG_FILES_TO_TEST = [ + "just_reverb" +] + """ Per-testcase xfail SNR thresholds (dB) """ pass_snr = dict() # not relevant for tests anymore, should be deprecated soon _pass_snr = { diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 690f495c7fc196c4c552e80a15a0445f74015ec3..00ea239714a7239aa4331149d8a4bb9d7eecf309 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -56,6 +56,24 @@ def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): ) +# Test compares rendering with render config file containing just reverb defaults against rendering without config file. +# These should be binary equivalent. +@pytest.mark.parametrize("config_file", CONFIG_FILES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ambisonics_binaural_headrotation_defaultrenderconfig(test_info, in_fmt, out_fmt, config_file): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "defaultrenderconfig" + }, + cut_kwargs={ + "config_file": TESTV_DIR.joinpath(f"{config_file}.cfg") + } + ) + # Test compares rendering with just a trajectory file against rendering with a trajectory file + a zero ref rotation. # These should be binary equivalent. @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 7a98dff3006b066bf78c563801a8816553e8498c..d2af91f60cdceb41d6f236cf46abdb94e06e919f 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -109,6 +109,7 @@ def run_renderer( refrot_file: Optional[str] = None, refvec_file: Optional[str] = None, refveclev_file: Optional[str] = None, + config_file: Optional[str] = None, output_path_base: str = OUTPUT_PATH_CUT, binary_suffix: str = "", is_comparetest: Optional[bool] = False, @@ -134,6 +135,11 @@ def run_renderer( else: refveclev_name = "" + if config_file is not None: + config_name = f"_{config_file.stem}" + else: + config_name = "" + if not isinstance(out_fmt, str): @@ -156,7 +162,7 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt - out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}{refvec_name}{refveclev_name}{name_extension}.wav")) + out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}{refrot_name}{refvec_name}{refveclev_name}{config_name}{name_extension}.wav")) cmd = RENDERER_CMD[:] cmd[2] = str(in_file) @@ -184,6 +190,9 @@ def run_renderer( cmd.extend(["-rvf", str(refveclev_file)]) cmd.extend(["-otr", "ref_vec_lev"]) + if config_file is not None: + cmd.extend(["-rc", str(config_file)]) + run_cmd(cmd) return pyaudio3dtools.audiofile.readfile(out_file)