Loading lib_com/fft_rel.c +162 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,168 @@ void fft_rel( return; } void fft_rel_16_32fx( Word16 x[], /* i/o: input/output vector Qx */ Word16 *q_x, /* extra scaling added on speech buffer*/ Word16 i_subfr, const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ) { Word16 i, j, k, n1, n2, n4; Word16 step; Word32 xt, t1, t2; Word32 *x0, *x1, *x2; const Word16 *s, *c; Word32 *xi2, *xi3, *xi4, *xi1; Word32 fft_bff32[L_FFT]; Copy_Scale_sig_16_32_no_sat( x, fft_bff32, L_FFT, 0 ); // copying x to fft_bff32 without scaling /*-----------------------------------------------------------------* * Digit reverse counter *-----------------------------------------------------------------*/ j = 0; move16(); x0 = &fft_bff32[0]; // Qx FOR( i = 0; i < n - 1; i++ ) { IF( LT_16( i, j ) ) { xt = fft_bff32[j]; // Qx move32(); fft_bff32[j] = *x0; // Qx move32(); *x0 = xt; // Qx move32(); } x0++; k = shr( n, 1 ); WHILE( ( k <= j ) ) { j = sub( j, k ); k = shr( k, 1 ); } j = add( j, k ); } /*-----------------------------------------------------------------* * Length two butterflies *-----------------------------------------------------------------*/ x0 = &fft_bff32[0]; x1 = &fft_bff32[1]; FOR( i = 0; i < ( n >> 1 ); i++ ) { xt = *x0; move32(); *x0 = L_add( xt, *x1 ); move32(); *x1 = L_sub( xt, *x1 ); move32(); x0++; x0++; x1++; x1++; } /*-----------------------------------------------------------------* * Other butterflies * * The implementation described in [1] has been changed by using * table lookup for evaluating sine and cosine functions. The * variable ind and its increment step are needed to access table * entries. Note that this implementation assumes n4 to be so * small that ind will never exceed the table. Thus the input * argument n and the constant N_MAX_SAS must be set properly. *-----------------------------------------------------------------*/ n2 = 1; move16(); /* step = N_MAX_SAS/4; */ FOR( k = 2; k <= m; k++ ) { n4 = n2; move16(); n2 = shl( n4, 1 ); n1 = shl( n2, 1 ); step = idiv1616( N_MAX_SAS, n1 ); x0 = fft_bff32; x1 = fft_bff32 + n2; x2 = fft_bff32 + add( n2, n4 ); FOR( i = 0; i < n; i += n1 ) { xt = *x0; move32(); /* xt = x[i]; */ *x0 = L_add( xt, *x1 ); move32(); /* x[i] = xt + x[i+n2]; */ *x1 = L_sub( xt, *x1 ); move32(); /* x[i+n2] = xt - x[i+n2]; */ *x2 = L_negate( *x2 ); move32(); /* x[i+n2+n4] = -x[i+n2+n4]; */ s = sincos_t_fx + step; // Q15 c = s + 64; // Q15 xi1 = fft_bff32 + add( i, 1 ); xi3 = xi1 + n2; xi2 = xi3 - 2; xi4 = xi1 + sub( n1, 2 ); FOR( j = 1; j < n4; j++ ) { t1 = L_add( Mpy_32_16_1( *xi3, *c ), Mpy_32_16_1( *xi4, *s ) ); /* t1 = *xi3**(pt_c+ind) + *xi4**(pt_s+ind); Qx */ t2 = L_sub( Mpy_32_16_1( *xi3, *s ), Mpy_32_16_1( *xi4, *c ) ); /* t2 = *xi3**(pt_s+ind) - *xi4**(pt_c+ind); Qx */ *xi4 = L_sub( *xi2, t2 ); move32(); *xi3 = L_negate( L_add( *xi2, t2 ) ); move32(); *xi2 = L_sub( *xi1, t1 ); move32(); *xi1 = L_add( *xi1, t1 ); move32(); xi4--; xi2--; xi3++; xi1++; c += step; s += step; /* autoincrement by ar0 */ } x0 += n1; x1 += n1; x2 += n1; } /* step = shr(step, 1); */ } Word16 norm = L_norm_arr( fft_bff32, L_FFT ); IF( i_subfr == 0 ) { Copy_Scale_sig32_16( fft_bff32, x, L_FFT, norm ); *q_x = sub( norm, 16 ); move16(); } ELSE { IF( LT_16( norm, *q_x ) ) { scale_sig( x - L_FFT, L_FFT, sub( norm, *q_x ) ); Copy_Scale_sig32_16( fft_bff32, x, L_FFT, norm ); *q_x = sub( norm, 16 ); move16(); } ELSE { Copy_Scale_sig32_16( fft_bff32, x, L_FFT, add( 16, *q_x ) ); } } return; } void fft_rel_fx( Word16 x[], /* i/o: input/output vector Qx */ Loading lib_com/prot_fx.h +7 −0 Original line number Diff line number Diff line Loading @@ -1472,6 +1472,13 @@ void fft_rel_fx( const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ); void fft_rel_16_32fx( Word16 x[], /* i/o: input/output vector Qx */ Word16 *q_x, /* extra scaling added on speech buffer*/ Word16 i_subfr, const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ); void fft_rel_fx32( Word32 x[], /* i/o: i /output vector */ const Word16 n, /* i : vector length */ Loading lib_enc/analy_sp_fx.c +18 −7 Original line number Diff line number Diff line Loading @@ -510,9 +510,7 @@ void ivas_analy_sp_fx( } ELSE { Word16 scale = norm_arr( speech + 3 * ( L_SUBFR / 2 ) - L_FFT / 2, L_FFT + 4 * ( L_SUBFR / 2 ) ); scale = sub( scale, LOG2_L_FFT ); // guard_bits *q_fft_buff = add( Q_new, scale ); Word16 scale = 0; move16(); FOR( i_subfr = 0; i_subfr <= 1; i_subfr++ ) Loading Loading @@ -543,11 +541,24 @@ void ivas_analy_sp_fx( move16(); } scale_sig( pt_fft, L_FFT, scale ); /* compute the spectrum */ fft_rel_fx( pt_fft, L_FFT, LOG2_L_FFT ); fft_rel_16_32fx( pt_fft, &scale, i_subfr, L_FFT, LOG2_L_FFT ); *q_fft_buff = add( Q_new, scale ); // resultant q for fft_buff move16(); IF( EQ_16( i_subfr, 1 ) ) { Word16 new_q_bands = add( shl( *q_fft_buff, 1 ), 14 ); IF( GT_16( new_q_bands, 39 ) ) { new_q_bands = 39; move16(); } scale_sig32( fr_bands, NB_BANDS, sub( new_q_bands, *q_fr_bands ) ); scale_sig32( lf_E, VOIC_BINS, sub( new_q_bands, *q_lf_E ) ); LEtot = W_shl( LEtot, sub( new_q_bands, *q_fr_bands ) ); scale_sig32( Bin_E, L_FFT / 2, sub( new_q_bands, *q_lf_E ) ); scale_sig32( band_energies, NB_BANDS, sub( new_q_bands, *q_fr_bands ) ); } /* find energy per critical band */ ivas_find_enr( pt_fft, *q_fft_buff, pt_bands, q_fr_bands, lf_E + i_subfr * VOIC_BINS, q_lf_E, &LEtot, min_band, max_band, &Bin_E[i_subfr * L_FFT / 2], BIN, band_energies + i_subfr * NB_BANDS ); Loading lib_enc/ivas_tcx_core_enc.c +0 −4 Original line number Diff line number Diff line Loading @@ -727,10 +727,6 @@ void stereo_tcx_core_enc( move16(); } } st->q_Bin_E = Q_new + Q_SCALE - 2; move16(); st->q_Bin_E_old = Q_new + Q_SCALE - 2; move16(); Scale_sig( st->synth, st->L_frame, -Q_new ); IF( st->tcxonly == 0 ) { Loading Loading
lib_com/fft_rel.c +162 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,168 @@ void fft_rel( return; } void fft_rel_16_32fx( Word16 x[], /* i/o: input/output vector Qx */ Word16 *q_x, /* extra scaling added on speech buffer*/ Word16 i_subfr, const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ) { Word16 i, j, k, n1, n2, n4; Word16 step; Word32 xt, t1, t2; Word32 *x0, *x1, *x2; const Word16 *s, *c; Word32 *xi2, *xi3, *xi4, *xi1; Word32 fft_bff32[L_FFT]; Copy_Scale_sig_16_32_no_sat( x, fft_bff32, L_FFT, 0 ); // copying x to fft_bff32 without scaling /*-----------------------------------------------------------------* * Digit reverse counter *-----------------------------------------------------------------*/ j = 0; move16(); x0 = &fft_bff32[0]; // Qx FOR( i = 0; i < n - 1; i++ ) { IF( LT_16( i, j ) ) { xt = fft_bff32[j]; // Qx move32(); fft_bff32[j] = *x0; // Qx move32(); *x0 = xt; // Qx move32(); } x0++; k = shr( n, 1 ); WHILE( ( k <= j ) ) { j = sub( j, k ); k = shr( k, 1 ); } j = add( j, k ); } /*-----------------------------------------------------------------* * Length two butterflies *-----------------------------------------------------------------*/ x0 = &fft_bff32[0]; x1 = &fft_bff32[1]; FOR( i = 0; i < ( n >> 1 ); i++ ) { xt = *x0; move32(); *x0 = L_add( xt, *x1 ); move32(); *x1 = L_sub( xt, *x1 ); move32(); x0++; x0++; x1++; x1++; } /*-----------------------------------------------------------------* * Other butterflies * * The implementation described in [1] has been changed by using * table lookup for evaluating sine and cosine functions. The * variable ind and its increment step are needed to access table * entries. Note that this implementation assumes n4 to be so * small that ind will never exceed the table. Thus the input * argument n and the constant N_MAX_SAS must be set properly. *-----------------------------------------------------------------*/ n2 = 1; move16(); /* step = N_MAX_SAS/4; */ FOR( k = 2; k <= m; k++ ) { n4 = n2; move16(); n2 = shl( n4, 1 ); n1 = shl( n2, 1 ); step = idiv1616( N_MAX_SAS, n1 ); x0 = fft_bff32; x1 = fft_bff32 + n2; x2 = fft_bff32 + add( n2, n4 ); FOR( i = 0; i < n; i += n1 ) { xt = *x0; move32(); /* xt = x[i]; */ *x0 = L_add( xt, *x1 ); move32(); /* x[i] = xt + x[i+n2]; */ *x1 = L_sub( xt, *x1 ); move32(); /* x[i+n2] = xt - x[i+n2]; */ *x2 = L_negate( *x2 ); move32(); /* x[i+n2+n4] = -x[i+n2+n4]; */ s = sincos_t_fx + step; // Q15 c = s + 64; // Q15 xi1 = fft_bff32 + add( i, 1 ); xi3 = xi1 + n2; xi2 = xi3 - 2; xi4 = xi1 + sub( n1, 2 ); FOR( j = 1; j < n4; j++ ) { t1 = L_add( Mpy_32_16_1( *xi3, *c ), Mpy_32_16_1( *xi4, *s ) ); /* t1 = *xi3**(pt_c+ind) + *xi4**(pt_s+ind); Qx */ t2 = L_sub( Mpy_32_16_1( *xi3, *s ), Mpy_32_16_1( *xi4, *c ) ); /* t2 = *xi3**(pt_s+ind) - *xi4**(pt_c+ind); Qx */ *xi4 = L_sub( *xi2, t2 ); move32(); *xi3 = L_negate( L_add( *xi2, t2 ) ); move32(); *xi2 = L_sub( *xi1, t1 ); move32(); *xi1 = L_add( *xi1, t1 ); move32(); xi4--; xi2--; xi3++; xi1++; c += step; s += step; /* autoincrement by ar0 */ } x0 += n1; x1 += n1; x2 += n1; } /* step = shr(step, 1); */ } Word16 norm = L_norm_arr( fft_bff32, L_FFT ); IF( i_subfr == 0 ) { Copy_Scale_sig32_16( fft_bff32, x, L_FFT, norm ); *q_x = sub( norm, 16 ); move16(); } ELSE { IF( LT_16( norm, *q_x ) ) { scale_sig( x - L_FFT, L_FFT, sub( norm, *q_x ) ); Copy_Scale_sig32_16( fft_bff32, x, L_FFT, norm ); *q_x = sub( norm, 16 ); move16(); } ELSE { Copy_Scale_sig32_16( fft_bff32, x, L_FFT, add( 16, *q_x ) ); } } return; } void fft_rel_fx( Word16 x[], /* i/o: input/output vector Qx */ Loading
lib_com/prot_fx.h +7 −0 Original line number Diff line number Diff line Loading @@ -1472,6 +1472,13 @@ void fft_rel_fx( const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ); void fft_rel_16_32fx( Word16 x[], /* i/o: input/output vector Qx */ Word16 *q_x, /* extra scaling added on speech buffer*/ Word16 i_subfr, const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ); void fft_rel_fx32( Word32 x[], /* i/o: i /output vector */ const Word16 n, /* i : vector length */ Loading
lib_enc/analy_sp_fx.c +18 −7 Original line number Diff line number Diff line Loading @@ -510,9 +510,7 @@ void ivas_analy_sp_fx( } ELSE { Word16 scale = norm_arr( speech + 3 * ( L_SUBFR / 2 ) - L_FFT / 2, L_FFT + 4 * ( L_SUBFR / 2 ) ); scale = sub( scale, LOG2_L_FFT ); // guard_bits *q_fft_buff = add( Q_new, scale ); Word16 scale = 0; move16(); FOR( i_subfr = 0; i_subfr <= 1; i_subfr++ ) Loading Loading @@ -543,11 +541,24 @@ void ivas_analy_sp_fx( move16(); } scale_sig( pt_fft, L_FFT, scale ); /* compute the spectrum */ fft_rel_fx( pt_fft, L_FFT, LOG2_L_FFT ); fft_rel_16_32fx( pt_fft, &scale, i_subfr, L_FFT, LOG2_L_FFT ); *q_fft_buff = add( Q_new, scale ); // resultant q for fft_buff move16(); IF( EQ_16( i_subfr, 1 ) ) { Word16 new_q_bands = add( shl( *q_fft_buff, 1 ), 14 ); IF( GT_16( new_q_bands, 39 ) ) { new_q_bands = 39; move16(); } scale_sig32( fr_bands, NB_BANDS, sub( new_q_bands, *q_fr_bands ) ); scale_sig32( lf_E, VOIC_BINS, sub( new_q_bands, *q_lf_E ) ); LEtot = W_shl( LEtot, sub( new_q_bands, *q_fr_bands ) ); scale_sig32( Bin_E, L_FFT / 2, sub( new_q_bands, *q_lf_E ) ); scale_sig32( band_energies, NB_BANDS, sub( new_q_bands, *q_fr_bands ) ); } /* find energy per critical band */ ivas_find_enr( pt_fft, *q_fft_buff, pt_bands, q_fr_bands, lf_E + i_subfr * VOIC_BINS, q_lf_E, &LEtot, min_band, max_band, &Bin_E[i_subfr * L_FFT / 2], BIN, band_energies + i_subfr * NB_BANDS ); Loading
lib_enc/ivas_tcx_core_enc.c +0 −4 Original line number Diff line number Diff line Loading @@ -727,10 +727,6 @@ void stereo_tcx_core_enc( move16(); } } st->q_Bin_E = Q_new + Q_SCALE - 2; move16(); st->q_Bin_E_old = Q_new + Q_SCALE - 2; move16(); Scale_sig( st->synth, st->L_frame, -Q_new ); IF( st->tcxonly == 0 ) { Loading