Commit 98dd68ae authored by Jouni Paulus's avatar Jouni Paulus
Browse files

removed delivering last_mc_mode as an argument across function calls and it is...

removed delivering last_mc_mode as an argument across function calls and it is determined when needed using current LS config and earlier bitrate
parent 472db4b9
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -347,8 +347,7 @@ ivas_error ivas_corecoder_dec_reconfig(
    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 MC_MODE last_mc_mode               /* i  : MC mode in the previous frame                             */
    const int32_t brate_CPE                  /* i  : bitrate to be set for the CPEs                            */
#else
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int16_t nSCE_old,                                     /* i  : number of SCEs in previous frame        */
@@ -657,8 +656,7 @@ ivas_error ivas_mc_dec_config(
);
#ifdef MC_BITRATE_SWITCHING
ivas_error ivas_mc_dec_reconfig(
    Decoder_Struct *st_ivas,   /* i/o: IVAS encoder structure      */
    const int16_t last_mc_mode /* i  : last frame MC mode          */
    Decoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure      */
);
#endif

+14 −3
Original line number Diff line number Diff line
@@ -61,8 +61,7 @@ ivas_error ivas_corecoder_dec_reconfig(
    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 MC_MODE last_mc_mode               /* i  : MC mode in the previous frame                             */
    const int32_t brate_CPE                  /* i  : bitrate to be set for the CPEs                            */
#else
    Decoder_Struct *st_ivas,                /* i/o: IVAS decoder structure                               */
    const int16_t nSCE_old,                 /* i  : number of SCEs in previous frame                     */
@@ -75,6 +74,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 MCMASA_BITRATE_SWITCHING
    MC_MODE last_mc_mode;
#endif
    DECODER_CONFIG_HANDLE hDecoderConfig;
    ivas_error error;

@@ -87,7 +89,16 @@ ivas_error ivas_corecoder_dec_reconfig(
    error = IVAS_ERR_OK;

    output_frame = (int16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC );

#ifdef MCMASA_BITRATE_SWITCHING
    if ( st_ivas->ivas_format == MC_FORMAT )
    {
        last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */
    }
    else
    {
        last_mc_mode = MC_MODE_NONE;
    }
#endif
    /*-----------------------------------------------------------------*
     * Allocate, initalize, and configure SCE/CPE/MCT handles
     *-----------------------------------------------------------------*/
+5 −4
Original line number Diff line number Diff line
@@ -626,7 +626,7 @@ ivas_error ivas_mc_dec_config(
            if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode )
            {
#ifdef MC_BITRATE_SWITCHING
                ivas_mc_dec_reconfig( st_ivas, last_mc_mode );
                ivas_mc_dec_reconfig( st_ivas );
#else
                return IVAS_ERROR( IVAS_ERR_RECONFIGURE_NOT_SUPPORTED, "Error: MC format switching not supported yet!!!\n\n" );
#endif
@@ -640,12 +640,12 @@ ivas_error ivas_mc_dec_config(
}
#ifdef MC_BITRATE_SWITCHING
ivas_error ivas_mc_dec_reconfig(
    Decoder_Struct *st_ivas,   /* i/o: IVAS encoder structure      */
    const int16_t last_mc_mode /* i  : last frame MC mode          */
    Decoder_Struct *st_ivas   /* i/o: IVAS encoder structure      */
)
{
#ifdef MCMASA_BITRATE_SWITCHING
    int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old;
    MC_MODE last_mc_mode;  /* last frame MC mode */
#else
    int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old;
#endif
@@ -655,6 +655,7 @@ ivas_error ivas_mc_dec_reconfig(
    MC_MODE mc_mode;
#ifdef MCMASA_BITRATE_SWITCHING
    int32_t new_brate_SCE, new_brate_CPE;
    last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */
#endif
    error = IVAS_ERR_OK;

@@ -906,7 +907,7 @@ ivas_error ivas_mc_dec_reconfig(
        new_brate_SCE = 0; /*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, last_mc_mode ) ) != 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 ) ) != 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, MC_MODE_NONE );
    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 );
#else
    ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old );
#endif