Loading lib_dec/dec_tcx_fx.c +56 −0 Original line number Diff line number Diff line Loading @@ -547,7 +547,11 @@ void decoder_tcx_fx( st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ ); move16(); tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e ); #ifdef ISSUE_1866_replace_overflow_libdec st->last_gain_syn_deemph = round_fx_sat( tmp32 ); //??sat #else st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow ); #endif move16(); /*for avoiding compiler warnings*/ hTcxDec->gainHelper = 32768 / 2; Loading Loading @@ -1276,9 +1280,11 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, Word32 tmp32; Word32 tmp32_1, tmp32_2; TCX_DEC_HANDLE hTcxDec; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hTcxDec = st_fx->hTcxDec; Loading Loading @@ -1351,7 +1357,11 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, } tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) ); tmp2 = norm_l( tmp32 ); #ifdef ISSUE_1866_replace_overflow_libdec tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) ); //??sat #else tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow ); #endif s = sub( sub( sub( 1, shl( s, 1 ) ), 6 /*table lookup for inverse framelength*/ ), tmp2 ); tmp1 = Sqrt16( tmp1, &s ); move16(); Loading Loading @@ -1444,18 +1454,30 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, &tmp1 ); tmp2 = BASOP_Util_Add_MantExp( hTcxDec->conceal_eof_gain, 15 - 14, negate( tmp1 ), tmp2, &tmp1 ); #ifdef ISSUE_1866_replace_overflow_libdec step = L_shl_sat( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ) ); /*Q30*/ //??sat #else step = L_shl_o( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ), &Overflow ); /*Q30*/ #endif { Word32 stepFB; UWord32 dmy; conceal_eof_gainFB = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ Mpy_32_32_ss( step, L_shl( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ), &stepFB, &dmy ); #ifdef ISSUE_1866_replace_overflow_libdec stepFB = L_shl_sat( stepFB, 3 - 1 ); /*Q30*/ //??sat #else stepFB = L_shl_o( stepFB, 3 - 1, &Overflow ); /*Q30*/ #endif FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) { synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) ); move16(); #ifdef ISSUE_1866_replace_overflow_libdec conceal_eof_gainFB = L_sub_sat( conceal_eof_gainFB, stepFB ); //??sat #else conceal_eof_gainFB = L_sub_o( conceal_eof_gainFB, stepFB, &Overflow ); #endif } } conceal_eof_gain32 = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ Loading @@ -1463,17 +1485,31 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, { xn_buf[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) ); move16(); #ifdef ISSUE_1866_replace_overflow_libdec conceal_eof_gain32 = L_sub_sat( conceal_eof_gain32, step ); //??sat #else conceal_eof_gain32 = L_sub_o( conceal_eof_gain32, step, &Overflow ); #endif } #ifdef ISSUE_1866_replace_overflow_libdec hTcxDec->conceal_eof_gain = round_fx_sat( conceal_eof_gain32 ); /*Q14*/ //??sat #else hTcxDec->conceal_eof_gain = round_fx_o( conceal_eof_gain32, &Overflow ); /*Q14*/ #endif move16(); /* run lpc gain compensation not for waveform adjustment */ test(); IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) { #ifdef ISSUE_1866_replace_overflow_libdec st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e ) ); /*Q30->Q14*/ //??sat #else st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/ #endif move16(); } ELSE Loading Loading @@ -1543,9 +1579,11 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, Word32 tmp32; Word32 tmp32_1, tmp32_2; TCX_DEC_HANDLE hTcxDec; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hTcxDec = st_fx->hTcxDec; Loading Loading @@ -1629,7 +1667,11 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, } tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) ); tmp2 = norm_l( tmp32 ); #ifdef ISSUE_1866_replace_overflow_libdec tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) ); //??sat #else tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow ); #endif // s = sub(sub(sub(1, shl(s, 1)), 6/*table lookup for inverse framelength*/), tmp2); s = sub( 25, add( shl( add( Q_syn, s ), 1 ), tmp2 ) ); tmp1 = Sqrt16( tmp1, &s ); Loading Loading @@ -1802,7 +1844,11 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, test(); IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) { #ifdef ISSUE_1866_replace_overflow_libdec st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e ) ); /*Q30->Q14*/ //??sat #else st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/ #endif move16(); } ELSE Loading Loading @@ -4394,9 +4440,11 @@ void decoder_tcx_invQ_fx( move16(); move16(); #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif tnsSize = 0; Loading Loading @@ -4521,7 +4569,11 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); #ifdef ISSUE_1866_replace_overflow_libdec *nf_seed = add_sat( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ) ); // abs( tmp32 ) * i * 2 //??sat #else *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 #endif move16(); } } Loading Loading @@ -4761,7 +4813,11 @@ void decoder_tcx_invQ_fx( st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ ); move16(); tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e ); #ifdef ISSUE_1866_replace_overflow_libdec st->last_gain_syn_deemph = round_fx_sat( tmp32 ); // Q15 //??sat #else st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow ); // Q15 #endif move16(); } Loading lib_dec/er_dec_tcx_fx.c +8 −0 Original line number Diff line number Diff line Loading @@ -36,14 +36,22 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, tmp16 = round_fx( old_fpitch ); /*Q0*/ tmp_loop = shl( L_subfr, 1 ); BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1866_replace_overflow_libdec tmp16_2 = round_fx_sat( L_shl_sat( lp_gainp, 2 ) ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/ //??sat //??sat #else tmp16_2 = round_fx_o( L_shl_o( lp_gainp, 2, &Overflow ), &Overflow ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/ #endif BASOP_SATURATE_WARNING_ON_EVS FOR( i = 0; i < tmp_loop; i++ ) { /*st->lp_gainc += ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] ) * ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] );*/ #ifdef ISSUE_1866_replace_overflow_libdec tmp16_3 = sub_sat( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/ ); //??sat #else tmp16_3 = sub_o( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/, &Overflow ); #endif L_acc = L_macNs_co( L_acc, tmp16_3, tmp16_3, &Carry, &Overflow ); /*Q3*/ Overflow = 0; move16(); Loading lib_dec/er_scale_syn_fx.c +6 −0 Original line number Diff line number Diff line Loading @@ -33,10 +33,12 @@ Word16 Damping_fact_fx( /* o : damping factor Word32 lp_tmp; Word16 s_gainp; Word32 gain32; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif IF( core == ACELP_CORE ) Loading Loading @@ -97,7 +99,11 @@ Word16 Damping_fact_fx( /* o : damping factor move16(); gain32 = Sqrt32( lp_tmp, &s_gainp ); /*Q31-s_gainp*/ #ifdef ISSUE_1866_replace_overflow_libdec gain = round_fx_sat( L_shl_sat( gain32, s_gainp ) ); /* Q15*/ //??sat //??sat #else gain = round_fx_o( L_shl_o( gain32, s_gainp, &Overflow ), &Overflow ); /* Q15*/ #endif gain = s_min( gain, 32113 /*0.98f Q15*/ ); /*Q15*/ gain = s_max( gain, 27853 /*0.85f Q15*/ ); /*Q15*/ alpha = mult_r( alpha, gain ); /*Q14*/ Loading lib_dec/er_sync_exc_fx.c +16 −0 Original line number Diff line number Diff line Loading @@ -30,9 +30,11 @@ static Word16 GetMinimumPosition_fx( Word16 iMinEnergyPos, center, i; Word16 cnt, tmp_e, tmp16; Word32 energy, energy_old, tmptest; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif filterLength = s_min( filterLength, length ); /*Q0*/ Loading Loading @@ -61,7 +63,11 @@ static Word16 GetMinimumPosition_fx( /*if (energy == MAXVAL_WORD32)*/ BASOP_SATURATE_WARNING_OFF_EVS /*saturates if energy < 0*/ #ifdef ISSUE_1866_replace_overflow_libdec tmptest = L_sub_sat( energy, MAXVAL_WORD32 ); /*Q31*/ //??sat #else tmptest = L_sub_o( energy, MAXVAL_WORD32, &Overflow ); /*Q31*/ #endif BASOP_SATURATE_WARNING_ON_EVS IF( tmptest == 0 ) { Loading Loading @@ -227,10 +233,12 @@ void PulseResynchronization_fx( Word16 /*int*/ roundedPitchStart, nSamplesDelta, nSamplesDeltaRemain, iMinPos1, iMinPos[NB_PULSES_MAX + 1], iDeltaSamples[NB_PULSES_MAX + 1], maxDeltaSamples, roundedCycleDelta; Word16 tmp16, tmp16_a, freqStart_e /*exponent of freqStart*/, tmp_e, samplesDelta_e, perCycleDeltaDelta_e, cycleDelta_e, tmp2_e, tmp3_e; Word32 /* pitchDelta, */ tmp32, tmp32_a, tmp32_b, samplesDelta, absPitchDiff, cycleDelta32; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif test(); Loading Loading @@ -295,7 +303,11 @@ void PulseResynchronization_fx( tmp3_e = tmp2_e; move16(); tmp32_a = L_negate( tmp32_a ); #ifdef ISSUE_1866_replace_overflow_libdec tmp32_a = L_add( L_shl_sat( 1, sub( 31, tmp3_e ) ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/ //??sat #else tmp32_a = L_add( L_shl_o( 1, sub( 31, tmp3_e ), &Overflow ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/ #endif tmp2_e = norm_s( nFrameLength ); tmp16_a = shl( nFrameLength, tmp2_e ); /*Q0+tmp2_e*/ tmp32_a = Mpy_32_16_1( tmp32_a /*Q31,tmp3_e*/, tmp16_a /*Q0,-tmp2_e*/ ); /*Q16,tmp3_e-tmp2_e*/ /*tmp32_a= nFrameLength*(1.0f-pitchStart*freqStart)*/ Loading Loading @@ -361,7 +373,11 @@ void PulseResynchronization_fx( tmp_e = sub( 15, norm_l( tmp32 ) ); cycleDelta_e = add( cycleDelta_e, tmp_e ); tmp32 = L_shr( tmp32, sub( tmp_e, 15 ) ); /*Q31 frac, cycleDelta_e*/ #ifdef ISSUE_1866_replace_overflow_libdec cycleDelta = round_fx_sat( tmp32 ); /*Q15, cycleDelta_e*/ //??sat #else cycleDelta = round_fx_o( tmp32, &Overflow ); /*Q15, cycleDelta_e*/ #endif if ( cycleDelta == 0 ) { cycleDelta_e = 0; Loading Loading
lib_dec/dec_tcx_fx.c +56 −0 Original line number Diff line number Diff line Loading @@ -547,7 +547,11 @@ void decoder_tcx_fx( st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ ); move16(); tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e ); #ifdef ISSUE_1866_replace_overflow_libdec st->last_gain_syn_deemph = round_fx_sat( tmp32 ); //??sat #else st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow ); #endif move16(); /*for avoiding compiler warnings*/ hTcxDec->gainHelper = 32768 / 2; Loading Loading @@ -1276,9 +1280,11 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, Word32 tmp32; Word32 tmp32_1, tmp32_2; TCX_DEC_HANDLE hTcxDec; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hTcxDec = st_fx->hTcxDec; Loading Loading @@ -1351,7 +1357,11 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, } tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) ); tmp2 = norm_l( tmp32 ); #ifdef ISSUE_1866_replace_overflow_libdec tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) ); //??sat #else tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow ); #endif s = sub( sub( sub( 1, shl( s, 1 ) ), 6 /*table lookup for inverse framelength*/ ), tmp2 ); tmp1 = Sqrt16( tmp1, &s ); move16(); Loading Loading @@ -1444,18 +1454,30 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, &tmp1 ); tmp2 = BASOP_Util_Add_MantExp( hTcxDec->conceal_eof_gain, 15 - 14, negate( tmp1 ), tmp2, &tmp1 ); #ifdef ISSUE_1866_replace_overflow_libdec step = L_shl_sat( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ) ); /*Q30*/ //??sat #else step = L_shl_o( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ), &Overflow ); /*Q30*/ #endif { Word32 stepFB; UWord32 dmy; conceal_eof_gainFB = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ Mpy_32_32_ss( step, L_shl( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ), &stepFB, &dmy ); #ifdef ISSUE_1866_replace_overflow_libdec stepFB = L_shl_sat( stepFB, 3 - 1 ); /*Q30*/ //??sat #else stepFB = L_shl_o( stepFB, 3 - 1, &Overflow ); /*Q30*/ #endif FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) { synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) ); move16(); #ifdef ISSUE_1866_replace_overflow_libdec conceal_eof_gainFB = L_sub_sat( conceal_eof_gainFB, stepFB ); //??sat #else conceal_eof_gainFB = L_sub_o( conceal_eof_gainFB, stepFB, &Overflow ); #endif } } conceal_eof_gain32 = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ Loading @@ -1463,17 +1485,31 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, { xn_buf[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) ); move16(); #ifdef ISSUE_1866_replace_overflow_libdec conceal_eof_gain32 = L_sub_sat( conceal_eof_gain32, step ); //??sat #else conceal_eof_gain32 = L_sub_o( conceal_eof_gain32, step, &Overflow ); #endif } #ifdef ISSUE_1866_replace_overflow_libdec hTcxDec->conceal_eof_gain = round_fx_sat( conceal_eof_gain32 ); /*Q14*/ //??sat #else hTcxDec->conceal_eof_gain = round_fx_o( conceal_eof_gain32, &Overflow ); /*Q14*/ #endif move16(); /* run lpc gain compensation not for waveform adjustment */ test(); IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) { #ifdef ISSUE_1866_replace_overflow_libdec st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e ) ); /*Q30->Q14*/ //??sat #else st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/ #endif move16(); } ELSE Loading Loading @@ -1543,9 +1579,11 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, Word32 tmp32; Word32 tmp32_1, tmp32_2; TCX_DEC_HANDLE hTcxDec; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif hTcxDec = st_fx->hTcxDec; Loading Loading @@ -1629,7 +1667,11 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, } tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) ); tmp2 = norm_l( tmp32 ); #ifdef ISSUE_1866_replace_overflow_libdec tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) ); //??sat #else tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow ); #endif // s = sub(sub(sub(1, shl(s, 1)), 6/*table lookup for inverse framelength*/), tmp2); s = sub( 25, add( shl( add( Q_syn, s ), 1 ), tmp2 ) ); tmp1 = Sqrt16( tmp1, &s ); Loading Loading @@ -1802,7 +1844,11 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, test(); IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) { #ifdef ISSUE_1866_replace_overflow_libdec st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e ) ); /*Q30->Q14*/ //??sat #else st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/ #endif move16(); } ELSE Loading Loading @@ -4394,9 +4440,11 @@ void decoder_tcx_invQ_fx( move16(); move16(); #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif tnsSize = 0; Loading Loading @@ -4521,7 +4569,11 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); #ifdef ISSUE_1866_replace_overflow_libdec *nf_seed = add_sat( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ) ); // abs( tmp32 ) * i * 2 //??sat #else *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 #endif move16(); } } Loading Loading @@ -4761,7 +4813,11 @@ void decoder_tcx_invQ_fx( st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ ); move16(); tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e ); #ifdef ISSUE_1866_replace_overflow_libdec st->last_gain_syn_deemph = round_fx_sat( tmp32 ); // Q15 //??sat #else st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow ); // Q15 #endif move16(); } Loading
lib_dec/er_dec_tcx_fx.c +8 −0 Original line number Diff line number Diff line Loading @@ -36,14 +36,22 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, tmp16 = round_fx( old_fpitch ); /*Q0*/ tmp_loop = shl( L_subfr, 1 ); BASOP_SATURATE_WARNING_OFF_EVS #ifdef ISSUE_1866_replace_overflow_libdec tmp16_2 = round_fx_sat( L_shl_sat( lp_gainp, 2 ) ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/ //??sat //??sat #else tmp16_2 = round_fx_o( L_shl_o( lp_gainp, 2, &Overflow ), &Overflow ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/ #endif BASOP_SATURATE_WARNING_ON_EVS FOR( i = 0; i < tmp_loop; i++ ) { /*st->lp_gainc += ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] ) * ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] );*/ #ifdef ISSUE_1866_replace_overflow_libdec tmp16_3 = sub_sat( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/ ); //??sat #else tmp16_3 = sub_o( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/, &Overflow ); #endif L_acc = L_macNs_co( L_acc, tmp16_3, tmp16_3, &Carry, &Overflow ); /*Q3*/ Overflow = 0; move16(); Loading
lib_dec/er_scale_syn_fx.c +6 −0 Original line number Diff line number Diff line Loading @@ -33,10 +33,12 @@ Word16 Damping_fact_fx( /* o : damping factor Word32 lp_tmp; Word16 s_gainp; Word32 gain32; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif IF( core == ACELP_CORE ) Loading Loading @@ -97,7 +99,11 @@ Word16 Damping_fact_fx( /* o : damping factor move16(); gain32 = Sqrt32( lp_tmp, &s_gainp ); /*Q31-s_gainp*/ #ifdef ISSUE_1866_replace_overflow_libdec gain = round_fx_sat( L_shl_sat( gain32, s_gainp ) ); /* Q15*/ //??sat //??sat #else gain = round_fx_o( L_shl_o( gain32, s_gainp, &Overflow ), &Overflow ); /* Q15*/ #endif gain = s_min( gain, 32113 /*0.98f Q15*/ ); /*Q15*/ gain = s_max( gain, 27853 /*0.85f Q15*/ ); /*Q15*/ alpha = mult_r( alpha, gain ); /*Q14*/ Loading
lib_dec/er_sync_exc_fx.c +16 −0 Original line number Diff line number Diff line Loading @@ -30,9 +30,11 @@ static Word16 GetMinimumPosition_fx( Word16 iMinEnergyPos, center, i; Word16 cnt, tmp_e, tmp16; Word32 energy, energy_old, tmptest; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move16(); #endif #endif filterLength = s_min( filterLength, length ); /*Q0*/ Loading Loading @@ -61,7 +63,11 @@ static Word16 GetMinimumPosition_fx( /*if (energy == MAXVAL_WORD32)*/ BASOP_SATURATE_WARNING_OFF_EVS /*saturates if energy < 0*/ #ifdef ISSUE_1866_replace_overflow_libdec tmptest = L_sub_sat( energy, MAXVAL_WORD32 ); /*Q31*/ //??sat #else tmptest = L_sub_o( energy, MAXVAL_WORD32, &Overflow ); /*Q31*/ #endif BASOP_SATURATE_WARNING_ON_EVS IF( tmptest == 0 ) { Loading Loading @@ -227,10 +233,12 @@ void PulseResynchronization_fx( Word16 /*int*/ roundedPitchStart, nSamplesDelta, nSamplesDeltaRemain, iMinPos1, iMinPos[NB_PULSES_MAX + 1], iDeltaSamples[NB_PULSES_MAX + 1], maxDeltaSamples, roundedCycleDelta; Word16 tmp16, tmp16_a, freqStart_e /*exponent of freqStart*/, tmp_e, samplesDelta_e, perCycleDeltaDelta_e, cycleDelta_e, tmp2_e, tmp3_e; Word32 /* pitchDelta, */ tmp32, tmp32_a, tmp32_b, samplesDelta, absPitchDiff, cycleDelta32; #ifndef ISSUE_1866_replace_overflow_libdec #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif #endif test(); Loading Loading @@ -295,7 +303,11 @@ void PulseResynchronization_fx( tmp3_e = tmp2_e; move16(); tmp32_a = L_negate( tmp32_a ); #ifdef ISSUE_1866_replace_overflow_libdec tmp32_a = L_add( L_shl_sat( 1, sub( 31, tmp3_e ) ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/ //??sat #else tmp32_a = L_add( L_shl_o( 1, sub( 31, tmp3_e ), &Overflow ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/ #endif tmp2_e = norm_s( nFrameLength ); tmp16_a = shl( nFrameLength, tmp2_e ); /*Q0+tmp2_e*/ tmp32_a = Mpy_32_16_1( tmp32_a /*Q31,tmp3_e*/, tmp16_a /*Q0,-tmp2_e*/ ); /*Q16,tmp3_e-tmp2_e*/ /*tmp32_a= nFrameLength*(1.0f-pitchStart*freqStart)*/ Loading Loading @@ -361,7 +373,11 @@ void PulseResynchronization_fx( tmp_e = sub( 15, norm_l( tmp32 ) ); cycleDelta_e = add( cycleDelta_e, tmp_e ); tmp32 = L_shr( tmp32, sub( tmp_e, 15 ) ); /*Q31 frac, cycleDelta_e*/ #ifdef ISSUE_1866_replace_overflow_libdec cycleDelta = round_fx_sat( tmp32 ); /*Q15, cycleDelta_e*/ //??sat #else cycleDelta = round_fx_o( tmp32, &Overflow ); /*Q15, cycleDelta_e*/ #endif if ( cycleDelta == 0 ) { cycleDelta_e = 0; Loading