Skip to content
...@@ -167,6 +167,30 @@ Word16 ivas_sba_get_nchan_fx( ...@@ -167,6 +167,30 @@ Word16 ivas_sba_get_nchan_fx(
} }
#ifdef NONBE_FIX_1052_SBA_EXT
/*-------------------------------------------------------------------*
* ivas_sba_spar_sid_bitlen_fx()
*
* Get number of bits in SPAR SID frame
*-------------------------------------------------------------------*/
/*! r: number of bits in SPAR SID frame */
Word16 ivas_sba_spar_sid_bitlen_fx(
const Word16 nchan_transport /* i : number of transport channels */
)
{
Word16 num_bits;
num_bits = i_mult( SPAR_DTX_BANDS, SPAR_SID_BITS_TAR_PER_BAND );
IF( GT_16( nchan_transport, 1 ) )
{
num_bits = sub( num_bits, 2 );
}
return num_bits;
}
#endif
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
* ivas_sba_get_nchan_metadata() * ivas_sba_get_nchan_metadata()
* *
......
...@@ -376,14 +376,6 @@ void sns_shape_spectrum_fx( ...@@ -376,14 +376,6 @@ void sns_shape_spectrum_fx(
{ {
L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1 L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1
move64(); move64();
#ifndef OPT_MCT_ENC_V3_NBE
shift = W_norm( L64_tmp[k] );
if ( LT_16( shift, min_shift ) )
{
min_shift = shift;
move16();
}
#endif
} }
} }
tmp_k = k; tmp_k = k;
...@@ -393,29 +385,18 @@ void sns_shape_spectrum_fx( ...@@ -393,29 +385,18 @@ void sns_shape_spectrum_fx(
*length = k; *length = k;
move16(); move16();
} }
#ifdef OPT_MCT_ENC_V3_NBE
min_shift = W_norm_arr( L64_tmp, k ); min_shift = W_norm_arr( L64_tmp, k );
#endif
q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 );
if ( GT_16( q_tmp, 30 ) ) if ( GT_16( q_tmp, 30 ) )
{ {
q_tmp = 30; q_tmp = 30;
move16(); move16();
} }
#ifdef OPT_MCT_ENC_V3_NBE
shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) ); shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) );
FOR( k = 0; k < tmp_k; k++ ) FOR( k = 0; k < tmp_k; k++ )
{ {
spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1 spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1
move32(); move32();
#else
FOR( k = 0; k < tmp_k; k++ )
{
L64_tmp[k] = W_shr( L64_tmp[k], sub( add( *q_spectrum, q_scf_int ), q_tmp ) ); // Q = q_tmp+1
move64();
spectrum[k] = W_sat_l( L64_tmp[k] ); // Q = q_tmp+1
move64();
#endif
} }
*q_spectrum = q_tmp; *q_spectrum = q_tmp;
move16(); move16();
...@@ -431,15 +412,6 @@ void sns_shape_spectrum_fx( ...@@ -431,15 +412,6 @@ void sns_shape_spectrum_fx(
{ {
L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1 L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1
move64(); move64();
#ifndef OPT_MCT_ENC_V3_NBE
shift = W_norm( L64_tmp[k] );
test();
if ( LT_16( shift, min_shift ) && NE_64( L64_tmp[k], 0 ) )
{
min_shift = shift;
move16();
}
#endif
} }
} }
tmp_k = k; tmp_k = k;
...@@ -449,29 +421,18 @@ void sns_shape_spectrum_fx( ...@@ -449,29 +421,18 @@ void sns_shape_spectrum_fx(
*length = k; *length = k;
move16(); move16();
} }
#ifdef OPT_MCT_ENC_V3_NBE
min_shift = W_norm_arr( L64_tmp, k ); min_shift = W_norm_arr( L64_tmp, k );
#endif
q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 );
if ( GT_16( q_tmp, 30 ) ) if ( GT_16( q_tmp, 30 ) )
{ {
q_tmp = 30; q_tmp = 30;
move16(); move16();
} }
#ifdef OPT_MCT_ENC_V3_NBE
shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) ); shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) );
FOR( k = 0; k < tmp_k; k++ ) FOR( k = 0; k < tmp_k; k++ )
{ {
spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1 spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1
move32(); move32();
#else
FOR( k = 0; k < tmp_k; k++ )
{
L64_tmp[k] = W_shr( L64_tmp[k], sub( add( *q_spectrum, q_scf_int ), q_tmp ) ); // q_tmp+1
move64();
spectrum[k] = W_sat_l( L64_tmp[k] ); // Q = q_tmp+1
move64();
#endif
} }
*q_spectrum = q_tmp; *q_spectrum = q_tmp;
move16(); move16();
......
This diff is collapsed.
...@@ -1965,11 +1965,7 @@ void v_multc_acc_32_16( ...@@ -1965,11 +1965,7 @@ void v_multc_acc_32_16(
FOR( i = 0; i < N; i++ ) FOR( i = 0; i < N; i++ )
{ {
#ifdef OPT_MCT_ENC_V1_BE
y[i] = Madd_32_16( y[i], x[i], c ); y[i] = Madd_32_16( y[i], x[i], c );
#else
y[i] = L_add( y[i], Mpy_32_16_1( x[i], c ) );
#endif
move32(); move32();
} }
...@@ -1986,11 +1982,7 @@ void v_multc_acc_32_32( ...@@ -1986,11 +1982,7 @@ void v_multc_acc_32_32(
FOR( i = 0; i < N; i++ ) FOR( i = 0; i < N; i++ )
{ {
#ifdef OPT_MCT_ENC_V1_BE
y[i] = Madd_32_32( y[i], x[i], c ); /*Qx*/ y[i] = Madd_32_32( y[i], x[i], c ); /*Qx*/
#else
y[i] = L_add( y[i], Mpy_32_32( x[i], c ) ); /*Qx*/
#endif
move32(); move32();
} }
......
...@@ -97,11 +97,7 @@ void ivas_fine_gain_pred_fx( ...@@ -97,11 +97,7 @@ void ivas_fine_gain_pred_fx(
/*gp *= 1.0f - 0.05f / accuracy; */ /*gp *= 1.0f - 0.05f / accuracy; */
tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */
#ifdef ISSUE_1772_replace_shr_o
tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
#else
tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */
#endif
tmp = sub( 32767, tmp ); tmp = sub( 32767, tmp );
tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */
...@@ -209,11 +205,7 @@ void fine_gain_pred_fx( ...@@ -209,11 +205,7 @@ void fine_gain_pred_fx(
/*gp *= 1.0f - 0.05f / accuracy; */ /*gp *= 1.0f - 0.05f / accuracy; */
tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */
#ifdef ISSUE_1772_replace_shr_o
tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
#else
tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */
#endif
tmp = sub( 32767, tmp ); tmp = sub( 32767, tmp );
tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */ tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
gp = mult_r( tmp, gp ); /*15+12+1-16=12 */ gp = mult_r( tmp, gp ); /*15+12+1-16=12 */
......
...@@ -1800,8 +1800,13 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ ...@@ -1800,8 +1800,13 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */
L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */
L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */
L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */
#ifdef ISSUE_1799_replace_L_shr_o
L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */
#else
L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */ L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */
#endif
f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */ f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */
} }
...@@ -1810,7 +1815,11 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ ...@@ -1810,7 +1815,11 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */
{ {
L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */ L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */
L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */
#ifdef ISSUE_1799_replace_L_shr_o
L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
#else
L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
#endif
f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
move16(); move16();
} }
...@@ -2314,7 +2323,11 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/ ...@@ -2314,7 +2323,11 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/ tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/
tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */ tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */
#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */
#else
tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */ tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */
#endif
tmp = s_max( tmp, 0 ); tmp = s_max( tmp, 0 );
......
...@@ -345,7 +345,11 @@ static Word32 b_inv_sq( ...@@ -345,7 +345,11 @@ static Word32 b_inv_sq(
exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) );
m_den = mult_r( m_den, m_den ); m_den = mult_r( m_den, m_den );
#ifdef ISSUE_1796_replace_shl_o
exp_den = shl_sat( exp_den, 1 );
#else
exp_den = shl_o( exp_den, 1, &Overflow ); exp_den = shl_o( exp_den, 1, &Overflow );
#endif
div_out = div_s( 8192, m_den ); div_out = div_s( 8192, m_den );
Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/
...@@ -423,7 +427,11 @@ static Word32 inv_pow( ...@@ -423,7 +427,11 @@ static Word32 inv_pow(
} }
tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp );
exp1 = add( exp1, exp2 ); exp1 = add( exp1, exp2 );
#ifdef ISSUE_1799_replace_L_shr_o
L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */
#else
L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */
#endif
return ( L_tmp ); return ( L_tmp );
} }
......
...@@ -256,11 +256,19 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val ...@@ -256,11 +256,19 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val
} }
IF( expi > 0 ) IF( expi > 0 )
{ {
#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( x[0], expi );
#else
tmp = shl_o( x[0], expi, &Overflow ); tmp = shl_o( x[0], expi, &Overflow );
#endif
L_sum = L_mac_o( 1, tmp, tmp, &Overflow ); L_sum = L_mac_o( 1, tmp, tmp, &Overflow );
FOR( i = 1; i < lg; i++ ) FOR( i = 1; i < lg; i++ )
{ {
#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( x[i], expi );
#else
tmp = shl_o( x[i], expi, &Overflow ); tmp = shl_o( x[i], expi, &Overflow );
#endif
L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow ); L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow );
} }
} }
......
...@@ -75,9 +75,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q ...@@ -75,9 +75,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
Word16 flag_low_order = 0; Word16 flag_low_order = 0;
move16(); move16();
Word16 filt_len_tmp; Word16 filt_len_tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL #ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0; Flag Overflow = 0;
move32(); move32();
#endif
#endif #endif
const Resampling_cfg *cfg_ptr_fx; const Resampling_cfg *cfg_ptr_fx;
...@@ -277,7 +279,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q ...@@ -277,7 +279,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
test(); test();
IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
{ {
#ifdef ISSUE_1796_replace_shl_o
num_den = shl_sat( num_den, 1 );
#else
num_den = shl_o( num_den, 1, &Overflow ); num_den = shl_o( num_den, 1, &Overflow );
#endif
*Q_new_inp = add( *Q_new_inp, 1 ); *Q_new_inp = add( *Q_new_inp, 1 );
move16(); move16();
} }
...@@ -358,9 +364,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ ...@@ -358,9 +364,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
Word16 flag_low_order = 0; Word16 flag_low_order = 0;
move16(); move16();
Word16 filt_len_tmp; Word16 filt_len_tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL #ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0; Flag Overflow = 0;
move32(); move32();
#endif
#endif #endif
const Resampling_cfg *cfg_ptr_fx; const Resampling_cfg *cfg_ptr_fx;
...@@ -557,7 +565,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ ...@@ -557,7 +565,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
{ {
#ifdef BASOP_NOGLOB_DECLARE_LOCAL #ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifdef ISSUE_1796_replace_shl_o
num_den = shl_sat( num_den, 1 );
#else
num_den = shl_o( num_den, 1, &Overflow ); num_den = shl_o( num_den, 1, &Overflow );
#endif
#else #else
num_den = shl( num_den, 1 ); num_den = shl( num_den, 1 );
#endif #endif
......
...@@ -70,78 +70,20 @@ ...@@ -70,78 +70,20 @@
#ifndef BASOP_NOGLOB_DEV_USE_GLOBALS #ifndef BASOP_NOGLOB_DEV_USE_GLOBALS
#define BASOP_NOGLOB_DECLARE_LOCAL #define BASOP_NOGLOB_DECLARE_LOCAL
#endif #endif
#define FIX_732_MS_PERIODOG_FLOOR /* Eri: Issue-732: Dynamic range of msPeriodog leads to minimum value 1e-5 being truncated to zero. This uses the smallest non-zero value instead. */
#define FIX_867_CLDFB_NRG_SCALE
#define FIX_1737_FIX_867_CLDFB_NRG_SCALE
#define FIX_1737_proto_fac_overflow
/* Note: each compile switch (FIX_1101_...) is independent from the other ones */ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCT_ENC_V3_BE #define OPT_MCT_ENC_V3_BE
#define OPT_MCT_ENC_V3_NBE
#define OPT_MCT_ENC_V2_BE
#define OPT_BIN_REND_V2_NBE #define OPT_BIN_REND_V2_NBE
#define OPT_MCH_DEC_V1_NBE
#define OPT_MASA_DEC_V1_NBE
#define OPT_MASA_DEC_V2_NBE
#define OPT_MCT_ENC_48KB_NBE
#define OPT_MCH_DEC_V1_BE
#define OPT_MCT_ENC_V2_NBE
#define OPT_SBA_DEC_V2_NBE
#define OPT_MCT_ENC_V1_NBE
#define OPT_MCT_ENC_V1_BE
#define OPT_SBA_REND_V1_BE
#define OPT_HEAD_ROT_REND_V1_BE
#define OPT_SBA_DEC_V2_BE
#define OPT_SBA_ENC_V2_BE
#define OPT_SBA_ENC_V2_NBE
#define OPT_SBA_ENC_V1_BE
#define OPT_SBA_DEC_PATH /* Optimization made in SBA decoding path */
#define OPT_IVAS_FILTER_ROM /* Optimization made in IVAS filter table */
/* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */
//#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version. Obsoleted by MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */
//#define HARM_SCE_INIT
#define MERGE_REQUEST_1472_SPEEDUP_ivas_mc_param_enc_fx_NONBE /* FhG: reduce WMOPS of dmx calculation in ivas_param_mc_param_est_enc_fx() by using 64 Bit addition. Requires MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE. */
#define FIX_1348_BIT_PRECISION_IMPROVEMENT #define FIX_1348_BIT_PRECISION_IMPROVEMENT
#define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN #define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
#define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD #define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
#define FIX_1802
#define FIX_USAN_BASOP_UTIL_DIVIDE3232 /* Eri: Fix USAN error in BASOP_Util_Divide3232_Scale_newton by adding explicit type cast for -1 in hex */
#define FIX_1740_MISING_POP_WMOPS /* VA: fix issue 1740: missing pop_wmops() */
#define FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC /* FhG: NON-BE!!! Simplify azimuth & elevation calculations, remove parameter mismatch for divide3232, fix copy/paste error for elevation */
#define FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG /* FhG: NON-BE!!! Simplify threshold - comparison, change (wrong) Equal-comparion to (correct) Greater-Than-comparison */
#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */
#define FIX_1762_COMPILER_ISSUE /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */ #define FIX_1762_COMPILER_ISSUE_NEW /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */
#define ISSUE_1751_replace_shl_ro /*FhG: replace shl_ro by overflow-free alternatives*/ #define ISSUE_1796_replace_shl_o /* FhG: replace shl_ro by overflow-free alternatives - BE*/
#define ISSUE_1770_replace_shr_ro /* FhG: replace by non-overflow-alternative - BE */ #define ISSUE_1799_replace_L_shr_o /* FhG: replace by non-overflow-alternative - BE */
#define ISSUE_1772_replace_shr_o /* FhG: replace by non-overflow-alternative - BE */
#define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */
#define FIX_ISSUE_1792 /* FhG: fix noise bursts in binaural rendering */
/* Info for issue 1816:
* Some compilers do not automatically use 32 bit for 16x16bit products. The code "Word32 c = (Word16) a * (Word16) b;" creates then a 16-bit result, sign-extending the
* lower 16-bit of the product, any upper bits are omitted. Example: Product 0x0100 * 0x0100 results in 0x0001.0000, gets truncated to its lower bits and return 0x0000.
* The issue is fixed by simply casting one of the product operands to Word32 in lib_com/basop32.c
*/
#define FIX_ISSUE_1816_USE_W32_FOR_MPY_W16xW16 /* FhG: (QA-FIX) Use doubled data width for 16x16 product, some compilers keep 16-bit format also for products */
#define FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* FhG: (NON-BE) improve precision of multiplications with factor 0.1f, avoids overflow with up-rounded value */
#define FIX_ISSUE_1795_Q3_OVERFLOW /* FhG: Q3 overflow in function WB_BWE_gain_pred_fx (EVS legacy code) BE, MR1855 */
#define NONBE_FIX_1748_SPAR_DIV_OPT /*Dlb: issue 1748: SPAR common div optimizations*/
#define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION /* FhG: Fixed getScalefactor usage */
#define FIX_1818_WRONG_PIT_INIT /* VA: Fix wrong pitch initialization */
#define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */
...@@ -149,28 +91,42 @@ ...@@ -149,28 +91,42 @@
#define FIX_1822 #define FIX_1822
#define FIX_ISSUE_1764 /* NTT: update renorm and use abs */ #define FIX_ISSUE_1764 /* NTT: update renorm and use abs */
#define FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 1931 */
#define FIX_1844_MISSING_FREE /* FhG: add missing free in ivas_binRenderer_convModuleClose_fx() */
/* #################### Start BASOP porting switches ############################ */ /* #################### Start BASOP porting switches ############################ */
#define FIX_1372_ISAR_POST_REND #define FIX_1372_ISAR_POST_REND
#define NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */
#ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM
#endif
#define NONBE_FIX_984_OMASA_EXT_OUTPUT /* Nokia: issue #984: complete the OMASA EXT output implementation */ #define NONBE_FIX_984_OMASA_EXT_OUTPUT /* Nokia: issue #984: complete the OMASA EXT output implementation */
#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ #define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */
#define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */ #define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */
#define FIX_1052_EXT_OUTPUT /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */
#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */
#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */
#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/
#define FIX_1741_REVERB_TIMES_Q_FORMAT /* Philips: reverberation times in Q26 format instead of Q31 */ #define FIX_1741_REVERB_TIMES_Q_FORMAT /* Philips: reverberation times in Q26 format instead of Q31 */
#define FIX_1831_REVERB_REGRESSION /* Philips: fixes reverb regression issues */ #define FIX_1831_REVERB_REGRESSION /* Philips: fixes reverb regression issues */
#define FIX_1835_REVERB_ACTIVATION /* FhG: Modified reverberation activation logic and corrected factEQ calculation */ #define FIX_1835_REVERB_ACTIVATION /* FhG: Modified reverberation activation logic and corrected factEQ calculation */
#define NON_BE_FIX_EVS_USAN_ERR_IN_WAVEADJUST /* FhG: address issue 1037 */ #define LC3PLUS_LEA_COMPAT_BITRATES_48_6 /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel) */
#define FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI /* FhG: move setting of pointers for parameter decoding so they are skipped in lost frames when they are not needed */ #define NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */
#define NONBE_FIX_1056_ISM_RATE_SWITCH /* FhG: Fix #1056: fix TC buffer udpate on a ISM rate switch */ #define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */
#define NONBE_FIX_1075 /* FhG: fix segfault for bitrate switching + BINAURAL_ROOM_REVERB output in MC */ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */
#define NON_BE_FIX_1041_USE_OLD_CNG_LSPS_IF_NONSTAB /* FhG: fix bug in TD MDCT-Stereo concealment */ #define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define CONF_DISTATT /* Eri: Make distance attenuation configurable */
#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
#define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */
#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
#define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */
/* #################### End BASOP porting switches ############################ */ /* #################### End BASOP porting switches ############################ */
#define FIX_1766_TCX2ACELP_BWE_ISSUE /* VA : Fix rare BWE issue when switching from TCX to ACELP */
#endif #endif
...@@ -1242,58 +1242,19 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/ ...@@ -1242,58 +1242,19 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
bitstream_fx.c bitstream_fx.c
/========================================================================================================*/ /========================================================================================================*/
   
UWord16 get_next_indice( /* o : value of the indice */ /* o : value of the indice */
UWord16 get_next_indice_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */ Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 nb_bits /* i : number of bits that were used to quantize the indice */ Word16 nb_bits /* i : number of bits that were used to quantize the indice */
); );
   
UWord16 get_next_indice_fx( /* o : value of the indice */
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 nb_bits /* i : number of bits that were used to quantize the indice */
);
void push_indice_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
Word16 id, /* i : ID of the indice */
UWord16 value, /* i : value of the quantized indice */
Word16 nb_bits /* i : number of bits used to quantize the indice */
);
void push_next_indice_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
UWord16 value, /* i : value of the quantized indice */
Word16 nb_bits /* i : number of bits used to quantize the indice */
);
Word16 rate2EVSmode( Word16 rate2EVSmode(
const Word32 brate, /* i : bitrate */ const Word32 brate, /* i : bitrate */
Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */ Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
); );
   
void push_next_bits_fx( /* o : value of the indice */
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ UWord16 get_next_indice_1_fx(
Word16 bits[], /* i : bit buffer to pack, sequence of single bits */
Word16 nb_bits /* i : number of bits to pack */
);
UWord16 get_indice_fx( /* o : value of the indice */
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 pos, /* i : absolute position in the bitstream */
Word16 nb_bits /* i : number of bits that were used to quantize the indice */
);
UWord16 get_next_indice_1_fx( /* o : value of the indice */
Decoder_State *st_fx /* i/o: decoder state structure */
);
UWord16 get_next_indice_1( /* o : value of the indice */
Decoder_State *st_fx /* i/o: decoder state structure */
);
UWord16 get_next_indice_1_fx( /* o : value of the indice */
Decoder_State *st_fx /* i/o: decoder state structure */
);
UWord16 get_next_indice_1_fx( /* o : value of the indice */
Decoder_State *st_fx /* i/o: decoder state structure */ Decoder_State *st_fx /* i/o: decoder state structure */
); );
   
...@@ -1302,13 +1263,8 @@ void get_next_indice_tmp_fx( ...@@ -1302,13 +1263,8 @@ void get_next_indice_tmp_fx(
Word16 nb_bits /* i : number of bits that were used to quantize the indice */ Word16 nb_bits /* i : number of bits that were used to quantize the indice */
); );
   
UWord16 get_indice( /* o : value of the indice */ /* o : value of the indice */
Decoder_State *st_fx, /* i/o: decoder state structure */ UWord16 get_indice_1_fx(
Word16 pos, /* i : absolute position in the bitstream */
Word16 nb_bits /* i : number of bits that were used to quantize the indice */
);
UWord16 get_indice_1_fx( /* o : value of the indice */
Decoder_State *st_fx, /* i/o: decoder state structure */ Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 pos /* i : absolute position in the bitstream */ Word16 pos /* i : absolute position in the bitstream */
); );
...@@ -1318,41 +1274,6 @@ void reset_indices_enc_fx( ...@@ -1318,41 +1274,6 @@ void reset_indices_enc_fx(
const Word16 max_num_indices /* i : max number of indices */ const Word16 max_num_indices /* i : max number of indices */
); );
   
void reset_indices_dec_fx(
Decoder_State *st_fx /* i/o: decoder state structure */
);
void write_indices_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
FILE *file /* i : output bitstream file */
,
UWord8 *pFrame, /* i: byte array with bit packet and byte aligned coded speech data */
Word16 pFrame_size /* i: size of the binary encoded access unit [bits] */
);
void write_indices_buf_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
UWord16 *out_buf, /* i : output bitstream file */
UWord8 *pFrame, /* i: byte array with bit packet and byte aligned coded speech data */
Word16 pFrame_size, /* i: size of the binary encoded access unit [bits] */
UWord16 *num_bits );
void indices_to_serial(
const Encoder_State *st_fx, /* i: encoder state structure */
BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
UWord8 *pFrame, /* o: byte array with bit packet and byte aligned coded speech data */
Word16 *pFrame_size /* o: size of the binary encoded access unit [bits] */
);
void indices_to_serial_generic(
const Indice *ind_list, /* i: indices list */
const Word16 num_indices, /* i: number of indices to write */
UWord8 *pFrame, /* o: byte array with bit packet and byte aligned coded speech data */
Word16 *pFrame_size /* i/o: number of bits in the binary encoded access unit [bits] */
);
Word16 BRATE2IDX_fx( Word32 brate ); Word16 BRATE2IDX_fx( Word32 brate );
Word16 BRATE2IDX16k_fx( Word32 brate ); Word16 BRATE2IDX16k_fx( Word32 brate );
   
...@@ -6412,11 +6333,7 @@ void TonalMDCTConceal_Apply( ...@@ -6412,11 +6333,7 @@ void TonalMDCTConceal_Apply(
void TonalMDCTConceal_Apply_ivas_fx( void TonalMDCTConceal_Apply_ivas_fx(
TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ TonalMDCTConcealPtr hTonalMDCTConc, /*IN */
Word32 *mdctSpectrum, /*IN/OUT*/ Word32 *mdctSpectrum, /*IN/OUT*/
#ifdef OPT_SBA_DEC_V2_NBE
Word16 mdctSpectrum_exp, /*IN */ Word16 mdctSpectrum_exp, /*IN */
#else /* OPT_SBA_DEC_V2_NBE */
Word16 mdctSpectrum_exp[L_FRAME48k], /*IN */
#endif /* OPT_SBA_DEC_V2_NBE */
const PsychoacousticParameters *psychParamsCurrent ); const PsychoacousticParameters *psychParamsCurrent );
   
void TonalMDCTConceal_InsertNoise_ivas_fx( void TonalMDCTConceal_InsertNoise_ivas_fx(
...@@ -11065,11 +10982,6 @@ UWord16 get_next_indice( ...@@ -11065,11 +10982,6 @@ UWord16 get_next_indice(
Word16 nb_bits /* i : number of bits that were used to quantize the indice */ Word16 nb_bits /* i : number of bits that were used to quantize the indice */
); );
   
/*! r: value of the indice */
UWord16 get_next_indice_1(
Decoder_State *st /* i/o: decoder state structure */
);
void get_next_indice_tmp( void get_next_indice_tmp(
Decoder_State *st, /* o : decoder state structure */ Decoder_State *st, /* o : decoder state structure */
Word16 nb_bits /* i : number of bits that were used to quantize the indice */ Word16 nb_bits /* i : number of bits that were used to quantize the indice */
......
...@@ -72,7 +72,11 @@ void Residu3_lc_fx( ...@@ -72,7 +72,11 @@ void Residu3_lc_fx(
{ {
q = add( q, shift ); q = add( q, shift );
} }
#ifdef ISSUE_1796_replace_shl_o
*y++ = shl_sat( x[0], shift );
#else
*y++ = shl_o( x[0], shift, &Overflow ); *y++ = shl_o( x[0], shift, &Overflow );
#endif
move16(); move16();
FOR( i = 1; i < m; i++ ) FOR( i = 1; i < m; i++ )
......
This diff is collapsed.
...@@ -70,24 +70,6 @@ extern const Word16 sin_twiddle_table_25_5_5[25]; // Q15 ...@@ -70,24 +70,6 @@ extern const Word16 sin_twiddle_table_25_5_5[25]; // Q15
extern const Word16 cos_twiddle_table_16_8_2[16]; // Q15 extern const Word16 cos_twiddle_table_16_8_2[16]; // Q15
extern const Word16 sin_twiddle_table_16_8_2[16]; // Q15 extern const Word16 sin_twiddle_table_16_8_2[16]; // Q15
#ifndef OPT_IVAS_FILTER_ROM
extern const Word16 CLDFB80_10_fx[100]; // Q15
extern const Word16 CLDFB80_16_fx[160]; // Q15
extern const Word16 CLDFB80_20_fx[200]; // Q15
extern const Word16 CLDFB80_30_fx[300]; // Q15
extern const Word16 CLDFB80_32_fx[320]; // Q15
extern const Word16 CLDFB80_40_fx[400]; // Q15
extern const Word16 CLDFB80_60_fx[600]; // Q15
/*5ms delay*/
extern const Word16 LDQMF_10_fx[100]; // Q15
extern const Word16 LDQMF_16_fx[160]; // Q15
extern const Word16 LDQMF_20_fx[200]; // Q15
extern const Word16 LDQMF_30_fx[300]; // Q15
extern const Word16 LDQMF_32_fx[320]; // Q15
extern const Word16 LDQMF_40_fx[400]; // Q15
extern const Word16 LDQMF_60_fx[600]; // Q15
#else /* OPT_IVAS_FILTER_ROM */
extern const Word32 CLDFB80_10_fx[100]; // Q30 extern const Word32 CLDFB80_10_fx[100]; // Q30
extern const Word32 CLDFB80_16_fx[160]; // Q30 extern const Word32 CLDFB80_16_fx[160]; // Q30
...@@ -105,7 +87,6 @@ extern const Word32 LDQMF_30_fx[300]; // Q30 ...@@ -105,7 +87,6 @@ extern const Word32 LDQMF_30_fx[300]; // Q30
extern const Word32 LDQMF_32_fx[320]; // Q30 extern const Word32 LDQMF_32_fx[320]; // Q30
extern const Word32 LDQMF_40_fx[400]; // Q30 extern const Word32 LDQMF_40_fx[400]; // Q30
extern const Word32 LDQMF_60_fx[600]; // Q30 extern const Word32 LDQMF_60_fx[600]; // Q30
#endif /* OPT_IVAS_FILTER_ROM */
/* Not used anywhere /* Not used anywhere
extern const Word16 LDQMF_10_enc_fx[100]; extern const Word16 LDQMF_10_enc_fx[100];
extern const Word16 LDQMF_16_enc_fx[160]; extern const Word16 LDQMF_16_enc_fx[160];
......
...@@ -619,11 +619,7 @@ typedef struct cldfb_filter_bank_struct ...@@ -619,11 +619,7 @@ typedef struct cldfb_filter_bank_struct
Word16 da; /* delay analysis */ Word16 da; /* delay analysis */
CLDFB_PROTOTYPE prototype; CLDFB_PROTOTYPE prototype;
const Word16 *p_filter; /*!< Pointer to filter coefficients */ // Q15 const Word16 *p_filter; /*!< Pointer to filter coefficients */ // Q15
#ifdef OPT_IVAS_FILTER_ROM
const Word32 *p_filter_32; /*!< Pointer to filter coefficients */ // Q15 const Word32 *p_filter_32; /*!< Pointer to filter coefficients */ // Q15
#else /* OPT_IVAS_FILTER_ROM */
Word16 p_filter_sf; // Q0
#endif /* OPT_IVAS_FILTER_ROM */
/* rotation vectors */ /* rotation vectors */
const Word32 *rot_vec_syn_re_fx; // Q29 const Word32 *rot_vec_syn_re_fx; // Q29
......
...@@ -161,7 +161,11 @@ void stat_noise_uv_mod_fx( ...@@ -161,7 +161,11 @@ void stat_noise_uv_mod_fx(
FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR )
{ {
exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */
#ifdef ISSUE_1796_replace_shl_o
exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */
#else
exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */
#endif
PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe ); PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe );
} }
...@@ -186,7 +190,11 @@ void stat_noise_uv_mod_fx( ...@@ -186,7 +190,11 @@ void stat_noise_uv_mod_fx(
tmp_shift = norm_s( tmp_den ); tmp_shift = norm_s( tmp_den );
tmp_den = shl( tmp_den, tmp_shift ); tmp_den = shl( tmp_den, tmp_shift );
tmp_res = div_s( tmp_nom, tmp_den ); tmp_res = div_s( tmp_nom, tmp_den );
#ifdef ISSUE_1796_replace_shl_o
tmp_res = shl_sat( tmp_res, tmp_shift );
#else
tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); tmp_res = shl_o( tmp_res, tmp_shift, &Overflow );
#endif
alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) );
*act_count = 0; *act_count = 0;
...@@ -467,7 +475,11 @@ void stat_noise_uv_mod_ivas_fx( ...@@ -467,7 +475,11 @@ void stat_noise_uv_mod_ivas_fx(
FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR )
{ {
exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */ exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */
#ifdef ISSUE_1796_replace_shl_o
exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */
#else
exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */ exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */
#endif
PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe ); PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe );
} }
...@@ -492,7 +504,11 @@ void stat_noise_uv_mod_ivas_fx( ...@@ -492,7 +504,11 @@ void stat_noise_uv_mod_ivas_fx(
tmp_shift = norm_s( tmp_den ); tmp_shift = norm_s( tmp_den );
tmp_den = shl( tmp_den, tmp_shift ); tmp_den = shl( tmp_den, tmp_shift );
tmp_res = div_s( tmp_nom, tmp_den ); tmp_res = div_s( tmp_nom, tmp_den );
#ifdef ISSUE_1796_replace_shl_o
tmp_res = shl_sat( tmp_res, tmp_shift );
#else
tmp_res = shl_o( tmp_res, tmp_shift, &Overflow ); tmp_res = shl_o( tmp_res, tmp_shift, &Overflow );
#endif
alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) ); alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) );
*act_count = 0; *act_count = 0;
......
...@@ -242,25 +242,15 @@ Word16 WB_BWE_gain_pred_fx( ...@@ -242,25 +242,15 @@ Word16 WB_BWE_gain_pred_fx(
enerL = L_deposit_l( enerL_16 ); enerL = L_deposit_l( enerL_16 );
enerL = L_shl( enerL, 6 ); /*Q6 */ enerL = L_shl( enerL, 6 ); /*Q6 */
#ifdef FIX_ISSUE_1795_Q3_OVERFLOW
/* Here, we do not multiply L_tmp by 3 to avoid overflow */ /* Here, we do not multiply L_tmp by 3 to avoid overflow */
L_tmp = L_mult0( WB_fenv[0], WB_fenv[0] ); /* Q6 */ L_tmp = L_mult0( WB_fenv[0], WB_fenv[0] ); /* Q6 */
#else
/* Here, we have not enough headroom for mult with 3, so we get some overflow */
tmp1 = i_mult_sat( 3, WB_fenv[0] ); /*Q3 */
L_tmp = L_mult0( tmp1, WB_fenv[0] ); /*Q6 */
#endif
test(); test();
test(); test();
test(); test();
#ifdef FIX_ISSUE_1795_Q3_OVERFLOW
#define ONE_DIV_3 ( (Word32) 0x2AAAAAAA ) #define ONE_DIV_3 ( (Word32) 0x2AAAAAAA )
/* Here, L_tmp is not pre-multiplied with 3, we multiply enerL with 1/3 */ /* Here, L_tmp is not pre-multiplied with 3, we multiply enerL with 1/3 */
IF( GT_16( shr( enerL_16, 3 ), tmp ) && GT_32( Mpy_32_32( ONE_DIV_3, enerL ), L_tmp ) && NE_16( prev_coder_type, UNVOICED ) && WB_fenv[0] != 0 ) IF( GT_16( shr( enerL_16, 3 ), tmp ) && GT_32( Mpy_32_32( ONE_DIV_3, enerL ), L_tmp ) && NE_16( prev_coder_type, UNVOICED ) && WB_fenv[0] != 0 )
#else
IF( GT_16( shr( enerL_16, 3 ), tmp ) && GT_32( enerL, L_tmp ) && NE_16( prev_coder_type, UNVOICED ) && WB_fenv[0] != 0 )
#endif
{ {
env_var_flag = 1; env_var_flag = 1;
move16(); move16();
...@@ -605,7 +595,12 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 ...@@ -605,7 +595,12 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24
tmp1 = mult_ro( *ptr++, 8192 /*0.25 in Q15 */, &Overflow ); /* Divide by 4 */ tmp1 = mult_ro( *ptr++, 8192 /*0.25 in Q15 */, &Overflow ); /* Divide by 4 */
L_ener = L_mac0_o( L_ener, tmp1, tmp1, &Overflow ); L_ener = L_mac0_o( L_ener, tmp1, tmp1, &Overflow );
} }
#ifdef ISSUE_1799_replace_L_shr_o
/*Overflow will never happen because exp2 is always positive*/
L_ener = L_shr( L_ener, exp2 );
#else
L_ener = L_shr_o( L_ener, exp2, &Overflow ); L_ener = L_shr_o( L_ener, exp2, &Overflow );
#endif
L_temp = L_add_o( L_ener_tot, L_ener, &Overflow ); L_temp = L_add_o( L_ener_tot, L_ener, &Overflow );
IF( Overflow != 0 ) IF( Overflow != 0 )
{ {
......
...@@ -2338,7 +2338,11 @@ void ton_ene_est_fx( ...@@ -2338,7 +2338,11 @@ void ton_ene_est_fx(
move16(); move16();
/* 0.06=15729(Q18) */ /* 0.06=15729(Q18) */
exp_shift = sub( 18, QE_r ); exp_shift = sub( 18, QE_r );
#ifdef ISSUE_1796_replace_shl_o
E_r_shift_fx = shl_sat( E_r_fx, exp_shift );
#else
E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow );
#endif
IF( LT_16( E_r_shift_fx, 15729 ) ) /* E_r < 0.06 */ IF( LT_16( E_r_shift_fx, 15729 ) ) /* E_r < 0.06 */
{ {
/* avg_pe[k] = (float) sqrt(pow(2.0f,band_energy[i])/band_width[i]); */ /* avg_pe[k] = (float) sqrt(pow(2.0f,band_energy[i])/band_width[i]); */
...@@ -3209,9 +3213,11 @@ void noiseinj_hf_fx( ...@@ -3209,9 +3213,11 @@ void noiseinj_hf_fx(
Word16 exp_normn, exp_normd; Word16 exp_normn, exp_normd;
Word16 div_fx; Word16 div_fx;
Word16 Qdiv; Word16 Qdiv;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL #ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0; Flag Overflow = 0;
move32(); move32();
#endif
#endif #endif
set16_fx( map_pulse_t_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); set16_fx( map_pulse_t_fx, 0, band_end_fx[BANDS_fx - 1] + 1 );
set16_fx( map_pulse_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); set16_fx( map_pulse_fx, 0, band_end_fx[BANDS_fx - 1] + 1 );
...@@ -3246,7 +3252,11 @@ void noiseinj_hf_fx( ...@@ -3246,7 +3252,11 @@ void noiseinj_hf_fx(
move32(); move32();
/**p_L_En = (float)sqrt(*p_En);*/ /**p_L_En = (float)sqrt(*p_En);*/
sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp );
#ifdef ISSUE_1796_replace_shl_o
*p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */
#else
*p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */
#endif
move16(); move16();
} }
p_L_En++; p_L_En++;
...@@ -3316,7 +3326,11 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) ...@@ -3316,7 +3326,11 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ )
/* SQRT Part */ /* SQRT Part */
sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp );
#ifdef ISSUE_1796_replace_shl_o
ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) );
#else
ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow );
#endif
ni_scale_fx = s_min( 20408, ni_scale_fx ); /* 1.25=20408.0(Q14) */ ni_scale_fx = s_min( 20408, ni_scale_fx ); /* 1.25=20408.0(Q14) */
ni_scale_fx = s_max( 12288, ni_scale_fx ); /* 0.75=12288.0(Q14) */ ni_scale_fx = s_max( 12288, ni_scale_fx ); /* 0.75=12288.0(Q14) */
......
...@@ -996,7 +996,9 @@ static void filt_mu_fx( ...@@ -996,7 +996,9 @@ static void filt_mu_fx(
Word16 mu, ga, temp; Word16 mu, ga, temp;
const Word16 *ptrs; const Word16 *ptrs;
Word16 tmp, exp; Word16 tmp, exp;
#ifndef ISSUE_1796_replace_shl_o
Flag Overflow = 0; Flag Overflow = 0;
#endif
move32(); move32();
...@@ -1038,7 +1040,11 @@ static void filt_mu_fx( ...@@ -1038,7 +1040,11 @@ static void filt_mu_fx(
{ {
temp = mult_r( mu, ( *ptrs++ ) ); temp = mult_r( mu, ( *ptrs++ ) );
temp = add_sat( temp, *ptrs ); /*Q12 */ temp = add_sat( temp, *ptrs ); /*Q12 */
#ifdef ISSUE_1796_replace_shl_o
sig_out[n] = shl_sat( mult_r( ga, temp ), 1 );
#else
sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow );
#endif
move16(); /*Q12 */ move16(); /*Q12 */
} }
...@@ -1537,7 +1543,11 @@ void GenShapedWBExcitation_ivas_fx( ...@@ -1537,7 +1543,11 @@ void GenShapedWBExcitation_ivas_fx(
n1 = norm_s( max_val ); n1 = norm_s( max_val );
FOR( i = 0; i < L_FRAME16k / 4; i++ ) FOR( i = 0; i < L_FRAME16k / 4; i++ )
{ {
#ifdef ISSUE_1796_replace_shl_o
excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); // Q_bwe_exc + n1
#else
excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1 excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1
#endif
move16(); /* Q14 */ move16(); /* Q14 */
} }
n1 = sub( sub( 14, n1 ), Q_bwe_exc ); n1 = sub( sub( 14, n1 ), Q_bwe_exc );
...@@ -1620,7 +1630,11 @@ void GenShapedWBExcitation_ivas_fx( ...@@ -1620,7 +1630,11 @@ void GenShapedWBExcitation_ivas_fx(
{ {
/*tmp_vfac = 2*voice_factors[i]; /*tmp_vfac = 2*voice_factors[i];
tmp_vfac = min(1, tmp_vfac);*/ tmp_vfac = min(1, tmp_vfac);*/
#ifdef ISSUE_1796_replace_shl_o
tmp_vfac = shl_sat( voice_factors[i], 1 );
#else
tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); tmp_vfac = shl_o( voice_factors[i], 1, &Overflow );
#endif
} }
ELSE ELSE
{ {
...@@ -1789,7 +1803,11 @@ void GenShapedWBExcitation_fx( ...@@ -1789,7 +1803,11 @@ void GenShapedWBExcitation_fx(
n1 = norm_s( max_val ); n1 = norm_s( max_val );
FOR( i = 0; i < L_FRAME16k / 4; i++ ) FOR( i = 0; i < L_FRAME16k / 4; i++ )
{ {
#ifdef ISSUE_1796_replace_shl_o
excTmp2_frac[i] = shl_sat( excTmp2[i], n1 );
#else
excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow );
#endif
move16(); /* Q14 */ move16(); /* Q14 */
} }
n1 = sub( sub( 14, n1 ), Q_bwe_exc ); n1 = sub( sub( 14, n1 ), Q_bwe_exc );
...@@ -1874,7 +1892,11 @@ void GenShapedWBExcitation_fx( ...@@ -1874,7 +1892,11 @@ void GenShapedWBExcitation_fx(
{ {
/*tmp_vfac = 2*voice_factors[i]; /*tmp_vfac = 2*voice_factors[i];
tmp_vfac = min(1, tmp_vfac);*/ tmp_vfac = min(1, tmp_vfac);*/
#ifdef ISSUE_1796_replace_shl_o
tmp_vfac = shl_sat( voice_factors[i], 1 );
#else
tmp_vfac = shl_o( voice_factors[i], 1, &Overflow ); tmp_vfac = shl_o( voice_factors[i], 1, &Overflow );
#endif
} }
ELSE ELSE
{ {
...@@ -5776,7 +5798,11 @@ void non_linearity_fx( ...@@ -5776,7 +5798,11 @@ void non_linearity_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) ); tmp = extract_l( Pow2( 14, frac ) );
#ifdef ISSUE_1796_replace_shl_o
scale_step = shl_sat( tmp, exp ); /* Q14 */
#else
scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */
#endif
} }
} }
...@@ -5854,7 +5880,11 @@ void non_linearity_fx( ...@@ -5854,7 +5880,11 @@ void non_linearity_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) ); tmp = extract_l( Pow2( 14, frac ) );
#ifdef ISSUE_1796_replace_shl_o
scale_step = shl_sat( tmp, exp ); /*Q14 */
#else
scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */
#endif
} }
} }
...@@ -6028,7 +6058,11 @@ void non_linearity_ivas_fx( ...@@ -6028,7 +6058,11 @@ void non_linearity_ivas_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) ); tmp = extract_l( Pow2( 14, frac ) );
#ifdef ISSUE_1796_replace_shl_o
scale_step = shl_sat( tmp, exp ); /* Q14 */
#else
scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */ scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */
#endif
} }
} }
...@@ -6106,7 +6140,11 @@ void non_linearity_ivas_fx( ...@@ -6106,7 +6140,11 @@ void non_linearity_ivas_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) ); tmp = extract_l( Pow2( 14, frac ) );
#ifdef ISSUE_1796_replace_shl_o
scale_step = shl_sat( tmp, exp ); /*Q14 */
#else
scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */ scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */
#endif
} }
} }
...@@ -7043,7 +7081,11 @@ void prep_tbe_exc_fx( ...@@ -7043,7 +7081,11 @@ void prep_tbe_exc_fx(
tmp = MAX_16; tmp = MAX_16;
move16(); move16();
#ifdef ISSUE_1796_replace_shl_o
pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */
#else
pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */ pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */
#endif
test(); test();
test(); test();
...@@ -7156,8 +7198,10 @@ Word16 swb_formant_fac_fx( ...@@ -7156,8 +7198,10 @@ Word16 swb_formant_fac_fx(
{ {
Word16 formant_fac; Word16 formant_fac;
Word16 tmp; Word16 tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL #ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0; Flag Overflow = 0;
#endif
#endif #endif
/* Smoothen tilt value */ /* Smoothen tilt value */
...@@ -7185,7 +7229,11 @@ Word16 swb_formant_fac_fx( ...@@ -7185,7 +7229,11 @@ Word16 swb_formant_fac_fx(
/* formant_fac = 1.0f - 0.5f*formant_fac */ /* formant_fac = 1.0f - 0.5f*formant_fac */
tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */ tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */
#ifdef ISSUE_1796_replace_shl_o
formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 );
#else
formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow ); formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow );
#endif
return formant_fac; /*Q15 */ return formant_fac; /*Q15 */
} }
......
This diff is collapsed.