diff --git a/lib_com/options.h b/lib_com/options.h index 04cbfaa19d6bbe24170f2284c23e60e0031ea040..1a8d9f114c2381933325699c8c5bcf09f104e7a5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,6 +100,9 @@ #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate 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*/ + #define FIX_1741_REVERB_TIMES_Q_FORMAT /* Philips: reverberation times in Q26 format instead of Q31 */ #define FIX_1831_REVERB_REGRESSION /* Philips: fixes reverb regression issues */ #define FIX_1835_REVERB_ACTIVATION /* FhG: Modified reverberation activation logic and corrected factEQ calculation */ diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 20f0f1de22b16e7bb27c5d23e82c7affcccbf7de..032946c48df56071d5c7af4fb5a3ee801dc8057c 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2796,6 +2796,23 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { IF( EQ_16( mc_mode_old, MC_MODE_MCT ) ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + int16_t crendInPlaceRotation = FALSE; + + test(); + test(); + test(); + IF( NE_16( st_ivas->transport_config, intern_config_old ) && ( EQ_16( intern_config_old, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( intern_config_old, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_16( intern_config_old, IVAS_AUDIO_CONFIG_HOA3 ) ) ) + { + IF( GT_16( sub( add( hIntSetupOld->nchan_out_woLFE, hIntSetupOld->num_lfe ), add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ) ), 0 ) ) + { + crendInPlaceRotation = TRUE; + move16(); + ivas_mc2sba_fx( st_ivas->hTransSetup, hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, hIntSetupOld->ambisonics_order, GAIN_LFE_FX ); + } + } +#endif + test(); IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { @@ -2811,10 +2828,15 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( } *st_ivas->hCrendWrapper->p_io_qfactor = 11; move16(); - +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + IF( NE_32( 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_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ), + IVAS_ERR_OK ) ) +#else IF( NE_32( ( 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_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -3526,7 +3548,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( const Word16 n_samples_granularity /* i : granularity of the renderer/buffer */ ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + Word32 nsamp_to_allocate; +#else Word16 nsamp_to_allocate; +#endif DECODER_TC_BUFFER_HANDLE hTcBuffer; Word16 nMaxSlotsPerSubframe; Word16 nchan_residual; @@ -3571,7 +3597,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( hTcBuffer->nb_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; move16(); nsamp_to_allocate = 0; +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + move32(); +#else move16(); +#endif tmp32 = L_mult0( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, hTcBuffer->n_samples_granularity ); // Q0 tmp = BASOP_Util_Divide3232_Scale( st_ivas->hDecoderConfig->output_Fs, tmp32, &tmp_e ); @@ -3609,8 +3639,13 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( move16(); } +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + nsamp_to_allocate = L_mult0( hTcBuffer->nchan_buffer_full, n_samp_full ); + nsamp_to_allocate = L_add( nsamp_to_allocate, L_mult0( nchan_residual, n_samp_residual ) ); +#else nsamp_to_allocate = mult0( hTcBuffer->nchan_buffer_full, n_samp_full ); nsamp_to_allocate = add( nsamp_to_allocate, mult0( nchan_residual, n_samp_residual ) ); +#endif IF( nsamp_to_allocate == 0 ) { @@ -3629,7 +3664,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( { 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_zero2_fx( hTcBuffer->tc_buffer_fx, nsamp_to_allocate ); +#else set32_fx( hTcBuffer->tc_buffer_fx, 0, nsamp_to_allocate ); +#endif offset = 0; move16(); @@ -3677,7 +3716,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( const Word16 n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + Word32 nsamp_to_allocate, offset; + Word16 n_samp_full, n_samp_residual, nchan_residual; +#else Word16 nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual; +#endif Word16 ch_idx; DECODER_TC_BUFFER_HANDLE hTcBuffer; @@ -3737,8 +3781,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( n_samp_residual = 0; move16(); } + +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + nsamp_to_allocate = L_mult0( hTcBuffer->nchan_buffer_full, n_samp_full ); + nsamp_to_allocate = L_add( nsamp_to_allocate, L_mult0( nchan_residual, n_samp_residual ) ); +#else nsamp_to_allocate = imult1616( hTcBuffer->nchan_buffer_full, n_samp_full ); nsamp_to_allocate = add( nsamp_to_allocate, imult1616( nchan_residual, n_samp_residual ) ); +#endif IF( nsamp_to_allocate == 0 ) { @@ -3757,19 +3807,35 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( { 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_zero2_fx( hTcBuffer->tc_buffer_fx, nsamp_to_allocate ); +#else set32_fx( hTcBuffer->tc_buffer_fx, 0, nsamp_to_allocate ); +#endif offset = 0; +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + move32(); +#else move16(); +#endif FOR( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + offset = L_add( offset, n_samp_full ); +#else offset = add( offset, n_samp_full ); +#endif } FOR( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + offset = L_add( offset, n_samp_residual ); +#else offset = add( offset, n_samp_residual ); +#endif } FOR( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { @@ -3780,14 +3846,26 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( move16(); offset = 0; +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + move32(); +#else move16(); +#endif FOR( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + offset = L_add( offset, n_samp_full ); +#else offset = add( offset, n_samp_full ); +#endif } FOR( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { +#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT + offset = L_add( offset, n_samp_residual ); +#else offset = add( offset, n_samp_residual ); +#endif } } ELSE