Commit 3071b455 authored by Vidhya V P's avatar Vidhya V P
Browse files

Added clean up changes for VLBR

parent d647e81b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1801,7 +1801,9 @@ ivas_error preview_indices(
                if ( bit_stream[2] == 0 )
                {
                    st_ivas->ivas_format = SBA_FORMAT;
#ifndef SBA_MODE_CLEAN_UP
                    st_ivas->sba_mode = ivas_sba_mode_select();
#endif
                }
                else
                {
+38 −7
Original line number Diff line number Diff line
@@ -70,7 +70,9 @@ ivas_error ivas_dirac_config(
    ivas_error error;
    int16_t spar_dirac_split_band;
    IVAS_FB_MIXER_HANDLE hFbMdft;
#ifndef SBA_MODE_CLEAN_UP
    SBA_MODE sba_mode;
#endif
    int16_t *dirac_to_spar_md_bands;

    error = IVAS_ERR_OK;
@@ -88,7 +90,9 @@ ivas_error ivas_dirac_config(
        band_grouping = ( (Encoder_Struct *) st_ivas )->hDirAC->band_grouping;
        hConfig = ( (Encoder_Struct *) st_ivas )->hDirAC->hConfig;
        hQMetaData = ( (Encoder_Struct *) st_ivas )->hQMetaData;
#ifndef SBA_MODE_CLEAN_UP
        sba_mode = ( (Encoder_Struct *) st_ivas )->sba_mode;
#endif
        if ( ( (Encoder_Struct *) st_ivas )->hSpar != NULL )
        {
            hFbMdft = ( (Encoder_Struct *) st_ivas )->hSpar->hFbMixer;
@@ -112,7 +116,9 @@ ivas_error ivas_dirac_config(
        band_grouping = ( (Decoder_Struct *) st_ivas )->hDirAC->band_grouping;
        hConfig = ( (Decoder_Struct *) st_ivas )->hDirAC->hConfig;
        hQMetaData = ( (Decoder_Struct *) st_ivas )->hQMetaData;
#ifndef SBA_MODE_CLEAN_UP
        sba_mode = ( (Decoder_Struct *) st_ivas )->sba_mode;
#endif
        if ( ( (Decoder_Struct *) st_ivas )->hSpar != NULL )
        {
            hFbMdft = ( (Decoder_Struct *) st_ivas )->hSpar->hFbMixer;
@@ -124,8 +130,11 @@ ivas_error ivas_dirac_config(
        ( (Decoder_Struct *) st_ivas )->hDirAC->hFbMdft = hFbMdft;
        dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hDirAC->dirac_to_spar_md_bands;
    }

#ifndef SBA_MODE_CLEAN_UP
    if ( sba_mode == SBA_MODE_SPAR )
#else
    if ( ivas_format == SBA_FORMAT )
#endif
    {
        hConfig->nbands = IVAS_MAX_NUM_BANDS;
        spar_dirac_split_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND );
@@ -142,28 +151,38 @@ ivas_error ivas_dirac_config(
#endif
    if ( ivas_format == SBA_FORMAT ) /* skip for MASA decoder */
    {
#ifndef SBA_MODE_CLEAN_UP
        if ( ( error = ivas_dirac_sba_config( hQMetaData, nchan_transport, nSCE, nCPE, element_mode, ivas_total_brate, sba_order, sba_mode, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_dirac_sba_config( hQMetaData, element_mode, ivas_total_brate, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }

        if ( hQMetaData != NULL )
        {
#ifndef SBA_MODE_CLEAN_UP
            if ( enc_dec == ENC || sba_mode != SBA_MODE_SPAR )
#else
            if ( enc_dec == ENC || ivas_format != SBA_FORMAT )
#endif
            {
                hConfig->nbands = hQMetaData->q_direction[0].cfg.nbands;
            }
            hConfig->enc_param_start_band = hQMetaData->q_direction[0].cfg.start_band + spar_dirac_split_band;
        }


#ifndef SBA_MODE_CLEAN_UP
        if ( sba_mode == SBA_MODE_SPAR )
        {
#endif
            hConfig->dec_param_estim = TRUE;
            if ( hConfig->dec_param_estim == TRUE )
            {
                hConfig->enc_param_start_band = spar_dirac_split_band;
            }
#ifndef SBA_MODE_CLEAN_UP
        }
        else
        {
@@ -172,9 +191,13 @@ ivas_error ivas_dirac_config(
                hConfig->dec_param_estim = TRUE;
            }
        }
#endif
    }

#ifndef SBA_MODE_CLEAN_UP
    if ( sba_mode == SBA_MODE_SPAR )
#else
    if ( ivas_format == SBA_FORMAT )
#endif
    {
        ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                 dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft );
@@ -301,26 +324,33 @@ void ivas_dirac_config_bands(

ivas_error ivas_dirac_sba_config(
    IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle                                    */
#ifndef SBA_MODE_CLEAN_UP
    int16_t *nchan_transport,         /* o  : number of transport channel needed for MASA format   */
    int16_t *nSCE,                    /* o  : number of SCEs                                       */
    int16_t *nCPE,                    /* o  : number of CPEs                                       */
#endif
    int16_t *element_mode,            /* i/o: element mode of the core coder                       */
    int32_t sba_total_brate,          /* i  : SBA total bitrate                                    */
#ifndef SBA_MODE_CLEAN_UP
    const int16_t sba_order,          /* i  : Ambisonic (SBA) order                                */
    const SBA_MODE sba_mode, /* i  : SBA mode                                             */
#endif
    const int16_t nbands /* i  : number of frequency bands                            */
)
{
#ifndef SBA_MODE_CLEAN_UP
    int16_t i;
    int16_t nbands_wb;
#endif
    int16_t nbands_coded;
    ivas_error error;

    error = IVAS_ERR_OK;
    hQMetaData->is_masa_ivas_format = 0;

#ifndef SBA_MODE_CLEAN_UP
    if ( sba_mode == SBA_MODE_SPAR )
    {
#endif
        /* map the bitrate for SID frame */
        if ( sba_total_brate == IVAS_SID_5k2 )
        {
@@ -417,6 +447,7 @@ ivas_error ivas_dirac_sba_config(
        hQMetaData->qmetadata_max_bit_req = QMETADATA_MAXBIT_REQ_SBA >> 1;

        return error;
#ifndef SBA_MODE_CLEAN_UP
    }

    if ( sba_total_brate > IVAS_SID_5k2 )
@@ -558,8 +589,8 @@ ivas_error ivas_dirac_sba_config(
            assert( !"SBA number of transport channels must be 8 or lower" );
        }
    }

    return error;
#endif
}


+6 −1
Original line number Diff line number Diff line
@@ -101,7 +101,9 @@ static int16_t ivas_get_num_bands(
ivas_error ivas_fb_set_cfg(
    IVAS_FB_CFG **pFb_cfg_out,     /* o  : FB config. handle           */
    const int16_t ivas_format,     /* i  : IVAS format                 */
#ifndef SBA_MODE_CLEAN_UP
    const SBA_MODE sba_mode,       /* i  : SBA mode                    */
#endif
    const int16_t num_in_chans,    /* i  : number of FB input channels */
    const int16_t num_out_chans,   /* i  : number of FB output channels*/
    const int16_t active_w_mixing, /* i  : active_w_mixing flag        */
@@ -131,12 +133,14 @@ ivas_error ivas_fb_set_cfg(
    else if ( ivas_format == SBA_FORMAT )
    {
        pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS );

#ifndef SBA_MODE_CLEAN_UP
        if ( sba_mode == SBA_MODE_SPAR )
        {
#endif
            pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS );
            pFb_cfg->prior_input_length = NS2SA( sampling_rate, FRAME_SIZE_NS );
            pFb_cfg->windowed_fr_offset = (int16_t) ( (float) ( sampling_rate / FRAMES_PER_SEC ) * 3.0f / 4.0f ) - NS2SA( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS );
#ifndef SBA_MODE_CLEAN_UP
        }
        else /* SBA_MODE_DIRAC */
        {
@@ -145,6 +149,7 @@ ivas_error ivas_fb_set_cfg(
            /* extra SPAR/DirAC synchro delay */
            pFb_cfg->prior_input_length += NS2SA( sampling_rate, DELAY_FB_1_NS );
        }
#endif
    }
    else if ( ivas_format == MASA_FORMAT )
    {
+39 −10
Original line number Diff line number Diff line
@@ -2938,8 +2938,11 @@ void reset_metadata_spatial(
    const int32_t element_brate,                                /* i  : element bitrate                         */
    int32_t *total_brate,                                       /* o  : total bitrate                           */
    const int32_t core_brate,                                   /* i  : core bitrate                            */
    const int16_t nb_bits_metadata,                             /* i  : number of meatdata bits                 */
    const int16_t nb_bits_metadata                              /* i  : number of meatdata bits                 */
#ifndef SBA_MODE_CLEAN_UP
    ,
    const SBA_MODE sba_mode                                     /* i  : SBA mode                                */
#endif
);

/*! r: number of bits written */
@@ -2947,8 +2950,11 @@ void ivas_qmetadata_enc_sid_encode(
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: metadata bitstream handle               */
    IVAS_QMETADATA *q_metadata,                                 /* i/o: metadata handle                         */
    const int16_t masa_sid_descriptor,                          /* i  : description of MASA SID coding structure*/
    const int16_t ivas_format,                                  /* i  : ivas format                             */
    const int16_t ivas_format                                   /* i  : ivas format                             */
#ifndef SBA_MODE_CLEAN_UP
    ,
    const SBA_MODE sba_mode                                     /* i  : SBA mode                                */
#endif
);

/*! r: number of bits read */
@@ -2965,8 +2971,11 @@ int16_t ivas_qmetadata_dec_sid_decode(
    int16_t *index,                                             /* i/o: bitstream position                      */
    const int16_t nchan_transport,                              /* i  : number of transport channels            */
    int16_t *element_mode,                                      /* o  : element mode                            */
    const int16_t ivas_format,                                  /* i  : IVAS format                             */
    const int16_t ivas_format                                   /* i  : IVAS format                             */
#ifndef SBA_MODE_CLEAN_UP
    ,
    const SBA_MODE sba_mode                                     /* i  : SBA mode                                */
#endif
);

void ivas_qmetadata_to_dirac(
@@ -2974,7 +2983,11 @@ void ivas_qmetadata_to_dirac(
    DIRAC_DEC_HANDLE hDirAC,                                    /* o  : DirAC decoder structure                 */
    MASA_DECODER_HANDLE hMasa,                                  /* i  : MASA decoder structure                  */
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
#ifndef SBA_MODE_CLEAN_UP
    const SBA_MODE sba_mode,                                    /* i  : SBA mode                                */
#else
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
#endif
    int16_t *dirac_to_spar_md_bands                             /* o  : DirAC->SPAR MD bands                    */
);

@@ -3170,10 +3183,14 @@ void ivas_dirac_param_est_enc(
    float **pp_fr_real,
    float **pp_fr_imag,
    const int16_t input_frame, 
#ifndef SBA_MODE_CLEAN_UP
    const SBA_MODE sba_mode    
#else
    const IVAS_FORMAT ivas_format 
#endif
 );


#ifndef SBA_MODE_CLEAN_UP
/*----------------------------------------------------------------------------------*
 * SBA format prototypes
 *----------------------------------------------------------------------------------*/
@@ -3182,7 +3199,7 @@ void ivas_dirac_param_est_enc(
SBA_MODE ivas_sba_mode_select( 
    void
);

#endif
void ivas_sba_config(
    const int32_t sba_total_brate,                              /* i  : SBA total bitrate                       */
    int16_t sba_order,                                          /* i  : Ambisonic (SBA) order                   */
@@ -3311,7 +3328,7 @@ void ivas_dirac_enc_close(
    DIRAC_ENC_HANDLE *hDirAC,                                   /* i/o: encoder DirAC handle                    */
    const int32_t input_Fs                                      /* i  : input sampling_rate                     */
);

#ifndef SBA_MODE_CLEAN_UP
void ivas_dirac_enc(
    DIRAC_ENC_HANDLE hDirAC,                                    /* i/o: encoder DirAC handle                    */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: q_metadata handle                       */
@@ -3322,7 +3339,7 @@ void ivas_dirac_enc(
    const int16_t input_frame,                                  /* i  : input frame length                      */
    const int16_t sba_planar                                    /* i  : SBA planar flag                         */
);

#endif
ivas_error ivas_dirac_config(
    void *st_ivas,                                              /* i/o: IVAS encoder/decoder state structure    */
    const int16_t enc_dec                                       /* i  : encoder or decoder flag                 */
@@ -3340,13 +3357,17 @@ void ivas_dirac_config_bands(

ivas_error ivas_dirac_sba_config(
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: q_metadata handle                                    */
#ifndef SBA_MODE_CLEAN_UP
    int16_t *nchan_transport,                                   /* o  : number of transport channel needed for MASA format   */
    int16_t *nSCE,                                              /* o  : number of SCEs                                       */
    int16_t *nCPE,                                              /* o  : number of CPEs                                       */
#endif
    int16_t *element_mode,                                      /* o  : element mode of the core coder                       */
    int32_t sba_total_brate,                                    /* i  : SBA total bitrate                                    */
#ifndef SBA_MODE_CLEAN_UP
    const int16_t sba_order,                                    /* i  : Ambisonic (SBA) order                                */
    const SBA_MODE sba_mode,                                    /* i  : SBA mode                                             */
#endif
    const int16_t nbands                                        /* i  : number of frequency bands                            */
);

@@ -3369,7 +3390,9 @@ void ivas_dirac_dec_read_BS(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: decoder DirAC handle                    */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: q metadata                              */
    int16_t *nb_bits,                                           /* o  : number of bits read                     */
#ifndef SBA_MODE_CLEAN_UP
    const SBA_MODE sba_mode,                                    /* i  : SBA mode                                */
#endif
    int16_t *dirac_to_spar_md_bands                             /* o  : DirAC->SPAR MD bands                    */
);

@@ -4904,7 +4927,11 @@ void computeReferencePower_enc(
    float *reference_power,                                     /* o  : Estimated power                                 */
    const int16_t enc_param_start_band,                         /* i  : first band to process                           */
    const int16_t num_freq_bands,                               /* i  : Number of frequency bands                       */
#ifndef SBA_MODE_CLEAN_UP
    const SBA_MODE sba_mode                                     /* i  : SBA mode                                        */
#else
    const IVAS_FORMAT ivas_format                               /* i  : ivas_format                                     */
#endif
);

ivas_error ivas_mono_dmx_renderer_open(
@@ -5024,7 +5051,9 @@ ivas_error ivas_td_binaural_renderer(
ivas_error ivas_fb_set_cfg(
    IVAS_FB_CFG **pFb_cfg_out,                                  /* o  : FB config. handle                           */
    const int16_t ivas_format,                                  /* i  : IVAS format                                 */
#ifndef SBA_MODE_CLEAN_UP
    const SBA_MODE sba_mode,                                    /* i  : SBA mode                                    */
#endif
    const int16_t num_in_chans,                                 /* i  : number of FB input channels                 */
    const int16_t num_out_chans,                                /* i  : number of FB output channels                */
    const int16_t active_w_mixing,                              /* i  : active_w_mixing flag                        */
@@ -5050,13 +5079,13 @@ void ivas_fb_mixer_pcm_ingest(
    float **ppOut_pcm,                                          /* o  : output audio channels                       */
    const int16_t frame_length                                  /* i  : frame length                                */
);

#ifndef SBA_MODE_CLEAN_UP
void ivas_dirac_enc_spar_delay_synchro(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                      */
    const int16_t input_frame,                                  /* i  : input frame length                          */
    float data_f[][L_FRAME48k]                                  /* i/o: SBA channels (ACN / SN3D)                   */
);

#endif
void ivas_fb_mixer_update_prior_input(
    IVAS_FB_MIXER_HANDLE hFbMixer,                              /* i/o: FB mixer handle                             */
    float *pcm_in[],                                            /* i  : input audio channels                        */
+2 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
#endif
#include "wmc_auto.h"


#ifndef SBA_MODE_CLEAN_UP
/*-------------------------------------------------------------------*
 * ivas_sba_mode_select()
 *
@@ -58,6 +58,7 @@ SBA_MODE ivas_sba_mode_select()
{
    return SBA_MODE_SPAR;
}
#endif
/*-------------------------------------------------------------------*
 * ivas_sba_config()
 *
Loading