Commit b0a39d0d authored by fotopoulou's avatar fotopoulou
Browse files

more fixes for bitrate switching - bitrate switching for swb and wb was previously still broken

parent 2d38a862
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ ivas_error ivas_corecoder_dec_reconfig(
    int16_t n, sce_id, cpe_id, output_frame;
    int16_t nSCE_existing, nCPE_existing;
    int32_t ivas_total_brate;
#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
    int16_t nchan_transport_real;
#endif
    MC_MODE last_mc_mode;
    DECODER_CONFIG_HANDLE hDecoderConfig;
    ivas_error error;
@@ -82,6 +85,14 @@ ivas_error ivas_corecoder_dec_reconfig(
        last_mc_mode = MC_MODE_NONE;
    }

#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
    nchan_transport_real = st_ivas->nchan_transport;

    if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
    {
        nchan_transport_real += st_ivas->nchan_ism;
    }
#endif
    /*-----------------------------------------------------------------*
     * Allocate, initialize, and configure SCE/CPE/MCT handles
     *-----------------------------------------------------------------*/
@@ -105,7 +116,11 @@ ivas_error ivas_corecoder_dec_reconfig(
        }
    }

#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
    if ( nchan_transport_real == nchan_transport_old && st_ivas->nSCE == nSCE_old && st_ivas->nCPE == nCPE_old )
#else
    if ( st_ivas->nchan_transport == nchan_transport_old && st_ivas->nSCE == nSCE_old && st_ivas->nCPE == nCPE_old )
#endif
    {
        for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
        {
+3 −0
Original line number Diff line number Diff line
@@ -457,6 +457,9 @@ ivas_error ivas_sba_dec_reconfigure(
            st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
            nCPE_old = st_ivas->nCPE;
            nchan_transport_old = st_ivas->nchan_transport;
#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
            nchan_transport_old += st_ivas->nchan_ism;
#endif
        }
    }

+20 −8
Original line number Diff line number Diff line
@@ -64,7 +64,9 @@ ivas_error ivas_corecoder_enc_reconfig(
    int16_t i, nb_bits;
    Indice temp_ind_list[MAX_NUM_IND_TEMP_LIST];
    int16_t nb_bits_tot;

#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
    int16_t nchan_transport_real, nchan_transport_old_real;
#endif
    ENCODER_CONFIG_HANDLE hEncoderConfig;
    ivas_error error;

@@ -81,11 +83,24 @@ ivas_error ivas_corecoder_enc_reconfig(
        len_inp_memory += NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS );
    }

#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
    nchan_transport_old_real = nchan_transport_old;
    nchan_transport_real = st_ivas->nchan_transport;

    if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
    {
        nchan_transport_real += st_ivas->hEncoderConfig->nchan_ism;
    }
#endif

    /*-----------------------------------------------------------------*
     * Switching between SCE(s)/CPE(s)/MCT
     *-----------------------------------------------------------------*/

#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
    if ( nchan_transport_real == nchan_transport_old_real && st_ivas->nSCE == nSCE_old && st_ivas->nCPE == nCPE_old ) /* in McMASA, nchan_transport may be the same, but nSCE/nCPE differs */
#else
    if ( st_ivas->nchan_transport == nchan_transport_old && st_ivas->nSCE == nSCE_old && st_ivas->nCPE == nCPE_old ) /* in McMASA, nchan_transport may be the same, but nSCE/nCPE differs */
#endif
    {
        for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
        {
@@ -117,17 +132,14 @@ ivas_error ivas_corecoder_enc_reconfig(
    }
    else
    {
#ifndef NONBE_FIX_752_OSBA_MISCONFIG_MCT
        int16_t nchan_transport_real, nchan_transport_old_real;


        nchan_transport_old_real = nchan_transport_old;
        nchan_transport_real = st_ivas->nchan_transport;

#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
        if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
            nchan_transport_real += st_ivas->hEncoderConfig->nchan_ism;
        }
#endif

        /* in SCE+CPE McMASA nchan_transport is still 2, fix the numbers */
        if ( hEncoderConfig->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA )
        {
+7 −0
Original line number Diff line number Diff line
@@ -222,6 +222,13 @@ ivas_error ivas_mct_enc(
        int32_t cp_bitrate;
        cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS;

#ifdef NONBE_FIX_752_OSBA_MISCONFIG_MCT
        if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
            cp_bitrate = ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS;
        }
#endif

        for ( n = 0; n < (int16_t) ( hMCT->nchan_out_woLFE * 0.5 ); n++ )
        {
            initMdctStereoEncData( hMCT->hBlockData[n]->hStereoMdct, ivas_format, IVAS_CPE_MDCT, cp_bitrate, max_bwidth, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFEnc->igfData.igfInfo.grid, 0 );