Commit 5edfd1b7 authored by bayers's avatar bayers
Browse files

* fixed most ParamMC<->MCT bit rate switch transitions

parent c3adc16e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -879,10 +879,12 @@ static ivas_error write_indices_element(

        for ( n = 0; n < n_channels; n++ )
        {
#ifndef MC_BITRATE_SWITCHING
            if ( ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && ( element_id * CPE_CHANNELS + n == LFE_CHANNEL ) )
            {
                continue;
            }
#endif
            reset_indices_enc( sts[n]->hBstr, MAX_NUM_INDICES );
        }
    }
+3 −0
Original line number Diff line number Diff line
@@ -225,6 +225,9 @@ void stereo_mdct_init_igf_start_band(
{
    int16_t i, bitRateIndex, igfStartLine;
    const int16_t *swb_offset;
#ifdef DEBUGGING
    stbParams->sfbIgfStart = 0;
#endif

    bitRateIndex = IGF_MapBitRateToIndex( element_brate, bwidth, IVAS_CPE_MDCT, 0 );
    swb_offset = &swb_offset_LB_new[bitRateIndex][1];
+5 −0
Original line number Diff line number Diff line
@@ -616,17 +616,22 @@ ivas_error init_decoder(
    }

    /* TCX config. data structure */
#ifndef MC_BITRATE_SWITCHING
    /* for correct bit rate switching in MC we at least need the TcxCfg */
    if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE )
    {
#endif
        if ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) count_malloc( sizeof( TCX_config ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) );
        }
#ifndef MC_BITRATE_SWITCHING
    }
    else
    {
        st->hTcxCfg = NULL;
    }
#endif

    /* Tonal MDCT concealment data structure */
    if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE )
+4 −0
Original line number Diff line number Diff line
@@ -358,7 +358,11 @@ ivas_error ivas_dec(
        /* LFE channel decoder */
        if ( st_ivas->mc_mode == MC_MODE_MCT )
        {
#ifndef MC_BITRATE_SWITCHING
            /* bay: this really killed the MC bitrate switching and took me one day to find it, at least a comment here why the messing with this pointers
                    happens would have been nice */
            st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg;
#endif
            ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch );
        }

+5 −1
Original line number Diff line number Diff line
@@ -1439,7 +1439,11 @@ void destroy_core_dec(
        hCoreCoder->hTcxDec = NULL;
    }

    if ( hCoreCoder->hTcxCfg != NULL && hCoreCoder->mct_chan_mode != MCT_CHAN_MODE_LFE )
    if ( hCoreCoder->hTcxCfg != NULL
#ifndef MC_BITRATE_SWITCHING
         && hCoreCoder->mct_chan_mode != MCT_CHAN_MODE_LFE
#endif
    )
    {
        count_free( hCoreCoder->hTcxCfg );
        hCoreCoder->hTcxCfg = NULL;
Loading