Commit 5d78d24a authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Crash fix for -10dB streams

parent d4bdd3a0
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1817,7 +1817,12 @@ ivas_error acelp_core_dec_ivas_fx(
                //st->hFdCngDec->partNoiseShape_exp = 31 - Q4; // Q4
                //floatToFixed_arrL(st->hFdCngDec->partNoiseShape_float, st->hFdCngDec->partNoiseShape, Q31 - st->hFdCngDec->partNoiseShape_exp, NPART);
                //Scale_sig(syn_tmp_fx, L_FRAME16k + L_SUBFR, 0 - st->Q_syn); //Q0
                Scale_sig32(st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp - Q27);
                st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q4; // Q4

                Scale_sig32(st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART, st->hFdCngDec->hFdCngCom->sidNoiseEstExp - Q27);
                Scale_sig32(st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, st->hFdCngDec->hFdCngCom->sidNoiseEstExp - Q27);
                st->hFdCngDec->hFdCngCom->sidNoiseEstExp = 31 - Q4; // Q4
                /*==========================================================*/
                                //ApplyFdCng_fx( syn_fx + L_SUBFR, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech));
+16 −12
Original line number Diff line number Diff line
@@ -1531,6 +1531,15 @@ Word16 ApplyFdCng_fx(
            }
            test();
            test();
            
            IF( EQ_16( concealWholeFrame, 1 ) && EQ_16( st->nbLostCmpt, 1 ) )
            {
                /* always set psychParameters for MDCT-Stereo ... */
                IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->hTonalMDCTConc != NULL )
                {
                    st->hTonalMDCTConc->psychParams = EQ_16( st->core, TCX_20_CORE ) ? &st->hTonalMDCTConc->psychParamsTCX20 : &st->hTonalMDCTConc->psychParamsTCX10;
                }
                /* update isf cng estimate for concealment. Do that during concealment, in order to avoid addition clean channel complexity*/
                W_tmp = 0;
                FOR( j = hFdCngCom->startBand; j < hFdCngCom->stopFFTbin; j++ )
                {
@@ -1539,17 +1548,11 @@ Word16 ApplyFdCng_fx(
                L_tmp = W_extract_h( W_shl( W_tmp, 32 ) );
                L_tmp_exp = 31;
#ifdef BASOP_NOGLOB
            IF( EQ_16( concealWholeFrame, 1 ) && EQ_16( st->nbLostCmpt, 1 ) && ( L_shl_o( L_tmp, L_tmp_exp, &Overflow ) > 21474836 /*0.01f Q31*/ ) )
                IF(L_shl_o(L_tmp, L_tmp_exp, &Overflow) > 21474836 /*0.01f Q31*/)
#else
            IF( EQ_16( concealWholeFrame, 1 ) && EQ_16( st->nbLostCmpt, 1 ) && ( L_shl( L_tmp, L_tmp_exp ) > 21474836 /*0.01f Q31*/ ) )
                IF( L_shl( L_tmp, L_tmp_exp ) > 21474836 /*0.01f Q31*/ )
#endif
                {
                /* always set psychParameters for MDCT-Stereo ... */
                IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->hTonalMDCTConc != NULL )
                {
                    st->hTonalMDCTConc->psychParams = EQ_16( st->core, TCX_20_CORE ) ? &st->hTonalMDCTConc->psychParamsTCX20 : &st->hTonalMDCTConc->psychParamsTCX10;
                }
                /* update isf cng estimate for concealment. Do that during concealment, in order to avoid addition clean channel complexity*/
                IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && NE_16( st->core, ACELP_CORE ) )
                {
                    TonalMdctConceal_whiten_noise_shape_ivas_fx( st, L_frame, ON_FIRST_LOST_FRAME );
@@ -1566,6 +1569,7 @@ Word16 ApplyFdCng_fx(
                st->plcBackgroundNoiseUpdated = 1;
                move16();
            }
            }
            BREAK;

        case SID_FRAME: