Skip to content
Commits on Source (8)
...@@ -77,13 +77,16 @@ ...@@ -77,13 +77,16 @@
#define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ #define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */
#define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ #define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */
#define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */ #define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */
#define FIX_1978_SAT_MISSING_IN_GAIN_ENC /* VA: Fix add saturation missing that lead to a crash in P800-10 */ #define FIX_1978_SAT_MISSING_IN_GAIN_ENC /* VA: Fix add saturation missing that lead to a crash in P800-10 */
//#define FIX_1981_MAXIMUM_EXP_FX /* FhG: Fix bug in function to find maximum value in vector */ #define FIX_1981_MAXIMUM_EXP_FX /* FhG: Fix bug in function to find maximum value in vector */
#define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */ #define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */
#define FIX_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */ #define FIX_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */
#define FIX_1980_CRASH_FDCNG_ENCODESID /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */ #define FIX_1980_CRASH_FDCNG_ENCODESID /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */
#define FIX_1987_CRASH_OMASA_ENERGY /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */ #define FIX_1987_CRASH_OMASA_ENERGY /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */
#define FIX_1985_SBA_714_HF_LOSS /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/
/* #################### Start BASOP porting switches ############################ */ /* #################### Start BASOP porting switches ############################ */
#define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
......
...@@ -1230,21 +1230,44 @@ Word16 maximum_exp_fx( /* o : index of the maximum value ...@@ -1230,21 +1230,44 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
exp = exp_vec[0]; exp = exp_vec[0];
move16(); move16();
#else #else
Word16 tmp, exp, scale;
ind = 0; ind = 0;
move16(); move16();
#endif #endif
#if 0
float vec_float[1024];
for ( int ii = 0; ii < lvec_fx; ii++ )
vec_float[ii] = vec_fx[ii] * pow( 2, exp_vec[ii] - 31 );
#endif
#ifdef FIX_1981_MAXIMUM_EXP_FX
scale = sub( norm_s( vec_fx[ind] ), 1 );
FOR( j = 1; j < lvec_fx; j++ ) FOR( j = 1; j < lvec_fx; j++ )
{ {
#ifdef FIX_1981_MAXIMUM_EXP_FX
if ( LE_16( vec_fx[ind], shr_sat( vec_fx[j], sub( exp_vec[ind], exp_vec[j] ) ) ) ) IF( LT_16( tmp, shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ) ) )
{ {
ind = j; ind = j;
move16(); move16();
scale = sub( norm_s( vec_fx[ind] ), 1 );
tmp = shl(vec_fx[j], scale);
exp = sub( exp_vec[j], scale );
}
} }
#else #else
FOR( j = 1; j < lvec_fx; j++ )
{
#if 0
// insert assert to find critical bitstreams // insert assert to find critical bitstreams
{ {
static int calls = 0;
calls++;
Word16 tmp16, tmp16_1; Word16 tmp16, tmp16_1;
Word32 tmp32, tmp32_1; Word32 tmp32, tmp32_1;
tmp16 = tmp; tmp16 = tmp;
...@@ -1252,8 +1275,14 @@ Word16 maximum_exp_fx( /* o : index of the maximum value ...@@ -1252,8 +1275,14 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
tmp16_1 = shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ); tmp16_1 = shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) );
tmp32_1 = L_shr_sat( L_deposit_l( vec_fx[j] ), sub( exp, exp_vec[j] ) ); tmp32_1 = L_shr_sat( L_deposit_l( vec_fx[j] ), sub( exp, exp_vec[j] ) );
assert( LT_16( tmp16, tmp16_1 ) == LT_32( tmp32, tmp32_1 ) ); if ( ( LT_16( tmp16, tmp16_1 ) != LT_32( tmp32, tmp32_1 ) ) )
{
tmp16 = LT_16( tmp16, tmp16_1 );
tmp32 = LT_32( tmp32, tmp32_1 );
assert( tmp16 == tmp32 );
} }
}
#endif
IF( LT_16( tmp, shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ) ) ) IF( LT_16( tmp, shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ) ) )
{ {
...@@ -1264,8 +1293,11 @@ Word16 maximum_exp_fx( /* o : index of the maximum value ...@@ -1264,8 +1293,11 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
exp = exp_vec[j]; exp = exp_vec[j];
move16(); move16();
} }
#endif
} }
#endif
#if 0 /*value out*/
printf( "\n val= %15.15f", vec_fx[ind] * pow(2,exp_vec[ind] - 15) );
#endif
return ind; return ind;
} }
......
...@@ -2632,10 +2632,48 @@ void protoSignalComputation4_fx( ...@@ -2632,10 +2632,48 @@ void protoSignalComputation4_fx(
Word32 sq_tmp_fx; Word32 sq_tmp_fx;
Word32 *p_proto_buffer_fx; Word32 *p_proto_buffer_fx;
Word16 min_q_shift, q_shift; Word16 min_q_shift, q_shift;
#ifndef FIX_1985_SBA_714_HF_LOSS
Word16 min_q_shift2, q_shift2; Word16 min_q_shift2, q_shift2;
#endif
Word32 re, im; Word32 re, im;
Word16 proto_power_smooth_fx_q, sq_tmp_q; Word16 proto_power_smooth_fx_q, sq_tmp_q;
#ifdef FIX_1985_SBA_714_HF_LOSS
Word64 ref_pow64[CLDFB_NO_CHANNELS_MAX], re64;
Word16 sf1, sf2;
#endif
#ifdef FIX_1985_SBA_714_HF_LOSS
FOR( l = 0; l < num_freq_bands; l++ )
{
re64 = W_mult_32_32( RealBuffer_fx[0][0][l], RealBuffer_fx[0][0][l] );
re64 = W_mac_32_32( re64, ImagBuffer_fx[0][0][l], ImagBuffer_fx[0][0][l] );
ref_pow64[l] = W_shr( re64, 1 ); // 2*q_cldfb +1
move64();
}
FOR( k = 1; k < 4; k++ )
{
FOR( l = 0; l < num_freq_bands; l++ )
{
re64 = W_mult_32_32( RealBuffer_fx[k][0][l], RealBuffer_fx[k][0][l] );
re64 = W_mac_32_32( re64, ImagBuffer_fx[k][0][l], ImagBuffer_fx[k][0][l] );
ref_pow64[l] = W_add( ref_pow64[l], W_shr( re64, 1 ) ); // 2*q_cldfb +1
move64();
}
}
sf1 = W_norm_arr( ref_pow64, s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) );
FOR( l = 0; l < s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ); l++ )
{
reference_power_fx[l] = W_extract_h( W_shl( ref_pow64[l], sf1 ) );
}
reference_power_q[0] = sub( add( shl( q_cldfb, 1 ), sf1 ), 31 );
sf2 = W_norm_arr( &ref_pow64[CLDFB_NO_CHANNELS_HALF], s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) );
FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ )
{
reference_power_fx[l] = W_extract_h( W_shl( ref_pow64[l], sf2 ) );
}
reference_power_q[1] = sub( add( shl( q_cldfb, 1 ), sf2 ), 31 );
#else
min_q_shift = Q31; min_q_shift = Q31;
move16(); move16();
q_shift = Q31; q_shift = Q31;
...@@ -2695,8 +2733,22 @@ void protoSignalComputation4_fx( ...@@ -2695,8 +2733,22 @@ void protoSignalComputation4_fx(
sq_tmp_q = sub( add( add( q_cldfb, min_q_shift2 ), add( q_cldfb, min_q_shift2 ) ), 31 ); sq_tmp_q = sub( add( add( q_cldfb, min_q_shift2 ), add( q_cldfb, min_q_shift2 ) ), 31 );
reference_power_q[1] = sq_tmp_q; reference_power_q[1] = sq_tmp_q;
move16(); move16();
#endif
#ifdef FIX_1985_SBA_714_HF_LOSS
min_q_shift = Q31;
/* calculate the shift possible for both RealBuffer_fx and ImagBuffer_fx buffers*/
FOR( k = 0; k < s_max( 4, nchan_transport ); k++ )
{
q_shift = L_norm_arr( RealBuffer_fx[k][0], num_freq_bands );
min_q_shift = s_min( q_shift, min_q_shift );
q_shift = L_norm_arr( ImagBuffer_fx[k][0], num_freq_bands );
min_q_shift = s_min( q_shift, min_q_shift );
}
min_q_shift = sub( min_q_shift, find_guarded_bits_fx( 2 ) );
#else
min_q_shift = sub( s_min( q_shift, q_shift2 ), find_guarded_bits_fx( 2 ) ); min_q_shift = sub( s_min( q_shift, q_shift2 ), find_guarded_bits_fx( 2 ) );
#endif
/*For decorrelated diffuseness*/ /*For decorrelated diffuseness*/
FOR( l = 0; l < num_outputs_diff; l++ ) FOR( l = 0; l < num_outputs_diff; l++ )
......