Commit 1da44342 authored by vaillancour's avatar vaillancour
Browse files

some more cleaning

parent 5ebfb73d
Loading
Loading
Loading
Loading
+34 −56
Original line number Diff line number Diff line
@@ -54,10 +54,10 @@ static double frameRate = FRAME_RATE; /* default value : 10 ms */

#ifdef WMOPS
/* Global counter variable for calculation of complexity weight */
/* Some enhancement written by Vail., GJR and M.Mul. during EVS time */

BASIC_OP multiCounter[MAXCOUNTERS];
#ifdef FROM_EVS_DEV
BASIC_OP glob_multiCounter;
#endif
int currCounter = 0;            /* Zero equals global counter */
#endif /* ifdef WMOPS */

@@ -323,14 +323,14 @@ Word32 DeltaWeightedOperation (void);
#ifdef WMOPS
/* Counters for separating counting for different objects */

#ifdef FROM_EVS_DEV
/* FROM_EVS_DEV */
    /**
 maxCounter: current number of counters. Each scope initialized with BASOP_sub_start() gets a own counter assigned.
 objectName: Name of each counter passed to BASOP_sub_start().
 fwc_corr: 
 nbTimeObjectIsCalled: number of times a counter (object) is referenced in the current frame.
 */
#endif

static int maxCounter = 0;
static char *objectName[MAXCOUNTERS + 1];

@@ -338,11 +338,6 @@ static Word16 fwc_corr[MAXCOUNTERS + 1];
static long int nbTimeObjectIsCalled[MAXCOUNTERS + 1];


#ifndef FROM_EVS_DEV
#define NbFuncMax  1024
static Word16 funcid[MAXCOUNTERS], nbframe[MAXCOUNTERS];
static Word32 glob_wc[MAXCOUNTERS], wc[MAXCOUNTERS][NbFuncMax];
#else
#define NbFuncMax  (4096)


@@ -364,13 +359,9 @@ static Word32 glob_wc[MAXCOUNTERS], wc[MAXCOUNTERS][NbFuncMax];

static Word32 funcid[MAXCOUNTERS], nbframe[MAXCOUNTERS], nbcalls[MAXCOUNTERS];
static Word32 glob_bc[MAXCOUNTERS], glob_wc[MAXCOUNTERS], bc[MAXCOUNTERS][NbFuncMax], wc[MAXCOUNTERS][NbFuncMax];

#endif
static float total_wmops[MAXCOUNTERS];

static Word32 LastWOper[MAXCOUNTERS];
#ifdef FROM_EVS_DEV

/* FROM_EVS_DEV */
static float total_sum[MAXCOUNTERS];
static Word16 call_tree[MAXCOUNTERS][MAXCOUNTERS];
static int sum_curr[MAXCOUNTERS+1];
@@ -385,7 +376,7 @@ static float callers_frames[MAX_CALLERS_SAVED_FRAMES+1][MAXCOUNTERS+1];
static int callers_frames_nos[MAX_CALLERS_SAVED_FRAMES];
static float callers_totals[MAX_CALLERS_SAVED_FRAMES];
#endif
#endif

#endif /* ifdef WMOPS */


@@ -480,11 +471,14 @@ static Word32 WMOPS_frameStat (void) {

  tot = TotalWeightedOperation ();
  if ( tot > glob_wc[currCounter] )
  {
      glob_wc[currCounter] = tot;
#ifdef FROM_EVS_DEV
  }

  if ( tot < glob_bc[currCounter] )
  {
      glob_bc[currCounter] = tot;
#endif
  }
  /* check if fwc() was forgotten at end of last frame */
  if (tot > LastWOper[currCounter]) {
    if (!fwc_corr[currCounter]) {
@@ -570,7 +564,6 @@ void Init_WMOPS_counter (void) {
  glob_wc[currCounter] = 0;
  nbframe[currCounter] = 0;
  total_wmops[currCounter] = 0.0;
#ifdef FROM_EVS_DEV
  for (i = 0; i < NbFuncMax; i++)
  {
    bc[currCounter][i] = (Word32)MAX_32;
@@ -578,7 +571,7 @@ void Init_WMOPS_counter (void) {
  glob_bc[currCounter] = MAX_32;
  nbcalls[currCounter] = 0;
  total_sum[currCounter] = 0.0;
#endif

  /* initially clear all counters */
  WMOPS_clearMultiCounter ();
  LastWOper[currCounter] = 0;
@@ -588,7 +581,6 @@ void Init_WMOPS_counter (void) {
  call_occurred = 1;
  funcId_where_last_call_to_else_occurred = MAXCOUNTERS;

#ifdef FROM_EVS_DEV
  sum_bc[currCounter] = MAX_32;
  sum_wc[currCounter] = 0;
  sum_curr[currCounter] = 0;
@@ -600,43 +592,31 @@ void Init_WMOPS_counter (void) {
  glob_sum_curr[currCounter] = 0;
  glob_sum_wc[currCounter] = 0;
  glob_sum_bc[currCounter] = MAX_32;
#endif

#endif /* ifdef WMOPS */
}


#ifdef FROM_EVS_DEV
Word32 Reset_WMOPS_counter(void) {
#else
void Reset_WMOPS_counter (void) {
#endif
#if WMOPS
  Word32 tot = WMOPS_frameStat ();

  /* increase the frame counter --> a frame is counted WHEN IT BEGINS */
  nbframe[currCounter]++;
#ifndef FROM_EVS_DEV  
  /* add wmops used in last frame to count, then reset counter (in first frame, this is a no-op */
  total_wmops[currCounter] += (float) (tot * frameRate);
#endif
#ifdef FROM_EVS_DEV
  /* Call counter */
  nbcalls[currCounter] += funcid[currCounter];
  /* add wmops used in last frame to count, then reset counter (in first frame, this is a no-op */
  total_wmops[currCounter] += (float) (tot * frameRate);
  total_sum[currCounter] += (float)((glob_sum_curr[currCounter]) * frameRate);
#endif

  /* clear counter before new frame starts */
  WMOPS_clearMultiCounter ();
  LastWOper[currCounter] = 0;
  funcid[currCounter] = 0;      /* new frame, set function id to zero */
#ifdef FROM_EVS_DEV

  glob_sum_curr[currCounter] = 0;
  sum_curr[currCounter] = 0;
  return tot;
#endif

#endif /* ifdef WMOPS */
}
@@ -650,21 +630,19 @@ Word32 fwc (void) {
  tot = DeltaWeightedOperation ();
  if (tot > wc[currCounter][funcid[currCounter]])
    wc[currCounter][funcid[currCounter]] = tot;
#ifdef FROM_EVS_DEV

  if (tot < bc[currCounter][funcid[currCounter]])
      bc[currCounter][funcid[currCounter]] = tot;
#endif

  funcid[currCounter]++;
#ifdef FROM_EVS_DEV

  /*make sure that BASOP_frame_update(); is put at the end of the main loop*/
    if (funcid[currCounter] >= NbFuncMax) {
  if (funcid[currCounter] >= NbFuncMax) 
  {
        printf("to many function calls\n");
  }
  assert(funcid[currCounter] < NbFuncMax);
  return (tot);
#else /* ifdef WMOPS */
  return 0;                     /* Dummy */
#endif
#endif /* ifdef WMOPS */
}

@@ -700,7 +678,7 @@ void WMOPS_output (Word16 dtx_mode) {
#endif /* ifdef WMOPS */
}

void WMOPS_output_avg (Word16 dtx_mode, Word32 * tot_wm, Word16 * num_frames) {
void WMOPS_output_avg (Word16 dtx_mode, Word32 * tot_wm, Word32 * num_frames) {
#if WMOPS
  Word16 i;
  Word32 tot, tot_wc;
@@ -870,7 +848,7 @@ void generic_WMOPS_output (Word16 dtx_mode, char *test_file_name) {
   (void)test_file_name;
#endif /* ifdef WMOPS */
}
#ifdef FROM_EVS_DEV
/* FROM_EVS_DEV */

#define MAX_STACK       64
static int stack[MAX_STACK];
@@ -1062,7 +1040,7 @@ void BASOP_push_wmops (const char *label)
            }
          else if (call_tree[i][j] == -1)
            {
              call_tree[i][j] = prev_counter;
              call_tree[i][j] = (Word16)prev_counter;
              break;
            }
        }
@@ -1452,5 +1430,5 @@ void BASOP_get_total_wmops(double *min, double *max, double *avg)
  }
#endif /* if WMOPS */
}
#endif

/* end of file */
+2 −11
Original line number Diff line number Diff line
@@ -64,9 +64,7 @@
//#undef WMOPS /* disable WMOPS profiling features */
#endif
#define MAXCOUNTERS (512)
#ifdef FROM_EVS_DEV
#define MAX_CALLERS_SAVED_FRAMES 5 /* # of Frame for which WMOPS Complexity Details will be saved, 0 = Disabled */
#endif

int getCounterId (char *objectName);
/*
@@ -93,7 +91,6 @@ char *readCounterIdName (void);
/*
 * Returns the current CounterId name.
 */
#ifdef FROM_EVS_DEV
void printStack(char *text, char * Id);
/*
 * print stack
@@ -102,7 +99,6 @@ void printStack(char *text, char * Id);
 *          "*", if all prints are wanted (default)
 *          "pitch_ol" or any other function name
 */
#endif

void incrementNbTimeObjectIsCalled (int counterId);
/*
@@ -127,11 +123,8 @@ void Init_WMOPS_counter (void);
 */


#ifdef FROM_EVS_DEV

Word32 Reset_WMOPS_counter( void );
#else
void Reset_WMOPS_counter( void );
#endif
    /*
 * Resets the current counter group.
 */
@@ -145,7 +138,7 @@ void WMOPS_output (Word16 notPrintWorstWorstCase);
 *
 */

void WMOPS_output_avg (Word16 dtx_mode, Word32 * tot_wm, Word16 * num_frames);
void WMOPS_output_avg (Word16 dtx_mode, Word32 * tot_wm, Word32 * num_frames);
/*
 * same as WMOPS_output + returns the total wmops counter and the number of frames
 * to support the computation of global average.
@@ -487,7 +480,6 @@ void generic_WMOPS_output (Word16 notPrintWorstWorstCase, char *test_file_name);
 *
 * notPrintWorstWorstCase : Same usage as in WMOPS_output().
 */
#ifdef FROM_EVS_DEV
void WMOPS_output_all(Word16 dtx_mode);
void WMOPS_output_all_std(Word16 dtx_mode);

@@ -495,7 +487,6 @@ void WMOPS_output_all_std(Word16 dtx_mode);
 * free all allocated counter memory 
 */
void WMOPS_destroy(void);
#endif
#if 0
/*
 * Example of how count.h could be used.
+4 −4
Original line number Diff line number Diff line
@@ -53,15 +53,15 @@
#pragma warning(disable:4310)     /* cast truncates constant value this affects mainly constants tables*/
#endif

#define WMOPS  1                             /* Activate complexity and memory counters */
#define FROM_EVS_DEV                        /* Some enhancement written by gr and Markus during EVS time */
#define WMOPS  1                             /* Activate FIXED-POINT complexity counters */
/*#define DONT_COUNT */                         /* To prevent the complexity counting  */

#ifdef WMOPS_FLT
/*#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") */

#endif

/* #################### End DEBUGGING switches ############################ */