Commit 7d6d31ec authored by Satish Patil's avatar Satish Patil
Browse files

simplify changes for fixed nbits=26

parent 53a1ac93
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -167,7 +167,11 @@ Word32 L_abs( Word32 L_var1 ); /* Long abs,
Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ); /* Long saturation,       4  */
Word16 norm_s( Word16 var1 );                                     /* Short norm,            1  */
Word16 div_s( Word16 var1, Word16 var2 );                         /* Short division,       18  */
#ifdef DIV32_OPT
Word32 div_w( Word32 L_num, Word32 L_den, Word16 nbits );
#else
Word32 div_w( Word32 L_num, Word32 L_den );
#endif
Word16 norm_l( Word32 L_var1 ); /* Long norm,             1  */
Word32 L_sat( Word32 L_var1 );  /* Long saturation,       4  */

+3 −53
Original line number Diff line number Diff line
@@ -1056,7 +1056,6 @@ Word32 div_w( Word32 L_num, Word32 L_den )
}
#endif /*  DIV32_OPT */

#ifndef DIV32_OPT
Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )
{
    Word32 z;
@@ -1099,59 +1098,11 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )
    move16();
    *s = add( *s, sy );

#ifndef DIV32_OPT
    z = div_w( x, y );

    if ( sign != 0 )
    {
        z = L_negate( z );
    }

    return z;
}
#else /*  DIV32_OPT */
Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s, Word16 bits )
{
    Word32 z;
    Word16 sx;
    Word16 sy;
    Word32 sign;

    /* assert (x >= (Word32)0); */
    assert( y != (Word32) 0 );

    sign = 0;
    move16();

    IF( x < 0 )
    {
        x = L_negate( x );
        sign = L_xor( sign, 1 );
    }

    IF( y < 0 )
    {
        y = L_negate( y );
        sign = L_xor( sign, 1 );
    }

    IF( x == (Word32) 0 )
    {
        *s = 0;
        return ( (Word32) 0 );
    }

    sx = norm_l( x );
    x = L_shl( x, sx );
    x = L_shr( x, 1 );
    move16();
    *s = sub( 1, sx );

    sy = norm_l( y );
    y = L_shl( y, sy );
    move16();
    *s = add( *s, sy );

    z = div_w( x, y);
    z = div_w( x, y, 26 );
#endif /*  DIV32_OPT */

    if ( sign != 0 )
    {
@@ -1160,7 +1111,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s, Word1

    return z;
}
#endif /*  DIV32_OPT */

Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s )
{
+0 −7
Original line number Diff line number Diff line
@@ -328,16 +328,9 @@ Word16 BASOP_Util_Divide3232_Scale( Word32 x, /*!< i : Numerator*/
                                    Word32 y,    /*!< i  : Denominator*/
                                    Word16 *s ); /*!< o  : Additional scalefactor difference*/

#ifdef DIV32_OPT
Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x,      /*!< i  : Numerator*/
                                            Word32 y,      /*!< i  : Denominator*/
                                            Word16 *s,     /*!< o  : Additional scalefactor difference*/
                                            Word16 bits ); /*!< o  : Additional scalefactor difference*/
#else /*  DIV32_OPT */
Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x,    /*!< i  : Numerator*/
                                            Word32 y,    /*!< i  : Denominator*/
                                            Word16 *s ); /*!< o  : Additional scalefactor difference*/
#endif /*  DIV32_OPT */


/************************************************************************/
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
#define BASOP_NOGLOB_DECLARE_LOCAL
#endif

#define DIV32_OPT
#define IVAS_FLOAT_FIXED
#define IVAS_FLOAT_FIXED_CONVERSIONS /* Temporary macro to keep track of intermediate flt to fixed and fixed to flt conversions */
#define MSAN_FIX
+4 −1
Original line number Diff line number Diff line
@@ -2326,8 +2326,11 @@ static void computeLfeEnergy_fx(
        Copy32( data_fx[lfeChannelIndex] + hMcMasa->offset_comp, &( delayedInputSignal[0][hMcMasa->num_slots_delay_comp * l_ts] ), ( MDFT_NO_COL_MAX - hMcMasa->num_slots_delay_comp ) * l_ts );      // q_inp
        Copy32( &( hMcMasa->delay_buffer_lfe[1][0] ), &( delayedInputSignal[1][0] ), hMcMasa->num_slots_delay_comp * l_ts );                                                                          // q_inp
        Copy32( data_fx[separateChannelIndex] + hMcMasa->offset_comp, &( delayedInputSignal[1][hMcMasa->num_slots_delay_comp * l_ts] ), ( MDFT_NO_COL_MAX - hMcMasa->num_slots_delay_comp ) * l_ts ); // q_inp

#ifdef DIV32_OPT
        lowpassCoef = L_shl( div_w( 1, (Word32) hMcMasa->ringBufferSize, 26 ), Q6 ); // Q.37(31+6)
#else
        lowpassCoef = L_shl( div_w( 1, (Word32) hMcMasa->ringBufferSize ), Q6 ); // Q.37(31+6)
#endif

        FOR( i = 0; i < input_frame; i++ )
        {