From ba32d8677097d1179b21736ec5e57bff9d569e1d Mon Sep 17 00:00:00 2001 From: marc emerit Date: Wed, 9 Jul 2025 14:34:10 +0200 Subject: [PATCH] initial version --- lib_com/options.h | 2 ++ lib_dec/ivas_jbm_dec.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d28fa86b2..64b272753 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,6 +184,8 @@ #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to actiate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on )*/ +#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ + /* #################### End BASOP porting switches ############################ */ /* clang-format on */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 094a861d1..9c9b653f9 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1564,10 +1564,27 @@ ivas_error ivas_jbm_dec_flush_renderer( { if ( mc_mode_old == MC_MODE_MCT ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + int16_t crendInPlaceRotation = FALSE; + + if ( st_ivas->transport_config != intern_config_old && ( intern_config_old == IVAS_AUDIO_CONFIG_FOA || intern_config_old == IVAS_AUDIO_CONFIG_HOA2 || intern_config_old == IVAS_AUDIO_CONFIG_HOA3 ) ) + { + if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) < ( hIntSetupOld->nchan_out_woLFE + hIntSetupOld->num_lfe ) ) + { + crendInPlaceRotation = TRUE; + ivas_mc2sba( st_ivas->hTransSetup, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, hIntSetupOld->ambisonics_order, GAIN_LFE ); + } + } +#endif if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV || renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, + hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : st_ivas->hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -2198,7 +2215,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ) { + +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + int32_t nsamp_to_allocate; +#else int16_t nsamp_to_allocate; +#endif DECODER_TC_BUFFER_HANDLE hTcBuffer; int16_t nMaxSlotsPerSubframe; int16_t nchan_residual; @@ -2277,8 +2299,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); } +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + set_zero_l( hTcBuffer->tc_buffer, nsamp_to_allocate ); +#else set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); - +#endif offset = 0; for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { @@ -2323,7 +2348,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + int32_t nsamp_to_allocate, offset; + int16_t n_samp_full, n_samp_residual, nchan_residual; +#else int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual; +#endif int16_t ch_idx; DECODER_TC_BUFFER_HANDLE hTcBuffer; @@ -2410,8 +2440,11 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); } +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + set_zero_l( hTcBuffer->tc_buffer, nsamp_to_allocate ); +#else set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); - +#endif offset = 0; for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { -- GitLab