Commit 43fa5856 authored by vaillancour's avatar vaillancour
Browse files

adding another exception

parent 64347e16
Loading
Loading
Loading
Loading
Loading
+39 −20
Original line number Diff line number Diff line
@@ -275,6 +275,21 @@ void gain_enc_mless_fx(
    /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
    L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code );
    exp_inov = sub( exp_code, 18 + 6 );
#ifdef FIX_1959_assert_in_gain_enc_mless_fx
    // To avoid crash in case code value is 0,
    test();
    IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) && element_mode > EVS_MONO )
    {
        // setting values to avoid extra computation
        *gain_inov = 32767; /*8(max value gain_inov can hold) in Q12*/
        Ei = -9743;         /* -38 in Q8*/
        move16();
        move16();
    }
    ELSE
#endif
    {

        exp_code = sub( exp_code, 30 );

        /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
@@ -287,10 +302,10 @@ void gain_enc_mless_fx(
        tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
        L_tmp1 = Mpy_32_16( tmp, frac, 12330 );             /* Q13 */
        Ei = round_fx( L_shl( L_tmp1, 11 ) );               /* Q8 */

#ifndef FIX_1959_assert_in_gain_enc_mless_fx
        /* predicted codebook gain */
        gcode0 = sub( Es_pred, Ei ); /* Q8 */

#endif
        /*---------------------------------------------------------------*
         * Decode codebook gain and the adaptive excitation low-pass
         * filtering factor (Finalize computation )
@@ -299,7 +314,11 @@ void gain_enc_mless_fx(
        L_tmp = Isqrt_lc( L_tmp, &exp_inov );
        *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
        move16();

    }
#ifdef FIX_1959_assert_in_gain_enc_mless_fx
    /* predicted codebook gain */
    gcode0 = sub( Es_pred, Ei ); /* Q8 */
#endif
    /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */
    /*----------------------------------------------------------------*
     * gcode0 = pow(10.0, gcode0/20)