Commit b68eaab5 authored by Vidhya VP's avatar Vidhya VP
Browse files

Merge branch '114-bitrate-switching-in-sba-PLC-fix' into 'main'

[non-BE] Fix for SBA BR switching with PLC

See merge request !405
parents e4096752 f2b86034
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4089,6 +4089,9 @@ ivas_error ivas_spar_md_dec_open(
    const DECODER_CONFIG_HANDLE hDecoderConfig,                 /* i  : configuration structure                 */
    const int16_t num_channels,                                 /* i  : number of internal channels             */
	const int16_t sba_order                                     /* i  : SBA order                               */
#ifdef SBA_BR_SWITCHING_RECONFIG
    ,const int16_t sid_format
#endif
);

void ivas_spar_md_dec_close(
+31 −0
Original line number Diff line number Diff line
@@ -267,6 +267,37 @@ ivas_error ivas_dec_setup(
                st_ivas->element_mode_init = IVAS_CPE_MDCT;
                break;
        }
#ifdef SBA_BR_SWITCHING_RECONFIG
        if ( ( st_ivas->ini_frame > 0 ) && ( st_ivas->ivas_format == SBA_FORMAT ) )
        {
            int16_t nchan_transport_old, nchan_transport;
            SBA_MODE sba_mode_old;
            int32_t last_ivas_total_brate;
            last_ivas_total_brate = st_ivas->last_active_ivas_total_brate;
            sba_mode_old = ivas_sba_mode_select( last_ivas_total_brate );
            nchan_transport_old = st_ivas->nchan_transport;
            nchan_transport = ( st_ivas->sid_format == SID_SBA_2TC ) ? 2 : 1;

            if ( ( nchan_transport_old != nchan_transport ) || ( sba_mode_old != st_ivas->sba_mode ) )
            {
                /*Setting the default bitrate for the reconfig function*/
                if ( st_ivas->sid_format == SID_SBA_2TC )
                {
                    st_ivas->hDecoderConfig->ivas_total_brate = IVAS_48k;
                }
                else
                {
                    st_ivas->hDecoderConfig->ivas_total_brate = ( st_ivas->sba_mode == SBA_MODE_SPAR ) ? IVAS_24k4 : IVAS_13k2;
                }
                if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
                st_ivas->last_active_ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
                st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate;
            }
        }
#endif
    }

    /*-------------------------------------------------------------------*
+1 −1
Original line number Diff line number Diff line
@@ -658,7 +658,7 @@ ivas_error ivas_sba_dec_reconfigure(
            /* MD handle */
            ivas_spar_md_dec_close( &hSpar->hMdDec );

            if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, nchan_internal, sba_order_internal ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, nchan_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK )
            {
                return error;
            }
+4 −0
Original line number Diff line number Diff line
@@ -89,7 +89,11 @@ ivas_error ivas_spar_dec_open(
    }

    /* MD handle */
#ifdef SBA_BR_SWITCHING_RECONFIG
    if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK )
#else
    if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
+10 −1
Original line number Diff line number Diff line
@@ -253,6 +253,10 @@ ivas_error ivas_spar_md_dec_open(
    const DECODER_CONFIG_HANDLE hDecoderConfig, /* i  : configuration structure      */
    const int16_t num_channels,                 /* i  : number of internal channels  */
    const int16_t sba_order                     /* i  : SBA order                    */
#ifdef SBA_BR_SWITCHING_RECONFIG
    ,
    const int16_t sid_format
#endif
)
{
    ivas_spar_md_dec_state_t *hMdDec;
@@ -271,7 +275,12 @@ ivas_error ivas_spar_md_dec_open(
    }

    hMdDec->table_idx = 0; /* just to initialize state variables*/

#ifdef SBA_BR_SWITCHING_RECONFIG
    if ( ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) && ( sid_format == SID_SBA_2TC ) )
    {
        hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL );
    }
#endif
    if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK )
    {
        return error;
Loading