Commit 74dae8d1 authored by malenov's avatar malenov
Browse files

dynamical allocation of ind_list[] based on the actual number of transport channels

parent 2d2029e9
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -48,6 +48,10 @@

#define WMC_TOOL_SKIP

#ifdef DEBUG_IND
extern int16_t total_num_id;
#endif

/*------------------------------------------------------------------------------------------*
 * Local constants, enums, structures
 *------------------------------------------------------------------------------------------*/
@@ -551,6 +555,7 @@ int main(
        fprintf( stdout, "\n\n-- Start the encoder (quiet mode) --\n\n" );
    }


#ifdef WMOPS
    reset_stack();
    reset_wmops();
@@ -567,6 +572,10 @@ int main(

    while ( 1 )
    {
#ifdef DEBUG_IND
        total_num_id = 0;
#endif

        /* Read the input data */
        if ( ( error = AudioFileReader_read( audioReader, pcmBuf, pcmBufSize, &numSamplesRead ) ) != IVAS_ERR_OK )
        {
@@ -709,6 +718,14 @@ int main(
            goto cleanup;
        }

#ifdef DEBUG_IND
        {
            int16_t tmp_i = -1;

            dbgwrite( &tmp_i, sizeof( int16_t ), 1, 960 - total_num_id, "res/ind_list.x" );
        }
#endif

        frame++;
        if ( !arg.quietModeEnabled )
        {
+9 −0
Original line number Diff line number Diff line
@@ -53,6 +53,10 @@

#ifdef DEBUGGING

#ifdef DEBUG_IND
int16_t total_num_id = 0;
#endif

#define FEC_SEED 12558

/*-------------------------------------------------------------------*
@@ -300,6 +304,11 @@ ivas_error push_indice(
    hBstr->last_ind = id;
    hBstr->nb_bits_tot += nb_bits;

#ifdef DEBUG_IND
    dbgwrite( &i, sizeof( int16_t ), 1, 1, "res/ind_list.x" );
    total_num_id++;
#endif

    return error;
}

+4 −0
Original line number Diff line number Diff line
@@ -285,7 +285,11 @@ 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
    Indice ind_list[][MAX_NUM_INDICES],                         /* i  : indices list                            */
#endif
    Indice ind_list_metadata[][MAX_BITS_METADATA]               /* i  : indices list metadata                   */
);

+5 −2
Original line number Diff line number Diff line
@@ -50,12 +50,16 @@
#ifndef RELEASE
#define DEBUGGING                               /* Activate debugging part of the code */
#endif
/*#define WMOPS*/                               /* Activate complexity and memory counters */
#define WMOPS                               /* Activate complexity and memory counters */
/*#define WMOPS_PER_FRAME*/                     /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
/*#define WMOPS_DETAIL*/                        /* Output detailed complexity printout for every function. Increases runtime overhead */
/*#define WMOPS_WC_FRAME_ANALYSIS*/             /* Output detailed complexity analysis for the worst-case frame */
/*#define MEM_COUNT_DETAILS*/                   /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */

/*#define BITSTREAM_INDICES_MEMORY*/                        /* Don't count memory for bitstream Indice at the encoder - it is a temporary solution for development only */
#define DEBUG_IND
#define IND_LIST_DYN                            /* dynamic allocation of ind_list based on transport channels */

#ifdef DEBUGGING

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
@@ -132,7 +136,6 @@
/* ################# Start DEVELOPMENT switches ######################## */

#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */
#define BITSTREAM_INDICES_MEMORY                        /* Don't count memory for bitstream Indice at the encoder - it is a temporary solution for development only */

#define LSF_RE_USE_SECONDARY_CHANNEL                    /* TD stereo Secondary channel LSF Q improvement */
#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+10 −0
Original line number Diff line number Diff line
@@ -111,6 +111,16 @@ ivas_error init_encoder(
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) );
        }

#ifdef IND_LIST_DYN
        /* allocate buffer of indices */
        if ( ( st->hBstr->ind_list = (INDICE_HANDLE) malloc( MAX_NUM_INDICES * sizeof( Indice ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for buffer of indices!\n" ) );
        }

        reset_indices_enc( st->hBstr, MAX_NUM_INDICES );
#endif
    }
    else
    {
Loading