From 13c63bf9940844351346a547fd361b319705f23a Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 6 Feb 2026 12:42:00 +0100 Subject: [PATCH 1/6] remove duplicated declarations and unused functions --- lib_com/core_com_config_fx.c | 11 +- lib_com/ivas_prot_fx.h | 4 + lib_com/lpc_tools_fx.c | 23 +-- lib_com/lsf_tools_fx.c | 25 ++- lib_com/prot_fx.h | 352 +++-------------------------------- lib_com/tools_fx.c | 49 ----- lib_enc/core_enc_init_fx.c | 2 +- lib_enc/core_enc_switch_fx.c | 2 +- 8 files changed, 56 insertions(+), 412 deletions(-) diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c index 1afa2f1a9..702ae84a2 100644 --- a/lib_com/core_com_config_fx.c +++ b/lib_com/core_com_config_fx.c @@ -492,13 +492,6 @@ Word16 sr2fscale_fx( return extract_l( Mpy_32_16_1( sr_core, FSCALE_DENOM_BY_12800_Q15 ) ); /*Q0*/ } -Word16 sr2fscale( - const Word32 sr_core /* i : internal sampling rate */ -) -{ - - return (Word16) ( ( FSCALE_DENOM * sr_core ) / 12800 ); -} Word32 getCoreSamplerateMode2( const Word16 element_mode, /* i : IVAS element mode Q0*/ @@ -1127,8 +1120,8 @@ void init_tcx_window_cfg_fx( } /*Mid-OLA*/ /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/ - hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale( sr_core ) ), LD_FSCALE_DENOM ) ); /*Q0*/ - hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale( input_Fs ) ), LD_FSCALE_DENOM ) ); /*Q0*/ + hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale_fx( sr_core ) ), LD_FSCALE_DENOM ) ); /*Q0*/ + hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale_fx( input_Fs ) ), LD_FSCALE_DENOM ) ); /*Q0*/ move16(); move16(); assert( GT_16( hTcxCfg->tcx_mdct_window_half_length, 16 ) && "Half window can not be large enough!" ); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index d87207a90..afb69aa0e 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3911,6 +3911,10 @@ void ivas_omasa_decode_masa_to_total_fx( const Word16 nblocks ); +void ivas_get_stereo_panning_gains_fx( + const Word16 aziDeg, + const Word16 eleDeg, + Word16 panningGains[2] ); /*----------------------------------------------------------------------------------* * TD Binaural Object renderer diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 5b3b8a1c0..a8e750db5 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -446,12 +446,8 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word * Returns: * void */ -Word16 E_LPC_lev_dur( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ ) -{ - return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ -} -Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/, Word16 k_max /*Q15*/ ) +static Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/, Word16 k_max /*Q15*/ ) { Word16 i, j, k; Word16 hi, lo; @@ -636,12 +632,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR return ( flag ); } -Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem ) +Word16 E_LPC_lev_dur( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ ) { - return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ + return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ } -Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max ) +static Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max ) { Word16 i, j, k; Word16 hi, lo; @@ -826,12 +822,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 return ( flag ); } -Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ ) +Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem ) { - return ( E_LPC_lev_dur_stab_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ + return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ } -Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/, Word16 k_max /*Q15*/ ) +static Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/, Word16 k_max /*Q15*/ ) { Word16 i, j, k; Word16 hi, lo; @@ -1016,6 +1012,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* return ( flag ); } +Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ ) +{ + return ( E_LPC_lev_dur_stab_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +} + /* * E_LPC_a_add_tilt diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index c1638a269..46e4c9b9c 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -52,17 +52,16 @@ val2 = shr( ( cbp )[2], 4 ); \ val3 = add( add( shr( lshl( ( cbp )[2], 12 ), 4 ), lshr( lshl( ( cbp )[1], 12 ), 8 ) ), s_and( ( cbp )[0], 0xF ) ); -#define SPC 0.0234952f -#define SPC_plus SPC * 1.001f + /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ -Word16 root_search_fx( Word16 low, Word16 high, Word32 *v_low, Word32 *coef, Word16 order ); -Word32 calc_weight( Word16 delta1, Word16 delta2, Word16 *n1 ); -Word32 polynomial_eval_fx( Word16 f, Word32 *coef, Word16 order ); -void E_LPC_isf_isp_conversion( const Word16 isf[], Word16 isp[], const Word16 m ); -void E_LPC_lsp_lsf_conversion( const Word16 lsp[], Word16 lsf[], const Word16 m ); -Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 ); + +static Word16 root_search_fx( Word16 low, Word16 high, Word32 *v_low, Word32 *coef, Word16 order ); +static Word32 calc_weight( Word16 delta1, Word16 delta2, Word16 *n1 ); +static Word32 polynomial_eval_fx( Word16 f, Word32 *coef, Word16 order ); +static Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 ); +static Word32 poscos_fx( Word16 w ); static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift ) { @@ -940,7 +939,7 @@ void lsp2lpc_fx( * R.A.Salami October 1990 * *-----------------------------------------------------------* */ -Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 ) +static Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 ) { /* All computation in Q23 */ const Word16 *plsp; @@ -3513,7 +3512,7 @@ void lsp_convolve_fx( /*===================================================================*/ -Word32 poscos_fx( Word16 w ) +static Word32 poscos_fx( Word16 w ) { Word16 a, z, z2, z3, z5, z7, z9; Word32 Ltemp; @@ -3571,7 +3570,7 @@ Word32 poscos_fx( Word16 w ) /* _ ( Word16) root in Q15, or 0xffff if no root is found */ /*===================================================================*/ -Word16 root_search_fx( Word16 low, +static Word16 root_search_fx( Word16 low, Word16 high, Word32 *v_low, Word32 *coef, @@ -3689,7 +3688,7 @@ and delta2 */ /* (alpha/(sqrt(delta1*delta2)) */ /*===================================================================*/ -Word32 calc_weight( +static Word32 calc_weight( Word16 delta1, Word16 delta2, Word16 *n1 ) @@ -3741,7 +3740,7 @@ Word32 calc_weight( /*===================================================================*/ /* 40-32 bit conversion */ -Word32 polynomial_eval_fx( Word16 f, +static Word32 polynomial_eval_fx( Word16 f, Word32 *coef, Word16 order ) { diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index e7166845d..466dfcd70 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -195,22 +195,6 @@ Word16 sign16_fx( mslvq_com_fx.c /========================================================================================================*/ -Word16 deindex_lvq_fx( - Word16 *index, /* i : index to be decoded, as an array of 3 short */ - Word16 *x_lvq, /* o : decoded codevector Q(x2.56)*/ - Word16 mode, /* i : LVQ coding mode (select scales & no_lead ), or idx_cv */ - Word16 sf_flag, /* i : safety net flag */ - Word16 no_bits, /* i : number of bits for lattice */ - Word32 *p_offset_scale1, /* i : offset for first subvector */ - Word32 *p_offset_scale2, /* i : offset for the second subvector */ - Word16 *p_no_scales ); - -void deindex_lvq_SHB_fx( - UWord32 index, - Word16 *out, - const Word16 nbits, - const Word16 mode ); - Word32 encode_comb_fx( Word16 *cv, Word16 idx_lead ); @@ -227,89 +211,6 @@ Word32 mslvq_ivas_16( const Word16 pred_flag /* i : prediction flag (0: safety net, 1,2 - predictive )*/ ); -UWord32 index_lvq_SHB_fx( - const Word16 idx_lead, - const Word16 idx_scale, - const Word16 nbits, - Word16 *lat_cv, - const Word16 mode ); - -Word16 deindex_lvq_ivas_fx( - Word16 *index, /* i : index to be decoded, as an array of 3 Word16 */ - Word16 *x_lvq, /* o : decoded codevector Q(x2.56) */ - Word16 mode, /* i : LVQ coding mode/MSLVQ structure index (select scales & no_lead ), or idx_cv for CNG case */ - Word16 sf_flag, /* i : safety net flag */ - Word16 no_bits /* i : number of bits for lattice */ -); - -void permute_fx( - Word16 *pTmp1, /* i/o: vector whose components are to be permuted */ - const Word16 *perm /* i : permutation info (indexes that should be interchanged), max two perms */ -); - -void init_lvq_fx( - Word32 offset_scale1[][MAX_NO_SCALES + 1], - Word32 offset_scale2[][MAX_NO_SCALES + 1], - Word32 offset_scale1_p[][MAX_NO_SCALES + 1], - Word32 offset_scale2_p[][MAX_NO_SCALES + 1], - Word16 no_scales[][2], - Word16 no_scales_p[][2] ); - -Word16 deindex_lvq_cng_fx( - Word16 *index, /* i : index to be decoded, as an array of 3 short */ - Word16 *x_lvq, /* o : decoded codevector Q9*/ - Word16 idx_cv, /* i : relative mode_lvq, wrt START_CNG */ - Word16 no_bits, /* i : number of bits for lattice */ - Word32 *p_offset_scale1, - Word32 *p_offset_scale2, - Word16 *p_no_scales ); - -/*========================================================================================================/ -swb_bwe_com_fx.c -/========================================================================================================*/ - -void calc_normal_length_fx( - const Word16 core, /* i : core */ - const Word16 *sp, /* i : i signal */ - const Word16 mode, /* i : i mode */ - const Word16 extl, /* i : extension layer */ - Word16 *L_swb_norm, /* o : normalize length */ - Word16 *prev_L_swb_norm, /*i/o : last normalize length */ - Word16 Q_syn ); - -void calc_normal_length_fx_32( - const Word16 core, /* i : core : Q0 */ - const Word32 *sp, /* i : i signal : Q12 */ - const Word16 mode, /* i : i mode : Q0 */ - const Word16 extl, /* i : extension layer : Q0 */ - Word16 *L_swb_norm, /* o : normalize length : Q0 */ - Word16 *prev_L_swb_norm /*i/o : last normalize length : Q0 */ -); - -void hq_generic_decoding_fx( - const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ - const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */ - Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */ - const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/ - Word16 *prev_L_swb_norm, /* i/o: last normalize length */ - const Word16 hq_generic_exc_clas, /* i : bwe excitation class */ - const Word16 *R ); - -Word16 WB_BWE_gain_pred_fx( - Word16 *WB_fenv, /* o : WB frequency envelopes */ - const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */ - const Word16 coder_type, /* i : coding type */ - Word16 prev_coder_type, /* i : coding type of last frame */ - Word16 prev_WB_fenv, /* i : envelope for last frame */ - Word16 *voice_factors, /* i : voicing factors Q15 */ - const Word16 pitch_buf[], /* i : pitch buffer Q6 */ - Word32 last_core_brate, /* i : previous frame core bitrate */ - Word16 last_wb_bwe_ener, /* i : previous frame wb bwe signal energy */ - Word16 Q_syn, - Word16 last_extl_fx, - Word16 tilt_wb_fx ); - /* o : Tilt in Q24 */ Word32 calc_tilt_bwe_fx( const Word16 *sp0, /* i : i signal */ @@ -317,95 +218,6 @@ Word32 calc_tilt_bwe_fx( const Word16 N /* i : signal length */ ); -void calc_norm_envelop_fx( - const Word16 SWB_signal[], /* i : SWB spectrum Q_syn*/ - Word32 *envelope, /* o : normalized envelope Q_syn*/ - const Word16 L_swb_norm, /* i : length of envelope Q0 */ - const Word16 SWB_flength, /* i : Length of i /output */ - const Word16 st_offset /* i : offset */ -); - -void WB_BWE_decoding_fx( - const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */ - Word16 *WB_fenv, /* i : WB frequency envelopes */ - Word32 *WB_signal32, /* o : WB signal in MDCT domain */ - const Word16 WB_flength, /* i : Length of i /output */ - const Word16 mode, /* i : classification for WB signal */ - const Word16 last_extl, /* i : extl. layer for last frame */ - Word32 *prev_Energy, /* i/o: energy for last frame */ - Word16 *prev_WB_fenv, /* i/o: envelope for last frame */ - Word16 *prev_L_wb_norm, /* i/o: length for last frame wb norm */ - const Word16 extl, /* i : extension layer */ - const Word16 coder_type, /* i : coding type */ - const Word32 total_brate, /* i : core layer bitrate */ - Word16 *Seed, /* i/o: random generator seed */ - Word16 *prev_flag, /* i/o: attenu flag of last frame */ - Word16 prev_coder_type, /* i : coding type of last frame */ - Word16 Q_syn, - Word16 *Q_syn_hb /* o : Q value of WB_signal_32 */ -); - -void SWB_BWE_decoding_fx( - const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */ - Word16 *SWB_fenv, /* i/o: SWB frequency envelopes */ - Word32 *SWB_signal, /* o : SWB signal in MDCT domain */ - const Word16 SWB_flength, /* i : Length of i /output */ - const Word16 mode, /* i : classification for SWB signal */ - Word16 *frica_flag, /* o : fricative signal flag */ - Word16 *prev_Energy, /* i/o: energy for last frame */ - Word16 *prev_SWB_fenv, /* i/o: envelope for last frame */ - Word16 *prev_L_swb_norm, /* i/o: length for last frame wb norm */ - const Word16 tilt_nb, /* i : tilt of synthesis wb signal */ - Word16 *Seed, /* i/o: random generator seed */ - const Word16 st_offset, /* i : offset value due to different core */ - Word16 *prev_weight, /* i/o: excitation weight value of last frame */ - const Word16 extl, /* i : extension layer */ - Word16 Q_syn, - const Word16 last_extl /* i : extension layer of last frame */ -); - -void time_envelop_shaping_fx( - Word16 werr[], /* i/o: SHB synthesis Q_synth*/ - Word32 SWB_tenv[], /* i/o: frequency envelope Q15*/ - const Word16 L, /* i : frame length */ - Word16 *Q_synth ); - -void time_reduce_pre_echo_fx( - const Word16 *synth, /* i : ACELP core synthesis Q_syn*/ - Word16 *error, /* i/o: SHB BWE synthesis Q0*/ - Word16 prev_td_energy, /* o : last td energy Q0*/ - const Word16 L, /* i : subframe length */ - Word16 Q_syn, - Word16 Q_synth ); - -void calc_norm_envelop_fx_32( - const Word32 SWB_signal_fx[], /* i : SWB spectrum : Q12 */ - Word32 *envelope_fx, /* o : normalized envelope : Q16 */ - const Word16 L_swb_norm, /* i : length of envelope : Q0 */ - const Word16 SWB_flength, /* i : Length of i /output : Q0 */ - const Word16 st_offset /* i : offset : Q0 */ -); - -void hq_generic_decoding_fx( - const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ - const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */ - Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */ - const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/ - Word16 *prev_L_swb_norm, /* i/o: last normalize length */ - const Word16 hq_generic_exc_clas, /* i : bwe excitation class */ - const Word16 *R ); - -void hq_generic_decoding_ivas_fx( - const Word16 HQ_mode, /* i : HQ mode */ - Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ - const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */ - Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */ - const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/ - Word16 *prev_L_swb_norm, /* i/o: last normalize length */ - const Word16 hq_generic_exc_clas, /* i : bwe excitation class */ - const Word16 *R ); - void save_old_syn_fx( const Word16 L_frame, /* i : frame length */ const Word16 syn[], /* i : ACELP synthesis */ @@ -774,9 +586,6 @@ void lsp_convolve_fx( Word32 *p2, Word16 len ); -Word32 poscos_fx( - Word16 w ); - Word32 sub_lsp2lsf_fx( const Word16 lsp_i /* i : lsp[m] (range: -1<=val<1) Q15*/ ); @@ -814,7 +623,7 @@ void E_LPC_isf_isp_conversion( const Word16 isf[], Word16 isp[], const Word16 m ); - + void E_LPC_f_isp_a_conversion( const Word16 *isp, Word16 *a, @@ -845,23 +654,11 @@ void lsp2lpc_fx( Word16 *prev_a, Word16 order ); -void E_LPC_a_lsp_conversion( - const Word16 *a, /* i : LP filter coefficients */ - Word16 *lsp, /* o : Line spectral pairs (in the cosine domain) */ - const Word16 *old_lsp, /* i : LSP vector from past frame */ - const Word16 m /* i : LPC order */ -); - void v_sort( Word16 *r, const Word16 lo, const Word16 up ); -void compute_poly_product_fx( - Word16 *coef, - Word32 *p, - Word16 order ); - void dec_prm_hm_fx( Decoder_State *st, Word16 *prm_hm, /* Q0 */ @@ -1005,14 +802,6 @@ Word16 lsf_stab_ivas_fx( const Word16 L_frame /* i : frame length */ ); -/* o : LP filter stability Q15*/ -Word16 lsf_stab_ivas_fx( - const Word16 *lsf, /* i : LSF vector Q(x2.56)*/ - const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const Word16 L_frame /* i : frame length */ -); - void reorder_isf_fx( Word16 *isf, /* i/o: ISFs in the frequency domain (0..0.5) */ const Word16 min_dist, /* i : minimum required distance */ @@ -1082,11 +871,6 @@ Word16 vq_dec_lvq_ivas_fx( Word16 no_bits /* i : no. bits for lattice */ ); -void a2rc_fx( - const Word16 *a, - Word16 *refl, - Word16 lpcorder ); - void lsp_weights_fx( Word16 lsp_nq_fx[], Word16 w[], @@ -1160,15 +944,6 @@ Word16 E_LPC_lev_dur( const Word16 order, Word16 *parcorr ); -Word16 E_LPC_lev_dur_stab( - const Word16 Rh[], - const Word16 Rl[], - Word16 A[], - Word32 epsP[], - const Word16 order, - Word16 *parcorr, - Word16 k_max ); - Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], @@ -1177,15 +952,6 @@ Word16 E_LPC_lev_dur_ivas_fx( const Word16 order, Word16 *parcorr ); -Word16 E_LPC_lev_dur_stab_ivas_fx( - const Word16 Rh[], - const Word16 Rl[], - Word16 A[], - Word32 epsP[], - const Word16 order, - Word16 *parcorr, - Word16 k_max ); - Word16 E_LPC_lev_dur_fx( const Word16 Rh[], const Word16 Rl[], @@ -1194,15 +960,6 @@ Word16 E_LPC_lev_dur_fx( const Word16 order, Word32 *mem ); -Word16 E_LPC_lev_dur_stab_fx( - const Word16 Rh[], - const Word16 Rl[], - Word32 A[], - Word32 epsP[], - const Word16 order, - Word32 *mem, - Word16 k_max ); - Word16 lev_dur_fx( Word32 *a_fx, /* o : LP coefficients (a[0] = 1.0) Q(q_a)*/ const Word32 *r_fx, /* i : vector of autocorrelations Q(q_r)*/ @@ -1431,7 +1188,6 @@ void hq_configure_evs_fx( Word16 *sfm_end /* o : Subband end coefficients Q0 */ ); -// hp50.c void hp20( Word16 signal[], /* i/o: signal to filter any */ const Word16 stride, /* i : stride to be applied accessing signal */ @@ -2792,14 +2548,15 @@ void hq_generic_decoding_fx( const Word16 hq_generic_exc_clas, /* i : bwe excitation class */ const Word16 *R ); -void save_old_syn_fx( - const Word16 L_frame, /* i : frame length */ - const Word16 syn[], /* i : ACELP synthesis */ - Word16 old_syn[], /* o : old synthesis buffer */ - Word16 old_syn_mem[], /* i/o: old synthesis buffer memory */ - const Word16 preemph_fac, /* i : preemphasis factor */ - Word16 *mem_deemph /* i/o: deemphasis filter memory */ -); +void hq_generic_decoding_ivas_fx( + const Word16 HQ_mode, /* i : HQ mode */ + Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */ + const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */ + Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */ + const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/ + Word16 *prev_L_swb_norm, /* i/o: last normalize length */ + const Word16 hq_generic_exc_clas, /* i : bwe excitation class */ + const Word16 *R ); void find_td_envelope_fx( const Word16 inp[], /* i : input signal Qx */ @@ -3899,6 +3656,19 @@ Word16 deindex_lvq_cng_ivas_fx( Word16 no_bits /* i: number of bits for lattice */ ); +UWord32 index_lvq_SHB_fx( + const Word16 idx_lead, + const Word16 idx_scale, + const Word16 nbits, + Word16 *lat_cv, + const Word16 mode ); + +void deindex_lvq_SHB_fx( + UWord32 index, + Word16 *out, + const Word16 nbits, + const Word16 mode ); + Word16 lsp_convert_poly_fx( Word16 w[], /* i/o: LSP or ISP parameters */ const Word16 L_frame, /* i : flag for up or down conversion */ @@ -8975,12 +8745,6 @@ void stereo_dft_dec_analyze_fx( Word16 *q, Word16 *q_DFT ); -void set32_fx( - Word32 y[], /* i/o: Vector to set */ - const Word32 a, /* i : Value to set the vector to */ - const Word16 N /* i : Lenght of the vector */ -); - void delay_signal_q_adj_fx( Word32 x[], /* i/o: signal to be delayed */ const Word16 len, /* i : length of the input signal */ @@ -9136,11 +8900,6 @@ void calculate_nbits_meta_fx( const Word16 idx_sep_obj, const Word16 ism_imp ); -void ivas_get_stereo_panning_gains_fx( - const Word16 aziDeg, - const Word16 eleDeg, - Word16 panningGains[2] ); - ivas_error openCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ CLDFB_TYPE type, /* i : analysis or synthesis */ @@ -9266,24 +9025,6 @@ Word32 sum_32_fx( const Word16 lvec, /* i : length of input vector */ Word16 *e ); -Word16 vq_dec_lvq_ivas_fx( - Word16 sf_flag, /* i : safety net flag */ - Word16 x[], /* o : Decoded vector Q(x2.56)*/ - Word16 indices[], /* i : Indices */ - Word16 stages, /* i : Number of stages */ - Word16 N, /* i : Vector dimension */ - Word16 mode, /* (i): mode_lvq, or mode_lvq_p */ - Word16 no_bits /* (i): no. bits for lattice */ -); - -Word16 deindex_lvq_ivas_fx( - Word16 *index, /* i : index to be decoded, as an array of 3 Word16 */ - Word16 *x_lvq, /* o : decoded codevector Q(x2.56) */ - Word16 mode, /* i : LVQ coding mode/MSLVQ structure index (select scales & no_lead ), or idx_cv for CNG case */ - Word16 sf_flag, /* i : safety net flag */ - Word16 no_bits /* i : number of bits for lattice */ -); - void deleteCldfb_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ ); @@ -9466,6 +9207,7 @@ Word32 mean_no_sat_Word32_fx( const Word32 *vec_fx, /* i : input vector Qx */ const Word16 lvec_fx, /* i : length of input vector */ const Word16 gb ); + void sort( UWord16 *x, /* i/o: Vector to be sorted */ UWord16 len /* i/o: vector length */ @@ -9813,20 +9555,6 @@ void v_multc_att32( const Word16 N /* i : Vector length */ ); -void v_multc_att3232( - const Word32 x[], /* i : Input vector Qx */ - const Word32 att, /* i : Constant Q32, <= MAX_32 */ - Word32 y[], /* o : Output vector that contains att*x */ - const Word16 N /* i : Vector length */ -); - -void v_L_mult_1616( - const Word16 x1[], /* i : Input vector 1 */ - const Word16 x2[], /* i : Input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 .* vector 2 */ - const Word16 N /* i : Vector length */ -); - void v_L_mult_3216( const Word32 x1[], /* i : Input vector 1 */ const Word16 x2[], /* i : Input vector 2 */ @@ -10255,10 +9983,6 @@ void ordr_esti( const Word16 Nsv /* i : total sub-vectors in a sub-frames */ ); -Word16 sr2fscale( - const Word32 sr_core /* i : internal sampling rate */ -); - void Copy_Scale_sig32( const Word32 x[], /* i : signal to scale input Qx */ Word32 y[], /* o : scaled signal output Qx */ @@ -10276,13 +10000,6 @@ void swb_pre_proc_ivas_fx( CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ ); -/* o : Q(2x - 31 - gb) */ -Word32 sum2_f_32_fx( - const Word32 *vec, /* i : input vector, Qx */ - const Word16 lvec, /* i : length of input vector */ - Word16 gb /* i : guard bits */ -); - Word32 sum2_16_exp_fx( const Word16 *vec, /* i : input vector Q(15 - exp) */ const Word16 lvec, /* i : length of input vector */ @@ -10297,11 +10014,6 @@ Word32 sum2_32_exp_fx( Word16 gb /* i : guard bits */ ); -Word32 sum2_32_fx( - const Word32 *vec, /* i : input vector */ - const Word16 lvec, /* i : length of input vector */ - Word16 *e ); - void ProcessStereoIGF_fx( STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ @@ -10621,7 +10333,6 @@ void WriteToBitstream_fx( Word16 *pnBits ); -/*===========================================================================================*/ /*----------------------------------------------------------------------------------* * MODE1 prototypes *----------------------------------------------------------------------------------*/ @@ -10688,13 +10399,6 @@ Word16 maximumAbs_l( Word32 *max_val /* o : maximum value in the input vector */ ); -/*! r: index of the minimum value in the input vector */ -Word16 minimum_s( - const Word16 *vec, /* i : Input vector */ - const Word16 lvec, /* i : Vector length */ - Word16 *min_val /* o : minimum value in the input vector */ -); - void sort_l( Word32 *x, /* i/o: Vector to be sorted */ Word16 len /* i/o: vector length */ @@ -11140,12 +10844,4 @@ ivas_error IGF_Reconfig( const Word16 rf_mode /* i : flag to signal the RF mode */ ); -void ordr_esti( - const Word16 k, /* i : sub-vector index */ - Word16 *Mpos, /* i/o: dominant sub-vector position from ACV */ - Word16 svOrder[], /* i/o: AVQ sub-vector order */ - const Word16 Nsv /* i : total sub-vectors in a sub-frames */ -); - -/*===========================================================================================*/ #endif diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index cd5ad9667..37f4c4513 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -3727,55 +3727,6 @@ void v_multc_att32( return; } -/*-------------------------------------------------------------------* - * v_multc_att3232() - * - * Attenuation of a vector, attenuation factor in Q31 - *-------------------------------------------------------------------*/ - -void v_multc_att3232( - const Word32 x[], /* i : Input vector Qx */ - const Word32 att, /* i : Constant Q32, <= MAX_32 */ - Word32 y[], /* o : Output vector that contains att*x */ - const Word16 N /* i : Vector length */ -) -{ - Word16 i; - IF( LE_32( att, MAX_32 ) ) - { - FOR( i = 0; i < N; i++ ) - { - y[i] = Mpy_32_32_r( x[i], att ); - move32(); - } - } - - return; -} - -/*-------------------------------------------------------------------* - * v_L_mult_1616() - * - * Multiplication of two vectors, Output in Word32 - *-------------------------------------------------------------------*/ - -void v_L_mult_1616( - const Word16 x1[], /* i : Input vector 1 */ - const Word16 x2[], /* i : Input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 .* vector 2 */ - const Word16 N /* i : Vector length */ -) -{ - Word16 i; - - for ( i = 0; i < N; i++ ) - { - y[i] = L_mult( x1[i], x2[i] ); - move32(); - } - - return; -} /*-------------------------------------------------------------------* * v_L_mult_3216() diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index a8c674170..e1689e409 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -55,7 +55,7 @@ void init_coder_ace_plus_fx( /* Core Sampling Rate */ st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); - st->fscale = sr2fscale( st->sr_core ); + st->fscale = sr2fscale_fx( st->sr_core ); move32(); move16(); diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index b61609e50..294da07f4 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -40,7 +40,7 @@ void core_coder_mode_switch_fx( sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); move32(); - fscale = sr2fscale( sr_core ); + fscale = sr2fscale_fx( sr_core ); move16(); if ( EQ_16( st->last_codec_mode, MODE1 ) ) -- GitLab From 0bcb6225c4dbacab11a64fc04b600bb8a780580c Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 2 Mar 2026 16:04:50 +0100 Subject: [PATCH 2/6] move declaration --- lib_com/ivas_prot_fx.h | 9 +++++++++ lib_com/prot_fx.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 7dd2639a0..8e2e660b2 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1876,6 +1876,15 @@ void ivas_mdct_core_invQ_fx( const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); +void ivas_mdct_core_reconstruct_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *x_fx[][NB_DIV], /* i/o: synthesis @internal_FS Q(q_x) */ + Word16 signal_outFB_fx[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS e_sig */ + Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + Word16 q_x, + Word16 e_sig[CPE_CHANNELS] ); + void ivas_mdct_tcx10_bit_distribution_fx( Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ const Word16 nbits_tcx, /* i : TCX bits */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index fe1b43a99..b85f4e3be 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -8921,15 +8921,6 @@ void con_tcx_ivas_fx( const Word16 *A_cng /* i : CNG LP filter coefficients */ ); -void ivas_mdct_core_reconstruct_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *x_fx[][NB_DIV], /* i/o: synthesis @internal_FS Q(q_x) */ - Word16 signal_outFB_fx[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS e_sig */ - Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ - Word16 q_x, - Word16 e_sig[CPE_CHANNELS] ); - void ari_start_encoding_14bits_ivas_fx( Tastat *s ); -- GitLab From 2d374950273d9697fc6956c9980ba20ecd2c7582 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Apr 2026 10:14:09 +0200 Subject: [PATCH 3/6] maintenance --- lib_basop/basop32.c | 2 +- lib_basop/typedefs.h | 2 +- lib_com/ivas_prot_fx.h | 2 +- lib_com/prot_fx.h | 5 +++++ lib_enc/ivas_cpe_enc_fx.c | 2 +- lib_enc/ivas_spar_md_enc_fx.c | 4 ---- lib_enc/ivas_stereo_td_enc_fx.c | 36 +++++++++++++++++++-------------- 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/lib_basop/basop32.c b/lib_basop/basop32.c index 27b499276..4f601911b 100644 --- a/lib_basop/basop32.c +++ b/lib_basop/basop32.c @@ -345,7 +345,7 @@ Flag Carry = 0; do \ { \ (void) 0; \ - } while ( 0 ) /* no-op */ + } while ( 0 ) /* no-op */ #define B_HELPER_GET_GLOBAL( global_flag ) 0 /* Default to 0 */ #endif diff --git a/lib_basop/typedefs.h b/lib_basop/typedefs.h index ed3860391..001f3f164 100644 --- a/lib_basop/typedefs.h +++ b/lib_basop/typedefs.h @@ -183,7 +183,7 @@ typedef struct */ typedef int Bool; #define false 0 -#define true 1 +#define true 1 /* ********* Check current platform diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 03248bb0c..d61572ebc 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1385,7 +1385,7 @@ void initMdctStereoDecData_fx( const Word16 bwidth /* i : audio bandwidth */ ); -void stereo_tdm_downmix_ivas_fx( +void stereo_tdm_downmix_fx( STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i : TD stereo IVAS encoder structure */ Word16 *Left_in_fx, /* Qx */ Word16 *Right_in_fx, /* Qx */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index bb34b2901..bf86c7209 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9778,6 +9778,11 @@ ivas_error push_indice( Word16 nb_bits /* i : number of bits used to quantize the indice */ ); +#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) +#define push_next_indice( ... ) push_next_indice_( __func__, __VA_ARGS__ ) +#define push_next_bits( ... ) push_next_bits_( __func__, __VA_ARGS__ ); +#endif + #if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) ivas_error push_next_indice_( const char *caller, diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 3943428d1..b43eb2142 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -795,7 +795,7 @@ ivas_error ivas_cpe_enc_fx( tdm_SM_flag = 0; move16(); } - stereo_tdm_downmix_ivas_fx( hCPE->hStereoTD, sts[0]->input_fx, sts[1]->input_fx, input_frame, tdm_ratio_idx, tdm_SM_flag, tdm_ratio_idx_SM ); + stereo_tdm_downmix_fx( hCPE->hStereoTD, sts[0]->input_fx, sts[1]->input_fx, input_frame, tdm_ratio_idx, tdm_SM_flag, tdm_ratio_idx_SM ); Copy_Scale_sig_16_32_no_sat( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( sts[0]->q_inp32, sts[0]->q_inp ) ); Copy_Scale_sig_16_32_no_sat( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( sts[1]->q_inp32, sts[1]->q_inp ) ); diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 16cd3a950..9bd2c17b3 100644 --- a/lib_enc/ivas_spar_md_enc_fx.c +++ b/lib_enc/ivas_spar_md_enc_fx.c @@ -438,11 +438,7 @@ static void write_metadata_buffer_fx( FOR( i = 0; i < hMetaData_tmp->nb_ind_tot; i++ ) { -#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) - push_next_indice( hMetaData_tmp->ind_list[i].function_name, hMetaData, hMetaData_tmp->ind_list[i].value, hMetaData_tmp->ind_list[i].nb_bits ); -#else push_next_indice( hMetaData, hMetaData_tmp->ind_list[i].value, hMetaData_tmp->ind_list[i].nb_bits ); -#endif } return; diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 0066efbe4..0629c0279 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -364,11 +364,14 @@ ivas_error stereo_set_tdm_fx( return error; } + + /*-------------------------------------------------------------------* * tdm_configure_enc() * * Configure TD stereo encoder *-------------------------------------------------------------------*/ + void tdm_configure_enc_fx( const Word16 ivas_format, /* i : IVAS format */ const Word16 ism_mode, /* i : ISM mode in combined format */ @@ -777,13 +780,14 @@ ivas_error signaling_enc_secondary_fx( return error; } + /*-------------------------------------------------------------------* * Function tdm_downmix_plain() * * downmix Left+Right to Primary+Secondary channel *-------------------------------------------------------------------*/ -static void tdm_downmix_plain_ivas_fx( +static void tdm_downmix_plain_fx( Word16 FR_Y_fx[], /*Qx*/ Word16 LR_X_fx[], /*Qx*/ const Word16 Left_in_fx[], /*Qx*/ @@ -810,12 +814,14 @@ static void tdm_downmix_plain_ivas_fx( return; } + /*-------------------------------------------------------------------* * Function tdm_downmix_fade() * * downmix Left+Right to Primary+Secondary channel with fade in/out *-------------------------------------------------------------------*/ -static void tdm_downmix_fade_ivas_fx( + +static void tdm_downmix_fade_fx( Word16 FR_Y_fx[], /* o : primary channel Qx */ Word16 LR_X_fx[], /* o : secondary channel Qx */ const Word16 Left_in_fx[], /* i : Left channel Qx */ @@ -868,7 +874,8 @@ static void tdm_downmix_fade_ivas_fx( * * Compute the TD stereo downmix signal based on the ratio index *-------------------------------------------------------------------*/ -void stereo_tdm_downmix_ivas_fx( + +void stereo_tdm_downmix_fx( STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i : TD stereo IVAS encoder structure */ Word16 *Left_in_fx, /* Qx */ Word16 *Right_in_fx, /* Qx */ @@ -925,10 +932,10 @@ void stereo_tdm_downmix_ivas_fx( case ( 0 ): { /* Switching from YX scheme to SM scheme */ - tdm_downmix_fade_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), hStereoTD->tdm_last_ratio_fx, L_sub( 2147483647, hStereoTD->tdm_last_ratio_fx ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_fade_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), hStereoTD->tdm_last_ratio_fx, L_sub( 2147483647, hStereoTD->tdm_last_ratio_fx ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 /* Create new mixture of using the ratio computed above and formular for SM scheme */ - tdm_downmix_plain_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_plain_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 } BREAK; case ( 1 ): @@ -936,38 +943,37 @@ void stereo_tdm_downmix_ivas_fx( /* Create new mixture of using the ratio computed above and formular for SM scheme */ IF( EQ_32( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], hStereoTD->tdm_last_ratio_SM_fx ) ) { - tdm_downmix_plain_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( (Word32) tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), 0, input_frame ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_plain_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( (Word32) tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), 0, input_frame ); // 1.0 in Q31 -> 2147483647 } ELSE { - tdm_downmix_fade_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), hStereoTD->tdm_last_ratio_SM_fx, L_sub( hStereoTD->tdm_last_ratio_SM_fx, 2147483647 ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_fade_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), hStereoTD->tdm_last_ratio_SM_fx, L_sub( hStereoTD->tdm_last_ratio_SM_fx, 2147483647 ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 - tdm_downmix_plain_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_plain_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx_SM], L_sub( tdm_ratio_tabl_fx[tdm_ratio_idx_SM], 2147483647 ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 } } BREAK; case ( 2 ): { /* Switching from SM scheme to YX scheme */ - tdm_downmix_fade_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), hStereoTD->tdm_last_ratio_SM_fx, L_sub( hStereoTD->tdm_last_ratio_SM_fx, 2147483647 ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_fade_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), hStereoTD->tdm_last_ratio_SM_fx, L_sub( hStereoTD->tdm_last_ratio_SM_fx, 2147483647 ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 /* Create new mixture of using the ratio computed above and formular for YX scheme */ - tdm_downmix_plain_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_plain_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 } BREAK; case ( 3 ): { /* Create new mixture of using the ratio computed above and formular for YX scheme */ - IF( EQ_32( tdm_ratio_tabl_fx[tdm_ratio_idx], - hStereoTD->tdm_last_ratio_fx ) ) + IF( EQ_32( tdm_ratio_tabl_fx[tdm_ratio_idx], hStereoTD->tdm_last_ratio_fx ) ) { - tdm_downmix_plain_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), 0, input_frame ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_plain_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), 0, input_frame ); // 1.0 in Q31 -> 2147483647 } ELSE { - tdm_downmix_fade_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), hStereoTD->tdm_last_ratio_fx, L_sub( 2147483647, hStereoTD->tdm_last_ratio_fx ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_fade_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), hStereoTD->tdm_last_ratio_fx, L_sub( 2147483647, hStereoTD->tdm_last_ratio_fx ), 0, tdm_n_OVA ); // 1.0 in Q31 -> 2147483647 - tdm_downmix_plain_ivas_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 + tdm_downmix_plain_fx( FR_Y_fx, LR_X_fx, Left_in_fx, Right_in_fx, tdm_ratio_tabl_fx[tdm_ratio_idx], L_sub( 2147483647, tdm_ratio_tabl_fx[tdm_ratio_idx] ), tdm_n_OVA, input_frame ); // 1.0 in Q31 -> 2147483647 } } BREAK; -- GitLab From 637ef815a4770929157a043f64fb0a2c23e12018 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Apr 2026 10:17:46 +0200 Subject: [PATCH 4/6] clang-format --- lib_com/basop_settings.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/basop_settings.h b/lib_com/basop_settings.h index 79544c078..f5e107cb5 100644 --- a/lib_com/basop_settings.h +++ b/lib_com/basop_settings.h @@ -59,13 +59,13 @@ \def Macro converts a float < 1 to Word32 fixed point with saturation and rounding */ #define FL2WORD32( val ) \ - ( Word32 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD32 ) ) ? (int32_t) ( MAXVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * (WORD32_FIX_SCALE) -0.5 ) <= (double) ( MINVAL_WORD32 ) ) ? (int32_t) ( MINVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) (WORD32_FIX_SCALE) -0.5 ) ) ) + ( Word32 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD32 ) ) ? (int32_t) ( MAXVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) -0.5 ) <= (double) ( MINVAL_WORD32 ) ) ? (int32_t) ( MINVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) -0.5 ) ) ) /*! \def Macro converts a float < 1 to Word16 fixed point with saturation and rounding */ #define FL2WORD16( val ) \ - ( Word16 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD16 ) ) ? (int32_t) ( MAXVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * (WORD16_FIX_SCALE) -0.5 ) <= (double) ( MINVAL_WORD16 ) ) ? (int32_t) ( MINVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) (WORD16_FIX_SCALE) -0.5 ) ) ) + ( Word16 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD16 ) ) ? (int32_t) ( MAXVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) -0.5 ) <= (double) ( MINVAL_WORD16 ) ) ? (int32_t) ( MINVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) -0.5 ) ) ) /*! \def Macro converts a Word32 fixed point to Word16 fixed point <1 with saturation -- GitLab From e89299106bf44995e513c4de1270b1249783b0ca Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Apr 2026 10:23:58 +0200 Subject: [PATCH 5/6] clang-format --- lib_com/basop_settings.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/basop_settings.h b/lib_com/basop_settings.h index f5e107cb5..6d1d513a2 100644 --- a/lib_com/basop_settings.h +++ b/lib_com/basop_settings.h @@ -59,13 +59,13 @@ \def Macro converts a float < 1 to Word32 fixed point with saturation and rounding */ #define FL2WORD32( val ) \ - ( Word32 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD32 ) ) ? (int32_t) ( MAXVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) -0.5 ) <= (double) ( MINVAL_WORD32 ) ) ? (int32_t) ( MINVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) -0.5 ) ) ) + ( Word32 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD32 ) ) ? (int32_t) ( MAXVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) - 0.5 ) <= (double) ( MINVAL_WORD32 ) ) ? (int32_t) ( MINVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) - 0.5 ) ) ) /*! \def Macro converts a float < 1 to Word16 fixed point with saturation and rounding */ #define FL2WORD16( val ) \ - ( Word16 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD16 ) ) ? (int32_t) ( MAXVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) -0.5 ) <= (double) ( MINVAL_WORD16 ) ) ? (int32_t) ( MINVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) -0.5 ) ) ) + ( Word16 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD16 ) ) ? (int32_t) ( MAXVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) - 0.5 ) <= (double) ( MINVAL_WORD16 ) ) ? (int32_t) ( MINVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) - 0.5 ) ) ) /*! \def Macro converts a Word32 fixed point to Word16 fixed point <1 with saturation -- GitLab From 90b2c4c2470fdd22695d1f154aad369322bf1ab2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 23 Apr 2026 17:56:42 +0200 Subject: [PATCH 6/6] remove unused function declarations --- lib_com/prot_fx.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index bf86c7209..b319a7b0c 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -79,14 +79,6 @@ Word32 sum_l_fx( const Word16 lvec /* i : length of input vector */ ); -Word32 Mult_32_16( - Word32 a, - Word16 b ); - -Word32 Mult_32_32( - Word32 a, - Word32 b ); - void Copy32( const Word32 x[], /* i : i vector */ Word32 y[], /* o : output vector */ @@ -9922,14 +9914,6 @@ Word32 ar_div_ivas( Word32 num, Word32 denum ); -Word32 Mult_32_16( - Word32 a, - Word16 b ); - -Word32 Mult_32_32( - Word32 a, - Word32 b ); - #ifdef DEBUGGING void read_next_force( int16_t *force, /* i/o: force value (0/1, 0 = speech, 1 = music)*/ -- GitLab