Commit 878bfe47 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

LTV opt mch be 2 - 10072025

parent bf9ba511
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@


/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCT_ENC_V2_BE
#define OPT_MCH_DEC_V1_NBE
#define OPT_MCT_ENC_48KB_NBE
#define OPT_MCH_DEC_V1_BE
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ void Residu3_fx(
    move16();
#endif
    q = add( norm_s( a[0] ), 1 );
    IF( shift != 0 )
    if ( shift != 0 )
    {
        q = add( q, shift );
    }
+8 −0
Original line number Diff line number Diff line
@@ -688,7 +688,11 @@ Word32 dotp_fixed_o(
    move16();
    test();
    test();
#ifdef OPT_MCT_ENC_V2_BE
    FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); )
#else
    WHILE( GT_64( suma, MAX_32 ) || LT_64( suma, MIN_32 ) || GT_16( *res_q, 31 ) )
#endif
    {
        suma = W_shr( suma, 1 );
        *res_q = sub( *res_q, 1 );
@@ -718,7 +722,11 @@ Word32 dotp_fixed_32(
    move16();
    test();
    test();
#ifdef OPT_MCT_ENC_V2_BE
    FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); )
#else
    WHILE( GT_64( suma, MAX_32 ) || LT_64( suma, MIN_32 ) || GT_16( *res_q, 31 ) )
#endif
    {
        suma = W_shr( suma, 1 );
        *res_q = sub( *res_q, 1 );
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ static Word16 IGF_getCrest_new_fx(
        move16();
        x_eff = L_add( x_eff, L_mult0( x, x ) );

        IF( GT_16( x, x_max ) )
        if ( GT_16( x, x_max ) )
        {
            x_max = x;
            move16();
+20 −2
Original line number Diff line number Diff line
@@ -882,7 +882,7 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res
        move32();
        en_fx[q] = Mpy_32_16_1( L_add( L_shl( e_ener, Q25 ), en_fx[q] ), 9864 /* log10(2) in Q15 */ ); // Q(25)
        move32();
        i = add( i, 4 );
        i += 4;
    }
    i = 0;
    move16();
@@ -901,7 +901,7 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res
        move32();
        en_fx[q] = Mpy_32_16_1( L_add( L_shl( e_ener, Q25 ), en_fx[q] ), 9864 /* log10(2) in Q15 */ ); // Q(25)
        move32();
        i = add( i, 4 );
        i += 4;
    }

    /* SQ scale: 4 bits / 6 dB per quadruple */
@@ -911,6 +911,9 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res
    offset_fx = fac_fx; /* Q25 */
    move32();

#ifdef OPT_MCT_ENC_V2_BE
    Word64 target_64_fx = W_shl( target_fx, 7 ); // Q25
#endif
    /* find offset (0 to 128 dB with step of 0.125dB) */
    FOR( iter = 0; iter < 10; iter++ )
    {
@@ -923,6 +926,20 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res
        {
            tmp_32 = L_sub( en_fx[i], offset_fx ); /* Q25 */

#ifdef OPT_MCT_ENC_V2_BE
            /* avoid SV with 1 bin of amp < 0.5f */
            if ( GT_32( tmp_32, 10066329 /*0.3 Q25*/ ) )
            {
                W_tmp = W_add( W_tmp, tmp_32 ); /* Q25 */
            }
            /* if ener is above target -> break and increase offset */
            IF( GT_64( W_tmp, target_64_fx ) )
            {
                offset_fx = L_add( offset_fx, fac_fx ); /* Q25 */
                BREAK;
            }
#else

            /* avoid SV with 1 bin of amp < 0.5f */
            IF( GT_32( tmp_32, 10066329 /*0.3 Q25*/ ) )
            {
@@ -935,6 +952,7 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res
                    BREAK;
                }
            }
#endif
        }
    }