Commit 83b9a851 authored by Jouni Paulus's avatar Jouni Paulus
Browse files

fix: re-instantiate CPE when bitrate switching McMASA<->non-McMASA as the...

fix: re-instantiate CPE when bitrate switching McMASA<->non-McMASA as the internal settings depend from the MC-mode. clean-up DFT-stereo dummy-CPE
parent 939dc7fc
Loading
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -343,11 +343,12 @@ ivas_error ivas_corecoder_dec_reconfig(
#ifdef MCMASA_BITRATE_SWITCHING
    Decoder_Struct *st_ivas,                 /* i/o: IVAS decoder structure                                    */
    const int16_t nSCE_old,                  /* i  : number of SCEs in previous frame                          */
    const int16_t nCPE_old,                                     /* i  : number of CPEs in previous frame                          */
    int16_t nCPE_old,                        /* i  : number of CPEs in previous frame                          */
    const int16_t nchan_transport_old,       /* i  : number of TCs in previous frame                           */
    const int16_t sba_dirac_stereo_flag_old, /* i  : signal stereo rendering using DFT upmix in previous frame */
    const int32_t brate_SCE,                                    /* i  : bitrate to be set for the SCEs                            */
    const int32_t brate_CPE                                     /* i  : bitrate to be set for the CPEs                            */
    const int32_t brate_SCE,                 /* i  : bitrate to be set for the SCEs                            */
    const int32_t brate_CPE,                 /* i  : bitrate to be set for the CPEs                            */
    const MC_MODE last_mc_mode               /* i  : MC mode in the previous frame                             */
#else
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int16_t nSCE_old,                                     /* i  : number of SCEs in previous frame        */
+18 −4
Original line number Diff line number Diff line
@@ -50,18 +50,19 @@
/*-------------------------------------------------------------------*
 * ivas_corecoder_dec_reconfig()
 *
 * Allocate, initialize, and configure SCE/CPE/MCT handles in case of bitrate switching
 * Allocate, initalize, and configure SCE/CPE/MCT handles in case of bitrate switching
 *-------------------------------------------------------------------*/

ivas_error ivas_corecoder_dec_reconfig(
#ifdef MCMASA_BITRATE_SWITCHING
    Decoder_Struct *st_ivas,                 /* i/o: IVAS decoder structure                                    */
    const int16_t nSCE_old,                  /* i  : number of SCEs in previous frame                          */
    const int16_t nCPE_old,                  /* i  : number of CPEs in previous frame                          */
    int16_t nCPE_old,                        /* i  : number of CPEs in previous frame                          */
    const int16_t nchan_transport_old,       /* i  : number of TCs in previous frame                           */
    const int16_t sba_dirac_stereo_flag_old, /* i  : signal stereo rendering using DFT upmix in previous frame */
    const int32_t brate_SCE,                 /* i  : bitrate to be set for the SCEs                            */
    const int32_t brate_CPE                  /* i  : bitrate to be set for the CPEs                            */
    const int32_t brate_CPE,                 /* i  : bitrate to be set for the CPEs                            */
    const MC_MODE last_mc_mode               /* i  : MC mode in the previous frame                             */
#else
    Decoder_Struct *st_ivas,                /* i/o: IVAS decoder structure                               */
    const int16_t nSCE_old,                 /* i  : number of SCEs in previous frame                     */
@@ -94,7 +95,7 @@ ivas_error ivas_corecoder_dec_reconfig(
    /* remove dummy CPE element for DFT stereo-like upmix */
#ifdef MCMASA_BITRATE_SWITCHING
    if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) ||
         ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) )
         ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) )
#else
    if ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag )
#endif
@@ -171,6 +172,19 @@ ivas_error ivas_corecoder_dec_reconfig(
            st_ivas->hCPE[cpe_id] = NULL;
        }

#ifdef MCMASA_BITRATE_SWITCHING
        /* the CPE-internal settings depend from ivas_format and mc_mode, so clean-up when switching between mc_modes */
        if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != last_mc_mode && ( st_ivas->mc_mode == MC_MODE_MCMASA || last_mc_mode == MC_MODE_MCMASA ) )
        {
            for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ )
            {
                destroy_cpe_dec( st_ivas->hCPE[cpe_id] );
                st_ivas->hCPE[cpe_id] = NULL;
            }
            nCPE_old = 0;
            nCPE_existing = min( nCPE_old, st_ivas->nCPE );
        }
#endif
        if ( st_ivas->nCPE <= 1 && st_ivas->hMCT != NULL )
        {
            ivas_mct_dec_close( &st_ivas->hMCT );
+1 −1
Original line number Diff line number Diff line
@@ -901,7 +901,7 @@ ivas_error ivas_mc_dec_reconfig(
        new_brate_SCE = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport;
        new_brate_CPE = ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS;
    }
    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE ) ) != IVAS_ERR_OK )
    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE, last_mc_mode ) ) != IVAS_ERR_OK )
#else
    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old ) ) != IVAS_ERR_OK )
#endif
+1 −1
Original line number Diff line number Diff line
@@ -606,7 +606,7 @@ ivas_error ivas_sba_dec_reconfigure(

#ifdef CORECODER_BITRATE_SWITCHING
#ifdef MCMASA_BITRATE_SWITCHING
    ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS );
    ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE );
#else
    ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old );
#endif
+1 −1

File changed.

Contains only whitespace changes.