Loading apps/renderer.c +17 −0 Original line number Diff line number Diff line Loading @@ -2432,6 +2432,9 @@ static void convertOutputBuffer( int16_t *intBuffer ) { int16_t chnl, smpl, i; #ifdef FIX_REND_ROUNDING float temp; #endif i = 0; Loading @@ -2439,7 +2442,21 @@ static void convertOutputBuffer( { for ( chnl = 0; chnl < numChannels; ++chnl ) { #ifdef FIX_REND_ROUNDING temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; temp = (float) floor( temp + 0.5f ); if ( temp > MAX16B_FLT ) { temp = MAX16B_FLT; } else if ( temp < MIN16B_FLT ) { temp = MIN16B_FLT; } intBuffer[i] = (int16_t) temp; #else intBuffer[i] = (int16_t) roundf( floatBuffer[chnl * numSamplesPerChannel + smpl] ); #endif ++i; } Loading lib_com/ivas_prot.h +9 −0 Original line number Diff line number Diff line Loading @@ -4653,6 +4653,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) */ Loading lib_com/options.h +7 −0 Original line number Diff line number Diff line Loading @@ -150,12 +150,19 @@ #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 */ #define FIX_ITD_CNG /* Eri Contribution 11: Fix for CNG ITD */ #define FIX_VBR_COMPLEXITY /* Issue 234: fix extremely high complexity numbers for IVAS EVS mode */ #define FIX_ISM_INACTIVE_BITS /* Issue 230: fix bitbudget distribution in inactive frames in ISM format */ #define IMPROVE_CMDLINE_ROBUSTNESS /* Issue 233: Improve robustness of command-line parameters */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif lib_dec/ivas_ism_renderer.c +58 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -140,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; Loading Loading @@ -170,6 +180,7 @@ void ivas_ism_render( gains[i][0] = sqrtf( A3 ); gains[i][1] = sqrtf( 1.0f - A3 ); } #endif } else { Loading @@ -180,8 +191,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 ) { Loading Loading @@ -222,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 lib_rend/ivas_rom_rend.c +15 −0 Original line number Diff line number Diff line Loading @@ -361,10 +361,20 @@ const uint32_t ls_LFE_last_idx_CICP19[12] = { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, /* Downmix matrices */ const float ls_conversion_cicpX_mono[12][1] = { #ifdef FIX_REND_MONO_DMX {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.849999964f}, {0.849999964f}, {0.849999964f}, {0.849999964f} #else {1.00000000f}, {1.00000000f}, {1.00000000f}, Loading @@ -373,6 +383,11 @@ const float ls_conversion_cicpX_mono[12][1] = {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, #endif }; const float ls_conversion_cicpX_stereo[12][2] = Loading Loading
apps/renderer.c +17 −0 Original line number Diff line number Diff line Loading @@ -2432,6 +2432,9 @@ static void convertOutputBuffer( int16_t *intBuffer ) { int16_t chnl, smpl, i; #ifdef FIX_REND_ROUNDING float temp; #endif i = 0; Loading @@ -2439,7 +2442,21 @@ static void convertOutputBuffer( { for ( chnl = 0; chnl < numChannels; ++chnl ) { #ifdef FIX_REND_ROUNDING temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; temp = (float) floor( temp + 0.5f ); if ( temp > MAX16B_FLT ) { temp = MAX16B_FLT; } else if ( temp < MIN16B_FLT ) { temp = MIN16B_FLT; } intBuffer[i] = (int16_t) temp; #else intBuffer[i] = (int16_t) roundf( floatBuffer[chnl * numSamplesPerChannel + smpl] ); #endif ++i; } Loading
lib_com/ivas_prot.h +9 −0 Original line number Diff line number Diff line Loading @@ -4653,6 +4653,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) */ Loading
lib_com/options.h +7 −0 Original line number Diff line number Diff line Loading @@ -150,12 +150,19 @@ #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 */ #define FIX_ITD_CNG /* Eri Contribution 11: Fix for CNG ITD */ #define FIX_VBR_COMPLEXITY /* Issue 234: fix extremely high complexity numbers for IVAS EVS mode */ #define FIX_ISM_INACTIVE_BITS /* Issue 230: fix bitbudget distribution in inactive frames in ISM format */ #define IMPROVE_CMDLINE_ROBUSTNESS /* Issue 233: Improve robustness of command-line parameters */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif
lib_dec/ivas_ism_renderer.c +58 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -140,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; Loading Loading @@ -170,6 +180,7 @@ void ivas_ism_render( gains[i][0] = sqrtf( A3 ); gains[i][1] = sqrtf( 1.0f - A3 ); } #endif } else { Loading @@ -180,8 +191,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 ) { Loading Loading @@ -222,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
lib_rend/ivas_rom_rend.c +15 −0 Original line number Diff line number Diff line Loading @@ -361,10 +361,20 @@ const uint32_t ls_LFE_last_idx_CICP19[12] = { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, /* Downmix matrices */ const float ls_conversion_cicpX_mono[12][1] = { #ifdef FIX_REND_MONO_DMX {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.849999964f}, {0.849999964f}, {0.849999964f}, {0.849999964f} #else {1.00000000f}, {1.00000000f}, {1.00000000f}, Loading @@ -373,6 +383,11 @@ const float ls_conversion_cicpX_mono[12][1] = {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, #endif }; const float ls_conversion_cicpX_stereo[12][2] = Loading