Loading lib_dec/dec_tcx_fx.c +25 −0 Original line number Diff line number Diff line Loading @@ -1859,6 +1859,7 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */ Word16 *exp /* o : exponent of result in [-32,31] Q0 */ ) #if 0 { Word16 i; Word32 L_sum, L_c; Loading Loading @@ -1895,6 +1896,30 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul L_sum = norm_llQ31( L_c, L_sum, exp ); return L_sum; } #else { Word16 i; Word32 L_sum; Word64 L_sum64; Word16 sh; L_sum64 = W_deposit32_l( L_off ); FOR( i = 0; i < lg; i+=2 ) { L_sum64 = W_mac_16_16( L_sum64, x[i], x[i] ); } #if 0 L_sum = w_norm_llQ31( L_sum64, exp ); #else sh = W_norm( L_sum64 ); L_sum = W_extract_h( W_shl(L_sum64, sh) ); *exp = (L_sum == 0) ? -32 : 32 - sh; #endif /* 0/1 use of w_norm_llQ31() */ return L_sum; } #endif /* 0/1 legacy */ void IMDCT_fx( Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_TDAC, Word16 *xn_buf, const Word16 *tcx_aldo_window_1, const PWord16 *tcx_aldo_window_1_trunc, const PWord16 *tcx_aldo_window_2, const PWord16 *tcx_mdct_window_half, const PWord16 *tcx_mdct_window_minimum, const PWord16 *tcx_mdct_window_trans, Word16 tcx_mdct_window_half_length, Word16 tcx_mdct_window_min_length, Word16 index, Word16 left_rect, Word16 tcx_offset, Word16 overlap, Word16 L_frame, Word16 L_frameTCX, Word16 L_spec_TCX5, Word16 L_frame_glob, Word16 frame_cnt, Word16 bfi, Word16 *old_out, Word16 *Q_old_wtda, Decoder_State *st, Word16 fullbandScale, Word16 *acelp_zir ) Loading lib_dec/fd_cng_dec_fx.c +101 −0 Original line number Diff line number Diff line Loading @@ -555,6 +555,16 @@ void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec ) error */ static inline Word32 w_norm_llQ31_inl( Word64 L64_var1, Word16 *S_var2 ) /*Q31 - L_tmp_exp*/ { Word32 L_result; Word16 sh = W_norm( L64_var1 ); L_result = W_extract_h( W_shl(L64_var1, sh) ); *S_var2 = (L_result == 0) ? -32 : 32 - sh; return L_result; } Word16 ApplyFdCng_fx( Word16 *timeDomainInput, /* i : pointer to time domain input Q*/ Word16 Q, Loading @@ -576,13 +586,17 @@ Word16 ApplyFdCng_fx( Word16 facTab[NPART]; Word16 facTabExp[NPART]; Word16 tmp_loop; #if 0 Word32 L_c; #endif Word16 lsp_cng[M]; HANDLE_FD_CNG_DEC hFdCngDec; HANDLE_FD_CNG_COM hFdCngCom; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #if 0 Flag Carry = 0; #endif move16(); move16(); #endif Loading Loading @@ -794,6 +808,7 @@ Word16 ApplyFdCng_fx( { tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -826,6 +841,27 @@ Word16 ApplyFdCng_fx( st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); L_tmp_exp = add( L_tmp_exp, 1 ); #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j )); /*Q31*/ } L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ } L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); L_tmp = Mpy_32_16_1( L_tmp, 1 ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, shr( T_DIV_L_Frame[L_shl( L_mac( -28000, NORM_MDCT_FACTOR, 95 ), 1 - 15 )], 1 ) ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16) ); /*->Q31, L_tmp_exp*/ st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); L_tmp_exp = add( L_tmp_exp, 1 ); #endif st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp; move16(); } Loading @@ -833,6 +869,7 @@ Word16 ApplyFdCng_fx( { tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -863,12 +900,32 @@ Word16 ApplyFdCng_fx( L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/ st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j )); /*Q31 - L_tmp_exp*/ } L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ } L_tmp_exp = add( L_tmp_exp, *cngNoiseLevel_exp - 1 ); L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16 )); /*->Q31, L_tmp_exp*/ st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ #endif move16(); st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp; move16(); } tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -900,6 +957,30 @@ Word16 ApplyFdCng_fx( st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j ) ); /*Q31 - L_tmp_exp*/ } #if 0 L_tmp = w_norm_llQ31( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ #else L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ #endif } L_tmp_exp = add( L_tmp_exp, *cngNoiseLevel_exp - 1); L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shr( L_mac( -28000, st->L_frame, 95 ), 15 - 1)] ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16) ); /*->Q31, L_tmp_exp */ st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); #endif st->cngTDLevel_e = L_tmp_exp; move16(); } Loading Loading @@ -1018,6 +1099,7 @@ Word16 ApplyFdCng_fx( /*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/ tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -1049,6 +1131,25 @@ Word16 ApplyFdCng_fx( st->cngTDLevel = round_fx_o( Sqrt32( L_tmp, &L_tmp_exp ), &Overflow ); /*Q15 - L_tmp_exp*/ move16(); #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j ) ); /*Q31 - L_tmp_exp*/ } L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ } L_tmp_exp = add( L_tmp_exp, *cngNoiseLevel_exp - 1 ); L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16) ); /*->Q31, L_tmp_exp*/ st->cngTDLevel = round_fx( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); #endif st->cngTDLevel_e = L_tmp_exp; move16(); BREAK; Loading Loading
lib_dec/dec_tcx_fx.c +25 −0 Original line number Diff line number Diff line Loading @@ -1859,6 +1859,7 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */ Word16 *exp /* o : exponent of result in [-32,31] Q0 */ ) #if 0 { Word16 i; Word32 L_sum, L_c; Loading Loading @@ -1895,6 +1896,30 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul L_sum = norm_llQ31( L_c, L_sum, exp ); return L_sum; } #else { Word16 i; Word32 L_sum; Word64 L_sum64; Word16 sh; L_sum64 = W_deposit32_l( L_off ); FOR( i = 0; i < lg; i+=2 ) { L_sum64 = W_mac_16_16( L_sum64, x[i], x[i] ); } #if 0 L_sum = w_norm_llQ31( L_sum64, exp ); #else sh = W_norm( L_sum64 ); L_sum = W_extract_h( W_shl(L_sum64, sh) ); *exp = (L_sum == 0) ? -32 : 32 - sh; #endif /* 0/1 use of w_norm_llQ31() */ return L_sum; } #endif /* 0/1 legacy */ void IMDCT_fx( Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_TDAC, Word16 *xn_buf, const Word16 *tcx_aldo_window_1, const PWord16 *tcx_aldo_window_1_trunc, const PWord16 *tcx_aldo_window_2, const PWord16 *tcx_mdct_window_half, const PWord16 *tcx_mdct_window_minimum, const PWord16 *tcx_mdct_window_trans, Word16 tcx_mdct_window_half_length, Word16 tcx_mdct_window_min_length, Word16 index, Word16 left_rect, Word16 tcx_offset, Word16 overlap, Word16 L_frame, Word16 L_frameTCX, Word16 L_spec_TCX5, Word16 L_frame_glob, Word16 frame_cnt, Word16 bfi, Word16 *old_out, Word16 *Q_old_wtda, Decoder_State *st, Word16 fullbandScale, Word16 *acelp_zir ) Loading
lib_dec/fd_cng_dec_fx.c +101 −0 Original line number Diff line number Diff line Loading @@ -555,6 +555,16 @@ void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec ) error */ static inline Word32 w_norm_llQ31_inl( Word64 L64_var1, Word16 *S_var2 ) /*Q31 - L_tmp_exp*/ { Word32 L_result; Word16 sh = W_norm( L64_var1 ); L_result = W_extract_h( W_shl(L64_var1, sh) ); *S_var2 = (L_result == 0) ? -32 : 32 - sh; return L_result; } Word16 ApplyFdCng_fx( Word16 *timeDomainInput, /* i : pointer to time domain input Q*/ Word16 Q, Loading @@ -576,13 +586,17 @@ Word16 ApplyFdCng_fx( Word16 facTab[NPART]; Word16 facTabExp[NPART]; Word16 tmp_loop; #if 0 Word32 L_c; #endif Word16 lsp_cng[M]; HANDLE_FD_CNG_DEC hFdCngDec; HANDLE_FD_CNG_COM hFdCngCom; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #if 0 Flag Carry = 0; #endif move16(); move16(); #endif Loading Loading @@ -794,6 +808,7 @@ Word16 ApplyFdCng_fx( { tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -826,6 +841,27 @@ Word16 ApplyFdCng_fx( st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); L_tmp_exp = add( L_tmp_exp, 1 ); #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j )); /*Q31*/ } L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ } L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); L_tmp = Mpy_32_16_1( L_tmp, 1 ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, shr( T_DIV_L_Frame[L_shl( L_mac( -28000, NORM_MDCT_FACTOR, 95 ), 1 - 15 )], 1 ) ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16) ); /*->Q31, L_tmp_exp*/ st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); L_tmp_exp = add( L_tmp_exp, 1 ); #endif st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp; move16(); } Loading @@ -833,6 +869,7 @@ Word16 ApplyFdCng_fx( { tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -863,12 +900,32 @@ Word16 ApplyFdCng_fx( L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/ st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j )); /*Q31 - L_tmp_exp*/ } L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ } L_tmp_exp = add( L_tmp_exp, *cngNoiseLevel_exp - 1 ); L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16 )); /*->Q31, L_tmp_exp*/ st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ #endif move16(); st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp; move16(); } tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -900,6 +957,30 @@ Word16 ApplyFdCng_fx( st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j ) ); /*Q31 - L_tmp_exp*/ } #if 0 L_tmp = w_norm_llQ31( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ #else L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ #endif } L_tmp_exp = add( L_tmp_exp, *cngNoiseLevel_exp - 1); L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shr( L_mac( -28000, st->L_frame, 95 ), 15 - 1)] ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16) ); /*->Q31, L_tmp_exp */ st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); #endif st->cngTDLevel_e = L_tmp_exp; move16(); } Loading Loading @@ -1018,6 +1099,7 @@ Word16 ApplyFdCng_fx( /*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/ tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); #if 0 L_tmp = L_deposit_h( 0 ); L_c = L_deposit_h( 0 ); FOR( j = 0; j < tmp_loop; j++ ) Loading Loading @@ -1049,6 +1131,25 @@ Word16 ApplyFdCng_fx( st->cngTDLevel = round_fx_o( Sqrt32( L_tmp, &L_tmp_exp ), &Overflow ); /*Q15 - L_tmp_exp*/ move16(); #else { Word64 W_tmp = 0; FOR( j = 0; j < tmp_loop; j++ ) { W_tmp = W_add( W_tmp, *( cngNoiseLevel + j ) ); /*Q31 - L_tmp_exp*/ } L_tmp = w_norm_llQ31_inl( W_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ } L_tmp_exp = add( L_tmp_exp, *cngNoiseLevel_exp - 1 ); L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/ L_tmp_exp = add( L_tmp_exp, -7 + (31 - 16) ); /*->Q31, L_tmp_exp*/ st->cngTDLevel = round_fx( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); #endif st->cngTDLevel_e = L_tmp_exp; move16(); BREAK; Loading