From 4cacc9a846a7e826895e36d43cbb573e9c48a4b6 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 6 Feb 2025 12:36:04 +0530 Subject: [PATCH] Fix for 3GPP issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps Link #1245 --- lib_com/options.h | 1 + lib_enc/cng_enc_fx.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fa1fd8f4e..ea2823ad7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,5 +151,6 @@ #define FIX_ISSUE_1237_KEEP_EVS_BE /* VA: Fix to keep EVS bitexactness to 26.444 */ #define FIX_ISSUE_1214 /* Ittiam: Fix for issue 1214: Energy leakage in IGF tiles for MDCT-stereo @64kbps SWB*/ #define FIX_881_HILBERT_FILTER /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */ +#define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ #endif #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 8a2495b40..4cfc193ec 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2024,13 +2024,23 @@ void CNG_enc_ivas_fx( /* convert log2 of residual signal energy */ /*enr = (float)log10( enr + 0.1f ) / (float)log10( 2.0f ); */ - hi = norm_l( L_ener ); - lo = Log2_norm_lc( L_shl( L_ener, hi ) ); - hi = sub( 29, hi ); /* log2 exp in Q2*Q_new */ - hi = sub( hi, shl( Q_new, 1 ) ); /* Q0 */ - L_tmp = L_Comp( hi, lo ); /* Q16 */ - enr = round_fx( L_shl( L_tmp, 8 ) ); /* Q8 (16+8-16) */ +#ifdef FIX_ISSUE_1245 + IF( L_ener == 0 ) + { + enr = -850; /*log(0.1) base 2 in Q8*/ + move16(); + } + ELSE +#endif + { + hi = norm_l( L_ener ); + lo = Log2_norm_lc( L_shl( L_ener, hi ) ); + hi = sub( 29, hi ); /* log2 exp in Q2*Q_new */ + hi = sub( hi, shl( Q_new, 1 ) ); /* Q0 */ + L_tmp = L_Comp( hi, lo ); /* Q16 */ + enr = round_fx( L_shl( L_tmp, 8 ) ); /* Q8 (16+8-16) */ + } /* update the circular buffer of old energies */ hTdCngEnc->cng_ener_hist_fx[hTdCngEnc->cng_hist_ptr] = enr; move16(); /* Q8 */ -- GitLab