Skip to content
Commits on Source (2)
...@@ -167,7 +167,11 @@ Word32 L_abs( Word32 L_var1 ); /* Long abs, ...@@ -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 */ Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ); /* Long saturation, 4 */
Word16 norm_s( Word16 var1 ); /* Short norm, 1 */ Word16 norm_s( Word16 var1 ); /* Short norm, 1 */
Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ 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 ); Word32 div_w( Word32 L_num, Word32 L_den );
#endif
Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */
Word32 L_sat( Word32 L_var1 ); /* Long saturation, 4 */ Word32 L_sat( Word32 L_var1 ); /* Long saturation, 4 */
......
...@@ -958,6 +958,55 @@ Word16 BASOP_Util_Divide3232_uu_1616_Scale( Word32 x, Word32 y, Word16 *s ) ...@@ -958,6 +958,55 @@ Word16 BASOP_Util_Divide3232_uu_1616_Scale( Word32 x, Word32 y, Word16 *s )
return ( z ); return ( z );
} }
#ifdef DIV32_OPT
Word32 div_w( Word32 L_num, Word32 L_den, Word16 bits )
{
Word32 L_var_out = 0;
Word16 iteration;
move32();
IF( L_den == 0 )
{
/* printf("Division by 0 in div_l, Fatal error in "); printStack(); */
return ( 0 );
}
test();
IF( ( L_num < 0 ) || ( L_den < 0 ) )
{
/* printf("Division Error in div_l, Fatal error in "); printStack(); */
return ( 0 );
}
Word64 W_num, W_den;
W_num = W_deposit32_l( L_num );
W_den = W_deposit32_l( L_den );
IF( GT_64( W_num, W_den ) )
{
return MAX_32;
}
ELSE
{
W_num = W_shr( W_num, 1 );
W_den = W_shr( W_den, 1 );
FOR( iteration = 0; iteration < bits; iteration++ )
{
L_var_out = L_shl( L_var_out, 1 );
W_num = W_shl( W_num, 1 );
IF( GT_64( W_num, W_den ) )
{
W_num = W_sub( W_num, W_den );
L_var_out = L_add( L_var_out, 1 );
}
}
return L_shl(L_var_out, 31-bits);
}
}
#else /* DIV32_OPT */
Word32 div_w( Word32 L_num, Word32 L_den ) Word32 div_w( Word32 L_num, Word32 L_den )
{ {
Word32 L_var_out = 0; Word32 L_var_out = 0;
...@@ -1005,6 +1054,7 @@ Word32 div_w( Word32 L_num, Word32 L_den ) ...@@ -1005,6 +1054,7 @@ Word32 div_w( Word32 L_num, Word32 L_den )
return L_var_out; return L_var_out;
} }
} }
#endif /* DIV32_OPT */
Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )
{ {
...@@ -1048,7 +1098,11 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) ...@@ -1048,7 +1098,11 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )
move16(); move16();
*s = add( *s, sy ); *s = add( *s, sy );
#ifndef DIV32_OPT
z = div_w( x, y ); z = div_w( x, y );
#else /* DIV32_OPT */
z = div_w( x, y, 26 );
#endif /* DIV32_OPT */
if ( sign != 0 ) if ( sign != 0 )
{ {
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#define BASOP_NOGLOB_DECLARE_LOCAL #define BASOP_NOGLOB_DECLARE_LOCAL
#endif #endif
#define DIV32_OPT
#define IVAS_FLOAT_FIXED #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 IVAS_FLOAT_FIXED_CONVERSIONS /* Temporary macro to keep track of intermediate flt to fixed and fixed to flt conversions */
#define MSAN_FIX #define MSAN_FIX
......
...@@ -2326,8 +2326,11 @@ static void computeLfeEnergy_fx( ...@@ -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( 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( &( 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 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) lowpassCoef = L_shl( div_w( 1, (Word32) hMcMasa->ringBufferSize ), Q6 ); // Q.37(31+6)
#endif
FOR( i = 0; i < input_frame; i++ ) FOR( i = 0; i < input_frame; i++ )
{ {
......