From 311dd987ef8e19c2446c7a133f045fdefe0f3ff7 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 5 Feb 2026 16:23:34 -0500 Subject: [PATCH 1/4] Harmonisation of modif_fs --- lib_com/cng_exc_fx.c | 8 +++++ lib_com/modif_fs_fx.c | 52 ++++++++++++++++++++++++--- lib_com/options.h | 1 + lib_com/prot_fx.h | 9 +++-- lib_dec/ivas_lfe_plc_fx.c | 8 +++++ lib_enc/amr_wb_enc_fx.c | 9 ++++- lib_enc/cng_enc_fx.c | 4 +++ lib_enc/ivas_core_pre_proc_front_fx.c | 24 +++++++++++++ lib_enc/ivas_core_pre_proc_fx.c | 24 +++++++++++++ lib_enc/ivas_front_vad_fx.c | 4 +++ lib_enc/ivas_stereo_icbwe_enc_fx.c | 5 ++- lib_enc/pre_proc_fx.c | 8 +++++ 12 files changed, 148 insertions(+), 8 deletions(-) diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 3ce3e518f..14ddc27d1 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -306,7 +306,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) IF( EQ_16( L_frame, L_FRAME16k ) ) { +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 ); +#else + modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, NULL, NULL ); +#endif } /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */ @@ -419,7 +423,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) IF( EQ_16( L_frame, L_FRAME16k ) ) { +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 ); +#else + modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, NULL, NULL ); +#endif } /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */ diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 97f4ef413..856f0a299 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -42,7 +42,11 @@ /* CALLED FROM : TX/RX */ /*==============================================================================*/ +#ifndef FIX_2410_HARM_MODIF_FS Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ +#else +Word16 modify_Fs_fx( /* o : length of output Q0 */ +#endif const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ Word16 lg, /* i : length of input Q0 */ const Word32 fin, /* i : frequency of input Q0 */ @@ -75,21 +79,32 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q move16(); Word16 filt_len_tmp; const Resampling_cfg *cfg_ptr_fx; + Word16 norm_cfg_ptr; /*-------------------------------------------------------------------* * Find the resampling configuration *-------------------------------------------------------------------*/ +#ifdef FIX_2410_HARM_MODIF_FS + if ( Q_new_inp != NULL ) +#endif + { *Q_new_inp = 0; move16(); + } /* check if fin and fout are the same */ IF( EQ_32( fin, fout ) ) { /* just copy the signal_fx and quit */ Copy( sigIn_fx, sigOut_fx, lg ); +#ifdef FIX_2410_HARM_MODIF_FS + if ( Q_new_inp != NULL ) +#endif + { *mem_decim_size = 0; *Q_new_inp = 0; move16(); move16(); + } return lg; } ELSE @@ -146,8 +161,13 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q } mem_len = shl( filt_len, 1 ); +#ifdef FIX_2410_HARM_MODIF_FS + if ( mem_decim_size != NULL ) +#endif + { *mem_decim_size = mem_len; move16(); + } signal_fx = signal_tab_fx + 2 * L_FILT_MAX + sub( L_FRAME48k, add( mem_len, lg ) ); signal_ana_fx = signal_fx; mem_len_ana = mem_len; @@ -225,8 +245,12 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q { filt_len_tmp = shr( add( filt_len, 1 ), 1 ); } - - Word16 norm_cfg_ptr = norm_s( sub( cfg_ptr_fx->filter_fx[0], 1 ) ); +#ifdef FIX_2410_HARM_MODIF_FS + if ( Q_new_inp != NULL ) +#endif + { + norm_cfg_ptr = norm_s( sub( cfg_ptr_fx->filter_fx[0], 1 ) ); + } FOR( i = 0; i < lg_out; i++ ) { sigOut_fx[i] = round_fx_sat( Interpol_lc_fx( sigIn_ptr, cfg_ptr_fx->filter_fx, frac, fac_num, filt_len_tmp ) ); @@ -240,7 +264,12 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q } sigIn_ptr += add( lshr( j, 15 ), datastep ); } +#ifdef FIX_2410_HARM_MODIF_FS + if ( Q_new_inp != NULL ) +#endif + { *Q_new_inp = negate( norm_cfg_ptr ); + } move16(); /* rescaling */ test(); @@ -259,9 +288,14 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q sigOut_fx[i] = round_fx( L_shl( L_mult( sigOut_fx[i], num_den ), 1 ) ); /*Q0*/ move16(); } +#ifdef FIX_2410_HARM_MODIF_FS + if ( Q_new_inp != NULL ) +#endif + { *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } + } ELSE { test(); @@ -270,9 +304,14 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { num_den = shl_sat( num_den, 1 ); +#ifdef FIX_2410_HARM_MODIF_FS + if ( Q_new_inp != NULL ) +#endif + { *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } + } FOR( i = 0; i < lg_out; i++ ) { sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q0*/ @@ -300,11 +339,16 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q sigOut_fx[i] = round_fx( L_mac( L_deposit_h( sigOut_fx[i] ), sigOut_fx[i], num_den ) ); /*Q0*/ move16(); } +#ifdef FIX_2410_HARM_MODIF_FS + if ( Q_new_inp != NULL ) +#endif + { *Q_new_inp = add( *Q_new_inp, 1 ); move16(); } } } + } ELSE IF( ( LT_16( fac_num, fac_den ) ) && ( ( cfg_ptr_fx->flags_fx & RS_INV_FAC ) != 0 ) ) { FOR( i = 0; i < lg_out; i++ ) @@ -319,7 +363,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q return lg_out; } - +#ifndef FIX_2410_HARM_MODIF_FS Word16 modify_Fs_fx( /* o : length of output Q0 */ const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ Word16 lg, /* i : length of input Q0 */ @@ -585,7 +629,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ return lg_out; } - +#endif /*-------------------------------------------------------------------* * modify_Fs_intcub3m_sup() * diff --git a/lib_com/options.h b/lib_com/options.h index f0eb097b5..cb931fb5b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -94,6 +94,7 @@ #define HARMONIZE_ACELP_ENC /* VA: basop issue 2400: Remove duplicated main ACELP encoder function */ #define FIX_2392_MSAN_DESTROY_DEC /* VA: basop issue 2392: fix MSAN in ivas_destroy_dec_fx() */ +//#define FIX_2410_HARM_MODIF_FS /* VA: basop issue 2410: Remove duplicated modif_Fs */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index e7166845d..0960d7c1f 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -2489,7 +2489,11 @@ Word32 Interpol_lc_fx( ); /* o : length of output Q0 */ -Word16 modify_Fs_ivas_fx( +#ifndef FIX_2410_HARM_MODIF_FS +Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ +#else +Word16 modify_Fs_fx( /* o : length of output Q0 */ +#endif const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ Word16 lg, /* i : length of input Q0 */ const Word32 fin, /* i : frequency of input Q0 */ @@ -2501,6 +2505,7 @@ Word16 modify_Fs_ivas_fx( Word16 *mem_decim_size /*i: size modified for mem_fx*/ ); +#ifndef FIX_2410_HARM_MODIF_FS /* o : length of output Q0 */ Word16 modify_Fs_fx( const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ @@ -2511,7 +2516,7 @@ Word16 modify_Fs_fx( Word16 mem_fx[], /* i/o: filter memory Q0 */ const Word16 nblp /* i : flag indicating if NB low-pass is applied */ ); - +#endif /* o : length of output */ Word16 modify_Fs_intcub3m_sup_fx( const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */ diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 0d3da5e33..f99237f46 100755 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -1001,10 +1001,18 @@ void ivas_lfe_tdplc_fx( Copy_Scale_sig_32_16( rec_frame_fx, rec_frame_16_fx, LFE_PLC_RECLEN, -Q5 ); // Q0 Word16 Q_new_inp, mem_decim_size, size_modified; +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( prevsynth_16_fx + LFE_PLC_BUFLEN - LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); +#else + size_modified = modify_Fs_fx( prevsynth_16_fx + LFE_PLC_BUFLEN - LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); +#endif Scale_sig( rec_frame_us_16_fx, size_modified, negate( Q_new_inp ) ); /* scaling back to Q0 */ +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( rec_frame_16_fx, LFE_PLC_RECLEN, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); +#else + size_modified = modify_Fs_fx( rec_frame_16_fx, LFE_PLC_RECLEN, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); +#endif Scale_sig( rec_frame_us_16_fx, size_modified, negate( Q_new_inp ) ); /* scaling back to Q0 */ /*samples are generated with 48k sampling rate diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index 876cc94fd..b2b432434 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -261,8 +261,11 @@ void amr_wb_enc_fx( /*----------------------------------------------------------------* * Change the sampling frequency to 12.8 kHz *----------------------------------------------------------------*/ +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp, 12800, st->mem_decim_fx, 0 ); - +#else + modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp, 12800, st->mem_decim_fx, 0, NULL, NULL ); +#endif /* update signal buffer */ Copy( new_inp, st->buf_speech_enc + L_FRAME, L_FRAME ); /* Q0 */ Scale_sig( st->buf_speech_enc + L_FRAME, L_FRAME, 1 ); /* Q1 */ @@ -448,7 +451,11 @@ void amr_wb_enc_fx( } ELSE IF( EQ_32( st->input_Fs, 32000 ) || EQ_32( st->input_Fs, 48000 ) ) { +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp_16k, 16000, st->mem_decim16k_fx, 0 ); +#else + modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp_16k, 16000, st->mem_decim16k_fx, 0, NULL, NULL ); +#endif } /*----------------------------------------------------------------* diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index e622c9857..e0b5041c8 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -877,7 +877,11 @@ void CNG_enc_fx( IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0 ); +#else + modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0, NULL, NULL ); +#endif } fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT ); diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index e4576ceaa..6d2b1d0ac 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -440,13 +440,21 @@ void pre_proc_front_ivas_fx( IF( EQ_16( element_mode, IVAS_SCE ) ) { +#ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#else + new_inp_out_size = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#endif Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ st->mem_q = st->q_inp; move16(); Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); +#ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#else + new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#endif Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) @@ -458,11 +466,19 @@ void pre_proc_front_ivas_fx( Word16 length_inp = NS2SA_FX2( input_Fs, L_MEM_RECALC_SCH_NS ); Word16 length_12k8 = NS2SA( INT_FS_12k8, L_MEM_RECALC_SCH_NS ); +#ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#else + new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#endif Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } +#ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#else + new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#endif st->mem_q = st->q_inp; move16(); Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* st->q_inp */ @@ -470,11 +486,19 @@ void pre_proc_front_ivas_fx( IF( lMemRecalc > 0 ) { +#ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx + sub( input_frame, lMemRecalc ), lMemRecalc, input_Fs, new_inp_12k8_fx + sub( L_FRAME, lMemRecalc_12k8 ), INT_FS_12k8, mem_decim_dummy_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#else + new_inp_out_size = modify_Fs_fx( signal_in_fx + sub( input_frame, lMemRecalc ), lMemRecalc, input_Fs, new_inp_12k8_fx + sub( L_FRAME, lMemRecalc_12k8 ), INT_FS_12k8, mem_decim_dummy_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#endif Scale_sig( new_inp_12k8_fx + L_FRAME - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); +#ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#else + new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ +#endif Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE /* DFT stereo */ diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 25bd43935..e4fcae2c0 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -789,12 +789,20 @@ void ivas_compute_core_buffers_fx( } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) { +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#else + size_modified = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#endif Scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#else + size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#endif Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } } @@ -821,22 +829,38 @@ void ivas_compute_core_buffers_fx( move16(); Copy( signal_in_fx - lMemRecalc - length_inp - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#else + size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#endif Scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#else + size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#endif Scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); IF( lMemRecalc > 0 ) { +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#else + size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#endif Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); +#ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#else + size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ +#endif Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } } diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index e4cac36d2..5980d77f0 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -224,7 +224,11 @@ ivas_error front_vad_fx( Copy( hFrontVad->buffer_12k8_fx + L_FFT, hFrontVad->buffer_12k8_fx, L_FFT / 2 ); /* Resample to 12k8 */ +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_ivas_fx( sts[n]->input_fx, input_frame, sts[0]->input_Fs, hFrontVad->buffer_12k8_fx + L_FFT / 2, INT_FS_12k8, hFrontVad->mem_decim_fx, ( sts[0]->max_bwidth == NB ), &Qband, &mem_decim_size ); +#else + modify_Fs_fx( sts[n]->input_fx, input_frame, sts[0]->input_Fs, hFrontVad->buffer_12k8_fx + L_FFT / 2, INT_FS_12k8, hFrontVad->mem_decim_fx, ( sts[0]->max_bwidth == NB ), &Qband, &mem_decim_size ); +#endif /* Preemphasis */ hFrontVad->mem_preemph_fx = shl( hFrontVad->mem_preemph_fx, sub( add( Q_inp, Qband ), hFrontVad->q_mem_preemph_fx ) ); /* Q_inp + Qband */ diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 1fbbd777a..aa80d7330 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -1410,8 +1410,11 @@ void stereo_icBWE_preproc_fx( Scale_sig( temp_inp_fx, L_FRAME48k, sub( 0, hStereoICBWE->q_dataChan_fx ) ); /* q_dataChan_fx */ /* IVAS-219: Re-wire the shb nonref estimation through a lite CLDFB */ +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_ivas_fx( temp_inp_fx, L_FRAME32k, 32000, tempSHB_fx, 16000, hStereoICBWE->mem_decim_shb_ch0_fx, 0, &Q_new_inp, &mem_decim_size ); - +#else + modify_Fs_fx( temp_inp_fx, L_FRAME32k, 32000, tempSHB_fx, 16000, hStereoICBWE->mem_decim_shb_ch0_fx, 0, &Q_new_inp, &mem_decim_size ); +#endif Copy_Scale_sig( tempSHB_fx, shb_speech_nonref_fx, L_FRAME16k, sub( q_shb_speech_nonref_fx, Q_new_inp ) ); /* q_shb_speech_nonref_fx */ return; diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 533ce13eb..485311c17 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -211,7 +211,11 @@ void pre_proc_fx( * Change the sampling frequency to 12.8 kHz *----------------------------------------------------------------*/ +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_12k8, INT_FS_12k8, st->mem_decim_fx, ( const Word16 )( EQ_16( st->max_bwidth, NB ) ) ); +#else + modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_12k8, INT_FS_12k8, st->mem_decim_fx, ( const Word16 )( EQ_16( st->max_bwidth, NB ) ), NULL, NULL ); +#endif Copy( new_inp_12k8, st->buf_speech_enc + L_FRAME32k, L_FRAME ); Scale_sig( st->buf_speech_enc + L_FRAME32k, L_FRAME, 1 ); @@ -1020,7 +1024,11 @@ void pre_proc_fx( } ELSE IF( EQ_32( st->input_Fs, 32000 ) || EQ_32( st->input_Fs, 48000 ) ) { +#ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_16k, sr_core_tmp, st->mem_decim16k_fx, 0 ); +#else + modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_16k, sr_core_tmp, st->mem_decim16k_fx, 0, NULL, NULL ); +#endif } ELSE /* keep memories up-to-date in case of bitrate switching */ { -- GitLab From bfd0ecbb56061d6ee8eadc560651e470aa77d698 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 5 Feb 2026 16:28:07 -0500 Subject: [PATCH 2/4] Fix clang format --- lib_com/modif_fs_fx.c | 40 +++++++++++++-------------- lib_com/prot_fx.h | 18 ++++++------ lib_enc/ivas_core_pre_proc_front_fx.c | 22 +++++++-------- lib_enc/ivas_core_pre_proc_fx.c | 24 ++++++++-------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 856f0a299..e3c6849b5 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -43,9 +43,9 @@ /*==============================================================================*/ #ifndef FIX_2410_HARM_MODIF_FS -Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ +Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ #else -Word16 modify_Fs_fx( /* o : length of output Q0 */ +Word16 modify_Fs_fx( /* o : length of output Q0 */ #endif const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ Word16 lg, /* i : length of input Q0 */ @@ -88,8 +88,8 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( Q_new_inp != NULL ) #endif { - *Q_new_inp = 0; - move16(); + *Q_new_inp = 0; + move16(); } /* check if fin and fout are the same */ IF( EQ_32( fin, fout ) ) @@ -100,10 +100,10 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( Q_new_inp != NULL ) #endif { - *mem_decim_size = 0; - *Q_new_inp = 0; - move16(); - move16(); + *mem_decim_size = 0; + *Q_new_inp = 0; + move16(); + move16(); } return lg; } @@ -165,8 +165,8 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( mem_decim_size != NULL ) #endif { - *mem_decim_size = mem_len; - move16(); + *mem_decim_size = mem_len; + move16(); } signal_fx = signal_tab_fx + 2 * L_FILT_MAX + sub( L_FRAME48k, add( mem_len, lg ) ); signal_ana_fx = signal_fx; @@ -268,7 +268,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( Q_new_inp != NULL ) #endif { - *Q_new_inp = negate( norm_cfg_ptr ); + *Q_new_inp = negate( norm_cfg_ptr ); } move16(); /* rescaling */ @@ -292,9 +292,9 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( Q_new_inp != NULL ) #endif { - *Q_new_inp = add( *Q_new_inp, 1 ); - move16(); - } + *Q_new_inp = add( *Q_new_inp, 1 ); + move16(); + } } ELSE { @@ -308,9 +308,9 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( Q_new_inp != NULL ) #endif { - *Q_new_inp = add( *Q_new_inp, 1 ); - move16(); - } + *Q_new_inp = add( *Q_new_inp, 1 ); + move16(); + } } FOR( i = 0; i < lg_out; i++ ) { @@ -343,12 +343,12 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( Q_new_inp != NULL ) #endif { - *Q_new_inp = add( *Q_new_inp, 1 ); - move16(); + *Q_new_inp = add( *Q_new_inp, 1 ); + move16(); + } } } } - } ELSE IF( ( LT_16( fac_num, fac_den ) ) && ( ( cfg_ptr_fx->flags_fx & RS_INV_FAC ) != 0 ) ) { FOR( i = 0; i < lg_out; i++ ) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 0960d7c1f..302a9efdf 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -2494,15 +2494,15 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ #else Word16 modify_Fs_fx( /* o : length of output Q0 */ #endif - const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ - Word16 lg, /* i : length of input Q0 */ - const Word32 fin, /* i : frequency of input Q0 */ - Word16 sigOut_fx[], /* o : decimated signal Q0 */ - const Word32 fout, /* i : frequency of output Q0 */ - Word16 mem_fx[], /* i/o: filter memory Q0 */ - const Word16 nblp, /* i : flag indicating if NB low-pass is applied */ - Word16 *Q_new_inp, /*scaling added on sigOut_fx */ - Word16 *mem_decim_size /*i: size modified for mem_fx*/ + const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ + Word16 lg, /* i : length of input Q0 */ + const Word32 fin, /* i : frequency of input Q0 */ + Word16 sigOut_fx[], /* o : decimated signal Q0 */ + const Word32 fout, /* i : frequency of output Q0 */ + Word16 mem_fx[], /* i/o: filter memory Q0 */ + const Word16 nblp, /* i : flag indicating if NB low-pass is applied */ + Word16 *Q_new_inp, /*scaling added on sigOut_fx */ + Word16 *mem_decim_size /*i: size modified for mem_fx*/ ); #ifndef FIX_2410_HARM_MODIF_FS diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 6d2b1d0ac..284bf3689 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -443,9 +443,9 @@ void pre_proc_front_ivas_fx( #ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #else - new_inp_out_size = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + new_inp_out_size = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #endif - Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ st->mem_q = st->q_inp; move16(); Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ @@ -453,9 +453,9 @@ void pre_proc_front_ivas_fx( #ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #else - new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #endif - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) { @@ -469,15 +469,15 @@ void pre_proc_front_ivas_fx( #ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #else - new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #endif - Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } #ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #else - new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #endif st->mem_q = st->q_inp; move16(); @@ -491,15 +491,15 @@ void pre_proc_front_ivas_fx( #else new_inp_out_size = modify_Fs_fx( signal_in_fx + sub( input_frame, lMemRecalc ), lMemRecalc, input_Fs, new_inp_12k8_fx + sub( L_FRAME, lMemRecalc_12k8 ), INT_FS_12k8, mem_decim_dummy_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #endif - Scale_sig( new_inp_12k8_fx + L_FRAME - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + Scale_sig( new_inp_12k8_fx + L_FRAME - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); #ifndef FIX_2410_HARM_MODIF_FS new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #else - new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ #endif - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE /* DFT stereo */ { @@ -1281,7 +1281,7 @@ void pre_proc_front_ivas_fx( #ifndef FIX_2404_HARM_SIGNAL_CLAS st->clas = signal_clas_ivas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */ #else - st->clas = signal_clas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */ + st->clas = signal_clas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */ #endif move16(); diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index e4fcae2c0..9134f304d 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -792,18 +792,18 @@ void ivas_compute_core_buffers_fx( #ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #else - size_modified = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + size_modified = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #endif - Scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); #ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #else - size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #endif - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) @@ -828,21 +828,21 @@ void ivas_compute_core_buffers_fx( Word16 length_16k = NS2SA_FX2( INT_FS_16k, L_MEM_RECALC_SCH_NS - DELAY_FIR_RESAMPL_NS ); move16(); - Copy( signal_in_fx - lMemRecalc - length_inp - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ + Copy( signal_in_fx - lMemRecalc - length_inp - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ #ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #else - size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #endif - Scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } #ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #else - size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #endif - Scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); IF( lMemRecalc > 0 ) @@ -852,16 +852,16 @@ void ivas_compute_core_buffers_fx( #else size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #endif - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); #ifndef FIX_2410_HARM_MODIF_FS size_modified = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #else - size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ #endif - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } } ELSE IF( st->idchan == 0 ) -- GitLab From 606d50a4a812fed0ee3d5dcfa3606490297bca36 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 6 Feb 2026 07:20:27 -0500 Subject: [PATCH 3/4] activation of switch --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3e4224cbf..3be09ea81 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,7 @@ #define HARMONIZE_ACELP_ENC /* VA: basop issue 2400: Remove duplicated main ACELP encoder function */ #define FIX_2392_MSAN_DESTROY_DEC /* VA: basop issue 2392: fix MSAN in ivas_destroy_dec_fx() */ -//#define FIX_2410_HARM_MODIF_FS /* VA: basop issue 2410: Remove duplicated modif_Fs */ +#define FIX_2410_HARM_MODIF_FS /* VA: basop issue 2410: Remove duplicated modif_Fs */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ -- GitLab From df1f20c6e48065fe38c0c9ad7a1863778e1a2834 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 6 Feb 2026 07:34:53 -0500 Subject: [PATCH 4/4] simplifications --- lib_com/modif_fs_fx.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index e3c6849b5..bac77c80d 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -79,7 +79,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ move16(); Word16 filt_len_tmp; const Resampling_cfg *cfg_ptr_fx; - Word16 norm_cfg_ptr; /*-------------------------------------------------------------------* * Find the resampling configuration @@ -249,7 +248,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ if ( Q_new_inp != NULL ) #endif { - norm_cfg_ptr = norm_s( sub( cfg_ptr_fx->filter_fx[0], 1 ) ); + *Q_new_inp = negate( norm_s( sub( cfg_ptr_fx->filter_fx[0], 1 ) ) ); } FOR( i = 0; i < lg_out; i++ ) { @@ -264,12 +263,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ } sigIn_ptr += add( lshr( j, 15 ), datastep ); } -#ifdef FIX_2410_HARM_MODIF_FS - if ( Q_new_inp != NULL ) -#endif - { - *Q_new_inp = negate( norm_cfg_ptr ); - } + move16(); /* rescaling */ test(); -- GitLab