diff --git a/lib_com/options.h b/lib_com/options.h index 452039c9629ef462d94d1937a56f10a211fff013..0b3fb0010fe8cd3e3b65f6ee2244c44f786ca06c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -78,6 +78,7 @@ #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_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */ /* #################### 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 */ diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index f2172a821195e33434e0252cc2bd7672296f7ec8..8e2f9fc131131831623f9784b12643c374d99e3c 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -653,7 +653,11 @@ ivas_error ivas_cpe_dec_fx( IF( NE_16( shift, 31 ) ) { +#ifdef FIX_1946_CRASH_JBM_PROCESSING + shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */ +#else shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q16 ); /* Q16 for guard bits */ +#endif IF( GT_16( shift, hCPE->hStereoDft->q_dft ) ) { diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 7d3bec07d2135d922a19fc6527c9cc8f8fe0b92f..271e34443410a907d6b9880a57498e8a050b8449 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -3171,16 +3171,25 @@ void stereo_dft_generate_res_pred_fx( move32(); DFT_PRED_RES[2 * i + 1] = L_add( L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i + 1], g_short ), q_shift0 ), L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_long_ind][2 * i + 1], g_long ), q_shift1 ) ); /* q_dft */ move32(); +#ifndef FIX_1946_CRASH_JBM_PROCESSING past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i] ), DFT_PRED_RES[2 * i + 1], DFT_PRED_RES[2 * i + 1] ); /* q_dft */ +#endif } test(); IF( !bfi || GE_16( b, hStereoDft->res_cod_band_max ) ) { Word16 q_div; Word16 op; +#ifdef FIX_1946_CRASH_JBM_PROCESSING + FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) + { + past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i] ), DFT_PRED_RES[2 * i + 1], DFT_PRED_RES[2 * i + 1] ); /* q_dft */ + } +#endif op = BASOP_Util_Divide3232_Scale( L_add( 1, dmx_nrg ), L_add( 1, past_dmx_nrg ), &q_div ); /* q_sqrt */ q_sqrt = q_div; move16(); + norm_fac = Sqrt16( op, &q_sqrt ); g2 = Mpy_32_16_1( pPredGain[b], norm_fac ); /* Q31 */ IF( LE_32( q_sqrt, norm_l( g2 ) ) )