diff --git a/lib_com/hq2_bit_alloc.c b/lib_com/hq2_bit_alloc.c index b46f54480e78f00ab8bad762c518b94468c40fdd..270c1306175779e042f4fc34728630f0a6e861dd 100644 --- a/lib_com/hq2_bit_alloc.c +++ b/lib_com/hq2_bit_alloc.c @@ -375,6 +375,13 @@ void hq2_bit_alloc_har( Word32 L_y[BANDS_MAX]; +#ifdef FIX_150 +#ifdef BASOP_NOGLOB + Flag Overflow; + Overflow = 0; +#endif +#endif + grp_rngmax_fx[0] = 0; grp_rngmax_fx[1] = 0; @@ -639,7 +646,16 @@ void hq2_bit_alloc_har( L_temp = Mpy_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */ L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */ +#ifdef FIX_150 +#ifdef BASOP_NOGLOB + lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow ); + Overflow = 0; /* reset BASOP Overflow */ +#else lf_hf_ge_r_fx = round_fx( L_shl( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); +#endif +#else + lf_hf_ge_r_fx = round_fx( L_shl( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) ); +#endif exp_normn = norm_s( norm_sum_fx ); exp_normn = sub( exp_normn, 1 ); diff --git a/lib_com/options.h b/lib_com/options.h index b462e5ec50e92c88facfc16130298d349d5c817b..e46be24d689dedd163775c3fd0a07757e1988bef 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,7 @@ #define FIX_ITD /* Contribution 16: TD renderer ITD improvement and code cleanup */ #define BRATE_SWITCHING_RENDERING /* Bitrate switching changes related to the renderers */ #define FIX_ISM_DECODER_PRINTOUT /* Issue 229: fix ISM decoder printout */ +#define FIX_150 /* Issue 150: Crash in EVS mono, HQ_HARMONIC mode, related to BASOP_NOGLOB */ #define FIX_REND_ISM_XFADE /* Issue 193: Crossfade inconsistencies in ISM between decoder and external renderer */ #define FIX_REND_ISM_POS_ROUNDING /* Issue 193: (Temporary solution until fix for #215) Align rounding of ISM position data in external renderer */ #define FIX_REND_ISM_STEREO_PANNING /* Issue 193: Use tangent panning for ISM to stereo in external renderer */ @@ -163,7 +164,6 @@ #define IMPROVE_CMDLINE_ROBUSTNESS /* Issue 233: Improve robustness of command-line parameters */ #define FIX_MDCT_AND_MC_MONO_ISSUES /* Issue 242: Fix some issues with TCX-LTP and delay alignement for mono output */ - /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_enc/swb_bwe_enc.c b/lib_enc/swb_bwe_enc.c index 54e786d7616073b63b86b98b092e6586df8b6b8b..01c586fcbc882c2219837964400594a97e2500d0 100644 --- a/lib_enc/swb_bwe_enc.c +++ b/lib_enc/swb_bwe_enc.c @@ -1795,6 +1795,13 @@ void hq_generic_hf_encoding( { Word16 tmp, frac, exp; Word32 L_tmp; +#ifdef FIX_150 +#ifdef BASOP_NOGLOB + Flag Overflow; + + Overflow = 0; +#endif +#endif tmp = add( (int16_t) ( hq_generic_fenv[n_band] * 256 ), (int16_t) ( Mean_env[n_band] * 256 ) ); /*Q8 */ L_tmp = L_mult( tmp, 21771 ); /* 0.166096 in Q17 -> Q26 */ @@ -1805,7 +1812,15 @@ void hq_generic_hf_encoding( /* output of Pow2() will be: */ /* 16384 < Pow2() <= 32767 */ exp = sub( exp, 13 ); - tmp = shl( tmp, add( exp, 1 ) ); /*Q1 */ +#ifdef FIX_150 +#ifdef BASOP_NOGLOB + tmp = shl_o( tmp, add( exp, 1 ), &Overflow ); /*Q1 */ +#else + tmp = shl( tmp, add( exp, 1 ) ); /*Q1 */ +#endif +#else + tmp = shl( tmp, add( exp, 1 ) ); /*Q1 */ +#endif hq_generic_fenv[n_band] = (float) tmp * 0.5f; /*Q1 */ }