Commit 66d76646 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Optimization for tcx_scalar_quantization_ivas_fx function

changes are under macro: OPT_MCT_ENC_V2_NBE
stream used: IVAS_cod -mc 7_1_4 -max_band fb 192000 48 stv714MC48c.wav mc_7_1_4.bit (MCT_714_192kbps_FB)
Around 18 WMOPs reduced
parent 86e64776
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@


/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCT_ENC_V2_NBE
#define OPT_MCT_ENC_V1_NBE
#define OPT_MCT_ENC_V1_BE
#define OPT_SBA_REND_V1_BE
+31 −0
Original line number Diff line number Diff line
@@ -1355,23 +1355,37 @@ void tcx_scalar_quantization_ivas_fx(
{
    Word16 i, tmp16, s;
    Word32 tmp32, offs32;
#ifdef OPT_MCT_ENC_V2_NBE
    Word32 offs32_1;
    Word32 offset_Q16 = L_shl( offset, 1 ); // Q16
#endif


    /* common exponent for x and gain for comparison */
    tmp16 = sub( gain_e, x_e );
#ifdef OPT_MCT_ENC_V2_NBE
    tmp32 = L_shl_sat( L_deposit_h( gain ), tmp16 ); // exp:x_e
#else
    tmp32 = L_shl( L_deposit_h( gain ), s_max( -31, s_min( tmp16, 0 ) ) );
    tmp16 = negate( s_max( tmp16, 0 ) );
#endif

    i = sub( L_frame, 1 );
    IF( memQuantZeros_fx != NULL )
    {
        test();
#ifdef OPT_MCT_ENC_V2_NBE
        FOR( ; ( ( memQuantZeros_fx[i] != 0 ) && ( L_abs( x[i] ) < tmp32 ) ); i-- )
#else
        WHILE( ( memQuantZeros_fx[i] != 0 ) && ( LT_32( L_abs( L_shl( x[i], tmp16 ) ), tmp32 ) ) )
#endif
        {
            test();
            xq[i] = 0;
            move16();
#ifndef OPT_MCT_ENC_V2_NBE
            i = sub( i, 1 );
#endif
        }
    }

@@ -1394,6 +1408,22 @@ void tcx_scalar_quantization_ivas_fx(

    FOR( ; i >= 0; i-- )
    {
#ifdef OPT_MCT_ENC_V2_NBE
        offs32 = Mpy_32_16_1( x[i], gain );
        offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */

        offs32_1 = L_add_sat( offs32, offset_Q16 ); /*15Q16 */
        tmp16 = extract_h( offs32_1 );
        IF( x[i] < 0 )
        {
            offs32 = L_sub_sat( offs32, offset_Q16 ); /*15Q16 */
            tmp16 = extract_h( offs32 );
            if ( L_mac_sat( offs32, tmp16, -ONE_IN_Q15 ) > 0 )
            {
                tmp16 = add( tmp16, 1 );
            }
        }
#else
        offs32 = Mpy_32_16_1( x[i], gain ); /* multiply */
        offs32 = L_shl_sat( offs32, s );    /* convert to 15Q16 */
        IF( x[i] > 0 )
@@ -1414,6 +1444,7 @@ void tcx_scalar_quantization_ivas_fx(
                tmp16 = add( tmp16, 1 );
            }
        }
#endif
        xq[i] = tmp16;
        move16();
    }