Loading lib_com/ivas_prot.h +9 −0 Original line number Diff line number Diff line Loading @@ -4661,6 +4661,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 +5 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,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 */ Loading @@ -159,6 +162,8 @@ #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 FIX_ITD_CNG /* Eri: Fix for CNG ITD */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading 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 @@ -152,6 +156,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 @@ -182,6 +192,7 @@ void ivas_ism_render( gains[i][0] = sqrtf( A3 ); gains[i][1] = sqrtf( 1.0f - A3 ); } #endif } else { Loading @@ -192,8 +203,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 @@ -234,3 +251,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_sba_rendering.c +15 −0 Original line number Diff line number Diff line Loading @@ -305,20 +305,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]; } Loading lib_rend/lib_rend.c +57 −7 Original line number Diff line number Diff line Loading @@ -3964,15 +3964,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 ) #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; } } /* 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 ); Loading Loading @@ -4005,7 +4039,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 ) ) Loading @@ -4014,7 +4056,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. Loading Loading
lib_com/ivas_prot.h +9 −0 Original line number Diff line number Diff line Loading @@ -4661,6 +4661,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 +5 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,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 */ Loading @@ -159,6 +162,8 @@ #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 FIX_ITD_CNG /* Eri: Fix for CNG ITD */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading
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 @@ -152,6 +156,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 @@ -182,6 +192,7 @@ void ivas_ism_render( gains[i][0] = sqrtf( A3 ); gains[i][1] = sqrtf( 1.0f - A3 ); } #endif } else { Loading @@ -192,8 +203,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 @@ -234,3 +251,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_sba_rendering.c +15 −0 Original line number Diff line number Diff line Loading @@ -305,20 +305,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]; } Loading
lib_rend/lib_rend.c +57 −7 Original line number Diff line number Diff line Loading @@ -3964,15 +3964,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 ) #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; } } /* 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 ); Loading Loading @@ -4005,7 +4039,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 ) ) Loading @@ -4014,7 +4056,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. Loading