Commit beda0f08 authored by malenov's avatar malenov
Browse files

cleanup within IND_LIST_DYN

parent 5c9b1761
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -285,9 +285,7 @@ void ivas_initialize_handles_enc(

ivas_error ivas_init_encoder(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
#ifdef IND_LIST_DYN
    //Indice *ind_list[],                                         /* i  : list of indices                         */
#else
#ifndef IND_LIST_DYN
    Indice ind_list[][MAX_NUM_INDICES],                         /* i  : indices list                            */
#endif
    Indice ind_list_metadata[][MAX_BITS_METADATA]               /* i  : indices list metadata                   */
+2 −16
Original line number Diff line number Diff line
@@ -287,14 +287,7 @@ ivas_error ivas_corecoder_enc_reconfig(
                }

                /* allocate buffer of indices */
#ifdef IND_LIST_DYN
                //if ( ( ind_list = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
                //{
                //    return IVAS_ERR_FAILED_ALLOC;
                //}

                //st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list;
#else
#ifndef IND_LIST_DYN
                st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES;
#endif

@@ -359,14 +352,7 @@ ivas_error ivas_corecoder_enc_reconfig(
                    copy_encoder_config( st_ivas, st_ivas->hCPE[cpe_id]->hCoreCoder[n], 0 );
                    st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */

#ifdef IND_LIST_DYN
                    //if ( ( ind_list = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
                    //{
                    //    return IVAS_ERR_FAILED_ALLOC;
                    //}

                    //st_ivas->hSCE[cpe_id]->hCoreCoder[0]->hBstr->ind_list = ind_list;
#else
#ifndef IND_LIST_DYN
                    st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n + st_ivas->nSCE ) * MAX_NUM_INDICES;
#endif
                    if ( cpe_id * CPE_CHANNELS + n > 0 || ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) )
+4 −68
Original line number Diff line number Diff line
@@ -311,9 +311,7 @@ void ivas_initialize_handles_enc(

ivas_error ivas_init_encoder(
    Encoder_Struct *st_ivas,                      /* i/o: IVAS encoder structure      */
#ifdef IND_LIST_DYN
    //Indice *ind_list[],                           /* i  : list of indices             */
#else
#ifndef IND_LIST_DYN
    Indice ind_list[][MAX_NUM_INDICES],           /* o  : bitstream indices           */
#endif
    Indice ind_list_metadata[][MAX_BITS_METADATA] /* o  : bitstream indices metadata  */
@@ -367,13 +365,6 @@ ivas_error ivas_init_encoder(
            return error;
        }

#ifdef IND_LIST_DYN
        ///* allocate buffer of indices */
        //if ( ( ind_list[sce_id] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
        //{
        //    return IVAS_ERR_FAILED_ALLOC;
        //}
#endif
#ifndef IND_LIST_DYN
        st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id];
        reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES );
@@ -403,13 +394,6 @@ ivas_error ivas_init_encoder(
        /* allocate buffer of indices */
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
#ifdef IND_LIST_DYN
            //if ( ( ind_list[n] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
            //{
            //    return IVAS_ERR_FAILED_ALLOC;
            //}
#endif

#ifndef IND_LIST_DYN
            st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[n];
            reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES );
@@ -441,14 +425,6 @@ ivas_error ivas_init_encoder(
                return error;
            }

#ifdef IND_LIST_DYN
            /* allocate buffer of indices */
            //if ( ( ind_list[sce_id] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
            //{
            //    return IVAS_ERR_FAILED_ALLOC;
            //}
#endif

#ifndef IND_LIST_DYN
            st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id];
            reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES );
@@ -511,14 +487,6 @@ ivas_error ivas_init_encoder(
                return error;
            }

#ifdef IND_LIST_DYN
            /* allocate buffer of indices */
            //if ( ( ind_list[sce_id] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
            //{
            //    return IVAS_ERR_FAILED_ALLOC;
            //}
#endif

#ifndef IND_LIST_DYN
            st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id];
            reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES );
@@ -546,13 +514,6 @@ ivas_error ivas_init_encoder(
            /* allocate buffer of indices */
            for ( n = 0; n < CPE_CHANNELS; n++ )
            {
#ifdef IND_LIST_DYN
                //if ( ( ind_list[cpe_id * CPE_CHANNELS + n] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
                //{
                //    return IVAS_ERR_FAILED_ALLOC;
                //}
#endif

#ifndef IND_LIST_DYN
                st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n];
                reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES );
@@ -604,12 +565,6 @@ ivas_error ivas_init_encoder(
                /* allocate buffer of indices */
                for ( n = 0; n < CPE_CHANNELS; n++ )
                {
#ifdef IND_LIST_DYN
                    //if ( ( ind_list[cpe_id * CPE_CHANNELS + n] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
                    //{
                    //    return IVAS_ERR_FAILED_ALLOC;
                    //}
#endif
                    /* we need the correct bitstream also for the LFE channel since it might become a proper coded channel when
                       switching to ParamMC and ind_list is only visible here, can't be done later */
#ifndef IND_LIST_DYN
@@ -658,12 +613,6 @@ ivas_error ivas_init_encoder(
                /* allocate buffer of indices */
                for ( n = 0; n < CPE_CHANNELS; n++ )
                {
#ifdef IND_LIST_DYN
                    //if ( ( ind_list[cpe_id * CPE_CHANNELS + n] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
                    //{
                    //    return IVAS_ERR_FAILED_ALLOC;
                    //}
#endif
#ifndef IND_LIST_DYN
                    st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n];
                    reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES );
@@ -719,15 +668,8 @@ ivas_error ivas_init_encoder(
                    return error;
                }

                /* allocate buffer of indices */
#ifdef IND_LIST_DYN
                //if ( ( ind_list[sce_id] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
                //{
                //    return IVAS_ERR_FAILED_ALLOC;
                //}
#endif

#ifndef IND_LIST_DYN
                /* allocate buffer of indices */
                st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id];
                reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES );
#endif
@@ -748,20 +690,14 @@ ivas_error ivas_init_encoder(
                    return error;
                }

#ifndef IND_LIST_DYN
                /* allocate buffer of indices */
                for ( n = 0; n < CPE_CHANNELS; n++ )
                {
#ifdef IND_LIST_DYN
                    //if ( ( ind_list[cpe_id * CPE_CHANNELS + n + st_ivas->nSCE] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
                    //{
                    //    return IVAS_ERR_FAILED_ALLOC;
                    //}
#endif
#ifndef IND_LIST_DYN
                    st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n + st_ivas->nSCE];
                    reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES );
#endif
                }
#endif

                /* Metadata only initialized for the last CPE index*/
                if ( cpe_id == st_ivas->nCPE - 1 )
+2 −34
Original line number Diff line number Diff line
@@ -48,9 +48,7 @@
struct IVAS_ENC
{
    Encoder_Struct *st_ivas;
#ifdef IND_LIST_DYN
    //Indice *ind_list[MAX_NUM_DATA];                                /* list of indices */
#else
#ifndef IND_LIST_DYN
    Indice ind_list[MAX_NUM_DATA][MAX_NUM_INDICES];                /* list of indices */
#endif
    Indice ind_list_metadata[MAX_NUM_METADATA][MAX_BITS_METADATA]; /* list of indices for metadata */
@@ -138,19 +136,7 @@ ivas_error IVAS_ENC_Open(
     * Initialize indices
     *-----------------------------------------------------------------*/

#ifdef IND_LIST_DYN
    /* allocate ind_list[0] - for the first transport channel */
    //if ( ( ( *phIvasEnc )->ind_list[0] = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
    //{
    //    return IVAS_ERR_FAILED_ALLOC;
    //}

    //for ( i = 0; i < MAX_NUM_DATA; ++i )
    //{
    //    ( *phIvasEnc )->ind_list[i] = NULL;
    //}
#else

#ifndef IND_LIST_DYN
    for ( i = 0; i < MAX_NUM_DATA; ++i )
    {
        for ( j = 0; j < MAX_NUM_INDICES; ++j )
@@ -216,10 +202,6 @@ void IVAS_ENC_Close(
    IVAS_ENC_HANDLE *phIvasEnc /* i/o: pointer to IVAS encoder handle */
)
{
#ifdef IND_LIST_DYN
    //int16_t i;
#endif

    /* Free all memory */
    if ( phIvasEnc == NULL || *phIvasEnc == NULL )
    {
@@ -242,20 +224,6 @@ void IVAS_ENC_Close(

    ( *phIvasEnc )->st_ivas = NULL;

#ifdef IND_LIST_DYN
    //for ( i = 0; i < MAX_NUM_DATA; ++i )
    //{
    //    if ( ( *phIvasEnc )->ind_list[i] != NULL )
    //    {
    //        free( ( *phIvasEnc )->ind_list[i] );
    //    }
    //    else
    //    {
    //        break;
    //    }
    //}
#endif

#ifdef BITSTREAM_INDICES_MEMORY
#define WMC_TOOL_SKIP
    free( *phIvasEnc );