Commit fa151856 authored by vaillancour's avatar vaillancour
Browse files

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

parent 36219e01
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -131,6 +131,8 @@
#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

/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+14 −0
Original line number Diff line number Diff line
@@ -916,7 +916,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, 18 - ( st->prev_Q_bwe_exc - 16 ) );                                       // Q18
#ifndef FIX_736_BWE_SECT_C
                L_mixExc16k = L_shl( L_mixExc16k, 18 - st->Q_exc );                                                       // Q18
#else
                L_mixExc16k = L_shl( L_mixExc16k, 18 - ( st->prev_Q_bwe_exc - 25 ) ); // Q18
#endif
                excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q18
                move32();
                k++;
@@ -2028,9 +2032,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 );
@@ -2040,7 +2050,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 );