Commit 117460bf authored by multrus's avatar multrus
Browse files

[cleanup] accept CORECODER_BITRATE_SWITCHING

parent 85d307c0
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -125,14 +125,12 @@ void ivas_mct_enc_close(
    MCT_ENC_HANDLE hMCT                                         /* i/o: MCT encoder structure                   */
);

#ifdef CORECODER_BITRATE_SWITCHING
ivas_error ivas_corecoder_enc_reconfig(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
    const int16_t nSCE_old,                                     /* i  : number of SCEs in previous frame        */
    const int16_t nCPE_old,                                     /* i  : number of CPEs in previous frame        */
    const int16_t nchan_transport_old                           /* i  : number of TCs in previous frame         */
);
#endif

ivas_error ivas_sce_enc(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
@@ -206,9 +204,7 @@ ivas_error pre_proc_ivas(
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    const int16_t last_element_mode,                            /* i  : last element mode                       */
    const int32_t element_brate,                                /* i  : element bitrate                         */
#ifdef CORECODER_BITRATE_SWITCHING
    const int32_t last_element_brate,                           /* i  : last element bitrate                    */
#endif
    const int16_t input_frame,                                  /* i  : frame length                            */
    float old_inp_12k8[],                                       /* i/o: buffer of old input signal              */
    float old_inp_16k[],                                        /* i/o: buffer of old input signal @ 16kHz      */
@@ -333,7 +329,6 @@ void ivas_mct_dec_close(
    MCT_DEC_HANDLE *hMCT                                        /* i/o: MCT decoder structure                   */
);

#ifdef CORECODER_BITRATE_SWITCHING
ivas_error ivas_corecoder_dec_reconfig(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int16_t nSCE_old,                                     /* i  : number of SCEs in previous frame        */
@@ -346,7 +341,6 @@ ivas_error ivas_hp20_dec_reconfig(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int16_t nchan_hp20_old                                /* i  : number of HP20 filters in previous frame*/
);
#endif

ivas_error ivas_sce_dec(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
@@ -418,9 +412,7 @@ ivas_error ivas_core_enc(
    float enerBuffer[CPE_CHANNELS][CLDFB_NO_CHANNELS_MAX],                   /* i  : energy buffer                           */
    float fft_buff[CPE_CHANNELS][2 * L_FFT],                                 /* i  : FFT buffer                              */
    const int16_t tdm_SM_flag,                                               /* i  : channel combination scheme flag                 */
#ifdef CORECODER_BITRATE_SWITCHING
    const int16_t ivas_format,                                               /* i  : IVAS format                            */
#endif
    const int16_t flag_16k_smc                                               /* i  : flag to indicate if the OL SMC is run at 16 kHz */
);

+0 −1
Original line number Diff line number Diff line
@@ -144,7 +144,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define FIX_I1_113*/                                  /* under review : MCT bit distribution optimization for SBA high bitrates*/

#define CORECODER_BITRATE_SWITCHING                     /* Issue 133: support bitrate switching in core-coder */
#define ISM_BITRATE_SWITCHING                           /* Issue 115: Support for Bitrate Switching in ISM */
#define SBA_SPAR_HARM                                   /* Issue 92: maintenance of the SBA SPAR functions */
#define FIX_155_HP20_ISSUE                              /* Issue 155: apply hp20 on all input channels instead of just 2 channels */
+0 −2
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@
#include "wmops.h"


#ifdef CORECODER_BITRATE_SWITCHING
/*-------------------------------------------------------------------*
 * ivas_corecoder_dec_reconfig()
 *
@@ -401,4 +400,3 @@ ivas_error ivas_hp20_dec_reconfig(

    return error;
}
#endif
+0 −4
Original line number Diff line number Diff line
@@ -892,9 +892,7 @@ ivas_error ivas_init_decoder(
            }

            st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */
#ifdef CORECODER_BITRATE_SWITCHING
            st_ivas->hCPE[0]->hCoreCoder[1] = NULL;
#endif
        }

        if ( st_ivas->nCPE > 1 )
@@ -1092,9 +1090,7 @@ ivas_error ivas_init_decoder(
                }

                st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */
#ifdef CORECODER_BITRATE_SWITCHING
                st_ivas->hCPE[0]->hCoreCoder[1] = NULL;
#endif
            }

            /* set CNA/CNG flags */
+0 −79
Original line number Diff line number Diff line
@@ -1018,9 +1018,6 @@ static ivas_error ivas_ism_bitrate_switching(
    const int16_t num_obj              /* i  : number of objects in the bitstream   */
)
{
#ifndef CORECODER_BITRATE_SWITCHING
    int16_t sce_id;
#endif
    ivas_error error;
    int32_t element_brate_tmp[MAX_NUM_OBJECTS];

@@ -1029,85 +1026,9 @@ static ivas_error ivas_ism_bitrate_switching(
    ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL );
    st_ivas->nSCE = st_ivas->nchan_transport;

#ifdef CORECODER_BITRATE_SWITCHING
    ivas_corecoder_dec_reconfig( st_ivas, nchan_transport_old, 0, nchan_transport_old, 0 );
#else
    if ( st_ivas->nchan_transport > nchan_transport_old )
    {
        /* Initialize for new bitrate */
        for ( sce_id = 0; sce_id < nchan_transport_old; sce_id++ )
        {
            st_ivas->hSCE[sce_id]->element_brate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport;
            st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */
        }

        /* Initialize some memories */
        for ( sce_id = nchan_transport_old; sce_id < st_ivas->nchan_transport; sce_id++ )
        {
            if ( ( error = create_sce_dec( st_ivas, sce_id, element_brate_tmp[sce_id] ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }
    else
    {
        /* Initialize for new bitrate */
        for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ )
        {
            st_ivas->hSCE[sce_id]->element_brate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport;
            st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */
        }

        /* Destroy the core coder memory */
        for ( ; sce_id < nchan_transport_old; sce_id++ )
        {
            destroy_sce_dec( st_ivas->hSCE[sce_id] );
            st_ivas->hSCE[sce_id] = NULL;
        }
    }
#endif

#ifdef CORECODER_BITRATE_SWITCHING
    ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old );
#else
    /* destroy the memory of hp20*/
    if ( st_ivas->mem_hp20_out != NULL )
    {
        for ( sce_id = 0; sce_id < nchan_transport_old; sce_id++ )
        {
            count_free( st_ivas->mem_hp20_out[sce_id] );
            st_ivas->mem_hp20_out[sce_id] = NULL;
        }
        count_free( st_ivas->mem_hp20_out );
        st_ivas->mem_hp20_out = NULL;
    }

    /* re initialize the memory of hp20 */
    /* set number of input channels used for analysis/coding */

    if ( st_ivas->nchan_transport > 0 )
    {
        if ( ( st_ivas->mem_hp20_out = (float **) count_malloc( st_ivas->nchan_transport * sizeof( float * ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) );
        }
    }
    else
    {
        st_ivas->mem_hp20_out = NULL;
    }

    for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ )
    {
        if ( ( st_ivas->mem_hp20_out[sce_id] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) );
        }

        set_f( st_ivas->mem_hp20_out[sce_id], 0.0f, L_HP20_MEM );
    }
#endif

    /* Initialize the needed renderer struct and destroy the unnecessary renderer struct */

Loading