Commit efb050e7 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '736-random-behaviour-of-bwe-at-32-kbps' into 'main'

Propose fix for the last problem of 736, related to icBWE

See merge request !296
parents 21208d6e 7245d585
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@
#define FIX_746  // proposed fix to solve low bit-rate frame boundaries issues 
#define FIX_SATURATION_725  // Propose fix for saturation in AVQ
#define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */

#define FIX_736_BWE_SECT_C        // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE
#define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP
/* ################## End DEVELOPMENT switches ######################### */

+2145 −2131
Original line number Diff line number Diff line
@@ -917,7 +917,11 @@ void stereo_icBWE_dec_fx(
                L_nlExc16k = L_deposit_l( hStereoICBWE->nlExc16k_fx[k] );                                                 // prev_q_bwe_exc - 16
                L_mixExc16k = L_deposit_l( hStereoICBWE->mixExc16k_fx[k] );                                               // Q_exc
                L_nlExc16k = L_shl( L_nlExc16k, Q_icBWE - ( st->prev_Q_bwe_exc - 16 ) );                                  // Q_icBWE
#ifndef FIX_736_BWE_SECT_C
                L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - st->Q_exc );                                                  // Q_icBWE
#else
                L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - ( st->prev_Q_bwe_exc - 25 ) );                                // Q_icBWE
#endif
                excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q_icBWE
                move32();
                k++;
@@ -2032,9 +2036,15 @@ void stereo_icBWE_decproc_fx(
            win_out_fx = L_sub( ONE_IN_Q31, win_in_fx );                                                                    /* Q31 */

            gain0_fx = Mpy_32_32( win_in_fx, hCPE->hStereoDft->td_gain_fx[0] );                                                                                                                              /* Q --> q_td_gain[0] */
#ifdef FIX_736_BWE_SECT_C
            gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */
            gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] );                                                                                                                             /* Q --> q_td_gain[1] */
            gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */
#else
            gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */
            gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] );                                                                                                                             /* Q --> q_td_gain[1] */
            gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */
#endif
            tmp_fx = L_add_sat( gain0_fx, gain1_fx );                                                                                                                                                        /* Q --> q_output */

            output[0][i] = L_add_sat( output[0][i], tmp_fx );
@@ -2044,7 +2054,11 @@ void stereo_icBWE_decproc_fx(
        }
        FOR( i = dftOvlLen; i < output_frame; i++ )
        {
#ifdef FIX_736_BWE_SECT_C
            tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */
#else
            tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */
#endif
            output[0][i] = L_add_sat( output[0][i], tmp_fx );
            move32();
            output[1][i] = L_sub_sat( output[1][i], tmp_fx );