Loading lib_com/edct_fx.c +65 −4 Original line number Diff line number Diff line Loading @@ -228,6 +228,67 @@ void edct_fx( return; } void edct_ivas_fx( const Word32 *x, /* i : input signal Qq */ Word32 *y, /* o : output transform Qq */ Word16 length, /* i : length Q0*/ Word16 *q /* i : Q value of input signal */ ) { Word16 i; const Word16 *edct_table; /*Q16 */ Word32 re[L_FRAME_PLUS / 2]; Word32 im[L_FRAME_PLUS / 2]; Word32 L_tmp; Word16 tmp; Word16 len1; edct_table = get_edct_table( length, q ); /*q*/ len1 = shr( length, 1 ); /*Q0*/ /* Twiddling and Pre-rotate */ FOR( i = 0; i < len1; i++ ) { L_tmp = Mult_32_16( x[2 * i], edct_table[i] ); /*Q(q+1) */ re[i] = Madd_32_16( L_tmp, x[( length - ( 1 + ( i * 2 ) ) )], edct_table[( len1 - ( 1 + i ) )] ); /*Q(q+1) */ move32(); L_tmp = Mult_32_16( x[( length - ( 1 + ( i * 2 ) ) )], edct_table[i] ); /*Q(q+1) */ im[i] = Msub_32_16( L_tmp, x[( i * 2 )], edct_table[( len1 - ( 1 + i ) )] ); /*Q(q+1) */ move32(); } *q = sub( 31, *q ); move16(); tmp = sub( s_min( getScaleFactor32( re, len1 ), getScaleFactor32( im, len1 ) ), find_guarded_bits_fx( len1 ) ); scale_sig32( re, len1, tmp ); scale_sig32( im, len1, tmp ); fft_fx( re, im, len1, 1 ); *q = sub( *q, tmp ); move16(); tmp = div_s( 4, length ); /*Q17 */ tmp = round_fx( L_mult( tmp, 19302 /*0.75f * EVS_PI in Q13*/ ) ); /*Q15 */ FOR( i = 0; i < len1; i++ ) { L_tmp = Msub_32_16( re[i], im[i], tmp ); im[i] = Madd_32_16( im[i], re[i], tmp ); /*Q(q+1) */ re[i] = L_tmp; /*Q(q+1) */ move32(); move32(); } FOR( i = 0; i < len1; i++ ) { y[2 * i] = L_add( Mult_32_16( re[i], edct_table[i] ), Mult_32_16( im[i], edct_table[( len1 - ( 1 + i ) )] ) ); /*Q(q+2)*/ move32(); y[( length - ( 1 + ( i * 2 ) ) )] = L_sub( Mult_32_16( re[i], edct_table[( len1 - ( 1 + i ) )] ), Mult_32_16( im[i], edct_table[i] ) ); /*Q(q+2)*/ move32(); } /*Q(q-2) */ *q = sub( 31 + 2, *q ); move16(); return; } /*-------------------------------------------------------------------------* * FUNCTION : edst_fx() * Loading Loading @@ -271,12 +332,12 @@ void edst_fx( move32(); } *q = sub( 15, *q ); *q = sub( 31, *q ); move16(); BASOP_cfft( (cmplx *) complex_buf, len1, q, y ); tmp = div_s( 1, length ); /*Q15 */ tmp = round_fx( L_shl( L_mult( tmp, 19302 /*0.75f * EVS_PI in Q13*/ ), 2 ) ); /*Q15 */ tmp = div_s( 4, length ); /*Q17 */ tmp = round_fx( L_mult( tmp, 19302 /*0.75f * EVS_PI in Q13*/ ) ); /*Q15 */ FOR( i = 0; i < len1; i++ ) { re = Msub_32_16( complex_buf[2 * i], complex_buf[( ( i * 2 ) + 1 )], tmp ); /*Qq+1*/ Loading @@ -287,7 +348,7 @@ void edst_fx( move32(); } /*Q(q) */ *q = sub( 15 + 2, *q ); *q = sub( 31 + 2, *q ); move16(); return; Loading lib_com/prot_fx.h +7 −0 Original line number Diff line number Diff line Loading @@ -4437,6 +4437,13 @@ void edct_fx( Word16 *q /* i : Q value of i signal */ ); void edct_ivas_fx( const Word32 *x, /* i : input signal Qq */ Word32 *y, /* o : output transform Qq */ Word16 length, /* i : length Q0*/ Word16 *q /* i : Q value of input signal */ ); void edst_fx( const Word32 *x, /* i : i signal Qq */ Word32 *y, /* o : output transform Qq */ Loading lib_enc/bw_detect_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ void bw_detect_fx( in_win32[i] = L_mult( *pt++, *pt1-- ); move32(); } edct_fx( in_win32, spect32, BWD_TOTAL_WIDTH, &Q_dct /*,st->element_mode*/ ); edct_ivas_fx( in_win32, spect32, BWD_TOTAL_WIDTH, &Q_dct /*,st->element_mode*/ ); FOR( i = 0; i < BWD_TOTAL_WIDTH; i++ ) { Loading lib_enc/cod_tcx_fx.c +14 −8 Original line number Diff line number Diff line Loading @@ -1075,6 +1075,13 @@ void ShapeSpectrum_ivas_fx( TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; move32(); move32(); Word32 total_brate = st->total_brate; move32(); if ( st->element_mode == IVAS_CPE_MDCT ) { total_brate = st->element_brate; move32(); } /*-----------------------------------------------------------* * Init * Loading Loading @@ -1110,7 +1117,7 @@ void ShapeSpectrum_ivas_fx( tcxGetNoiseFillingTilt( A, M, L_frame, ( GE_32( st->total_brate, ACELP_13k20 ) && st->rf_mode == 0 ), ( GE_32( total_brate, ACELP_13k20 ) && st->rf_mode == 0 ), &hTcxEnc->noiseTiltFactor ); /* Calculate Spectrum Flatness Measure for the TCX Concealment */ Loading @@ -1121,7 +1128,7 @@ void ShapeSpectrum_ivas_fx( } test(); IF( LE_32( st->total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) IF( LE_32( total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) { max_low_pre = 0; move32(); Loading Loading @@ -1171,8 +1178,7 @@ void ShapeSpectrum_ivas_fx( FOR( i = L_frame; i < L_spec; i++ ) { W_tmp = W_mult0_32_32( spectrum[i], sns_int_scf[hTcxCfg->psychParamsCurrent->nBands - 1] ); W_tmp = W_shr( W_tmp, Q16 ); spectrum[i] = W_extract_l( W_tmp ); spectrum[i] = W_extract_h( W_shl( W_tmp, Q16 ) ); move32(); } *spectrum_e = sub( 31 - 1, q_spectrum ); // As the output spectrum from sns_shape_spectrum_fx has Q = q_spectrum + 1 Loading @@ -1198,7 +1204,7 @@ void ShapeSpectrum_ivas_fx( /* reduce the peaks in the IGF region, to make life of the core-coder easier... */ test(); IF( LE_32( st->total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) IF( LE_32( total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) { Word16 sf_width; Word16 dist_low, dist_high; Loading Loading @@ -3229,7 +3235,7 @@ void QuantizeSpectrum_fx( /* DCT */ Q = sub( 31, *spectrum_e ); edct_fx( spectrum, tmp_buf, L_frame, &Q ); edct_ivas_fx( spectrum, tmp_buf, L_frame, &Q ); /* scale by sqrt(L / NORM_MDCT_FACTOR) */ tmp1 = mult_r( shl( L_frame, 4 ), 26214 /*128.f / NORM_MDCT_FACTOR Q15*/ ); /* 4Q11 */ Loading Loading @@ -4483,7 +4489,7 @@ void coder_tcx_fx( Q = sub( Q, tmp2 ); /* DCT */ edct_fx( tmp_buf, spectrum, L_frame, &Q ); edct_ivas_fx( tmp_buf, spectrum, L_frame, &Q ); *spectrum_e = sub( 31, Q ); } Loading Loading @@ -5182,7 +5188,7 @@ void InternalTCXDecoder_fx( /* DCT */ Q = sub( 31, *spectrum_e ); edct_fx( spectrum_fx, tmp_buf, L_frame, &Q ); edct_ivas_fx( spectrum_fx, tmp_buf, L_frame, &Q ); /* scale by sqrt(L / NORM_MDCT_FACTOR) */ tmp1 = mult_r( shl( L_frame, 4 ), 26214 /*128.f / NORM_MDCT_FACTOR Q15*/ ); /* 4Q11 */ Loading lib_enc/ext_sig_ana_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -417,7 +417,7 @@ void core_signal_analysis_high_bitrate_fx( Q = sub( Q, tmp2 ); /* DCT */ edct_fx( tmp_buf, spectrum[frameno], L_subframe, &Q ); edct_ivas_fx( tmp_buf, spectrum[frameno], L_subframe, &Q ); *spectrum_e = sub( 31, Q ); } ELSE Loading Loading @@ -1072,7 +1072,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word16 Q; Q = q_out_wtda; edct_fx( tcx20Win_32, hTcxEnc->spectrum_fx[frameno], L_subframe, &Q ); edct_ivas_fx( tcx20Win_32, hTcxEnc->spectrum_fx[frameno], L_subframe, &Q ); hTcxEnc->spectrum_e[frameno] = sub( 31, Q ); move16(); Loading Loading
lib_com/edct_fx.c +65 −4 Original line number Diff line number Diff line Loading @@ -228,6 +228,67 @@ void edct_fx( return; } void edct_ivas_fx( const Word32 *x, /* i : input signal Qq */ Word32 *y, /* o : output transform Qq */ Word16 length, /* i : length Q0*/ Word16 *q /* i : Q value of input signal */ ) { Word16 i; const Word16 *edct_table; /*Q16 */ Word32 re[L_FRAME_PLUS / 2]; Word32 im[L_FRAME_PLUS / 2]; Word32 L_tmp; Word16 tmp; Word16 len1; edct_table = get_edct_table( length, q ); /*q*/ len1 = shr( length, 1 ); /*Q0*/ /* Twiddling and Pre-rotate */ FOR( i = 0; i < len1; i++ ) { L_tmp = Mult_32_16( x[2 * i], edct_table[i] ); /*Q(q+1) */ re[i] = Madd_32_16( L_tmp, x[( length - ( 1 + ( i * 2 ) ) )], edct_table[( len1 - ( 1 + i ) )] ); /*Q(q+1) */ move32(); L_tmp = Mult_32_16( x[( length - ( 1 + ( i * 2 ) ) )], edct_table[i] ); /*Q(q+1) */ im[i] = Msub_32_16( L_tmp, x[( i * 2 )], edct_table[( len1 - ( 1 + i ) )] ); /*Q(q+1) */ move32(); } *q = sub( 31, *q ); move16(); tmp = sub( s_min( getScaleFactor32( re, len1 ), getScaleFactor32( im, len1 ) ), find_guarded_bits_fx( len1 ) ); scale_sig32( re, len1, tmp ); scale_sig32( im, len1, tmp ); fft_fx( re, im, len1, 1 ); *q = sub( *q, tmp ); move16(); tmp = div_s( 4, length ); /*Q17 */ tmp = round_fx( L_mult( tmp, 19302 /*0.75f * EVS_PI in Q13*/ ) ); /*Q15 */ FOR( i = 0; i < len1; i++ ) { L_tmp = Msub_32_16( re[i], im[i], tmp ); im[i] = Madd_32_16( im[i], re[i], tmp ); /*Q(q+1) */ re[i] = L_tmp; /*Q(q+1) */ move32(); move32(); } FOR( i = 0; i < len1; i++ ) { y[2 * i] = L_add( Mult_32_16( re[i], edct_table[i] ), Mult_32_16( im[i], edct_table[( len1 - ( 1 + i ) )] ) ); /*Q(q+2)*/ move32(); y[( length - ( 1 + ( i * 2 ) ) )] = L_sub( Mult_32_16( re[i], edct_table[( len1 - ( 1 + i ) )] ), Mult_32_16( im[i], edct_table[i] ) ); /*Q(q+2)*/ move32(); } /*Q(q-2) */ *q = sub( 31 + 2, *q ); move16(); return; } /*-------------------------------------------------------------------------* * FUNCTION : edst_fx() * Loading Loading @@ -271,12 +332,12 @@ void edst_fx( move32(); } *q = sub( 15, *q ); *q = sub( 31, *q ); move16(); BASOP_cfft( (cmplx *) complex_buf, len1, q, y ); tmp = div_s( 1, length ); /*Q15 */ tmp = round_fx( L_shl( L_mult( tmp, 19302 /*0.75f * EVS_PI in Q13*/ ), 2 ) ); /*Q15 */ tmp = div_s( 4, length ); /*Q17 */ tmp = round_fx( L_mult( tmp, 19302 /*0.75f * EVS_PI in Q13*/ ) ); /*Q15 */ FOR( i = 0; i < len1; i++ ) { re = Msub_32_16( complex_buf[2 * i], complex_buf[( ( i * 2 ) + 1 )], tmp ); /*Qq+1*/ Loading @@ -287,7 +348,7 @@ void edst_fx( move32(); } /*Q(q) */ *q = sub( 15 + 2, *q ); *q = sub( 31 + 2, *q ); move16(); return; Loading
lib_com/prot_fx.h +7 −0 Original line number Diff line number Diff line Loading @@ -4437,6 +4437,13 @@ void edct_fx( Word16 *q /* i : Q value of i signal */ ); void edct_ivas_fx( const Word32 *x, /* i : input signal Qq */ Word32 *y, /* o : output transform Qq */ Word16 length, /* i : length Q0*/ Word16 *q /* i : Q value of input signal */ ); void edst_fx( const Word32 *x, /* i : i signal Qq */ Word32 *y, /* o : output transform Qq */ Loading
lib_enc/bw_detect_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ void bw_detect_fx( in_win32[i] = L_mult( *pt++, *pt1-- ); move32(); } edct_fx( in_win32, spect32, BWD_TOTAL_WIDTH, &Q_dct /*,st->element_mode*/ ); edct_ivas_fx( in_win32, spect32, BWD_TOTAL_WIDTH, &Q_dct /*,st->element_mode*/ ); FOR( i = 0; i < BWD_TOTAL_WIDTH; i++ ) { Loading
lib_enc/cod_tcx_fx.c +14 −8 Original line number Diff line number Diff line Loading @@ -1075,6 +1075,13 @@ void ShapeSpectrum_ivas_fx( TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; move32(); move32(); Word32 total_brate = st->total_brate; move32(); if ( st->element_mode == IVAS_CPE_MDCT ) { total_brate = st->element_brate; move32(); } /*-----------------------------------------------------------* * Init * Loading Loading @@ -1110,7 +1117,7 @@ void ShapeSpectrum_ivas_fx( tcxGetNoiseFillingTilt( A, M, L_frame, ( GE_32( st->total_brate, ACELP_13k20 ) && st->rf_mode == 0 ), ( GE_32( total_brate, ACELP_13k20 ) && st->rf_mode == 0 ), &hTcxEnc->noiseTiltFactor ); /* Calculate Spectrum Flatness Measure for the TCX Concealment */ Loading @@ -1121,7 +1128,7 @@ void ShapeSpectrum_ivas_fx( } test(); IF( LE_32( st->total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) IF( LE_32( total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) { max_low_pre = 0; move32(); Loading Loading @@ -1171,8 +1178,7 @@ void ShapeSpectrum_ivas_fx( FOR( i = L_frame; i < L_spec; i++ ) { W_tmp = W_mult0_32_32( spectrum[i], sns_int_scf[hTcxCfg->psychParamsCurrent->nBands - 1] ); W_tmp = W_shr( W_tmp, Q16 ); spectrum[i] = W_extract_l( W_tmp ); spectrum[i] = W_extract_h( W_shl( W_tmp, Q16 ) ); move32(); } *spectrum_e = sub( 31 - 1, q_spectrum ); // As the output spectrum from sns_shape_spectrum_fx has Q = q_spectrum + 1 Loading @@ -1198,7 +1204,7 @@ void ShapeSpectrum_ivas_fx( /* reduce the peaks in the IGF region, to make life of the core-coder easier... */ test(); IF( LE_32( st->total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) IF( LE_32( total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) { Word16 sf_width; Word16 dist_low, dist_high; Loading Loading @@ -3229,7 +3235,7 @@ void QuantizeSpectrum_fx( /* DCT */ Q = sub( 31, *spectrum_e ); edct_fx( spectrum, tmp_buf, L_frame, &Q ); edct_ivas_fx( spectrum, tmp_buf, L_frame, &Q ); /* scale by sqrt(L / NORM_MDCT_FACTOR) */ tmp1 = mult_r( shl( L_frame, 4 ), 26214 /*128.f / NORM_MDCT_FACTOR Q15*/ ); /* 4Q11 */ Loading Loading @@ -4483,7 +4489,7 @@ void coder_tcx_fx( Q = sub( Q, tmp2 ); /* DCT */ edct_fx( tmp_buf, spectrum, L_frame, &Q ); edct_ivas_fx( tmp_buf, spectrum, L_frame, &Q ); *spectrum_e = sub( 31, Q ); } Loading Loading @@ -5182,7 +5188,7 @@ void InternalTCXDecoder_fx( /* DCT */ Q = sub( 31, *spectrum_e ); edct_fx( spectrum_fx, tmp_buf, L_frame, &Q ); edct_ivas_fx( spectrum_fx, tmp_buf, L_frame, &Q ); /* scale by sqrt(L / NORM_MDCT_FACTOR) */ tmp1 = mult_r( shl( L_frame, 4 ), 26214 /*128.f / NORM_MDCT_FACTOR Q15*/ ); /* 4Q11 */ Loading
lib_enc/ext_sig_ana_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -417,7 +417,7 @@ void core_signal_analysis_high_bitrate_fx( Q = sub( Q, tmp2 ); /* DCT */ edct_fx( tmp_buf, spectrum[frameno], L_subframe, &Q ); edct_ivas_fx( tmp_buf, spectrum[frameno], L_subframe, &Q ); *spectrum_e = sub( 31, Q ); } ELSE Loading Loading @@ -1072,7 +1072,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word16 Q; Q = q_out_wtda; edct_fx( tcx20Win_32, hTcxEnc->spectrum_fx[frameno], L_subframe, &Q ); edct_ivas_fx( tcx20Win_32, hTcxEnc->spectrum_fx[frameno], L_subframe, &Q ); hTcxEnc->spectrum_e[frameno] = sub( 31, Q ); move16(); Loading