From d4ad9d9dee9efcf4f58c12e9a5d4f7260a417b9e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 11 Dec 2024 18:07:41 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 895: Bitrate switching quality issue, low level square wave link #895 --- lib_com/fft_fx.c | 11 +++++++++++ lib_com/prot_fx.h | 1 + lib_dec/ivas_mdct_core_dec.c | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 64a4c8be2..4c2aaa5d6 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -7299,3 +7299,14 @@ Flag is_zero_arr( Word32 *arr, Word16 size ) return 1; } + +Flag is_zero_arr16( Word16 *arr, Word16 size ) +{ + FOR( Word16 i = 0; i < size; i++ ) + IF( arr[i] != 0 ) + { + return 0; + } + + return 1; +} \ No newline at end of file diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 40086183d..e743c6ff0 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4557,6 +4557,7 @@ Word16 L_norm_arr( Word32 *arr, Word16 size ); Word16 get_min_scalefactor( Word32 x, Word32 y ); Flag is_zero_arr( Word32 *arr, Word16 size ); +Flag is_zero_arr16( Word16 *arr, Word16 size ); void edct2_fx_ivas( const Word16 n, diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 96f15b91d..b80bff932 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -1168,7 +1168,12 @@ void ivas_mdct_core_reconstruct_fx( } synth_fx = synth_buf_fx + st->hTcxDec->old_synth_len; synthFB_fx = synth_bufFB_fx + st->hTcxDec->old_synth_lenFB; - + test(); + if ( is_zero_arr16( st->hTcxDec->old_synth, st->hTcxDec->old_synth_len ) && is_zero_arr16( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synth_lenFB ) ) + { + st->hTcxDec->q_old_synth = 0; + move16(); + } Copy( st->hTcxDec->old_synth, synth_buf_fx, st->hTcxDec->old_synth_len ); // Q = st->hTcxDec->q_old_synth Copy_Scale_sig( st->hTcxDec->old_synthFB_fx, synth_bufFB_fx, st->hTcxDec->old_synth_lenFB, sub( st->hTcxDec->q_old_synth, st->Q_syn ) ); // Q = st->hTcxDec->q_old_synth q_syn = st->hTcxDec->q_old_synth; -- GitLab From b5d0a2253a56e1bf159177b3dbe003514eecacf5 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 11 Dec 2024 18:14:04 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_com/fft_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 4c2aaa5d6..2ab8a9451 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -7309,4 +7309,4 @@ Flag is_zero_arr16( Word16 *arr, Word16 size ) } return 1; -} \ No newline at end of file +} -- GitLab