From 2b8875ee9b592244e1e3be965d13c40707d9cd56 Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Thu, 10 Apr 2025 16:33:10 +0530 Subject: [PATCH] Fix for 3GPP issue 1447: BASOP encoder: W channel sounds dull and distorted in OSBA at 48 kbps with the LTV --- lib_enc/analy_sp_fx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index bd4ad12ba..4f96ea2d4 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -494,9 +494,9 @@ void ivas_analy_sp_fx( } ELSE { - Word16 scale = 0; + Word16 scale = 0, shift; move16(); - + shift = s_min( norm_arr( speech + 3 * ( L_SUBFR / 2 ) - L_FFT / 2, L_FFT ), norm_arr( speech + 7 * ( L_SUBFR / 2 ) - L_FFT / 2, L_FFT ) ); FOR( i_subfr = 0; i_subfr <= 1; i_subfr++ ) { /* set pointer to the beginning of the signal for spectral analysis */ @@ -507,27 +507,26 @@ void ivas_analy_sp_fx( /* set the pointer for second analysis window */ pt = speech + 7 * ( L_SUBFR / 2 ) - L_FFT / 2; } - /* Clear 1st value of 1st part, copy 1st value of 2nd part */ pt_fft[0] = 0; move16(); - pt_fft[L_FFT / 2] = pt[L_FFT / 2]; // Q_new - preemph_bits + pt_fft[L_FFT / 2] = shl( pt[L_FFT / 2], shift ); // (Q_new + shift) - preemph_bits move16(); FOR( i = 1; i < L_FFT / 2; i++ ) { /* 1st windowed part */ - pt_fft[i] = mult_r( pt[i], sqrt_han_window_fx[i] ); // Q_new - preemph_bits + pt_fft[i] = mult_r( shl( pt[i], shift ), sqrt_han_window_fx[i] ); // (Q_new + shift) - preemph_bits move16(); /* 2nd windowed part */ - pt_fft[L_FFT - i] = mult_r( pt[L_FFT - i], sqrt_han_window_fx[i] ); // Q_new - preemph_bits + pt_fft[L_FFT - i] = mult_r( shl( pt[L_FFT - i], shift ), sqrt_han_window_fx[i] ); // (Q_new + shift) - preemph_bits move16(); } /* compute the spectrum */ fft_rel_16_32fx( pt_fft, &scale, i_subfr, L_FFT, LOG2_L_FFT ); - *q_fft_buff = add( Q_new, scale ); // resultant q for fft_buff + *q_fft_buff = add( add( Q_new, shift ), scale ); // resultant q for fft_buff move16(); IF( EQ_16( i_subfr, 1 ) ) { -- GitLab