From ec12834622a01b2833817478d5d10c450a43f476 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 7 May 2025 11:20:16 +0200 Subject: [PATCH 1/2] remove sum_l() leftover --- lib_com/prot_fx.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 45641b3f8..afae8dfbf 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -11252,12 +11252,6 @@ int16_t sum_s( const int16_t lvec /* i : length of input vector */ ); -/*! r: sum of all vector elements */ -int32_t sum_l( - const int32_t *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - /*! r: sum of all squared vector elements */ float sum2_f( const float *vec, /* i : input vector */ -- GitLab From 4179ea850e4bc1837b2b825af89899f088482758 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 13 Jun 2025 20:51:26 +0200 Subject: [PATCH 2/2] formatting --- lib_com/ivas_dirac_com_fx.c | 4 +--- lib_dec/ivas_dirac_dec_fx.c | 9 ++++++++- lib_dec/ivas_ism_dec_fx.c | 16 +++++----------- lib_dec/ivas_jbm_dec_fx.c | 10 +++++----- lib_dec/ivas_objectRenderer_internal_fx.c | 6 +----- lib_dec/ivas_sba_dec_fx.c | 8 +++----- lib_enc/ivas_enc_fx.c | 6 ++---- lib_enc/ivas_ism_enc_fx.c | 4 ++-- lib_rend/ivas_objectRenderer_fx.c | 2 +- lib_rend/ivas_reverb_fx.c | 18 +++++++++--------- 10 files changed, 37 insertions(+), 46 deletions(-) diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 0c913499b..017181d07 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -179,9 +179,7 @@ ivas_error ivas_dirac_config_fx( test(); IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) /* skip for MASA decoder */ { - IF( NE_32( ( error = ivas_dirac_sba_config_fx( hQMetaData, element_mode, ivas_total_brate, sba_order, sub( hConfig->nbands, spar_dirac_split_band ), - ivas_format ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_dirac_sba_config_fx( hQMetaData, element_mode, ivas_total_brate, sba_order, sub( hConfig->nbands, spar_dirac_split_band ), ivas_format ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 8ac4fadf0..e3b32d3fc 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -798,8 +798,10 @@ static ivas_error ivas_dirac_rend_config_fx( nchan_transport_tmp = nchan_transport; move16(); } + /* close and reopen the decorrelator */ ivas_dirac_dec_decorr_close_fx( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); + IF( NE_32( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, hDirACRend->synthesisConf, hDirACRend->frequency_axis_fx, nchan_transport_tmp, output_Fs ) ), IVAS_ERR_OK ) ) @@ -1102,12 +1104,14 @@ ivas_error ivas_dirac_dec_config_fx( common_rend_config_flag = flag_config_inp; move32(); } + IF( NE_32( ( error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, common_rend_config_flag, dec_param_estim_new, st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, hodirac_flag, 0 ) ), IVAS_ERR_OK ) ) { return error; } + IF( need_dirac_rend ) { IF( st_ivas->hDirACRend == NULL ) @@ -1167,13 +1171,15 @@ ivas_error ivas_dirac_dec_config_fx( { st_ivas->hDiracDecBin[pos_idx]->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr; } - IF( !st_ivas->hDiracDecBin[0]->useTdDecorr ) + IF( !st_ivas->hDiracDecBin[0]->useTdDecorr ) { IF( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params == NULL ) { Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; + ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); + IF( NE_32( ( error = ivas_dirac_dec_decorr_open_fx( &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, DIRAC_SYNTHESIS_PSD_LS, frequency_axis_fx, BINAURAL_CHANNELS, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) @@ -1182,6 +1188,7 @@ ivas_error ivas_dirac_dec_config_fx( } } } + FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor_fx = configure_reqularization_factor_fx( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 13e888af3..727a0a651 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -454,16 +454,12 @@ ivas_error ivas_ism_dec_config_fx( IF( st_ivas->ini_active_frame != 0 ) { /* ISM bit-rate switching */ + test(); + IF( ( NE_16( st_ivas->ism_mode, last_ism_mode ) ) || ( NE_32( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) ) { - test(); - IF( ( NE_16( st_ivas->ism_mode, last_ism_mode ) ) || ( NE_32( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) ) + IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) ) { - IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, - data ) ), - IVAS_ERR_OK ) ) - { - return error; - } + return error; } } } @@ -486,9 +482,7 @@ ivas_error ivas_ism_dec_config_fx( /* ISM mode switching */ IF( NE_32( st_ivas->ism_mode, last_ism_mode ) ) { - IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, - data ) ), - IVAS_ERR_OK ) ) + IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index c21f182da..c7863bb98 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2266,17 +2266,16 @@ ivas_error ivas_jbm_dec_render_fx( } } - if ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - if ( ( error = ivas_rend_crendProcessSubframesSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : p_tc_fx, p_output_fx, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_rend_crendProcessSubframesSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : p_tc_fx, p_output_fx, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) { return error; } } - else + ELSE { - IF( NE_32( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : p_tc_fx, p_output_fx, *nSamplesRendered, output_Fs, 0 ) ), IVAS_ERR_OK ) ) @@ -2699,6 +2698,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( st_ivas->hCrendWrapper->p_io_qfactor = &st_ivas->hCrendWrapper->io_qfactor; *st_ivas->hCrendWrapper->p_io_qfactor = 11; + move16(); IF( NE_32( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ), diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 9c603fa93..08bf0f437 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -227,11 +227,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx( move16(); } - IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( st_ivas->hBinRendererTd, - enableCombinedOrientation, - tmp_Quaternion_fx, - tmp_vector_fx ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( st_ivas->hBinRendererTd, enableCombinedOrientation, tmp_Quaternion_fx, tmp_vector_fx ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 8f8a7f486..687991c89 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -411,7 +411,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( st_ivas->hBinRenderer == NULL && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { /* open fastconv binaural renderer */ - if ( NE_32( ( error = ivas_binRenderer_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_binRenderer_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } @@ -423,7 +423,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( EQ_16( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && st_ivas->hMonoDmxRenderer == NULL ) { - if ( NE_32( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } @@ -434,9 +434,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); } - if ( NE_32( ( error = ivas_dirac_sba_config_fx( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ), - st_ivas->ivas_format ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_dirac_sba_config_fx( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ), st_ivas->ivas_format ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index 56299c69d..11368cec8 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -255,8 +255,7 @@ ivas_error ivas_enc_fx( ELSE { IF( ( error = ivas_masa_encode_fx( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, hEncoderConfig->Opt_DTX_ON, -1, - ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 ) ) != - IVAS_ERR_OK ) + ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -648,8 +647,7 @@ ivas_error ivas_enc_fx( } IF( ( error = ivas_masa_encode_fx( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1, - ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 ) ) != - IVAS_ERR_OK ) + ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 122ea1d75..3e7d8afcd 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -360,9 +360,9 @@ ivas_error ivas_ism_enc_fx( { omasa_stereo_sw_cnt = NULL; } + IF( ( error = ivas_ism_metadata_enc_fx( &ism_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, lp_noise_CPE_fx, flag_omasa_ener_brate, omasa_stereo_sw_cnt, st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame ) ) != - IVAS_ERR_OK ) + nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, lp_noise_CPE_fx, flag_omasa_ener_brate, omasa_stereo_sw_cnt, st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index da2c3cce9..9eea08c71 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -931,13 +931,13 @@ ivas_error ivas_td_binaural_renderer_ext_fx( } } - IF( NE_32( ( error = ivas_td_binaural_renderer_unwrap_fx( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, ism_md_subframe_update_ext, p_output_fx, output_frame, num_subframes ) ), IVAS_ERR_OK ) ) { return error; } + IF( hReverb != NULL ) { *exp = sub( *exp, 2 ); diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 74c2a0c0a..b5da38708 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -2555,17 +2555,15 @@ ivas_error ivas_binaural_reverb_open_fastconv_fx( /* THIS PART IS YET TO BE CONVERTED AS REVERB_UTILS.C IS NOT INVOKED IN GPROF */ float t60_flt[CLDFB_NO_CHANNELS_MAX]; float ene_flt[CLDFB_NO_CHANNELS_MAX]; + revTimes = t60; revEne = ene; - if ( NE_32( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, - hHrtfFastConv, - internal_config, - false, - sampling_rate, t60_flt, ene_flt ) ), - IVAS_ERR_OK ) ) + + IF( NE_32( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, internal_config, false, sampling_rate, t60_flt, ene_flt ) ), IVAS_ERR_OK ) ) { return error; } + preDelay = (Word16) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); floatToFixed_arrL( t60_flt, t60, Q31, CLDFB_NO_CHANNELS_MAX ); floatToFixed_arrL( ene_flt, ene, Q31, CLDFB_NO_CHANNELS_MAX ); @@ -2583,17 +2581,19 @@ ivas_error ivas_binaural_reverb_open_fastconv_fx( return error; } + /*------------------------------------------------------------------------- * ivas_binaural_reverb_open_parambin() * * Allocate and initialize binaural room reverberator handle for ParamBin *------------------------------------------------------------------------*/ + ivas_error ivas_binaural_reverb_open_parambin( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ - const Word16 numBins, /* i : number of CLDFB bins Q0 */ - const Word16 numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame Q0 */ + const Word16 numBins, /* i : number of CLDFB bins Q0 */ + const Word16 numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame Q0 */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ - const Word32 sampling_rate, /* i : sampling rate Q0 */ + const Word32 sampling_rate, /* i : sampling rate Q0 */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ ) { -- GitLab