diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c index bab08fe1870431eef3f56536ddc4075916f7b170..e2f617a62a9f4d972d44dadfe4c6934a5d42402f 100644 --- a/lib_com/core_com_config_fx.c +++ b/lib_com/core_com_config_fx.c @@ -396,13 +396,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*/ @@ -1030,8 +1023,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/hp50_fx.c b/lib_com/hp50_fx.c index 1622a7b1e900e0a25aea5e5a3658249d09182d98..031bca0a7ff8480f2c24cd2ee5e2db4ac5a73b9b 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -285,7 +285,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * } -void hp20_fx_32_opt( +void hp20_fx_32( Word32 signal_fx[], const Word16 lg, Word32 mem_fx[], @@ -448,189 +448,3 @@ void hp20_fx_32_opt( return; } - - -void hp20_fx_32( - Word32 signal_fx[], - const Word16 lg, - Word32 mem_fx[], - const Word32 Fs ) -{ - Word16 i; - Word32 a1_fx, a2_fx, b1_fx, b2_fx; - Word16 Qx0, Qx1, Qx2, Qy1, Qprev_y1, Qy2, Qprev_y2, Qmin; - Word64 x0_fx64, x1_fx64, x2_fx64, y0_fx64, y1_fx64, y2_fx64, R1, R2, R3, R4, R5; - - IF( EQ_32( Fs, 8000 ) ) - { - /* hp filter 20Hz at 3dB for 8000KHz input sampling rate - [b,a] = butter(2, 20.0/4000.0, 'high'); - b = [0.988954248067140 -1.977908496134280 0.988954248067140] - a =[1.000000000000000 -1.977786483776764 0.978030508491796]*/ - a1_fx = 1061816033l /* 1.977786483776764 Q29*/; - a2_fx = -525076131l /*-0.978030508491796 Q29*/; - b1_fx = -1061881538l /*-1.977908496134280 Q29*/; - b2_fx = 530940769l /* 0.988954248067140 Q29*/; - } - ELSE IF( EQ_32( Fs, 16000 ) ) - { - /* hp filter 20Hz at 3dB for 16000KHz sampling rate - [b,a] = butter(2, 20.0/8000.0, 'high'); - b =[ 0.994461788958195 -1.988923577916390 0.994461788958195] - a =[1.000000000000000 -1.988892905899653 0.988954249933127] */ - a1_fx = 1067778748l /* 1.988892905899653 Q29*/; - a2_fx = -530940770l /*-0.988954249933127 Q29*/; - b1_fx = -1067795215l /*-1.988923577916390 Q29*/; - b2_fx = 533897608l /* 0.994461788958195 Q29*/; - } - ELSE IF( EQ_32( Fs, 32000 ) ) - { - /* hp filter 20Hz at 3dB for 32000KHz sampling rate - [b,a] = butter(2, 20.0/16000.0, 'high'); - b =[0.997227049904470 -1.994454099808940 0.997227049904470] - a =[1.000000000000000 -1.994446410541927 0.994461789075954]*/ - a1_fx = 1070760263l /* 1.994446410541927 Q29*/; - a2_fx = -533897608l /*-0.994461789075954 Q29*/; - b1_fx = -1070764392l /*-1.994454099808940 Q29*/; - b2_fx = 535382196l /* 0.997227049904470 Q29*/; - } - ELSE - { - /* hp filter 20Hz at 3dB for 48000KHz sampling rate - [b,a] = butter(2, 20.0/24000.0, 'high'); - b =[ 0.998150511190452 -1.996301022380904 0.998150511190452] - a =[1.000000000000000 -1.996297601769122 0.996304442992686]*/ - a1_fx = 1071754114l /* 1.996297601769122 Q29*/; - a2_fx = -534886875l /*-0.996304442992686 Q29*/; - b1_fx = -1071755951l /*-1.996301022380904 Q29*/; - b2_fx = 535877975l /* 0.998150511190452 Q29*/; - } - move32(); - move32(); - move32(); - move32(); - - Qprev_y1 = extract_l( mem_fx[4] ); - Qprev_y2 = extract_l( mem_fx[5] ); - y1_fx64 = W_deposit32_l( mem_fx[0] ); - y2_fx64 = W_deposit32_l( mem_fx[1] ); - x0_fx64 = W_deposit32_l( mem_fx[2] ); - x1_fx64 = W_deposit32_l( mem_fx[3] ); - - FOR( i = 0; i < lg; i++ ) - { - x2_fx64 = x1_fx64; - move64(); - x1_fx64 = x0_fx64; - move64(); - x0_fx64 = W_deposit32_l( signal_fx[i] ); - - Qy1 = W_norm( y1_fx64 ); - if ( y1_fx64 == 0 ) - { - Qy1 = 62; - move16(); - } - Qy1 = sub( Qy1, 34 ); - R1 = W_mult0_32_32( W_shl_sat_l( y1_fx64, Qy1 ), a1_fx ); - Qy1 = add( Qy1, Qprev_y1 ); - - Qy2 = W_norm( y2_fx64 ); - if ( y2_fx64 == 0 ) - { - Qy2 = 62; - move16(); - } - Qy2 = sub( Qy2, 34 ); - R2 = W_mult0_32_32( W_shl_sat_l( y2_fx64, Qy2 ), a2_fx ); - Qy2 = add( Qy2, Qprev_y2 ); - - Qx0 = W_norm( x0_fx64 ); - if ( x0_fx64 == 0 ) - { - Qx0 = 62; - move16(); - } - Qx0 = sub( Qx0, 34 ); - R3 = W_mult0_32_32( W_shl_sat_l( x0_fx64, Qx0 ), b2_fx ); - - Qx1 = W_norm( x1_fx64 ); - if ( x1_fx64 == 0 ) - { - Qx1 = 62; - move16(); - } - Qx1 = sub( Qx1, 34 ); - R4 = W_mult0_32_32( W_shl_sat_l( x1_fx64, Qx1 ), b1_fx ); - - Qx2 = W_norm( x2_fx64 ); - if ( x2_fx64 == 0 ) - { - Qx2 = 62; - move16(); - } - Qx2 = sub( Qx2, 34 ); - R5 = W_mult0_32_32( W_shl_sat_l( x2_fx64, Qx2 ), b2_fx ); - - Qmin = s_min( Qy1, Qy2 ); - - y0_fx64 = W_add( W_shr( R1, sub( Qy1, Qmin ) ), W_shr( R2, sub( Qy2, Qmin ) ) ); - - Qmin = s_min( Qmin, Qx0 ); - Qmin = s_min( Qmin, Qx1 ); - Qmin = s_min( Qmin, Qx2 ); - - y0_fx64 = W_add( W_shr( y0_fx64, sub( s_min( Qy1, Qy2 ), Qmin ) ), W_add( W_shr( R3, sub( Qx0, Qmin ) ), W_add( W_shr( R4, sub( Qx1, Qmin ) ), W_shr( R5, sub( Qx2, Qmin ) ) ) ) ); - - y0_fx64 = W_shr( y0_fx64, 29 ); - - signal_fx[i] = W_extract_l( W_shr( y0_fx64, Qmin ) ); - move32(); - IF( signal_fx[i] < 0 ) - { - signal_fx[i] = L_add( signal_fx[i], 1 ); - move32(); - } - - y2_fx64 = y1_fx64; - y1_fx64 = y0_fx64; - Qprev_y2 = Qprev_y1; - Qprev_y1 = Qmin; - move64(); - move64(); - move16(); - move16(); - } - - Qy1 = W_norm( y1_fx64 ); - test(); - IF( y1_fx64 != 0 && LT_16( Qy1, 32 ) ) - { - y1_fx64 = W_shr( y1_fx64, sub( 32, Qy1 ) ); - Qprev_y1 = sub( Qprev_y1, sub( 32, Qy1 ) ); - } - - Qy2 = W_norm( y2_fx64 ); - test(); - IF( y2_fx64 != 0 && LT_16( Qy2, 32 ) ) - { - y2_fx64 = W_shr( y2_fx64, sub( 32, Qy2 ) ); - Qprev_y2 = sub( Qprev_y2, sub( 32, Qy2 ) ); - } - - mem_fx[0] = W_extract_l( y1_fx64 ); - mem_fx[1] = W_extract_l( y2_fx64 ); - mem_fx[2] = W_extract_l( x0_fx64 ); - mem_fx[3] = W_extract_l( x1_fx64 ); - mem_fx[4] = Qprev_y1; - mem_fx[5] = Qprev_y2; - - move32(); - move32(); - move32(); - move32(); - move32(); - move32(); - - return; -} diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 907e55b16c4dbf1d368124c88069cfac8bef39b6..0f093d72e349eff2889ffbf2139da7e86513806b 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 */ @@ -1689,6 +1689,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 */ @@ -3604,6 +3613,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/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 71f30f83ff4c007157d9413fd77104188ee90998..c69503350f8320bcd8cde9f92f1f44a16dd62e1c 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; @@ -3593,7 +3592,7 @@ Word32 poscos_fx( /* _ ( Word16) root in Q15, or 0xffff if no root is found */ /*===================================================================*/ -Word16 root_search_fx( +static Word16 root_search_fx( Word16 low, Word16 high, Word32 *v_low, @@ -3713,7 +3712,7 @@ and delta2 */ /* (alpha/(sqrt(delta1*delta2)) */ /*===================================================================*/ -Word32 calc_weight( +static Word32 calc_weight( Word16 delta1, Word16 delta2, Word16 *n1 ) @@ -3765,7 +3764,7 @@ Word32 calc_weight( /*===================================================================*/ /* 40-32 bit conversion */ -Word32 polynomial_eval_fx( +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 8b8aecb8cb74fc5619edff94d6bbe00c3ea93eb1..347c72941c204b5307c86511ecbbeef7cf1f38fa 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 */ @@ -183,22 +175,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 ); @@ -222,13 +198,11 @@ UWord32 index_lvq_SHB_fx( 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 deindex_lvq_SHB_fx( + UWord32 index, + Word16 *out, + const Word16 nbits, + const Word16 mode ); void permute_fx( Word16 *pTmp1, /* i/o: vector whose components are to be permuted */ @@ -243,6 +217,24 @@ void init_lvq_fx( Word16 no_scales[][2], Word16 no_scales_p[][2] ); +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 ); + +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 */ +); + 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*/ @@ -252,6 +244,13 @@ Word16 deindex_lvq_cng_fx( Word32 *p_offset_scale2, Word16 *p_no_scales ); +Word16 deindex_lvq_cng_ivas_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 */ +); + /*========================================================================================================/ swb_bwe_com_fx.c /========================================================================================================*/ @@ -632,7 +631,7 @@ void hq_bwe_fx( const Word16 *hq_generic_fenv, /* i : SWB frequency envelopes */ Word32 *coeff_out, /* o : SWB signal in MDCT domain */ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic bwe*/ - Word16 *prev_L_swb_norm, /*i/o : last normalize length */ + Word16 *prev_L_swb_norm, /* i/o: last normalize length */ const Word16 hq_generic_exc_clas, /* i : bwe excitation class */ const Word16 *sfm_end, /* i : End of bands */ const Word16 num_sfm, @@ -715,9 +714,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*/ ); @@ -725,7 +721,7 @@ Word32 sub_lsp2lsf_fx( void E_LPC_lsp_lsf_conversion( const Word16 lsp[], /* i : lsp[m] (range: -1<=val<1) */ Word16 lsf[], /* o : lsf[m] normalized (range: 0<=val<=6400) */ - const Word16 m /* i : LPC order */ + const Word16 m /* i : LPC order */ ); void E_LPC_lsf_lsp_conversion( @@ -786,23 +782,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 */ @@ -946,14 +930,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 */ @@ -1023,11 +999,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[], @@ -3464,53 +3435,6 @@ void tcxInvertWindowGrouping( const Word16 frame_cnt, const Word16 bfi ); -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_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 ); - -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 */ -); - -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 ); - -Word16 deindex_lvq_cng_ivas_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 */ -); - Word16 lsp_convert_poly_fx( Word16 w[], /* i/o: LSP or ISP parameters */ const Word16 L_frame, /* i : flag for up or down conversion */ @@ -6742,7 +6666,6 @@ void HQ_nbfec_init_fx( HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */ ); - void hq_ecu_fx( const Word16 *prevsynth, /* i : buffer of previously synthesized signal */ Word32 *ecu_rec, /* o : reconstructed frame in tda domain */ @@ -7636,7 +7559,7 @@ void IGFSCFDecoderDecode( Word16 *sfe, /* o : ptr to an array which will contain the decoded quantized coefficients */ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 indepFlag /* i : if 1 on input the decoder will be forced to reset, - if 0 on input the decoder will be forced to encode without a reset */ + if 0 on input the decoder will be forced to encode without a reset */ ); Word32 ari_decode_overflow_fx( @@ -8292,12 +8215,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 */ @@ -8453,11 +8370,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 */ @@ -8585,24 +8497,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 */ ); @@ -8642,15 +8536,6 @@ void con_tcx_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] ); - #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC void ari_start_encoding_14bits_fx( #else @@ -8807,6 +8692,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 */ @@ -9154,20 +9040,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 */ @@ -9488,12 +9360,6 @@ void hp20_fx_32( Word32 mem_fx[], const Word32 Fs ); -void hp20_fx_32_opt( - Word32 signal_fx[], - const Word16 lg, - Word32 mem_fx[], - const Word32 Fs ); - void getTCXMode_ivas_fx( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ @@ -9557,7 +9423,6 @@ void SynthesisSTFT_fx( const Word16 nchan_out /* i : number of output channels */ ); - void cldfb_restore_memory_ivas_fx( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ); @@ -9573,10 +9438,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 */ @@ -9584,13 +9445,6 @@ void Copy_Scale_sig32( const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */ ); -/* 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 */ @@ -9605,11 +9459,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 */ @@ -9758,33 +9607,6 @@ ivas_error config_acelp1_fx( const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); -#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, -#else -ivas_error push_next_indice( -#endif - BSTR_ENC_HANDLE hBstr, - UWord16 value, /* i : value of the quantized indice */ - Word16 nb_bits /* i : number of bits used to quantize the indice */ -); - -#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) -ivas_error push_next_bits_( - const char *caller, -#else -ivas_error push_next_bits( -#endif - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const UWord16 bits[], /* i : bit buffer to pack, sequence of single bits */ - const Word16 nb_bits /* i : number of bits to pack */ -); - /*! r: index of next coefficient */ Word16 get_next_coeff_mapped_ivas_fx( Word16 ii[2], /* i/o: coefficient indexes Q0*/ @@ -9922,7 +9744,6 @@ void WriteToBitstream_fx( Word16 *pnBits ); -/*===========================================================================================*/ /*----------------------------------------------------------------------------------* * MODE1 prototypes *----------------------------------------------------------------------------------*/ @@ -9989,13 +9810,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 */ @@ -10008,18 +9822,27 @@ ivas_error push_indice( Word16 nb_bits /* i : number of bits used to quantize the indice */ ); -ivas_error push_next_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, +#else +ivas_error push_next_indice( #endif BSTR_ENC_HANDLE hBstr, UWord16 value, /* i : value of the quantized indice */ Word16 nb_bits /* i : number of bits used to quantize the indice */ ); -ivas_error push_next_bits_( #if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) +ivas_error push_next_bits_( const char *caller, +#else +ivas_error push_next_bits( #endif BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const UWord16 bits[], /* i : bit buffer to pack, sequence of single bits */ @@ -10029,7 +9852,7 @@ ivas_error push_next_bits_( /*! r: maximum number of indices */ Word16 get_ivas_max_num_indices_fx( const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); /*! r: maximum number of indices */ @@ -10143,14 +9966,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)*/ @@ -10409,12 +10224,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 7b2c8bfcd7ab2b7dad54713af54b56587120aeca..e15184cbaa4b89174dc1a79a7e576cddfefe1541 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -3761,55 +3761,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_dec/ivas_dec_fx.c b/lib_dec/ivas_dec_fx.c index 8113f437a0a7a46dad43778dad1f611871f8befd..e668248199381fba809d1880c60a5b9a12aa6d5b 100644 --- a/lib_dec/ivas_dec_fx.c +++ b/lib_dec/ivas_dec_fx.c @@ -107,7 +107,7 @@ ivas_error ivas_dec_fx( /* HP filtering */ FOR( n = 0; n < s_min( nchan_out, st_ivas->nchan_transport ); n++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) @@ -158,7 +158,7 @@ ivas_error ivas_dec_fx( } /* HP filtering */ - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } test(); @@ -292,7 +292,7 @@ ivas_error ivas_dec_fx( /* HP filtering */ FOR( n = 0; n < nchan_remapped; n++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) @@ -450,7 +450,7 @@ ivas_error ivas_dec_fx( FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } Word16 output_q = Q11; @@ -582,7 +582,7 @@ ivas_error ivas_dec_fx( /* HP filtering */ FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } nchan_remapped = ivas_sba_remapTCs_fx( &p_output_fx[sba_ch_idx], st_ivas, output_frame ); @@ -697,7 +697,7 @@ ivas_error ivas_dec_fx( { IF( NE_16( n, LFE_CHANNEL ) ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } } @@ -756,7 +756,7 @@ ivas_error ivas_dec_fx( { IF( NE_16( n, LFE_CHANNEL ) ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } } @@ -816,7 +816,7 @@ ivas_error ivas_dec_fx( /* HP filtering */ FOR( n = 0; n < st_ivas->nchan_transport; n++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } /* Rendering */ @@ -902,7 +902,7 @@ ivas_error ivas_dec_fx( /* HP filtering */ FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } IF( EQ_32( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index c74d460849b0ddc6d4b5bf62360edd1519e59072..d79a2a3c9d263491ee645326c13280bdbffaf4cd 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -54,7 +54,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 2fe851f624a58dbb0d7cd52e6fa72a084561da3a..b94595176ae98324ce53fa314f1424ce6a59b05e 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 ) ) diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 3943428d137e16412075066eee787398501bb800..b43eb2142cf2286d9694736fa11da1ec159abfff 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_enc_fx.c b/lib_enc/ivas_enc_fx.c index cde2237841f4cff1954f3cbf5a36ce257ca7af3c..2b2e26d0450104bfddb8cd6f412de427365196c7 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -156,11 +156,11 @@ ivas_error ivas_enc_fx( test(); IF( ( EQ_32( ivas_format, SBA_FORMAT ) ) && !( GT_16( st_ivas->sba_analysis_order, 1 ) ) ) { - hp20_fx_32_opt( data_fx[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); + hp20_fx_32( data_fx[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); } ELSE IF( !( EQ_32( ivas_format, MC_FORMAT ) && EQ_16( i, LFE_CHANNEL ) ) ) { - hp20_fx_32_opt( data_fx[i], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); + hp20_fx_32( data_fx[i], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); } } diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 2d68dc00b6cb70b2ade4e6498b9ece49c35041ee..9bd2c17b381a593e6cf88d66b2e2cd28c1d1ad3b 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 0066efbe490041bc0d082064b3292d97c8c77051..0629c027994e62fbd0e801132bfb8e30297c4fb1 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;