Skip to content
......@@ -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()
*
......
......@@ -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
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;
......@@ -393,29 +385,18 @@ void sns_shape_spectrum_fx(
*length = k;
move16();
}
#ifdef OPT_MCT_ENC_V3_NBE
min_shift = W_norm_arr( L64_tmp, k );
#endif
q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 );
if ( GT_16( q_tmp, 30 ) )
{
q_tmp = 30;
move16();
}
#ifdef OPT_MCT_ENC_V3_NBE
shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) );
FOR( k = 0; k < tmp_k; k++ )
{
spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1
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;
move16();
......@@ -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
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;
......@@ -449,29 +421,18 @@ void sns_shape_spectrum_fx(
*length = k;
move16();
}
#ifdef OPT_MCT_ENC_V3_NBE
min_shift = W_norm_arr( L64_tmp, k );
#endif
q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 );
if ( GT_16( q_tmp, 30 ) )
{
q_tmp = 30;
move16();
}
#ifdef OPT_MCT_ENC_V3_NBE
shift = sub( q_tmp, add( *q_spectrum, q_scf_int ) );
FOR( k = 0; k < tmp_k; k++ )
{
spectrum[k] = W_shl_sat_l( L64_tmp[k], shift ); // q_tmp+1
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;
move16();
......
......@@ -1995,86 +1995,42 @@ static void ivas_calc_post_pred_per_band_enc_fx(
Word16 *q_postpred_cov_re )
{
Word16 i, j, k;
#ifndef OPT_SBA_ENC_V1_BE
Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
Word16 q_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
Word16 min_val;
#else
Word16 max_val;
Word16 temp;
Word32 temp_add;
Word16 e_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
#endif
Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
Word32 tmp_re;
Word16 tmp_q;
Word16 tmp_e;
#ifndef OPT_SBA_ENC_V1_BE
FOR( i = 0; i < num_ch; i++ )
{
FOR( j = 0; j < num_ch; j++ )
{
dmx_mat_conj[i][j] = mixer_mat[j][i][band_idx]; /*q_mixer_mat*/
move32();
}
}
FOR( i = 0; i < num_ch; i++ )
{
set32_fx( temp_mat[i], 0, num_ch );
set32_fx( postpred_cov_re[i], 0, num_ch );
}
#endif
#ifdef OPT_SBA_ENC_V1_BE
max_val = MIN16B;
move16();
temp = sub( 62, q_mixer_mat );
#else
min_val = MAX16B;
move16();
#endif
/* num_ch x num_ch mult */
FOR( i = 0; i < num_ch; i++ )
{
FOR( j = 0; j < num_ch; j++ )
{
#ifndef OPT_SBA_ENC_V1_BE
temp_mat[i][j] = 0;
#else
temp_add = 0;
#endif
move32();
temp_mat_e[i][j] = 0;
move16();
FOR( k = 0; k < num_ch; k++ )
{
#ifndef OPT_SBA_ENC_V1_BE
tmp_re = Mpy_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] );
tmp_e = sub( 62, add( q_cov_real[i][k][band_idx], q_mixer_mat ) );
IF( tmp_re )
{
temp_mat[i][j] = BASOP_Util_Add_Mant32Exp( temp_mat[i][j], temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] );
move32();
}
#else
tmp_re = Mpy_32_32( cov_real[i][k][band_idx], mixer_mat[j][k][band_idx] );
tmp_e = sub( temp, q_cov_real[i][k][band_idx] );
IF( tmp_re )
{
temp_add = BASOP_Util_Add_Mant32Exp( temp_add, temp_mat_e[i][j], tmp_re, tmp_e, &temp_mat_e[i][j] );
}
#endif
}
#ifdef OPT_SBA_ENC_V1_BE
temp_mat[i][j] = temp_add;
move32();
#endif
}
}
......@@ -2084,49 +2040,25 @@ static void ivas_calc_post_pred_per_band_enc_fx(
{
FOR( j = i; j < num_ch; j++ )
{
#ifdef OPT_SBA_ENC_V1_BE
temp_add = 0;
move32();
e_postpred_cov_re_buf[i][j] = sub( 31, *q_postpred_cov_re );
#else
q_postpred_cov_re_buf[i][j] = *q_postpred_cov_re;
#endif
move16();
FOR( k = 0; k < num_ch; k++ )
{
tmp_re = Mpy_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] );
#ifdef OPT_SBA_ENC_V1_BE
tmp_q = add( tmp_e, temp_mat_e[k][j] );
#else
tmp_q = sub( q_mixer_mat, temp_mat_e[k][j] );
#endif
IF( tmp_re )
{
#ifndef OPT_SBA_ENC_V1_BE
tmp_e = sub( 31, q_postpred_cov_re_buf[i][j] );
postpred_cov_re[i][j] = BASOP_Util_Add_Mant32Exp( postpred_cov_re[i][j], tmp_e, tmp_re, sub( Q31, tmp_q ), &tmp_e );
move32();
q_postpred_cov_re_buf[i][j] = sub( 31, tmp_e );
move16();
#else
temp_add = BASOP_Util_Add_Mant32Exp( temp_add, e_postpred_cov_re_buf[i][j], tmp_re, tmp_q, &e_postpred_cov_re_buf[i][j] );
#endif
}
}
#ifndef OPT_SBA_ENC_V1_BE
IF( postpred_cov_re[i][j] )
{
min_val = s_min( min_val, q_postpred_cov_re_buf[i][j] );
#else
if ( temp_add )
{
max_val = s_max( max_val, e_postpred_cov_re_buf[i][j] );
#endif
}
#ifdef OPT_SBA_ENC_V1_BE
postpred_cov_re[i][j] = temp_add;
move32();
#endif
}
}
......@@ -2137,11 +2069,7 @@ static void ivas_calc_post_pred_per_band_enc_fx(
{
IF( postpred_cov_re[i][j] )
{
#ifdef OPT_SBA_ENC_V1_BE
postpred_cov_re[i][j] = L_shr( postpred_cov_re[i][j], sub( max_val, e_postpred_cov_re_buf[i][j] ) );
#else
postpred_cov_re[i][j] = L_shl( postpred_cov_re[i][j], sub( min_val, q_postpred_cov_re_buf[i][j] ) );
#endif
move32();
}
}
......@@ -2156,21 +2084,12 @@ static void ivas_calc_post_pred_per_band_enc_fx(
move32();
}
}
#ifdef OPT_SBA_ENC_V1_BE
if ( EQ_16( max_val, MIN16B ) )
{
max_val = 0;
move16();
}
*q_postpred_cov_re = sub( Q31, max_val );
#else
if ( EQ_16( min_val, MAX16B ) )
{
min_val = Q31;
move16();
}
*q_postpred_cov_re = min_val;
#endif
move16();
return;
......@@ -2361,30 +2280,18 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
Word32 re1, re2;
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], cov_dd_re[0][0] ); /*q_cov_dd_re+ pSparMd->band_coeffs[b_ts_idx].q_C_re_fx*/
#ifdef OPT_SBA_ENC_V2_BE
q_tmp1 = sub( W_norm( W_tmp ), 32 );
re1 = W_shl_sat_l( W_tmp, q_tmp1 ); /*q_cov_dd_re+ q_C_re+q_tmp1*/
q_tmp1 = add( add( q_C_re, q_tmp1 ), q_cov_dd_re );
#else
q_tmp1 = W_norm( W_tmp );
re1 = W_extract_h( W_shl( W_tmp, q_tmp1 ) ); /*q_cov_dd_re+ q_C_re+q_tmp1-32*/
q_tmp1 = sub( add( add( q_C_re, q_tmp1 ), q_cov_dd_re ), 32 );
#endif
if ( W_tmp == 0 )
{
q_tmp1 = 31;
move16();
}
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], cov_dd_re[0][0] ); /*q_cov_dd_re+ q_C_re*/
#ifdef OPT_SBA_ENC_V2_BE
q_tmp = sub( W_norm( W_tmp ), 32 );
re2 = W_shl_sat_l( W_tmp, q_tmp ); /*q_cov_dd_re+ q_C_re+q_tmp*/
q_tmp = add( add( q_C_re, q_tmp ), q_cov_dd_re );
#else
q_tmp = W_norm( W_tmp );
re2 = W_extract_h( W_shl( W_tmp, q_tmp ) ); /*q_cov_dd_re+ q_C_re+q_tmp-32*/
q_tmp = sub( add( add( q_C_re, q_tmp ), q_cov_dd_re ), 32 );
#endif
if ( W_tmp == 0 )
{
q_tmp = 31;
......@@ -2392,20 +2299,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
}
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re1 ); // q_tmp1+q_C_re
#ifdef OPT_SBA_ENC_V2_BE
q_factor = sub( W_norm( W_tmp ), 32 );
recon_uu_re[0][0] = W_shl_sat_l( W_tmp, q_factor ); // q_tmp1+q_C_re+q_recon_uu_re[0][0]
move32();
q_recon_uu_re[0][0] = add( add( q_C_re, q_factor ), q_tmp1 );
move16();
#else
q_recon_uu_re[0][0] = W_norm( W_tmp );
move16();
recon_uu_re[0][0] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[0][0] ) ); // q_tmp1+q_C_re+q_recon_uu_re[0][0]-32
move32();
q_recon_uu_re[0][0] = sub( add( add( q_C_re, q_recon_uu_re[0][0] ), q_tmp1 ), 32 );
move16();
#endif
if ( W_tmp == 0 )
{
q_recon_uu_re[0][0] = 31;
......@@ -2413,20 +2311,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
}
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], re1 ); // q_C_re+q_tmp1
#ifdef OPT_SBA_ENC_V2_BE
q_factor = sub( W_norm( W_tmp ), 32 );
recon_uu_re[0][1] = W_shl_sat_l( W_tmp, q_factor ); // q_C_re+q_tmp1+q_recon_uu_re[0][1]
move32();
q_recon_uu_re[0][1] = add( add( q_C_re, q_factor ), q_tmp1 );
move16();
#else
q_recon_uu_re[0][1] = W_norm( W_tmp );
move16();
recon_uu_re[0][1] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[0][1] ) ); // q_C_re+q_tmp1+q_recon_uu_re[0][1]-32
move32();
q_recon_uu_re[0][1] = sub( add( add( q_C_re, q_recon_uu_re[0][1] ), q_tmp1 ), 32 );
move16();
#endif
if ( W_tmp == 0 )
{
q_recon_uu_re[0][1] = 31;
......@@ -2434,20 +2323,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
}
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re2 ); // q_C_re+q_tmp
#ifdef OPT_SBA_ENC_V2_BE
q_factor = sub( W_norm( W_tmp ), 32 );
recon_uu_re[1][0] = W_shl_sat_l( W_tmp, q_factor ); // q_C_re+q_tmp+q_recon_uu_re[1][0]
move32();
q_recon_uu_re[1][0] = add( add( q_C_re, q_factor ), q_tmp );
move16();
#else
q_recon_uu_re[1][0] = W_norm( W_tmp );
move16();
recon_uu_re[1][0] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[1][0] ) ); // q_C_re+q_tmp+q_recon_uu_re[1][0]-32
move32();
q_recon_uu_re[1][0] = sub( add( add( q_C_re, q_recon_uu_re[1][0] ), q_tmp ), 32 );
move16();
#endif
if ( W_tmp == 0 )
{
q_recon_uu_re[1][0] = 31;
......@@ -2455,20 +2335,11 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
}
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], re2 ); // q_C_re+q_tmp
#ifdef OPT_SBA_ENC_V2_BE
q_factor = sub( W_norm( W_tmp ), 32 );
recon_uu_re[1][1] = W_shl_sat_l( W_tmp, q_factor ); // q_C_re+q_tmp+q_recon_uu_re[1][1]
move32();
q_recon_uu_re[1][1] = add( add( q_C_re, q_factor ), q_tmp );
move16();
#else
q_recon_uu_re[1][1] = W_norm( W_tmp );
move16();
recon_uu_re[1][1] = W_extract_h( W_shl( W_tmp, q_recon_uu_re[1][1] ) ); // q_C_re+q_tmp+q_recon_uu_re[1][1]-32
move32();
q_recon_uu_re[1][1] = sub( add( add( q_C_re, q_recon_uu_re[1][1] ), q_tmp ), 32 );
move16();
#endif
if ( W_tmp == 0 )
{
q_recon_uu_re[1][1] = 31;
......@@ -2485,18 +2356,12 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
}
}
q_tmp = sub( s_min( q_tmp, q_cov_uu_re ), 1 );
#ifdef OPT_SBA_ENC_V2_BE
q_factor = sub( q_cov_uu_re, q_tmp );
#endif
FOR( i = 0; i < 2; i++ )
{
FOR( j = 0; j < 2; j++ )
{
#ifdef OPT_SBA_ENC_V2_BE
cov_uu_re[i][j] = L_sub( L_shr( cov_uu_re[i][j], q_factor ), L_shr( recon_uu_re[i][j], sub( q_recon_uu_re[i][j], q_tmp ) ) ); // q_tmp
#else
cov_uu_re[i][j] = L_sub( L_shr( cov_uu_re[i][j], sub( q_cov_uu_re, q_tmp ) ), L_shr( recon_uu_re[i][j], sub( q_recon_uu_re[i][j], q_tmp ) ) ); // q_tmp
#endif
move32();
}
}
......@@ -2516,15 +2381,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
{
Word32 re;
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][k], cov_dd_re[k][j] ); // q_C_re+q_cov_dd_re
#ifdef OPT_SBA_ENC_V2_BE
q_tmp = sub( W_norm( W_tmp ), 33 );
re = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_cov_dd_re+q_tmp
q_tmp = add( add( q_C_re, q_tmp ), q_cov_dd_re );
#else
q_tmp = sub( W_norm( W_tmp ), 1 );
re = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_cov_dd_re+q_tmp-32
q_tmp = sub( add( add( q_C_re, q_tmp ), q_cov_dd_re ), 32 );
#endif
if ( W_tmp == 0 )
{
q_tmp = 31;
......@@ -2548,15 +2407,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
}
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re1[0] ); // q_C_re+q_re1[0]
#ifdef OPT_SBA_ENC_V2_BE
q_tmp = sub( W_norm( W_tmp ), 33 );
re2 = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_re1[0]+q_tmp
q_tmp = add( add( q_C_re, q_tmp ), q_re1[0] );
#else
q_tmp = sub( W_norm( W_tmp ), 1 );
re2 = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_re1[0]+q_tmp-32
q_tmp = sub( add( add( q_C_re, q_tmp ), q_re1[0] ), 32 );
#endif
if ( W_tmp == 0 )
{
q_tmp = 31;
......@@ -2566,15 +2419,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
move32();
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][1], re1[1] ); // q_C_re+q_re1[1]
#ifdef OPT_SBA_ENC_V2_BE
q_tmp1 = sub( W_norm( W_tmp ), 33 );
re2 = W_shl_sat_l( W_tmp, q_tmp1 ); // q_C_re+q_re1[1]+q_tmp1
q_tmp1 = add( add( q_C_re, q_tmp1 ), q_re1[1] );
#else
q_tmp1 = sub( W_norm( W_tmp ), 1 );
re2 = W_extract_h( W_shl( W_tmp, q_tmp1 ) ); // q_C_re+q_re1[1]+q_tmp1-32
q_tmp1 = sub( add( add( q_C_re, q_tmp1 ), q_re1[1] ), 32 );
#endif
if ( W_tmp == 0 )
{
q_tmp1 = 31;
......@@ -2653,15 +2500,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
FOR( k = 0; k < num_dmx - 1; k++ )
{
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[i][k], cov_dd_re[k][m] ); // q_C_re+q_cov_dd_re
#ifdef OPT_SBA_ENC_V2_BE
q_tmp = sub( W_norm( W_tmp ), 34 );
re = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_cov_dd_re+q_tmp
q_tmp = add( add( q_C_re, q_tmp ), q_cov_dd_re );
#else
q_tmp = sub( W_norm( W_tmp ), 2 );
re = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_cov_dd_re+q_tmp-32
q_tmp = sub( add( add( q_C_re, q_tmp ), q_cov_dd_re ), 32 );
#endif
if ( W_tmp == 0 )
{
q_tmp = 31;
......@@ -2701,15 +2542,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
FOR( m = 0; m < num_dmx - 1; m++ )
{
W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[j][m], re1[m] ); // q_C_re+q_re1[m]
#ifdef OPT_SBA_ENC_V2_BE
q_tmp = sub( W_norm( W_tmp ), 34 );
re = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+q_re1[m]+q_tmp
q_tmp = add( add( q_C_re, q_tmp ), q_re1[m] );
#else
q_tmp = sub( W_norm( W_tmp ), 2 );
re = W_extract_h( W_shl( W_tmp, q_tmp ) ); // q_C_re+q_re1[m]+q_tmp-32
q_tmp = sub( add( add( q_C_re, q_tmp ), q_re1[m] ), 32 );
#endif
if ( W_tmp == 0 )
{
q_tmp = 31;
......@@ -2794,15 +2629,9 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
move16();
IF( trace != 0 )
{
#ifdef OPT_SBA_ENC_V2_BE
q_factor = sub( W_norm( trace ), 32 );
tmp = Mpy_32_32( p_norm_scaling, W_shl_sat_l( trace, q_factor ) ); // q_cov_uu_re+q_factor
q_factor = add( q_cov_uu_re, q_factor );
#else
q_factor = W_norm( trace );
tmp = Mpy_32_32( p_norm_scaling, W_extract_h( W_shl( trace, q_factor ) ) ); // q_cov_uu_re+q_factor-32
q_factor = sub( add( q_cov_uu_re, q_factor ), 32 );
#endif
IF( GT_16( q_factor, q_postpred_cov_re ) )
{
tmp = L_shr( tmp, sub( q_factor, q_postpred_cov_re ) ); // q_postpred_cov_re
......@@ -4017,12 +3846,8 @@ void ivas_compute_spar_params_fx(
Word32 diff_norm_order1_table[4] = { 0, 805306368, 402653184, 268435456 }; // q28
Word32 diff_norm_order2_table[6] = { 0, 1342177280, 671088640, 447392416, 335544320, 268435456 }; // q28
Word32 diff_norm_order3_table[8] = { 0, 1879048192, 939524096, 626349376, 469762048, 375809632, 313174688, 268435456 }; // q28
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
#define EPSILON_FX_SHIFT 6
#define EPSILON_FX_THR ( 1 << EPSILON_FX_SHIFT )
#else
#define EPSILON_FX_THR 70
#endif
#define ONE_BY_THREE_Q31 715827882
#define ONE_BY_FIVE_Q31 429496729
#define ONE_BY_SEVEN_Q31 306783378
......@@ -4263,19 +4088,11 @@ void ivas_get_spar_md_from_dirac_enc_fx(
Word32 norm_fx;
Word16 norm_q;
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
Word16 num_ch_order, norm_t;
Word32 tmp_norm_out;
#else
Word16 num_ch_order, hoa2_ch_order;
#endif
num_ch_order = ivas_sba_get_nchan_fx( order, 0 );
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 );
#else
assert( order == 1 );
#endif
FOR( ch = 0; ch < num_ch_order; ch++ )
{
......@@ -4290,36 +4107,18 @@ void ivas_get_spar_md_from_dirac_enc_fx(
}
/*normalize 1st order*/
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) );
norm_t = sub( norm_t, 1 );
scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t );
#endif
norm_fx = 0;
move32();
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
norm_q = 0;
move16();
#endif
FOR( ch = 1; ch < foa_ch; ch++ )
{
norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
}
norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) );
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
#else
IF( norm_fx )
{
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
}
ELSE
{
norm_fx = EPSILON_FX;
move32();
}
#endif
IF( norm_q <= 0 )
{
norm_fx = L_shr( norm_fx, ( negate( norm_q ) ) ); // q=31
......@@ -4328,7 +4127,6 @@ void ivas_get_spar_md_from_dirac_enc_fx(
}
norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
FOR( ch = 1; ch < foa_ch; ch++ )
......@@ -4347,136 +4145,6 @@ void ivas_get_spar_md_from_dirac_enc_fx(
move32();
}
}
#else
FOR( ch = 1; ch < foa_ch; ch++ )
{
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
IF( response_avg_fx[ch] != 0 )
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15
move32();
}
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
}
ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) )
{
response_avg_fx[ch] = ONE_IN_Q30; // 1 q30
move32();
}
ELSE
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15
move32();
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
}
}
#endif
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
/*normalize 2nd order*/
norm_fx = 0;
move32();
Word16 min_ch_order = s_min( hoa2_ch_order, num_ch_order );
FOR( ch = foa_ch; ch < min_ch_order; ch++ )
{
norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
}
norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) );
IF( norm_fx )
{
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
}
ELSE
{
norm_fx = EPSILON_FX;
move32();
}
IF( norm_q < 0 )
{
norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31
norm_q = 0;
move16();
}
norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30
min_ch_order = s_min( hoa2_ch_order, num_ch_order );
FOR( ch = foa_ch; ch < min_ch_order; ch++ )
{
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
response_avg_fx[ch] = response_avg_fx[ch]; // q30
response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
move32();
move32();
}
ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) )
{
response_avg_fx[ch] = ONE_IN_Q30; // q30
move32();
}
ELSE
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
move32();
}
}
/*normalize 3rd order*/
norm_fx = 0;
move32();
FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ )
{
norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
}
norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) );
IF( norm_fx )
{
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
}
ELSE
{
norm_fx = EPSILON_FX;
move32();
}
IF( norm_q < 0 )
{
norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31
norm_q = 0;
move16();
}
norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30
FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ )
{
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
response_avg_fx[ch] = response_avg_fx[ch]; // q30
response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
move32();
move32();
}
ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) )
{
response_avg_fx[ch] = ONE_IN_Q30; // 1 q30
move32();
}
ELSE
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15
move32();
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
}
}
#endif
}
}
......@@ -4866,19 +4534,11 @@ void ivas_get_spar_md_from_dirac_fx(
{
Word32 norm_fx;
Word16 norm_q;
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
Word16 num_ch_order, norm_t;
Word32 tmp_norm_out;
#else
Word16 num_ch_order, hoa2_ch_order;
#endif
num_ch_order = ivas_sba_get_nchan_fx( order, 0 );
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 );
#else
assert( order == 1 );
#endif
FOR( ch = 0; ch < num_ch_order; ch++ )
{
......@@ -4893,17 +4553,11 @@ void ivas_get_spar_md_from_dirac_fx(
}
/*normalize 1st order*/
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) );
norm_t = sub( norm_t, 1 );
scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t );
#endif
norm_fx = 0;
move32();
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
norm_q = 0;
move16();
#endif
FOR( ch = 1; ch < foa_ch; ch++ )
{
norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
......@@ -4911,19 +4565,7 @@ void ivas_get_spar_md_from_dirac_fx(
norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) );
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
#else
IF( norm_fx )
{
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
}
ELSE
{
norm_fx = EPSILON_FX;
move32();
}
#endif
IF( norm_q <= 0 )
{
......@@ -4933,7 +4575,6 @@ void ivas_get_spar_md_from_dirac_fx(
}
norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
FOR( ch = 1; ch < foa_ch; ch++ )
......@@ -4952,135 +4593,6 @@ void ivas_get_spar_md_from_dirac_fx(
move32();
}
}
#else
FOR( ch = 1; ch < foa_ch; ch++ )
{
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
IF( response_avg_fx[ch] != 0 )
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15
move32();
}
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
}
ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) )
{
response_avg_fx[ch] = ONE_IN_Q30; // 1 q30
move32();
}
ELSE
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15
move32();
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
}
}
#endif
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
/*normalize 2nd order*/
norm_fx = 0;
move32();
Word16 min_ch_order = s_min( hoa2_ch_order, num_ch_order );
FOR( ch = foa_ch; ch < min_ch_order; ch++ )
{
norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
}
norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) );
IF( norm_fx )
{
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
}
ELSE
{
norm_fx = EPSILON_FX;
move32();
}
IF( norm_q < 0 )
{
norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31
norm_q = 0;
move16();
}
norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30
min_ch_order = s_min( hoa2_ch_order, num_ch_order );
FOR( ch = foa_ch; ch < min_ch_order; ch++ )
{
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
response_avg_fx[ch] = response_avg_fx[ch]; // q30
response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
move32();
move32();
}
ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) )
{
response_avg_fx[ch] = ONE_IN_Q30; // q30
move32();
}
ELSE
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
move32();
}
}
/*normalize 3rd order*/
norm_fx = 0;
move32();
FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ )
{
norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
}
norm_q = sub( 31, ( sub( add( 29, 29 ), 31 ) ) );
IF( norm_fx )
{
norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
}
ELSE
{
norm_fx = EPSILON_FX;
move32();
}
IF( norm_q < 0 )
{
norm_fx = L_shr( norm_fx, negate( norm_q ) ); // q31
norm_q = 0;
move16();
}
norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30
FOR( ch = hoa2_ch_order; ch < num_ch_order; ch++ )
{
IF( LT_32( norm_fx, EPSILON_FX_THR ) )
{
response_avg_fx[ch] = response_avg_fx[ch]; // q30
response_avg_fx[ch] = divide3232( response_avg_fx[ch], EPSILON_FX_THR ); // q15
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
move32();
move32();
}
ELSE IF( GT_32( response_avg_fx[ch], norm_fx ) )
{
response_avg_fx[ch] = ONE_IN_Q30; // 1 q30
move32();
}
ELSE
{
response_avg_fx[ch] = divide3232( response_avg_fx[ch], norm_fx ); // q15
move32();
response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
move32();
}
}
#endif
}
}
......
......@@ -1965,11 +1965,7 @@ void v_multc_acc_32_16(
FOR( i = 0; i < N; i++ )
{
#ifdef OPT_MCT_ENC_V1_BE
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();
}
......@@ -1986,11 +1982,7 @@ void v_multc_acc_32_32(
FOR( i = 0; i < N; i++ )
{
#ifdef OPT_MCT_ENC_V1_BE
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();
}
......
......@@ -97,11 +97,7 @@ void ivas_fine_gain_pred_fx(
/*gp *= 1.0f - 0.05f / accuracy; */
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 */
#else
tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */
#endif
tmp = sub( 32767, tmp );
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 */
......@@ -209,11 +205,7 @@ void fine_gain_pred_fx(
/*gp *= 1.0f - 0.05f / accuracy; */
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 */
#else
tmp = shr_o( tmp, sub( 34, exp ), &Overflow ); /*15+18-exp+16-15=34-exp */
#endif
tmp = sub( 32767, tmp );
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 */
......
......@@ -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_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) */
#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_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[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 */
{
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) */
#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 */
#endif
f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
move16();
}
......@@ -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 = 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 */
#endif
tmp = s_max( tmp, 0 );
......
......@@ -345,7 +345,11 @@ static Word32 b_inv_sq(
exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) );
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 );
#endif
div_out = div_s( 8192, m_den );
Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/
......@@ -423,7 +427,11 @@ static Word32 inv_pow(
}
tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp );
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 */
#endif
return ( L_tmp );
}
......
......@@ -256,11 +256,19 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val
}
IF( expi > 0 )
{
#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( x[0], expi );
#else
tmp = shl_o( x[0], expi, &Overflow );
#endif
L_sum = L_mac_o( 1, tmp, tmp, &Overflow );
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 );
#endif
L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow );
}
}
......
......@@ -75,9 +75,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
Word16 flag_low_order = 0;
move16();
Word16 filt_len_tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
const Resampling_cfg *cfg_ptr_fx;
......@@ -277,7 +279,11 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
test();
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 );
#endif
*Q_new_inp = add( *Q_new_inp, 1 );
move16();
}
......@@ -358,9 +364,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
Word16 flag_low_order = 0;
move16();
Word16 filt_len_tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
const Resampling_cfg *cfg_ptr_fx;
......@@ -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 ) ) )
{
#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 );
#endif
#else
num_den = shl( num_den, 1 );
#endif
......
......@@ -70,78 +70,20 @@
#ifndef BASOP_NOGLOB_DEV_USE_GLOBALS
#define BASOP_NOGLOB_DECLARE_LOCAL
#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 */
#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_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_QWIN
#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 FIX_1762_COMPILER_ISSUE /* 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_1770_replace_shr_ro /* 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 FIX_1762_COMPILER_ISSUE_NEW /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */
#define ISSUE_1796_replace_shl_o /* FhG: replace shl_ro by overflow-free alternatives - BE*/
#define ISSUE_1799_replace_L_shr_o /* FhG: replace by non-overflow-alternative - BE */
#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 @@
#define FIX_1822
#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 ############################ */
#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 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_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_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_1831_REVERB_REGRESSION /* Philips: fixes reverb regression issues */
#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 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_1056_ISM_RATE_SWITCH /* FhG: Fix #1056: fix TC buffer udpate on a ISM rate switch */
#define NONBE_FIX_1075 /* FhG: fix segfault for bitrate switching + BINAURAL_ROOM_REVERB output in MC */
#define NON_BE_FIX_1041_USE_OLD_CNG_LSPS_IF_NONSTAB /* FhG: fix bug in TD MDCT-Stereo concealment */
#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 NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */
#define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */
#define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */
#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 ############################ */
#define FIX_1766_TCX2ACELP_BWE_ISSUE /* VA : Fix rare BWE issue when switching from TCX to ACELP */
#endif
......@@ -1242,58 +1242,19 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
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 */
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(
const Word32 brate, /* i : bitrate */
Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
);
 
void push_next_bits_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
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 */
/* o : value of the indice */
UWord16 get_next_indice_1_fx(
Decoder_State *st_fx /* i/o: decoder state structure */
);
 
......@@ -1302,13 +1263,8 @@ void get_next_indice_tmp_fx(
Word16 nb_bits /* i : number of bits that were used to quantize the indice */
);
 
UWord16 get_indice( /* 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_indice_1_fx( /* o : value of the indice */
/* o : value of the indice */
UWord16 get_indice_1_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 pos /* i : absolute position in the bitstream */
);
......@@ -1318,41 +1274,6 @@ void reset_indices_enc_fx(
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 BRATE2IDX16k_fx( Word32 brate );
 
......@@ -6412,11 +6333,7 @@ void TonalMDCTConceal_Apply(
void TonalMDCTConceal_Apply_ivas_fx(
TonalMDCTConcealPtr hTonalMDCTConc, /*IN */
Word32 *mdctSpectrum, /*IN/OUT*/
#ifdef OPT_SBA_DEC_V2_NBE
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 );
 
void TonalMDCTConceal_InsertNoise_ivas_fx(
......@@ -11065,11 +10982,6 @@ UWord16 get_next_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(
Decoder_State *st, /* o : decoder state structure */
Word16 nb_bits /* i : number of bits that were used to quantize the indice */
......
......@@ -72,7 +72,11 @@ void Residu3_lc_fx(
{
q = add( q, shift );
}
#ifdef ISSUE_1796_replace_shl_o
*y++ = shl_sat( x[0], shift );
#else
*y++ = shl_o( x[0], shift, &Overflow );
#endif
move16();
FOR( i = 1; i < m; i++ )
......
......@@ -5194,243 +5194,6 @@ const Word16 freqTable[2] = {20, 40}; // Q0
/* SNR: 109.44, PHASE: 3.500000000000000 */
 
/* SNR: 109.44, PHASE: 3.500000000000000 */
#ifndef OPT_IVAS_FILTER_ROM
const Word16 CLDFB80_10_fx[100] = // q = 15 sf = 17036 qsf = 14
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, -2, 0, 0, 0, -1, 0, 0, 0, -8, -31,
-4, 0, 0, -6, 5, 0, 0, -1, 33, -63, -24, 11, 49, 54, 49, 69, 89, 95, 52, -44, -50, 24, 80, 71, 8,
-103, -205, -300, -429, 587, 764, 1010, 1347, 1783, 2309, 2880, 3411, 3810, 4001, 3950, 3582, 2797,
1568, -98, -2200, -4710, -7582, -10752, -14132, 17583, 20974, 24169, 27024, 29400, 31176, 32302,
32767, 32696, 32027, 30287, 27571, 24530, 21358, 18039, 14649, 11219, 7832, 4369, 1312
};
/* SNR: 292.49, PHASE: 2.000000000000000 */
const Word16 CLDFB80_16_fx[160] = // q = 15 sf = 17051 qsf = 14
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10,
-4, -1, -1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, -2, -13, -38, -16, -5, -3, -1, 0, -1, 1, -7, 1, 0, 1, 1, 1,
10, 52, -67, -48, -23, -3, 22, 47, 56, 36, 50, 57, 70, 87, 93, 95, 80, 40, -34, -61, -46, 0, 45, 78,
82, 65, 29, -38, -110, -175, -233, -293, -368, -457, 559, 658, 776, 923, 1104, 1322, 1579, 1873, 2203,
2556, 2913, 3252, 3551, 3787, 3943, 4005, 3975, 3832, 3542, 3087, 2458, 1656, 683, -459, -1772, -3248,
-4875, -6643, -8536, -10537, -12624, -14766, 16922, 19062, 21161, 23180, 25080, 26833, 28403, 29754,
30863, 31722, 32320, 32657, 32767, 32685, 32379, 31797, 30709, 29137, 27361, 25471, 23533, 21541, 19486,
17392, 15275, 13136, 10996, 8882, 6757, 4582, 2509, 876,
};
/* SNR: 89.77, PHASE: 1.500000000000000 */
const Word16 CLDFB80_20_fx[200] = // q = 15 sf = 17050 qsf = 14
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, -9, -6, -1, -2, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, -3, -15, -37, -20, -4, -5, -3, -1, 0, 0,
-4, 8, -15, 4, 0, 1, 1, 1, 2, -4, 10, 57, -62, -58, -27, -19, -1, 19, 39, 52, 57, 24, 52, 53, 60, 75, 87, 92,
96, 88, 69, 33, -29, -56, -59, -34, 4, 41, 72, 87, 78, 64, 37, -18, -75, -131, -181, -228, -275, -328, -394,
-466, 549, 627, 713, 817, 939, 1085, 1253, 1446, 1664, 1904, 2168, 2449, 2736, 3018, 3284, 3524, 3724, 3876,
3972, 4006, 3982, 3890, 3707, 3424, 3032, 2528, 1914, 1191, 358, -583, -1633, -2789, -4043, -5392, -6827, -8342,
-9927, -11572, -13263, -14983, 16709, 18424, 20121, 21779, 23377, 24898, 26326, 27645, 28834, 29878, 30765,
31493, 32056, 32450, 32679, 32767, 32733, 32567, 32235, 31727, 30857, 29634, 28272, 26803, 25281, 23730, 22147,
20522, 18862, 17182, 15489, 13781, 12065, 10360, 8671, 6973, 5237, 3512, 1961, 735,
};
/* SNR: 89.29, PHASE: 0.833333333333333 */
const Word16 CLDFB80_30_fx[300] = // q = 15 sf = 17051 qsf = 14
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -7, -4, -2, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0,
0, -1, -1, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, -2, -8, -19, -31, -31, -20, -7, -4, -5, -3, 0, -1, 0, 0, 1, -3, -6, 18,
-23, 5, 3, -3, 0, 1, 2, 0, 1, 2, -1, 0, 11, 33, 61, -57, -63, -54, -33, -24, -16, -4, 11, 23, 36, 49, 54, 56, 54,
8, 52, 49, 55, 60, 69, 78, 86, 89, 93, 96, 95, 87, 75, 52, 22, -19, -44, -59, -60, -50, -28, -2, 24, 47, 67, 80,
86, 80, 71, 62, 48, 8, -27, -65, -103, -139, -173, -205, -235, -266, -300, -338, -382, -429, -478, 534, 587, 641,
698, 763, 836, 917, 1009, 1111, 1223, 1346, 1480, 1626, 1781, 1945, 2122, 2307, 2496, 2688, 2878, 3063, 3241, 3408,
3560, 3694, 3806, 3896, 3960, 3997, 4003, 3987, 3946, 3866, 3744, 3579, 3366, 3105, 2794, 2434, 2024, 1566, 1060,
505, -98, -750, -1450, -2198, -2991, -3827, -4706, -5625, -6582, -7575, -8601, -9658, -10742, -11850, -12978, -14119,
-15271, 16422, 17566, 18707, 19838, 20954, 22048, 23114, 24147, 25141, 26094, 26999, 27851, 28644, 29373, 30034, 30626,
31147, 31596, 31972, 32272, 32496, 32649, 32737, 32767, 32744, 32665, 32521, 32301, 31997, 31636, 31056, 30259, 29415,
28506, 27545, 26550, 25535, 24507, 23467, 22412, 21338, 20246, 19139, 18023, 16900, 15771, 14635, 13494, 12350, 11209,
10077, 8952, 7825, 6685, 5527, 4365, 3235, 2198, 1311, 541,
};
/* SNR: 85.69, PHASE: 0.750000000000000 */
const Word16 CLDFB80_32_fx[320] = // q = 15 sf = 17050 qsf = 14
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -8, -5, -2, -1, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0,
-1, -1, 0, 1, 0, 0, -1, 0, 0, 0, 0, 1, -1, -3, -9, -20, -31, -32, -20, -10, -2, -5, -4, -2, 0, 0, 0, 0, 0, -3, -5, 18, -24, 4,
3, -2, 2, 1, 2, 0, 1, 2, 2, -5, 4, 11, 37, 61, -56, -65, -57, -38, -23, -20, -9, 2, 16, 29, 40, 51, 55, 57, 52, 6, 52, 49, 54,
59, 65, 74, 84, 88, 91, 94, 96, 93, 85, 71, 50, 21, -18, -43, -57, -61, -54, -36, -13, 12, 35, 55, 73, 84, 85, 79, 69, 62, 50,
11, -21, -56, -93, -127, -159, -190, -219, -248, -278, -310, -348, -389, -433, -480, 532, 582, 632, 685, 744, 810, 883, 965,
1056, 1156, 1264, 1383, 1511, 1649, 1796, 1951, 2117, 2290, 2467, 2646, 2825, 3000, 3170, 3332, 3482, 3617, 3735, 3834, 3912,
3968, 4000, 4003, 3988, 3952, 3881, 3775, 3630, 3445, 3217, 2946, 2631, 2273, 1872, 1429, 943, 413, -157, -771, -1428, -2126,
-2864, -3641, -4455, -5305, -6189, -7106, -8052, -9027, -10028, -11053, -12097, -13156, -14228, -15309, 16387, 17461, 18531,
19594, 20644, 21677, 22687, 23669, 24620, 25536, 26413, 27246, 28032, 28765, 29440, 30056, 30611, 31104, 31534, 31899, 32198,
32430, 32598, 32706, 32761, 32767, 32727, 32635, 32483, 32262, 31968, 31629, 31085, 30337, 29554, 28712, 27822, 26897, 25951,
24992, 24023, 23042, 22047, 21034, 20006, 18967, 17919, 16866, 15808, 14744, 13674, 12601, 11530, 10466, 9409, 8355, 7294, 6217,
5127, 4042, 2998, 2049, 1236, 515,
};
/* SNR: 81.55, PHASE: 0.500000000000000 */
const Word16 CLDFB80_40_fx[400] = // q = 15 sf = 17051 qsf = 14
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -10, -9, -6, -4,
-2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, 0, 0, 0, 1, -1, 0, 0, -1, 0, 0, 0, 0, 0, 2, -1, -2, -5, -12, -22, -29,
-37, -24, -18, -9, -2, -6, -4, -3, -2, 0, -1, 0, 0, 0, 1, -2, -6, -2, 20, -24, 0, 5, 2, -2, 2, 0, 2, 2, 0, 1, 2, 2, 2, -6, 3, 11,
18, 47, 61, -57, -68, -60, -52, -36, -23, -22, -14, -6, 3, 16, 25, 35, 44, 51, 54, 56, 56, 44, 3, 49, 49, 51, 56, 59, 64, 72, 79,
86, 88, 90, 93, 96, 96, 92, 86, 77, 59, 45, 17, -14, -38, -50, -60, -61, -55, -42, -25, -5, 15, 33, 49, 65, 77, 85, 85, 81, 75, 67,
62, 54, 22, -4, -31, -60, -90, -117, -144, -169, -193, -216, -239, -262, -287, -313, -344, -377, -411, -447, -485, 527, 569, 606,
648, 690, 737, 790, 845, 906, 973, 1046, 1125, 1209, 1299, 1395, 1498, 1607, 1722, 1842, 1966, 2099, 2237, 2378, 2520, 2664, 2807,
2948, 3086, 3219, 3347, 3467, 3578, 3678, 3766, 3843, 3905, 3953, 3987, 4003, 4001, 3989, 3967, 3921, 3853, 3762, 3646, 3505, 3336,
3140, 2916, 2665, 2385, 2078, 1744, 1382, 993, 577, 133, -337, -835, -1360, -1913, -2490, -3093, -3720, -4372, -5046, -5743, -6460,
-7198, -7956, -8731, -9524, -10332, -11155, -11990, -12836, -13690, -14550, -15416, 16279, 17137, 17995, 18849, 19698, 20538, 21367,
22183, 22983, 23764, 24524, 25263, 25977, 26665, 27325, 27953, 28548, 29107, 29629, 30112, 30556, 30960, 31324, 31647, 31929, 32168,
32365, 32519, 32634, 32711, 32755, 32767, 32750, 32702, 32620, 32498, 32333, 32121, 31865, 31595, 31160, 30560, 29950, 29304, 28623,
27911, 27175, 26424, 25662, 24894, 24118, 23336, 22544, 21743, 20930, 20108, 19278, 18442, 17602, 16759, 15912, 15062, 14208, 13351,
12493, 11636, 10783, 9936, 9092, 8249, 7400, 6542, 5673, 4799, 3934, 3099, 2320, 1623, 1018, 436,
};
/* SNR: 85.15, PHASE: 0.166666666666667 */
const Word16 CLDFB80_60_fx[600] = // q = 15 sf = 17051 qsf = 14
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -11, -9, -9, -6, -6, -4, -3, -1, -1, -1, -2,
-1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, -3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, -1,
-2, -3, -5, -11, -15, -25, -27, -37, -35, -26, -20, -17, -11, -4, -2, -6, -5, -4, -4, -3, -2, 0, -1, -1, 0, 0, 0, 0, 0, 0, -2, -4, -6,
-3, 8, 18, -21, -15, 2, 6, 4, 2, -2, 0, 2, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 2, 1, -4, -4, 5, 10, 10, 23, 42, 57, 61, -58, -62, -67, -60,
-58, -49, -39, -27, -23, -23, -19, -13, -7, -1, 5, 15, 19, 26, 34, 39, 46, 50, 52, 55, 56, 57, 56, 48, 24, 2, 43, 52, 49, 50, 53, 56,
59, 60, 66, 71, 75, 80, 85, 87, 88, 90, 92, 94, 95, 96, 96, 93, 88, 85, 79, 69, 56, 47, 33, 12, -8, -29, -41, -48, -56, -61, -61, -59,
-54, -45, -34, -22, -9, 4, 18, 30, 41, 52, 62, 72, 78, 83, 87, 85, 82, 78, 73, 68, 64, 62, 58, 37, 17, 0, -18, -36, -55, -75, -94, -112,
-131, -148, -165, -181, -197, -212, -228, -243, -258, -275, -291, -309, -328, -349, -371, -394, -417, -441, -466, -492, 520, 549, 575, 599,
627, 655, 683, 713, 746, 781, 817, 855, 896, 939, 985, 1033, 1085, 1138, 1194, 1253, 1315, 1379, 1446, 1516, 1588, 1663, 1741, 1822, 1904,
1987, 2076, 2168, 2261, 2354, 2449, 2544, 2640, 2735, 2830, 2925, 3018, 3109, 3198, 3284, 3368, 3448, 3524, 3595, 3662, 3724, 3780, 3831,
3876, 3914, 3947, 3972, 3991, 4002, 4005, 3999, 3991, 3981, 3960, 3930, 3890, 3839, 3779, 3707, 3624, 3530, 3424, 3306, 3175, 3032, 2877,
2709, 2528, 2336, 2131, 1914, 1685, 1444, 1191, 926, 648, 358, 56, -257, -583, -920, -1270, -1633, -2007, -2392, -2789, -3196, -3614, -4043,
-4483, -4932, -5392, -5861, -6339, -6827, -7324, -7828, -8341, -8862, -9391, -9926, -10469, -11017, -11572, -12131, -12695, -13262, -13833,
-14406, -14982, -15561, 16136, 16708, 17280, 17853, 18423, 18991, 19557, 20120, 20678, 21230, 21778, 22318, 22851, 23376, 23892, 24400, 24897,
25384, 25860, 26325, 26778, 27217, 27644, 28055, 28452, 28833, 29197, 29545, 29876, 30189, 30485, 30764, 31024, 31267, 31492, 31698, 31886,
32055, 32205, 32336, 32448, 32542, 32618, 32678, 32722, 32751, 32766, 32767, 32756, 32731, 32692, 32637, 32565, 32475, 32364, 32233, 32082,
31911, 31726, 31551, 31261, 30855, 30461, 30055, 29633, 29194, 28739, 28271, 27790, 27300, 26802, 26298, 25790, 25279, 24765, 24249, 23729,
23205, 22678, 22145, 21608, 21067, 20521, 19971, 19417, 18861, 18303, 17743, 17181, 16618, 16054, 15488, 14920, 14351, 13780, 13208, 12636,
12064, 11494, 10925, 10359, 9795, 9233, 8671, 8108, 7542, 6972, 6398, 5818, 5236, 4654, 4077, 3512, 2965, 2445, 1961, 1516, 1114, 735, 325,
};
/* 5ms delay prototype */
const Word16 LDQMF_10_fx[] = // q = 15 sf = 15388 qsf = 14
{
4, 2, -2, -7, -11, -13, -14, -14, -16, -21, -31, -44, -56, -66, -70, -67, -57, -39, -15, 12, -43, -75, -104, -132, -156, -178, -196, -210,
-221, -229, -238, -248, -262, -281, -306, -332, -353, -359, -340, -281, 168, -11, -267, -606, -1030, -1534, -2105, -2724, -3361, -3979, -4533,
-4973, -5242, -5284, -5046, -4480, -3551, -2234, -523, 1572, -4024, -6784, -9789, -12957, -16197, -19406, -22478, -25307, -27793, -29846, -31391,
-32374, -32768, -32565, -31782, -30462, -28663, -26465, -23956, -21234, 18397, 15542, 12766, 10150, 7762, 5656, 3864, 2396, 1242, 371, -221,
-567, -753, -808, -763, -646, -489, -322, -174, -64,
};
const Word16 LDQMF_16_fx[] = // q = 15 sf = 15388 qsf = 14
{
4, 3, 1, 0, -3, -7, -9, -12, -13, -14, -14, -14, -14, -16, -19, -23, -29, -37, -45, -53, -60, -65, -69, -70, -68, -64, -56, -45, -32, -16, 0, 18,
-38, -57, -76, -95, -113, -130, -146, -161, -174, -186, -197, -206, -214, -220, -226, -231, -236, -242, -248, -257, -267, -280, -295, -311, -327,
-342, -353, -359, -357, -342, -312, -264, 194, 98, -24, -178, -364, -583, -835, -1119, -1434, -1777, -2143, -2527, -2922, -3321, -3714, -4089,
-4437, -4743, -4995, -5179, -5282, -5289, -5188, -4966, -4613, -4120, -3480, -2688, -1742, -641, 610, 2006, -3539, -5197, -6965, -8828, -10765,
-12756, -14777, -16804, -18811, -20773, -22663, -24455, -26125, -27649, -29006, -30177, -31143, -31892, -32415, -32708, -32768, -32594, -32193,
-31574, -30747, -29729, -28536, -27189, -25709, -24120, -22444, -20707, 18934, 17143, 15365, 13619, 11927, 10307, 8775, 7345, 6028, 4832, 3762,
2820, 2002, 1305, 720, 235, -135, -394, -583, -710, -783, -808, -793, -746, -672, -581, -479, -374, -273, -182, -107, -49,
};
const Word16 LDQMF_20_fx[] = // q = 15 sf = 15390 qsf = 14
{
4, 4, 3, 1, -1, -3, -6, -8, -10, -12, -13, -13, -14, -14, -14, -14, -15, -17, -20, -23, -28, -34, -41, -47, -53, -59, -64, -67, -70, -70, -69, -65,
-60, -53, -44, -33, -21, -8, 5, 20, -36, -51, -67, -82, -97, -111, -125, -138, -150, -162, -173, -182, -191, -199, -207, -213, -218, -223, -227,
-231, -235, -240, -245, -251, -258, -266, -276, -287, -299, -312, -325, -338, -348, -356, -360, -357, -348, -329, -300, -258, 202, 130, 40, -67,
-195, -344, -513, -704, -916, -1149, -1401, -1671, -1957, -2256, -2566, -2882, -3201, -3518, -3828, -4125, -4403, -4655, -4876, -5057, -5193, -5275,
-5297, -5252, -5134, -4936, -4654, -4283, -3818, -3258, -2600, -1843, -987, -34, 1014, 2153, -3380, -4687, -6068, -7514, -9017, -10567, -12153, -13762,
-15383, -17003, -18609, -20188, -21726, -23209, -24625, -25961, -27205, -28346, -29373, -30279, -31052, -31686, -32178, -32523, -32720, -32768, -32666,
-32417, -32026, -31496, -30835, -30049, -29149, -28143, -27043, -25859, -24603, -23288, -21925, -20528, 19110, 17678, 16249, 14835, 13446, 12092, 10783,
9528, 8333, 7207, 6153, 5177, 4281, 3466, 2732, 2078, 1502, 999, 565, 191, -105, -324, -497, -627, -719, -777, -805, -805, -782, -739, -680, -609, -530,
-447, -363, -283, -208, -142, -88, -44,
};
const Word16 LDQMF_30_fx[] = // q = 15 sf = 15388 qsf = 14
{
3, 4, 4, 3, 2, 0, 0, -2, -4, -5, -7, -8, -10, -11, -12, -13, -13, -13, -14, -14, -14, -14, -14, -14, -15, -16, -17, -19, -21, -24, -27, -31, -35, -40,
-44, -48, -52, -56, -60, -63, -66, -68, -69, -70, -70, -69, -67, -65, -61, -57, -51, -45, -39, -31, -23, -15, -6, 3, 12, 22, -33, -43, -54, -64, -75,
-85, -95, -104, -114, -123, -132, -140, -148, -156, -164, -171, -178, -184, -190, -196, -201, -205, -210, -214, -217, -221, -224, -227, -229, -232, -235,
-238, -241, -244, -248, -252, -257, -262, -268, -274, -281, -289, -297, -306, -314, -323, -332, -339, -347, -353, -357, -359, -359, -356, -350, -340, -325,
-306, -281, -250, 212, 168, 116, 56, -11, -87, -172, -267, -370, -484, -606, -738, -880, -1030, -1190, -1358, -1534, -1718, -1908, -2105, -2307, -2514,
-2724, -2936, -3149, -3361, -3571, -3778, -3979, -4173, -4359, -4533, -4695, -4842, -4973, -5084, -5175, -5242, -5284, -5298, -5284, -5238, -5159, -5046,
-4896, -4708, -4480, -4212, -3903, -3551, -3156, -2717, -2234, -1707, -1137, -523, 133, 832, 1572, 2352, -3170, -4024, -4913, -5833, -6784, -7762, -8765,
-9789, -10831, -11888, -12957, -14034, -15115, -16197, -17275, -18346, -19406, -20451, -21476, -22478, -23453, -24398, -25307, -26179, -27008, -27793,
-28529, -29215, -29846, -30422, -30938, -31391, -31783, -32111, -32374, -32571, -32703, -32768, -32766, -32698, -32565, -32367, -32105, -31782, -31399,
-30958, -30462, -29912, -29311, -28663, -27971, -27237, -26465, -25658, -24821, -23956, -23067, -22159, -21234, -20296, 19352, 18397, 17442, 16489, 15542,
14603, 13677, 12766, 11872, 10999, 10150, 9326, 8529, 7762, 7027, 6324, 5656, 5023, 4425, 3864, 3338, 2849, 2396, 1977, 1593, 1242, 922, 633, 371, 134, -63,
-221, -356, -471, -567, -645, -707, -753, -784, -802, -808, -803, -788, -763, -730, -691, -646, -597, -544, -489, -433, -377, -322, -270, -220, -174, -132,
-96, -64, -36,
};
const Word16 LDQMF_32_fx[] = // q = 15 sf = 15392 qsf = 14
{
3, 4, 4, 3, 2, 1, 0, -1, -3, -4, -6, -7, -9, -10, -11, -12, -13, -13, -13, -14, -14, -14, -14, -14, -14, -15, -15, -16, -18, -19, -22, -24, -27, -31, -35,
-39, -43, -47, -51, -54, -58, -61, -64, -66, -68, -70, -70, -70, -69, -67, -65, -62, -58, -53, -48, -42, -35, -28, -20, -12, -4, 4, 13, 22, -33, -42, -52,
-62, -72, -81, -91, -100, -109, -117, -126, -134, -142, -150, -157, -164, -171, -177, -183, -189, -194, -199, -204, -208, -212, -215, -219, -222, -224,
-227, -230, -232, -235, -237, -240, -243, -246, -250, -254, -259, -264, -270, -277, -283, -291, -298, -306, -315, -323, -331, -338, -345, -351, -356, -359,
-360, -358, -354, -347, -336, -321, -302, -278, -248, 213, 172, 125, 70, 8, -60, -137, -221, -314, -415, -525, -642, -768, -902, -1045, -1195, -1352, -1517,
-1688, -1866, -2049, -2237, -2429, -2625, -2822, -3021, -3221, -3419, -3616, -3809, -3997, -4178, -4352, -4516, -4670, -4811, -4937, -5047, -5139, -5212, -5263,
-5292, -5296, -5273, -5223, -5143, -5032, -4889, -4713, -4502, -4256, -3973, -3653, -3296, -2900, -2465, -1992, -1481, -930, -342, 283, 945, 1644, 2377, -3143,
-3942, -4771, -5628, -6512, -7421, -8353, -9304, -10273, -11256, -12252, -13256, -14267, -15281, -16294, -17305, -18309, -19303, -20284, -21249, -22194, -23116,
-24013, -24880, -25715, -26515, -27277, -27999, -28677, -29310, -29896, -30432, -30916, -31344, -31718, -32037, -32299, -32503, -32650, -32738, -32768, -32739,
-32652, -32508, -32308, -32052, -31742, -31379, -30966, -30504, -29994, -29440, -28844, -28207, -27533, -26825, -26085, -25316, -24521, -23703, -22865, -22010,
-21141, -20262, 19377, 18482, 17587, 16693, 15804, 14921, 14049, 13188, 12342, 11512, 10702, 9913, 9147, 8405, 7690, 7003, 6344, 5716, 5118, 4552, 4017, 3514,
3043, 2603, 2195, 1817, 1468, 1149, 856, 590, 348, 127, -58, -207, -337, -448, -542, -620, -683, -733, -769, -793, -806, -808, -800, -784, -760, -729, -692, -651,
-605, -556, -505, -452, -400, -348, -297, -249, -203, -162, -124, -91, -62, -35,
};
const Word16 LDQMF_40_fx[] = // q = 15 sf = 15391 qsf = 14
{
3, 4, 4, 4, 3, 2, 1, 0, 0, -1, -2, -4, -5, -6, -7, -9, -10, -11, -11, -12, -13, -13, -13, -13, -14, -14, -14, -14, -14, -14, -14, -14, -15, -16, -16, -18, -19, -20,
-22, -24, -27, -30, -33, -36, -39, -42, -46, -49, -52, -55, -58, -60, -63, -65, -67, -68, -69, -70, -70, -70, -69, -68, -66, -64, -61, -58, -55, -51, -46, -41, -36,
-30, -24, -18, -11, -5, 1, 9, 16, 23, -32, -39, -47, -55, -63, -71, -78, -86, -93, -101, -108, -115, -122, -128, -135, -141, -147, -153, -159, -165, -170, -175, -180,
-185, -189, -193, -197, -201, -205, -208, -211, -214, -217, -219, -222, -224, -226, -228, -230, -232, -234, -236, -239, -241, -243, -246, -249, -252, -256, -260, -264,
-268, -273, -279, -284, -290, -296, -302, -309, -315, -322, -328, -335, -340, -346, -350, -354, -357, -359, -360, -358, -356, -351, -344, -335, -323, -308, -291, -270,
-245, 217, 185, 149, 109, 64, 15, -38, -97, -161, -230, -304, -384, -469, -559, -655, -755, -861, -973, -1089, -1210, -1336, -1467, -1602, -1741, -1884, -2030, -2180,
-2333, -2487, -2644, -2802, -2962, -3121, -3281, -3439, -3596, -3751, -3903, -4052, -4196, -4335, -4468, -4595, -4714, -4824, -4925, -5016, -5096, -5163, -5218, -5259,
-5286, -5297, -5292, -5269, -5229, -5170, -5091, -4993, -4873, -4732, -4569, -4384, -4175, -3943, -3687, -3407, -3103, -2774, -2420, -2041, -1638, -1210, -758, -281,
218, 743, 1290, 1860, 2452, -3065, -3699, -4352, -5025, -5715, -6423, -7146, -7884, -8636, -9400, -10175, -10960, -11753, -12552, -13357, -14166, -14976, -15788, -16598,
-17406, -18209, -19006, -19795, -20575, -21344, -22101, -22842, -23568, -24276, -24965, -25633, -26279, -26901, -27498, -28069, -28612, -29126, -29610, -30062, -30483,
-30870, -31222, -31539, -31820, -32066, -32276, -32448, -32584, -32683, -32744, -32768, -32754, -32703, -32615, -32491, -32330, -32135, -31904, -31639, -31341, -31010,
-30648, -30255, -29833, -29383, -28905, -28402, -27875, -27325, -26753, -26160, -25550, -24921, -24278, -23620, -22950, -22268, -21577, -20879, -20174, 19467, 18751,
18035, 17319, 16604, 15892, 15185, 14484, 13789, 13103, 12426, 11759, 11105, 10463, 9835, 9222, 8625, 8045, 7481, 6936, 6409, 5901, 5413, 4945, 4497, 4069, 3662, 3275,
2908, 2561, 2234, 1927, 1639, 1370, 1118, 884, 667, 466, 279, 107, -41, -164, -274, -372, -458, -533, -598, -654, -700, -737, -766, -787, -801, -807, -807, -801, -790,
-773, -751, -726, -696, -664, -628, -590, -551, -510, -468, -426, -384, -343, -302, -263, -226, -191, -158, -127, -100, -76, -54, -32,
};
const Word16 LDQMF_60_fx[] = // q = 15 sf = 15391 qsf = 14
{
3, 4, 4, 4, 4, 3, 3, 3, 2, 1, 1, 0, 0, -1, -1, -2, -3, -4, -5, -6, -6, -7, -8, -9, -9, -10, -11, -11, -12, -12, -12, -13, -13, -13, -13, -14, -14, -14, -14, -14, -14, -14,
-14, -14, -14, -14, -14, -14, -15, -15, -16, -16, -17, -18, -19, -20, -21, -22, -23, -25, -26, -28, -30, -32, -34, -36, -39, -41, -43, -45, -47, -49, -51, -53, -55, -57, -59,
-61, -62, -64, -65, -66, -67, -68, -69, -70, -70, -70, -70, -70, -69, -69, -68, -67, -65, -64, -62, -60, -58, -55, -53, -50, -47, -44, -40, -37, -33, -29, -25, -21, -17, -13,
-8, -3, 0, 5, 10, 15, 20, 25, -30, -36, -41, -46, -51, -57, -62, -67, -72, -77, -82, -87, -92, -97, -102, -107, -111, -116, -121, -125, -129, -134, -138, -142, -146, -150,
-154, -158, -162, -166, -169, -173, -176, -179, -182, -186, -189, -191, -194, -197, -199, -202, -204, -207, -209, -211, -213, -215, -216, -218, -220, -221, -223, -224, -226,
-227, -229, -230, -231, -233, -234, -235, -237, -238, -240, -241, -243, -245, -247, -249, -251, -253, -255, -258, -260, -263, -266, -269, -273, -276, -280, -283, -287, -291,
-295, -299, -304, -308, -312, -317, -321, -325, -329, -334, -337, -341, -345, -348, -351, -354, -356, -358, -359, -360, -359, -359, -357, -355, -352, -348, -343, -337, -329,
-321, -311, -300, -287, -273, -258, -241, 222, 202, 180, 156, 130, 102, 72, 40, 6, -29, -67, -107, -150, -195, -242, -292, -344, -398, -454, -513, -575, -638, -704, -773, -843,
-916, -992, -1069, -1149, -1231, -1315, -1401, -1489, -1579, -1671, -1765, -1860, -1957, -2055, -2155, -2256, -2358, -2462, -2566, -2671, -2776, -2882, -2988, -3095, -3201,
-3307, -3413, -3518, -3622, -3726, -3828, -3929, -4028, -4125, -4220, -4313, -4403, -4490, -4574, -4655, -4733, -4806, -4876, -4941, -5002, -5057, -5108, -5153, -5193, -5226,
-5254, -5275, -5289, -5297, -5297, -5289, -5275, -5252, -5221, -5181, -5133, -5077, -5011, -4936, -4851, -4757, -4654, -4540, -4416, -4283, -4138, -3984, -3818, -3642, -3456,
-3258, -3050, -2830, -2600, -2359, -2106, -1843, -1569, -1283, -987, -680, -362, -34, 304, 654, 1013, 1383, 1763, 2153, 2553, -2962, -3380, -3807, -4242, -4687, -5139, -5599,
-6067, -6543, -7025, -7514, -8009, -8510, -9017, -9529, -10046, -10567, -11092, -11620, -12152, -12687, -13223, -13762, -14301, -14842, -15383, -15924, -16464, -17003, -17541,
-18076, -18609, -19139, -19665, -20187, -20705, -21218, -21725, -22226, -22721, -23208, -23688, -24160, -24624, -25079, -25524, -25960, -26386, -26800, -27204, -27596, -27977,
-28345, -28701, -29043, -29373, -29688, -29990, -30278, -30552, -30810, -31052, -31278, -31489, -31685, -31865, -32029, -32177, -32308, -32424, -32522, -32605, -32670, -32719,
-32752, -32768, -32767, -32749, -32715, -32665, -32598, -32515, -32416, -32302, -32171, -32025, -31863, -31687, -31495, -31289, -31068, -30834, -30585, -30324, -30049, -29761,
-29461, -29148, -28824, -28489, -28143, -27786, -27419, -27042, -26656, -26262, -25858, -25447, -25028, -24603, -24170, -23732, -23287, -22838, -22383, -21925, -21462, -20997,
-20528, -20057, 19586, 19110, 18633, 18155, 17677, 17200, 16724, 16248, 15775, 15303, 14834, 14368, 13905, 13445, 12990, 12538, 12092, 11650, 11214, 10783, 10358, 9939, 9527,
9122, 8724, 8333, 7950, 7574, 7207, 6847, 6496, 6153, 5819, 5493, 5177, 4869, 4570, 4281, 4000, 3728, 3466, 3212, 2968, 2732, 2505, 2287, 2078, 1878, 1686, 1502, 1326, 1159,
999, 847, 702, 565, 434, 310, 191, 80, -19, -105, -183, -257, -324, -387, -444, -497, -545, -588, -627, -662, -693, -719, -742, -762, -777, -790, -799, -805, -808, -808, -805,
-800, -792, -782, -770, -755, -739, -721, -701, -680, -658, -634, -609, -584, -557, -530, -503, -475, -447, -419, -391, -363, -336, -309, -283, -257, -232, -208, -185, -163,
-142, -123, -104, -88, -72, -57, -44, -28,
};
#else /* OPT_IVAS_FILTER_ROM */
 
const Word32 CLDFB80_10_fx[100] = // q = 30
{
......@@ -6200,7 +5963,6 @@ const Word32 LDQMF_60_fx[] = // q = 30
-7153632, -6413878, -5706099, -5031208, -4393110, -3792571,
-3230785, -2713518, -2227977, -1784736, -1364255, -871387
};
#endif /* OPT_IVAS_FILTER_ROM */
 
const Word32 rot_vec_delay_re_LDQMF_fx[60] = // q = 31
{
......@@ -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 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_16_fx[160]; // 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_40_fx[400]; // Q30
extern const Word32 LDQMF_60_fx[600]; // Q30
#endif /* OPT_IVAS_FILTER_ROM */
/* Not used anywhere
extern const Word16 LDQMF_10_enc_fx[100];
extern const Word16 LDQMF_16_enc_fx[160];
......
......@@ -619,11 +619,7 @@ typedef struct cldfb_filter_bank_struct
Word16 da; /* delay analysis */
CLDFB_PROTOTYPE prototype;
const Word16 *p_filter; /*!< Pointer to filter coefficients */ // Q15
#ifdef OPT_IVAS_FILTER_ROM
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 */
const Word32 *rot_vec_syn_re_fx; // Q29
......
......@@ -161,7 +161,11 @@ void stat_noise_uv_mod_fx(
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 */
#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 */
#endif
PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe );
}
......@@ -186,7 +190,11 @@ void stat_noise_uv_mod_fx(
tmp_shift = norm_s( tmp_den );
tmp_den = shl( tmp_den, tmp_shift );
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 );
#endif
alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) );
*act_count = 0;
......@@ -467,7 +475,11 @@ void stat_noise_uv_mod_ivas_fx(
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 */
#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 */
#endif
PREEMPH_FX( &Exc2_local[i_subfr], exctilt, L_SUBFR, exc_pe );
}
......@@ -492,7 +504,11 @@ void stat_noise_uv_mod_ivas_fx(
tmp_shift = norm_s( tmp_den );
tmp_den = shl( tmp_den, tmp_shift );
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 );
#endif
alpha = add( 32767, mult( tmp_res, sub( min_alpha, 32767 ) ) );
*act_count = 0;
......
......@@ -242,25 +242,15 @@ Word16 WB_BWE_gain_pred_fx(
enerL = L_deposit_l( enerL_16 );
enerL = L_shl( enerL, 6 ); /*Q6 */
#ifdef FIX_ISSUE_1795_Q3_OVERFLOW
/* Here, we do not multiply L_tmp by 3 to avoid overflow */
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();
#ifdef FIX_ISSUE_1795_Q3_OVERFLOW
#define ONE_DIV_3 ( (Word32) 0x2AAAAAAA )
/* 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 )
#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;
move16();
......@@ -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 */
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 );
#endif
L_temp = L_add_o( L_ener_tot, L_ener, &Overflow );
IF( Overflow != 0 )
{
......
......@@ -2338,7 +2338,11 @@ void ton_ene_est_fx(
move16();
/* 0.06=15729(Q18) */
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 );
#endif
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]); */
......@@ -3209,9 +3213,11 @@ void noiseinj_hf_fx(
Word16 exp_normn, exp_normd;
Word16 div_fx;
Word16 Qdiv;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
#endif
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 );
......@@ -3246,7 +3252,11 @@ void noiseinj_hf_fx(
move32();
/**p_L_En = (float)sqrt(*p_En);*/
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 */
#endif
move16();
}
p_L_En++;
......@@ -3316,7 +3326,11 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ )
/* SQRT Part */
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 );
#endif
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) */
......
......@@ -996,7 +996,9 @@ static void filt_mu_fx(
Word16 mu, ga, temp;
const Word16 *ptrs;
Word16 tmp, exp;
#ifndef ISSUE_1796_replace_shl_o
Flag Overflow = 0;
#endif
move32();
......@@ -1038,7 +1040,11 @@ static void filt_mu_fx(
{
temp = mult_r( mu, ( *ptrs++ ) );
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 );
#endif
move16(); /*Q12 */
}
......@@ -1537,7 +1543,11 @@ void GenShapedWBExcitation_ivas_fx(
n1 = norm_s( max_val );
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
#endif
move16(); /* Q14 */
}
n1 = sub( sub( 14, n1 ), Q_bwe_exc );
......@@ -1620,7 +1630,11 @@ void GenShapedWBExcitation_ivas_fx(
{
/*tmp_vfac = 2*voice_factors[i];
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 );
#endif
}
ELSE
{
......@@ -1789,7 +1803,11 @@ void GenShapedWBExcitation_fx(
n1 = norm_s( max_val );
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 );
#endif
move16(); /* Q14 */
}
n1 = sub( sub( 14, n1 ), Q_bwe_exc );
......@@ -1874,7 +1892,11 @@ void GenShapedWBExcitation_fx(
{
/*tmp_vfac = 2*voice_factors[i];
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 );
#endif
}
ELSE
{
......@@ -5776,7 +5798,11 @@ void non_linearity_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
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 */
#endif
}
}
......@@ -5854,7 +5880,11 @@ void non_linearity_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
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 */
#endif
}
}
......@@ -6028,7 +6058,11 @@ void non_linearity_ivas_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
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 */
#endif
}
}
......@@ -6106,7 +6140,11 @@ void non_linearity_ivas_fx(
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
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 */
#endif
}
}
......@@ -7043,7 +7081,11 @@ void prep_tbe_exc_fx(
tmp = MAX_16;
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 */
#endif
test();
test();
......@@ -7156,8 +7198,10 @@ Word16 swb_formant_fac_fx(
{
Word16 formant_fac;
Word16 tmp;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
#endif
/* Smoothen tilt value */
......@@ -7185,7 +7229,11 @@ Word16 swb_formant_fac_fx(
/* formant_fac = 1.0f - 0.5f*formant_fac */
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 );
#endif
return formant_fac; /*Q15 */
}
......
......@@ -188,20 +188,12 @@ void syn_filt_fx(
Word16 *yy;
Word32 s;
Word16 q;
#ifndef ISSUE_1772_replace_shr_o
Flag Overflow = 0;
move16();
#endif
Word16 a0;
yy = &buf[0];
q = add( norm_s( a[0] ), 1 );
#ifdef ISSUE_1772_replace_shr_o
a0 = shr_sat( a[0], shift ); /* input / 2^shift */
#else
a0 = shr_o( a[0], shift, &Overflow ); /* input / 2^shift */
#endif
/*------------------------------------------------------------------*
* copy initial filter states into synthesis buffer and do synthesis
......@@ -379,11 +371,7 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W
*-----------------------------------------------------------------------*/
mem += m; /*move16();*/
#ifdef ISSUE_1772_replace_shr_o
a0 = shr_sat( a[0], shift ); /* input / 2^shift */
#else
a0 = shr_o( a[0], shift, &Overflow ); /* input / 2^shift */
#endif
/*-----------------------------------------------------------------------*
* Do the filtering
*-----------------------------------------------------------------------*/
......@@ -492,7 +480,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[]
*-----------------------------------------------------------------------*/
mem += m; /*move32();*/
#ifdef ISSUE_1799_replace_L_shr_o
a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */
#else
a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */
#endif
/*-----------------------------------------------------------------------*
* Do the filtering
......