Loading lib_com/prot.h +16 −0 Original line number Diff line number Diff line Loading @@ -6968,6 +6968,21 @@ void enc_acelp_tcx_main( const int16_t vad_hover_flag /* i : VAD hangover flag */ ); #ifdef IVAS_FLOAT_FIXED void getTCXMode_ivas_fx( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void getTCXWindowing_ivas_fx( const Word16 core, /* i : current frame mode */ const Word16 last_core, /* i : last frame mode */ const Word16 element_mode, /* i : element mode */ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ); #else void getTCXMode_ivas( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ Loading @@ -6981,6 +6996,7 @@ void getTCXWindowing_ivas( TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ); #endif void getLPCparam_ivas( Decoder_State *st, /* i/o: decoder memory state */ Loading lib_dec/LD_music_post_filter_fx.c +34 −3 Original line number Diff line number Diff line Loading @@ -73,9 +73,15 @@ void LD_music_post_filter_fx( #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif move16(); move16(); move16(); move16(); move32(); local_min_gain = hMusicPF->LDm_enh_min_ns_gain_fx; move16(); /*------------------------------------------------------------------------* * Frequency analysis Loading Loading @@ -111,6 +117,7 @@ void LD_music_post_filter_fx( hMusicPF->last_nonfull_music = s_min( 51, hMusicPF->last_nonfull_music ); move16(); /*------------------------------------------------------------------------* * Remapping of bands Loading Loading @@ -197,7 +204,7 @@ void LD_music_post_filter_fx( hMusicPF->LDm_bckr_noise_fx[i] = Mult_32_16( m_ave, sc_qnoise_fx[i] ); move32(); j += mfreq_bindiv_LD[i]; j = add( j, mfreq_bindiv_LD[i] ); } /* This is computed inside the loop i = maximum(lf_E, DCT_L_POST, &m_ave);*/ Loading @@ -220,6 +227,7 @@ void LD_music_post_filter_fx( old_tmp16_1 = tmp16; move16(); tmp_lfE[0] = round_fx( L_mac( L_mult( 16384, old_tmp16 ), 16384, tmp16 ) ); move16(); FOR( i = 1; i < DCT_L_POST - 1; i++ ) { Loading @@ -234,6 +242,7 @@ void LD_music_post_filter_fx( old_tmp16_1 = s_min( tmp16, MAXX_Q12_FX ); Ltmp = L_mac( Ltmp, 10813, old_tmp16_1 ); tmp_lfE[i] = round_fx( Ltmp ); move16(); } tmp16 = norm_lfe( lf_E[i], s_ave, exp1 ); Loading @@ -241,17 +250,20 @@ void LD_music_post_filter_fx( tmp_lfE[i] = 0.5f*old_ftmp + 0.5f*ftmp;*/ tmp16 = s_min( tmp16, MAXX_Q12_FX ); tmp_lfE[i] = round_fx( L_mac( L_mult( 16384, old_tmp16 ), 16384, tmp16 ) ); move16(); FOR( i = 0; i < BIN_4KHZ; i++ ) { /*filt_lfE[i] = tmp_lfE[i]*.05f + .95f*filt_lfE[i] ;*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( L_mult( tmp_lfE[i], 1638 ), 31130, hMusicPF->filt_lfE_fx[i] ) ); move16(); } FOR( ; i < DCT_L_POST; i++ ) { /*filt_lfE[i] = tmp_lfE[i]*(.15f) + .85f*filt_lfE[i] ;*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( L_mult( tmp_lfE[i], 4915 ), 27853, hMusicPF->filt_lfE_fx[i] ) ); move16(); } /*------------------------------------------------------------------------* * - Reduce inter-harmonic noise with SNR based method Loading @@ -277,6 +289,7 @@ void LD_music_post_filter_fx( { tmp16 = s_min( 4096, hMusicPF->filt_lfE_fx[i] ); dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); move16(); } } { Loading Loading @@ -360,6 +373,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } FOR( ; i < BIN_4KHZ; i++ ) Loading @@ -372,6 +386,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } test(); Loading @@ -388,6 +403,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } } } Loading @@ -403,6 +419,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } } } Loading Loading @@ -450,6 +467,8 @@ static void spectrum_mod_dct_fx( Flag Overflow = 0; #endif move16(); move32(); gain = 0; move16(); Loading Loading @@ -479,6 +498,7 @@ static void spectrum_mod_dct_fx( e_invno[i] = norm_l( noiseE[i] ); move16(); m_invno[i] = extract_h( L_shl( noiseE[i], e_invno[i] ) ); move16(); e_invno[i] = sub( 14, e_invno[i] ); move16(); m_invno[i] = div_s( 16384, m_invno[i] ); Loading Loading @@ -650,6 +670,8 @@ static void spectrum_mod_dct_fx( #else *pt = round_fx( L_shl( L_mult( *pt, *pt_gbin ), 1 ) ); #endif move16(); move16(); pt++; pt_gbin++; } Loading @@ -667,6 +689,7 @@ static void spectrum_mod_dct_fx( { /**pt_gbin = 0.9f* *pt_gbin + 0.1f;*/ *pt_gbin = round_fx( L_mac( L_mult( 29491, *pt_gbin ), 32767, 1638 ) ); move16(); pt_gbin++; } } Loading @@ -691,6 +714,7 @@ static void analy_sp_dct_fx( ) { Word32 Letot = 0; move32(); Word16 exp_etot, frac_etot; Letot = L_deposit_l( 0 ); Loading @@ -708,6 +732,7 @@ static void analy_sp_dct_fx( Letot = Mpy_32_16( exp_etot, frac_etot, LG10 ); /* Q8 Averaged the total energy over both half-frames in log10 */ *etot = extract_l( L_shr( Letot, 14 - 8 ) ); move16(); return; } Loading Loading @@ -736,7 +761,7 @@ static void find_enr_dct_fx( Word32 LE_min, Ltmp, Ltmp1; LE_min = L_max( L_shl( E_MIN_Q15, sub( shl( Q_dct, 1 ) + 10, 22 ) ), 1 ); LE_min = L_max( L_shl( E_MIN_Q15, sub( add( shl( Q_dct, 1 ), 10 ), 22 ) ), 1 ); ptR = &data[0]; /* pointer to first real coefficient */ freq = 0; Loading Loading @@ -833,6 +858,11 @@ void Prep_music_postP_fx( /*------------------------------------------------------------* * Resetting some memories in case of switching *------------------------------------------------------------*/ test(); test(); test(); test(); test(); IF( ( EQ_16( element_mode, EVS_MONO ) && EQ_16( last_core, HQ_CORE ) ) || ( NE_16( element_mode, EVS_MONO ) && ( EQ_16( last_core, HQ_CORE ) || EQ_16( last_core, TCX_20_CORE ) || EQ_16( last_core, TCX_10_CORE ) ) ) ) { set16_fx( filt_lfE, 4096, DCT_L_POST ); Loading Loading @@ -918,6 +948,7 @@ static Word16 norm_lfe( Flag Overflow = 0; #endif move32(); Ltmp = Mult_32_16( Lfe, m_norm ); Ltmp = L_add( Ltmp, L_shl( BET_Q15_FX, sub( e_norm, 15 ) ) ); /* Ltmp -> e_norm*/ Loading Loading @@ -1023,6 +1054,7 @@ void music_postfilt_init( e_db = add( e_db, 15 - 14 ); f_db = add( f_db, shr( 1, add( e_db, 1 ) ) ); hMusicPF->LDm_enh_min_ns_gain_fx = shl( f_db, e_db ); move16(); hMusicPF->LDm_last_music_flag = 0; move16(); Loading Loading @@ -1058,7 +1090,6 @@ void music_postfilt_init( move16(); } set16_fx( hMusicPF->filt_lfE_fx, 4096, DCT_L_POST ); move16(); hMusicPF->last_nonfull_music = 0; move16(); hMusicPF->Old_ener_Q = 0; Loading lib_dec/d_gain2p_fx.c +13 −7 Original line number Diff line number Diff line Loading @@ -90,22 +90,24 @@ static void Mode2_gain_dec_mless_fx( * Select the gains quantization table *-----------------------------------------------------------------*/ t_qua_gain = E_ROM_qua_gain7b_const; move16(); if ( coder_type == 0 ) { t_qua_gain = E_ROM_qua_gain5b_const; move16(); } if ( EQ_16( coder_type, 1 ) ) { t_qua_gain = E_ROM_qua_gain6b_const; move16(); } /*-----------------------------------------------------------------* * decode pitch gain *-----------------------------------------------------------------*/ *gain_pit = t_qua_gain[index * 2]; move16(); /*-----------------------------------------------------------------* * calculate the predicted gain code *-----------------------------------------------------------------*/ Loading @@ -128,11 +130,13 @@ static void Mode2_gain_dec_mless_fx( * decode normalized codebook gain *-----------------------------------------------------------------*/ /* *gain_code = t_qua_gain[index*2+1] * gcode0;*/ L_tmp = calc_gain_code_fx( t_qua_gain[index * 2 + 1], gcode0, exp_gcode0 ); Word16 tmp_idx = add( shl( index, 1 ), 1 ); L_tmp = calc_gain_code_fx( t_qua_gain[tmp_idx], gcode0, exp_gcode0 ); *gain_code = L_tmp; move32(); *past_gpit = *gain_pit; move16(); /**past_gcode = *gain_code / *gain_inov; */ /* Q16/Q12 => Q5 */ L_tmp1 = L_deposit_h( BASOP_Util_Divide3216_Scale( L_tmp, *gain_inov, &exp_L_tmp1 ) ); Loading Loading @@ -187,14 +191,16 @@ static void gain_dec_uv_fx( L_tmp = L_and( 0x7FFFFFFF, L_tmp ); L_tmp = Pow2( 30, round_fx( L_tmp ) ); L_tmp = L_shl( L_tmp, i - ( 31 - 16 ) ); /* Q16 */ L_tmp = L_shl( L_tmp, sub( i, ( 31 - 16 ) ) ); /* Q16 */ /*-----------------------------------------------------------------* * past gains for error concealment *-----------------------------------------------------------------*/ *past_gpit = *gain_pit; move16(); *past_gcode = L_tmp; move32(); #ifdef BASOP_NOGLOB L_tmp = L_shl_sat( Mpy_32_16_1( L_tmp, *gain_inov ), 3 ); /* Q16*Q12 -> Q13 -> Q16 */ #else Loading Loading @@ -345,7 +351,7 @@ void decode_acelp_gains_fx( ) { Word16 index = 0; move16(); index = **pt_indice; ( *pt_indice )++; Loading Loading @@ -409,7 +415,7 @@ void d_gain_pred_fx( move16(); } IF( GT_16( nrg_mode, 2 ) ) if ( GT_16( nrg_mode, 2 ) ) { move16(); *Es_pred = extract_l( L_mac( -335544320l /* -20.f Q24*/, indice, 224 /* 1.75f Q7*/ ) ); /*(Q8 - ((Q0*Q7)=Q8))*/ Loading lib_dec/dec_LPD_fx.c +51 −22 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ void decoder_LPD_fx( hTcxDec = st->hTcxDec; st->core = 0; /* to avoid compilation warnings */ move16(); prm = NULL; /* to avoid compilation warnings */ /*--------------------------------------------------------------------------------* Loading Loading @@ -99,6 +100,7 @@ void decoder_LPD_fx( if ( bfi == 0 ) { st->bits_frame_core = sub( st->bits_frame, bitsRead[0] ); move16(); } /* Framing parameters */ Loading Loading @@ -131,7 +133,7 @@ void decoder_LPD_fx( /* PLC: [Common: Memory update] * PLC: Update the number of lost frames */ IF( bfi != 0 ) if ( bfi != 0 ) { move16(); st->nbLostCmpt = add( st->nbLostCmpt, 1 ); Loading @@ -152,6 +154,8 @@ void decoder_LPD_fx( tcx_current_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; move16(); dec_prm_fx( &st->coder_type, param, param_lpc, total_nbbits, st, L_frame, bitsRead ); test(); test(); IF( !st->rate_switching_init && EQ_16( ( st->last_codec_mode ), MODE2 ) && st->BER_detect ) { st->coder_type = st->last_coder_type; Loading Loading @@ -194,9 +198,10 @@ void decoder_LPD_fx( /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ IF( bfi != 0 ) if ( bfi != 0 ) { st->core = GetPLCModeDecision_fx( st ); move16(); } IF( bfi == 0 ) Loading @@ -222,7 +227,6 @@ void decoder_LPD_fx( test(); test(); test(); test(); IF( ( bfi == 0 ) || ( bfi != 0 && st->use_partial_copy != 0 && EQ_16( st->rf_frame_type, RF_TCXFD ) ) ) { test(); Loading Loading @@ -267,11 +271,19 @@ void decoder_LPD_fx( Copy( lsf_q_rf, &lsf[M], M ); Copy( lsp_q_rf, &lsp[M], M ); lsp_diff = 0; move16(); FOR( i = 0; i < M; i++ ) { lsp_diff = L_add( lsp_diff, (Word32) abs_s( sub( lsp[i + M], lsp[i] ) ) ); } test(); test(); test(); test(); test(); test(); test(); IF( EQ_16( st->core, ACELP_CORE ) && EQ_16( st->last_core, ACELP_CORE ) && LT_32( lsp_diff, 52428 ) && GT_32( lsp_diff, 3932 ) && EQ_16( st->next_coder_type, GENERIC ) && !st->prev_use_partial_copy && EQ_16( st->last_coder_type, UNVOICED ) && GE_16( st->rf_frame_type, RF_GENPRED ) ) { Copy( &lsp[0], &lsp[M], M ); Loading @@ -287,9 +299,11 @@ void decoder_LPD_fx( Copy( &lsf[( k + 1 ) * M], &xsfnew_uw[k * M], M ); } } ELSE IF( ( hTcxDec->enableTcxLpc != 0 && NE_16( st->core, ACELP_CORE ) ) || ( bfi && st->use_partial_copy && st->rf_frame_type == RF_TCXFD ) ) ELSE IF( ( hTcxDec->enableTcxLpc != 0 && NE_16( st->core, ACELP_CORE ) ) || ( bfi && st->use_partial_copy && EQ_16( st->rf_frame_type, RF_TCXFD ) ) ) { Word16 tcx_lpc_cdk; test(); test(); IF( bfi && st->use_partial_copy && EQ_16( st->rf_frame_type, RF_TCXFD ) ) { tcx_lpc_cdk = tcxlpc_get_cdk( GENERIC ); Loading Loading @@ -331,9 +345,13 @@ void decoder_LPD_fx( ELSE { lpc_unquantize_fx( st, lsf, lsp, M, param_lpc, lspmid, lsfmid, st->coder_type, &LSF_Q_prediction ); test(); test(); test(); test(); IF( EQ_16( st->prev_use_partial_copy, 1 ) && EQ_16( st->last_core, ACELP_CORE ) && EQ_16( st->core, ACELP_CORE ) && GE_16( st->prev_rf_frame_type, RF_GENPRED ) && EQ_16( st->coder_type, UNVOICED ) ) { test(); IF( st->lpcQuantization && st->acelp_cfg.midLpc ) { Copy( lspmid, &lsp[0], M ); Loading @@ -357,11 +375,11 @@ void decoder_LPD_fx( FOR( i = 0; i < M; i++ ) { move16(); st->lsf_adaptive_mean_fx[i] = add( add( mult_r( st->lsfoldbfi1_fx[i], 10923 /*1.0f/3.0f Q15*/ ), mult_r( st->lsfoldbfi0_fx[i], 10923 /*1.0f/3.0f Q15*/ ) ), mult_r( xsfnew_uw[k * M + i], 10923 /*1.0f/3.0f Q15*/ ) ); st->lsf_adaptive_mean_fx[i] = add( add( mult_r( st->lsfoldbfi1_fx[i], 10923 /*1.0f/3.0f Q15*/ ), mult_r( st->lsfoldbfi0_fx[i], 10923 /*1.0f/3.0f Q15*/ ) ), mult_r( xsfnew_uw[add( imult1616( k, M ), i )], 10923 /*1.0f/3.0f Q15*/ ) ); move16(); st->lsfoldbfi1_fx[i] = st->lsfoldbfi0_fx[i]; move16(); st->lsfoldbfi0_fx[i] = xsfnew_uw[k * M + i]; st->lsfoldbfi0_fx[i] = xsfnew_uw[add( imult1616( k, M ), i )]; } } } Loading Loading @@ -396,20 +414,20 @@ void decoder_LPD_fx( FOR( k = 0; k < st->numlpc; k++ ) { Copy( &xsfnew_uw[k * M], &lsf[( k + 1 ) * M], M ); Copy( &xsfnew_uw[k * M], &lsf[add( k, 1 ) * M], M ); IF( st->tcxonly ) { E_LPC_lsf_lsp_conversion( &lsf[( k + 1 ) * M], &lsp[( k + 1 ) * M], M ); E_LPC_lsf_lsp_conversion( &lsf[add( k, 1 ) * M], &lsp[add( k, 1 ) * M], M ); E_LPC_lsf_lsp_conversion( st->lsf_q_cng, st->lsp_q_cng, M ); } ELSE { lsf2lsp_fx( &lsf[( k + 1 ) * M], &lsp[( k + 1 ) * M], M, st->sr_core ); lsf2lsp_fx( &lsf[add( k, 1 ) * M], &lsp[add( k, 1 ) * M], M, st->sr_core ); lsf2lsp_fx( st->lsf_q_cng, st->lsp_q_cng, M, st->sr_core ); } Copy( &lsp[( k + 1 ) * M], &xspnew_uw[k * M], M ); Copy( &lsp[add( k, 1 ) * M], &xspnew_uw[imult1616( k, M )], M ); } } Loading Loading @@ -484,9 +502,11 @@ void decoder_LPD_fx( test(); test(); test(); test(); IF( ( bfi == 0 ) && ( ( EQ_16( st->dec_glr_idx, 1 ) ) || ( ( st->safety_net == 0 ) && ( shr( enr_new, 11 ) > 0 ) && ( GT_16( shr( enr_new, 1 ), enr_old ) ) ) ) && ( st->prev_bfi != 0 ) ) { Word16 reset_q = 0; move16(); if ( EQ_16( st->dec_glr_idx, 1 ) ) { reset_q = 1; Loading Loading @@ -545,7 +565,7 @@ void decoder_LPD_fx( } test(); IF( bfi != 0 && st->last_core != ACELP_CORE ) IF( bfi != 0 && NE_16( st->last_core, ACELP_CORE ) ) { /* PLC: [TCX: TD PLC] */ #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT Loading Loading @@ -589,14 +609,15 @@ void decoder_LPD_fx( IF( st->flagGuidedAcelp > 0 ) { st->guidedT0 = s_max( s_min( add( st->T0_4th, st->guidedT0 ), NBPSF_PIT_MAX ), PIT_MIN_16k ); move16(); } FOR( i = 0; i < st->nb_subfr; i++ ) { move16(); move16(); st->mem_pitch_gain[2 + ( 2 * st->nb_subfr - 1 ) - i] = st->mem_pitch_gain[2 + ( st->nb_subfr - 1 ) - i]; st->mem_pitch_gain[2 + ( st->nb_subfr - 1 ) - i] = pit_gain[i]; st->mem_pitch_gain[sub( add( 2, ( sub( shl( st->nb_subfr, 1 ), 1 ) ) ), i )] = st->mem_pitch_gain[sub( add( 2, sub( st->nb_subfr, 1 ) ), i )]; st->mem_pitch_gain[sub( add( 2, sub( st->nb_subfr, 1 ) ), i )] = pit_gain[i]; } } } Loading @@ -617,7 +638,9 @@ void decoder_LPD_fx( IF( bfi == 0 ) { st->second_last_tns_active = st->last_tns_active; move16(); st->last_tns_active = 0; move16(); hTcxDec->tcxltp_last_gain_unmodified = 0; move16(); } Loading Loading @@ -701,16 +724,16 @@ void decoder_LPD_fx( /* Stability Factor */ IF( bfi == 0 ) { st->stab_fac_fx = lsf_stab_fx( &lsf[( k + 1 ) * M], &lsf[k * M], 0, L_FRAME ); st->stab_fac_fx = lsf_stab_fx( &lsf[( add( k, 1 ) ) * M], &lsf[k * M], 0, L_FRAME ); } E_LPC_f_lsp_a_conversion( &lsp[( k + 1 ) * M], Aq, M ); E_LPC_f_lsp_a_conversion( &lsp[( add( k, 1 ) ) * M], Aq, M ); /* TCX decoder */ IGFDecRestoreTCX10SubFrameData( st->hIGFDec, k ); decoder_tcx_fx( st->hTcxCfg, prm, Aq, Aind, shr( L_frame, 1 ), shr( L_frameTCX, 1 ), shr( st->hTcxCfg->tcx_coded_lines, 1 ), &synth[k * L_frame / 2], &synthFB[k * L_frameTCX / 2], st, st->coder_type, bfi, k, st->stab_fac_fx ); shr( st->hTcxCfg->tcx_coded_lines, 1 ), &synth[shr( imult1616( k, L_frame ), 1 )], &synthFB[shr( imult1616( k, L_frameTCX ), 1 )], st, st->coder_type, bfi, k, st->stab_fac_fx ); } } Loading Loading @@ -762,7 +785,7 @@ void decoder_LPD_fx( IF( st->narrowBand || ( EQ_32( st->sr_core, INT_FS_12k8 ) ) || ( EQ_32( st->sr_core, INT_FS_16k ) ) ) { int_lsp_fx( L_frame, st->lspold_uw, xspnew_uw, Aq, M, interpol_frac_fx, 0 ); Copy( Aq, st->mem_Aq, nb_subfr * ( M + 1 ) ); Copy( Aq, st->mem_Aq, imult1616( nb_subfr, ( M + 1 ) ) ); } } } Loading Loading @@ -790,6 +813,7 @@ void decoder_LPD_fx( } LTP_Gain = -32768 /*-1.0f Q15*/; move16(); if ( hTcxLtpDec->tcxltp ) { LTP_Gain = hTcxDec->tcxltp_last_gain_unmodified; Loading Loading @@ -875,8 +899,8 @@ void decoder_LPD_fx( Copy( synth_bufFB + L_frameTCX, hTcxDec->old_synthFB_fx, hTcxDec->old_synth_lenFB ); Copy_Scale_sig( st->hHQ_core->old_out_fx + NS2SA_fx2( st->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + hTcxDec->old_synth_lenFB, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( st->hHQ_core->Q_old_wtda ) ); Copy( &xspnew_uw[( st->numlpc - 1 ) * M], st->lspold_uw, M ); Copy( &xsfnew_uw[( st->numlpc - 1 ) * M], st->lsfold_uw, M ); Copy( &xspnew_uw[imult1616( sub( st->numlpc, 1 ), M )], st->lspold_uw, M ); Copy( &xsfnew_uw[imult1616( sub( st->numlpc, 1 ), M )], st->lsfold_uw, M ); IF( bfi ) { Loading @@ -892,9 +916,12 @@ void decoder_LPD_fx( Copy( st->lsf_q_cng, st->old_lsf_q_cng, M ); /* Update LP_CNG parameters */ test(); IF( st->tcxonly == 0 && st->hTdCngDec != NULL ) { /* update CNG parameters in active frames */ test(); test(); IF( EQ_16( st->bwidth, NB ) && hTcxDec->enableTcxLpc != 0 && NE_16( st->core, ACELP_CORE ) ) { Word16 buf[L_LP], res[L_FRAME], A[M + 1], Qexc, r_l[M + 1], r_h[M + 1], lsptmp[M], Q_r, tmp; Loading @@ -902,6 +929,7 @@ void decoder_LPD_fx( assert( st->L_frame == L_FRAME ); Copy( synth + L_FRAME - L_LP, buf, L_LP ); tmp = synth[L_FRAME - L_LP - 1]; move16(); Qexc = E_UTIL_f_preemph3( buf, st->preemph_fac, L_LP, &tmp, 1 ); autocorr_fx( buf, M, r_h, r_l, &Q_r, L_LP, Assym_window_W16fx, 0, 0 ); lag_wind( r_h, r_l, M, INT_FS_FX, LAGW_WEAK ); Loading Loading @@ -945,7 +973,8 @@ void decoder_LPD_fx( { if ( !bfi ) { st->plcInfo.nbLostCmpt = (int16_t) L_deposit_l( 0 ); st->plcInfo.nbLostCmpt = extract_l( L_deposit_l( 0 ) ); move16(); } IF( st->core == 0 ) Loading lib_dec/dec_higher_acelp_fx.c +20 −8 Original line number Diff line number Diff line Loading @@ -41,10 +41,11 @@ void transf_cdbk_dec_fx( Word16 avq_bit_sFlag; Word16 trgtSvPos; Word16 Nsv = 8; move16(); avq_bit_sFlag = 0; move16(); IF( GT_16( st_fx->element_mode, EVS_MONO ) ) if ( GT_16( st_fx->element_mode, EVS_MONO ) ) { move16(); avq_bit_sFlag = 1; Loading Loading @@ -92,6 +93,7 @@ void transf_cdbk_dec_fx( } ELSE { test(); IF( GT_32( st_fx->core_brate, ACELP_24k40 ) && LE_32( st_fx->core_brate, 42000 ) ) { gain16 = gain_dequant_fx( index, G_AVQ_MIN_32kbps_Q15, G_AVQ_MAX_Q0, G_AVQ_BITS, &exp16 ); Loading Loading @@ -135,13 +137,15 @@ void transf_cdbk_dec_fx( #ifdef IVAS_CODE_AVQ AVQ_demuxdec_fx( st_fx, code_preQ, &nBits, 8, nq, avq_bit_sFlag, trgtSvPos ); Word16 q_Code_preQ; IF( st_fx->element_mode == EVS_MONO ) IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { q_Code_preQ = Q_AVQ_OUT_DEC; move16(); } ELSE { q_Code_preQ = Q_AVQ_OUT; move16(); } #else AVQ_demuxdec_fx( st_fx, code_preQ, &nBits, 8, nq ); Loading Loading @@ -192,20 +196,28 @@ void transf_cdbk_dec_fx( #ifdef IVAS_CODE_AVQ /* TD pre-quantizer: in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ test(); test(); test(); test(); test(); IF( GT_16( st_fx->element_mode, EVS_MONO ) && NE_16( st_fx->coder_type, INACTIVE ) && GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && !harm_flag_acelp && code_preQ[0] != 0 ) { // PMT("Fixed point taking accound of the scaling needs to be done here ") IF( GT_16( abs_s( st_fx->last_code_preq ), shl_sat( abs_s( code_preQ[0] ), 4 ) ) ) { st_fx->mem_preemp_preQ_fx = shr( st_fx->mem_preemp_preQ_fx, 4 ); move16(); } ELSE IF( GT_16( abs_s( ( st_fx->last_code_preq ) ), shl_sat( abs_s( code_preQ[0] ), 3 ) ) ) { st_fx->mem_preemp_preQ_fx = shr( st_fx->mem_preemp_preQ_fx, 3 ); move16(); } } st_fx->last_code_preq = (Word16) code_preQ[L_SUBFR - 1]; st_fx->last_code_preq = extract_h( code_preQ[L_SUBFR - 1] ); move16(); #endif preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &st_fx->mem_preemp_preQ_fx ); /*--------------------------------------------------------------* Loading @@ -227,15 +239,15 @@ void transf_cdbk_dec_fx( } ELSE { exp16 = sub( exp16, q_Code_preQ * 2 + 6 ); /* exp: (code_preQ in q_Code_preQ), -6 (/L_SUBFR) */ exp16 = sub( exp16, add( imult1616( q_Code_preQ, 2 ), 6 ) ); /* exp: (code_preQ in q_Code_preQ), -6 (/L_SUBFR) */ L_tmp = Isqrt_lc( L_tmp, &exp16 ); tmp16 = extract_h( L_tmp ); exp16 = 15 - 10 - exp16; /* tmp16 in Q10+exp16*/ exp16 = sub( sub( 15, 10 ), exp16 ); /* tmp16 in Q10+exp16*/ tmp16 = div_s( 16384, tmp16 ); /* Q15+Q14-(Q10+Qexp16) = Q19-exp16*/ L_tmp = L_mult( *gain_preQ, tmp16 ); /* Q2+Q19-exp16+1 -> Q22-exp16 */ L_tmp = Mult_32_16( L_tmp, 26214 ); /* Q22-Qexp16+Q15+1-16 -> Q22-exp16*/ *norm_gain_preQ = L_shr( L_tmp, 6 - exp16 ); *norm_gain_preQ = L_shr( L_tmp, sub( 6, exp16 ) ); move32(); /* Q22-exp16 -> Q16*/ } Loading Loading @@ -283,7 +295,7 @@ Word16 gain_dequant_fx( /* o: decoded gain */ Word16 e_tmp, f_tmp; Word16 tmp, frac; Word32 L_tmp; levels = 1 << bits; levels = shl( 1, bits ); /*c_min = (float)log10(min); c_mult = (float) ((levels-1)/(log10(max)-c_min)); Loading Loading
lib_com/prot.h +16 −0 Original line number Diff line number Diff line Loading @@ -6968,6 +6968,21 @@ void enc_acelp_tcx_main( const int16_t vad_hover_flag /* i : VAD hangover flag */ ); #ifdef IVAS_FLOAT_FIXED void getTCXMode_ivas_fx( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void getTCXWindowing_ivas_fx( const Word16 core, /* i : current frame mode */ const Word16 last_core, /* i : last frame mode */ const Word16 element_mode, /* i : element mode */ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ); #else void getTCXMode_ivas( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0, /* i : bitstream */ Loading @@ -6981,6 +6996,7 @@ void getTCXWindowing_ivas( TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ); #endif void getLPCparam_ivas( Decoder_State *st, /* i/o: decoder memory state */ Loading
lib_dec/LD_music_post_filter_fx.c +34 −3 Original line number Diff line number Diff line Loading @@ -73,9 +73,15 @@ void LD_music_post_filter_fx( #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif move16(); move16(); move16(); move16(); move32(); local_min_gain = hMusicPF->LDm_enh_min_ns_gain_fx; move16(); /*------------------------------------------------------------------------* * Frequency analysis Loading Loading @@ -111,6 +117,7 @@ void LD_music_post_filter_fx( hMusicPF->last_nonfull_music = s_min( 51, hMusicPF->last_nonfull_music ); move16(); /*------------------------------------------------------------------------* * Remapping of bands Loading Loading @@ -197,7 +204,7 @@ void LD_music_post_filter_fx( hMusicPF->LDm_bckr_noise_fx[i] = Mult_32_16( m_ave, sc_qnoise_fx[i] ); move32(); j += mfreq_bindiv_LD[i]; j = add( j, mfreq_bindiv_LD[i] ); } /* This is computed inside the loop i = maximum(lf_E, DCT_L_POST, &m_ave);*/ Loading @@ -220,6 +227,7 @@ void LD_music_post_filter_fx( old_tmp16_1 = tmp16; move16(); tmp_lfE[0] = round_fx( L_mac( L_mult( 16384, old_tmp16 ), 16384, tmp16 ) ); move16(); FOR( i = 1; i < DCT_L_POST - 1; i++ ) { Loading @@ -234,6 +242,7 @@ void LD_music_post_filter_fx( old_tmp16_1 = s_min( tmp16, MAXX_Q12_FX ); Ltmp = L_mac( Ltmp, 10813, old_tmp16_1 ); tmp_lfE[i] = round_fx( Ltmp ); move16(); } tmp16 = norm_lfe( lf_E[i], s_ave, exp1 ); Loading @@ -241,17 +250,20 @@ void LD_music_post_filter_fx( tmp_lfE[i] = 0.5f*old_ftmp + 0.5f*ftmp;*/ tmp16 = s_min( tmp16, MAXX_Q12_FX ); tmp_lfE[i] = round_fx( L_mac( L_mult( 16384, old_tmp16 ), 16384, tmp16 ) ); move16(); FOR( i = 0; i < BIN_4KHZ; i++ ) { /*filt_lfE[i] = tmp_lfE[i]*.05f + .95f*filt_lfE[i] ;*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( L_mult( tmp_lfE[i], 1638 ), 31130, hMusicPF->filt_lfE_fx[i] ) ); move16(); } FOR( ; i < DCT_L_POST; i++ ) { /*filt_lfE[i] = tmp_lfE[i]*(.15f) + .85f*filt_lfE[i] ;*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( L_mult( tmp_lfE[i], 4915 ), 27853, hMusicPF->filt_lfE_fx[i] ) ); move16(); } /*------------------------------------------------------------------------* * - Reduce inter-harmonic noise with SNR based method Loading @@ -277,6 +289,7 @@ void LD_music_post_filter_fx( { tmp16 = s_min( 4096, hMusicPF->filt_lfE_fx[i] ); dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); move16(); } } { Loading Loading @@ -360,6 +373,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } FOR( ; i < BIN_4KHZ; i++ ) Loading @@ -372,6 +386,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } test(); Loading @@ -388,6 +403,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } } } Loading @@ -403,6 +419,7 @@ void LD_music_post_filter_fx( #else dtc_out[i] = round_fx( L_shl( L_mult( dtc_out[i], tmp16 ), 3 ) ); #endif move16(); } } } Loading Loading @@ -450,6 +467,8 @@ static void spectrum_mod_dct_fx( Flag Overflow = 0; #endif move16(); move32(); gain = 0; move16(); Loading Loading @@ -479,6 +498,7 @@ static void spectrum_mod_dct_fx( e_invno[i] = norm_l( noiseE[i] ); move16(); m_invno[i] = extract_h( L_shl( noiseE[i], e_invno[i] ) ); move16(); e_invno[i] = sub( 14, e_invno[i] ); move16(); m_invno[i] = div_s( 16384, m_invno[i] ); Loading Loading @@ -650,6 +670,8 @@ static void spectrum_mod_dct_fx( #else *pt = round_fx( L_shl( L_mult( *pt, *pt_gbin ), 1 ) ); #endif move16(); move16(); pt++; pt_gbin++; } Loading @@ -667,6 +689,7 @@ static void spectrum_mod_dct_fx( { /**pt_gbin = 0.9f* *pt_gbin + 0.1f;*/ *pt_gbin = round_fx( L_mac( L_mult( 29491, *pt_gbin ), 32767, 1638 ) ); move16(); pt_gbin++; } } Loading @@ -691,6 +714,7 @@ static void analy_sp_dct_fx( ) { Word32 Letot = 0; move32(); Word16 exp_etot, frac_etot; Letot = L_deposit_l( 0 ); Loading @@ -708,6 +732,7 @@ static void analy_sp_dct_fx( Letot = Mpy_32_16( exp_etot, frac_etot, LG10 ); /* Q8 Averaged the total energy over both half-frames in log10 */ *etot = extract_l( L_shr( Letot, 14 - 8 ) ); move16(); return; } Loading Loading @@ -736,7 +761,7 @@ static void find_enr_dct_fx( Word32 LE_min, Ltmp, Ltmp1; LE_min = L_max( L_shl( E_MIN_Q15, sub( shl( Q_dct, 1 ) + 10, 22 ) ), 1 ); LE_min = L_max( L_shl( E_MIN_Q15, sub( add( shl( Q_dct, 1 ), 10 ), 22 ) ), 1 ); ptR = &data[0]; /* pointer to first real coefficient */ freq = 0; Loading Loading @@ -833,6 +858,11 @@ void Prep_music_postP_fx( /*------------------------------------------------------------* * Resetting some memories in case of switching *------------------------------------------------------------*/ test(); test(); test(); test(); test(); IF( ( EQ_16( element_mode, EVS_MONO ) && EQ_16( last_core, HQ_CORE ) ) || ( NE_16( element_mode, EVS_MONO ) && ( EQ_16( last_core, HQ_CORE ) || EQ_16( last_core, TCX_20_CORE ) || EQ_16( last_core, TCX_10_CORE ) ) ) ) { set16_fx( filt_lfE, 4096, DCT_L_POST ); Loading Loading @@ -918,6 +948,7 @@ static Word16 norm_lfe( Flag Overflow = 0; #endif move32(); Ltmp = Mult_32_16( Lfe, m_norm ); Ltmp = L_add( Ltmp, L_shl( BET_Q15_FX, sub( e_norm, 15 ) ) ); /* Ltmp -> e_norm*/ Loading Loading @@ -1023,6 +1054,7 @@ void music_postfilt_init( e_db = add( e_db, 15 - 14 ); f_db = add( f_db, shr( 1, add( e_db, 1 ) ) ); hMusicPF->LDm_enh_min_ns_gain_fx = shl( f_db, e_db ); move16(); hMusicPF->LDm_last_music_flag = 0; move16(); Loading Loading @@ -1058,7 +1090,6 @@ void music_postfilt_init( move16(); } set16_fx( hMusicPF->filt_lfE_fx, 4096, DCT_L_POST ); move16(); hMusicPF->last_nonfull_music = 0; move16(); hMusicPF->Old_ener_Q = 0; Loading
lib_dec/d_gain2p_fx.c +13 −7 Original line number Diff line number Diff line Loading @@ -90,22 +90,24 @@ static void Mode2_gain_dec_mless_fx( * Select the gains quantization table *-----------------------------------------------------------------*/ t_qua_gain = E_ROM_qua_gain7b_const; move16(); if ( coder_type == 0 ) { t_qua_gain = E_ROM_qua_gain5b_const; move16(); } if ( EQ_16( coder_type, 1 ) ) { t_qua_gain = E_ROM_qua_gain6b_const; move16(); } /*-----------------------------------------------------------------* * decode pitch gain *-----------------------------------------------------------------*/ *gain_pit = t_qua_gain[index * 2]; move16(); /*-----------------------------------------------------------------* * calculate the predicted gain code *-----------------------------------------------------------------*/ Loading @@ -128,11 +130,13 @@ static void Mode2_gain_dec_mless_fx( * decode normalized codebook gain *-----------------------------------------------------------------*/ /* *gain_code = t_qua_gain[index*2+1] * gcode0;*/ L_tmp = calc_gain_code_fx( t_qua_gain[index * 2 + 1], gcode0, exp_gcode0 ); Word16 tmp_idx = add( shl( index, 1 ), 1 ); L_tmp = calc_gain_code_fx( t_qua_gain[tmp_idx], gcode0, exp_gcode0 ); *gain_code = L_tmp; move32(); *past_gpit = *gain_pit; move16(); /**past_gcode = *gain_code / *gain_inov; */ /* Q16/Q12 => Q5 */ L_tmp1 = L_deposit_h( BASOP_Util_Divide3216_Scale( L_tmp, *gain_inov, &exp_L_tmp1 ) ); Loading Loading @@ -187,14 +191,16 @@ static void gain_dec_uv_fx( L_tmp = L_and( 0x7FFFFFFF, L_tmp ); L_tmp = Pow2( 30, round_fx( L_tmp ) ); L_tmp = L_shl( L_tmp, i - ( 31 - 16 ) ); /* Q16 */ L_tmp = L_shl( L_tmp, sub( i, ( 31 - 16 ) ) ); /* Q16 */ /*-----------------------------------------------------------------* * past gains for error concealment *-----------------------------------------------------------------*/ *past_gpit = *gain_pit; move16(); *past_gcode = L_tmp; move32(); #ifdef BASOP_NOGLOB L_tmp = L_shl_sat( Mpy_32_16_1( L_tmp, *gain_inov ), 3 ); /* Q16*Q12 -> Q13 -> Q16 */ #else Loading Loading @@ -345,7 +351,7 @@ void decode_acelp_gains_fx( ) { Word16 index = 0; move16(); index = **pt_indice; ( *pt_indice )++; Loading Loading @@ -409,7 +415,7 @@ void d_gain_pred_fx( move16(); } IF( GT_16( nrg_mode, 2 ) ) if ( GT_16( nrg_mode, 2 ) ) { move16(); *Es_pred = extract_l( L_mac( -335544320l /* -20.f Q24*/, indice, 224 /* 1.75f Q7*/ ) ); /*(Q8 - ((Q0*Q7)=Q8))*/ Loading
lib_dec/dec_LPD_fx.c +51 −22 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ void decoder_LPD_fx( hTcxDec = st->hTcxDec; st->core = 0; /* to avoid compilation warnings */ move16(); prm = NULL; /* to avoid compilation warnings */ /*--------------------------------------------------------------------------------* Loading Loading @@ -99,6 +100,7 @@ void decoder_LPD_fx( if ( bfi == 0 ) { st->bits_frame_core = sub( st->bits_frame, bitsRead[0] ); move16(); } /* Framing parameters */ Loading Loading @@ -131,7 +133,7 @@ void decoder_LPD_fx( /* PLC: [Common: Memory update] * PLC: Update the number of lost frames */ IF( bfi != 0 ) if ( bfi != 0 ) { move16(); st->nbLostCmpt = add( st->nbLostCmpt, 1 ); Loading @@ -152,6 +154,8 @@ void decoder_LPD_fx( tcx_current_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; move16(); dec_prm_fx( &st->coder_type, param, param_lpc, total_nbbits, st, L_frame, bitsRead ); test(); test(); IF( !st->rate_switching_init && EQ_16( ( st->last_codec_mode ), MODE2 ) && st->BER_detect ) { st->coder_type = st->last_coder_type; Loading Loading @@ -194,9 +198,10 @@ void decoder_LPD_fx( /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ IF( bfi != 0 ) if ( bfi != 0 ) { st->core = GetPLCModeDecision_fx( st ); move16(); } IF( bfi == 0 ) Loading @@ -222,7 +227,6 @@ void decoder_LPD_fx( test(); test(); test(); test(); IF( ( bfi == 0 ) || ( bfi != 0 && st->use_partial_copy != 0 && EQ_16( st->rf_frame_type, RF_TCXFD ) ) ) { test(); Loading Loading @@ -267,11 +271,19 @@ void decoder_LPD_fx( Copy( lsf_q_rf, &lsf[M], M ); Copy( lsp_q_rf, &lsp[M], M ); lsp_diff = 0; move16(); FOR( i = 0; i < M; i++ ) { lsp_diff = L_add( lsp_diff, (Word32) abs_s( sub( lsp[i + M], lsp[i] ) ) ); } test(); test(); test(); test(); test(); test(); test(); IF( EQ_16( st->core, ACELP_CORE ) && EQ_16( st->last_core, ACELP_CORE ) && LT_32( lsp_diff, 52428 ) && GT_32( lsp_diff, 3932 ) && EQ_16( st->next_coder_type, GENERIC ) && !st->prev_use_partial_copy && EQ_16( st->last_coder_type, UNVOICED ) && GE_16( st->rf_frame_type, RF_GENPRED ) ) { Copy( &lsp[0], &lsp[M], M ); Loading @@ -287,9 +299,11 @@ void decoder_LPD_fx( Copy( &lsf[( k + 1 ) * M], &xsfnew_uw[k * M], M ); } } ELSE IF( ( hTcxDec->enableTcxLpc != 0 && NE_16( st->core, ACELP_CORE ) ) || ( bfi && st->use_partial_copy && st->rf_frame_type == RF_TCXFD ) ) ELSE IF( ( hTcxDec->enableTcxLpc != 0 && NE_16( st->core, ACELP_CORE ) ) || ( bfi && st->use_partial_copy && EQ_16( st->rf_frame_type, RF_TCXFD ) ) ) { Word16 tcx_lpc_cdk; test(); test(); IF( bfi && st->use_partial_copy && EQ_16( st->rf_frame_type, RF_TCXFD ) ) { tcx_lpc_cdk = tcxlpc_get_cdk( GENERIC ); Loading Loading @@ -331,9 +345,13 @@ void decoder_LPD_fx( ELSE { lpc_unquantize_fx( st, lsf, lsp, M, param_lpc, lspmid, lsfmid, st->coder_type, &LSF_Q_prediction ); test(); test(); test(); test(); IF( EQ_16( st->prev_use_partial_copy, 1 ) && EQ_16( st->last_core, ACELP_CORE ) && EQ_16( st->core, ACELP_CORE ) && GE_16( st->prev_rf_frame_type, RF_GENPRED ) && EQ_16( st->coder_type, UNVOICED ) ) { test(); IF( st->lpcQuantization && st->acelp_cfg.midLpc ) { Copy( lspmid, &lsp[0], M ); Loading @@ -357,11 +375,11 @@ void decoder_LPD_fx( FOR( i = 0; i < M; i++ ) { move16(); st->lsf_adaptive_mean_fx[i] = add( add( mult_r( st->lsfoldbfi1_fx[i], 10923 /*1.0f/3.0f Q15*/ ), mult_r( st->lsfoldbfi0_fx[i], 10923 /*1.0f/3.0f Q15*/ ) ), mult_r( xsfnew_uw[k * M + i], 10923 /*1.0f/3.0f Q15*/ ) ); st->lsf_adaptive_mean_fx[i] = add( add( mult_r( st->lsfoldbfi1_fx[i], 10923 /*1.0f/3.0f Q15*/ ), mult_r( st->lsfoldbfi0_fx[i], 10923 /*1.0f/3.0f Q15*/ ) ), mult_r( xsfnew_uw[add( imult1616( k, M ), i )], 10923 /*1.0f/3.0f Q15*/ ) ); move16(); st->lsfoldbfi1_fx[i] = st->lsfoldbfi0_fx[i]; move16(); st->lsfoldbfi0_fx[i] = xsfnew_uw[k * M + i]; st->lsfoldbfi0_fx[i] = xsfnew_uw[add( imult1616( k, M ), i )]; } } } Loading Loading @@ -396,20 +414,20 @@ void decoder_LPD_fx( FOR( k = 0; k < st->numlpc; k++ ) { Copy( &xsfnew_uw[k * M], &lsf[( k + 1 ) * M], M ); Copy( &xsfnew_uw[k * M], &lsf[add( k, 1 ) * M], M ); IF( st->tcxonly ) { E_LPC_lsf_lsp_conversion( &lsf[( k + 1 ) * M], &lsp[( k + 1 ) * M], M ); E_LPC_lsf_lsp_conversion( &lsf[add( k, 1 ) * M], &lsp[add( k, 1 ) * M], M ); E_LPC_lsf_lsp_conversion( st->lsf_q_cng, st->lsp_q_cng, M ); } ELSE { lsf2lsp_fx( &lsf[( k + 1 ) * M], &lsp[( k + 1 ) * M], M, st->sr_core ); lsf2lsp_fx( &lsf[add( k, 1 ) * M], &lsp[add( k, 1 ) * M], M, st->sr_core ); lsf2lsp_fx( st->lsf_q_cng, st->lsp_q_cng, M, st->sr_core ); } Copy( &lsp[( k + 1 ) * M], &xspnew_uw[k * M], M ); Copy( &lsp[add( k, 1 ) * M], &xspnew_uw[imult1616( k, M )], M ); } } Loading Loading @@ -484,9 +502,11 @@ void decoder_LPD_fx( test(); test(); test(); test(); IF( ( bfi == 0 ) && ( ( EQ_16( st->dec_glr_idx, 1 ) ) || ( ( st->safety_net == 0 ) && ( shr( enr_new, 11 ) > 0 ) && ( GT_16( shr( enr_new, 1 ), enr_old ) ) ) ) && ( st->prev_bfi != 0 ) ) { Word16 reset_q = 0; move16(); if ( EQ_16( st->dec_glr_idx, 1 ) ) { reset_q = 1; Loading Loading @@ -545,7 +565,7 @@ void decoder_LPD_fx( } test(); IF( bfi != 0 && st->last_core != ACELP_CORE ) IF( bfi != 0 && NE_16( st->last_core, ACELP_CORE ) ) { /* PLC: [TCX: TD PLC] */ #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT Loading Loading @@ -589,14 +609,15 @@ void decoder_LPD_fx( IF( st->flagGuidedAcelp > 0 ) { st->guidedT0 = s_max( s_min( add( st->T0_4th, st->guidedT0 ), NBPSF_PIT_MAX ), PIT_MIN_16k ); move16(); } FOR( i = 0; i < st->nb_subfr; i++ ) { move16(); move16(); st->mem_pitch_gain[2 + ( 2 * st->nb_subfr - 1 ) - i] = st->mem_pitch_gain[2 + ( st->nb_subfr - 1 ) - i]; st->mem_pitch_gain[2 + ( st->nb_subfr - 1 ) - i] = pit_gain[i]; st->mem_pitch_gain[sub( add( 2, ( sub( shl( st->nb_subfr, 1 ), 1 ) ) ), i )] = st->mem_pitch_gain[sub( add( 2, sub( st->nb_subfr, 1 ) ), i )]; st->mem_pitch_gain[sub( add( 2, sub( st->nb_subfr, 1 ) ), i )] = pit_gain[i]; } } } Loading @@ -617,7 +638,9 @@ void decoder_LPD_fx( IF( bfi == 0 ) { st->second_last_tns_active = st->last_tns_active; move16(); st->last_tns_active = 0; move16(); hTcxDec->tcxltp_last_gain_unmodified = 0; move16(); } Loading Loading @@ -701,16 +724,16 @@ void decoder_LPD_fx( /* Stability Factor */ IF( bfi == 0 ) { st->stab_fac_fx = lsf_stab_fx( &lsf[( k + 1 ) * M], &lsf[k * M], 0, L_FRAME ); st->stab_fac_fx = lsf_stab_fx( &lsf[( add( k, 1 ) ) * M], &lsf[k * M], 0, L_FRAME ); } E_LPC_f_lsp_a_conversion( &lsp[( k + 1 ) * M], Aq, M ); E_LPC_f_lsp_a_conversion( &lsp[( add( k, 1 ) ) * M], Aq, M ); /* TCX decoder */ IGFDecRestoreTCX10SubFrameData( st->hIGFDec, k ); decoder_tcx_fx( st->hTcxCfg, prm, Aq, Aind, shr( L_frame, 1 ), shr( L_frameTCX, 1 ), shr( st->hTcxCfg->tcx_coded_lines, 1 ), &synth[k * L_frame / 2], &synthFB[k * L_frameTCX / 2], st, st->coder_type, bfi, k, st->stab_fac_fx ); shr( st->hTcxCfg->tcx_coded_lines, 1 ), &synth[shr( imult1616( k, L_frame ), 1 )], &synthFB[shr( imult1616( k, L_frameTCX ), 1 )], st, st->coder_type, bfi, k, st->stab_fac_fx ); } } Loading Loading @@ -762,7 +785,7 @@ void decoder_LPD_fx( IF( st->narrowBand || ( EQ_32( st->sr_core, INT_FS_12k8 ) ) || ( EQ_32( st->sr_core, INT_FS_16k ) ) ) { int_lsp_fx( L_frame, st->lspold_uw, xspnew_uw, Aq, M, interpol_frac_fx, 0 ); Copy( Aq, st->mem_Aq, nb_subfr * ( M + 1 ) ); Copy( Aq, st->mem_Aq, imult1616( nb_subfr, ( M + 1 ) ) ); } } } Loading Loading @@ -790,6 +813,7 @@ void decoder_LPD_fx( } LTP_Gain = -32768 /*-1.0f Q15*/; move16(); if ( hTcxLtpDec->tcxltp ) { LTP_Gain = hTcxDec->tcxltp_last_gain_unmodified; Loading Loading @@ -875,8 +899,8 @@ void decoder_LPD_fx( Copy( synth_bufFB + L_frameTCX, hTcxDec->old_synthFB_fx, hTcxDec->old_synth_lenFB ); Copy_Scale_sig( st->hHQ_core->old_out_fx + NS2SA_fx2( st->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + hTcxDec->old_synth_lenFB, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( st->hHQ_core->Q_old_wtda ) ); Copy( &xspnew_uw[( st->numlpc - 1 ) * M], st->lspold_uw, M ); Copy( &xsfnew_uw[( st->numlpc - 1 ) * M], st->lsfold_uw, M ); Copy( &xspnew_uw[imult1616( sub( st->numlpc, 1 ), M )], st->lspold_uw, M ); Copy( &xsfnew_uw[imult1616( sub( st->numlpc, 1 ), M )], st->lsfold_uw, M ); IF( bfi ) { Loading @@ -892,9 +916,12 @@ void decoder_LPD_fx( Copy( st->lsf_q_cng, st->old_lsf_q_cng, M ); /* Update LP_CNG parameters */ test(); IF( st->tcxonly == 0 && st->hTdCngDec != NULL ) { /* update CNG parameters in active frames */ test(); test(); IF( EQ_16( st->bwidth, NB ) && hTcxDec->enableTcxLpc != 0 && NE_16( st->core, ACELP_CORE ) ) { Word16 buf[L_LP], res[L_FRAME], A[M + 1], Qexc, r_l[M + 1], r_h[M + 1], lsptmp[M], Q_r, tmp; Loading @@ -902,6 +929,7 @@ void decoder_LPD_fx( assert( st->L_frame == L_FRAME ); Copy( synth + L_FRAME - L_LP, buf, L_LP ); tmp = synth[L_FRAME - L_LP - 1]; move16(); Qexc = E_UTIL_f_preemph3( buf, st->preemph_fac, L_LP, &tmp, 1 ); autocorr_fx( buf, M, r_h, r_l, &Q_r, L_LP, Assym_window_W16fx, 0, 0 ); lag_wind( r_h, r_l, M, INT_FS_FX, LAGW_WEAK ); Loading Loading @@ -945,7 +973,8 @@ void decoder_LPD_fx( { if ( !bfi ) { st->plcInfo.nbLostCmpt = (int16_t) L_deposit_l( 0 ); st->plcInfo.nbLostCmpt = extract_l( L_deposit_l( 0 ) ); move16(); } IF( st->core == 0 ) Loading
lib_dec/dec_higher_acelp_fx.c +20 −8 Original line number Diff line number Diff line Loading @@ -41,10 +41,11 @@ void transf_cdbk_dec_fx( Word16 avq_bit_sFlag; Word16 trgtSvPos; Word16 Nsv = 8; move16(); avq_bit_sFlag = 0; move16(); IF( GT_16( st_fx->element_mode, EVS_MONO ) ) if ( GT_16( st_fx->element_mode, EVS_MONO ) ) { move16(); avq_bit_sFlag = 1; Loading Loading @@ -92,6 +93,7 @@ void transf_cdbk_dec_fx( } ELSE { test(); IF( GT_32( st_fx->core_brate, ACELP_24k40 ) && LE_32( st_fx->core_brate, 42000 ) ) { gain16 = gain_dequant_fx( index, G_AVQ_MIN_32kbps_Q15, G_AVQ_MAX_Q0, G_AVQ_BITS, &exp16 ); Loading Loading @@ -135,13 +137,15 @@ void transf_cdbk_dec_fx( #ifdef IVAS_CODE_AVQ AVQ_demuxdec_fx( st_fx, code_preQ, &nBits, 8, nq, avq_bit_sFlag, trgtSvPos ); Word16 q_Code_preQ; IF( st_fx->element_mode == EVS_MONO ) IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { q_Code_preQ = Q_AVQ_OUT_DEC; move16(); } ELSE { q_Code_preQ = Q_AVQ_OUT; move16(); } #else AVQ_demuxdec_fx( st_fx, code_preQ, &nBits, 8, nq ); Loading Loading @@ -192,20 +196,28 @@ void transf_cdbk_dec_fx( #ifdef IVAS_CODE_AVQ /* TD pre-quantizer: in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ test(); test(); test(); test(); test(); IF( GT_16( st_fx->element_mode, EVS_MONO ) && NE_16( st_fx->coder_type, INACTIVE ) && GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && !harm_flag_acelp && code_preQ[0] != 0 ) { // PMT("Fixed point taking accound of the scaling needs to be done here ") IF( GT_16( abs_s( st_fx->last_code_preq ), shl_sat( abs_s( code_preQ[0] ), 4 ) ) ) { st_fx->mem_preemp_preQ_fx = shr( st_fx->mem_preemp_preQ_fx, 4 ); move16(); } ELSE IF( GT_16( abs_s( ( st_fx->last_code_preq ) ), shl_sat( abs_s( code_preQ[0] ), 3 ) ) ) { st_fx->mem_preemp_preQ_fx = shr( st_fx->mem_preemp_preQ_fx, 3 ); move16(); } } st_fx->last_code_preq = (Word16) code_preQ[L_SUBFR - 1]; st_fx->last_code_preq = extract_h( code_preQ[L_SUBFR - 1] ); move16(); #endif preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &st_fx->mem_preemp_preQ_fx ); /*--------------------------------------------------------------* Loading @@ -227,15 +239,15 @@ void transf_cdbk_dec_fx( } ELSE { exp16 = sub( exp16, q_Code_preQ * 2 + 6 ); /* exp: (code_preQ in q_Code_preQ), -6 (/L_SUBFR) */ exp16 = sub( exp16, add( imult1616( q_Code_preQ, 2 ), 6 ) ); /* exp: (code_preQ in q_Code_preQ), -6 (/L_SUBFR) */ L_tmp = Isqrt_lc( L_tmp, &exp16 ); tmp16 = extract_h( L_tmp ); exp16 = 15 - 10 - exp16; /* tmp16 in Q10+exp16*/ exp16 = sub( sub( 15, 10 ), exp16 ); /* tmp16 in Q10+exp16*/ tmp16 = div_s( 16384, tmp16 ); /* Q15+Q14-(Q10+Qexp16) = Q19-exp16*/ L_tmp = L_mult( *gain_preQ, tmp16 ); /* Q2+Q19-exp16+1 -> Q22-exp16 */ L_tmp = Mult_32_16( L_tmp, 26214 ); /* Q22-Qexp16+Q15+1-16 -> Q22-exp16*/ *norm_gain_preQ = L_shr( L_tmp, 6 - exp16 ); *norm_gain_preQ = L_shr( L_tmp, sub( 6, exp16 ) ); move32(); /* Q22-exp16 -> Q16*/ } Loading Loading @@ -283,7 +295,7 @@ Word16 gain_dequant_fx( /* o: decoded gain */ Word16 e_tmp, f_tmp; Word16 tmp, frac; Word32 L_tmp; levels = 1 << bits; levels = shl( 1, bits ); /*c_min = (float)log10(min); c_mult = (float) ((levels-1)/(log10(max)-c_min)); Loading