Commit 77797a59 authored by norvell's avatar norvell Committed by Manuel Jander
Browse files

Add FIX_1461_CNG_BW_SWITCHING to address BW switching in Stereo CNG

parent a4056538
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -130,6 +130,9 @@ ivas_error ivas_cpe_enc_fx(
    Word16 old_wsp_fx[CPE_CHANNELS][L_WSP];
    Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp;
    Word16 Q_new[CPE_CHANNELS] = { 0 };
#ifdef FIX_1461_CNG_BW_SWITCHING
    Word16 NFFT_inner;
#endif
    move16();
    move16();
    Word16 q_com, shift, q_min, gb;
@@ -1182,6 +1185,12 @@ ivas_error ivas_cpe_enc_fx(
            IF( EQ_32( sts[0]->core_brate, SID_2k40 ) || sts[0]->core_brate == FRAME_NO_DATA )
            {
                /* Reconfigure DFT Stereo for inactive frames */
#ifdef FIX_1461_CNG_BW_SWITCHING
                /* -- nbands may need to be updated here in case the bandwidth was changed due to inactive frames */
                NFFT_inner = shl( inner_frame_tbl[sts[0]->bwidth], 1 );
                hCPE->hStereoDft->nbands = stereo_dft_band_config_fx( hCPE->hStereoDft->band_limits, hCPE->hStereoDft->hConfig->band_res, NFFT_inner, ENC );
                move16();
#endif
                IF( EQ_32( sts[0]->core_brate, SID_2k40 ) )
                {
                    stereo_dft_config_fx( hConfigDft, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+11 −0
Original line number Diff line number Diff line
@@ -3853,6 +3853,17 @@ static void stereo_dft_enc_compute_prm_fx(
    hStereoDft->nrg_past_pos = ( pos + 1 ) % STEREO_DFT_NRG_PAST_LEN;
    move16();

#ifdef FIX_1461_CNG_BW_SWITCHING
    /* Replicate last band for remaining bands in case the bandwidth is higher after SID/NODATA is considered */
    FOR( i = hStereoDft->nbands; i < STEREO_DFT_BAND_MAX; i++ )
    {
        pPredGain[i] = pPredGain[i - 1];
        move32();
        pSideGain[i] = pSideGain[i - 1];
        move32();
    }
#endif


    /*------------------------------------------------------------------*
     * Compute IPDs