Loading lib_com/ivas_masa_com.c +254 −11 Original line number Diff line number Diff line Loading @@ -66,6 +66,258 @@ static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *ph static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); static Word16 quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, Word32 *phi_hat, const Word16 n ); static Word32 estim_round[MASA_NO_CIRCLES + 1] = { /* Q0 */ -423, 0, 422, 845, 1267, 1689, 2111, 2532, 2953, 3373, 3793, 4212, 4630, 5047, 5464, 5880, 6294, 6708, 7120, 7532, 7941, 8350, 8757, 9163, 9567, 9969, 10370, 10769, 11166, 11561, 11955, 12346, 12735, 13122, 13507, 13890, 14270, 14648, 15023, 15396, 15766, 16134, 16499, 16861, 17220, 17576, 17930, 18280, 18627, 18971, 19312, 19650, 19984, 20315, 20643, 20967, 21288, 21605, 21918, 22228, 22534, 22836, 23135, 23429, 23720, 24007, 24289, 24568, 24842, 25112, 25378, 25640, 25898, 26151, 26400, 26644, 26884, 27119, 27350, 27576, 27798, 28015, 28227, 28435, 28637, 28835, 29029, 29217, 29400, 29579, 29752, 29921, 30084, 30243, 30396, 30544, 30688, 30826, 30959, 31086, 31209, 31326, 31438, 31545, 31647, 31743, 31834, 31919, 32000, 32075, 32144, 32208, 32267, 32320, 32368, 32411, 32448, 32480, 32506, 32527, 32542, 32552 }; static Word32 estim_ceil[MASA_NO_CIRCLES + 1] = { /* Q0 */ -422, 0, 423, 845, 1268, 1690, 2111, 2532, 2953, 3374, 3793, 4212, 4630, 5048, 5465, 5880, 6295, 6708, 7121, 7532, 7942, 8350, 8758, 9163, 9567, 9970, 10371, 10770, 11167, 11562, 11955, 12347, 12736, 13123, 13508, 13890, 14270, 14648, 15024, 15396, 15767, 16134, 16499, 16861, 17220, 17577, 17930, 18280, 18628, 18972, 19313, 19650, 19985, 20316, 20644, 20968, 21288, 21605, 21919, 22229, 22535, 22837, 23135, 23430, 23720, 24007, 24290, 24568, 24843, 25113, 25379, 25641, 25898, 26151, 26400, 26644, 26884, 27120, 27350, 27577, 27798, 28015, 28228, 28435, 28638, 28836, 29029, 29217, 29401, 29579, 29753, 29921, 30085, 30243, 30397, 30545, 30688, 30826, 30959, 31087, 31210, 31327, 31439, 31546, 31647, 31743, 31834, 31920, 32000, 32075, 32145, 32209, 32268, 32321, 32369, 32411, 32449, 32480, 32506, 32527, 32543, 32552 }; #endif Loading Loading @@ -1564,26 +1816,17 @@ void deindex_sph_idx_fx( } ELSE { estim_fx = Mpy_32_32( MASA_ANGLE_AT_EQUATOR_Q31, L_sub( L_shl( id_th, Q22 ), 2097152 ) /* 0.5f in Q22 */ ); /* Q22 */ base_low = n[0]; move32(); IF( GE_16( id_th, 2 ) ) { tmp32 = estim_fx % 26353590; /* 2 * PI in Q22 */ tmp32 = Mpy_32_32( tmp32, 341782638 /* 2147483647 / 2 * PI */ ); /* Q7 */ tmp16 = extract_l( L_shr( tmp32, Q7 ) ); tmp16 = getSineWord16R2( tmp16 ); tmp16 = sub( tmp16, MASA_ASIN_OFFSET_Q15 ); tmp32 = Mpy_32_16_1( MASA_NTOT2_FAC_Q15, tmp16 ); /* Q15 */ IF( EQ_16( id_th, 2 ) ) { base_low = L_add( base_low, L_shl( extract_l( L_shr( ceil_fixed( tmp32, Q15 ), Q15 ) ), 1 ) ); /* Q0 */ base_low = L_add( base_low, L_shl( estim_ceil[id_th], 1 ) ); /* Q0 */ } ELSE { base_low = L_add( base_low, L_shl( extract_l( L_shr_r( tmp32, Q15 ) ), 1 ) ); /* Q0 */ base_low = L_add( base_low, L_shl( estim_round[id_th], 1 ) ); /* Q0 */ } } base_up = L_add( base_low, L_shl( n[id_th], 1 ) ); Loading lib_dec/ivas_core_dec.c +0 −12 Original line number Diff line number Diff line Loading @@ -758,9 +758,6 @@ ivas_error ivas_core_dec_fx( st->prev_Q_syn = st->Q_syn; move16(); Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( st->Q_syn, st->hHQ_core->Q_old_wtda_LB ) ); Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( st->Q_syn, st->hHQ_core->Q_old_wtda ) ); IF( st->hTcxDec ) { st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; Loading @@ -774,15 +771,6 @@ ivas_error ivas_core_dec_fx( } stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx, e_sig ); FOR( ch = 0; ch < 2; ch++ ) { st = hCPE->hCoreCoder[ch]; st->hHQ_core->Q_old_wtda_LB = st->Q_syn; move16(); st->hHQ_core->Q_old_wtda = st->Q_syn; move16(); } } } /* for inactive frames with mono output, copy and (if necessary) downmix buffers */ Loading lib_dec/ivas_mct_dec.c +0 −9 Original line number Diff line number Diff line Loading @@ -571,10 +571,6 @@ ivas_error ivas_mct_dec_fx( } FOR( n = 0; n < CPE_CHANNELS; n++ ) { IF( hCPE->hCoreCoder[n]->Q_syn != 0 ) { Scale_sig( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[n]->Q_syn ); } if ( sts[n]->hTcxDec && sts[n]->hTcxDec->conCngLevelBackgroundTrace_e < 0 ) { sts[n]->hTcxDec->conCngLevelBackgroundTrace_e = 0; Loading Loading @@ -607,11 +603,6 @@ ivas_error ivas_mct_dec_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { IF( hCPE->hCoreCoder[n]->Q_syn != 0 ) { Scale_sig( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, negate( hCPE->hCoreCoder[n]->Q_syn ) ); Scale_sig( hCPE->hCoreCoder[n]->hHQ_core->old_out_LB_fx, L_FRAME32k, negate( hCPE->hCoreCoder[n]->Q_syn ) ); } IF( hCPE->hCoreCoder[n]->hBPF ) { hCPE->hCoreCoder[n]->hBPF->pst_mem_deemp_err_fx = extract_l( L_shr( hCPE->hCoreCoder[n]->mem_error, sub( Q16, sub( hCPE->hCoreCoder[n]->Q_syn2, 1 ) ) ) ); Loading lib_dec/ivas_mdct_core_dec.c +7 −4 Original line number Diff line number Diff line Loading @@ -2057,8 +2057,8 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( q_win, sub( -1, st->Q_syn ) ) ); Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( q_win, st->Q_syn ) ); Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->Q_syn ) ); Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->Q_syn ) ); Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); #ifdef MSAN_FIX Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); Loading Loading @@ -2110,7 +2110,7 @@ void ivas_mdct_core_reconstruct_fx( st->Q_syn = q_syn; move16(); } sf = getScaleFactor16( st->hHQ_core->old_out_fx, L_FRAME48k ); sf = s_min( getScaleFactor16( st->hHQ_core->old_out_fx, L_FRAME48k ), getScaleFactor16( st->hHQ_core->old_out_LB_fx, L_FRAME32k ) ); IF( LT_16( sf, sub( st->Q_syn, q_win ) ) ) { st->Q_syn = add( q_win, sf ); Loading Loading @@ -2181,7 +2181,10 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->mem_syn2_fx, M, st->Q_syn ); Scale_sig( st->mem_syn_r, M, st->Q_syn ); } st->hHQ_core->Q_old_wtda = st->Q_syn; move16(); st->hHQ_core->Q_old_wtda_LB = st->Q_syn; move16(); /*--------------------------------------------------------------------------------* * Updates *--------------------------------------------------------------------------------*/ Loading lib_dec/ivas_stereo_dft_dec_fx.c +53 −21 Original line number Diff line number Diff line Loading @@ -2519,6 +2519,8 @@ void stereo_dft_generate_res_pred_fx( Word16 d_long, d_short, d_long_ind, d_short_ind; Word16 g_short, g_long; Word32 dmx_nrg, rev_nrg; Word64 dmx_nrg_64bit, rev_nrg_64bit; Word16 q_shift, q_com, dmx_nrg_q, rev_nrg_q, q_smoothed_nrg_local[STEREO_DFT_BAND_MAX]; Word32 past_dmx_nrg; Word32 pred_gain_avg; Word32 g2; Loading Loading @@ -2580,35 +2582,50 @@ void stereo_dft_generate_res_pred_fx( { /* ESF in lowband */ /* main loop over core region*/ set16_fx( q_smoothed_nrg_local, hStereoDft->q_smoothed_nrg, STEREO_DFT_BAND_MAX ); FOR( b = hStereoDft->res_cod_band_max; b <= band0; b++ ) { dmx_nrg = EPSILON_FIX; move32(); rev_nrg = EPSILON_FIX; move32(); dmx_nrg_64bit = EPSILLON_FX; move64(); rev_nrg_64bit = EPSILLON_FX; move64(); /* calculate band energies (low band only in case of ACELP) */ FOR( i = hStereoDft->band_limits[b]; i < s_min( hStereoDft->band_limits[b + 1], bin0 ); i++ ) { /* Saturating below calculations (to be rechecked?) */ dmx_nrg = L_add_sat( dmx_nrg, Madd_32_32( Mpy_32_32( pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), pDFT_DMX[add( shl( i, 1 ), 1 )], pDFT_DMX[add( shl( i, 1 ), 1 )] ) ); rev_nrg = L_add_sat( rev_nrg, Madd_32_32( Mpy_32_32( ap_filt_DMX[2 * i], ap_filt_DMX[2 * i] ), ap_filt_DMX[add( shl( i, 1 ), 1 )], ap_filt_DMX[add( shl( i, 1 ), 1 )] ) ); dmx_nrg_64bit = W_add( dmx_nrg_64bit, W_add( W_mult0_32_32( pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), W_mult0_32_32( pDFT_DMX[add( shl( i, 1 ), 1 )], pDFT_DMX[add( shl( i, 1 ), 1 )] ) ) ); rev_nrg_64bit = W_add( rev_nrg_64bit, W_add( W_mult0_32_32( ap_filt_DMX[2 * i], ap_filt_DMX[2 * i] ), W_mult0_32_32( ap_filt_DMX[add( shl( i, 1 ), 1 )], ap_filt_DMX[add( shl( i, 1 ), 1 )] ) ) ); } IF( LT_16( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ) ) q_shift = W_norm( dmx_nrg_64bit ); dmx_nrg = W_extract_l( W_shl( dmx_nrg_64bit, sub( q_shift, 32 ) ) ); // 2 * hStereoDft->q_dft + (q_shift - 32) dmx_nrg_q = add( imult1616( 2, hStereoDft->q_dft ), sub( q_shift, 32 ) ); q_shift = W_norm( rev_nrg_64bit ); rev_nrg = W_extract_l( W_shl( rev_nrg_64bit, sub( q_shift, 32 ) ) ); // 2 * hStereoDft->q_dft + (q_shift - 32) rev_nrg_q = add( imult1616( 2, hStereoDft->q_dft ), sub( q_shift, 32 ) ); /* Reach a common Q for dmx_nrg and rev_nrg */ q_com = s_min( dmx_nrg_q, rev_nrg_q ); dmx_nrg = L_shl( dmx_nrg, sub( q_com, dmx_nrg_q ) ); rev_nrg = L_shl( rev_nrg, sub( q_com, rev_nrg_q ) ); IF( LT_16( hStereoDft->q_smoothed_nrg, q_com ) ) { rev_nrg = L_shr( rev_nrg, shl( sub( hStereoDft->q_dft, hStereoDft->q_smoothed_nrg ), 1 ) ); dmx_nrg = L_shr( dmx_nrg, shl( sub( hStereoDft->q_dft, hStereoDft->q_smoothed_nrg ), 1 ) ); rev_nrg = L_shr( rev_nrg, shl( sub( q_com, hStereoDft->q_smoothed_nrg ), 1 ) ); dmx_nrg = L_shr( dmx_nrg, shl( sub( q_com, hStereoDft->q_smoothed_nrg ), 1 ) ); q_com = hStereoDft->q_smoothed_nrg; move16(); } ELSE IF( GT_16( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ) ) ELSE IF( GT_16( hStereoDft->q_smoothed_nrg, q_com ) ) { hStereoDft->smooth_res_nrg_fx[b] = L_shr( hStereoDft->smooth_res_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ), 1 ) ); hStereoDft->smooth_dmx_nrg_fx[b] = L_shr( hStereoDft->smooth_dmx_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ), 1 ) ); hStereoDft->smooth_res_nrg_fx[b] = L_shr( hStereoDft->smooth_res_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, q_com ), 1 ) ); move32(); hStereoDft->smooth_dmx_nrg_fx[b] = L_shr( hStereoDft->smooth_dmx_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, q_com ), 1 ) ); move32(); q_smoothed_nrg_local[b] = q_com; move16(); } /* smoothing */ hStereoDft->smooth_res_nrg_fx[b] = Madd_32_16( Mpy_32_16_1( hStereoDft->smooth_res_nrg_fx[b], alpha ), rev_nrg, sub( (Word16) ( 0x7FFF ), alpha ) ); Loading Loading @@ -2691,8 +2708,23 @@ void stereo_dft_generate_res_pred_fx( move32(); } } IF( GT_16( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ) ) /* Reach a common Q for all the bands */ q_com = Q31; move16(); FOR( b = 0; b < STEREO_DFT_BAND_MAX; b++ ) { q_com = s_min( q_com, q_smoothed_nrg_local[b] ); } FOR( b = 0; b < STEREO_DFT_BAND_MAX; b++ ) { hStereoDft->smooth_dmx_nrg_fx[b] = L_shl( hStereoDft->smooth_dmx_nrg_fx[b], sub( q_com, q_smoothed_nrg_local[b] ) ); hStereoDft->smooth_res_nrg_fx[b] = L_shl( hStereoDft->smooth_res_nrg_fx[b], sub( q_com, q_smoothed_nrg_local[b] ) ); } IF( GT_16( q_com, hStereoDft->q_dft ) ) { scale_sig32( hStereoDft->smooth_dmx_nrg_fx, STEREO_DFT_BAND_MAX, sub( hStereoDft->q_dft, q_com ) ); scale_sig32( hStereoDft->smooth_res_nrg_fx, STEREO_DFT_BAND_MAX, sub( hStereoDft->q_dft, q_com ) ); hStereoDft->q_smoothed_nrg = hStereoDft->q_dft; move16(); } Loading Loading @@ -2905,7 +2937,7 @@ void stereo_dft_generate_res_pred_fx( IF( g_short > 0 ) { Word16 q_divide, q_shift; Word16 q_divide; Word32 op = BASOP_Util_Divide3232_Scale( L_add( EPSILON_FIX, dmx_nrg ), L_add( EPSILON_FIX, past_dmx_nrg ), &q_divide ); q_norm_fac = add( add( Q16, q_divide ), hStereoDft->q_hb_nrg_subr ); op = Sqrt32( op, &q_norm_fac ); Loading Loading
lib_com/ivas_masa_com.c +254 −11 Original line number Diff line number Diff line Loading @@ -66,6 +66,258 @@ static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *ph static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); static Word16 quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, Word32 *phi_hat, const Word16 n ); static Word32 estim_round[MASA_NO_CIRCLES + 1] = { /* Q0 */ -423, 0, 422, 845, 1267, 1689, 2111, 2532, 2953, 3373, 3793, 4212, 4630, 5047, 5464, 5880, 6294, 6708, 7120, 7532, 7941, 8350, 8757, 9163, 9567, 9969, 10370, 10769, 11166, 11561, 11955, 12346, 12735, 13122, 13507, 13890, 14270, 14648, 15023, 15396, 15766, 16134, 16499, 16861, 17220, 17576, 17930, 18280, 18627, 18971, 19312, 19650, 19984, 20315, 20643, 20967, 21288, 21605, 21918, 22228, 22534, 22836, 23135, 23429, 23720, 24007, 24289, 24568, 24842, 25112, 25378, 25640, 25898, 26151, 26400, 26644, 26884, 27119, 27350, 27576, 27798, 28015, 28227, 28435, 28637, 28835, 29029, 29217, 29400, 29579, 29752, 29921, 30084, 30243, 30396, 30544, 30688, 30826, 30959, 31086, 31209, 31326, 31438, 31545, 31647, 31743, 31834, 31919, 32000, 32075, 32144, 32208, 32267, 32320, 32368, 32411, 32448, 32480, 32506, 32527, 32542, 32552 }; static Word32 estim_ceil[MASA_NO_CIRCLES + 1] = { /* Q0 */ -422, 0, 423, 845, 1268, 1690, 2111, 2532, 2953, 3374, 3793, 4212, 4630, 5048, 5465, 5880, 6295, 6708, 7121, 7532, 7942, 8350, 8758, 9163, 9567, 9970, 10371, 10770, 11167, 11562, 11955, 12347, 12736, 13123, 13508, 13890, 14270, 14648, 15024, 15396, 15767, 16134, 16499, 16861, 17220, 17577, 17930, 18280, 18628, 18972, 19313, 19650, 19985, 20316, 20644, 20968, 21288, 21605, 21919, 22229, 22535, 22837, 23135, 23430, 23720, 24007, 24290, 24568, 24843, 25113, 25379, 25641, 25898, 26151, 26400, 26644, 26884, 27120, 27350, 27577, 27798, 28015, 28228, 28435, 28638, 28836, 29029, 29217, 29401, 29579, 29753, 29921, 30085, 30243, 30397, 30545, 30688, 30826, 30959, 31087, 31210, 31327, 31439, 31546, 31647, 31743, 31834, 31920, 32000, 32075, 32145, 32209, 32268, 32321, 32369, 32411, 32449, 32480, 32506, 32527, 32543, 32552 }; #endif Loading Loading @@ -1564,26 +1816,17 @@ void deindex_sph_idx_fx( } ELSE { estim_fx = Mpy_32_32( MASA_ANGLE_AT_EQUATOR_Q31, L_sub( L_shl( id_th, Q22 ), 2097152 ) /* 0.5f in Q22 */ ); /* Q22 */ base_low = n[0]; move32(); IF( GE_16( id_th, 2 ) ) { tmp32 = estim_fx % 26353590; /* 2 * PI in Q22 */ tmp32 = Mpy_32_32( tmp32, 341782638 /* 2147483647 / 2 * PI */ ); /* Q7 */ tmp16 = extract_l( L_shr( tmp32, Q7 ) ); tmp16 = getSineWord16R2( tmp16 ); tmp16 = sub( tmp16, MASA_ASIN_OFFSET_Q15 ); tmp32 = Mpy_32_16_1( MASA_NTOT2_FAC_Q15, tmp16 ); /* Q15 */ IF( EQ_16( id_th, 2 ) ) { base_low = L_add( base_low, L_shl( extract_l( L_shr( ceil_fixed( tmp32, Q15 ), Q15 ) ), 1 ) ); /* Q0 */ base_low = L_add( base_low, L_shl( estim_ceil[id_th], 1 ) ); /* Q0 */ } ELSE { base_low = L_add( base_low, L_shl( extract_l( L_shr_r( tmp32, Q15 ) ), 1 ) ); /* Q0 */ base_low = L_add( base_low, L_shl( estim_round[id_th], 1 ) ); /* Q0 */ } } base_up = L_add( base_low, L_shl( n[id_th], 1 ) ); Loading
lib_dec/ivas_core_dec.c +0 −12 Original line number Diff line number Diff line Loading @@ -758,9 +758,6 @@ ivas_error ivas_core_dec_fx( st->prev_Q_syn = st->Q_syn; move16(); Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( st->Q_syn, st->hHQ_core->Q_old_wtda_LB ) ); Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( st->Q_syn, st->hHQ_core->Q_old_wtda ) ); IF( st->hTcxDec ) { st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; Loading @@ -774,15 +771,6 @@ ivas_error ivas_core_dec_fx( } stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx, e_sig ); FOR( ch = 0; ch < 2; ch++ ) { st = hCPE->hCoreCoder[ch]; st->hHQ_core->Q_old_wtda_LB = st->Q_syn; move16(); st->hHQ_core->Q_old_wtda = st->Q_syn; move16(); } } } /* for inactive frames with mono output, copy and (if necessary) downmix buffers */ Loading
lib_dec/ivas_mct_dec.c +0 −9 Original line number Diff line number Diff line Loading @@ -571,10 +571,6 @@ ivas_error ivas_mct_dec_fx( } FOR( n = 0; n < CPE_CHANNELS; n++ ) { IF( hCPE->hCoreCoder[n]->Q_syn != 0 ) { Scale_sig( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[n]->Q_syn ); } if ( sts[n]->hTcxDec && sts[n]->hTcxDec->conCngLevelBackgroundTrace_e < 0 ) { sts[n]->hTcxDec->conCngLevelBackgroundTrace_e = 0; Loading Loading @@ -607,11 +603,6 @@ ivas_error ivas_mct_dec_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { IF( hCPE->hCoreCoder[n]->Q_syn != 0 ) { Scale_sig( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, negate( hCPE->hCoreCoder[n]->Q_syn ) ); Scale_sig( hCPE->hCoreCoder[n]->hHQ_core->old_out_LB_fx, L_FRAME32k, negate( hCPE->hCoreCoder[n]->Q_syn ) ); } IF( hCPE->hCoreCoder[n]->hBPF ) { hCPE->hCoreCoder[n]->hBPF->pst_mem_deemp_err_fx = extract_l( L_shr( hCPE->hCoreCoder[n]->mem_error, sub( Q16, sub( hCPE->hCoreCoder[n]->Q_syn2, 1 ) ) ) ); Loading
lib_dec/ivas_mdct_core_dec.c +7 −4 Original line number Diff line number Diff line Loading @@ -2057,8 +2057,8 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( q_win, sub( -1, st->Q_syn ) ) ); Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( q_win, st->Q_syn ) ); Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->Q_syn ) ); Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->Q_syn ) ); Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); #ifdef MSAN_FIX Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); Loading Loading @@ -2110,7 +2110,7 @@ void ivas_mdct_core_reconstruct_fx( st->Q_syn = q_syn; move16(); } sf = getScaleFactor16( st->hHQ_core->old_out_fx, L_FRAME48k ); sf = s_min( getScaleFactor16( st->hHQ_core->old_out_fx, L_FRAME48k ), getScaleFactor16( st->hHQ_core->old_out_LB_fx, L_FRAME32k ) ); IF( LT_16( sf, sub( st->Q_syn, q_win ) ) ) { st->Q_syn = add( q_win, sf ); Loading Loading @@ -2181,7 +2181,10 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->mem_syn2_fx, M, st->Q_syn ); Scale_sig( st->mem_syn_r, M, st->Q_syn ); } st->hHQ_core->Q_old_wtda = st->Q_syn; move16(); st->hHQ_core->Q_old_wtda_LB = st->Q_syn; move16(); /*--------------------------------------------------------------------------------* * Updates *--------------------------------------------------------------------------------*/ Loading
lib_dec/ivas_stereo_dft_dec_fx.c +53 −21 Original line number Diff line number Diff line Loading @@ -2519,6 +2519,8 @@ void stereo_dft_generate_res_pred_fx( Word16 d_long, d_short, d_long_ind, d_short_ind; Word16 g_short, g_long; Word32 dmx_nrg, rev_nrg; Word64 dmx_nrg_64bit, rev_nrg_64bit; Word16 q_shift, q_com, dmx_nrg_q, rev_nrg_q, q_smoothed_nrg_local[STEREO_DFT_BAND_MAX]; Word32 past_dmx_nrg; Word32 pred_gain_avg; Word32 g2; Loading Loading @@ -2580,35 +2582,50 @@ void stereo_dft_generate_res_pred_fx( { /* ESF in lowband */ /* main loop over core region*/ set16_fx( q_smoothed_nrg_local, hStereoDft->q_smoothed_nrg, STEREO_DFT_BAND_MAX ); FOR( b = hStereoDft->res_cod_band_max; b <= band0; b++ ) { dmx_nrg = EPSILON_FIX; move32(); rev_nrg = EPSILON_FIX; move32(); dmx_nrg_64bit = EPSILLON_FX; move64(); rev_nrg_64bit = EPSILLON_FX; move64(); /* calculate band energies (low band only in case of ACELP) */ FOR( i = hStereoDft->band_limits[b]; i < s_min( hStereoDft->band_limits[b + 1], bin0 ); i++ ) { /* Saturating below calculations (to be rechecked?) */ dmx_nrg = L_add_sat( dmx_nrg, Madd_32_32( Mpy_32_32( pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), pDFT_DMX[add( shl( i, 1 ), 1 )], pDFT_DMX[add( shl( i, 1 ), 1 )] ) ); rev_nrg = L_add_sat( rev_nrg, Madd_32_32( Mpy_32_32( ap_filt_DMX[2 * i], ap_filt_DMX[2 * i] ), ap_filt_DMX[add( shl( i, 1 ), 1 )], ap_filt_DMX[add( shl( i, 1 ), 1 )] ) ); dmx_nrg_64bit = W_add( dmx_nrg_64bit, W_add( W_mult0_32_32( pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), W_mult0_32_32( pDFT_DMX[add( shl( i, 1 ), 1 )], pDFT_DMX[add( shl( i, 1 ), 1 )] ) ) ); rev_nrg_64bit = W_add( rev_nrg_64bit, W_add( W_mult0_32_32( ap_filt_DMX[2 * i], ap_filt_DMX[2 * i] ), W_mult0_32_32( ap_filt_DMX[add( shl( i, 1 ), 1 )], ap_filt_DMX[add( shl( i, 1 ), 1 )] ) ) ); } IF( LT_16( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ) ) q_shift = W_norm( dmx_nrg_64bit ); dmx_nrg = W_extract_l( W_shl( dmx_nrg_64bit, sub( q_shift, 32 ) ) ); // 2 * hStereoDft->q_dft + (q_shift - 32) dmx_nrg_q = add( imult1616( 2, hStereoDft->q_dft ), sub( q_shift, 32 ) ); q_shift = W_norm( rev_nrg_64bit ); rev_nrg = W_extract_l( W_shl( rev_nrg_64bit, sub( q_shift, 32 ) ) ); // 2 * hStereoDft->q_dft + (q_shift - 32) rev_nrg_q = add( imult1616( 2, hStereoDft->q_dft ), sub( q_shift, 32 ) ); /* Reach a common Q for dmx_nrg and rev_nrg */ q_com = s_min( dmx_nrg_q, rev_nrg_q ); dmx_nrg = L_shl( dmx_nrg, sub( q_com, dmx_nrg_q ) ); rev_nrg = L_shl( rev_nrg, sub( q_com, rev_nrg_q ) ); IF( LT_16( hStereoDft->q_smoothed_nrg, q_com ) ) { rev_nrg = L_shr( rev_nrg, shl( sub( hStereoDft->q_dft, hStereoDft->q_smoothed_nrg ), 1 ) ); dmx_nrg = L_shr( dmx_nrg, shl( sub( hStereoDft->q_dft, hStereoDft->q_smoothed_nrg ), 1 ) ); rev_nrg = L_shr( rev_nrg, shl( sub( q_com, hStereoDft->q_smoothed_nrg ), 1 ) ); dmx_nrg = L_shr( dmx_nrg, shl( sub( q_com, hStereoDft->q_smoothed_nrg ), 1 ) ); q_com = hStereoDft->q_smoothed_nrg; move16(); } ELSE IF( GT_16( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ) ) ELSE IF( GT_16( hStereoDft->q_smoothed_nrg, q_com ) ) { hStereoDft->smooth_res_nrg_fx[b] = L_shr( hStereoDft->smooth_res_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ), 1 ) ); hStereoDft->smooth_dmx_nrg_fx[b] = L_shr( hStereoDft->smooth_dmx_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ), 1 ) ); hStereoDft->smooth_res_nrg_fx[b] = L_shr( hStereoDft->smooth_res_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, q_com ), 1 ) ); move32(); hStereoDft->smooth_dmx_nrg_fx[b] = L_shr( hStereoDft->smooth_dmx_nrg_fx[b], shl( sub( hStereoDft->q_smoothed_nrg, q_com ), 1 ) ); move32(); q_smoothed_nrg_local[b] = q_com; move16(); } /* smoothing */ hStereoDft->smooth_res_nrg_fx[b] = Madd_32_16( Mpy_32_16_1( hStereoDft->smooth_res_nrg_fx[b], alpha ), rev_nrg, sub( (Word16) ( 0x7FFF ), alpha ) ); Loading Loading @@ -2691,8 +2708,23 @@ void stereo_dft_generate_res_pred_fx( move32(); } } IF( GT_16( hStereoDft->q_smoothed_nrg, hStereoDft->q_dft ) ) /* Reach a common Q for all the bands */ q_com = Q31; move16(); FOR( b = 0; b < STEREO_DFT_BAND_MAX; b++ ) { q_com = s_min( q_com, q_smoothed_nrg_local[b] ); } FOR( b = 0; b < STEREO_DFT_BAND_MAX; b++ ) { hStereoDft->smooth_dmx_nrg_fx[b] = L_shl( hStereoDft->smooth_dmx_nrg_fx[b], sub( q_com, q_smoothed_nrg_local[b] ) ); hStereoDft->smooth_res_nrg_fx[b] = L_shl( hStereoDft->smooth_res_nrg_fx[b], sub( q_com, q_smoothed_nrg_local[b] ) ); } IF( GT_16( q_com, hStereoDft->q_dft ) ) { scale_sig32( hStereoDft->smooth_dmx_nrg_fx, STEREO_DFT_BAND_MAX, sub( hStereoDft->q_dft, q_com ) ); scale_sig32( hStereoDft->smooth_res_nrg_fx, STEREO_DFT_BAND_MAX, sub( hStereoDft->q_dft, q_com ) ); hStereoDft->q_smoothed_nrg = hStereoDft->q_dft; move16(); } Loading Loading @@ -2905,7 +2937,7 @@ void stereo_dft_generate_res_pred_fx( IF( g_short > 0 ) { Word16 q_divide, q_shift; Word16 q_divide; Word32 op = BASOP_Util_Divide3232_Scale( L_add( EPSILON_FIX, dmx_nrg ), L_add( EPSILON_FIX, past_dmx_nrg ), &q_divide ); q_norm_fac = add( add( Q16, q_divide ), hStereoDft->q_hb_nrg_subr ); op = Sqrt32( op, &q_norm_fac ); Loading