diff --git a/lib_com/options.h b/lib_com/options.h index ab8aa2878472cfe151f149571efebbe8f7129695..bcb56c66efd5d4891d02a7d1ab9a1246b6a12a20 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -207,6 +207,7 @@ #define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */ #define FIX_1349_TNS_CRASH /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ +#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */ // object-editing feature porting #define OBJ_EDITING_API /* object editing changes related to the API */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index bd051a922056b38929dd59023e1f738258a23df3..69c270b13c06f7df1fd83371aecab91f28611651 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -132,7 +132,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif /* transfer subframe info from DirAC or ParamMC to central tc buffer */ /* only do this if we are not having done everything already in the TC decoding part and having only played out from the TC buffer */ if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && st_ivas->hTcBuffer->tc_buffer_mode != TC_BUFFER_MODE_BUFFER ) @@ -153,10 +155,19 @@ static ivas_error ivas_ism_bitrate_switching_dec( #ifdef FIX_HRTF_LOAD /* flush already done in IVAS_DEC_ReadFormat() */ #else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) - { - return error; - } +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + /* write back info for correct rendering of the flushable samples */ + int16_t nchan_transport_ref = st_ivas->nchan_transport; + st_ivas->nchan_transport = nchan_transport_old; + +#endif + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + st_ivas->nchan_transport = nchan_transport_ref; +#endif #endif } /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ @@ -167,7 +178,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } +#endif if ( st_ivas->ism_mode != last_ism_mode ) { @@ -307,19 +320,26 @@ static ivas_error ivas_ism_bitrate_switching_dec( * floating-point output audio buffers *-----------------------------------------------------------------*/ +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } +#endif /*-----------------------------------------------------------------* * JBM TC buffers *-----------------------------------------------------------------*/ + +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif int16_t tc_nchan_full_new; DECODER_TC_BUFFER_HANDLE hTcBuffer; @@ -355,7 +375,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } +#endif #ifdef FIX_HRTF_LOAD return IVAS_ERR_OK; @@ -448,6 +470,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { + #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) #else diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f1f183463e06c4a9d2dedde149244391f8426fcc..6f0567d1652b2cf388b09a92de4c6c91abf79d92 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1219,8 +1219,11 @@ ivas_error IVAS_DEC_ReadFormat( render what still fits in the new granularity */ int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + st_ivas->nchan_transport = nchan_transport_old; +#else // st_ivas->nchan_transport = nchan_transport_old; // ToDo: temporarily deactivated to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1200 - +#endif if ( st_ivas->ivas_format == MASA_FORMAT ) { st_ivas->nchan_ism = 0; // ToDo: temporary hack to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1199