Loading lib_com/ivas_mdct_core_com.c +49 −0 Original line number Diff line number Diff line Loading @@ -36,12 +36,61 @@ #include "ivas_prot.h" #include "prot.h" #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif /*--------------------------------------------------------------------------* * ivas_mdct_tcx10_bit_distribution() * * *--------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_mdct_tcx10_bit_distribution_fx( Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ const Word16 nbits_tcx, /* i : TCX bits */ const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ ) { Word16 k; Word16 min_required_bits = add( add( NBITS_TCX_GAIN, i_mult2( NOISE_FILL_RANGES, NBITS_NOISE_FILL_LEVEL ) ), SMDCT_MINIMUM_ARITH_BITS ); FOR( k = 0; k < 2; k++ ) { IF( nbits_tcx & 1 ) { target_bitsTCX10[k] = sub( add( shr( nbits_tcx, 1 ), ( k == 0 ? 1 : 0 ) ), nTnsBitsTCX10[k] ); move16(); } ELSE { target_bitsTCX10[k] = sub( shr( nbits_tcx, 1 ), nTnsBitsTCX10[k] ); move16(); } } IF( LT_16( target_bitsTCX10[0], min_required_bits ) ) { /*redistribute bits*/ target_bitsTCX10[1] = sub( target_bitsTCX10[1], sub( min_required_bits, target_bitsTCX10[0] ) ); move16(); target_bitsTCX10[0] = min_required_bits; move16(); } ELSE IF( LT_16( target_bitsTCX10[1], min_required_bits ) ) { /*redistribute bits*/ target_bitsTCX10[0] = sub( target_bitsTCX10[0], sub( min_required_bits, target_bitsTCX10[1] ) ); move16(); target_bitsTCX10[1] = min_required_bits; move16(); } return; } #endif void ivas_mdct_tcx10_bit_distribution( int16_t target_bitsTCX10[NB_DIV], /* o : target bit distribution */ Loading lib_com/ivas_prot_fx.h +54 −0 Original line number Diff line number Diff line Loading @@ -1606,4 +1606,58 @@ void ivas_param_ism_config_fx( PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i/o: IVAS Param ISM Config Structure */ const Word16 nchan_obj /* i : number of ISM channels */ ); void ivas_mdct_core_invQ_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ Word16 nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ Word16 p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ Word16 param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ Word16 param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ Word32 *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ Word16 x_0_e[CPE_CHANNELS][NB_DIV], Word32 *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ Word16 x_e[CPE_CHANNELS][NB_DIV], Word16 x_len[CPE_CHANNELS][NB_DIV], Word16 Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ Word16 ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_tcx10_bit_distribution_fx( Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ const Word16 nbits_tcx, /* i : TCX bits */ const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ ); void TonalMDCTConceal_Detect_ivas_fx( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, Word16 * numIndices, const PsychoacousticParameters* psychParamsCurrent ); Word16 GetPLCModeDecision_ivas_fx( Decoder_State *st /* i/o: decoder memory state pointer */ ); void ivas_DetectTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16* pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ const PsychoacousticParameters* psychParamsCurrent ); #endif lib_dec/TonalComponentDetection_fx.c +76 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,10 @@ #include "rom_basop_util.h" #include "rom_com.h" #include "basop_util.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif /*---------------------------------------------------------------------* Loading @@ -37,6 +41,78 @@ static void findTonalComponents(Word16 * indexOfTonalPeak, Word16 * lowerIndex, * store them in indexOfTonalPeak. Updates lowerIndex, upperIndex, * pNumIndexes accordingly. *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_DetectTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16* pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ const PsychoacousticParameters* psychParamsCurrent ) { Word16 F0; Word16 thresholdModification[L_FRAME_MAX], lastMDCTSpect_exp; Word32 pScaledMdctSpectrum[L_FRAME_MAX]; Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; Word16 q_pScaledMdctSpectrum; FOR(Word16 i = 0; i < nSamples; i++) { pScaledMdctSpectrum[i] = L_shl(lastMDCTSpectrum[i], 16); // Q31 - lastMDCTSpectrum_exp } IF (psychParamsCurrent == NULL) { nBands = FDNS_NPTS; //PMT("add nBands argument to mdct_shaping_16") mdct_shaping_16(lastMDCTSpectrum, nSamplesCore, nSamples, scaleFactors, scaleFactors_exp, scaleFactors_max_e, pScaledMdctSpectrum); lastMDCTSpect_exp = add(lastMDCTSpectrum_exp, scaleFactors_max_e); } ELSE { FOR(Word16 i = 0; i < FDNS_NPTS; i++) { sns_int_scf_fx[i] = L_shl(scaleFactors[i], 1 + scaleFactors_exp[i]); // Q16 } q_pScaledMdctSpectrum = 31 - lastMDCTSpectrum_exp; sns_shape_spectrum_fx(pScaledMdctSpectrum, &q_pScaledMdctSpectrum, psychParamsCurrent, sns_int_scf_fx,16, nSamplesCore); q_pScaledMdctSpectrum = q_pScaledMdctSpectrum + 1; Word16 tmp_e = 31 - q_pScaledMdctSpectrum; nBands = psychParamsCurrent->nBands; // till nSamplesCore different Q and nSamples - nSamplesCore in different Q Scale_sig32(pScaledMdctSpectrum + nSamplesCore, nSamples - nSamplesCore, lastMDCTSpectrum_exp - tmp_e); lastMDCTSpect_exp = 31 - q_pScaledMdctSpectrum; } for (int i = nSamplesCore; i < nSamples; ++i) { Word64 tmp = W_mult_32_32(pScaledMdctSpectrum[i], sns_int_scf_fx[nBands - 1]); // q_pScaledMdctSpectrum + 16 + 1 pScaledMdctSpectrum[i] = W_extract_h(W_shl(tmp, Q15)); // q_pScaledMdctSpectrum } /* Find peak candidates in the last frame. */ findCandidates(nSamples, pScaledMdctSpectrum, lastMDCTSpect_exp, thresholdModification, floorPowerSpectrum); /* Refine peak candidates using the pitch information */ RefineThresholdsUsingPitch(nSamples, nSamplesCore, secondLastPowerSpectrum, lastPitchLag, currentPitchLag, &F0, thresholdModification); /* Find peaks in the second last frame */ findTonalComponents(indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, F0, thresholdModification); } #endif void DetectTonalComponents( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Loading lib_dec/er_util_fx.c +138 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ #include "prot_fx2.h" #include "basop_util.h" #include <assert.h> #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif /* static void setnoiseLevelMemory() Loading Loading @@ -364,6 +366,141 @@ void highPassFiltering( * PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed *----------------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED Word16 GetPLCModeDecision_ivas_fx( Decoder_State *st /* i/o: decoder memory state pointer */ ) { Word16 /*int*/ core; Word16 numIndices = 0; TCX_DEC_HANDLE hTcxDec; hTcxDec = st->hTcxDec; IF( EQ_16(st->flagGuidedAcelp,1)) { st->old_pitch_buf_fx[2*st->nb_subfr] = L_deposit_h(st->guidedT0); st->old_pitch_buf_fx[2*st->nb_subfr+1] = L_deposit_h(st->guidedT0); st->mem_pitch_gain[0] = st->mem_pitch_gain[1] = 16384/*1.f Q14*/;/*Q14*/ } st->plc_use_future_lag = 0; move16(); test(); test(); if(( st->last_core > ACELP_CORE && hTcxDec->tcxltp_last_gain_unmodified!=0 ) || ( EQ_16(st->flagGuidedAcelp,1) ) ) { /* no updates needed here, because already updated in last good frame */ st->plc_use_future_lag = 1; move16(); } IF (EQ_16(st->last_core,-1)) { core = TCX_20_CORE; move16(); st->last_core = ACELP_CORE; move16(); if(st->Opt_AMR_WB) { core = ACELP_CORE; move16(); } st->tonal_mdct_plc_active = 0; move16(); } ELSE { core = ACELP_CORE; move16(); if (GT_16(st->nbLostCmpt,1)) { core = st->last_core_bfi; move16(); } IF (EQ_16(st->nbLostCmpt,1)) { st->tonal_mdct_plc_active = 0; move16(); test(); test(); test(); IF ( !(st->rf_flag && st->use_partial_copy && (EQ_16(st->rf_frame_type, RF_TCXTD1)||EQ_16(st->rf_frame_type,RF_TCXTD2)))) { test(); test(); test(); test(); test(); test(); //PMT("handle to tonalMDCTconceal is missing") //#ifdef ADD_IVAS_HTONALMDCTCONC IF ((st->hTonalMDCTConc != NULL && EQ_16(st->last_core,TCX_20_CORE))&&(EQ_16(st->second_last_core,TCX_20_CORE)) && ((LE_32(st->old_fpitch,L_deposit_h(shr(st->L_frame,1)))) || (LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/))) /* it is fine to call the detection even if no ltp information is available, meaning that st->old_fpitch == st->tcxltp_second_last_pitch == st->L_frame */ && (EQ_32(st->old_fpitch, hTcxDec->tcxltp_second_last_pitch)) && !st->last_tns_active && !st->second_last_tns_active) { Word32 pitch; pitch = L_deposit_h(0); if(hTcxDec->tcxltp_last_gain_unmodified > 0) { pitch = L_add(st->old_fpitch, 0); } //TonalMDCTConceal_Detect_ivas_fx(&st->tonalMDCTconceal, pitch, &numIndices // , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent) //); TonalMDCTConceal_Detect_ivas_fx(st->hTonalMDCTConc, pitch, &numIndices , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent) ); test(); test(); test(); test(); test(); test(); IF ((GT_16(numIndices,10)) || ((GT_16(numIndices,5) ) && (LT_32(L_abs(L_sub(hTcxDec->tcxltp_third_last_pitch, hTcxDec->tcxltp_second_last_pitch)),32768l/*0.5f Q16*/) )) || ((numIndices > 0) && ((LE_16(st->last_good_fx,UNVOICED_TRANSITION))||(LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/))) && (LT_32(L_abs(L_sub(hTcxDec->tcxltp_third_last_pitch, hTcxDec->tcxltp_second_last_pitch)),32768l/*0.5f Q16*/) ))) { core = TCX_20_CORE; move16(); st->tonal_mdct_plc_active = 1; move16(); } ELSE IF (LE_16(st->last_good_fx,UNVOICED_TRANSITION)||LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/)) { core = TCX_20_CORE; move16(); } } ELSE IF (st->last_core != ACELP_CORE) { test(); if (LE_16(st->last_good_fx,UNVOICED_TRANSITION)||LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/)) { core = st->last_core; move16(); } } } } } return core; } #endif Word16 GetPLCModeDecision( Decoder_State *st /* i/o: decoder memory state pointer */ ) Loading lib_dec/ivas_mct_dec.c +132 −0 Original line number Diff line number Diff line Loading @@ -184,8 +184,140 @@ ivas_error ivas_mct_dec( set_zero( x[n][1], L_FRAME48k / 2 ); } #ifdef IVAS_FLOAT_FIXED #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED hCPE = st_ivas->hCPE[cpe_id]; sts = hCPE->hCoreCoder; Word16 Aq_fx[MCT_MAX_BLOCKS][CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; Word16 ch, k, l, i, j; Word32 *x_fx[CPE_CHANNELS][NB_DIV]; Word16 x_e[CPE_CHANNELS][NB_DIV]; Word16 x_len[CPE_CHANNELS][NB_DIV] = { 0 }; FOR( i = 0; i < CPE_CHANNELS; ++i ) { x_fx[i][0] = malloc( L_FRAME48k * sizeof( Word32 ) ); x_fx[i][1] = x_fx[i][0] + L_FRAME48k / 2; floatToFixed_arrL( x[i][0], x_fx[i][0], 0, L_FRAME48k / 2 ); floatToFixed_arrL( x[i][1], x_fx[i][1], 0, L_FRAME48k / 2 ); FOR( j = 0; j < NB_DIV; ++j ) { x_e[i][j] = 31; } } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sts[ch]->gamma = float_to_fix16( sts[ch]->gamma_float, Q15 ); sts[ch]->preemph_fac = float_to_fix16( sts[ch]->preemph_fac_float, Q15 ); sts[ch]->Mode2_lp_gainp = float_to_fix( sts[ch]->lp_gainp, Q16 ); sts[ch]->stab_fac_fx = float_to_fix16( sts[ch]->stab_fac, Q15 ); sts[ch]->hTcxCfg->na_scale = float_to_fix16( sts[ch]->hTcxCfg->na_scale_flt, Q15 ); sts[ch]->hTcxCfg->sq_rounding = float_to_fix16( sts[ch]->hTcxCfg->sq_rounding_flt, Q15 ); sts[ch]->hTcxLtpDec->tcxltp_gain = float_to_fix16( sts[ch]->hTcxLtpDec->tcxltp_gain_float, Q15 ); sts[ch]->inv_gamma = float_to_fix16( 1 / sts[ch]->gamma_float, Q14 ); sts[ch]->hTcxCfg->preemph_fac = float_to_fix16( sts[ch]->hTcxCfg->preemph_fac_flt, Q15 ); f2me_16( sts[ch]->last_gain_syn_deemph_float, &sts[ch]->last_gain_syn_deemph, &sts[ch]->last_gain_syn_deemph_e ); f2me_16( sts[ch]->last_concealed_gain_syn_deemph_float, &sts[ch]->last_concealed_gain_syn_deemph, &sts[ch]->last_concealed_gain_syn_deemph_e ); f2me_16( sts[ch]->hTcxDec->old_gaintcx_bfi_float, &sts[ch]->hTcxDec->old_gaintcx_bfi, &sts[ch]->hTcxDec->old_gaintcx_bfi_e ); floatToFixed_arr( Aq[cpe_id][ch], Aq_fx[cpe_id][ch], Q12, ( NB_SUBFR16k + 1 ) * ( M + 1 ) ); sts[ch]->hTcxDec->tcxltp_last_gain_unmodified = float_to_fix16( sts[ch]->hTcxDec->tcxltp_last_gain_unmodified_float, Q15 ); sts[ch]->old_fpitch = float_to_fix( sts[ch]->old_fpitch_float, Q16 ); sts[ch]->hTonalMDCTConc->lastPitchLag = float_to_fix( sts[ch]->hTonalMDCTConc->lastPitchLag_float, Q16 ); // u8bit to 16bit FOR( l = 0; l < IGF_START_MX; l++ ) { sts[ch]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[ch]->hIGFDec->infoTCXNoise[l]; } FOR( l = 0; l < N_LTP_GAIN_MEMS; l++ ) { sts[ch]->hTcxDec->ltpGainMemory_fx[l] = float_to_fix16( sts[ch]->hTcxDec->ltpGainMemory[l], Q15 ); } sts[ch]->hTcxDec->cummulative_damping_tcx = float_to_fix16( sts[ch]->hTcxDec->cummulative_damping_tcx_float, Q15 ); } } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->rate_switching_reset ) { floatToFixed_arr( sts[ch]->lsp_old, sts[ch]->lsp_old_fx, Q15, M ); } } #endif ivas_mdct_core_invQ_fx( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x_fx, x_e, x_fx, x_e, x_len, Aq_fx[cpe_id], NULL, 1 ); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { me2f_buf( x_fx[ch][0], x_e[ch][0], x[ch][0], sts[ch]->hTcxCfg->tcx_coded_lines ); sts[ch]->hTcxDec->damping_float = fix16_to_float( sts[ch]->hTcxDec->damping, Q14 ); sts[ch]->hTcxDec->gainHelper_float = me2f_16( sts[ch]->hTcxDec->gainHelper, sts[ch]->hTcxDec->gainHelper_e ); sts[ch]->hTcxDec->stepCompensate_float = me2f_16( sts[ch]->hTcxDec->stepCompensate, sts[ch]->hTcxDec->stepCompensate_e ); } IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sts[ch]->lp_gainp = fix_to_float( sts[ch]->Mode2_lp_gainp, Q16 ); sts[ch]->hTonalMDCTConc->lastPitchLag_float = fix_to_float( sts[ch]->hTonalMDCTConc->lastPitchLag, Q16 ); sts[ch]->hTonalMDCTConc->nFramesLost_float = fix16_to_float( sts[ch]->hTonalMDCTConc->nFramesLost, Q1 ); sts[ch]->hTcxDec->damping_float = fix16_to_float( sts[ch]->hTcxDec->damping, Q14 ); sts[ch]->hTcxDec->stepCompensate_float = me2f_16( sts[ch]->hTcxDec->stepCompensate, sts[ch]->hTcxDec->stepCompensate_e ); sts[ch]->hTcxDec->gainHelper_float = me2f_16( sts[ch]->hTcxDec->gainHelper, sts[ch]->hTcxDec->gainHelper_e ); sts[ch]->last_concealed_gain_syn_deemph_float = me2f_16( sts[ch]->last_concealed_gain_syn_deemph, sts[ch]->last_concealed_gain_syn_deemph_e ); sts[ch]->last_gain_syn_deemph_float = me2f_16( sts[ch]->last_gain_syn_deemph, sts[ch]->last_gain_syn_deemph_e ); sts[ch]->hTcxDec->old_gaintcx_bfi_float = me2f_16( sts[ch]->hTcxDec->old_gaintcx_bfi, sts[ch]->hTcxDec->old_gaintcx_bfi_e ); sts[ch]->stab_fac = fix16_to_float( sts[ch]->stab_fac_fx, Q15 ); fixedToFloat_arr( Aq_fx[cpe_id][ch], Aq[cpe_id][ch], Q12, ( NB_SUBFR16k + 1 ) * ( M + 1 ) ); // 16bit to u8bit FOR( Word16 l = 0; l < IGF_START_MX; l++ ) { sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; } FOR( Word16 l = 0; l < N_LTP_GAIN_MEMS; l++ ) { sts[ch]->hTcxDec->ltpGainMemory[l] = fix16_to_float( sts[ch]->hTcxDec->ltpGainMemory_fx[l], Q15 ); } Word16 subFrames = ( sts[ch]->core == TCX_10_CORE ) ? NB_DIV : 1; FOR( k = 0; k < subFrames; ++k ) { me2f_buf( x_fx[ch][k], x_e[ch][k], x[ch][k], x_len[ch][k] ); // To be made into Q11 // me2f_buf(x_fx[ch][k], x_e[ch][k], x[ch][k], L_FRAME48k / 2); } IF( !sts[0]->bfi || ( sts[0]->bfi && sts[ch]->core != ACELP_CORE ) ) { me2f_buf( sts[ch]->hIGFDec->virtualSpec, sts[ch]->hIGFDec->virtualSpec_e, sts[ch]->hIGFDec->virtualSpec_float, ( N_MAX_TCX - IGF_START_MN ) ); } sts[ch]->hTcxDec->cummulative_damping_tcx_float = fix16_to_float( sts[ch]->hTcxDec->cummulative_damping_tcx, Q15 ); } } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->rate_switching_reset ) { Word16 old_Aq_12_8_e = norm_s( sts[ch]->old_Aq_12_8_fx[0] ); fixedToFloat_arr( sts[ch]->old_Aq_12_8_fx, sts[ch]->old_Aq_12_8, ( 15 - old_Aq_12_8_e ), M + 1 ); } } FOR( i = 0; i < CPE_CHANNELS; ++i ) { free( x_fx[i][0] ); } #endif #else ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1 ); #endif st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; Loading Loading
lib_com/ivas_mdct_core_com.c +49 −0 Original line number Diff line number Diff line Loading @@ -36,12 +36,61 @@ #include "ivas_prot.h" #include "prot.h" #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif /*--------------------------------------------------------------------------* * ivas_mdct_tcx10_bit_distribution() * * *--------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_mdct_tcx10_bit_distribution_fx( Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ const Word16 nbits_tcx, /* i : TCX bits */ const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ ) { Word16 k; Word16 min_required_bits = add( add( NBITS_TCX_GAIN, i_mult2( NOISE_FILL_RANGES, NBITS_NOISE_FILL_LEVEL ) ), SMDCT_MINIMUM_ARITH_BITS ); FOR( k = 0; k < 2; k++ ) { IF( nbits_tcx & 1 ) { target_bitsTCX10[k] = sub( add( shr( nbits_tcx, 1 ), ( k == 0 ? 1 : 0 ) ), nTnsBitsTCX10[k] ); move16(); } ELSE { target_bitsTCX10[k] = sub( shr( nbits_tcx, 1 ), nTnsBitsTCX10[k] ); move16(); } } IF( LT_16( target_bitsTCX10[0], min_required_bits ) ) { /*redistribute bits*/ target_bitsTCX10[1] = sub( target_bitsTCX10[1], sub( min_required_bits, target_bitsTCX10[0] ) ); move16(); target_bitsTCX10[0] = min_required_bits; move16(); } ELSE IF( LT_16( target_bitsTCX10[1], min_required_bits ) ) { /*redistribute bits*/ target_bitsTCX10[0] = sub( target_bitsTCX10[0], sub( min_required_bits, target_bitsTCX10[1] ) ); move16(); target_bitsTCX10[1] = min_required_bits; move16(); } return; } #endif void ivas_mdct_tcx10_bit_distribution( int16_t target_bitsTCX10[NB_DIV], /* o : target bit distribution */ Loading
lib_com/ivas_prot_fx.h +54 −0 Original line number Diff line number Diff line Loading @@ -1606,4 +1606,58 @@ void ivas_param_ism_config_fx( PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i/o: IVAS Param ISM Config Structure */ const Word16 nchan_obj /* i : number of ISM channels */ ); void ivas_mdct_core_invQ_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ Word16 nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ Word16 p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ Word16 param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ Word16 param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ Word32 *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ Word16 x_0_e[CPE_CHANNELS][NB_DIV], Word32 *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ Word16 x_e[CPE_CHANNELS][NB_DIV], Word16 x_len[CPE_CHANNELS][NB_DIV], Word16 Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ Word16 ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_tcx10_bit_distribution_fx( Word16 target_bitsTCX10[NB_DIV], /* o : target bit distribution */ const Word16 nbits_tcx, /* i : TCX bits */ const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ ); void TonalMDCTConceal_Detect_ivas_fx( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, Word16 * numIndices, const PsychoacousticParameters* psychParamsCurrent ); Word16 GetPLCModeDecision_ivas_fx( Decoder_State *st /* i/o: decoder memory state pointer */ ); void ivas_DetectTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16* pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ const PsychoacousticParameters* psychParamsCurrent ); #endif
lib_dec/TonalComponentDetection_fx.c +76 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,10 @@ #include "rom_basop_util.h" #include "rom_com.h" #include "basop_util.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif /*---------------------------------------------------------------------* Loading @@ -37,6 +41,78 @@ static void findTonalComponents(Word16 * indexOfTonalPeak, Word16 * lowerIndex, * store them in indexOfTonalPeak. Updates lowerIndex, upperIndex, * pNumIndexes accordingly. *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_DetectTonalComponents_fx( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Word16 upperIndex[], Word16* pNumIndexes, const Word32 lastPitchLag, const Word32 currentPitchLag, const Word16 lastMDCTSpectrum[], const Word16 lastMDCTSpectrum_exp, const Word16 scaleFactors[], const Word16 scaleFactors_exp[], const Word16 scaleFactors_max_e, const Word32 secondLastPowerSpectrum[], const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ const PsychoacousticParameters* psychParamsCurrent ) { Word16 F0; Word16 thresholdModification[L_FRAME_MAX], lastMDCTSpect_exp; Word32 pScaledMdctSpectrum[L_FRAME_MAX]; Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; Word16 q_pScaledMdctSpectrum; FOR(Word16 i = 0; i < nSamples; i++) { pScaledMdctSpectrum[i] = L_shl(lastMDCTSpectrum[i], 16); // Q31 - lastMDCTSpectrum_exp } IF (psychParamsCurrent == NULL) { nBands = FDNS_NPTS; //PMT("add nBands argument to mdct_shaping_16") mdct_shaping_16(lastMDCTSpectrum, nSamplesCore, nSamples, scaleFactors, scaleFactors_exp, scaleFactors_max_e, pScaledMdctSpectrum); lastMDCTSpect_exp = add(lastMDCTSpectrum_exp, scaleFactors_max_e); } ELSE { FOR(Word16 i = 0; i < FDNS_NPTS; i++) { sns_int_scf_fx[i] = L_shl(scaleFactors[i], 1 + scaleFactors_exp[i]); // Q16 } q_pScaledMdctSpectrum = 31 - lastMDCTSpectrum_exp; sns_shape_spectrum_fx(pScaledMdctSpectrum, &q_pScaledMdctSpectrum, psychParamsCurrent, sns_int_scf_fx,16, nSamplesCore); q_pScaledMdctSpectrum = q_pScaledMdctSpectrum + 1; Word16 tmp_e = 31 - q_pScaledMdctSpectrum; nBands = psychParamsCurrent->nBands; // till nSamplesCore different Q and nSamples - nSamplesCore in different Q Scale_sig32(pScaledMdctSpectrum + nSamplesCore, nSamples - nSamplesCore, lastMDCTSpectrum_exp - tmp_e); lastMDCTSpect_exp = 31 - q_pScaledMdctSpectrum; } for (int i = nSamplesCore; i < nSamples; ++i) { Word64 tmp = W_mult_32_32(pScaledMdctSpectrum[i], sns_int_scf_fx[nBands - 1]); // q_pScaledMdctSpectrum + 16 + 1 pScaledMdctSpectrum[i] = W_extract_h(W_shl(tmp, Q15)); // q_pScaledMdctSpectrum } /* Find peak candidates in the last frame. */ findCandidates(nSamples, pScaledMdctSpectrum, lastMDCTSpect_exp, thresholdModification, floorPowerSpectrum); /* Refine peak candidates using the pitch information */ RefineThresholdsUsingPitch(nSamples, nSamplesCore, secondLastPowerSpectrum, lastPitchLag, currentPitchLag, &F0, thresholdModification); /* Find peaks in the second last frame */ findTonalComponents(indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, F0, thresholdModification); } #endif void DetectTonalComponents( Word16 indexOfTonalPeak[], Word16 lowerIndex[], Loading
lib_dec/er_util_fx.c +138 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ #include "prot_fx2.h" #include "basop_util.h" #include <assert.h> #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif /* static void setnoiseLevelMemory() Loading Loading @@ -364,6 +366,141 @@ void highPassFiltering( * PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed *----------------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED Word16 GetPLCModeDecision_ivas_fx( Decoder_State *st /* i/o: decoder memory state pointer */ ) { Word16 /*int*/ core; Word16 numIndices = 0; TCX_DEC_HANDLE hTcxDec; hTcxDec = st->hTcxDec; IF( EQ_16(st->flagGuidedAcelp,1)) { st->old_pitch_buf_fx[2*st->nb_subfr] = L_deposit_h(st->guidedT0); st->old_pitch_buf_fx[2*st->nb_subfr+1] = L_deposit_h(st->guidedT0); st->mem_pitch_gain[0] = st->mem_pitch_gain[1] = 16384/*1.f Q14*/;/*Q14*/ } st->plc_use_future_lag = 0; move16(); test(); test(); if(( st->last_core > ACELP_CORE && hTcxDec->tcxltp_last_gain_unmodified!=0 ) || ( EQ_16(st->flagGuidedAcelp,1) ) ) { /* no updates needed here, because already updated in last good frame */ st->plc_use_future_lag = 1; move16(); } IF (EQ_16(st->last_core,-1)) { core = TCX_20_CORE; move16(); st->last_core = ACELP_CORE; move16(); if(st->Opt_AMR_WB) { core = ACELP_CORE; move16(); } st->tonal_mdct_plc_active = 0; move16(); } ELSE { core = ACELP_CORE; move16(); if (GT_16(st->nbLostCmpt,1)) { core = st->last_core_bfi; move16(); } IF (EQ_16(st->nbLostCmpt,1)) { st->tonal_mdct_plc_active = 0; move16(); test(); test(); test(); IF ( !(st->rf_flag && st->use_partial_copy && (EQ_16(st->rf_frame_type, RF_TCXTD1)||EQ_16(st->rf_frame_type,RF_TCXTD2)))) { test(); test(); test(); test(); test(); test(); //PMT("handle to tonalMDCTconceal is missing") //#ifdef ADD_IVAS_HTONALMDCTCONC IF ((st->hTonalMDCTConc != NULL && EQ_16(st->last_core,TCX_20_CORE))&&(EQ_16(st->second_last_core,TCX_20_CORE)) && ((LE_32(st->old_fpitch,L_deposit_h(shr(st->L_frame,1)))) || (LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/))) /* it is fine to call the detection even if no ltp information is available, meaning that st->old_fpitch == st->tcxltp_second_last_pitch == st->L_frame */ && (EQ_32(st->old_fpitch, hTcxDec->tcxltp_second_last_pitch)) && !st->last_tns_active && !st->second_last_tns_active) { Word32 pitch; pitch = L_deposit_h(0); if(hTcxDec->tcxltp_last_gain_unmodified > 0) { pitch = L_add(st->old_fpitch, 0); } //TonalMDCTConceal_Detect_ivas_fx(&st->tonalMDCTconceal, pitch, &numIndices // , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent) //); TonalMDCTConceal_Detect_ivas_fx(st->hTonalMDCTConc, pitch, &numIndices , (st->element_mode == IVAS_CPE_MDCT ? &(st->hTcxCfg->psychParamsTCX20) : st->hTcxCfg->psychParamsCurrent) ); test(); test(); test(); test(); test(); test(); IF ((GT_16(numIndices,10)) || ((GT_16(numIndices,5) ) && (LT_32(L_abs(L_sub(hTcxDec->tcxltp_third_last_pitch, hTcxDec->tcxltp_second_last_pitch)),32768l/*0.5f Q16*/) )) || ((numIndices > 0) && ((LE_16(st->last_good_fx,UNVOICED_TRANSITION))||(LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/))) && (LT_32(L_abs(L_sub(hTcxDec->tcxltp_third_last_pitch, hTcxDec->tcxltp_second_last_pitch)),32768l/*0.5f Q16*/) ))) { core = TCX_20_CORE; move16(); st->tonal_mdct_plc_active = 1; move16(); } ELSE IF (LE_16(st->last_good_fx,UNVOICED_TRANSITION)||LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/)) { core = TCX_20_CORE; move16(); } } ELSE IF (st->last_core != ACELP_CORE) { test(); if (LE_16(st->last_good_fx,UNVOICED_TRANSITION)||LE_16(hTcxDec->tcxltp_last_gain_unmodified,13107/*0.4f Q15*/)) { core = st->last_core; move16(); } } } } } return core; } #endif Word16 GetPLCModeDecision( Decoder_State *st /* i/o: decoder memory state pointer */ ) Loading
lib_dec/ivas_mct_dec.c +132 −0 Original line number Diff line number Diff line Loading @@ -184,8 +184,140 @@ ivas_error ivas_mct_dec( set_zero( x[n][1], L_FRAME48k / 2 ); } #ifdef IVAS_FLOAT_FIXED #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED hCPE = st_ivas->hCPE[cpe_id]; sts = hCPE->hCoreCoder; Word16 Aq_fx[MCT_MAX_BLOCKS][CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; Word16 ch, k, l, i, j; Word32 *x_fx[CPE_CHANNELS][NB_DIV]; Word16 x_e[CPE_CHANNELS][NB_DIV]; Word16 x_len[CPE_CHANNELS][NB_DIV] = { 0 }; FOR( i = 0; i < CPE_CHANNELS; ++i ) { x_fx[i][0] = malloc( L_FRAME48k * sizeof( Word32 ) ); x_fx[i][1] = x_fx[i][0] + L_FRAME48k / 2; floatToFixed_arrL( x[i][0], x_fx[i][0], 0, L_FRAME48k / 2 ); floatToFixed_arrL( x[i][1], x_fx[i][1], 0, L_FRAME48k / 2 ); FOR( j = 0; j < NB_DIV; ++j ) { x_e[i][j] = 31; } } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sts[ch]->gamma = float_to_fix16( sts[ch]->gamma_float, Q15 ); sts[ch]->preemph_fac = float_to_fix16( sts[ch]->preemph_fac_float, Q15 ); sts[ch]->Mode2_lp_gainp = float_to_fix( sts[ch]->lp_gainp, Q16 ); sts[ch]->stab_fac_fx = float_to_fix16( sts[ch]->stab_fac, Q15 ); sts[ch]->hTcxCfg->na_scale = float_to_fix16( sts[ch]->hTcxCfg->na_scale_flt, Q15 ); sts[ch]->hTcxCfg->sq_rounding = float_to_fix16( sts[ch]->hTcxCfg->sq_rounding_flt, Q15 ); sts[ch]->hTcxLtpDec->tcxltp_gain = float_to_fix16( sts[ch]->hTcxLtpDec->tcxltp_gain_float, Q15 ); sts[ch]->inv_gamma = float_to_fix16( 1 / sts[ch]->gamma_float, Q14 ); sts[ch]->hTcxCfg->preemph_fac = float_to_fix16( sts[ch]->hTcxCfg->preemph_fac_flt, Q15 ); f2me_16( sts[ch]->last_gain_syn_deemph_float, &sts[ch]->last_gain_syn_deemph, &sts[ch]->last_gain_syn_deemph_e ); f2me_16( sts[ch]->last_concealed_gain_syn_deemph_float, &sts[ch]->last_concealed_gain_syn_deemph, &sts[ch]->last_concealed_gain_syn_deemph_e ); f2me_16( sts[ch]->hTcxDec->old_gaintcx_bfi_float, &sts[ch]->hTcxDec->old_gaintcx_bfi, &sts[ch]->hTcxDec->old_gaintcx_bfi_e ); floatToFixed_arr( Aq[cpe_id][ch], Aq_fx[cpe_id][ch], Q12, ( NB_SUBFR16k + 1 ) * ( M + 1 ) ); sts[ch]->hTcxDec->tcxltp_last_gain_unmodified = float_to_fix16( sts[ch]->hTcxDec->tcxltp_last_gain_unmodified_float, Q15 ); sts[ch]->old_fpitch = float_to_fix( sts[ch]->old_fpitch_float, Q16 ); sts[ch]->hTonalMDCTConc->lastPitchLag = float_to_fix( sts[ch]->hTonalMDCTConc->lastPitchLag_float, Q16 ); // u8bit to 16bit FOR( l = 0; l < IGF_START_MX; l++ ) { sts[ch]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[ch]->hIGFDec->infoTCXNoise[l]; } FOR( l = 0; l < N_LTP_GAIN_MEMS; l++ ) { sts[ch]->hTcxDec->ltpGainMemory_fx[l] = float_to_fix16( sts[ch]->hTcxDec->ltpGainMemory[l], Q15 ); } sts[ch]->hTcxDec->cummulative_damping_tcx = float_to_fix16( sts[ch]->hTcxDec->cummulative_damping_tcx_float, Q15 ); } } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->rate_switching_reset ) { floatToFixed_arr( sts[ch]->lsp_old, sts[ch]->lsp_old_fx, Q15, M ); } } #endif ivas_mdct_core_invQ_fx( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x_fx, x_e, x_fx, x_e, x_len, Aq_fx[cpe_id], NULL, 1 ); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { me2f_buf( x_fx[ch][0], x_e[ch][0], x[ch][0], sts[ch]->hTcxCfg->tcx_coded_lines ); sts[ch]->hTcxDec->damping_float = fix16_to_float( sts[ch]->hTcxDec->damping, Q14 ); sts[ch]->hTcxDec->gainHelper_float = me2f_16( sts[ch]->hTcxDec->gainHelper, sts[ch]->hTcxDec->gainHelper_e ); sts[ch]->hTcxDec->stepCompensate_float = me2f_16( sts[ch]->hTcxDec->stepCompensate, sts[ch]->hTcxDec->stepCompensate_e ); } IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sts[ch]->lp_gainp = fix_to_float( sts[ch]->Mode2_lp_gainp, Q16 ); sts[ch]->hTonalMDCTConc->lastPitchLag_float = fix_to_float( sts[ch]->hTonalMDCTConc->lastPitchLag, Q16 ); sts[ch]->hTonalMDCTConc->nFramesLost_float = fix16_to_float( sts[ch]->hTonalMDCTConc->nFramesLost, Q1 ); sts[ch]->hTcxDec->damping_float = fix16_to_float( sts[ch]->hTcxDec->damping, Q14 ); sts[ch]->hTcxDec->stepCompensate_float = me2f_16( sts[ch]->hTcxDec->stepCompensate, sts[ch]->hTcxDec->stepCompensate_e ); sts[ch]->hTcxDec->gainHelper_float = me2f_16( sts[ch]->hTcxDec->gainHelper, sts[ch]->hTcxDec->gainHelper_e ); sts[ch]->last_concealed_gain_syn_deemph_float = me2f_16( sts[ch]->last_concealed_gain_syn_deemph, sts[ch]->last_concealed_gain_syn_deemph_e ); sts[ch]->last_gain_syn_deemph_float = me2f_16( sts[ch]->last_gain_syn_deemph, sts[ch]->last_gain_syn_deemph_e ); sts[ch]->hTcxDec->old_gaintcx_bfi_float = me2f_16( sts[ch]->hTcxDec->old_gaintcx_bfi, sts[ch]->hTcxDec->old_gaintcx_bfi_e ); sts[ch]->stab_fac = fix16_to_float( sts[ch]->stab_fac_fx, Q15 ); fixedToFloat_arr( Aq_fx[cpe_id][ch], Aq[cpe_id][ch], Q12, ( NB_SUBFR16k + 1 ) * ( M + 1 ) ); // 16bit to u8bit FOR( Word16 l = 0; l < IGF_START_MX; l++ ) { sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; } FOR( Word16 l = 0; l < N_LTP_GAIN_MEMS; l++ ) { sts[ch]->hTcxDec->ltpGainMemory[l] = fix16_to_float( sts[ch]->hTcxDec->ltpGainMemory_fx[l], Q15 ); } Word16 subFrames = ( sts[ch]->core == TCX_10_CORE ) ? NB_DIV : 1; FOR( k = 0; k < subFrames; ++k ) { me2f_buf( x_fx[ch][k], x_e[ch][k], x[ch][k], x_len[ch][k] ); // To be made into Q11 // me2f_buf(x_fx[ch][k], x_e[ch][k], x[ch][k], L_FRAME48k / 2); } IF( !sts[0]->bfi || ( sts[0]->bfi && sts[ch]->core != ACELP_CORE ) ) { me2f_buf( sts[ch]->hIGFDec->virtualSpec, sts[ch]->hIGFDec->virtualSpec_e, sts[ch]->hIGFDec->virtualSpec_float, ( N_MAX_TCX - IGF_START_MN ) ); } sts[ch]->hTcxDec->cummulative_damping_tcx_float = fix16_to_float( sts[ch]->hTcxDec->cummulative_damping_tcx, Q15 ); } } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { IF( sts[ch]->rate_switching_reset ) { Word16 old_Aq_12_8_e = norm_s( sts[ch]->old_Aq_12_8_fx[0] ); fixedToFloat_arr( sts[ch]->old_Aq_12_8_fx, sts[ch]->old_Aq_12_8, ( 15 - old_Aq_12_8_e ), M + 1 ); } } FOR( i = 0; i < CPE_CHANNELS; ++i ) { free( x_fx[i][0] ); } #endif #else ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1 ); #endif st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; Loading