Loading lib_enc/acelp_core_enc.c +26 −25 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ ivas_error acelp_core_enc( /* bitstream */ BSTR_ENC_HANDLE hBstr = st->hBstr; #if 1 Word16 Q_exc = 0; //Word16 Q_exc = 0; move16(); Word16 A_fx[85], Aw_fx[85]; Word16 old_exc_fx[L_EXC], *exc_fx; /* excitation signal buffer */ Loading @@ -140,7 +140,7 @@ ivas_error acelp_core_enc( // Word16 tc_subfr_fx; /* TC sub-frame indication */ Word16 old_bwe_exc_fx[( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2]; /* excitation buffer */ Word16 Q_old_bwe_exc; //Word16 Q_old_bwe_exc; Word16 *bwe_exc_fx; /* excitation for SWB TBE */ // Word16 allow_cn_step_fx; // Word16 int_fs_fx; Loading Loading @@ -194,8 +194,6 @@ ivas_error acelp_core_enc( f2me_buf_16( &A[i * ( M + 1 )], &A_fx[i * ( M + 1 )], &tmp, ( M + 1 ) ); f2me_buf_16( &Aw[i * ( M + 1 )], &Aw_fx[i * ( M + 1 )], &tmp, ( M + 1 ) ); } IF( st->hBWE_TD ) floatToFixed_arr16( st->hBWE_TD->old_bwe_exc, st->hBWE_TD->old_bwe_exc_fx, Q_exc, PIT16k_MAX * 2 ); floatToFixed_arr16( st->lsp_old, st->lsp_old_fx, 15, M ); floatToFixed_arr16( st->lsp_old16k, st->lsp_old16k_fx, 15, M ); floatToFixed_arr16( lsp_mid, lsp_mid_fx, 15, M ); Loading @@ -213,7 +211,7 @@ ivas_error acelp_core_enc( q_comm_Bin = min( Q_factor_arrL( st->Bin_E_old, 128 ), Q_factor_arrL( st->Bin_E, 256 ) ); Q_new = Q_factor_arr( &inp[-M - 1], L_FRAME16k + M + 1 ); Q_new = min( Q_new, q_comm_Bin - ( QSCALE - 2 ) ); Q_new = min(Q_new, 1); Q_new = min(Q_new, 5); IF(st->hLPDmem) { Q_new = min(Q_new, Q_factor_arr(&st->hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1)); st->hLPDmem->e_old_exc = 15 - Q_new; Loading @@ -223,7 +221,7 @@ ivas_error acelp_core_enc( s_min(Q_factor_arr(st->hLPDmem->mem_syn2_flt, 16), s_min(Q_factor_arr(st->hLPDmem->mem_syn3_flt, 16), Q_factor_arr(st->hLPDmem->mem_syn_r_flt, 60))))); Q_new = min( Q_temp, Q_new ); st->hLPDmem->mem_syn_q = Q_new; //st->hLPDmem->mem_syn_q = Q_new; floatToFixed_arr(st->hLPDmem->mem_syn_flt, st->hLPDmem->mem_syn, Q_new, 16); floatToFixed_arr(st->hLPDmem->mem_syn1_flt, st->hLPDmem->mem_syn1_fx, Q_new, 16); floatToFixed_arr(st->hLPDmem->mem_syn2_flt, st->hLPDmem->mem_syn2, Q_new, 16); Loading @@ -231,6 +229,8 @@ ivas_error acelp_core_enc( floatToFixed_arr(st->hLPDmem->mem_syn_r_flt, st->hLPDmem->mem_syn_r, Q_new, 60); } //Q_new = Q_new - 3; //guard bits IF(st->hBWE_TD) floatToFixed_arr(st->hBWE_TD->old_bwe_exc, st->hBWE_TD->old_bwe_exc_fx, Q_new, PIT16k_MAX * 2); floatToFixed_arr( &inp[-M - 1], &inp_fx[-M - 1], Q_new, L_FRAME16k + M + 1 ); floatToFixed_arrL( st->Bin_E_old, st->Bin_E_old_fx, Q_new + Q_SCALE - 2, 128 ); floatToFixed_arrL( st->Bin_E, st->Bin_E_fx, Q_new + Q_SCALE - 2, 256 ); Loading Loading @@ -453,11 +453,11 @@ ivas_error acelp_core_enc( fixedToFloat_arr( st->lsp_old_fx, st->lsp_old, 15, M ); IF( st->hLPDmem ) { fixedToFloat_arr( st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn1_fx, st->hLPDmem->mem_syn1_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn2, st->hLPDmem->mem_syn2_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn3, st->hLPDmem->mem_syn3_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn_r, st->hLPDmem->mem_syn_r_flt, st->hLPDmem->mem_syn_q, 60 ); fixedToFloat_arr( st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn1_fx, st->hLPDmem->mem_syn1_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn2, st->hLPDmem->mem_syn2_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn3, st->hLPDmem->mem_syn3_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn_r, st->hLPDmem->mem_syn_r_flt, Q_new, 60 ); } me2f_buf_16( &st->hLPDmem->old_exc[-M - 1], st->hLPDmem->e_old_exc, &st->hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1 ); me2f_buf_16( old_exc_fx, st->hLPDmem->e_old_exc, old_exc_flt, L_EXC_MEM ); Loading Loading @@ -766,7 +766,7 @@ ivas_error acelp_core_enc( { st->hLPDmem->tilt_code = float_to_fix16( st->hLPDmem->tilt_code_flt, Q15 ); st->hLPDmem->gc_threshold = float_to_fix16( st->hLPDmem->gc_threshold_flt, Q16 ); floatToFixed_arr( &st->hLPDmem->mem_syn_flt[-1], &st->hLPDmem->mem_syn[-1], st->hLPDmem->mem_syn_q, M + 1 ); // -1 to sync the exponent of mem_syn with mem_w0 floatToFixed_arr( &st->hLPDmem->mem_syn_flt[-1], &st->hLPDmem->mem_syn[-1], Q_new, M + 1 ); // -1 to sync the exponent of mem_syn with mem_w0 } floatToFixed_arr( lsp_new, lsp_new_fx, Q15, M ); floatToFixed_arr( lsp_mid, lsp_mid_fx, Q15, M ); Loading @@ -784,14 +784,15 @@ ivas_error acelp_core_enc( st->lsfoldbfi1_fx[idx] = (Word16) ( st->lsfoldbfi1[idx] * 2.56f ); st->lsfoldbfi0_fx[idx] = (Word16) ( st->lsfoldbfi0[idx] * 2.56f ); } Q_old_bwe_exc = Q_factor_arr( old_bwe_exc, 1380 ); floatToFixed_arr( old_bwe_exc, old_bwe_exc_fx, Q_old_bwe_exc, 1380 ); Q_exc = Q_factor_arr( old_exc_flt, st->L_frame ); //Q_old_bwe_exc = Q_factor_arr( old_bwe_exc, 1380 ); floatToFixed_arr( old_bwe_exc, old_bwe_exc_fx, Q_new, 1380 ); /*Q_exc = Q_factor_arr( old_exc_flt, st->L_frame ); hLPDmem->e_old_exc = Q_factor_arr( &hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1 ) - 1; Q_exc = min(s_min( Q_exc, hLPDmem->e_old_exc ), Q_new); hLPDmem->e_old_exc = Q15 - Q_exc; floatToFixed_arr( &hLPDmem->old_exc_flt[-M - 1], &hLPDmem->old_exc[-M - 1], Q15 - hLPDmem->e_old_exc, L_EXC_MEM + M + 1 ); floatToFixed_arr16( old_exc_flt, old_exc_fx, Q_exc, st->L_frame ); hLPDmem->e_old_exc = Q15 - Q_exc;*/ hLPDmem->e_old_exc = Q15 - (Q_new); floatToFixed_arr( &hLPDmem->old_exc_flt[-M - 1], &hLPDmem->old_exc[-M - 1], Q_new , L_EXC_MEM + M + 1 ); floatToFixed_arr( old_exc_flt, old_exc_fx, Q_new, st->L_frame ); st->preemph_fac = float_to_fix16( st->preemph_fac_flt, Q15 ); floatToFixed_arr( st->voicing, st->voicing_fx, Q15, 3 ); Loading Loading @@ -915,7 +916,7 @@ ivas_error acelp_core_enc( tmpF_fx = hLPDmem->old_exc[0]; PREEMPH_FX( hLPDmem->old_exc, st->preemph_fac, st->L_frame, &tmpF_fx ); //hLPDmem->e_mem_syn = hLPDmem->e_old_exc; Copy_Scale_sig( hLPDmem->old_exc + sub( st->L_frame, M ), hLPDmem->mem_syn, M , sub(hLPDmem->mem_syn_q, sub(15, hLPDmem->e_old_exc))); Copy_Scale_sig( hLPDmem->old_exc + sub( st->L_frame, M ), hLPDmem->mem_syn, M , sub(Q_new, sub(15, hLPDmem->e_old_exc))); Residu3_fx( Aq_fx, hLPDmem->old_exc, old_exc_fx, st->L_frame, 0 ); } Loading @@ -931,7 +932,7 @@ ivas_error acelp_core_enc( { lerp( old_exc_fx, old_bwe_exc_fx, L_EXC_MEM_DEC * 2, L_EXC_MEM_DEC ); } Q_old_bwe_exc = Q_exc; //Q_old_bwe_exc = Q_exc; move16(); } Loading Loading @@ -1137,7 +1138,7 @@ ivas_error acelp_core_enc( fixedToFloat_arr(lsp_new_bck_fx, lsp_new_bck, Q15, M); fixedToFloat_arr(lsp_mid_bck_fx, lsp_mid_bck, Q15, M); fixedToFloat_arr(mem_syn_bck_fx, mem_syn_bck, st->hLPDmem->mem_syn_q, M); fixedToFloat_arr(mem_syn_bck_fx, mem_syn_bck, Q_new, M); fixedToFloat_arr(lsp_new_fx, lsp_new, 15, M); fixedToFloat_arr(lsp_mid_fx, lsp_mid, 15, M); for (i = 0; i < M; i++) Loading @@ -1164,16 +1165,16 @@ ivas_error acelp_core_enc( } fixedToFloat_arr(old_exc_fx, old_exc_flt, Q15 - hLPDmem->e_old_exc, st->L_frame); me2f_buf_16(&hLPDmem->old_exc[-M - 1], hLPDmem->e_old_exc, &hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1); fixedToFloat_arr(old_bwe_exc_fx, old_bwe_exc, Q_old_bwe_exc, 1380); fixedToFloat_arr(old_bwe_exc_fx, old_bwe_exc, Q_new + 1, 1380); fixedToFloat_arr(res_fx, res, Q_new + 1, st->L_frame); Es_pred = fix16_to_float(Es_pred_fx, Q8); fixedToFloat_arr(st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, st->hLPDmem->mem_syn_q, M); st->hLPDmem->mem_w0_flt = fixedToFloat(st->hLPDmem->mem_w0, st->hLPDmem->mem_syn_q); fixedToFloat_arr(st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, Q_new, M); st->hLPDmem->mem_w0_flt = fixedToFloat(st->hLPDmem->mem_w0, Q_new); fixedToFloat_arr(exc_fx, exc, Q_exc2, L_FRAME); fixedToFloat_arr(exc2_fx, exc2, Q_exc2, L_FRAME16k); if (st->hBWE_TD) fixedToFloat_arr(bwe_exc_fx, bwe_exc, Q_exc, L_FRAME32k); fixedToFloat_arr(bwe_exc_fx, bwe_exc, Q_new + 1, L_FRAME32k); st->hGSCEnc->Last_frame_ener = fixedToFloat_32(st->hGSCEnc->Last_frame_ener_fx, Q4); me2f_buf_16(st->hGSCEnc->last_exc_dct_in_fx, Q15 - st->hGSCEnc->Q_last_exc_dct_in, st->hGSCEnc->last_exc_dct_in, L_FRAME16k); fixedToFloat_arr(syn_fx, syn, Q_new /*Q_exc2*/, L_FRAME16k); Loading lib_enc/cod4t64_fast.c +11 −7 Original line number Diff line number Diff line Loading @@ -842,6 +842,7 @@ void acelp_fast_fx( Word16 track_order[NB_TRACK_FCB_4T * MAX_NUM_INTER], m0_track[NB_TRACK_FCB_4T]; Word16 ind_stream[NPMAXPT * NB_TRACK_FCB_4T], idx; Word16 G, G1, G2, G3, Gn, Gd; Word32 Gd32; Word16 y_tmp[L_SUBFR_MAX]; Word32 dn[L_SUBFR_MAX]; Word32 crit_num, crit_den, crit_num_max, crit_den_max, L_tmp1, L_tmp2; Loading Loading @@ -1333,7 +1334,8 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 3 ) ) { Gn = add( Gn, i_mult( s[1], shr( dn_orig[m[1]], 1 ) ) ); // Q_dn -1 Gd = add( Gd, add( alp[0], i_mult( i_mult( shl( s[0], 1 ), s[1] ), alp[m[0] - m[1]] ) ) ); // Q6 Gd32 = Gd; Gd32 = L_add(Gd32, L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[1] ), alp[m[0] - m[1]] ) ) ); // Q6 G = Gn; // Q_dn - 1 move16(); G1 = i_mult( G, s[1] ); // Q_dn-1 Loading @@ -1346,7 +1348,7 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { dn[i] = L_shr( L_msu( L_msu0( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), 6 ); // Q_dn dn[i] = L_shr( L_msu( L_msu0( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), 6 ); // Q_dn move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; Loading @@ -1363,7 +1365,8 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 4 ) ) { Gn = add( Gn, i_mult( s[2], shr( dn_orig[m[2]], 1 ) ) ); // Q_dn-1 Gd = add( Gd, add( add( alp[0], i_mult( i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ) ), i_mult( i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ) ) ); // Q6 Gd32 = Gd; Gd32 = L_add(Gd32, L_add( L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ) ), L_mult0( i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ) ) ); // Q6 G = Gn; // Q_dn-1 move16(); G1 = i_mult( G, s[1] ); // Q_dn-1 Loading @@ -1378,7 +1381,7 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { dn[i] = L_shr( L_msu( L_msu( L_msu( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), 6 ); // Q_dn dn[i] = L_shr( L_msu( L_msu( L_msu(imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), 6 ); // Q_dn move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; Loading @@ -1401,7 +1404,8 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 5 ) ) { Gn = add( Gn, i_mult( s[3], shr( dn_orig[m[3]], 1 ) ) ); // Q_dn-1 Gd = add( Gd, add( add( add( alp[0], i_mult( i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ) ), i_mult( i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ) ), i_mult( i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ) ) ); // Q6 Gd32 = Gd; Gd32 = L_add(Gd32, L_add(L_add(L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ) ), L_mult0( i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ) ), L_mult0( i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ) ) ); // Q6 G = Gn; // Q_dn-1 G1 = i_mult( G, s[1] ); // Q_dn-1 G2 = i_mult( G, s[2] ); // Q_dn-1 Loading @@ -1420,7 +1424,7 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); // Q_dn dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); // Q_dn move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; Loading @@ -1440,7 +1444,7 @@ void acelp_fast_fx( FOR( i = 0; i < L_subfr; i++ ) { dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); /*Q_dn*/ dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu(imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); /*Q_dn*/ move16(); alp_pos0++; alp_pos1++; Loading lib_enc/corr_xh_fx.c +63 −0 Original line number Diff line number Diff line Loading @@ -137,3 +137,66 @@ void corr_hh_ivas_fx( return; } void corr_xh_ivas_fx2( const Word16 x[], /* i : target signal */ const Word16 Qx, Word16 dn[], /* o : correlation between x[] and h[] */ Word16 *Qdn, const Word16 h[], /* i : impulse response (of weighted synthesis filter) */ const Word16 L_subfr /* i : length of the subframe */ ) { Word16 i, j, k; Word32 L_tmp, y32[L_SUBFR*2], L_maxloc, L_tot; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif /* first keep the result on 32 bits and find absolute maximum */ L_tot = L_deposit_l(1); FOR(k = 0; k < NB_TRACK; k++) { L_maxloc = L_deposit_l(0); FOR(i = k; i < L_subfr; i += STEP) { L_tmp = L_mac(1L, x[i], h[0]); /* 1 -> to avoid null dn[] */ FOR(j = i; j < L_subfr - 1; j++) { #ifdef BASOP_NOGLOB L_tmp = L_mac_o(L_tmp, x[j + 1], h[j + 1 - i], &Overflow); #else L_tmp = L_mac(L_tmp, x[j + 1], h[j + 1 - i]); #endif } y32[i] = L_tmp; move32(); L_tmp = L_abs(L_tmp); L_maxloc = L_max(L_tmp, L_maxloc); } /* tot += 3*max / 8 */ L_maxloc = L_shr(L_maxloc, 2); #ifdef BASOP_NOGLOB L_tot = L_add_o(L_tot, L_maxloc, &Overflow); /* +max/4 */ L_tot = L_add_o(L_tot, L_shr(L_maxloc, 1), &Overflow); /* +max/8 */ #else L_tot = L_add(L_tot, L_maxloc); /* +max/4 */ L_tot = L_add(L_tot, L_shr(L_maxloc, 1)); /* +max/8 */ #endif } /* Find the number of right shifts to do on y32[] so that */ /* 6.0 x sumation of max of dn[] in each track not saturate. */ j = sub(norm_l(L_tot), 4); /* 4 -> 16 x tot */ FOR(i = 0; i < L_subfr; i++) { dn[i] = round_fx(L_shl(y32[i], j)); } *Qdn = add(j, add(Qx,16-norm_s(h[0])) + 1) - 16; return; } No newline at end of file lib_enc/inov_enc_fx.c +10 −8 Original line number Diff line number Diff line Loading @@ -449,7 +449,7 @@ Word16 inov_encode_ivas_fx( Word16 shift, Word16 Q_new ) { Word16 dn[2 * L_SUBFR]; Word16 dn[2 * L_SUBFR], Qdn; Word16 nBits, cmpl_flag; Word16 stack_pulses; Word16 g1, g2; Loading Loading @@ -493,14 +493,16 @@ Word16 inov_encode_ivas_fx( cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_SUBFR ); /* h2: Q11, Rw: (Rw_e)Q */ ///* Rw_e = */ E_ACELP_hh_corr( h2, Rw, L_SUBFR, 3 ); corr_hh_ivas_fx( h2, Rw, L_subfr); // Q(Rw) = Q11-2 Word16 Rw_e = E_ACELP_hh_corr( h2, Rw, L_SUBFR, 3 ); //corr_hh_ivas_fx( h2, Rw, L_subfr); // Q(Rw) = Q11-2 E_ACELP_conv( xn2, h2, cn ); /* dn_e -> Rw_e*Q_xn */ /*dn_e = */ E_ACELP_toeplitz_mul_fx( Rw, cn, dn, L_SUBFR, 1 ); Scale_sig(Rw, L_subfr, -3); //Q9->Q6 //Scale_sig(Rw, L_SUBFR, sub(5, Rw_e)); //Q9 Word16 dn_e = E_ACELP_toeplitz_mul_fx( Rw, cn, dn, L_SUBFR, 1 ); Qdn = add(13, dn_e) - sub(5, Rw_e); //Scale_sig(Rw, L_subfr, -3); //Q9->Q6 } ELSE { Loading @@ -511,7 +513,7 @@ Word16 inov_encode_ivas_fx( Scale_sig( cn, L_subfr, shift ); cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); corr_xh_ivas_fx( xn2, dn, h2, L_subfr ); // Q(dn) = Q_new+1 corr_xh_ivas_fx2( xn2, Q_new - 1 + shift, dn, &Qdn, h2, L_subfr ); // Q(dn) = Q_new+1 } /*-----------------------------------------------------------------* Loading Loading @@ -676,7 +678,7 @@ Word16 inov_encode_ivas_fx( } ELSE { acelp_fast_fx( hBstr, nBits, dn, add( Q_new, 1 ), cn, h2, code, y2, L_subfr ); acelp_fast_fx( hBstr, nBits, dn, Qdn, cn, h2, code, y2, L_subfr ); } } ELSE IF( ( EQ_16( st_fx->idchan, 1 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 7 ) ) || ( st_fx->idchan == 0 && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 3 ) ) ) Loading @@ -687,7 +689,7 @@ Word16 inov_encode_ivas_fx( } ELSE { acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, add( Q_new, 1 ), cn, h2, code, y2, L_SUBFR ); acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn, h2, code, y2, L_SUBFR ); } } ELSE Loading lib_enc/prot_fx_enc.h +9 −0 Original line number Diff line number Diff line Loading @@ -2853,6 +2853,15 @@ void corr_xh_ivas_fx( const Word16 L_subfr /* i : length of the subframe */ ); void corr_xh_ivas_fx2( const Word16 x[], /* i : target signal */ const Word16 Qx, Word16 dn[], /* o : correlation between x[] and h[] */ Word16 *Qdn, const Word16 h[], /* i : impulse response (of weighted synthesis filter) */ const Word16 L_subfr /* i : length of the subframe */ ); void corr_hh_ivas_fx( const Word16 *h, /* i : target signal e(norm_s(h1[0])+1) */ Word16 *y, /* o : correlation between x[] and h[] Q_new + 1 */ Loading Loading
lib_enc/acelp_core_enc.c +26 −25 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ ivas_error acelp_core_enc( /* bitstream */ BSTR_ENC_HANDLE hBstr = st->hBstr; #if 1 Word16 Q_exc = 0; //Word16 Q_exc = 0; move16(); Word16 A_fx[85], Aw_fx[85]; Word16 old_exc_fx[L_EXC], *exc_fx; /* excitation signal buffer */ Loading @@ -140,7 +140,7 @@ ivas_error acelp_core_enc( // Word16 tc_subfr_fx; /* TC sub-frame indication */ Word16 old_bwe_exc_fx[( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2]; /* excitation buffer */ Word16 Q_old_bwe_exc; //Word16 Q_old_bwe_exc; Word16 *bwe_exc_fx; /* excitation for SWB TBE */ // Word16 allow_cn_step_fx; // Word16 int_fs_fx; Loading Loading @@ -194,8 +194,6 @@ ivas_error acelp_core_enc( f2me_buf_16( &A[i * ( M + 1 )], &A_fx[i * ( M + 1 )], &tmp, ( M + 1 ) ); f2me_buf_16( &Aw[i * ( M + 1 )], &Aw_fx[i * ( M + 1 )], &tmp, ( M + 1 ) ); } IF( st->hBWE_TD ) floatToFixed_arr16( st->hBWE_TD->old_bwe_exc, st->hBWE_TD->old_bwe_exc_fx, Q_exc, PIT16k_MAX * 2 ); floatToFixed_arr16( st->lsp_old, st->lsp_old_fx, 15, M ); floatToFixed_arr16( st->lsp_old16k, st->lsp_old16k_fx, 15, M ); floatToFixed_arr16( lsp_mid, lsp_mid_fx, 15, M ); Loading @@ -213,7 +211,7 @@ ivas_error acelp_core_enc( q_comm_Bin = min( Q_factor_arrL( st->Bin_E_old, 128 ), Q_factor_arrL( st->Bin_E, 256 ) ); Q_new = Q_factor_arr( &inp[-M - 1], L_FRAME16k + M + 1 ); Q_new = min( Q_new, q_comm_Bin - ( QSCALE - 2 ) ); Q_new = min(Q_new, 1); Q_new = min(Q_new, 5); IF(st->hLPDmem) { Q_new = min(Q_new, Q_factor_arr(&st->hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1)); st->hLPDmem->e_old_exc = 15 - Q_new; Loading @@ -223,7 +221,7 @@ ivas_error acelp_core_enc( s_min(Q_factor_arr(st->hLPDmem->mem_syn2_flt, 16), s_min(Q_factor_arr(st->hLPDmem->mem_syn3_flt, 16), Q_factor_arr(st->hLPDmem->mem_syn_r_flt, 60))))); Q_new = min( Q_temp, Q_new ); st->hLPDmem->mem_syn_q = Q_new; //st->hLPDmem->mem_syn_q = Q_new; floatToFixed_arr(st->hLPDmem->mem_syn_flt, st->hLPDmem->mem_syn, Q_new, 16); floatToFixed_arr(st->hLPDmem->mem_syn1_flt, st->hLPDmem->mem_syn1_fx, Q_new, 16); floatToFixed_arr(st->hLPDmem->mem_syn2_flt, st->hLPDmem->mem_syn2, Q_new, 16); Loading @@ -231,6 +229,8 @@ ivas_error acelp_core_enc( floatToFixed_arr(st->hLPDmem->mem_syn_r_flt, st->hLPDmem->mem_syn_r, Q_new, 60); } //Q_new = Q_new - 3; //guard bits IF(st->hBWE_TD) floatToFixed_arr(st->hBWE_TD->old_bwe_exc, st->hBWE_TD->old_bwe_exc_fx, Q_new, PIT16k_MAX * 2); floatToFixed_arr( &inp[-M - 1], &inp_fx[-M - 1], Q_new, L_FRAME16k + M + 1 ); floatToFixed_arrL( st->Bin_E_old, st->Bin_E_old_fx, Q_new + Q_SCALE - 2, 128 ); floatToFixed_arrL( st->Bin_E, st->Bin_E_fx, Q_new + Q_SCALE - 2, 256 ); Loading Loading @@ -453,11 +453,11 @@ ivas_error acelp_core_enc( fixedToFloat_arr( st->lsp_old_fx, st->lsp_old, 15, M ); IF( st->hLPDmem ) { fixedToFloat_arr( st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn1_fx, st->hLPDmem->mem_syn1_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn2, st->hLPDmem->mem_syn2_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn3, st->hLPDmem->mem_syn3_flt, st->hLPDmem->mem_syn_q, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn_r, st->hLPDmem->mem_syn_r_flt, st->hLPDmem->mem_syn_q, 60 ); fixedToFloat_arr( st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn1_fx, st->hLPDmem->mem_syn1_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn2, st->hLPDmem->mem_syn2_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn3, st->hLPDmem->mem_syn3_flt, Q_new, 16 ); fixedToFloat_arr( st->hLPDmem->mem_syn_r, st->hLPDmem->mem_syn_r_flt, Q_new, 60 ); } me2f_buf_16( &st->hLPDmem->old_exc[-M - 1], st->hLPDmem->e_old_exc, &st->hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1 ); me2f_buf_16( old_exc_fx, st->hLPDmem->e_old_exc, old_exc_flt, L_EXC_MEM ); Loading Loading @@ -766,7 +766,7 @@ ivas_error acelp_core_enc( { st->hLPDmem->tilt_code = float_to_fix16( st->hLPDmem->tilt_code_flt, Q15 ); st->hLPDmem->gc_threshold = float_to_fix16( st->hLPDmem->gc_threshold_flt, Q16 ); floatToFixed_arr( &st->hLPDmem->mem_syn_flt[-1], &st->hLPDmem->mem_syn[-1], st->hLPDmem->mem_syn_q, M + 1 ); // -1 to sync the exponent of mem_syn with mem_w0 floatToFixed_arr( &st->hLPDmem->mem_syn_flt[-1], &st->hLPDmem->mem_syn[-1], Q_new, M + 1 ); // -1 to sync the exponent of mem_syn with mem_w0 } floatToFixed_arr( lsp_new, lsp_new_fx, Q15, M ); floatToFixed_arr( lsp_mid, lsp_mid_fx, Q15, M ); Loading @@ -784,14 +784,15 @@ ivas_error acelp_core_enc( st->lsfoldbfi1_fx[idx] = (Word16) ( st->lsfoldbfi1[idx] * 2.56f ); st->lsfoldbfi0_fx[idx] = (Word16) ( st->lsfoldbfi0[idx] * 2.56f ); } Q_old_bwe_exc = Q_factor_arr( old_bwe_exc, 1380 ); floatToFixed_arr( old_bwe_exc, old_bwe_exc_fx, Q_old_bwe_exc, 1380 ); Q_exc = Q_factor_arr( old_exc_flt, st->L_frame ); //Q_old_bwe_exc = Q_factor_arr( old_bwe_exc, 1380 ); floatToFixed_arr( old_bwe_exc, old_bwe_exc_fx, Q_new, 1380 ); /*Q_exc = Q_factor_arr( old_exc_flt, st->L_frame ); hLPDmem->e_old_exc = Q_factor_arr( &hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1 ) - 1; Q_exc = min(s_min( Q_exc, hLPDmem->e_old_exc ), Q_new); hLPDmem->e_old_exc = Q15 - Q_exc; floatToFixed_arr( &hLPDmem->old_exc_flt[-M - 1], &hLPDmem->old_exc[-M - 1], Q15 - hLPDmem->e_old_exc, L_EXC_MEM + M + 1 ); floatToFixed_arr16( old_exc_flt, old_exc_fx, Q_exc, st->L_frame ); hLPDmem->e_old_exc = Q15 - Q_exc;*/ hLPDmem->e_old_exc = Q15 - (Q_new); floatToFixed_arr( &hLPDmem->old_exc_flt[-M - 1], &hLPDmem->old_exc[-M - 1], Q_new , L_EXC_MEM + M + 1 ); floatToFixed_arr( old_exc_flt, old_exc_fx, Q_new, st->L_frame ); st->preemph_fac = float_to_fix16( st->preemph_fac_flt, Q15 ); floatToFixed_arr( st->voicing, st->voicing_fx, Q15, 3 ); Loading Loading @@ -915,7 +916,7 @@ ivas_error acelp_core_enc( tmpF_fx = hLPDmem->old_exc[0]; PREEMPH_FX( hLPDmem->old_exc, st->preemph_fac, st->L_frame, &tmpF_fx ); //hLPDmem->e_mem_syn = hLPDmem->e_old_exc; Copy_Scale_sig( hLPDmem->old_exc + sub( st->L_frame, M ), hLPDmem->mem_syn, M , sub(hLPDmem->mem_syn_q, sub(15, hLPDmem->e_old_exc))); Copy_Scale_sig( hLPDmem->old_exc + sub( st->L_frame, M ), hLPDmem->mem_syn, M , sub(Q_new, sub(15, hLPDmem->e_old_exc))); Residu3_fx( Aq_fx, hLPDmem->old_exc, old_exc_fx, st->L_frame, 0 ); } Loading @@ -931,7 +932,7 @@ ivas_error acelp_core_enc( { lerp( old_exc_fx, old_bwe_exc_fx, L_EXC_MEM_DEC * 2, L_EXC_MEM_DEC ); } Q_old_bwe_exc = Q_exc; //Q_old_bwe_exc = Q_exc; move16(); } Loading Loading @@ -1137,7 +1138,7 @@ ivas_error acelp_core_enc( fixedToFloat_arr(lsp_new_bck_fx, lsp_new_bck, Q15, M); fixedToFloat_arr(lsp_mid_bck_fx, lsp_mid_bck, Q15, M); fixedToFloat_arr(mem_syn_bck_fx, mem_syn_bck, st->hLPDmem->mem_syn_q, M); fixedToFloat_arr(mem_syn_bck_fx, mem_syn_bck, Q_new, M); fixedToFloat_arr(lsp_new_fx, lsp_new, 15, M); fixedToFloat_arr(lsp_mid_fx, lsp_mid, 15, M); for (i = 0; i < M; i++) Loading @@ -1164,16 +1165,16 @@ ivas_error acelp_core_enc( } fixedToFloat_arr(old_exc_fx, old_exc_flt, Q15 - hLPDmem->e_old_exc, st->L_frame); me2f_buf_16(&hLPDmem->old_exc[-M - 1], hLPDmem->e_old_exc, &hLPDmem->old_exc_flt[-M - 1], L_EXC_MEM + M + 1); fixedToFloat_arr(old_bwe_exc_fx, old_bwe_exc, Q_old_bwe_exc, 1380); fixedToFloat_arr(old_bwe_exc_fx, old_bwe_exc, Q_new + 1, 1380); fixedToFloat_arr(res_fx, res, Q_new + 1, st->L_frame); Es_pred = fix16_to_float(Es_pred_fx, Q8); fixedToFloat_arr(st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, st->hLPDmem->mem_syn_q, M); st->hLPDmem->mem_w0_flt = fixedToFloat(st->hLPDmem->mem_w0, st->hLPDmem->mem_syn_q); fixedToFloat_arr(st->hLPDmem->mem_syn, st->hLPDmem->mem_syn_flt, Q_new, M); st->hLPDmem->mem_w0_flt = fixedToFloat(st->hLPDmem->mem_w0, Q_new); fixedToFloat_arr(exc_fx, exc, Q_exc2, L_FRAME); fixedToFloat_arr(exc2_fx, exc2, Q_exc2, L_FRAME16k); if (st->hBWE_TD) fixedToFloat_arr(bwe_exc_fx, bwe_exc, Q_exc, L_FRAME32k); fixedToFloat_arr(bwe_exc_fx, bwe_exc, Q_new + 1, L_FRAME32k); st->hGSCEnc->Last_frame_ener = fixedToFloat_32(st->hGSCEnc->Last_frame_ener_fx, Q4); me2f_buf_16(st->hGSCEnc->last_exc_dct_in_fx, Q15 - st->hGSCEnc->Q_last_exc_dct_in, st->hGSCEnc->last_exc_dct_in, L_FRAME16k); fixedToFloat_arr(syn_fx, syn, Q_new /*Q_exc2*/, L_FRAME16k); Loading
lib_enc/cod4t64_fast.c +11 −7 Original line number Diff line number Diff line Loading @@ -842,6 +842,7 @@ void acelp_fast_fx( Word16 track_order[NB_TRACK_FCB_4T * MAX_NUM_INTER], m0_track[NB_TRACK_FCB_4T]; Word16 ind_stream[NPMAXPT * NB_TRACK_FCB_4T], idx; Word16 G, G1, G2, G3, Gn, Gd; Word32 Gd32; Word16 y_tmp[L_SUBFR_MAX]; Word32 dn[L_SUBFR_MAX]; Word32 crit_num, crit_den, crit_num_max, crit_den_max, L_tmp1, L_tmp2; Loading Loading @@ -1333,7 +1334,8 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 3 ) ) { Gn = add( Gn, i_mult( s[1], shr( dn_orig[m[1]], 1 ) ) ); // Q_dn -1 Gd = add( Gd, add( alp[0], i_mult( i_mult( shl( s[0], 1 ), s[1] ), alp[m[0] - m[1]] ) ) ); // Q6 Gd32 = Gd; Gd32 = L_add(Gd32, L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[1] ), alp[m[0] - m[1]] ) ) ); // Q6 G = Gn; // Q_dn - 1 move16(); G1 = i_mult( G, s[1] ); // Q_dn-1 Loading @@ -1346,7 +1348,7 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { dn[i] = L_shr( L_msu( L_msu0( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), 6 ); // Q_dn dn[i] = L_shr( L_msu( L_msu0( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), 6 ); // Q_dn move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; Loading @@ -1363,7 +1365,8 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 4 ) ) { Gn = add( Gn, i_mult( s[2], shr( dn_orig[m[2]], 1 ) ) ); // Q_dn-1 Gd = add( Gd, add( add( alp[0], i_mult( i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ) ), i_mult( i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ) ) ); // Q6 Gd32 = Gd; Gd32 = L_add(Gd32, L_add( L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ) ), L_mult0( i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ) ) ); // Q6 G = Gn; // Q_dn-1 move16(); G1 = i_mult( G, s[1] ); // Q_dn-1 Loading @@ -1378,7 +1381,7 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { dn[i] = L_shr( L_msu( L_msu( L_msu( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), 6 ); // Q_dn dn[i] = L_shr( L_msu( L_msu( L_msu(imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), 6 ); // Q_dn move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; Loading @@ -1401,7 +1404,8 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 5 ) ) { Gn = add( Gn, i_mult( s[3], shr( dn_orig[m[3]], 1 ) ) ); // Q_dn-1 Gd = add( Gd, add( add( add( alp[0], i_mult( i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ) ), i_mult( i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ) ), i_mult( i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ) ) ); // Q6 Gd32 = Gd; Gd32 = L_add(Gd32, L_add(L_add(L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ) ), L_mult0( i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ) ), L_mult0( i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ) ) ); // Q6 G = Gn; // Q_dn-1 G1 = i_mult( G, s[1] ); // Q_dn-1 G2 = i_mult( G, s[2] ); // Q_dn-1 Loading @@ -1420,7 +1424,7 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); // Q_dn dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); // Q_dn move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; Loading @@ -1440,7 +1444,7 @@ void acelp_fast_fx( FOR( i = 0; i < L_subfr; i++ ) { dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); /*Q_dn*/ dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu(imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); /*Q_dn*/ move16(); alp_pos0++; alp_pos1++; Loading
lib_enc/corr_xh_fx.c +63 −0 Original line number Diff line number Diff line Loading @@ -137,3 +137,66 @@ void corr_hh_ivas_fx( return; } void corr_xh_ivas_fx2( const Word16 x[], /* i : target signal */ const Word16 Qx, Word16 dn[], /* o : correlation between x[] and h[] */ Word16 *Qdn, const Word16 h[], /* i : impulse response (of weighted synthesis filter) */ const Word16 L_subfr /* i : length of the subframe */ ) { Word16 i, j, k; Word32 L_tmp, y32[L_SUBFR*2], L_maxloc, L_tot; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif /* first keep the result on 32 bits and find absolute maximum */ L_tot = L_deposit_l(1); FOR(k = 0; k < NB_TRACK; k++) { L_maxloc = L_deposit_l(0); FOR(i = k; i < L_subfr; i += STEP) { L_tmp = L_mac(1L, x[i], h[0]); /* 1 -> to avoid null dn[] */ FOR(j = i; j < L_subfr - 1; j++) { #ifdef BASOP_NOGLOB L_tmp = L_mac_o(L_tmp, x[j + 1], h[j + 1 - i], &Overflow); #else L_tmp = L_mac(L_tmp, x[j + 1], h[j + 1 - i]); #endif } y32[i] = L_tmp; move32(); L_tmp = L_abs(L_tmp); L_maxloc = L_max(L_tmp, L_maxloc); } /* tot += 3*max / 8 */ L_maxloc = L_shr(L_maxloc, 2); #ifdef BASOP_NOGLOB L_tot = L_add_o(L_tot, L_maxloc, &Overflow); /* +max/4 */ L_tot = L_add_o(L_tot, L_shr(L_maxloc, 1), &Overflow); /* +max/8 */ #else L_tot = L_add(L_tot, L_maxloc); /* +max/4 */ L_tot = L_add(L_tot, L_shr(L_maxloc, 1)); /* +max/8 */ #endif } /* Find the number of right shifts to do on y32[] so that */ /* 6.0 x sumation of max of dn[] in each track not saturate. */ j = sub(norm_l(L_tot), 4); /* 4 -> 16 x tot */ FOR(i = 0; i < L_subfr; i++) { dn[i] = round_fx(L_shl(y32[i], j)); } *Qdn = add(j, add(Qx,16-norm_s(h[0])) + 1) - 16; return; } No newline at end of file
lib_enc/inov_enc_fx.c +10 −8 Original line number Diff line number Diff line Loading @@ -449,7 +449,7 @@ Word16 inov_encode_ivas_fx( Word16 shift, Word16 Q_new ) { Word16 dn[2 * L_SUBFR]; Word16 dn[2 * L_SUBFR], Qdn; Word16 nBits, cmpl_flag; Word16 stack_pulses; Word16 g1, g2; Loading Loading @@ -493,14 +493,16 @@ Word16 inov_encode_ivas_fx( cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_SUBFR ); /* h2: Q11, Rw: (Rw_e)Q */ ///* Rw_e = */ E_ACELP_hh_corr( h2, Rw, L_SUBFR, 3 ); corr_hh_ivas_fx( h2, Rw, L_subfr); // Q(Rw) = Q11-2 Word16 Rw_e = E_ACELP_hh_corr( h2, Rw, L_SUBFR, 3 ); //corr_hh_ivas_fx( h2, Rw, L_subfr); // Q(Rw) = Q11-2 E_ACELP_conv( xn2, h2, cn ); /* dn_e -> Rw_e*Q_xn */ /*dn_e = */ E_ACELP_toeplitz_mul_fx( Rw, cn, dn, L_SUBFR, 1 ); Scale_sig(Rw, L_subfr, -3); //Q9->Q6 //Scale_sig(Rw, L_SUBFR, sub(5, Rw_e)); //Q9 Word16 dn_e = E_ACELP_toeplitz_mul_fx( Rw, cn, dn, L_SUBFR, 1 ); Qdn = add(13, dn_e) - sub(5, Rw_e); //Scale_sig(Rw, L_subfr, -3); //Q9->Q6 } ELSE { Loading @@ -511,7 +513,7 @@ Word16 inov_encode_ivas_fx( Scale_sig( cn, L_subfr, shift ); cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); corr_xh_ivas_fx( xn2, dn, h2, L_subfr ); // Q(dn) = Q_new+1 corr_xh_ivas_fx2( xn2, Q_new - 1 + shift, dn, &Qdn, h2, L_subfr ); // Q(dn) = Q_new+1 } /*-----------------------------------------------------------------* Loading Loading @@ -676,7 +678,7 @@ Word16 inov_encode_ivas_fx( } ELSE { acelp_fast_fx( hBstr, nBits, dn, add( Q_new, 1 ), cn, h2, code, y2, L_subfr ); acelp_fast_fx( hBstr, nBits, dn, Qdn, cn, h2, code, y2, L_subfr ); } } ELSE IF( ( EQ_16( st_fx->idchan, 1 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 7 ) ) || ( st_fx->idchan == 0 && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 3 ) ) ) Loading @@ -687,7 +689,7 @@ Word16 inov_encode_ivas_fx( } ELSE { acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, add( Q_new, 1 ), cn, h2, code, y2, L_SUBFR ); acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn, h2, code, y2, L_SUBFR ); } } ELSE Loading
lib_enc/prot_fx_enc.h +9 −0 Original line number Diff line number Diff line Loading @@ -2853,6 +2853,15 @@ void corr_xh_ivas_fx( const Word16 L_subfr /* i : length of the subframe */ ); void corr_xh_ivas_fx2( const Word16 x[], /* i : target signal */ const Word16 Qx, Word16 dn[], /* o : correlation between x[] and h[] */ Word16 *Qdn, const Word16 h[], /* i : impulse response (of weighted synthesis filter) */ const Word16 L_subfr /* i : length of the subframe */ ); void corr_hh_ivas_fx( const Word16 *h, /* i : target signal e(norm_s(h1[0])+1) */ Word16 *y, /* o : correlation between x[] and h[] Q_new + 1 */ Loading