From 80dcf2d9073fb874b4a4f44334cfd3f8a5fa3b70 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 7 Dec 2022 17:59:59 +0100 Subject: [PATCH 1/8] harmonize rounding of ISM position metadata and crossfading between renderer and decoder --- lib_com/options.h | 3 +++ lib_dec/ivas_ism_renderer.c | 10 ++++++++++ lib_rend/ivas_sba_rendering.c | 15 +++++++++++++++ lib_rend/lib_rend.c | 34 +++++++++++++++++++++++++++++++++- 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b5063ecf39..116dc7fad3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,6 +179,9 @@ #define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ +#define FIX_REND_ISM_XFADE /* Issue 193: Crossfade inconsistencies in ISM between decoder and external renderer */ +#define FIX_REND_ISM_POS_ROUNDING /* Issue 193: (TEMPORARY! Pending fix for #215) Align rounding of ISM position data in external renderer */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index f27d49b111..d6e91bc197 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -82,7 +82,11 @@ ivas_error ivas_ism_renderer_open( interpolator_length = (uint16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); for ( i = 0; i < interpolator_length; i++ ) { +#ifdef FIX_REND_ISM_XFADE + st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); +#else st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length ); +#endif } return error; @@ -180,8 +184,14 @@ void ivas_ism_render( } else { +#ifdef FIX_REND_ISM_POS_ROUNDING + // TODO tmu review when #215 is resolved + azimuth = (int16_t) floorf( st_ivas->hIsmMetaData[i]->azimuth + 0.5f ); + elevation = (int16_t) floorf( st_ivas->hIsmMetaData[i]->elevation + 0.5f ); +#else azimuth = (int16_t) ( st_ivas->hIsmMetaData[i]->azimuth + 0.5f ); elevation = (int16_t) ( st_ivas->hIsmMetaData[i]->elevation + 0.5f ); +#endif if ( st_ivas->hIntSetup.is_planar_setup ) { diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index e2977a81e4..1e692e3061 100755 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -308,20 +308,35 @@ void ivas_ism2sba( for ( i = 0; i < num_objects; i++ ) { +#ifdef FIX_REND_ISM_POS_ROUNDING + // TODO tmu review when #215 is resolved + azimuth = (int16_t) floorf( hIsmMetaData[i]->azimuth + 0.5f ); + elevation = (int16_t) floorf( hIsmMetaData[i]->elevation + 0.5f ); +#else azimuth = (int16_t) ( hIsmMetaData[i]->azimuth + 0.5f ); elevation = (int16_t) ( hIsmMetaData[i]->elevation + 0.5f ); +#endif /*get HOA gets for direction (ACN/SN3D)*/ ivas_dirac_dec_get_response( azimuth, elevation, gains, sba_order ); for ( j = 0; j < sba_num_chans; j++ ) { +#ifdef FIX_REND_ISM_XFADE + g1 = 1.f; +#endif g2 = 0.f; for ( k = 0; k < output_frame; k++ ) { +#ifdef FIX_REND_ISM_XFADE + buffer_tmp[j][k] += ( g2 * gains[j] + g1 * hIsmRendererData->prev_gains[i][j] ) * buffer_td[i][k]; + g2 += 1.f / ( output_frame - 1 ); + g1 = 1.0f - g2; +#else g2 += 1.f / output_frame; g1 = 1.0f - g2; buffer_tmp[j][k] += ( g2 * gains[j] + g1 * hIsmRendererData->prev_gains[i][j] ) * buffer_td[i][k]; +#endif } hIsmRendererData->prev_gains[i][j] = gains[j]; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d766334988..760987c922 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3790,12 +3790,28 @@ static ivas_error renderIsmToMc( wmops_sub_start( "renderIsmToMc" ); - /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ +/* TODO(sgi): Possible optimization: less processing needed if position didn't change */ +#ifdef FIX_REND_ISM_POS_ROUNDING + // TODO tmu review when #215 is resolved + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), + (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ), + currentPanGains ) ) != IVAS_ERR_OK ) +#else if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ismInput->currentPos.azimuth, ismInput->currentPos.elevation, currentPanGains ) ) != IVAS_ERR_OK ) +#endif { return error; } +#ifdef FIX_REND_ISM_POS_ROUNDING + // TODO tmu review when #215 is resolved + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), + (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), + previousPanGains ) ) != IVAS_ERR_OK ) +#else if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ismInput->previousPos.azimuth, ismInput->previousPos.elevation, previousPanGains ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -3832,7 +3848,15 @@ static ivas_error renderIsmToSba( return error; } +#ifdef FIX_REND_ISM_POS_ROUNDING + // TODO tmu review when #215 is resolved + ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), + (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), + previousPanGains, + ambiOrderOut ); +#else ivas_dirac_dec_get_response( (int16_t) ismInput->previousPos.azimuth, (int16_t) ismInput->previousPos.elevation, previousPanGains, ambiOrderOut ); +#endif if ( ( ismInput->currentPos.azimuth == ismInput->previousPos.azimuth ) && ( ismInput->currentPos.elevation == ismInput->previousPos.elevation ) ) @@ -3841,7 +3865,15 @@ static ivas_error renderIsmToSba( } else { +#ifdef FIX_REND_ISM_POS_ROUNDING + // TODO tmu review when #215 is resolved + ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), + (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ), + currentPanGains, + ambiOrderOut ); +#else ivas_dirac_dec_get_response( (int16_t) ismInput->currentPos.azimuth, (int16_t) ismInput->currentPos.elevation, currentPanGains, ambiOrderOut ); +#endif } /* Assume num channels in audio buffer to be 1. -- GitLab From 3c20b44b644e74ccb27983e0be35b11e6986aeae Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 8 Dec 2022 11:10:57 +0100 Subject: [PATCH 2/8] remove casting to int16 in python scripts + adjust thresholds for tests --- scripts/pyaudio3dtools/hoadecoder.py | 5 +- scripts/pyaudio3dtools/rotation.py | 4 +- scripts/pyaudio3dtools/spatialaudioconvert.py | 8 +- tests/renderer/constants.py | 214 ++++++++++-------- 4 files changed, 129 insertions(+), 102 deletions(-) diff --git a/scripts/pyaudio3dtools/hoadecoder.py b/scripts/pyaudio3dtools/hoadecoder.py index b774c0a9ec..9879980259 100644 --- a/scripts/pyaudio3dtools/hoadecoder.py +++ b/scripts/pyaudio3dtools/hoadecoder.py @@ -65,10 +65,9 @@ def get_hoa_mtx( mtx_hoa_dec[1, 0] = 0.5 mtx_hoa_dec[1, 1] = -0.5 elif spkrlayout.isloudspeaker: - # TODO getRSH in IVAS casts to int16_t , decide on final behaviour for scripts Y_td = getRSH( - T_DESIGN_11_AZI.astype(np.int16), - T_DESIGN_11_ELE.astype(np.int16), + T_DESIGN_11_AZI, + T_DESIGN_11_ELE, ambi_order, norm="ortho", ) diff --git a/scripts/pyaudio3dtools/rotation.py b/scripts/pyaudio3dtools/rotation.py index 09f90a9ccf..5fd9707167 100644 --- a/scripts/pyaudio3dtools/rotation.py +++ b/scripts/pyaudio3dtools/rotation.py @@ -331,9 +331,7 @@ def rotateMC(x: np.ndarray, trajectory: str, layout: spatialaudioformat) -> np.n rotateAziEle(a, e, Quat2RotMat(q)) for a, e in zip(layout.ls_azi, layout.ls_ele) ] - ).astype( - np.int16 - ) # TODO tmu for alignment with IVAS + ) R = panner.pan(rotated_pos[:, 0], rotated_pos[:, 1]) R[:, layout.lfe_index] = np.zeros([layout.nchannels, 1]) R[layout.lfe_index, layout.lfe_index] = 1 diff --git a/scripts/pyaudio3dtools/spatialaudioconvert.py b/scripts/pyaudio3dtools/spatialaudioconvert.py index 2dc1fc0737..86893d168e 100644 --- a/scripts/pyaudio3dtools/spatialaudioconvert.py +++ b/scripts/pyaudio3dtools/spatialaudioconvert.py @@ -372,8 +372,7 @@ def convert_mc( # SH response for loudspeaker positions MC2HOA = np.hstack( [ - # TODO getRSH in IVAS casts to int16_t , decide on final behaviour for scripts - hoadecoder.getRSH([int(a)], [int(e)], out_spfmt.ambi_order) + hoadecoder.getRSH([a], [e], out_spfmt.ambi_order) for a, e in zip(in_spfmt.ls_azi, in_spfmt.ls_ele) ] ).T @@ -435,10 +434,7 @@ def convert_ism( gains = gains[:, np.newaxis] # ISM -> HOA elif out_spfmt.ambi_order > 0: - # TODO getRSH in IVAS casts to int16_t , decide on final behaviour for scripts - gains = hoadecoder.getRSH( - [int(pos[0])], [int(pos[1])], out_spfmt.ambi_order - ) + gains = hoadecoder.getRSH([pos[0]], [pos[1]], out_spfmt.ambi_order) else: raise NotImplementedError( f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented" diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index da7302bdc2..396efc4a28 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -241,7 +241,9 @@ FORMAT_TO_CREND_FORMAT = { INPUT_FORMATS_AMBI = ["FOA", "HOA2", "HOA3"] INPUT_FORMATS_MC = ["MONO", "STEREO", "5_1", "5_1_2", "5_1_4", "7_1", "7_1_4"] INPUT_FORMATS_ISM = ["ISM1", "ISM2", "ISM3", "ISM4"] -INPUT_FORMATS_MASA = ["MASA2"] #["MASA1", "MASA2"] # Disable MASA1 tests until MASA1 can be implemented properly +INPUT_FORMATS_MASA = [ + "MASA2" +] # ["MASA1", "MASA2"] # Disable MASA1 tests until MASA1 can be implemented properly """ Non binaural / parametric output formats """ OUTPUT_FORMATS = [ @@ -283,6 +285,22 @@ pass_snr = { # External Renderer vs Standalone and pyaudio3dtools renderers tests # #################################################################### + # Failure reason: Renderer uses getRSH() with int16_t vs float in python + "test_ambisonics[FOA-5_1]": 39, + "test_ambisonics[FOA-5_1_2]": 40, + "test_ambisonics[FOA-5_1_4]": 41, + "test_ambisonics[FOA-7_1]": 39, + "test_ambisonics[FOA-7_1_4]": 41, + "test_ambisonics[HOA2-5_1]": 26, + "test_ambisonics[HOA2-5_1_2]": 29, + "test_ambisonics[HOA2-5_1_4]": 31, + "test_ambisonics[HOA2-7_1]": 27, + "test_ambisonics[HOA2-7_1_4]": 32, + "test_ambisonics[HOA3-5_1]": 25, + "test_ambisonics[HOA3-5_1_2]": 27, + "test_ambisonics[HOA3-5_1_4]": 29, + "test_ambisonics[HOA3-7_1]": 25, + "test_ambisonics[HOA3-7_1_4]": 30, # TODO needs debugging "test_ambisonics_binaural_headrotation[HOA2-BINAURAL-full_circle_in_15s]": 18, "test_ambisonics_binaural_headrotation[HOA3-BINAURAL-full_circle_in_15s]": 15, @@ -299,88 +317,102 @@ pass_snr = { "test_ambisonics_binaural_static[FOA-BINAURAL_ROOM]": 0, "test_ambisonics_binaural_static[HOA2-BINAURAL_ROOM]": 0, "test_ambisonics_binaural_static[HOA3-BINAURAL_ROOM]": 0, + # Failure reason: Renderer uses getRSH() with int16_t vs float in python + "test_custom_ls_input[t_design_4-FOA]": 43, + "test_custom_ls_input[t_design_4-HOA2]": 39, + "test_custom_ls_input[t_design_4-HOA3]": 36, + "test_custom_ls_output[FOA-16ch_8+4+4]": 40, + "test_custom_ls_output[FOA-4d4]": 40, + "test_custom_ls_output[FOA-itu_4+5+1]": 41, + "test_custom_ls_output[FOA-t_design_4]": 40, + "test_custom_ls_output[HOA2-16ch_8+4+4]": 32, + "test_custom_ls_output[HOA2-4d4]": 31, + "test_custom_ls_output[HOA2-itu_4+5+1]": 31, + "test_custom_ls_output[HOA2-t_design_4]": 34, + "test_custom_ls_output[HOA3-16ch_8+4+4]": 30, + "test_custom_ls_output[HOA3-4d4]": 29, + "test_custom_ls_output[HOA3-itu_4+5+1]": 30, + "test_custom_ls_output[HOA3-t_design_4]": 32, # Failure reason: TD Object Renderer standalone does not support custom LS input # Comparison with pyaudio3dtools results in bad SNR - "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL]": 0, + "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL]": 8, "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL_ROOM]": 0, - "test_custom_ls_input_binaural[4d4-BINAURAL]": 0, + "test_custom_ls_input_binaural[4d4-BINAURAL]": 6, "test_custom_ls_input_binaural[4d4-BINAURAL_ROOM]": 0, - "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-full_circle_in_15s]": 0, + "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL]": 1, + "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL_ROOM]": 3, + "test_custom_ls_input_binaural[t_design_4-BINAURAL]": 5, + "test_custom_ls_input_binaural[t_design_4-BINAURAL_ROOM]": 0, + "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-full_circle_in_15s]": 7, + "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-rotate_yaw_pitch_roll1]": 6, "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL_ROOM-full_circle_in_15s]": 0, "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, - "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-rotate_yaw_pitch_roll1]": 0, - "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-full_circle_in_15s]": 0, + "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-full_circle_in_15s]": 7, + "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-rotate_yaw_pitch_roll1]": 5, "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL_ROOM-full_circle_in_15s]": 0, "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, - "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-rotate_yaw_pitch_roll1]": 0, - "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-full_circle_in_15s]": 0, + "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-full_circle_in_15s]": 1, + "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-rotate_yaw_pitch_roll1]": 1, "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL_ROOM-full_circle_in_15s]": 3, "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3, - "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-rotate_yaw_pitch_roll1]": 0, - "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-full_circle_in_15s]": 0, + "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-full_circle_in_15s]": 4, + "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-rotate_yaw_pitch_roll1]": 4, "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL_ROOM-full_circle_in_15s]": 0, "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, - "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-rotate_yaw_pitch_roll1]": 0, - "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL]": 0, - "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL_ROOM]": 3, - "test_custom_ls_input_binaural[t_design_4-BINAURAL]": 0, - "test_custom_ls_input_binaural[t_design_4-BINAURAL_ROOM]": 0, - # TODO need to verify 5ms rendering in external renderer - # Crend unit test does not support intermediate conversion to 7_1_4 - # Comparison with pyaudio3dtools results in bad SNR - "test_ism_binaural_headrotation[ISM1-BINAURAL_ROOM-full_circle_in_15s]": 9, + # TODO needs debugging + "test_ism_binaural_headrotation[ISM2-BINAURAL-rotate_yaw_pitch_roll1]": 34, + "test_ism_binaural_headrotation[ISM3-BINAURAL-rotate_yaw_pitch_roll1]": 34, + "test_ism_binaural_headrotation[ISM4-BINAURAL-rotate_yaw_pitch_roll1]": 33, + # Failure reason: Crend unit test does not support intermediate conversion to 7_1_4 + "test_ism_binaural_headrotation[ISM1-BINAURAL_ROOM-full_circle_in_15s]": 10, "test_ism_binaural_headrotation[ISM1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 4, "test_ism_binaural_headrotation[ISM2-BINAURAL_ROOM-full_circle_in_15s]": 10, "test_ism_binaural_headrotation[ISM2-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3, - "test_ism_binaural_headrotation[ISM2-BINAURAL-rotate_yaw_pitch_roll1]": 24, "test_ism_binaural_headrotation[ISM3-BINAURAL_ROOM-full_circle_in_15s]": 10, "test_ism_binaural_headrotation[ISM3-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 4, - "test_ism_binaural_headrotation[ISM3-BINAURAL-rotate_yaw_pitch_roll1]": 24, "test_ism_binaural_headrotation[ISM4-BINAURAL_ROOM-full_circle_in_15s]": 10, "test_ism_binaural_headrotation[ISM4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 4, - "test_ism_binaural_headrotation[ISM4-BINAURAL-rotate_yaw_pitch_roll1]": 24, "test_ism_binaural_static[ISM1-BINAURAL_ROOM]": 23, "test_ism_binaural_static[ISM2-BINAURAL_ROOM]": 21, "test_ism_binaural_static[ISM3-BINAURAL_ROOM]": 21, "test_ism_binaural_static[ISM4-BINAURAL_ROOM]": 21, - # TODO needs debugging - # Failure reason: minor differences could be due to crossfades or metadata position rounding - "test_ism[ISM1-5_1_2]": 48, - "test_ism[ISM1-5_1_4]": 48, - "test_ism[ISM1-5_1]": 48, - "test_ism[ISM1-7_1_4]": 46, - "test_ism[ISM1-7_1]": 45, - "test_ism[ISM1-FOA]": 44, - "test_ism[ISM1-HOA2]": 40, - "test_ism[ISM1-HOA3]": 37, - "test_ism[ISM1-STEREO]": 54, - "test_ism[ISM2-5_1_2]": 46, - "test_ism[ISM2-5_1_4]": 45, + # Failure Reason: Casting of positions in renderer to int16_t vs. float in python + "test_ism[ISM1-STEREO]": 50, + "test_ism[ISM2-STEREO]": 54, + "test_ism[ISM4-STEREO]": 55, + "test_ism[ISM3-STEREO]": 51, + "test_ism[ISM1-5_1]": 43, + "test_ism[ISM1-5_1_2]": 43, + "test_ism[ISM1-5_1_4]": 43, + "test_ism[ISM1-7_1]": 40, + "test_ism[ISM1-7_1_4]": 41, + "test_ism[ISM1-FOA]": 49, + "test_ism[ISM1-HOA2]": 45, + "test_ism[ISM1-HOA3]": 42, "test_ism[ISM2-5_1]": 47, - "test_ism[ISM2-7_1_4]": 43, - "test_ism[ISM2-7_1]": 45, - "test_ism[ISM2-FOA]": 41, - "test_ism[ISM2-HOA2]": 37, - "test_ism[ISM2-HOA3]": 34, - "test_ism[ISM2-STEREO]": 55, - "test_ism[ISM3-5_1_2]": 44, - "test_ism[ISM3-5_1_4]": 43, + "test_ism[ISM2-5_1_2]": 44, + "test_ism[ISM2-5_1_4]": 43, + "test_ism[ISM2-7_1]": 44, + "test_ism[ISM2-7_1_4]": 41, + "test_ism[ISM2-FOA]": 47, + "test_ism[ISM2-HOA2]": 43, + "test_ism[ISM2-HOA3]": 40, "test_ism[ISM3-5_1]": 45, - "test_ism[ISM3-7_1_4]": 42, - "test_ism[ISM3-7_1]": 44, - "test_ism[ISM3-FOA]": 39, - "test_ism[ISM3-HOA2]": 36, - "test_ism[ISM3-HOA3]": 33, - "test_ism[ISM3-STEREO]": 54, - "test_ism[ISM4-5_1_2]": 44, - "test_ism[ISM4-5_1_4]": 44, + "test_ism[ISM3-5_1_2]": 43, + "test_ism[ISM3-5_1_4]": 42, + "test_ism[ISM3-7_1]": 43, + "test_ism[ISM3-7_1_4]": 41, + "test_ism[ISM3-FOA]": 47, + "test_ism[ISM3-HOA2]": 43, + "test_ism[ISM3-HOA3]": 40, "test_ism[ISM4-5_1]": 46, - "test_ism[ISM4-7_1_4]": 43, - "test_ism[ISM4-7_1]": 44, - "test_ism[ISM4-FOA]": 40, - "test_ism[ISM4-HOA2]": 36, - "test_ism[ISM4-HOA3]": 33, - "test_ism[ISM4-STEREO]": 57, + "test_ism[ISM4-5_1_2]": 43, + "test_ism[ISM4-5_1_4]": 43, + "test_ism[ISM4-7_1]": 45, + "test_ism[ISM4-7_1_4]": 41, + "test_ism[ISM4-FOA]": 47, + "test_ism[ISM4-HOA2]": 43, + "test_ism[ISM4-HOA3]": 40, # TODO delay alignment of LFE in binaural output # Failure reason: bitexact except for delay alignment of LFE signal (Issue 59) "test_multichannel_binaural_headrotation[5_1-BINAURAL-full_circle_in_15s]": 7, @@ -411,6 +443,12 @@ pass_snr = { "test_multichannel_binaural_headrotation[7_1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3, "test_multichannel_binaural_headrotation[7_1_4-BINAURAL_ROOM-full_circle_in_15s]": 10, "test_multichannel_binaural_headrotation[7_1_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3, + # Failure reason: combined format, reasons listed above + "test_metadata[mixed_scene-5_1_2]": 47, + "test_metadata[mixed_scene-7_1]": 48, + "test_metadata[mixed_scene-7_1_4]": 47, + "test_metadata[mixed_scene-5_1_4]": 47, + "test_metadata[mixed_scene-5_1]": 47, ##################################### # # External vs Internal Renderer tests @@ -437,46 +475,42 @@ pass_snr = { "test_ism_binaural_static_vs_decoder[ISM4-BINAURAL_ROOM]": 12, # TODO harmonize panning to stereo # Failure reason ISM to stereo panning is done via EFAP in the renderer and tangent law in decoder, harmonize - "test_ism_vs_decoder[ISM1-STEREO]": 8, - "test_ism_vs_decoder[ISM2-STEREO]": 17, - "test_ism_vs_decoder[ISM3-STEREO]": 14, - "test_ism_vs_decoder[ISM4-STEREO]": 14, - # TODO needs investigation - # Failure reason: likely differences between metadata position rounding (decoder uses ceil()) and crossfades - "test_ism_vs_decoder[ISM1-5_1_2]": 26, - "test_ism_vs_decoder[ISM1-5_1]": 26, - "test_ism_vs_decoder[ISM1-5_1_4]": 26, - "test_ism_vs_decoder[ISM1-7_1]": 26, - "test_ism_vs_decoder[ISM1-7_1_4]": 26, - "test_ism_vs_decoder[ISM1-FOA]": 26, - "test_ism_vs_decoder[ISM1-HOA2]": 26, - "test_ism_vs_decoder[ISM1-HOA3]": 26, - "test_ism_vs_decoder[ISM2-5_1_2]": 31, - "test_ism_vs_decoder[ISM2-5_1_4]": 31, + # "test_ism_vs_decoder[ISM1-STEREO]": 8, + # "test_ism_vs_decoder[ISM2-STEREO]": 17, + # "test_ism_vs_decoder[ISM3-STEREO]": 14, + # "test_ism_vs_decoder[ISM4-STEREO]": 14, + # Failure reason: Decoder sets elevation for non-planar output layouts to 0 "test_ism_vs_decoder[ISM2-5_1]": 6, - "test_ism_vs_decoder[ISM2-7_1_4]": 31, "test_ism_vs_decoder[ISM2-7_1]": 5, - "test_ism_vs_decoder[ISM2-FOA]": 31, - "test_ism_vs_decoder[ISM2-HOA2]": 30, - "test_ism_vs_decoder[ISM2-HOA3]": 29, - "test_ism_vs_decoder[ISM3-5_1_2]": 32, - "test_ism_vs_decoder[ISM3-5_1_4]": 32, "test_ism_vs_decoder[ISM3-5_1]": 8, - "test_ism_vs_decoder[ISM3-7_1_4]": 31, "test_ism_vs_decoder[ISM3-7_1]": 7, - "test_ism_vs_decoder[ISM3-FOA]": 32, - "test_ism_vs_decoder[ISM3-HOA2]": 31, - "test_ism_vs_decoder[ISM3-HOA3]": 29, - "test_ism_vs_decoder[ISM3-MONO]": 77, - "test_ism_vs_decoder[ISM4-5_1_2]": 31, - "test_ism_vs_decoder[ISM4-5_1_4]": 30, "test_ism_vs_decoder[ISM4-5_1]": 8, - "test_ism_vs_decoder[ISM4-7_1_4]": 30, "test_ism_vs_decoder[ISM4-7_1]": 7, + # Failure reason: Bit-exact except for first frame; renderer fades in from defaultObjectPosition(), decoder fades in from 0 + "test_ism_vs_decoder[ISM1-5_1_2]": 27, + "test_ism_vs_decoder[ISM1-5_1_4]": 27, + "test_ism_vs_decoder[ISM1-7_1_4]": 27, + "test_ism_vs_decoder[ISM1-FOA]": 27, + "test_ism_vs_decoder[ISM1-HOA2]": 27, + "test_ism_vs_decoder[ISM1-HOA3]": 27, + "test_ism_vs_decoder[ISM2-5_1_2]": 32, + "test_ism_vs_decoder[ISM2-5_1_4]": 32, + "test_ism_vs_decoder[ISM2-7_1_4]": 32, + "test_ism_vs_decoder[ISM2-FOA]": 32, + "test_ism_vs_decoder[ISM2-HOA2]": 32, + "test_ism_vs_decoder[ISM2-HOA3]": 32, + "test_ism_vs_decoder[ISM3-5_1_2]": 33, + "test_ism_vs_decoder[ISM3-5_1_4]": 33, + "test_ism_vs_decoder[ISM3-7_1_4]": 33, + "test_ism_vs_decoder[ISM3-FOA]": 33, + "test_ism_vs_decoder[ISM3-HOA2]": 33, + "test_ism_vs_decoder[ISM3-HOA3]": 33, + "test_ism_vs_decoder[ISM4-5_1_2]": 31, + "test_ism_vs_decoder[ISM4-5_1_4]": 31, + "test_ism_vs_decoder[ISM4-7_1_4]": 31, "test_ism_vs_decoder[ISM4-FOA]": 31, - "test_ism_vs_decoder[ISM4-HOA2]": 30, - "test_ism_vs_decoder[ISM4-HOA3]": 29, - "test_ism_vs_decoder[ISM4-MONO]": 77, + "test_ism_vs_decoder[ISM4-HOA2]": 32, + "test_ism_vs_decoder[ISM4-HOA3]": 31, # TODO needs investigation # Failure reason: headrotation and crossfade could have differences "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL-full_circle_in_15s]": 4, -- GitLab From 8f61fff4e1f21774d3b23e64a8c3f8af524063e4 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 8 Dec 2022 11:40:49 +0100 Subject: [PATCH 3/8] update some more test thresholds --- tests/renderer/constants.py | 49 +++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index 396efc4a28..ae77c59b88 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -463,27 +463,39 @@ pass_snr = { # Failure reason: conversion to 7_1_4 could be implemented differently w.r.t decoder "test_ism_binaural_headrotation_vs_decoder[ISM1-BINAURAL_ROOM-full_circle_in_15s]": 15, "test_ism_binaural_headrotation_vs_decoder[ISM1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 15, + "test_ism_binaural_headrotation_vs_decoder[ISM2-BINAURAL-rotate_yaw_pitch_roll1]": 55, "test_ism_binaural_headrotation_vs_decoder[ISM2-BINAURAL_ROOM-full_circle_in_15s]": 12, "test_ism_binaural_headrotation_vs_decoder[ISM2-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 13, + "test_ism_binaural_headrotation_vs_decoder[ISM3-BINAURAL-full_circle_in_15s]": 72, + "test_ism_binaural_headrotation_vs_decoder[ISM3-BINAURAL-rotate_yaw_pitch_roll1]": 73, "test_ism_binaural_headrotation_vs_decoder[ISM3-BINAURAL_ROOM-full_circle_in_15s]": 12, "test_ism_binaural_headrotation_vs_decoder[ISM3-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 13, + "test_ism_binaural_headrotation_vs_decoder[ISM4-BINAURAL-full_circle_in_15s]": 71, + "test_ism_binaural_headrotation_vs_decoder[ISM4-BINAURAL-rotate_yaw_pitch_roll1]": 61, "test_ism_binaural_headrotation_vs_decoder[ISM4-BINAURAL_ROOM-full_circle_in_15s]": 12, "test_ism_binaural_headrotation_vs_decoder[ISM4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 13, + # TODO needs investigation "test_ism_binaural_static_vs_decoder[ISM1-BINAURAL_ROOM]": 15, "test_ism_binaural_static_vs_decoder[ISM2-BINAURAL_ROOM]": 12, "test_ism_binaural_static_vs_decoder[ISM3-BINAURAL_ROOM]": 12, "test_ism_binaural_static_vs_decoder[ISM4-BINAURAL_ROOM]": 12, + "test_ism_binaural_static_vs_decoder[ISM3-BINAURAL]": 72, + "test_ism_binaural_static_vs_decoder[ISM4-BINAURAL]": 71, # TODO harmonize panning to stereo # Failure reason ISM to stereo panning is done via EFAP in the renderer and tangent law in decoder, harmonize - # "test_ism_vs_decoder[ISM1-STEREO]": 8, - # "test_ism_vs_decoder[ISM2-STEREO]": 17, - # "test_ism_vs_decoder[ISM3-STEREO]": 14, - # "test_ism_vs_decoder[ISM4-STEREO]": 14, + "test_ism_vs_decoder[ISM1-STEREO]": 8, + "test_ism_vs_decoder[ISM2-STEREO]": 17, + "test_ism_vs_decoder[ISM3-STEREO]": 14, + "test_ism_vs_decoder[ISM4-STEREO]": 14, # Failure reason: Decoder sets elevation for non-planar output layouts to 0 + "test_ism_vs_decoder[ISM1-5_1]": 27, + "test_ism_vs_decoder[ISM1-7_1]": 27, "test_ism_vs_decoder[ISM2-5_1]": 6, "test_ism_vs_decoder[ISM2-7_1]": 5, + "test_ism_vs_decoder[ISM3-MONO]": 73, "test_ism_vs_decoder[ISM3-5_1]": 8, "test_ism_vs_decoder[ISM3-7_1]": 7, + "test_ism_vs_decoder[ISM4-MONO]": 72, "test_ism_vs_decoder[ISM4-5_1]": 8, "test_ism_vs_decoder[ISM4-7_1]": 7, # Failure reason: Bit-exact except for first frame; renderer fades in from defaultObjectPosition(), decoder fades in from 0 @@ -512,30 +524,37 @@ pass_snr = { "test_ism_vs_decoder[ISM4-HOA2]": 32, "test_ism_vs_decoder[ISM4-HOA3]": 31, # TODO needs investigation - # Failure reason: headrotation and crossfade could have differences - "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL-full_circle_in_15s]": 4, - "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL-rotate_yaw_pitch_roll1]": 0, - "test_multichannel_binaural_headrotation_vs_decoder[5_1_4-BINAURAL-full_circle_in_15s]": 4, - "test_multichannel_binaural_headrotation_vs_decoder[5_1_4-BINAURAL-rotate_yaw_pitch_roll1]": 0, - "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL-full_circle_in_15s]": 4, - "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL-rotate_yaw_pitch_roll1]": 0, - # TODO needs investigation + "test_multichannel_binaural_headrotation_vs_decoder[5_1-BINAURAL-full_circle_in_15s]": 74, + "test_multichannel_binaural_headrotation_vs_decoder[5_1-BINAURAL-rotate_yaw_pitch_roll1]": 74, "test_multichannel_binaural_headrotation_vs_decoder[5_1-BINAURAL_ROOM-full_circle_in_15s]": 5, "test_multichannel_binaural_headrotation_vs_decoder[5_1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, + "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL-full_circle_in_15s]": 4, + "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL-rotate_yaw_pitch_roll1]": 0, "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL_ROOM-full_circle_in_15s]": 6, "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, + "test_multichannel_binaural_headrotation_vs_decoder[5_1_4-BINAURAL-full_circle_in_15s]": 4, + "test_multichannel_binaural_headrotation_vs_decoder[5_1_4-BINAURAL-rotate_yaw_pitch_roll1]": 0, "test_multichannel_binaural_headrotation_vs_decoder[5_1_4-BINAURAL_ROOM-full_circle_in_15s]": 7, "test_multichannel_binaural_headrotation_vs_decoder[5_1_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, + "test_multichannel_binaural_headrotation_vs_decoder[7_1-BINAURAL-full_circle_in_15s]": 75, + "test_multichannel_binaural_headrotation_vs_decoder[7_1-BINAURAL-rotate_yaw_pitch_roll1]": 74, "test_multichannel_binaural_headrotation_vs_decoder[7_1-BINAURAL_ROOM-full_circle_in_15s]": 5, "test_multichannel_binaural_headrotation_vs_decoder[7_1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, + "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL-full_circle_in_15s]": 4, + "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL-rotate_yaw_pitch_roll1]": 0, "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL_ROOM-full_circle_in_15s]": 5, "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0, # TODO needs investigation + "test_multichannel_binaural_static_vs_decoder[5_1-BINAURAL]": 74, + "test_multichannel_binaural_static_vs_decoder[5_1-BINAURAL_ROOM]": 18, + "test_multichannel_binaural_static_vs_decoder[5_1_2-BINAURAL]": 75, "test_multichannel_binaural_static_vs_decoder[5_1_2-BINAURAL_ROOM]": 18, + "test_multichannel_binaural_static_vs_decoder[5_1_4-BINAURAL]": 74, "test_multichannel_binaural_static_vs_decoder[5_1_4-BINAURAL_ROOM]": 18, - "test_multichannel_binaural_static_vs_decoder[5_1-BINAURAL_ROOM]": 18, - "test_multichannel_binaural_static_vs_decoder[7_1_4-BINAURAL_ROOM]": 18, + "test_multichannel_binaural_static_vs_decoder[7_1-BINAURAL]": 74, "test_multichannel_binaural_static_vs_decoder[7_1-BINAURAL_ROOM]": 19, + "test_multichannel_binaural_static_vs_decoder[7_1_4-BINAURAL]": 74, + "test_multichannel_binaural_static_vs_decoder[7_1_4-BINAURAL_ROOM]": 18, # Failure reason: Mono downmix significantly different, needs a fix "test_multichannel_vs_decoder[5_1_2-MONO]": 1, "test_multichannel_vs_decoder[5_1_4-MONO]": 1, @@ -565,7 +584,7 @@ pass_snr = { "test_multichannel_vs_decoder[5_1-7_1]": 62, "test_multichannel_vs_decoder[7_1_4-5_1_2]": 63, "test_multichannel_vs_decoder[7_1_4-5_1_4]": 63, - "test_multichannel_vs_decoder[7_1_4-5_1]": 63, + "test_multichannel_vs_decoder[7_1_4-5_1]": 62, "test_multichannel_vs_decoder[7_1_4-7_1]": 62, "test_multichannel_vs_decoder[7_1-5_1_2]": 63, "test_multichannel_vs_decoder[7_1-5_1_4]": 63, -- GitLab From 5d632dd6802f9bc3df69b52d9dc30f990aedb92e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 8 Dec 2022 13:46:37 +0100 Subject: [PATCH 4/8] refactor + enable tangent law stereo panning for ISM in the renderer --- lib_com/ivas_prot.h | 9 +++++++ lib_com/options.h | 1 + lib_dec/ivas_ism_renderer.c | 48 ++++++++++++++++++++++++++++++++++ lib_rend/lib_rend.c | 52 +++++++++++++++++++++++++------------ tests/renderer/constants.py | 12 ++++----- 5 files changed, 99 insertions(+), 23 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2d7ef74210..0f2e298c88 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4673,6 +4673,15 @@ void ivas_ism_render( const int16_t output_frame /* i : output frame length per channel */ ); +#ifdef FIX_REND_ISM_STEREO_PANNING +void ivas_ism_get_stereo_gains( + const float azimuth, /* i : object azimuth */ + const float elevation, /* i : object elevation */ + float *left_gain, /* o : left channel gain */ + float *right_gain /* o : right channel gain */ +); + +#endif void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ diff --git a/lib_com/options.h b/lib_com/options.h index 116dc7fad3..16143aacc1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -181,6 +181,7 @@ #define FIX_REND_ISM_XFADE /* Issue 193: Crossfade inconsistencies in ISM between decoder and external renderer */ #define FIX_REND_ISM_POS_ROUNDING /* Issue 193: (TEMPORARY! Pending fix for #215) Align rounding of ISM position data in external renderer */ +#define FIX_REND_ISM_STEREO_PANNING /* Issue 193: Use tangent panning for ISM to stereo in external renderer */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index d6e91bc197..6346ee82ff 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -144,6 +144,12 @@ void ivas_ism_render( { if ( st_ivas->intern_config == AUDIO_CONFIG_STEREO ) { +#ifdef FIX_REND_ISM_STEREO_PANNING + ivas_ism_get_stereo_gains( st_ivas->hIsmMetaData[i]->azimuth, + st_ivas->hIsmMetaData[i]->elevation, + &gains[i][0], + &gains[i][1] ); +#else float aziRad, eleRad; float y, mappedX, aziRadMapped, A, A2, A3; const float LsAngleRad = 30.0f * PI_OVER_180; @@ -174,6 +180,7 @@ void ivas_ism_render( gains[i][0] = sqrtf( A3 ); gains[i][1] = sqrtf( 1.0f - A3 ); } +#endif } else { @@ -232,3 +239,44 @@ void ivas_ism_render( } return; } + +#ifdef FIX_REND_ISM_STEREO_PANNING +void ivas_ism_get_stereo_gains( + const float azimuth, /* i : object azimuth */ + const float elevation, /* i : object elevation */ + float *left_gain, /* o : left channel gain */ + float *right_gain /* o : right channel gain */ +) +{ + float aziRad, eleRad; + float y, mappedX, aziRadMapped, A, A2, A3; + const float LsAngleRad = 30.0f * PI_OVER_180; + + /* Convert azi and ele to an azi value of the cone of confusion */ + aziRad = azimuth * PI_OVER_180; + eleRad = elevation * PI_OVER_180; + y = ( sinf( aziRad ) * cosf( eleRad ) ); + mappedX = sqrtf( max( 0.0f, 1.0f - ( y * y ) ) ); + aziRadMapped = atan2f( y, mappedX ); + + /* Determine the amplitude panning gains */ + if ( aziRadMapped >= LsAngleRad ) + { /* Left side */ + *left_gain = 1.0f; + *right_gain = 0.0f; + } + else if ( aziRadMapped <= -LsAngleRad ) + { /* Right side */ + *left_gain = 0.0f; + *right_gain = 1.0f; + } + else /* Tangent panning law */ + { + A = tanf( aziRadMapped ) / tanf( LsAngleRad ); + A2 = ( A - 1.0f ) / max( 0.001f, A + 1.0f ); + A3 = 1.0f / ( A2 * A2 + 1.0f ); + *left_gain = sqrtf( A3 ); + *right_gain = sqrtf( 1.0f - A3 ); + } +} +#endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 760987c922..f31c3f4f27 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3791,31 +3791,49 @@ static ivas_error renderIsmToMc( wmops_sub_start( "renderIsmToMc" ); /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ +#ifdef FIX_REND_ISM_STEREO_PANNING + if ( *ismInput->base.ctx.pOutConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) + { + set_zero( currentPanGains, 16 ); + ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, + ismInput->currentPos.elevation, + ¤tPanGains[0], + ¤tPanGains[1] ); + + set_zero( previousPanGains, 16 ); + ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, + ismInput->previousPos.elevation, + &previousPanGains[0], + &previousPanGains[1] ); + } + else +#endif + { #ifdef FIX_REND_ISM_POS_ROUNDING // TODO tmu review when #215 is resolved - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), - (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ), - currentPanGains ) ) != IVAS_ERR_OK ) + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), + (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ), + currentPanGains ) ) != IVAS_ERR_OK ) #else - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ismInput->currentPos.azimuth, ismInput->currentPos.elevation, currentPanGains ) ) != IVAS_ERR_OK ) + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ismInput->currentPos.azimuth, ismInput->currentPos.elevation, currentPanGains ) ) != IVAS_ERR_OK ) #endif - { - return error; - } + { + return error; + } #ifdef FIX_REND_ISM_POS_ROUNDING // TODO tmu review when #215 is resolved - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), - (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), - previousPanGains ) ) != IVAS_ERR_OK ) + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), + (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), + previousPanGains ) ) != IVAS_ERR_OK ) #else - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ismInput->previousPos.azimuth, ismInput->previousPos.elevation, previousPanGains ) ) != IVAS_ERR_OK ) + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, ismInput->previousPos.azimuth, ismInput->previousPos.elevation, previousPanGains ) ) != IVAS_ERR_OK ) #endif - { - return error; + { + return error; + } } - /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, outAudio ); @@ -3849,7 +3867,7 @@ static ivas_error renderIsmToSba( } #ifdef FIX_REND_ISM_POS_ROUNDING - // TODO tmu review when #215 is resolved + // TODO tmu review when #215 is resolved ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), previousPanGains, diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index ae77c59b88..4e1cf96c86 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -376,11 +376,12 @@ pass_snr = { "test_ism_binaural_static[ISM2-BINAURAL_ROOM]": 21, "test_ism_binaural_static[ISM3-BINAURAL_ROOM]": 21, "test_ism_binaural_static[ISM4-BINAURAL_ROOM]": 21, - # Failure Reason: Casting of positions in renderer to int16_t vs. float in python + # Failure Reason: Tangent law panning missing in python scripts "test_ism[ISM1-STEREO]": 50, "test_ism[ISM2-STEREO]": 54, "test_ism[ISM4-STEREO]": 55, "test_ism[ISM3-STEREO]": 51, + # Failure Reason: Casting of positions in renderer to int16_t vs. float in python "test_ism[ISM1-5_1]": 43, "test_ism[ISM1-5_1_2]": 43, "test_ism[ISM1-5_1_4]": 43, @@ -482,11 +483,6 @@ pass_snr = { "test_ism_binaural_static_vs_decoder[ISM3-BINAURAL]": 72, "test_ism_binaural_static_vs_decoder[ISM4-BINAURAL]": 71, # TODO harmonize panning to stereo - # Failure reason ISM to stereo panning is done via EFAP in the renderer and tangent law in decoder, harmonize - "test_ism_vs_decoder[ISM1-STEREO]": 8, - "test_ism_vs_decoder[ISM2-STEREO]": 17, - "test_ism_vs_decoder[ISM3-STEREO]": 14, - "test_ism_vs_decoder[ISM4-STEREO]": 14, # Failure reason: Decoder sets elevation for non-planar output layouts to 0 "test_ism_vs_decoder[ISM1-5_1]": 27, "test_ism_vs_decoder[ISM1-7_1]": 27, @@ -505,24 +501,28 @@ pass_snr = { "test_ism_vs_decoder[ISM1-FOA]": 27, "test_ism_vs_decoder[ISM1-HOA2]": 27, "test_ism_vs_decoder[ISM1-HOA3]": 27, + "test_ism_vs_decoder[ISM1-STEREO]": 27, "test_ism_vs_decoder[ISM2-5_1_2]": 32, "test_ism_vs_decoder[ISM2-5_1_4]": 32, "test_ism_vs_decoder[ISM2-7_1_4]": 32, "test_ism_vs_decoder[ISM2-FOA]": 32, "test_ism_vs_decoder[ISM2-HOA2]": 32, "test_ism_vs_decoder[ISM2-HOA3]": 32, + "test_ism_vs_decoder[ISM2-STEREO]": 32, "test_ism_vs_decoder[ISM3-5_1_2]": 33, "test_ism_vs_decoder[ISM3-5_1_4]": 33, "test_ism_vs_decoder[ISM3-7_1_4]": 33, "test_ism_vs_decoder[ISM3-FOA]": 33, "test_ism_vs_decoder[ISM3-HOA2]": 33, "test_ism_vs_decoder[ISM3-HOA3]": 33, + "test_ism_vs_decoder[ISM3-STEREO]": 33, "test_ism_vs_decoder[ISM4-5_1_2]": 31, "test_ism_vs_decoder[ISM4-5_1_4]": 31, "test_ism_vs_decoder[ISM4-7_1_4]": 31, "test_ism_vs_decoder[ISM4-FOA]": 31, "test_ism_vs_decoder[ISM4-HOA2]": 32, "test_ism_vs_decoder[ISM4-HOA3]": 31, + "test_ism_vs_decoder[ISM4-STEREO]": 32, # TODO needs investigation "test_multichannel_binaural_headrotation_vs_decoder[5_1-BINAURAL-full_circle_in_15s]": 74, "test_multichannel_binaural_headrotation_vs_decoder[5_1-BINAURAL-rotate_yaw_pitch_roll1]": 74, -- GitLab From 8cbb895b07fe7dfdde5e89ca5377491559420e4b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 8 Dec 2022 14:13:13 +0100 Subject: [PATCH 5/8] formatting --- lib_dec/ivas_ism_renderer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 6346ee82ff..ca71e4035d 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -146,9 +146,9 @@ void ivas_ism_render( { #ifdef FIX_REND_ISM_STEREO_PANNING ivas_ism_get_stereo_gains( st_ivas->hIsmMetaData[i]->azimuth, - st_ivas->hIsmMetaData[i]->elevation, - &gains[i][0], - &gains[i][1] ); + st_ivas->hIsmMetaData[i]->elevation, + &gains[i][0], + &gains[i][1] ); #else float aziRad, eleRad; float y, mappedX, aziRadMapped, A, A2, A3; -- GitLab From a1b633b82cfada5e590614f829ff88e9a43dfc60 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 8 Dec 2022 14:25:49 +0100 Subject: [PATCH 6/8] more thresholds --- tests/renderer/constants.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index 4e1cf96c86..a29380551d 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -377,10 +377,10 @@ pass_snr = { "test_ism_binaural_static[ISM3-BINAURAL_ROOM]": 21, "test_ism_binaural_static[ISM4-BINAURAL_ROOM]": 21, # Failure Reason: Tangent law panning missing in python scripts - "test_ism[ISM1-STEREO]": 50, - "test_ism[ISM2-STEREO]": 54, - "test_ism[ISM4-STEREO]": 55, - "test_ism[ISM3-STEREO]": 51, + "test_ism[ISM1-STEREO]": 8, + "test_ism[ISM2-STEREO]": 13, + "test_ism[ISM3-STEREO]": 13, + "test_ism[ISM4-STEREO]": 13, # Failure Reason: Casting of positions in renderer to int16_t vs. float in python "test_ism[ISM1-5_1]": 43, "test_ism[ISM1-5_1_2]": 43, -- GitLab From 18e36be88395024092c9c16c99725632cf72dd00 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 8 Dec 2022 15:51:16 +0100 Subject: [PATCH 7/8] - fix a bug causing incorrectly named output files in tests - reorganise switches in options.h --- lib_com/options.h | 6 +++--- tests/renderer/constants.py | 10 +++++++++- tests/renderer/utils.py | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e389d90910..2011fb56b4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -150,6 +150,9 @@ #define FIX_ITD /* Contribution 16: TD renderer ITD improvement and code cleanup */ #define BRATE_SWITCHING_RENDERING /* Bitrate switching changes related to the renderers */ #define FIX_ISM_DECODER_PRINTOUT /* Issue 229: fix ISM decoder printout */ +#define FIX_REND_ISM_XFADE /* Issue 193: Crossfade inconsistencies in ISM between decoder and external renderer */ +#define FIX_REND_ISM_POS_ROUNDING /* Issue 193: (Temporary solution until fix for #215) Align rounding of ISM position data in external renderer */ +#define FIX_REND_ISM_STEREO_PANNING /* Issue 193: Use tangent panning for ISM to stereo in external renderer */ #define FIX_REND_ROUNDING /* Issue 195: Align float to int16 conversion in renderer with decoder */ #define FIX_REND_MONO_DMX /* Issue 195: Fix mono downmix coefficients in decoder and renderer */ #define FIX_REND_ROT_MC_BIN /* Issue 195: Fix wrong EFAP handle passed to renderer, resulting in no rotation for BINAURAL_ROOM output */ @@ -160,9 +163,6 @@ #define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ -#define FIX_REND_ISM_XFADE /* Issue 193: Crossfade inconsistencies in ISM between decoder and external renderer */ -#define FIX_REND_ISM_POS_ROUNDING /* Issue 193: (TEMPORARY! Pending fix for #215) Align rounding of ISM position data in external renderer */ -#define FIX_REND_ISM_STEREO_PANNING /* Issue 193: Use tangent panning for ISM to stereo in external renderer */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index a80df2a8da..c209aa4ed3 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -435,6 +435,12 @@ pass_snr = { "test_multichannel_binaural_headrotation[7_1-BINAURAL_ROOM-full_circle_in_15s]": 11, "test_multichannel_binaural_headrotation[7_1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 9, "test_multichannel_binaural_headrotation[5_1_2-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 6, + # Failure reason: mixed format, see above + "Ftest_metadata[mixed_scene-5_1]": 47, + "Ftest_metadata[mixed_scene-5_1_2]": 47, + "test_metadata[mixed_scene-7_1]": 48, + "test_metadata[mixed_scene-7_1_4]": 47, + "test_metadata[mixed_scene-5_1_4]": 47, ##################################### # # External vs Internal Renderer tests @@ -467,7 +473,6 @@ pass_snr = { "test_ism_binaural_static_vs_decoder[ISM4-BINAURAL_ROOM]": 12, "test_ism_binaural_static_vs_decoder[ISM3-BINAURAL]": 72, "test_ism_binaural_static_vs_decoder[ISM4-BINAURAL]": 71, - # TODO harmonize panning to stereo # Failure reason: Decoder sets elevation for non-planar output layouts to 0 "test_ism_vs_decoder[ISM1-5_1]": 27, "test_ism_vs_decoder[ISM1-7_1]": 27, @@ -508,6 +513,7 @@ pass_snr = { "test_ism_vs_decoder[ISM4-HOA2]": 30, "test_ism_vs_decoder[ISM4-HOA3]": 29, "test_ism_vs_decoder[ISM4-MONO]": 77, + "test_ism_vs_decoder[ISM4-STEREO]": 31, # TODO needs investigation # Failure reason: headrotation and crossfade could have differences "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL-full_circle_in_15s]": 4, @@ -528,11 +534,13 @@ pass_snr = { "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL_ROOM-full_circle_in_15s]": 16, "test_multichannel_binaural_headrotation_vs_decoder[7_1_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 16, # Failure reason: Differences seem to be purely in late reverb part + "test_multichannel_binaural_static_vs_decoder[5_1-BINAURAL_ROOM]": 18, "test_multichannel_binaural_static_vs_decoder[5_1_2-BINAURAL_ROOM]": 18, "test_multichannel_binaural_static_vs_decoder[5_1_4-BINAURAL]": 74, "test_multichannel_binaural_static_vs_decoder[5_1_4-BINAURAL_ROOM]": 18, "test_multichannel_binaural_static_vs_decoder[7_1-BINAURAL]": 74, "test_multichannel_binaural_static_vs_decoder[7_1-BINAURAL_ROOM]": 19, + "test_multichannel_binaural_static_vs_decoder[7_1_4-BINAURAL_ROOM]": 18, # Failure reason: R channel in MONO output is delayed "test_multichannel_vs_decoder[5_1_2-MONO]": 1, "test_multichannel_vs_decoder[5_1_4-MONO]": 1, diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index b22cdc9f69..6030440f07 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -443,7 +443,7 @@ def compare_renderer_vs_decoder(test_info, in_fmt, out_fmt, **kwargs): if in_fmt in FORMAT_TO_METADATA_FILES.keys(): tmp_fmt = "EXT" in_meta_files = [ - str(tmp_dir.joinpath(f"{in_fmt}_to_EXT.wav.{n}.csv")) + str(tmp_dir.joinpath(f"{in_fmt}_to_EXT{trj_name}.wav.{n}.csv")) for n in range(int(in_fmt[-1])) ] else: -- GitLab From 54f18ddaa84e30efc52081a96d2cd7bf1fbc2596 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 8 Dec 2022 16:02:06 +0100 Subject: [PATCH 8/8] fix typo --- tests/renderer/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index c209aa4ed3..adb600768f 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -436,8 +436,8 @@ pass_snr = { "test_multichannel_binaural_headrotation[7_1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 9, "test_multichannel_binaural_headrotation[5_1_2-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 6, # Failure reason: mixed format, see above - "Ftest_metadata[mixed_scene-5_1]": 47, - "Ftest_metadata[mixed_scene-5_1_2]": 47, + "test_metadata[mixed_scene-5_1]": 47, + "test_metadata[mixed_scene-5_1_2]": 47, "test_metadata[mixed_scene-7_1]": 48, "test_metadata[mixed_scene-7_1_4]": 47, "test_metadata[mixed_scene-5_1_4]": 47, -- GitLab