diff --git a/lib_com/options.h b/lib_com/options.h index ab6123579b877b0c0e5bb15de2abc4a839400125..5a623804108a9d8c1f56c331da01da89e2f05840 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,6 +145,7 @@ #define NONBE_FIX_1069_SVD_TUNING /* FhG: issue 1069: tune SVD constants */ #define FIX_778_STEREO_BRATE_SWITCHING #define FIX_774_ENERGY_BURST /* Fix 0 bit BWE */ +#define FIX_729_MISSING_RESCALING /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index e93fdc57cb7bc16dc6b0e4ee89b8b19ffdd3a04f..ffb96c5dfc8cb61c835fa1a47bb8cbfffb42a919 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -727,6 +727,9 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; +#ifdef FIX_729_MISSING_RESCALING + Flag Overflow = 0; +#endif IF( EQ_16( SubFrameLength, L_SUBFR ) ) @@ -767,7 +770,19 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add( temp, *ptrs ); /*Q12 */ +#ifdef FIX_729_MISSING_RESCALING + sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); +#ifdef DEBUGGING + if ( Overflow ) + { + fprintf( stderr, "Saturation in filt_mu_fx for ga = %d, temp = %d, result = %.2f at frame %d\n\n", ga, temp, (float) ga * temp * 4.0 / 65536.0, frame ); + Overflow = 0; + } +#endif + +#else sig_out[n] = shl( mult_r( ga, temp ), 1 ); +#endif move16(); /*Q12 */ } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index 37e2b6b087006e7fb19628382fdcc0c7cc38d287..70c57bff2a11eb747ee1c10f9cd267390818f1c1 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -1733,6 +1733,15 @@ void ivas_swb_tbe_dec_fx( st->prev_Q_bwe_exc_fb = 51; move16(); } + +#ifdef FIX_729_MISSING_RESCALING + /* rescale the TBE post proc memory */ + FOR( i = 0; i < LPC_SHB_ORDER; i++ ) + { + hBWE_TD->mem_stp_swb_fx[i] = shl( hBWE_TD->mem_stp_swb_fx[i], Q_bwe_exc - st->prev_Q_bwe_syn ); + move16(); + } +#endif /* fill-in missing SHB excitation */ IF( ( st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT ) && st->last_core_brate <= SID_2k40 ) {