Loading lib_com/basop_util.c +2 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,8 @@ #define WMC_TOOL_SKIP extern const Word32 SqrtTable[32]; extern const Word16 SqrtDiffTable[32]; extern const Word32 SqrtTable[32]; // Q31 extern const Word16 SqrtDiffTable[32]; /* Q15 */ extern const Word32 ISqrtTable[32]; extern const Word16 ISqrtDiffTable[32]; Loading lib_com/cldfb.c +425 −45 File changed.Preview size limit exceeded, changes collapsed. Show changes lib_com/cng_exc_fx.c +53 −48 Original line number Diff line number Diff line Loading @@ -28,24 +28,24 @@ void CNG_exc_fx( Word16 *seed, /* i/o: random generator seed */ Word16 exc[], /* o : current non-enhanced excitation Q_new */ Word16 exc2[], /* o : current enhanced excitation Q_new */ Word32 *lp_ener, /* i/o: LP filtered E */ Word32 *lp_ener, /* i/o: LP filtered E Q6 */ const Word32 last_core_brate, /* i : previous frame core bitrate */ Word16 *first_CNG, /* i/o: first CNG frame flag for energy init. */ Word16 *cng_ener_seed, /* i/o: random generator seed for CNG energy */ Word16 bwe_exc[], /* o : excitation for SWB TBE */ Word16 bwe_exc[], /* o : excitation for SWB TBE Q_syn */ const Word16 allow_cn_step, /* i : allow CN step */ Word16 *last_allow_cn_step, /* i/o: last allow step */ const Word16 OldQ_exc, /* i : Old excitation scaling */ const Word16 Q_exc, /* i : excitation scaling */ const Word16 num_ho, /* i : number of selected hangover frames */ Word32 q_env[], Word32 *lp_env, Word32 *old_env, Word16 *exc_mem, Word16 *exc_mem1, Word32 q_env[], /*Q6*/ Word32 *lp_env, /*Q6*/ Word32 *old_env, /*Q6*/ Word16 *exc_mem, /*Q0*/ Word16 *exc_mem1, /*Q0*/ Word16 *sid_bw, Word16 *cng_ener_seed1, Word16 exc3[], Word16 exc3[], /*Q_exc*/ Word16 Opt_AMR_WB, const int16_t element_mode /* i : IVAS Element mode */ ) Loading Loading @@ -93,9 +93,9 @@ void CNG_exc_fx( L_tmp_ener = Mult_32_16( L_tmp_ener, 9079 ); /* divide by PIT_MAX (in Q15 + Q6 to get output in Q6)*/ L_tmp_ener = L_shr( L_tmp_ener, Q_ener ); /* -> If we want ener in Q6 */ if ( EQ_16( L_frame, L_FRAME16k ) ) IF( EQ_16( L_frame, L_FRAME16k ) ) { L_tmp_ener = Mult_32_16( L_tmp_ener, 26214 ); /* Compensate for 16kHz */ L_tmp_ener = Mult_32_16( L_tmp_ener, 26214 /*.8f in Q15*/ ); /* Compensate for 16kHz */ } *Enew = L_tmp_ener; move32(); Loading Loading @@ -123,14 +123,14 @@ void CNG_exc_fx( IF( LT_16( num_ho, 3 ) || LT_32( Mult_32_16( *Enew, 21845 /*1/1.5f, Q15*/ ), *lp_ener ) ) { /**lp_ener = 0.8f * *lp_ener + 0.2f * *Enew;*/ L_tmp_ener = Mult_32_16( *lp_ener, 26214 ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 6554 ); L_tmp_ener = Mult_32_16( *lp_ener, 26214 /*.8f in Q15*/ ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 6554 /*.2f in Q15*/ ); } ELSE { /**lp_ener = 0.95f * *lp_ener + 0.05f * *Enew;*/ L_tmp_ener = Mult_32_16( *lp_ener, 31130 ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 1638 ); L_tmp_ener = Mult_32_16( *lp_ener, 31130 /*.95f in Q15*/ ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 1638 /* .05f in Q15*/ ); } } ELSE Loading Loading @@ -192,8 +192,8 @@ FOR( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR ) * Insert random variation for excitation energy * (random variation is scaled according to *lp_ener value) *------------------------------------------------------------*/ L_tmp = Mult_32_16( *lp_ener, Random( cng_ener_seed ) ); L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); L_tmp = Mult_32_16( *lp_ener, Random( cng_ener_seed ) ); // Q6 L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); // Q6 #ifdef BASOP_NOGLOB L_tmp = L_add_sat( L_tmp, *lp_ener ); #else Loading @@ -212,11 +212,11 @@ FOR( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR ) exp = sub( exp, exp2 ); if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { tmp = shr( tmp, 1 ); } Loading @@ -233,12 +233,13 @@ FOR( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR ) FOR( i = 0; i < L_SUBFR; i++ ) { /* exc2[i] *= enr */ L_tmp = L_mult( exc2[add( i_subfr, i )], tmp ); /* Q-4 * Q_exc+19 -> Q_exc +16 */ L_tmp = L_mult( exc2[i_subfr + i], tmp ); /* Q-4 * Q_exc+19 -> Q_exc +16 */ #ifdef BASOP_NOGLOB exc2[add( i_subfr, i )] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); exc2[i_subfr + i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); #else exc2[i_subfr + i] = round_fx( L_shl( L_tmp, exp ) ); #endif move16(); } } IF( NE_16( Opt_AMR_WB, 1 ) ) Loading Loading @@ -298,8 +299,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) { /* get AR low-passed envelope */ /* lp_env[i] = 0.9f*lp_env[i] + (1-0.9f)*old_env[i]; */ L_tmp = Mult_32_16( lp_env[i], 29491 ); lp_env[i] = L_add( L_tmp, Mult_32_16( old_env[i], 3277 ) ); L_tmp = Mult_32_16( lp_env[i], 29491 /*.9f in Q15*/ ); lp_env[i] = L_add( L_tmp, Mult_32_16( old_env[i], 3277 /*.1f in Q15*/ ) ); move32(); /* Q6 */ } Loading Loading @@ -381,8 +382,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* itmp[i] += own_random( cng_ener_seed1 )*denv[i]*0.000011f + denv[i]; */ L_tmp = Mult_32_16( denv[i], Random( cng_ener_seed1 ) ); L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); L_tmp = Mult_32_16( denv[i], Random( cng_ener_seed1 ) ); // Q6 L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); // Q6 #ifdef BASOP_NOGLOB L_tmp = L_add_sat( L_tmp, denv[i] ); itmp[i] = L_add_sat( L_tmp, itmp[i] ); Loading @@ -394,7 +395,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) if ( itmp[i] < 0 ) { itmp[i] = L_deposit_l( 0 ); itmp[i] = 0; move32(); } } ptR = &fft_io[1]; Loading @@ -413,11 +415,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) exp2 = sub( 31 - 6, exp2 ); /* in Q15 (L_tmp in Q6)*/ exp = sub( exp2, exp ); /* Denormalize and substract */ if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { tmp2 = shr( tmp2, 1 ); } Loading Loading @@ -452,7 +454,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */ enr1 = L_deposit_l( 1 ); enr1 = 1; move32(); pt_fft_io = fft_io; IF( EQ_16( L_frame, L_FRAME ) ) { Loading Loading @@ -498,11 +501,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) exp = sub( exp, exp2 ); if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { tmp = shr( tmp, 1 ); } Loading @@ -529,8 +532,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) FOR( i = 0; i < L_SUBFR; i++ ) { /* fft_io[i] *= enr */ L_tmp = L_mult( fft_io[add( i_subfr, i )], tmp ); /* Q_exc + 16 - exp */ fft_io[add( i_subfr, i )] = round_fx( L_shl( L_tmp, exp ) ); /*Q_exc*/ L_tmp = L_mult( fft_io[i_subfr + i], tmp ); /* Q_exc + 16 - exp */ fft_io[i_subfr + i] = round_fx( L_shl( L_tmp, exp ) ); /*Q_exc*/ move16(); } } Loading @@ -538,7 +541,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) FOR( i = 0; i < L_frame; i++ ) { /* fft_io[i] = 0.75f*fft_io[i] + exc2[i];*/ tmp = mult( fft_io[i], 24576 ); tmp = mult( fft_io[i], 24576 /*.75f in Q15*/ ); #ifdef BASOP_NOGLOB fft_io[i] = add_sat( tmp, exc2[i] ); #else Loading @@ -549,7 +552,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) /* enr = (dotp( fft_io, fft_io, L_frame ) / L_frame) + 0.01f */ L_tmp2 = L_deposit_l( 1 ); L_tmp2 = 1; move32(); pt_fft_io = fft_io; IF( EQ_16( L_frame, L_FRAME ) ) { Loading Loading @@ -598,11 +602,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) exp2 = sub( 31 - 6, exp2 ); /* in Q15 (L_tmp in Q6)*/ exp = sub( exp2, exp ); /* Denormalize and substract */ if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { tmp2 = shr( tmp2, 1 ); } Loading Loading @@ -654,7 +658,7 @@ void cng_params_postupd_fx( const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ const Word16 *const cng_Qexc_buf, /* i : Q_exc buffer Q0 */ const Word32 *const cng_brate_buf, /* i : bit rate buffer Q0 */ Word32 ho_env_circ[] /* i/o: Envelope buffer */ Word32 ho_env_circ[] /* i/o: Envelope buffer Q6 */ #ifdef IVAS_CODE_CNG_COM , const Word16 element_mode, /* i : Element mode */ Loading Loading @@ -683,7 +687,7 @@ void cng_params_postupd_fx( #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); if ( ptr < 0 ) IF( ptr < 0 ) { ptr = add( ptr, HO_HIST_SIZE ); } Loading Loading @@ -782,7 +786,7 @@ void cng_params_postupd_ivas_fx( const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ const Word16 *const cng_Qexc_buf, /* i : Q_exc buffer Q0 */ const Word32 *const cng_brate_buf, /* i : bit rate buffer Q0 */ Word32 ho_env_circ[], /* i/o: Envelope buffer */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q6 */ const Word16 element_mode, /* i : Element mode */ const Word16 bwidth /* i : Audio bandwidth */ ) Loading @@ -808,7 +812,7 @@ void cng_params_postupd_ivas_fx( #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); if ( ptr < 0 ) IF( ptr < 0 ) { ptr = add( ptr, HO_HIST_SIZE ); } Loading Loading @@ -922,7 +926,7 @@ void cng_params_upd_fx( Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ const Word16 Q_exc, /* i : Q value of excitation */ const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ Word32 ho_env_circ[], /* i/o: Envelope buffer */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q6 */ Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */ Loading Loading @@ -979,7 +983,8 @@ void cng_params_upd_fx( scale = norm_s( maxv ); pt_exc2 = exc2; L_ener = L_deposit_l( 0 ); L_ener = 0; move32(); IF( EQ_16( L_frame, L_FRAME ) ) { FOR( j = 0; j < 128; j++ ) Loading Loading @@ -1046,7 +1051,7 @@ void cng_params_upd_fx( cng_Qexc_buf[*ho_circ_ptr] = Q_exc; move16(); cng_brate_buf[*ho_circ_ptr] = last_active_brate; move16(); move32(); } ELSE { Loading Loading @@ -1137,7 +1142,7 @@ void cng_params_upd_ivas_fx( Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ const Word16 Q_exc, /* i : Q value of excitation */ const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ Word32 ho_env_circ[], /* i/o: Envelope buffer */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q(6+shift) */ Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */ Loading Loading @@ -1192,7 +1197,8 @@ void cng_params_upd_ivas_fx( scale = norm_s( maxv ); pt_exc2 = exc2; L_ener = L_deposit_l( 0 ); L_ener = 0; move32(); IF( EQ_16( L_frame, L_FRAME ) ) { FOR( j = 0; j < 128; j++ ) Loading Loading @@ -1259,7 +1265,7 @@ void cng_params_upd_ivas_fx( cng_Qexc_buf[*ho_circ_ptr] = Q_exc; move16(); cng_brate_buf[*ho_circ_ptr] = last_active_brate; move16(); move32(); } ELSE { Loading Loading @@ -1305,7 +1311,6 @@ void cng_params_upd_ivas_fx( att_fx = pow_10_q23[index]; // Q23 move32(); tmp = extract_h( att_fx ); // Q7 move16(); shift = 8; move16(); } Loading Loading @@ -1336,7 +1341,7 @@ void cng_params_upd_ivas_fx( /* update the circular buffer of old residual envelope */ /* Copy32( env, &(ho_env_circ[add(shl(*ho_circ_ptr,4),shl(*ho_circ_ptr,2))]), NUM_ENV_CNG ); */ Copy32( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG ); scale_sig32( &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG, shift ); scale_sig32( &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG, shift ); // Q(6+shift) } *ho_circ_size = add( *ho_circ_size, 1 ); move16(); Loading lib_com/cnst.h +1 −0 Original line number Diff line number Diff line Loading @@ -1940,6 +1940,7 @@ typedef enum _DCTTYPE #define N_SMC_FEATURES 15 /* number of features */ #define N_SMC_MIXTURES 6 /* number of mixtures */ #define N_PCA_COEF 12 /* number of PCA components */ #define HALF_N_PCA_COEF_LOG_P12_Q19 5781461//Q19 of (0.5f * N_PCA_COEF *logf( PI2 )) #define SMC_ST_MEAN_FACT 0.5 /* forgetting factor of short-term IIR mean filter */ #define SMC_ST_MEAN_RSHIFT_FACT_FX 1 /* SMC_ST_MEAN_FACT equivalent right shift factor */ Loading lib_com/codec_tcx_common.c +52 −44 Original line number Diff line number Diff line Loading @@ -19,7 +19,8 @@ Word16 tcxGetNoiseFillingTilt( const Word16 lpcorder, const Word16 L_frame, const Word16 mode, Word16 *noiseTiltFactor ) Word16 *noiseTiltFactor /*Q15*/ ) { Word16 firstLine; Word32 tmp; Loading @@ -36,7 +37,7 @@ Word16 tcxGetNoiseFillingTilt( { firstLine = shr( L_frame, 3 ); Copy_Scale_sig( A, As, add( lpcorder, 1 ), sub( norm_s( A[0] ), 2 ) ); Copy_Scale_sig( A, As, add( lpcorder, 1 ), sub( norm_s( A[0] ), 2 ) ); // Q(12) tmp = get_gain( As + 1, As, lpcorder ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB Loading @@ -54,10 +55,10 @@ Word16 tcxGetNoiseFillingTilt( void tcxFormantEnhancement( Word16 xn_buf[], const Word16 gainlpc[], Word16 xn_buf[], // Q(15-xn_buf_e) const Word16 gainlpc[], // Q(15-gainlpc_e) const Word16 gainlpc_e[], Word32 spectrum[], Word32 spectrum[], // Q(31-spectrum_e) Word16 *spectrum_e, const Word16 L_frame, const Word16 L_frameTCX ) Loading Loading @@ -88,13 +89,13 @@ void tcxFormantEnhancement( e = gainlpc_e[0]; move16(); m = Sqrt16( gainlpc[0], &e ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); e = gainlpc_e[1]; move16(); m = Sqrt16( gainlpc[1], &e ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); fac0 = s_min( xn_buf[0], xn_buf[1] ); Loading @@ -107,7 +108,7 @@ void tcxFormantEnhancement( e = gainlpc_e[i + 1]; move16(); m = Sqrt16( gainlpc[i + 1], &e ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); test(); Loading @@ -122,9 +123,9 @@ void tcxFormantEnhancement( move16(); tmp = sub( e, fac_e ); if ( tmp > 0 ) IF( tmp > 0 ) fac0 = shr( fac0, tmp ); if ( tmp < 0 ) IF( tmp < 0 ) fac1 = shl( fac1, tmp ); if ( tmp > 0 ) Loading @@ -144,7 +145,7 @@ void tcxFormantEnhancement( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_o( mult( xn_buf[add( l, j )], fac ), fac_e, &Overflow ) ); xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -171,9 +172,9 @@ void tcxFormantEnhancement( move16(); tmp = sub( e, fac_e ); if ( tmp > 0 ) IF( tmp > 0 ) fac0 = shr( fac0, tmp ); if ( tmp < 0 ) IF( tmp < 0 ) fac1 = shl( fac1, tmp ); if ( tmp > 0 ) Loading @@ -193,7 +194,7 @@ void tcxFormantEnhancement( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_sat( mult( xn_buf[add( l, j )], fac ), fac_e ) ); xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -209,7 +210,7 @@ void tcxFormantEnhancement( { FOR( l = 0; l < k; l++ ) { *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); // Q(15-xn_buf_e)+Q(31-spectrum_e)+1 -16 move32(); spectrum++; } Loading @@ -219,7 +220,7 @@ void tcxFormantEnhancement( tmp = sub( L_frameTCX, L_frame ); FOR( i = 0; i < tmp; i++ ) { spectrum[i] = L_shr( spectrum[i], xn_buf_e ); spectrum[i] = L_shr( spectrum[i], xn_buf_e ); // Q(31-(specturm_e+xn_buf_e)) move32(); } *spectrum_e = add( *spectrum_e, xn_buf_e ); Loading @@ -227,11 +228,11 @@ void tcxFormantEnhancement( } void tcxFormantEnhancement_with_shift( Word16 xn_buf[], Word16 xn_buf[], // Q(15-xn_buf_e_out) Word16 *xn_buf_e_out, const Word16 gainlpc[], const Word16 gainlpc[], // Q(15-gainlpc_e) const Word16 gainlpc_e[], Word32 spectrum[], Word32 spectrum[], // Q(31-spectrum_e) Word16 *spectrum_e, const Word16 L_frame, const Word16 L_frameTCX ) Loading Loading @@ -262,13 +263,13 @@ void tcxFormantEnhancement_with_shift( e = gainlpc_e[0]; move16(); m = Sqrt16( gainlpc[0], &e ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); e = gainlpc_e[1]; move16(); m = Sqrt16( gainlpc[1], &e ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); fac0 = s_min( xn_buf[0], xn_buf[1] ); Loading @@ -281,7 +282,7 @@ void tcxFormantEnhancement_with_shift( e = gainlpc_e[i + 1]; move16(); m = Sqrt16( gainlpc[i + 1], &e ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); test(); Loading Loading @@ -322,7 +323,7 @@ void tcxFormantEnhancement_with_shift( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_o( mult( xn_buf[add( l, j )], fac ), fac_e, &Overflow ) ); xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -349,9 +350,9 @@ void tcxFormantEnhancement_with_shift( move16(); tmp = sub( e, fac_e ); if ( tmp > 0 ) IF( tmp > 0 ) fac0 = shr( fac0, tmp ); if ( tmp < 0 ) IF( tmp < 0 ) fac1 = shl( fac1, tmp ); if ( tmp > 0 ) Loading @@ -371,7 +372,7 @@ void tcxFormantEnhancement_with_shift( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_o( mult( xn_buf[add( l, j )], fac ), fac_e, &Overflow ) ); xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -387,7 +388,7 @@ void tcxFormantEnhancement_with_shift( { FOR( l = 0; l < k; l++ ) { *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); // Q(15-xn_buf_e)+Q(31-spectrum_e)+1 -16 move32(); spectrum++; } Loading @@ -397,7 +398,7 @@ void tcxFormantEnhancement_with_shift( tmp = sub( L_frameTCX, L_frame ); FOR( i = 0; i < tmp; i++ ) { spectrum[i] = L_shr( spectrum[i], xn_buf_e ); spectrum[i] = L_shr( spectrum[i], xn_buf_e ); // Q(31-(specturm_e+xn_buf_e)) move32(); } *spectrum_e = add( *spectrum_e, xn_buf_e ); Loading @@ -409,8 +410,8 @@ void tcxFormantEnhancement_with_shift( void tcxInvertWindowGrouping( TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word32 xn_buf[], Word32 spectrum[], Word32 xn_buf[], // Qx Word32 spectrum[], // Qx const Word16 L_frame, const Word8 fUseTns, const Word16 last_core, Loading Loading @@ -461,7 +462,7 @@ void tcxInvertWindowGrouping( } p = spectrum + sub( L_frame, 1 ); FOR( i = sub( L_frame, 1 ); i > L_win; i -= 2 ) FOR( i = L_frame - 1; i > L_win; i -= 2 ) { *p-- = spectrum[i]; move32(); Loading Loading @@ -632,7 +633,8 @@ void tcx5TnsUngrouping( void tcx5SpectrumInterleaving_fx( const Word16 tcx5Size, Word32 *spectrum ) Word32 *spectrum // Qx ) { Word16 i; Word32 interleaveBuf[N_TCX10_MAX]; Loading @@ -643,7 +645,9 @@ void tcx5SpectrumInterleaving_fx( FOR( i = 0; i < tcx5Size; i++ ) { interleaveBuf[2 * i] = spectrum[i]; interleaveBuf[add( 2 * i, 1 )] = spectrum[add( tcx5Size, i )]; interleaveBuf[2 * i + 1] = spectrum[tcx5Size + i]; move32(); move32(); } Copy32( interleaveBuf, spectrum, shl( tcx5Size, 1 ) ); Loading @@ -659,7 +663,8 @@ void tcx5SpectrumInterleaving_fx( void tcx5SpectrumDeinterleaving_fx( const Word16 tcx5Size, Word32 *spectrum ) Word32 *spectrum // Qx ) { Word16 i; Word32 interleaveBuf[N_TCX10_MAX]; Loading @@ -670,7 +675,9 @@ void tcx5SpectrumDeinterleaving_fx( FOR( i = 0; i < tcx5Size; i++ ) { interleaveBuf[i] = spectrum[2 * i]; interleaveBuf[add( tcx5Size, i )] = spectrum[add( 2 * i, 1 )]; interleaveBuf[tcx5Size + i] = spectrum[2 * i + 1]; move32(); move32(); } Copy32( interleaveBuf, spectrum, shl( tcx5Size, 1 ) ); Loading @@ -687,7 +694,8 @@ void tcx5SpectrumDeinterleaving_fx( void tcx5TnsGrouping_fx( const Word16 L_frame, /* i : frame length (TCX5) */ const Word16 L_spec, /* i : coded spec length (TCX5, derived from filter borders*/ Word32 *spectrum ) Word32 *spectrum /*Qx*/ ) { /* rearrange LF sub-window lines prior to TNS synthesis filtering */ IF( LT_16( L_spec, L_frame ) ) Loading Loading @@ -716,7 +724,7 @@ void tcx5TnsGrouping_fx( void tcx5TnsUngrouping_fx( const Word16 L_frame, /* i : frame length (TCX5) */ const Word16 L_spec, /* i : coded spec length (TCX5, derived from filter borders*/ Word32 *spectrum, Word32 *spectrum, /*Qx*/ const Word16 enc_dec /* i : 0: encoder, else decoder */ ) { Loading Loading
lib_com/basop_util.c +2 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,8 @@ #define WMC_TOOL_SKIP extern const Word32 SqrtTable[32]; extern const Word16 SqrtDiffTable[32]; extern const Word32 SqrtTable[32]; // Q31 extern const Word16 SqrtDiffTable[32]; /* Q15 */ extern const Word32 ISqrtTable[32]; extern const Word16 ISqrtDiffTable[32]; Loading
lib_com/cng_exc_fx.c +53 −48 Original line number Diff line number Diff line Loading @@ -28,24 +28,24 @@ void CNG_exc_fx( Word16 *seed, /* i/o: random generator seed */ Word16 exc[], /* o : current non-enhanced excitation Q_new */ Word16 exc2[], /* o : current enhanced excitation Q_new */ Word32 *lp_ener, /* i/o: LP filtered E */ Word32 *lp_ener, /* i/o: LP filtered E Q6 */ const Word32 last_core_brate, /* i : previous frame core bitrate */ Word16 *first_CNG, /* i/o: first CNG frame flag for energy init. */ Word16 *cng_ener_seed, /* i/o: random generator seed for CNG energy */ Word16 bwe_exc[], /* o : excitation for SWB TBE */ Word16 bwe_exc[], /* o : excitation for SWB TBE Q_syn */ const Word16 allow_cn_step, /* i : allow CN step */ Word16 *last_allow_cn_step, /* i/o: last allow step */ const Word16 OldQ_exc, /* i : Old excitation scaling */ const Word16 Q_exc, /* i : excitation scaling */ const Word16 num_ho, /* i : number of selected hangover frames */ Word32 q_env[], Word32 *lp_env, Word32 *old_env, Word16 *exc_mem, Word16 *exc_mem1, Word32 q_env[], /*Q6*/ Word32 *lp_env, /*Q6*/ Word32 *old_env, /*Q6*/ Word16 *exc_mem, /*Q0*/ Word16 *exc_mem1, /*Q0*/ Word16 *sid_bw, Word16 *cng_ener_seed1, Word16 exc3[], Word16 exc3[], /*Q_exc*/ Word16 Opt_AMR_WB, const int16_t element_mode /* i : IVAS Element mode */ ) Loading Loading @@ -93,9 +93,9 @@ void CNG_exc_fx( L_tmp_ener = Mult_32_16( L_tmp_ener, 9079 ); /* divide by PIT_MAX (in Q15 + Q6 to get output in Q6)*/ L_tmp_ener = L_shr( L_tmp_ener, Q_ener ); /* -> If we want ener in Q6 */ if ( EQ_16( L_frame, L_FRAME16k ) ) IF( EQ_16( L_frame, L_FRAME16k ) ) { L_tmp_ener = Mult_32_16( L_tmp_ener, 26214 ); /* Compensate for 16kHz */ L_tmp_ener = Mult_32_16( L_tmp_ener, 26214 /*.8f in Q15*/ ); /* Compensate for 16kHz */ } *Enew = L_tmp_ener; move32(); Loading Loading @@ -123,14 +123,14 @@ void CNG_exc_fx( IF( LT_16( num_ho, 3 ) || LT_32( Mult_32_16( *Enew, 21845 /*1/1.5f, Q15*/ ), *lp_ener ) ) { /**lp_ener = 0.8f * *lp_ener + 0.2f * *Enew;*/ L_tmp_ener = Mult_32_16( *lp_ener, 26214 ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 6554 ); L_tmp_ener = Mult_32_16( *lp_ener, 26214 /*.8f in Q15*/ ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 6554 /*.2f in Q15*/ ); } ELSE { /**lp_ener = 0.95f * *lp_ener + 0.05f * *Enew;*/ L_tmp_ener = Mult_32_16( *lp_ener, 31130 ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 1638 ); L_tmp_ener = Mult_32_16( *lp_ener, 31130 /*.95f in Q15*/ ); L_tmp_ener = Madd_32_16( L_tmp_ener, *Enew, 1638 /* .05f in Q15*/ ); } } ELSE Loading Loading @@ -192,8 +192,8 @@ FOR( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR ) * Insert random variation for excitation energy * (random variation is scaled according to *lp_ener value) *------------------------------------------------------------*/ L_tmp = Mult_32_16( *lp_ener, Random( cng_ener_seed ) ); L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); L_tmp = Mult_32_16( *lp_ener, Random( cng_ener_seed ) ); // Q6 L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); // Q6 #ifdef BASOP_NOGLOB L_tmp = L_add_sat( L_tmp, *lp_ener ); #else Loading @@ -212,11 +212,11 @@ FOR( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR ) exp = sub( exp, exp2 ); if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { tmp = shr( tmp, 1 ); } Loading @@ -233,12 +233,13 @@ FOR( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR ) FOR( i = 0; i < L_SUBFR; i++ ) { /* exc2[i] *= enr */ L_tmp = L_mult( exc2[add( i_subfr, i )], tmp ); /* Q-4 * Q_exc+19 -> Q_exc +16 */ L_tmp = L_mult( exc2[i_subfr + i], tmp ); /* Q-4 * Q_exc+19 -> Q_exc +16 */ #ifdef BASOP_NOGLOB exc2[add( i_subfr, i )] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); exc2[i_subfr + i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); #else exc2[i_subfr + i] = round_fx( L_shl( L_tmp, exp ) ); #endif move16(); } } IF( NE_16( Opt_AMR_WB, 1 ) ) Loading Loading @@ -298,8 +299,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) { /* get AR low-passed envelope */ /* lp_env[i] = 0.9f*lp_env[i] + (1-0.9f)*old_env[i]; */ L_tmp = Mult_32_16( lp_env[i], 29491 ); lp_env[i] = L_add( L_tmp, Mult_32_16( old_env[i], 3277 ) ); L_tmp = Mult_32_16( lp_env[i], 29491 /*.9f in Q15*/ ); lp_env[i] = L_add( L_tmp, Mult_32_16( old_env[i], 3277 /*.1f in Q15*/ ) ); move32(); /* Q6 */ } Loading Loading @@ -381,8 +382,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* itmp[i] += own_random( cng_ener_seed1 )*denv[i]*0.000011f + denv[i]; */ L_tmp = Mult_32_16( denv[i], Random( cng_ener_seed1 ) ); L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); L_tmp = Mult_32_16( denv[i], Random( cng_ener_seed1 ) ); // Q6 L_tmp = Mult_32_16( L_tmp, GAIN_VAR ); // Q6 #ifdef BASOP_NOGLOB L_tmp = L_add_sat( L_tmp, denv[i] ); itmp[i] = L_add_sat( L_tmp, itmp[i] ); Loading @@ -394,7 +395,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) if ( itmp[i] < 0 ) { itmp[i] = L_deposit_l( 0 ); itmp[i] = 0; move32(); } } ptR = &fft_io[1]; Loading @@ -413,11 +415,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) exp2 = sub( 31 - 6, exp2 ); /* in Q15 (L_tmp in Q6)*/ exp = sub( exp2, exp ); /* Denormalize and substract */ if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { tmp2 = shr( tmp2, 1 ); } Loading Loading @@ -452,7 +454,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */ enr1 = L_deposit_l( 1 ); enr1 = 1; move32(); pt_fft_io = fft_io; IF( EQ_16( L_frame, L_FRAME ) ) { Loading Loading @@ -498,11 +501,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) exp = sub( exp, exp2 ); if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp, tmp2 ) ) IF( GT_16( tmp, tmp2 ) ) { tmp = shr( tmp, 1 ); } Loading @@ -529,8 +532,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) FOR( i = 0; i < L_SUBFR; i++ ) { /* fft_io[i] *= enr */ L_tmp = L_mult( fft_io[add( i_subfr, i )], tmp ); /* Q_exc + 16 - exp */ fft_io[add( i_subfr, i )] = round_fx( L_shl( L_tmp, exp ) ); /*Q_exc*/ L_tmp = L_mult( fft_io[i_subfr + i], tmp ); /* Q_exc + 16 - exp */ fft_io[i_subfr + i] = round_fx( L_shl( L_tmp, exp ) ); /*Q_exc*/ move16(); } } Loading @@ -538,7 +541,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) FOR( i = 0; i < L_frame; i++ ) { /* fft_io[i] = 0.75f*fft_io[i] + exc2[i];*/ tmp = mult( fft_io[i], 24576 ); tmp = mult( fft_io[i], 24576 /*.75f in Q15*/ ); #ifdef BASOP_NOGLOB fft_io[i] = add_sat( tmp, exc2[i] ); #else Loading @@ -549,7 +552,8 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) /* enr = (dotp( fft_io, fft_io, L_frame ) / L_frame) + 0.01f */ L_tmp2 = L_deposit_l( 1 ); L_tmp2 = 1; move32(); pt_fft_io = fft_io; IF( EQ_16( L_frame, L_FRAME ) ) { Loading Loading @@ -598,11 +602,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) exp2 = sub( 31 - 6, exp2 ); /* in Q15 (L_tmp in Q6)*/ exp = sub( exp2, exp ); /* Denormalize and substract */ if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { exp = add( exp, 1 ); } if ( GT_16( tmp2, tmp ) ) IF( GT_16( tmp2, tmp ) ) { tmp2 = shr( tmp2, 1 ); } Loading Loading @@ -654,7 +658,7 @@ void cng_params_postupd_fx( const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ const Word16 *const cng_Qexc_buf, /* i : Q_exc buffer Q0 */ const Word32 *const cng_brate_buf, /* i : bit rate buffer Q0 */ Word32 ho_env_circ[] /* i/o: Envelope buffer */ Word32 ho_env_circ[] /* i/o: Envelope buffer Q6 */ #ifdef IVAS_CODE_CNG_COM , const Word16 element_mode, /* i : Element mode */ Loading Loading @@ -683,7 +687,7 @@ void cng_params_postupd_fx( #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); if ( ptr < 0 ) IF( ptr < 0 ) { ptr = add( ptr, HO_HIST_SIZE ); } Loading Loading @@ -782,7 +786,7 @@ void cng_params_postupd_ivas_fx( const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ const Word16 *const cng_Qexc_buf, /* i : Q_exc buffer Q0 */ const Word32 *const cng_brate_buf, /* i : bit rate buffer Q0 */ Word32 ho_env_circ[], /* i/o: Envelope buffer */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q6 */ const Word16 element_mode, /* i : Element mode */ const Word16 bwidth /* i : Audio bandwidth */ ) Loading @@ -808,7 +812,7 @@ void cng_params_postupd_ivas_fx( #endif ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); if ( ptr < 0 ) IF( ptr < 0 ) { ptr = add( ptr, HO_HIST_SIZE ); } Loading Loading @@ -922,7 +926,7 @@ void cng_params_upd_fx( Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ const Word16 Q_exc, /* i : Q value of excitation */ const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ Word32 ho_env_circ[], /* i/o: Envelope buffer */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q6 */ Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */ Loading Loading @@ -979,7 +983,8 @@ void cng_params_upd_fx( scale = norm_s( maxv ); pt_exc2 = exc2; L_ener = L_deposit_l( 0 ); L_ener = 0; move32(); IF( EQ_16( L_frame, L_FRAME ) ) { FOR( j = 0; j < 128; j++ ) Loading Loading @@ -1046,7 +1051,7 @@ void cng_params_upd_fx( cng_Qexc_buf[*ho_circ_ptr] = Q_exc; move16(); cng_brate_buf[*ho_circ_ptr] = last_active_brate; move16(); move32(); } ELSE { Loading Loading @@ -1137,7 +1142,7 @@ void cng_params_upd_ivas_fx( Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ const Word16 Q_exc, /* i : Q value of excitation */ const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ Word32 ho_env_circ[], /* i/o: Envelope buffer */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q(6+shift) */ Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */ Loading Loading @@ -1192,7 +1197,8 @@ void cng_params_upd_ivas_fx( scale = norm_s( maxv ); pt_exc2 = exc2; L_ener = L_deposit_l( 0 ); L_ener = 0; move32(); IF( EQ_16( L_frame, L_FRAME ) ) { FOR( j = 0; j < 128; j++ ) Loading Loading @@ -1259,7 +1265,7 @@ void cng_params_upd_ivas_fx( cng_Qexc_buf[*ho_circ_ptr] = Q_exc; move16(); cng_brate_buf[*ho_circ_ptr] = last_active_brate; move16(); move32(); } ELSE { Loading Loading @@ -1305,7 +1311,6 @@ void cng_params_upd_ivas_fx( att_fx = pow_10_q23[index]; // Q23 move32(); tmp = extract_h( att_fx ); // Q7 move16(); shift = 8; move16(); } Loading Loading @@ -1336,7 +1341,7 @@ void cng_params_upd_ivas_fx( /* update the circular buffer of old residual envelope */ /* Copy32( env, &(ho_env_circ[add(shl(*ho_circ_ptr,4),shl(*ho_circ_ptr,2))]), NUM_ENV_CNG ); */ Copy32( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG ); scale_sig32( &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG, shift ); scale_sig32( &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG, shift ); // Q(6+shift) } *ho_circ_size = add( *ho_circ_size, 1 ); move16(); Loading
lib_com/cnst.h +1 −0 Original line number Diff line number Diff line Loading @@ -1940,6 +1940,7 @@ typedef enum _DCTTYPE #define N_SMC_FEATURES 15 /* number of features */ #define N_SMC_MIXTURES 6 /* number of mixtures */ #define N_PCA_COEF 12 /* number of PCA components */ #define HALF_N_PCA_COEF_LOG_P12_Q19 5781461//Q19 of (0.5f * N_PCA_COEF *logf( PI2 )) #define SMC_ST_MEAN_FACT 0.5 /* forgetting factor of short-term IIR mean filter */ #define SMC_ST_MEAN_RSHIFT_FACT_FX 1 /* SMC_ST_MEAN_FACT equivalent right shift factor */ Loading
lib_com/codec_tcx_common.c +52 −44 Original line number Diff line number Diff line Loading @@ -19,7 +19,8 @@ Word16 tcxGetNoiseFillingTilt( const Word16 lpcorder, const Word16 L_frame, const Word16 mode, Word16 *noiseTiltFactor ) Word16 *noiseTiltFactor /*Q15*/ ) { Word16 firstLine; Word32 tmp; Loading @@ -36,7 +37,7 @@ Word16 tcxGetNoiseFillingTilt( { firstLine = shr( L_frame, 3 ); Copy_Scale_sig( A, As, add( lpcorder, 1 ), sub( norm_s( A[0] ), 2 ) ); Copy_Scale_sig( A, As, add( lpcorder, 1 ), sub( norm_s( A[0] ), 2 ) ); // Q(12) tmp = get_gain( As + 1, As, lpcorder ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB Loading @@ -54,10 +55,10 @@ Word16 tcxGetNoiseFillingTilt( void tcxFormantEnhancement( Word16 xn_buf[], const Word16 gainlpc[], Word16 xn_buf[], // Q(15-xn_buf_e) const Word16 gainlpc[], // Q(15-gainlpc_e) const Word16 gainlpc_e[], Word32 spectrum[], Word32 spectrum[], // Q(31-spectrum_e) Word16 *spectrum_e, const Word16 L_frame, const Word16 L_frameTCX ) Loading Loading @@ -88,13 +89,13 @@ void tcxFormantEnhancement( e = gainlpc_e[0]; move16(); m = Sqrt16( gainlpc[0], &e ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); e = gainlpc_e[1]; move16(); m = Sqrt16( gainlpc[1], &e ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); fac0 = s_min( xn_buf[0], xn_buf[1] ); Loading @@ -107,7 +108,7 @@ void tcxFormantEnhancement( e = gainlpc_e[i + 1]; move16(); m = Sqrt16( gainlpc[i + 1], &e ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); test(); Loading @@ -122,9 +123,9 @@ void tcxFormantEnhancement( move16(); tmp = sub( e, fac_e ); if ( tmp > 0 ) IF( tmp > 0 ) fac0 = shr( fac0, tmp ); if ( tmp < 0 ) IF( tmp < 0 ) fac1 = shl( fac1, tmp ); if ( tmp > 0 ) Loading @@ -144,7 +145,7 @@ void tcxFormantEnhancement( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_o( mult( xn_buf[add( l, j )], fac ), fac_e, &Overflow ) ); xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -171,9 +172,9 @@ void tcxFormantEnhancement( move16(); tmp = sub( e, fac_e ); if ( tmp > 0 ) IF( tmp > 0 ) fac0 = shr( fac0, tmp ); if ( tmp < 0 ) IF( tmp < 0 ) fac1 = shl( fac1, tmp ); if ( tmp > 0 ) Loading @@ -193,7 +194,7 @@ void tcxFormantEnhancement( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_sat( mult( xn_buf[add( l, j )], fac ), fac_e ) ); xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -209,7 +210,7 @@ void tcxFormantEnhancement( { FOR( l = 0; l < k; l++ ) { *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); // Q(15-xn_buf_e)+Q(31-spectrum_e)+1 -16 move32(); spectrum++; } Loading @@ -219,7 +220,7 @@ void tcxFormantEnhancement( tmp = sub( L_frameTCX, L_frame ); FOR( i = 0; i < tmp; i++ ) { spectrum[i] = L_shr( spectrum[i], xn_buf_e ); spectrum[i] = L_shr( spectrum[i], xn_buf_e ); // Q(31-(specturm_e+xn_buf_e)) move32(); } *spectrum_e = add( *spectrum_e, xn_buf_e ); Loading @@ -227,11 +228,11 @@ void tcxFormantEnhancement( } void tcxFormantEnhancement_with_shift( Word16 xn_buf[], Word16 xn_buf[], // Q(15-xn_buf_e_out) Word16 *xn_buf_e_out, const Word16 gainlpc[], const Word16 gainlpc[], // Q(15-gainlpc_e) const Word16 gainlpc_e[], Word32 spectrum[], Word32 spectrum[], // Q(31-spectrum_e) Word16 *spectrum_e, const Word16 L_frame, const Word16 L_frameTCX ) Loading Loading @@ -262,13 +263,13 @@ void tcxFormantEnhancement_with_shift( e = gainlpc_e[0]; move16(); m = Sqrt16( gainlpc[0], &e ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); xn_buf[0] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); e = gainlpc_e[1]; move16(); m = Sqrt16( gainlpc[1], &e ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); fac0 = s_min( xn_buf[0], xn_buf[1] ); Loading @@ -281,7 +282,7 @@ void tcxFormantEnhancement_with_shift( e = gainlpc_e[i + 1]; move16(); m = Sqrt16( gainlpc[i + 1], &e ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) ); // Q(15-xn_buf_e) move16(); test(); Loading Loading @@ -322,7 +323,7 @@ void tcxFormantEnhancement_with_shift( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_o( mult( xn_buf[add( l, j )], fac ), fac_e, &Overflow ) ); xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -349,9 +350,9 @@ void tcxFormantEnhancement_with_shift( move16(); tmp = sub( e, fac_e ); if ( tmp > 0 ) IF( tmp > 0 ) fac0 = shr( fac0, tmp ); if ( tmp < 0 ) IF( tmp < 0 ) fac1 = shl( fac1, tmp ); if ( tmp > 0 ) Loading @@ -371,7 +372,7 @@ void tcxFormantEnhancement_with_shift( fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) ); BASOP_SATURATE_WARNING_OFF_EVS; #ifdef BASOP_NOGLOB xn_buf[add( l, j )] = s_min( xn_one, shl_o( mult( xn_buf[add( l, j )], fac ), fac_e, &Overflow ) ); xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) ); #else xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) ); #endif Loading @@ -387,7 +388,7 @@ void tcxFormantEnhancement_with_shift( { FOR( l = 0; l < k; l++ ) { *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); *spectrum = Mpy_32_16_1( *spectrum, *xn_buf ); // Q(15-xn_buf_e)+Q(31-spectrum_e)+1 -16 move32(); spectrum++; } Loading @@ -397,7 +398,7 @@ void tcxFormantEnhancement_with_shift( tmp = sub( L_frameTCX, L_frame ); FOR( i = 0; i < tmp; i++ ) { spectrum[i] = L_shr( spectrum[i], xn_buf_e ); spectrum[i] = L_shr( spectrum[i], xn_buf_e ); // Q(31-(specturm_e+xn_buf_e)) move32(); } *spectrum_e = add( *spectrum_e, xn_buf_e ); Loading @@ -409,8 +410,8 @@ void tcxFormantEnhancement_with_shift( void tcxInvertWindowGrouping( TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word32 xn_buf[], Word32 spectrum[], Word32 xn_buf[], // Qx Word32 spectrum[], // Qx const Word16 L_frame, const Word8 fUseTns, const Word16 last_core, Loading Loading @@ -461,7 +462,7 @@ void tcxInvertWindowGrouping( } p = spectrum + sub( L_frame, 1 ); FOR( i = sub( L_frame, 1 ); i > L_win; i -= 2 ) FOR( i = L_frame - 1; i > L_win; i -= 2 ) { *p-- = spectrum[i]; move32(); Loading Loading @@ -632,7 +633,8 @@ void tcx5TnsUngrouping( void tcx5SpectrumInterleaving_fx( const Word16 tcx5Size, Word32 *spectrum ) Word32 *spectrum // Qx ) { Word16 i; Word32 interleaveBuf[N_TCX10_MAX]; Loading @@ -643,7 +645,9 @@ void tcx5SpectrumInterleaving_fx( FOR( i = 0; i < tcx5Size; i++ ) { interleaveBuf[2 * i] = spectrum[i]; interleaveBuf[add( 2 * i, 1 )] = spectrum[add( tcx5Size, i )]; interleaveBuf[2 * i + 1] = spectrum[tcx5Size + i]; move32(); move32(); } Copy32( interleaveBuf, spectrum, shl( tcx5Size, 1 ) ); Loading @@ -659,7 +663,8 @@ void tcx5SpectrumInterleaving_fx( void tcx5SpectrumDeinterleaving_fx( const Word16 tcx5Size, Word32 *spectrum ) Word32 *spectrum // Qx ) { Word16 i; Word32 interleaveBuf[N_TCX10_MAX]; Loading @@ -670,7 +675,9 @@ void tcx5SpectrumDeinterleaving_fx( FOR( i = 0; i < tcx5Size; i++ ) { interleaveBuf[i] = spectrum[2 * i]; interleaveBuf[add( tcx5Size, i )] = spectrum[add( 2 * i, 1 )]; interleaveBuf[tcx5Size + i] = spectrum[2 * i + 1]; move32(); move32(); } Copy32( interleaveBuf, spectrum, shl( tcx5Size, 1 ) ); Loading @@ -687,7 +694,8 @@ void tcx5SpectrumDeinterleaving_fx( void tcx5TnsGrouping_fx( const Word16 L_frame, /* i : frame length (TCX5) */ const Word16 L_spec, /* i : coded spec length (TCX5, derived from filter borders*/ Word32 *spectrum ) Word32 *spectrum /*Qx*/ ) { /* rearrange LF sub-window lines prior to TNS synthesis filtering */ IF( LT_16( L_spec, L_frame ) ) Loading Loading @@ -716,7 +724,7 @@ void tcx5TnsGrouping_fx( void tcx5TnsUngrouping_fx( const Word16 L_frame, /* i : frame length (TCX5) */ const Word16 L_spec, /* i : coded spec length (TCX5, derived from filter borders*/ Word32 *spectrum, Word32 *spectrum, /*Qx*/ const Word16 enc_dec /* i : 0: encoder, else decoder */ ) { Loading