Commit b0e22cab authored by vaclav's avatar vaclav
Browse files

Merge branch...

Merge branch '1235-update-of-the-wmc-tool-to-v1-7-recognizing-the-newly-added-basop-operators' into 'main'

Resolve "Update of the WMC tool to v1.7 recognizing newly added BASOP operators"

See merge request !1889
parents 05b43c35 e56d5175
Loading
Loading
Loading
Loading
Loading
+438 −145
Original line number Diff line number Diff line
/*
 * (C) 2022 copyright VoiceAge Corporation. All Rights Reserved.
 * (C) 2024 copyright VoiceAge Corporation. All Rights Reserved.
 *
 * This software is protected by copyright law and by international treaties. The source code, and all of its derivations,
 * is provided by VoiceAge Corporation under the "ITU-T Software Tools' General Public License". Please, read the license file
@@ -18,6 +18,7 @@
#include <stdint.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <limits.h>

#ifndef _MSC_VER
#include <dirent.h>
@@ -31,8 +32,11 @@

#define WMC_TOOL_SKIP /* Skip the instrumentation of this file, if invoked by accident */

#ifdef WMOPS
#ifndef WMOPS
int cntr_push_pop = 0; /* global counter for checking balanced push_wmops()/pop_wmops() pairs when WMOPS is not activated */
#endif

#ifdef WMOPS
/*-------------------------------------------------------------------*
 * Complexity counting tool
 *--------------------------------------------------------------------*/
@@ -43,8 +47,9 @@
#define MAX_NUM_RECORDS_REALLOC_STEP 50  /* When re-allocating the list of records, increase the number of records by this number */
#define MAX_CALL_TREE_DEPTH          100 /* maximum depth of the function call tree */
#define DOUBLE_MAX                   0x80000000
#define FRAMES_PER_SECOND            50.0
#define FAC                          ( FRAMES_PER_SECOND / 1e6 )

#define PROM_INST_SIZE               32 /* number of bits of each program instruction when stored in the PROM memory (applied only when the user selects reporting in bytes) */

typedef struct
{
@@ -58,7 +63,7 @@ typedef struct
    double max_selfcnt;
    double min_selfcnt;
    double tot_selfcnt;
    double start_cnt; 
    double start_cnt; /* The following take into account the decendants */
    double current_cnt;
    double max_cnt;
    double min_cnt;
@@ -72,7 +77,6 @@ typedef struct
} wmops_record;

double ops_cnt;
double prom_cnt;
double inst_cnt[NUM_INST];

static wmops_record *wmops = NULL;
@@ -87,10 +91,73 @@ static long fnum_cnt_wc;
static int *wmops_caller_stack = NULL, wmops_caller_stack_index, max_wmops_caller_stack_index = 0;
static int *heap_allocation_call_tree = NULL, heap_allocation_call_tree_size = 0, heap_allocation_call_tree_max_size = 0;

static BASIC_OP op_weight = {
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 2, 2, 1,
    1, 1, 1, 2, 1,

    1, 1, 1, 2, 1,
    1, 1, 18, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    2, 2, 2, 2, 1,

    1, 1, 1, 1, 1,
    1, 1, 1, 2,
    1, 2, 2, 2, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,

    1, 1, 1, 1, 3,
    3, 3, 3, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 3, 2,
    2, 6, 3, 3, 2,

    1, 32, 1

/* New complex basops */
#ifdef COMPLEX_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1

    ,
    1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1

#endif /* #ifdef COMPLEX_OPERATOR */

#ifdef ENH_64_BIT_OPERATOR
    /* Weights of new 64 bit basops */
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_64_BIT_OPERATOR */

#ifdef ENH_32_BIT_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_32_BIT_OPERATOR */

#ifdef ENH_U_32_BIT_OPERATOR
    ,
    1, 1, 1, 2, 2, 1, 1
#endif /* #ifdef ENH_U_32_BIT_OPERATOR */

#ifdef CONTROL_CODE_OPS
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef CONTROL_CODE_OPS */
};

BASIC_OP *multiCounter = NULL;
unsigned int currCounter = 0;
long funcid_total_wmops_at_last_call_to_else;
char func_name_where_last_call_to_else_occurred[MAX_FUNCTION_NAME_LENGTH + 1];

void reset_wmops( void )
{
    int i, j;
    unsigned int *ptr;

    num_wmops_records = 0;
    max_num_wmops_records = MAX_NUM_RECORDS;
@@ -102,7 +169,7 @@ void reset_wmops( void )
    start_cnt = 0.0;
    ops_cnt = 0.0;

    /* allocate the list of wmops records */
    /* allocate the list of WMOPS records */
    if ( wmops == NULL )
    {
        wmops = (wmops_record *) malloc( max_num_wmops_records * sizeof( wmops_record ) );
@@ -114,7 +181,7 @@ void reset_wmops( void )
        exit( -1 );
    }

    /* allocate the BASOP WMOPS counter */
    /* allocate the list of BASOP WMOPS records */
    if ( multiCounter == NULL )
    {
        multiCounter = (BASIC_OP *) malloc( max_num_wmops_records * sizeof( BASIC_OP ) );
@@ -127,7 +194,7 @@ void reset_wmops( void )
    }

    /* initilize the list of WMOPS records */
    /* initilize the BASOP WMOPS counters */
    /* initilize BASOP operation counters */
    for ( i = 0; i < max_num_wmops_records; i++ )
    {
        strcpy( &wmops[i].label[0], "\0" );
@@ -154,13 +221,8 @@ void reset_wmops( void )
        wmops[i].wc_call_number = -1;
#endif

        /* clear all BASOP operation counters */
        ptr = (unsigned int*) &multiCounter[i];
        for ( j = 0; j < (int) ( sizeof(BASIC_OP ) / sizeof( unsigned int ) ); j++ )
        {
            *ptr++ = 0;
        }
        wmops[i].LastWOper = 0;
        /* Reset BASOP operation counter */
        Reset_BASOP_WMOPS_counter( i );
    }

    /* allocate the list of wmops callers to track the sequence of function calls */
@@ -182,10 +244,6 @@ void reset_wmops( void )
        wmops_caller_stack[i] = -1;
    }

    /* initialize auxiliary BASOP WMOPS variables */
    call_occurred = 1;
    funcId_where_last_call_to_else_occurred = INT_MAX;

    return;
}

@@ -193,7 +251,7 @@ void push_wmops_fct( const char *label, ... )
{
    int new_flag;
    int i, j, index_record;
    unsigned int *ptr;
    long tot;
    va_list arg;
    char func_name[MAX_FUNCTION_NAME_LENGTH] = "";

@@ -218,7 +276,7 @@ void push_wmops_fct( const char *label, ... )
    }
    index_record = i;

    /* Create a new record in the list */
    /* Create a new WMOPS record in the list */
    if ( new_flag )
    {
        if ( num_wmops_records >= max_num_wmops_records )
@@ -227,51 +285,42 @@ void push_wmops_fct( const char *label, ... )
            max_num_wmops_records += MAX_NUM_RECORDS_REALLOC_STEP;
            wmops = realloc( wmops, max_num_wmops_records * sizeof( wmops_record ) );
            multiCounter = realloc( multiCounter, max_num_wmops_records * sizeof( BASIC_OP ) );
        }

            /* initilize newly created WMOPS records */
            for ( i = num_wmops_records; i < max_num_wmops_records; i++ )
            {
                strcpy( &wmops[i].label[0], "\0" );
                wmops[i].call_number = 0;
                wmops[i].update_cnt = 0;
        /* initilize the new WMOPS record */
        strcpy( &wmops[index_record].label[0], "\0" );
        wmops[index_record].call_number = 0;
        wmops[index_record].update_cnt = 0;
        for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ )
        {
                    wmops[i].call_tree[j] = -1;
                }
                wmops[i].start_selfcnt = 0.0;
                wmops[i].current_selfcnt = 0.0;
                wmops[i].max_selfcnt = 0.0;
                wmops[i].min_selfcnt = DOUBLE_MAX;
                wmops[i].tot_selfcnt = 0.0;
                wmops[i].start_cnt = 0.0;
                wmops[i].current_cnt = 0.0;
                wmops[i].max_cnt = 0.0;
                wmops[i].min_cnt = DOUBLE_MAX;
                wmops[i].tot_cnt = 0.0;
            wmops[index_record].call_tree[j] = -1;
        }
        wmops[index_record].start_selfcnt = 0.0;
        wmops[index_record].current_selfcnt = 0.0;
        wmops[index_record].max_selfcnt = 0.0;
        wmops[index_record].min_selfcnt = DOUBLE_MAX;
        wmops[index_record].tot_selfcnt = 0.0;
        wmops[index_record].start_cnt = 0.0;
        wmops[index_record].current_cnt = 0.0;
        wmops[index_record].max_cnt = 0.0;
        wmops[index_record].min_cnt = DOUBLE_MAX;
        wmops[index_record].tot_cnt = 0.0;
#ifdef WMOPS_WC_FRAME_ANALYSIS
                wmops[i].wc_cnt = 0.0;
                wmops[i].wc_selfcnt = 0.0;
                wmops[i].current_call_number = 0;
                wmops[i].wc_call_number = -1;
        wmops[index_record].wc_cnt = 0.0;
        wmops[index_record].wc_selfcnt = 0.0;
        wmops[index_record].current_call_number = 0;
        wmops[index_record].wc_call_number = -1;
#endif

                /* initialize BASOP WMOPS counters */
                ptr = (unsigned int *) &multiCounter[i];
                for ( j = 0; j < (int) ( sizeof( BASIC_OP ) / sizeof( unsigned int ) ); j++ )
                {
                    *ptr++ = 0;
                }
                wmops[i].LastWOper = 0;
            }

        }
        /* Reset BASOP operation counter */
        Reset_BASOP_WMOPS_counter( index_record );

        strcpy( wmops[index_record].label, func_name );

        num_wmops_records++;
    }

    /* Push the current context info to the new record */
    /* Update the WMOPS context info of the old record before switching to the new one */
    if ( current_record >= 0 )
    {
        if ( wmops_caller_stack_index >= max_wmops_caller_stack_index )
@@ -282,7 +331,9 @@ void push_wmops_fct( const char *label, ... )
        }
        wmops_caller_stack[wmops_caller_stack_index++] = current_record;

        /* accumulate op counts */
        /* add the BASOP complexity to the counter and update the old WMOPS counter */
        tot = DeltaWeightedOperation( current_record );
        ops_cnt += tot;
        wmops[current_record].current_selfcnt += ops_cnt - wmops[current_record].start_selfcnt;

        /* update call tree */
@@ -300,7 +351,14 @@ void push_wmops_fct( const char *label, ... )
        }
    }

    /* update the current context info */
    /* Need to reset the BASOP operation counter of the 0th record in every push_wmops() */
    /* because currCounter can never be -1 */
    if ( current_record == -1 && index_record == 0 )
    {
        wmops[index_record].LastWOper = TotalWeightedOperation( index_record );
    }

    /* switch to the new record */
    current_record = index_record;
    wmops[index_record].start_selfcnt = ops_cnt;
    wmops[index_record].start_cnt = ops_cnt;
@@ -309,13 +367,12 @@ void push_wmops_fct( const char *label, ... )
    wmops[index_record].current_call_number++;
#endif

    /* set the ID of BASOP functions counters */
    Set_BASOP_WMOPS_counter( index_record );
    /* set the ID of the current BASOP operations counter */
    currCounter = index_record;

    return;
}


void pop_wmops( void )
{
    long tot;
@@ -328,7 +385,7 @@ void pop_wmops( void )
    }

    /* add the BASOP complexity to the counter */
    tot = DeltaWeightedOperation();
    tot = DeltaWeightedOperation( currCounter );
    ops_cnt += tot;

    /* update count of current record */
@@ -340,15 +397,21 @@ void pop_wmops( void )
    {
        current_record = wmops_caller_stack[--wmops_caller_stack_index];
        wmops[current_record].start_selfcnt = ops_cnt;

        /* set the ID of the previous BASOP counter */
        Set_BASOP_WMOPS_counter( current_record );
    }
    else
    {
        current_record = -1;
    }

    /* set the ID of the previous BASOP operations counter */
    if ( current_record == -1 )
    {
        currCounter = 0; /* Note: currCounter cannot be set to -1 because it's defined as unsigned int ! */
    }
    else
    {
        currCounter = current_record;
    }

    return;
}
@@ -441,9 +504,8 @@ void update_wmops( void )
        wmops[i].current_call_number = 0;
#endif

        /* update the WC of all BASOP counters */
        Set_BASOP_WMOPS_counter( i );
        Reset_BASOP_WMOPS_counter();
        /* reset the BASOP operations counter */
        Reset_BASOP_WMOPS_counter( i );
    }

    current_cnt = ops_cnt - start_cnt;
@@ -477,7 +539,6 @@ void update_wmops( void )
    return;
}


void print_wmops( void )
{
    int i, label_len, max_label_len;
@@ -654,7 +715,6 @@ void print_wmops( void )
    return;
}


/*-------------------------------------------------------------------*
 * Memory counting tool measuring RAM usage (stack and heap)
 *
@@ -677,6 +737,7 @@ void print_wmops( void )
 * #define WMC_TOOL_SKIP ... #undef WMC_TOOL_SKIP macro pair around the malloc(), calloc() and free().
 *--------------------------------------------------------------------*/


/* This is the value (in bytes) towards which the block size is rounded. For example, a block of 123 bytes, when using
   a 32 bits system, will end up taking 124 bytes since the last unused byte cannot be used for another block. */
#ifdef MEM_ALIGN_64BITS
@@ -686,12 +747,14 @@ void print_wmops( void )
#endif

#define N_32BITS_BLOCKS ( BLOCK_ROUNDING / sizeof( int32_t ) )
#define ROUND_BLOCK_SIZE( n ) ( ( ( n ) + BLOCK_ROUNDING - 1 ) & ~( BLOCK_ROUNDING - 1 ) )

#define MAGIC_VALUE_OOB  0x12A534F0           /* Signature value which is inserted before and after each allocated memory block, used to detect out-of-bound access */
#define MAGIC_VALUE_USED ( ~MAGIC_VALUE_OOB ) /* Value used to pre-fill allocated memory blocks, used to calculate actual memory usage */
#define OOB_START        0x1                  /* Flag indicating out-of-bounds access before memory block */
#define OOB_END          0x2                  /* Flag indicating out-of-bounds access after memory block */
#define OOB_START        0x1                  /* int indicating out-of-bounds access before memory block */
#define OOB_END          0x2                  /* int indicating out-of-bounds access after memory block */

#define ROUND_BLOCK_SIZE( n ) ( ( ( n ) + BLOCK_ROUNDING - 1 ) & ~( BLOCK_ROUNDING - 1 ) )
#define IS_CALLOC( str )      ( str[0] == 'c' )

#ifdef MEM_COUNT_DETAILS
const char *csv_filename = "mem_analysis.csv";
@@ -713,7 +776,6 @@ static int32_t wc_stack_frame = 0; /* Frame corresponding to the worst-case
static int current_calls = 0, max_num_calls = MAX_NUM_RECORDS;
static char location_max_stack[256] = "undefined";

/* Heap-related variables */
typedef struct
{
    char name[MAX_FUNCTION_NAME_LENGTH + 1]; /* +1 for NUL */
@@ -2114,108 +2176,339 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )

#endif /* WMOPS */

#ifndef WMOPS
int cntr_push_pop = 0; /* global counter for checking balanced push_wmops()/pop_wmops() pairs when WMOPS is not activated */
#ifdef CONTROL_CODE_OPS

int LT_16( short var1, short var2 )
{
    int F_ret = 0;

    if ( var1 < var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].LT_16++;
#endif
    return F_ret;
}

int GT_16( short var1, short var2 )
{
    int F_ret = 0;

    if ( var1 > var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
/* Global counter for the calculation of BASOP complexity */
BASIC_OP *multiCounter = NULL;
int currCounter = 0;
int funcId_where_last_call_to_else_occurred;
long funcid_total_wmops_at_last_call_to_else;
int call_occurred = 1;
    multiCounter[currCounter].GT_16++;
#endif
    return F_ret;
}

BASIC_OP op_weight = {
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 2, 2, 1,
    1, 1, 1, 3, 1,
int LE_16( short var1, short var2 )
{
    int F_ret = 0;

    1, 1, 1, 3, 1,
    4, 1, 18, 1, 1,
    2, 1, 2, 2, 1,
    1, 1, 1, 1, 1,
    3, 3, 3, 3, 1,
    if ( var1 <= var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].LE_16++;
#endif
    return F_ret;
}

    1, 1, 1, 1, 1,
    1, 1, 1, 2,
    1, 2, 2, 4, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
int GE_16( short var1, short var2 )
{
    int F_ret = 0;

    1, 1, 1, 1, 3,
    3, 3, 3, 3, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 4, 4,
    4, 8, 3, 4, 4,
    if ( var1 >= var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].GE_16++;
#endif
    return F_ret;
}

    5, 32, 3
};
int EQ_16( short var1, short var2 )
{
    int F_ret = 0;

/* Set the counter group to use, default is zero */
void Set_BASOP_WMOPS_counter( int counterId )
    if ( var1 == var2 )
    {
    if ( ( counterId > num_wmops_records ) || ( counterId < 0 ) )
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].EQ_16++;
#endif
    return F_ret;
}

int NE_16( short var1, short var2 )
{
        currCounter = 0;
        return;
    int F_ret = 0;

    if ( var1 != var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].NE_16++;
#endif
    return F_ret;
}

int LT_32( int L_var1, int L_var2 )
{
    int F_ret = 0;

    if ( L_var1 < L_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].LT_32++;
#endif
    return F_ret;
}

int GT_32( int L_var1, int L_var2 )
{
    int F_ret = 0;

    if ( L_var1 > L_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].GT_32++;
#endif
    return F_ret;
}

int LE_32( int L_var1, int L_var2 )
{
    int F_ret = 0;

    if ( L_var1 <= L_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].LE_32++;
#endif
    return F_ret;
}

int GE_32( int L_var1, int L_var2 )
{
    int F_ret = 0;

    if ( L_var1 >= L_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].GE_32++;
#endif
    return F_ret;
}

int EQ_32( int L_var1, int L_var2 )
{
    int F_ret = 0;

    if ( L_var1 == L_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].EQ_32++;
#endif
    return F_ret;
}

int NE_32( int L_var1, int L_var2 )
{
    int F_ret = 0;

    if ( L_var1 != L_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].NE_32++;
#endif
    return F_ret;
}

int LT_64( long long int L64_var1, long long int L64_var2 )
{
    int F_ret = 0;

    if ( L64_var1 < L64_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].LT_64++;
#endif
    return F_ret;
}

int GT_64( long long int L64_var1, long long int L64_var2 )
{
    int F_ret = 0;

    if ( L64_var1 > L64_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].GT_64++;
#endif
    return F_ret;
}

int LE_64( long long int L64_var1, long long int L64_var2 )
{
    int F_ret = 0;

    if ( L64_var1 <= L64_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].LE_64++;
#endif
    return F_ret;
}
int GE_64( long long int L64_var1, long long int L64_var2 )
{
    int F_ret = 0;

    if ( L64_var1 >= L64_var2 )
    {
        F_ret = 1;
    }
    currCounter = counterId;
    call_occurred = 1;
#ifdef WMOPS
    multiCounter[currCounter].GE_64++;
#endif
    return F_ret;
}

extern int32_t frame;
int EQ_64( long long int L64_var1, long long int L64_var2 )
{
    int F_ret = 0;

long TotalWeightedOperation()
    if ( L64_var1 == L64_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].EQ_64++;
#endif
    return F_ret;
}
int NE_64( long long int L64_var1, long long int L64_var2 )
{
    int F_ret = 0;

    if ( L64_var1 != L64_var2 )
    {
        F_ret = 1;
    }
#ifdef WMOPS
    multiCounter[currCounter].NE_64++;
#endif
    return F_ret;
}

#endif /* #ifdef CONTROL_CODE_OPS */

#ifdef WMOPS

void incrIf( const char *func_name )
{
    /* Technical note: If the "IF" operator comes just after an "ELSE", its counter must not be incremented */
    /* The following auxiliary variables are used to check if the "IF" operator doesn't immediately follow an "ELSE" operator */
    if ( ( strncmp( func_name, func_name_where_last_call_to_else_occurred, MAX_FUNCTION_NAME_LENGTH ) != 0 ) || ( TotalWeightedOperation( currCounter ) != funcid_total_wmops_at_last_call_to_else ) )
    {

        multiCounter[currCounter].If++;
    }

    func_name_where_last_call_to_else_occurred[0] = '\0';
}

void incrElse( const char *func_name )
{
    multiCounter[currCounter].If++;

    /* Save the BASOP comeplxity in the last call of the ELSE() statement */
    funcid_total_wmops_at_last_call_to_else = TotalWeightedOperation( currCounter );

    /* We keep track of the name of the last calling function when the ELSE macro was called */
    strncpy( func_name_where_last_call_to_else_occurred, func_name, MAX_FUNCTION_NAME_LENGTH );
    func_name_where_last_call_to_else_occurred[MAX_FUNCTION_NAME_LENGTH] = '\0';
}

long TotalWeightedOperation( unsigned int CounterId )
{
    int i;
    unsigned int *ptr, *ptr2;
    long tot;

    tot = 0;
    ptr = (unsigned int *) &multiCounter[currCounter];
    ptr = (unsigned int *) &multiCounter[CounterId];
    ptr2 = (unsigned int *) &op_weight;

    for ( i = 0; i < ( int )( sizeof( multiCounter[currCounter] ) / sizeof( unsigned int ) ); i++ )
    for ( i = 0; i < (int) ( sizeof( multiCounter[CounterId] ) / sizeof( unsigned int ) ); i++ )
    {
        if ( *ptr == UINT_MAX )
        {
            printf( "\nError in BASOP complexity counters: multiCounter[%d][%d] = %d !!!\n", CounterId, i, *ptr );
            exit( -1 );
        }

        tot += ( ( *ptr++ ) * ( *ptr2++ ) );
    }

    return ( tot );
}

long DeltaWeightedOperation( void )
long DeltaWeightedOperation( unsigned int CounterId )
{
    long NewWOper, delta;

    NewWOper = TotalWeightedOperation();
    NewWOper = TotalWeightedOperation( CounterId );

    delta = NewWOper - wmops[currCounter].LastWOper;
    wmops[currCounter].LastWOper = NewWOper;
    delta = NewWOper - wmops[CounterId].LastWOper;
    wmops[CounterId].LastWOper = NewWOper;

    return ( delta );
}

/* Resets the current BASOP WMOPS counter */
void Reset_BASOP_WMOPS_counter( void )
/* Resets BASOP operation counter */
void Reset_BASOP_WMOPS_counter( unsigned int counterId )
{
    int i;
    long *ptr;
    unsigned int *ptr;

    /* clear the current BASOP operation counter before new frame begins */
    ptr = (long *) &multiCounter[currCounter];
    for ( i = 0; i < (int) ( sizeof( multiCounter[currCounter] ) / sizeof( long ) ); i++ )
    /* reset the current BASOP operation counter */
    ptr = (unsigned int *) &multiCounter[counterId];
    for ( i = 0; i < (int) (sizeof(BASIC_OP) / sizeof(unsigned int)); i++ )
    {
        *ptr++ = 0;
    }

    wmops[currCounter].LastWOper = 0;
    wmops[counterId].LastWOper = 0;

    return;
}

#endif

+421 −630

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -1776,7 +1776,7 @@ ivas_error split_renderer_open_lc3plus(
    /* Alocate buffers for delay compensation */
    if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS )
    {
        delayBufferLength = (int16_t) ( output_Fs / (int32_t) FRAMES_PER_SECOND + hSplitRendWrapper->lc3plusDelaySamples );
        delayBufferLength = (int16_t) ( output_Fs / (int32_t) FRAMES_PER_SEC + hSplitRendWrapper->lc3plusDelaySamples );
        for ( i = 0; i < hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++i )
        {
            if ( ( hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) ) ) == NULL )
@@ -1905,7 +1905,7 @@ ivas_error isar_renderMultiTDBinToSplitBinaural(
    if ( useLc3plus )
    {
        /*this should always have the time resolution of pose correction MD. Note that this does not change frame size of LC3plus*/
        int16_t frame_size = (int16_t) ( hSplitBin->hLc3plusEnc->config.samplerate / (int32_t) FRAMES_PER_SECOND );
        int16_t frame_size = (int16_t) ( hSplitBin->hLc3plusEnc->config.samplerate / (int32_t) FRAMES_PER_SEC );

        for ( i = 0; i < num_poses * BINAURAL_CHANNELS; ++i )
        {
+410 KiB (674 KiB)

File changed.

No diff preview for this file type.

+13.1 KiB (369 KiB)

File changed.

No diff preview for this file type.

Loading