Skip to content
......@@ -1207,13 +1207,8 @@ static Word32 FIRLattice(
move32();
FOR( i = 0; i < order - 1; i++ )
{
#ifdef OPT_MCT_ENC_V1_BE
tmp = Madd_32_16( state[i], x, parCoeff[i] ); /*Q0*/
x = Madd_32_16( x, state[i], parCoeff[i] ); /* exponent: 31+0 */
#else
tmp = L_add( state[i], Mpy_32_16_1( x, parCoeff[i] ) ); /*Q0*/
x = L_add( x, Mpy_32_16_1( state[i], parCoeff[i] ) ); /* exponent: 31+0 */
#endif
state[i] = tmpSave; /*Q0*/
move32();
tmpSave = tmp; /*Q0*/
......@@ -1221,11 +1216,7 @@ static Word32 FIRLattice(
}
/* last stage: only need half operations */
#ifdef OPT_MCT_ENC_V1_BE
x = Madd_32_16( x, state[order - 1], parCoeff[order - 1] ); /*Q0*/
#else
x = L_add( x, Mpy_32_16_1( state[order - 1], parCoeff[order - 1] ) ); /*Q0*/
#endif
state[order - 1] = tmpSave; /*Q0*/
move32();
......
......@@ -687,11 +687,7 @@ 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 );
......@@ -721,11 +717,7 @@ 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 );
......
......@@ -317,7 +317,11 @@ Word16 usquant_fx( /* o: index of the winning codeword */
exp = norm_s( delta );
tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */
L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */
#ifdef ISSUE_1796_replace_shl_o
idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */
#else
idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */
#endif
idx = s_min( idx, sub( cbsize, 1 ) );
idx = s_max( idx, 0 );
......@@ -680,9 +684,11 @@ void Copy_Scale_sig(
{
Word16 i;
Word16 tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
IF( exp0 == 0 )
{
......@@ -705,7 +711,11 @@ void Copy_Scale_sig(
}
FOR( i = 0; i < lg; i++ )
{
#ifdef ISSUE_1796_replace_shl_o
y[i] = shl_sat( x[i], exp0 );
#else
y[i] = shl_o( x[i], exp0, &Overflow );
#endif
move16(); /* saturation can occur here */
}
}
......@@ -723,10 +733,12 @@ void Copy_Scale_sig_16_32_DEPREC(
{
Word16 i;
Word16 tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
IF( exp0 == 0 )
......@@ -743,7 +755,11 @@ void Copy_Scale_sig_16_32_DEPREC(
/*Should not happen */
FOR( i = 0; i < lg; i++ )
{
#ifdef ISSUE_1796_replace_shl_o
y[i] = L_deposit_l( shl_sat( x[i], exp0 ) );
#else
y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) );
#endif
move32();
}
return;
......@@ -756,7 +772,11 @@ void Copy_Scale_sig_16_32_DEPREC(
#else
assert( exp0 < 16 );
#endif
#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( 1, exp0 );
#else
tmp = shl_o( 1, exp0, &Overflow );
#endif
FOR( i = 0; i < lg; i++ )
{
y[i] = L_mult0( x[i], tmp );
......@@ -793,7 +813,11 @@ void Copy_Scale_sig_16_32_no_sat(
/*Should not happen */
FOR( i = 0; i < lg; i++ )
{
#ifdef ISSUE_1796_replace_shl_o
y[i] = L_deposit_l( shl_sat( x[i], exp0 ) );
#else
y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) );
#endif
move32();
}
return;
......@@ -2448,7 +2472,11 @@ Word32 root_a_over_b_fx(
exp_den = sub( sub( 30, exp_den ), Q_a );
scale = shr( sub( den, num ), 15 );
#ifdef ISSUE_1796_replace_shl_o
num = shl_sat( num, scale );
#else
num = shl_o( num, scale, &Overflow );
#endif
exp_num = sub( exp_num, scale );
tmp = div_s( num, den );
......@@ -3124,11 +3152,7 @@ void add_vec_fx(
{
FOR( i = 0; i < N; i++ )
{
#ifdef ISSUE_1770_replace_shr_ro
y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow );
#else
y[i] = add_o( x1[i], shr_ro( x2[i], Qyx2, &Overflow ), &Overflow );
#endif
move16();
}
}
......@@ -3136,11 +3160,7 @@ void add_vec_fx(
{
FOR( i = 0; i < N; i++ )
{
#ifdef ISSUE_1770_replace_shr_ro
y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow );
#else
y[i] = add_o( shr_ro( x1[i], Qyx1, &Overflow ), shr_ro( x2[i], Qyx2, &Overflow ), &Overflow );
#endif
move16();
}
}
......@@ -3280,8 +3300,12 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy)
temp = mult_ro( *signal++, 16384, &Overflow );
L_temp = L_mac0_o( L_temp, temp, temp, &Overflow );
}
#ifdef ISSUE_1799_replace_L_shr_o
/*Overfloe will never happen because temp2 is always positive*/
L_temp = L_shr( L_temp, temp2 );
#else
L_temp = L_shr_o( L_temp, temp2, &Overflow );
#endif
/* Here we try the addition just to check if we can sum
the energy of the small (8 Iterations) loop with the
total energy calculated so far without an overflow.
......
......@@ -359,7 +359,11 @@ static Word16 DTFS_alignment_weight_fx(
}
temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */
#ifdef ISSUE_1796_replace_shl_o
wcorr_fx = L_mult_o( temp1, shl_sat( temp, 2 ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */
#else
wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */
#endif
IF( GE_16( Qmaxcorr, Qcorr ) )
{
diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */
......@@ -1266,9 +1270,17 @@ void DTFS_zeroFilter_fx(
/* bring to the same Q */
FOR( k = 0; k <= HalfLag; k++ )
{
#ifdef ISSUE_1796_replace_shl_o
X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) );
#else
X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow );
#endif
move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */
#ifdef ISSUE_1796_replace_shl_o
X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) );
#else
X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow );
#endif
move16(); /* Q(Q+Qmin) */
}
......@@ -2105,7 +2117,11 @@ static void cubicPhase_fx(
fracb = negate( fracb );
}
scale = shr( sub( fracb, fraca ), 15 );
#ifdef ISSUE_1796_replace_shl_o
fraca = shl_sat( fraca, scale );
#else
fraca = shl_o( fraca, scale, &Overflow );
#endif
expa = sub( expa, scale );
tmp = div_s( fraca, fracb ); /* 15-exp */
......@@ -3491,7 +3507,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W
scale = shr( sub( fraca, fracb ), 15 );
#ifdef ISSUE_1796_replace_shl_o
fracb = shl_sat( fracb, scale );
#else
fracb = shl_o( fracb, scale, &Overflow );
#endif
expb = sub( expb, scale );
tmp = div_s( fracb, fraca );
......@@ -3525,7 +3545,11 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W
scale = shr( sub( fraca, fracb ), 15 );
#ifdef ISSUE_1796_replace_shl_o
fracb = shl_sat( fracb, scale );
#else
fracb = shl_o( fracb, scale, &Overflow );
#endif
expb = sub( expb, scale );
tmp = div_s( fracb, fraca );
......
......@@ -63,7 +63,11 @@ void ham_cos_window(
FOR( i = n1; i < n1 + n2; i++ )
{
/* fh_f[i] = (Float32)cos(cc); */
#ifdef ISSUE_1796_replace_shl_o
fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/
#else
fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/
#endif
move16();
cc = L_add( cc, cte );
}
......
......@@ -43,9 +43,11 @@ static void Regression_Anal_fx(
Word32 L_tmp1, L_tmp2;
Word16 aindex_fx[MAX_PGF + 1]; // Q0
Word32 b_p_fx[MAX_PGF + 1]; // Q10
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
/* Initialize */
......@@ -78,7 +80,11 @@ static void Regression_Anal_fx(
{
b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */
move32();
#ifdef ISSUE_1796_replace_shl_o
b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */
#else
b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */
#endif
move32();
}
......@@ -162,9 +168,11 @@ void HQ_FEC_processing_fx(
Word16 energy_diff_fx; // Q10
HQ_NBFEC_HANDLE hHQ_nbfec;
HQ_DEC_HANDLE hHQ_core;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
hHQ_nbfec = st_fx->hHQ_nbfec;
hHQ_core = st_fx->hHQ_core;
......@@ -382,7 +390,11 @@ void HQ_FEC_processing_fx(
FOR( j = 0; j < Num_bands_p[i]; j++ )
{
#ifdef ISSUE_1796_replace_shl_o
hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 );
#else
hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow );
#endif
move16();
k = add( k, 1 );
}
......@@ -518,7 +530,11 @@ void ivas_HQ_FEC_Mem_update_fx(
L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/
k = add( k, 1 );
}
#ifdef ISSUE_1796_replace_shl_o
tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/
#else
tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/
#endif
norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/
move32();
tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/
......@@ -638,11 +654,7 @@ void ivas_HQ_FEC_Mem_update_fx(
exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] );
tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) );
exp = add( 15, sub( exp1, exp2 ) );
#ifdef ISSUE_1772_replace_shr_o
*mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow );
#else
*mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow );
#endif
move16();
}
*mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] );
......@@ -807,7 +819,11 @@ void HQ_FEC_Mem_update_fx(
L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/
k = add( k, 1 );
}
#ifdef ISSUE_1796_replace_shl_o
tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/
#else
tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/
#endif
norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/
move32();
tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/
......@@ -928,11 +944,7 @@ void HQ_FEC_Mem_update_fx(
exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] );
tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) );
exp = add( 15, sub( exp1, exp2 ) );
#ifdef ISSUE_1772_replace_shr_o
*mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow );
#else
*mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow );
#endif
move16();
}
*mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] );
......@@ -1003,9 +1015,11 @@ static Word16 find_best_delay_fx(
Word32 min_sq_cross_fx, min_corr_fx;
Word32 accA_fx, accB_fx;
Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC];
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
move16(); // d1m
......@@ -1072,7 +1086,11 @@ static Word16 find_best_delay_fx(
L_tmp1 = L_shl( min_sq_cross_fx, exp1 );
L_tmp2 = L_shl( min_corr_fx, exp2 );
tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */
#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */
#else
tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */
#endif
}
*false_flag = 0;
......
......@@ -1164,12 +1164,6 @@ static Word16 imax_fx( /* o: The location, relative to the
Word16 y1, y2, y3, man, expo, edge;
const Word16 *pY;
Word32 numer, denom, sign, acc, y3_y1;
#ifndef ISSUE_1772_replace_shr_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
/* Seek the extremum of the parabola P(x) defined by 3 consecutive points
so that P([-1 0 1]) = [y1 y2 y3] */
pY = y;
......@@ -1203,11 +1197,7 @@ static Word16 imax_fx( /* o: The location, relative to the
/* Although the output of ratio() is in Q14, adding the missing factor of 2 (See above)
* in the denominator, the output is now considered to be in Q15. */
man = ratio( numer, denom, &expo ); /* The mantissa is considered in Q15 */
#ifdef ISSUE_1772_replace_shr_o
posi = shr_sat( man, expo ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */
#else
posi = shr_o( man, expo, &Overflow ); /* in Q15 (Due to saturation, it is automatically bound inside [-1.0,1.0].) */
#endif
if ( sign < 0 ) /* Restore the sign. */
{
posi = negate( posi );
......
......@@ -126,7 +126,11 @@ void FEC_exc_estim_fx(
gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */
}
#ifdef ISSUE_1796_replace_shl_o
tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 );
#else
tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow );
#endif
gainCNG = s_min( gainCNG, tmp1 );
set16_fx( exc_dct_in, 0, L_FRAME16k );
......@@ -187,9 +191,15 @@ void FEC_exc_estim_fx(
{
test();
test();
#ifdef ISSUE_1796_replace_shl_o
IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&
GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
#else
IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) &&
GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
#endif
{
/* take the pitch value of last subframe of the previous frame */
*tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) );
......@@ -200,9 +210,16 @@ void FEC_exc_estim_fx(
{
test();
test();
#ifdef ISSUE_1796_replace_shl_o
IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&
GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
#else
IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) &&
GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
#endif
{
/* take the pitch value of last subframe of the previous frame */
*tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) );
......@@ -751,9 +768,11 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1
{
Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e;
Word32 tmp_pit2;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
tmp_pit = BASOP_Util_Divide1616_Scale( new_pit /*Q0*/, Tc /*Q0*/, &tmp_pit_e ) /*Q15*/;
......@@ -763,7 +782,11 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1
tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/
BASOP_SATURATE_WARNING_OFF_EVS
/*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/
#ifdef ISSUE_1796_replace_shl_o
tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e );
#else
tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow );
#endif
BASOP_SATURATE_WARNING_ON_EVS
*cond1 = sub( tmp_pit, negate( tmp_frame ) );
move16();
......
......@@ -599,7 +599,11 @@ static void spectrum_mod_dct_fx(
Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/
e_binE = sub( add( e_tmp, e_binE ), 15 );
#ifdef ISSUE_1799_replace_L_shr_o
Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/
#else
Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/
#endif
Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/
}
......@@ -901,8 +905,10 @@ static Word16 norm_lfe(
{
Word32 Ltmp;
Word16 exp2, tmp16, exp3;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
#endif
move32();
......@@ -923,7 +929,11 @@ static Word16 norm_lfe(
exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */
/* Need to shl by 3 to take into account the 3 multiplications */
}
#ifdef ISSUE_1796_replace_shl_o
tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */
#else
tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */
#endif
return tmp16;
}
......
......@@ -872,10 +872,12 @@ static void decod_gen_voic_core_switch_fx(
Word16 *pt1;
GSC_DEC_HANDLE hGSCDec;
hGSCDec = st_fx->hGSCDec;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
#endif
#endif
/*----------------------------------------------------------------------*
......@@ -966,7 +968,11 @@ static void decod_gen_voic_core_switch_fx(
IF( st_fx->prev_bfi )
{
/*gain_code = min(gain_code, 0.5f*gain_code+0.5f*st->lp_gainc);*/
#ifdef ISSUE_1796_replace_shl_o
gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_sat( 16384 >> 3, st_fx->Q_exc ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */
#else
gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_o( 16384 >> 3, st_fx->Q_exc, &Overflow ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */
#endif
}
FOR( i = 0; i < L_SUBFR; i++ )
......
......@@ -1287,7 +1287,11 @@ void open_decoder_LPD_ivas_fx(
st->inv_gamma = GAMMA16k_INV;
move16();
}
#ifdef NONBE_FIX_1028_1DB_TCX_LEVEL_DROP
ELSE IF( GT_16( st->element_mode, EVS_MONO ) && GT_32( st->sr_core, INT_FS_16k ) )
#else
ELSE IF( GT_32( st->sr_core, INT_FS_16k ) && EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
#endif
{
st->gamma = GAMMA16k;
move16();
......
......@@ -718,20 +718,12 @@ void decoder_LPD_fx(
FOR( k = 0; k < 2; k++ )
{
#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI
/* Set pointer to parameters */
prm = param + ( k * DEC_NPRM_DIV );
/* Stability Factor */
#endif
IF( bfi == 0 )
{
#ifdef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI
/* Set pointer to parameters */
prm = param + ( k * DEC_NPRM_DIV );
/* Stability Factor */
#endif
st->stab_fac_fx = lsf_stab_fx( &lsf[( ( k + 1 ) ) * M], &lsf[k * M], 0, L_FRAME );
move16();
}
......
......@@ -463,20 +463,11 @@ ivas_error decod_gen_voic_fx(
test();
test();
test();
#ifdef ISSUE_1751_replace_shl_ro
IF( GT_16( shr_r_sat( enratio, sub( Qenratio, 15 ) ), 8192 ) && /*compare with 0.25 in Q15*/
LT_16( shr_r_sat( enratio, sub( Qenratio, 10 ) ), 15360 ) && /*compare with 15.0 in Q10*/
GT_16( shr_r_sat( sp_enratio, sub( Qsp_enratio, 15 ) ), 4915 ) && /*compare with 0.15 in Q15*/
LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/
LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/
#else
Flag Overflow;
IF( GT_16( shl_ro( enratio, sub( 15, Qenratio ), &Overflow ), 8192 ) && /*compare with 0.25 in Q15*/
LT_16( shl_ro( enratio, sub( 10, Qenratio ), &Overflow ), 15360 ) && /*compare with 15.0 in Q10*/
GT_16( shl_ro( sp_enratio, sub( 15, Qsp_enratio ), &Overflow ), 4915 ) && /*compare with 0.15 in Q15*/
LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/
LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/
#endif
{
IF( NE_32( ( error = DTFS_new_fx( &PREVP ) ), IVAS_ERR_OK ) )
{
......
......@@ -30,9 +30,11 @@ void transf_cdbk_dec_fx(
Word32 L_tmp;
Word32 dct_code32[L_SUBFR];
Word16 qdct;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
Word16 avq_bit_sFlag;
Word16 trgtSvPos;
......@@ -142,7 +144,11 @@ void transf_cdbk_dec_fx(
}
FOR( i = 0; i < L_SUBFR; i++ )
{
#ifdef ISSUE_1796_replace_shl_o
code_preQ[i] = shl_sat( code_preQ[i], q_Code_preQ );
#else
code_preQ[i] = shl_o( code_preQ[i], q_Code_preQ, &Overflow );
#endif
move16(); /* code_preQ in Q6*/
}
......
......@@ -73,9 +73,11 @@ void dec_pit_exc_fx(
Word16 use_fcb;
Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */
Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes */
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
use_fcb = 0;
......@@ -248,7 +250,11 @@ void dec_pit_exc_fx(
gain_pit_fx = st_fx->lp_gainp_fx;
move16();
}
#ifdef ISSUE_1796_replace_shl_o
gain_code_fx = L_mult0( s_max( sub( 32767, shl_sat( gain_pit_fx, 1 ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/
#else
gain_code_fx = L_mult0( s_max( sub( 32767, shl_o( gain_pit_fx, 1, &Overflow ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/
#endif
}
/*----------------------------------------------------------------------*
......
......@@ -493,7 +493,7 @@ static void modify_pst_param_fx(
Word16 tmp;
Word16 lp_noiseQ12;
Word32 L_tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef ISSUE_1796_replace_shl_o
Flag Overflow = 0;
move16();
#endif
......@@ -502,7 +502,11 @@ static void modify_pst_param_fx(
test();
IF( NE_16( coder_type, INACTIVE ) && LT_16( lp_noise, LP_NOISE_THR_FX ) )
{
#ifdef ISSUE_1796_replace_shl_o
lp_noiseQ12 = shl_sat( lp_noise, 4 ); /* to go from Q8 to Q12 */
#else
lp_noiseQ12 = shl_o( lp_noise, 4, &Overflow ); /* to go from Q8 to Q12 */
#endif
/* ftmp = lp_noise*BG1_FX + CG1_FX */
tmp = mac_r( CG1_FX * 65536L, lp_noiseQ12, BG1_FX * 8 ); /* x8 to go from Q12 to Q15 */
......
......@@ -3044,16 +3044,10 @@ void IMDCT_ivas_fx(
Word32 fac;
// fac = shl_sat( mult_r( extract_h( L_shr_sat( hTcxDec->conceal_eof_gain32, sub( 1, hTcxDec->conceal_eof_gain_e ) ) ), st->last_concealed_gain_syn_deemph ), 1 );
fac = Mpy_32_16_1( hTcxDec->conceal_eof_gain32, st->last_concealed_gain_syn_deemph ); // q = 31 - hTcxDec->conceal_eof_gain_e - last_concealed_gain_syn_deemph_e
#ifdef OPT_SBA_DEC_V2_BE
Word16 eff_e = add( hTcxDec->conceal_eof_gain_e, st->last_concealed_gain_syn_deemph_e );
#endif /* OPT_SBA_DEC_V2_BE */
FOR( Word16 ind = 0; ind < overlap; ind++ )
{
#ifdef OPT_SBA_DEC_V2_BE
old_syn_overl_fx[ind] = extract_h( L_shl_sat( Mpy_32_16_1( fac, old_syn_overl_fx[ind] ), eff_e ) ); // Q(-2)
#else /* OPT_SBA_DEC_V2_BE */
old_syn_overl_fx[ind] = extract_h( L_shl_sat( Mpy_32_16_1( fac, old_syn_overl_fx[ind] ), add( hTcxDec->conceal_eof_gain_e, st->last_concealed_gain_syn_deemph_e ) ) ); // Q(-2)
#endif /* OPT_SBA_DEC_V2_BE */
move16();
}
}
......@@ -3464,11 +3458,7 @@ void IMDCT_ivas_fx(
// sub( q_xn_buf_fx_32, q_win ) == 16 - L_norm_arr( xn_buf_fx_32, L_frame )
// q_xn_buf_fx_32 - q_win == 16 - L_norm_arr( xn_buf_fx_32, L_frame )
// q_win == - 16 + L_norm_arr( xn_buf_fx_32, L_frame ) + q_xn_buf_fx_32
#ifdef FIX_1802
q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), sub( L_norm_arr( xn_buf_fx_32 + ( overlap / 2 ) + nz, L_frame ), 2 ) ) );
#else
q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), L_norm_arr( xn_buf_fx_32, L_frame ) ) - 2 );
#endif
}
IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag );
#endif
......@@ -4411,15 +4401,11 @@ void decoder_tcx_invQ_fx(
tnsSize = 0;
move16();
#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI
prm_target = NULL; /* just to suppress MSVC warnigs */
#else
/* just to suppress MSVC warnigs */
prm_target = NULL;
prm_ltp = NULL;
prm_tns = NULL;
prm_sqQ = NULL;
#endif
/*-----------------------------------------------------------------*
* Initializations
......@@ -4443,10 +4429,6 @@ void decoder_tcx_invQ_fx(
move16();
}
#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI
prm_ltp = &prm[1 + NOISE_FILL_RANGES];
prm_tns = prm_ltp + LTPSIZE;
#endif
gainCompensate = ONE_IN_Q14;
move16();
......@@ -4462,10 +4444,8 @@ void decoder_tcx_invQ_fx(
IF( !bfi )
{
#ifdef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI
prm_ltp = &prm[1 + NOISE_FILL_RANGES];
prm_tns = prm_ltp + LTPSIZE;
#endif
index = prm[0];
move16();
......@@ -4487,11 +4467,6 @@ void decoder_tcx_invQ_fx(
move16();
}
#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI
prm_hm = prm_tns + tnsSize;
prm_sqQ = prm_hm + NPRM_CTX_HM;
*prm_sqQ1 = prm_sqQ;
#endif
/*-----------------------------------------------------------*
* Spectrum data *
......@@ -4499,11 +4474,9 @@ void decoder_tcx_invQ_fx(
IF( !bfi )
{
#ifdef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI
prm_hm = prm_tns + tnsSize;
prm_sqQ = prm_hm + NPRM_CTX_HM;
*prm_sqQ1 = prm_sqQ;
#endif
/*-----------------------------------------------------------*
* Context HM *
*-----------------------------------------------------------*/
......@@ -5455,16 +5428,10 @@ void decoder_tcx_noiseshaping_igf_fx(
{
/* If the exponent on the spec side (i>L_frame) is lesser, then shift all the values in the
spec side by the difference to make both sides have the same exponent. */
#ifdef OPT_SBA_DEC_V2_BE
Word16 diff_e = sub( frame_side_x_e, spec_side_x_e );
#endif /* OPT_SBA_DEC_V2_BE */
FOR( i = L_frame; i < L_spec; i++ )
{
#ifdef OPT_SBA_DEC_V2_BE
x_fx[i] = L_shr( x_fx[i], diff_e );
#else /* OPT_SBA_DEC_V2_BE */
x_fx[i] = L_shr( x_fx[i], sub( frame_side_x_e, spec_side_x_e ) );
#endif /* OPT_SBA_DEC_V2_BE */
move32();
}
}
......@@ -5472,16 +5439,10 @@ void decoder_tcx_noiseshaping_igf_fx(
{
/* If the exponent on the spec side (i>L_frame) is greater, then shift all the values in the
frame side (i<L_frame) by the difference to make both sides have the same exponent. */
#ifdef OPT_SBA_DEC_V2_BE
Word16 diff_e = sub( spec_side_x_e, frame_side_x_e );
#endif /* OPT_SBA_DEC_V2_BE */
FOR( i = 0; i < L_frame; i++ )
{
#ifdef OPT_SBA_DEC_V2_BE
x_fx[i] = L_shr( x_fx[i], diff_e );
#else /* OPT_SBA_DEC_V2_BE */
x_fx[i] = L_shr( x_fx[i], sub( spec_side_x_e, frame_side_x_e ) );
#endif /* OPT_SBA_DEC_V2_BE */
move32();
}
}
......@@ -5496,34 +5457,9 @@ void decoder_tcx_noiseshaping_igf_fx(
test();
IF( bfi && st->tonal_mdct_plc_active && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
{
#ifndef OPT_SBA_DEC_V2_NBE
Word16 tmp_x_fx_exp[L_FRAME48k], temp;
temp = -MAX_16;
move16();
set16_fx( tmp_x_fx_exp, *x_e, L_frameTCX );
TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx, tmp_x_fx_exp, st->hTcxCfg->psychParamsCurrent );
#else /* OPT_SBA_DEC_V2_NBE */
TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx, *x_e, st->hTcxCfg->psychParamsCurrent );
#endif /* OPT_SBA_DEC_V2_NBE */
/* If exponent has been updated after TonalMDCTConceal_Apply, then shift the spectrum to common exponent. */
#ifndef OPT_SBA_DEC_V2_NBE
FOR( i = 0; i < L_frameTCX; i++ )
{
temp = s_max( temp, tmp_x_fx_exp[i] );
}
{
*x_e = temp;
move16();
FOR( i = 0; i < L_frameTCX; i++ )
{
x_fx[i] = L_shr( x_fx[i], sub( temp, tmp_x_fx_exp[i] ) );
move32();
}
}
#endif /* OPT_SBA_DEC_V2_NBE */
}
test();
......
......@@ -1766,11 +1766,7 @@ void con_tcx_ivas_fx(
alpha_inv = sub( 16384 /*Q.0f in Q14*/, alpha_delayed ); /*Q14*/
#ifdef NON_BE_FIX_1041_USE_OLD_CNG_LSPS_IF_NONSTAB
E_LPC_a_lsp_conversion( A_local, lsp_local, st->lspold_cng, M );
#else
E_LPC_a_lsp_conversion( A_local, lsp_local, lsp_local, M );
#endif
FOR( i = 0; i < M; i++ )
{
......
......@@ -44,16 +44,22 @@ void minimumStatistics_fx(
Word16 f, p, i;
Word16 tmp, tmp2, tmp_e;
Word32 tmp32;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
#endif
#endif
aOpt_e = 0;
move16();
BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1796_replace_shl_o
IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) )
#else
IF( LT_16( shl_o( currentFrameLevel, currentFrameLevel_e, &Overflow ), PLC_MIN_CNG_LEV ) )
#endif
{
BASOP_SATURATE_WARNING_ON_EVS
currentFrameLevel = PLC_MIN_CNG_LEV; /*Q15*/
......
......@@ -1500,9 +1500,7 @@ void perform_noise_estimation_dec_ivas_fx(
Word32 enr, enr_tot, enr_tot0;
Word16 enr_e, enr_ratio, alpha;
Word32 *msPeriodog;
#ifdef FIX_732_MS_PERIODOG_FLOOR
Word32 msPeriodog_floor;
#endif
Word32 *msNoiseEst;
Word32 *reIter;
Word32 rescale_fac = 0;
......@@ -1511,10 +1509,8 @@ void perform_noise_estimation_dec_ivas_fx(
Word16 q_shift;
Word32 max_l;
Word16 norm_shift;
#ifdef FIX_732_MS_PERIODOG_FLOOR
Word16 check = 0;
move16();
#endif
/* pointer initialization */
periodog = hFdCngDec->hFdCngCom->periodog; /*Q31 - hFdCngDec->hFdCngCom->periodog_exp*/
......@@ -1713,23 +1709,13 @@ void perform_noise_estimation_dec_ivas_fx(
msPeriodog[p] = L_add( msPeriodog[p], L_tmp ); /*Q31 - hFdCngDec->msPeriodog_exp*/
move32();
#ifdef FIX_732_MS_PERIODOG_FLOOR
msPeriodog_floor = L_max( 1, L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ); /*Q31 - hFdCngDec->msPeriodog_exp*/
IF( LT_32( msPeriodog[p], msPeriodog_floor ) )
#else
IF( LT_32( msPeriodog[p], L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ) )
#endif
{
#ifdef FIX_732_MS_PERIODOG_FLOOR
msPeriodog[p] = msPeriodog_floor;
move32();
#else
msPeriodog[p] = L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ); /*Q31 - hFdCngDec->msPeriodog_exp*/
move32();
#endif
}
}
#ifdef FIX_732_MS_PERIODOG_FLOOR
FOR( p = 0; p < npart; p++ )
{
IF( GT_32( msPeriodog[p], 1 ) )
......@@ -1744,7 +1730,6 @@ void perform_noise_estimation_dec_ivas_fx(
hFdCngDec->msPeriodog_exp = 14; /* msPeriodog buffer will have minimum value as 1e-5f */
move16();
}
#endif
}
/* calculate total energy (short-term and long-term) */
......