Commit ad4a1668 authored by Vidhya V P's avatar Vidhya V P
Browse files

Resolving the BR switching test cases failures.

parent 2d17161f
Loading
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -4530,7 +4530,18 @@ void ivas_get_spar_md_from_dirac(
int16_t ivas_get_spar_dec_md_num_subframes(
    const int16_t sba_order, /* i  : Ambisonic (SBA) order            */
    const int32_t ivas_total_brate );
#ifdef VLBR_20MS_MD

ivas_error ivas_spar_md_dec_matrix_open(
    ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle       */
    const int16_t num_channels,       /* i  : number of internal channels  */
    const int16_t num_md_sub_frames );

void ivas_spar_md_dec_matrix_close(
    ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle      */
    const int16_t num_channels );            /* i  : number of internal channels */
    
#endif
ivas_error ivas_spar_md_dec_open(
    ivas_spar_md_dec_state_t **hMdDec_out,                      /* i/o: SPAR MD decoder handle                  */
    const DECODER_CONFIG_HANDLE hDecoderConfig,                 /* i  : configuration structure                 */
+122 −2
Original line number Diff line number Diff line
@@ -110,7 +110,10 @@ ivas_error ivas_sba_dec_reconfigure(
    int16_t sba_dirac_stereo_flag_old;
    int32_t ivas_total_brate;
    int32_t last_ivas_total_brate;

#ifdef VLBR_20MS_MD
    int16_t num_channels, num_md_sub_frames;
    int16_t i,j,k;
#endif
    RENDERER_TYPE old_renderer_type;

    DECODER_CONFIG_HANDLE hDecoderConfig;
@@ -170,7 +173,7 @@ ivas_error ivas_sba_dec_reconfigure(
            hSpar->hPCA = NULL;
        }

#ifdef VLBR_20MS_MD
#ifndef VLBR_20MS_MD
        if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) || ( last_ivas_total_brate >= IVAS_512k && ivas_total_brate < IVAS_512k ) || ( last_ivas_total_brate < IVAS_512k && ivas_total_brate >= IVAS_512k ) || ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) )
#else
        if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) || ( last_ivas_total_brate >= IVAS_512k && ivas_total_brate < IVAS_512k ) || ( last_ivas_total_brate < IVAS_512k && ivas_total_brate >= IVAS_512k ) )
@@ -184,7 +187,65 @@ ivas_error ivas_sba_dec_reconfigure(
                return error;
            }
        }
#ifdef VLBR_20MS_MD
        else if ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 )
        {

            num_channels = st_ivas->hSpar->hMdDec->spar_md_cfg.num_umx_chs;

            ivas_spar_md_dec_matrix_close( st_ivas->hSpar->hMdDec, num_channels );

            num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate );
            if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels,
                                                         num_md_sub_frames ) ) != IVAS_ERR_OK )
            {
                return error;
            }
            for ( i = 0; i < num_channels; i++ )
            {
                for ( j = 0; j < num_channels; j++ )
                {
                    for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                    {
                        st_ivas->hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0;
                    }
                }
            }

            for ( i = 0; i < num_channels; i++ )
            {
                for ( j = 0; j < num_channels; j++ )
                {
                    for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                    {
                        st_ivas->hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0;
                    }
                }
            }

            for ( i = 0; i < num_channels; i++ )
            {
                for ( j = 0; j < num_channels; j++ )
                {
                    for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                    {
                        st_ivas->hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0;
                    }
                }
            }

            for ( i = 0; i < num_channels; i++ )
            {
                for ( j = 0; j < num_channels; j++ )
                {
                    for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                    {
                        st_ivas->hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0;
                    }
                }
            }
        }
#endif
        ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format );
    }
    else
@@ -194,7 +255,66 @@ ivas_error ivas_sba_dec_reconfigure(
            return error;
        }
    }
#ifndef VLBR_20MS_MD
    if ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 )
    {

        num_channels = st_ivas->hSpar->hMdDec->spar_md_cfg.num_umx_chs;

        ivas_spar_md_dec_matrix_close( st_ivas->hSpar->hMdDec, num_channels );

        num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate );
        if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels,
                                                     num_md_sub_frames ) ) != IVAS_ERR_OK )
        {
            return error;
        }
        for ( i = 0; i < num_channels; i++ )
        {
            for ( j = 0; j < num_channels; j++ )
            {
                for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                {
                    st_ivas->hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0;
                }
            }
        }

        for ( i = 0; i < num_channels; i++ )
        {
            for ( j = 0; j < num_channels; j++ )
            {
                for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                {
                    st_ivas->hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0;
                }
            }
        }

        for ( i = 0; i < num_channels; i++ )
        {
            for ( j = 0; j < num_channels; j++ )
            {
                for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                {
                    st_ivas->hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0;
                }
            }
        }

        for ( i = 0; i < num_channels; i++ )
        {
            for ( j = 0; j < num_channels; j++ )
            {
                for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ )
                {
                    st_ivas->hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0;
                }
            }
        }

    }
#endif
    hSpar = st_ivas->hSpar;
    st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );

+18 −10
Original line number Diff line number Diff line
@@ -96,8 +96,12 @@ static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder
 *
 * Allocate and initialize SPAR MD decoder matrices
 *------------------------------------------------------------------------*/

static ivas_error ivas_spar_md_dec_matrix_open(
#ifdef VLBR_20MS_MD
ivas_error ivas_spar_md_dec_matrix_open
#else
static ivas_error ivas_spar_md_dec_matrix_open
#endif
    (
        ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle       */
        const int16_t num_channels,       /* i  : number of internal channels  */
        const int16_t num_md_sub_frames )
@@ -337,8 +341,12 @@ ivas_error ivas_spar_md_dec_open(
 *
 * Deallocate SPAR MD decoder matrices
 *------------------------------------------------------------------------*/

static void ivas_spar_md_dec_matrix_close(
#ifdef VLBR_20MS_MD
void ivas_spar_md_dec_matrix_close
#else
static void ivas_spar_md_dec_matrix_close
#endif
    (
        ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle      */
        const int16_t num_channels            /* i  : number of internal channels */
    )