diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj
index 537f7005b966660d7a7de7c8aa79a4d28576f813..9182dd36282cc0652cc43986fb561b0be255385e 100644
--- a/Workspace_msvc/lib_com.vcxproj
+++ b/Workspace_msvc/lib_com.vcxproj
@@ -142,9 +142,7 @@
-
-
diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters
index c427c57e58624bfd3babdbbe6f68cd7b008f320a..93a2b1c00c5b944283f3f7778ccbe44a5f1548ff 100644
--- a/Workspace_msvc/lib_com.vcxproj.filters
+++ b/Workspace_msvc/lib_com.vcxproj.filters
@@ -76,9 +76,6 @@
common_ivas_c
-
- common_all_c
-
common_all_c
@@ -417,7 +414,6 @@
-
diff --git a/lib_com/basop32.c b/lib_com/basop32.c
index dbdda3aebcaa6963d43fb0d2ffeee54a3a397a70..732e33b2a5ef05c6b47458c63f0c854a73cf7b4d 100644
--- a/lib_com/basop32.c
+++ b/lib_com/basop32.c
@@ -159,7 +159,9 @@ HISTORY:
#include
#include
+#include "options.h"
#include "stl.h"
+
#ifdef BASOP_NOGLOB
#include
#endif /* BASOP_NOGLOB */
@@ -170,10 +172,6 @@ HISTORY:
#pragma warning( disable : 4310 )
#endif
-#ifdef WMOPS
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-#endif
/*___________________________________________________________________________
| |
diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c
index c465428fc90125779c4ab2505bc28a0684356467..fb4cf1517d3084601d31ec47a5682eb62cd94c64 100644
--- a/lib_com/basop_util.c
+++ b/lib_com/basop_util.c
@@ -43,7 +43,6 @@
#include "rom_com.h"
#include "rom_basic_math.h"
#include "basop_settings.h"
-#include "control.h"
#include "cnst.h"
diff --git a/lib_com/complex_basop.c b/lib_com/complex_basop.c
index ffe56d47545610529d208ab39b4d0f9c5b2c4757..cf3b40154acf5119739354e855db0e55a78822cd 100644
--- a/lib_com/complex_basop.c
+++ b/lib_com/complex_basop.c
@@ -9,22 +9,9 @@
*****************************************************************************/
-#include "typedef.h"
-#include "basop32.h"
-
-#include "complex_basop.h"
-
#include "stl.h"
-
-#ifdef WMOPS
-
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-
-extern int currCounter;
-
-#endif /* if WMOPS */
-
+#define WMC_TOOL_SKIP
#ifdef COMPLEX_OPERATOR
diff --git a/lib_com/complex_basop.h b/lib_com/complex_basop.h
index 117ba400e427883a5777c221f12b9950c93e3c63..bf1641e749960b5fdf2c9ee4130ebce852f39c81 100644
--- a/lib_com/complex_basop.h
+++ b/lib_com/complex_basop.h
@@ -10,8 +10,6 @@
#ifndef _COMPLEX_BASIC_OP_H
#define _COMPLEX_BASIC_OP_H
-#include "typedef.h"
-#include "basop32.h"
#include "stl.h"
#ifdef COMPLEX_OPERATOR
diff --git a/lib_com/control.c b/lib_com/control.c
deleted file mode 100644
index dadb2e4967166a786333097c5102c3745397d491..0000000000000000000000000000000000000000
--- a/lib_com/control.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- ===========================================================================
- File: CONTROL.C v.2.3 - 30.Nov.2009
- ===========================================================================
-
- ITU-T STL BASIC OPERATORS
-
- CONTROL FLOW OPERATOR INTERNAL VARIABLE DECLARATIONS
-
- History:
- 07 Nov 04 v2.0 Incorporation of new 32-bit / 40-bit / control
- operators for the ITU-T Standard Tool Library as
- described in Geneva, 20-30 January 2004 WP 3/16 Q10/16
- TD 11 document and subsequent discussions on the
- wp3audio@yahoogroups.com email reflector.
- March 06 v2.1 Changed to improve portability.
-
- ============================================================================
-*/
-
-#include "stl.h"
-
-#ifdef WMOPS
-long funcid_total_wmops_at_last_call_to_else;
-#ifdef FIX_1054_IF_ELSE_CMPLX
-char func_name_where_last_call_to_else_occurred[MAX_FUNCTION_NAME_LENGTH + 1] = "";
-#else
-int funcId_where_last_call_to_else_occurred;
-int call_occurred = 1;
-#endif
-#endif
-
-#ifdef CONTROL_CODE_OPS
-
-Flag LT_16( Word16 var1, Word16 var2 )
-{
- Flag F_ret = 0;
-
- if ( var1 < var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].LT_16++;
-#endif
- return F_ret;
-}
-
-Flag GT_16( Word16 var1, Word16 var2 )
-{
- Flag F_ret = 0;
-
- if ( var1 > var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].GT_16++;
-#endif
- return F_ret;
-}
-
-Flag LE_16( Word16 var1, Word16 var2 )
-{
- Flag F_ret = 0;
-
- if ( var1 <= var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].LE_16++;
-#endif
- return F_ret;
-}
-
-Flag GE_16( Word16 var1, Word16 var2 )
-{
- Flag F_ret = 0;
-
- if ( var1 >= var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].GE_16++;
-#endif
- return F_ret;
-}
-
-Flag EQ_16( Word16 var1, Word16 var2 )
-{
- Flag F_ret = 0;
-
- if ( var1 == var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].EQ_16++;
-#endif
- return F_ret;
-}
-
-Flag NE_16( Word16 var1, Word16 var2 )
-{
- Flag F_ret = 0;
-
- if ( var1 != var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].NE_16++;
-#endif
- return F_ret;
-}
-
-Flag LT_32( Word32 L_var1, Word32 L_var2 )
-{
- Flag F_ret = 0;
-
- if ( L_var1 < L_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].LT_32++;
-#endif
- return F_ret;
-}
-
-Flag GT_32( Word32 L_var1, Word32 L_var2 )
-{
- Flag F_ret = 0;
-
- if ( L_var1 > L_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].GT_32++;
-#endif
- return F_ret;
-}
-
-Flag LE_32( Word32 L_var1, Word32 L_var2 )
-{
- Flag F_ret = 0;
-
- if ( L_var1 <= L_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].LE_32++;
-#endif
- return F_ret;
-}
-
-Flag GE_32( Word32 L_var1, Word32 L_var2 )
-{
- Flag F_ret = 0;
-
- if ( L_var1 >= L_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].GE_32++;
-#endif
- return F_ret;
-}
-
-Flag EQ_32( Word32 L_var1, Word32 L_var2 )
-{
- Flag F_ret = 0;
-
- if ( L_var1 == L_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].EQ_32++;
-#endif
- return F_ret;
-}
-
-Flag NE_32( Word32 L_var1, Word32 L_var2 )
-{
- Flag F_ret = 0;
-
- if ( L_var1 != L_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].NE_32++;
-#endif
- return F_ret;
-}
-
-Flag LT_64( Word64 L64_var1, Word64 L64_var2 )
-{
- Flag F_ret = 0;
-
- if ( L64_var1 < L64_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].LT_64++;
-#endif
- return F_ret;
-}
-
-Flag GT_64( Word64 L64_var1, Word64 L64_var2 )
-{
- Flag F_ret = 0;
-
- if ( L64_var1 > L64_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].GT_64++;
-#endif
- return F_ret;
-}
-
-Flag LE_64( Word64 L64_var1, Word64 L64_var2 )
-{
- Flag F_ret = 0;
-
- if ( L64_var1 <= L64_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].LE_64++;
-#endif
- return F_ret;
-}
-Flag GE_64( Word64 L64_var1, Word64 L64_var2 )
-{
- Flag F_ret = 0;
-
- if ( L64_var1 >= L64_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].GE_64++;
-#endif
- return F_ret;
-}
-
-Flag EQ_64( Word64 L64_var1, Word64 L64_var2 )
-{
- Flag F_ret = 0;
-
- if ( L64_var1 == L64_var2 )
- {
- F_ret = 1;
- }
-#ifdef WMOPS
- multiCounter[currCounter].EQ_64++;
-#endif
- return F_ret;
-}
-Flag NE_64( Word64 L64_var1, Word64 L64_var2 )
-{
- Flag 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 */
-
-
-/* end of file */
diff --git a/lib_com/control.h b/lib_com/control.h
deleted file mode 100644
index c788cac140d174f56799e577ec66d7355dfe4f91..0000000000000000000000000000000000000000
--- a/lib_com/control.h
+++ /dev/null
@@ -1,408 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef _CONTROL_H
-#define _CONTROL_H
-
-#include
-#include "stl.h"
-
-/*****************************************************************************
- *
- * Constants and Globals
- *
- *****************************************************************************/
-#ifdef WMOPS
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-
-#define MAX_FUNCTION_NAME_LENGTH 200 /* Maximum length of the function name */
-
-extern long funcid_total_wmops_at_last_call_to_else;
-#ifdef FIX_1054_IF_ELSE_CMPLX
-extern char func_name_where_last_call_to_else_occurred[];
-#else
-/* Technical note :
- * The following 3 variables are only used for correct complexity
- * evaluation of the following structure :
- * IF{
- * ...
- * } ELSE IF {
- * ...
- * } ELSE IF {
- * ...
- * }
- * ...
- * } ELSE {
- * ...
- * }
- */
-
-extern int call_occurred;
-extern int funcId_where_last_call_to_else_occurred;
-#endif
-#endif /* ifdef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Macros
- *
- *****************************************************************************/
-
-/*****************************************************************************
- *
- * Function Name : FOR
- *
- * Purpose :
- *
- * The macro FOR should be used instead of the 'for' C statement.
- * The complexity is independent of the number of loop iterations that are
- * performed.
- *
- * Complexity weight : 3 (regardless of number of iterations).
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define FOR( a ) for ( a )
-
-#else /* ifndef WMOPS */
-#define FOR( a ) \
- if ( incrFor(), 0 ) \
- ; \
- else \
- for ( a )
-
-static __inline void incrFor( void )
-{
- multiCounter[currCounter].For++;
-}
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : WHILE
- *
- * Purpose :
- *
- * The macro WHILE should be used instead of the 'while' C statement.
- * The complexity is proportional to the number of loop iterations that
- * are performed.
- *
- * Complexity weight : 4 x 'number of loop iterations'.
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define WHILE( a ) while ( a )
-
-#else /* ifndef WMOPS */
-#define WHILE( a ) while ( incrWhile(), a )
-
-static __inline void incrWhile( void )
-{
- multiCounter[currCounter].While++;
-}
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : DO
- *
- * Purpose :
- *
- * The macro DO should be used instead of the 'do' C statement.
- *
- * Complexity weight : 0 (complexity counted by WHILE macro).
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define DO do
-
-#else /* ifndef WMOPS */
-#define DO do
-
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : IF
- *
- * Purpose :
- *
- * The macro IF should :
- *
- * - not be used when :
- * - the 'if' structure does not have any 'else if' nor 'else' statement
- * - and it conditions only one DSP basic operations.
- *
- * - be used instead of the 'if' C statement in every other case :
- * - when there is an 'else' or 'else if' statement,
- * - or when the 'if' conditions several DSP basic operations,
- * - or when the 'if' conditions a function call.
- *
- * Complexity weight : 4
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define IF( a ) if ( a )
-
-#else /* ifndef WMOPS */
-#ifdef FIX_1054_IF_ELSE_CMPLX
-#define IF( a ) if ( incrIf( __func__ ), a )
-#else
-#define IF( a ) if ( incrIf(), a )
-#endif
-
-#ifdef FIX_1054_IF_ELSE_CMPLX
-static __inline void incrIf( const char *func_name )
-#else
-static __inline void incrIf( void )
-#endif
-{
- /* Technical note :
- * If the "IF" operator comes just after an "ELSE", its counter
- * must not be incremented.
- */
-#ifdef FIX_1054_IF_ELSE_CMPLX
- if ( ( strncmp( func_name, func_name_where_last_call_to_else_occurred, MAX_FUNCTION_NAME_LENGTH ) != 0 ) || ( TotalWeightedOperation() != funcid_total_wmops_at_last_call_to_else ) )
- {
-
- multiCounter[currCounter].If++;
- }
-
- func_name_where_last_call_to_else_occurred[0] = '\0';
-#else
- if ( ( currCounter != funcId_where_last_call_to_else_occurred ) || ( TotalWeightedOperation() != funcid_total_wmops_at_last_call_to_else ) || ( call_occurred == 1 ) )
- multiCounter[currCounter].If++;
-
- call_occurred = 0;
- funcId_where_last_call_to_else_occurred = MAXCOUNTERS;
-#endif
-}
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : ELSE
- *
- * Purpose :
- *
- * The macro ELSE should be used instead of the 'else' C statement.
- *
- * Complexity weight : 4
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define ELSE else
-
-#else /* ifndef WMOPS */
-#ifdef FIX_1054_IF_ELSE_CMPLX
-#define ELSE \
- else if ( incrElse( __func__ ), 0 ); \
- else
-#else
-#define ELSE \
- else if ( incrElse(), 0 ); \
- else
-#endif
-
-#ifdef FIX_1054_IF_ELSE_CMPLX
-static __inline void incrElse( const char *func_name )
-#else
-static __inline void incrElse( void )
-#endif
-{
- multiCounter[currCounter].If++;
-
- /* We keep track of the number of WMOPS of this funcId when the ELSE macro was called. */
- funcid_total_wmops_at_last_call_to_else = TotalWeightedOperation();
-
-#ifdef FIX_1054_IF_ELSE_CMPLX
- /* 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';
-#else
- /* We keep track of the funcId of the last function which used ELSE {...} structure. */
- funcId_where_last_call_to_else_occurred = currCounter;
-
- /* call_occurred is set to 0, in order to count the next IF (if necessary) */
- call_occurred = 0;
-#endif
-}
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : SWITCH
- *
- * Purpose :
- *
- * The macro SWITCH should be used instead of the 'switch' C statement.
- *
- * Complexity weight : 8
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define SWITCH( a ) switch ( a )
-
-#else /* ifndef WMOPS */
-#define SWITCH( a ) switch ( incrSwitch(), a )
-
-static __inline void incrSwitch( void )
-{
- multiCounter[currCounter].Switch++;
-}
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : CONTINUE
- *
- * Purpose :
- *
- * The macro CONTINUE should be used instead of the 'continue' C statement.
- *
- * Complexity weight : 4
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define CONTINUE continue
-
-#else /* ifndef WMOPS */
-#define CONTINUE \
- if ( incrContinue(), 0 ) \
- ; \
- else \
- continue
-
-static __inline void incrContinue( void )
-{
- multiCounter[currCounter].Continue++;
-}
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : BREAK
- *
- * Purpose :
- *
- * The macro BREAK should be used instead of the 'break' C statement.
- *
- * Complexity weight : 4
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define BREAK break
-
-#else /* ifndef WMOPS */
-#define BREAK \
- if ( incrBreak(), 0 ) \
- ; \
- else \
- break
-
-static __inline void incrBreak( void )
-{
- multiCounter[currCounter].Break++;
-}
-#endif /* ifndef WMOPS */
-
-
-/*****************************************************************************
- *
- * Function Name : GOTO
- *
- * Purpose :
- *
- * The macro GOTO should be used instead of the 'goto' C statement.
- *
- * Complexity weight : 4
- *
- *****************************************************************************/
-#ifndef WMOPS
-#define GOTO goto
-
-#else /* ifndef WMOPS */
-#define GOTO \
- if ( incrGoto(), 0 ) \
- ; \
- else \
- goto
-
-static __inline void incrGoto( void )
-{
- multiCounter[currCounter].Goto++;
-}
-#endif /* ifndef WMOPS */
-
-
-/*
- * New control code basops
- */
-#ifdef CONTROL_CODE_OPS
-
-Flag LT_16( Word16 var1, Word16 var2 );
-Flag GT_16( Word16 var1, Word16 var2 );
-Flag LE_16( Word16 var1, Word16 var2 );
-Flag GE_16( Word16 var1, Word16 var2 );
-Flag EQ_16( Word16 var1, Word16 var2 );
-Flag NE_16( Word16 var1, Word16 var2 );
-
-Flag LT_32( Word32 L_var1, Word32 L_var2 );
-Flag GT_32( Word32 L_var1, Word32 L_var2 );
-Flag LE_32( Word32 L_var1, Word32 L_var2 );
-Flag GE_32( Word32 L_var1, Word32 L_var2 );
-Flag EQ_32( Word32 L_var1, Word32 L_var2 );
-Flag NE_32( Word32 L_var1, Word32 L_var2 );
-
-Flag LT_64( Word64 L64_var1, Word64 L64_var2 );
-Flag GT_64( Word64 L64_var1, Word64 L64_var2 );
-Flag LE_64( Word64 L64_var1, Word64 L64_var2 );
-Flag GE_64( Word64 L64_var1, Word64 L64_var2 );
-Flag EQ_64( Word64 L64_var1, Word64 L64_var2 );
-Flag NE_64( Word64 L64_var1, Word64 L64_var2 );
-
-
-#endif /* #ifdef CONTROL_CODE_OPS */
-
-#endif /* _CONTROL_H */
-
-
-/* end of file */
diff --git a/lib_com/count.c b/lib_com/count.c
deleted file mode 100644
index ce38def6716e73c2ccb0ce7f15913873d698f0dd..0000000000000000000000000000000000000000
--- a/lib_com/count.c
+++ /dev/null
@@ -1,1399 +0,0 @@
-/*
- ===========================================================================
- File: COUNT.C v.2.3 - 30.Nov.2009
- ===========================================================================
-
- ITU-T STL BASIC OPERATORS
-
- COMPLEXITY EVALUATION FUNCTIONS
-
- History:
- 03 Nov 04 v2.0 Incorporation of new 32-bit / 40-bit / control
- operators for the ITU-T Standard Tool Library as
- described in Geneva, 20-30 January 2004 WP 3/16 Q10/16
- TD 11 document and subsequent discussions on the
- wp3audio@yahoogroups.com email reflector.
- norm_s() weight reduced from 15 to 1.
- norm_l() weight reduced from 30 to 1.
- L_abs() weight reduced from 2 to 1.
- L_add() weight reduced from 2 to 1.
- L_negate() weight reduced from 2 to 1.
- L_shl() weight reduced from 2 to 1.
- L_shr() weight reduced from 2 to 1.
- L_sub() weight reduced from 2 to 1.
- mac_r() weight reduced from 2 to 1.
- msu_r() weight reduced from 2 to 1.
- mult_r() weight reduced from 2 to 1.
- L_deposit_h() weight reduced from 2 to 1.
- L_deposit_l() weight reduced from 2 to 1.
- March 06 v2.1 Changed to improve portability.
- Dec 06 v2.2 Changed to specify frame rate using setFrameRate()
- Adding WMOPS_output_avg() for global average computation
- L_mls() weight of 5.
- div_l() weight of 32.
- i_mult() weight of 3.
- ============================================================================
-*/
-
-
-/*****************************************************************************
- *
- * This file contains functions for the automatic complexity calculation
- *
- *****************************************************************************/
-
-
-#include
-#include
-#include
-#include
-#include "stl.h"
-#include "options.h"
-#include "wmc_auto.h"
-
-#ifndef WMOPS
-#include "options_warnings.h"
-#endif
-
-#define WMC_TOOL_SKIP
-
-#ifdef WMOPS
-static double frameRate = FRAME_RATE; /* default value : 10 ms */
-
-#define MAX_RECORDS 1024
-#define MAX_STACK 64
-#define MAX_CHAR 64
-
-// struct wmops_record
-//{
-// char label[MAX_CHAR];
-// long call_number;
-// long update_cnt;
-// int call_tree[MAX_RECORDS];
-// double start_selfcnt;
-// double current_selfcnt;
-// double max_selfcnt;
-// double min_selfcnt;
-// double tot_selfcnt;
-// double start_cnt; /* The following take into account the decendants */
-// double current_cnt;
-// double max_cnt;
-// double min_cnt;
-// double tot_cnt;
-// };
-//
-// static struct wmops_record wmops[MAX_RECORDS];
-
-static int stack[MAX_STACK];
-static int sptr;
-static int sum_stack[MAX_STACK];
-
-/* Global counter variable for calculation of complexity weight */
-/* Some enhancement written by Vail., GJR and M.Mul. during EVS time */
-
-BASIC_OP multiCounter[MAXCOUNTERS];
-BASIC_OP glob_multiCounter;
-int currCounter = 0; /* Zero equals global counter */
-
-void setFrameRate( int samplingFreq, int frameLength )
-{
- if ( frameLength > 0 )
- {
- frameRate = samplingFreq / 1000000.0 / frameLength;
- }
- return;
-}
-
-
-/*
- * Below list is used for displaying the code profiling information in
- * the file which name is defined by CODE_PROFILE_FILENAME.
- * For further details see generic_WMOPS_output() function.
- * Attention, the ordering in this table must be kept in synchronisation
- * with the structure definition BASIC_OP.
- */
-char *BasicOperationList[] = {
- "add", "sub", "abs_s", "shl", "shr",
- "extract_h", "extract_l", "mult", "L_mult", "negate",
- "round", "L_mac", "L_msu", "L_macNs", "L_msuNs",
- "L_add", "L_sub", "L_add_c", "L_sub_c", "L_negate",
- "L_shl", "L_shr", "mult_r", "shr_r", "mac_r",
-
- "msu_r", "L_deposit_h", "L_deposit_l", "L_shr_r", "L_abs",
- "L_sat", "norm_s", "div_s", "norm_l", "move16",
- "move32", "Logic16", "Logic32", "Test", "s_max",
- "s_min", "L_max", "L_min", "L40_max", "L40_min",
- "shl_r", "L_shl_r", "L40_shr_r", "L40_shl_r", "norm_L40",
-
- "L40_shl", "L40_shr", "L40_negate", "L40_add", "L40_sub",
- "L40_abs", "L40_mult", "L40_mac", "mac_r40",
- "L40_msu", "msu_r40", "Mpy_32_16_ss", "Mpy_32_32_ss", "L_mult0",
- "L_mac0", "L_msu0", "lshl", "lshr", "L_lshl",
- "L_lshr", "L40_lshl", "L40_lshr", "s_and", "s_or",
-
- "s_xor", "L_and", "L_or", "L_xor", "rotl",
- "rotr", "L_rotl", "L_rotr", "L40_set", "L40_deposit_h",
- "L40_deposit_l", "L40_deposit32", "Extract40_H", "Extract40_L", "L_Extract40",
- "L40_round", "L_saturate40", "round40", "IF", "GOTO",
- "BREAK", "SWITCH", "FOR", "WHILE", "CONTINUE",
-
- "L_mls", "div_l", "i_mult"
-
-/* New complex basops */
-#ifdef COMPLEX_OPERATOR
- ,
- "CL_shr", "CL_shl", "CL_add", "CL_sub", "CL_scale", "CL_dscale", "CL_msu_j", "CL_mac_j", "CL_move", "CL_Extract_real", "CL_Extract_imag", "CL_form", "CL_multr_32x16", "CL_negate", "CL_conjugate", "CL_mul_j", "CL_swap_real_imag", "C_add", "C_sub", "C_mul_j", "C_multr", "C_form"
-
- ,
- "C_scale", "CL_round32_16", "CL_scale_32", "CL_dscale_32", "CL_multr_32x32", "C_mac_r", "C_msu_r", "C_Extract_real", "C_Extract_imag", "C_negate", "C_conjugate", "C_shr", "C_shl"
-
-#endif /* #ifdef COMPLEX_OPERATOR */
-
-/* New 64 bit basops */
-#ifdef ENH_64_BIT_OPERATOR
- ,
- "move64", "W_add_nosat", "W_sub_nosat", "W_shl", "W_shr", "W_shl_nosat", "W_shr_nosat", "W_mac_32_16", "W_msu_32_16", "W_mult_32_16", "W_mult0_16_16", "W_mac0_16_16", "W_msu0_16_16", "W_mult_16_16", "W_mac_16_16", "W_msu_16_16", "W_shl_sat_l", "W_sat_l", "W_sat_m", "W_deposit32_l", "W_deposit32_h", "W_extract_l", "W_extract_h", "W_round48_L", "W_round32_s", "W_norm", "W_add", "W_sub", "W_neg", "W_abs", "W_mult_32_32", "W_mult0_32_32", "W_lshl", "W_lshr", "W_round64_L"
-
-#endif /* #ifdef ENH_64_BIT_OPERATOR */
-
-#ifdef ENH_32_BIT_OPERATOR
- ,
- "Mpy_32_16_1", "Mpy_32_16_r", "Mpy_32_32", "Mpy_32_32_r", "Madd_32_16", "Madd_32_16_r", "Msub_32_16", "Msub_32_16_r", "Madd_32_32", "Madd_32_32_r", "Msub_32_32", "Msub_32_32_r"
-#endif /* #ifdef ENH_32_BIT_OPERATOR */
-
-#ifdef ENH_U_32_BIT_OPERATOR
- ,
- "UL_addNs", "UL_subNs", "UL_Mpy_32_32", "Mpy_32_32_uu", "Mpy_32_16_uu", "norm_ul_float", "UL_deposit_l"
-#endif /* #ifdef ENH_U_32_BIT_OPERATOR */
-
-#ifdef CONTROL_CODE_OPS
- ,
- "LT_16", "GT_16", "LE_16", "GE_16", "EQ_16", "NE_16", "LT_32", "GT_32", "LE_32", "GE_32", "EQ_32", "NE_32", "LT_64", "GT_64", "LE_64", "GE_64", "EQ_64", "NE_64"
-#endif /* #ifdef CONTROL_CODE_OPS */
-
-};
-
-
-const 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 */
-};
-#endif /* ifdef WMOPS */
-
-
-Word32 TotalWeightedOperation( void );
-Word32 DeltaWeightedOperation( void );
-
-
-#ifdef WMOPS
-/* Counters for separating counting for different objects */
-
-/* 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.
-*/
-
-static int maxCounter = 0;
-static char *objectName[MAXCOUNTERS + 1];
-
-static Word16 fwc_corr[MAXCOUNTERS + 1];
-static long int nbTimeObjectIsCalled[MAXCOUNTERS + 1];
-
-
-#define NbFuncMax ( 4096 )
-
-
-/**
- funcid: current function call for each counter
- bc : best case for each counter and function call
- wc : worst case for each counter and function call
- nbframe: number of frames for each counter.
- glob_bc: global best case self time for each counter for current frame.
- glob_wc: global worst case self time for each counter for current frame.
- glob_sum_curr: global cummulative time for each counter for current frame.
- glob_sum_bc: global best case cummulative time for each counter for current frame.
- glob_sum_wc: global worst case cummulative time for each counter for current frame.
-
- total_wmops: total wmops self time for each counter for current frame.
- total_sum: total wmops cummulative time for each counter for current frame.
- LastWOper: values used for WMOPS deltas
- */
-
-static Word32 funcid[MAXCOUNTERS], nbframe[MAXCOUNTERS], nbcalls[MAXCOUNTERS];
-static Word32 glob_bc[MAXCOUNTERS], glob_wc[MAXCOUNTERS], bc[MAXCOUNTERS][NbFuncMax], wc[MAXCOUNTERS][NbFuncMax];
-static float total_wmops[MAXCOUNTERS];
-static Word32 LastWOper[MAXCOUNTERS];
-/* FROM_EVS_DEV */
-static float total_sum[MAXCOUNTERS];
-static Word16 call_tree[MAXCOUNTERS][MAXCOUNTERS];
-static int sum_curr[MAXCOUNTERS + 1];
-static int sum_bc[MAXCOUNTERS + 1];
-static int sum_wc[MAXCOUNTERS + 1];
-static int glob_sum_curr[MAXCOUNTERS + 1];
-static int glob_sum_bc[MAXCOUNTERS + 1];
-static int glob_sum_wc[MAXCOUNTERS + 1];
-#if MAX_CALLERS_SAVED_FRAMES
-#define MAX_CALLERS_PRINT 20
-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 /* ifdef WMOPS */
-
-
-#ifdef WMOPS
-static char *my_strdup( const char *s )
-{
- /*
- * duplicates UNIX function strdup() which is not ANSI standard:
- * -- malloc() memory area big enough to hold the string s
- * -- copy string into new area
- * -- return pointer to new area
- *
- * returns NULL if either s==NULL or malloc() fails
- */
- char *dup;
-
- if ( s == NULL )
- return NULL;
-
- /* allocate memory for copy of ID string (including string terminator) */
- /* NOTE: the ID strings will never be deallocated because there is no way to "destroy" a counter that is not longer needed */
- if ( ( dup = (char *) malloc( strlen( s ) + 1 ) ) == NULL )
- return NULL;
-
- return strcpy( dup, s );
-}
-#endif /* ifdef WMOPS */
-
-
-int getCounterId( const char *objectNameArg )
-{
-#ifdef WMOPS
- if ( maxCounter >= MAXCOUNTERS - 1 )
- return 0;
- objectName[++maxCounter] = my_strdup( objectNameArg );
- return maxCounter;
-
-#else /* ifdef WMOPS */
- (void) objectNameArg;
- return 0; /* Dummy */
-
-#endif /* ifdef WMOPS */
-}
-
-
-#ifdef WMOPS
-int readCounterId()
-{
- return currCounter;
-}
-#endif /* ifdef WMOPS */
-
-
-#ifdef WMOPS
-char *readCounterIdName()
-{
- return objectName[currCounter];
-}
-#endif /* ifdef WMOPS */
-
-void setCounter( int counterId )
-{
-#ifdef WMOPS
- if ( ( counterId > maxCounter ) || ( counterId < 0 ) )
- {
- currCounter = 0;
- return;
- }
- currCounter = counterId;
-#ifndef FIX_1054_IF_ELSE_CMPLX
- call_occurred = 1;
-#endif
-#else
- (void) counterId;
-#endif /* ifdef WMOPS */
-}
-
-
-void incrementNbTimeObjectIsCalled( int counterId )
-{
-#ifdef WMOPS
- if ( ( counterId > maxCounter ) || ( counterId < 0 ) )
- {
- nbTimeObjectIsCalled[0]++;
- return;
- }
- nbTimeObjectIsCalled[counterId]++;
-#else
- (void) counterId;
-#endif /* ifdef WMOPS */
-}
-
-
-#ifdef WMOPS
-static Word32 WMOPS_frameStat( void )
-{
- /* calculate the WMOPS seen so far and update the global
- per-frame maximum (glob_wc)
- */
- Word32 tot;
-
- tot = TotalWeightedOperation();
- if ( tot > glob_wc[currCounter] )
- {
- glob_wc[currCounter] = tot;
- }
-
- if ( tot < glob_bc[currCounter] )
- {
- glob_bc[currCounter] = tot;
- }
- /* check if fwc() was forgotten at end of last frame */
- if ( tot > LastWOper[currCounter] )
- {
- if ( !fwc_corr[currCounter] )
- {
- fprintf( stderr,
- "count: operations counted after last fwc() for '%s'; "
- "-> fwc() called\n",
- objectName[currCounter] ? objectName[currCounter] : "" );
- }
- fwc();
- }
-
- return tot;
-}
-#endif /* ifdef WMOPS */
-
-
-#ifdef WMOPS
-static void WMOPS_clearMultiCounter( void )
-{
- Word16 i;
-
- Word32 *ptr = (Word32 *) &multiCounter[currCounter];
- for ( i = 0; i < (Word16) ( sizeof( multiCounter[currCounter] ) / sizeof( Word32 ) ); i++ )
- {
- *ptr++ = 0;
- }
-}
-#endif /* ifdef WMOPS */
-
-
-void ClearNbTimeObjectsAreCalled()
-{
-#ifdef WMOPS
- Word16 i;
-
- for ( i = 0; i < (Word16) ( sizeof( multiCounter[currCounter] ) / sizeof( Word32 ) ); i++ )
- {
- nbTimeObjectIsCalled[i] = 0;
- }
-#endif /* ifdef WMOPS */
-}
-
-Word32 TotalWeightedOperation()
-{
-#ifdef WMOPS
- Word16 i;
- Word32 tot, *ptr;
- const Word32 *ptr2;
-
- tot = 0;
- ptr = (Word32 *) &multiCounter[currCounter];
- ptr2 = (const Word32 *) &op_weight;
- for ( i = 0; i < (Word16) ( sizeof( multiCounter[currCounter] ) / sizeof( Word32 ) ); i++ )
- {
- tot += ( ( *ptr++ ) * ( *ptr2++ ) );
- }
-
- return ( (Word32) tot );
-
-#else /* ifdef WMOPS */
- return 0; /* Dummy */
-
-#endif /* ifdef WMOPS */
-}
-
-Word32 DeltaWeightedOperation()
-{
-#ifdef WMOPS
- Word32 NewWOper, delta;
-
- NewWOper = TotalWeightedOperation();
- delta = NewWOper - LastWOper[currCounter];
- LastWOper[currCounter] = NewWOper;
- return ( delta );
-
-#else /* ifdef WMOPS */
- return 0; /* Dummy */
-
-#endif /* ifdef WMOPS */
-}
-
-
-void Init_WMOPS_counter( void )
-{
-#ifdef WMOPS
- Word16 i;
-
- /* reset function weight operation counter variable */
-
- for ( i = 0; i < NbFuncMax; i++ )
- wc[currCounter][i] = (Word32) 0;
- glob_wc[currCounter] = 0;
- nbframe[currCounter] = 0;
- total_wmops[currCounter] = 0.0;
- for ( i = 0; i < NbFuncMax; i++ )
- {
- bc[currCounter][i] = (Word32) MAX_32;
- }
- glob_bc[currCounter] = MAX_32;
- nbcalls[currCounter] = 0;
- total_sum[currCounter] = 0.0;
-
- /* initially clear all counters */
- WMOPS_clearMultiCounter();
- LastWOper[currCounter] = 0;
- funcid[currCounter] = 0;
-
-#ifndef FIX_1054_IF_ELSE_CMPLX
- /* Following line is useful for incrIf(), see control.h */
- call_occurred = 1;
- funcId_where_last_call_to_else_occurred = MAXCOUNTERS;
-#endif
-
- sum_bc[currCounter] = MAX_32;
- sum_wc[currCounter] = 0;
- sum_curr[currCounter] = 0;
- for ( i = 0; i < MAXCOUNTERS; i++ )
- {
- call_tree[currCounter][i] = -1;
- }
-
- glob_sum_curr[currCounter] = 0;
- glob_sum_wc[currCounter] = 0;
- glob_sum_bc[currCounter] = MAX_32;
-
-#endif /* ifdef WMOPS */
-}
-
-
-Word32 Reset_WMOPS_counter( void )
-{
-#ifdef WMOPS
- Word32 tot = WMOPS_frameStat();
-
- /* increase the frame counter --> a frame is counted WHEN IT BEGINS */
- nbframe[currCounter]++;
- /* 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 );
-
- /* clear counter before new frame starts */
- WMOPS_clearMultiCounter();
- LastWOper[currCounter] = 0;
- funcid[currCounter] = 0; /* new frame, set function id to zero */
-
- glob_sum_curr[currCounter] = 0;
- sum_curr[currCounter] = 0;
- return tot;
-#else
- return 0;
-#endif /* ifdef WMOPS */
-}
-
-
-Word32 fwc( void )
-{
-/* function worst case */
-#ifdef WMOPS
- Word32 tot;
-
- tot = DeltaWeightedOperation();
- if ( tot > wc[currCounter][funcid[currCounter]] )
- wc[currCounter][funcid[currCounter]] = tot;
-
- if ( tot < bc[currCounter][funcid[currCounter]] )
- bc[currCounter][funcid[currCounter]] = tot;
-
- funcid[currCounter]++;
-
- /*make sure that BASOP_frame_update(); is put at the end of the main loop*/
- if ( funcid[currCounter] >= NbFuncMax )
- {
- printf( "to many function calls\n" );
- }
- assert( funcid[currCounter] < NbFuncMax );
- return ( tot );
-#else
- return 0;
-#endif /* ifdef WMOPS */
-}
-
-void WMOPS_output( Word16 dtx_mode )
-{
-#ifdef WMOPS
- Word16 i;
- Word32 tot, tot_wm, tot_wc;
-
- /* get operations since last reset (or init), but do not update the counters (except the glob_wc[] maximum)
- so output CAN be called in each frame without problems. The frame counter is NOT updated! */
- tot = WMOPS_frameStat();
- tot_wm = (Word32) ( total_wmops[currCounter] + ( (float) tot ) * frameRate );
-
- fprintf( stdout,
- "%10s:WMOPS=%.3f", objectName[currCounter] ? objectName[currCounter] : "",
- ( (float) tot ) * frameRate );
-
- if ( nbframe[currCounter] != 0 )
- {
- fprintf( stdout, " Average=%.3f", tot_wm / (float) nbframe[currCounter] );
- }
- fprintf( stdout, " WorstCase=%.3f", ( (float) glob_wc[currCounter] ) * frameRate );
-
- /* Worst worst case printed only when not in DTX mode */
- if ( dtx_mode == 0 )
- {
- tot_wc = 0L;
- for ( i = 0; i < funcid[currCounter]; i++ )
- tot_wc += wc[currCounter][i];
- fprintf( stdout, " WorstWC=%.3f", ( (float) tot_wc ) * frameRate );
- }
- fprintf( stdout, " (%d frames)\n", nbframe[currCounter] );
-#else
- (void) dtx_mode;
-#endif /* ifdef WMOPS */
-}
-
-void WMOPS_output_avg( Word16 dtx_mode, Word32 *tot_wm, Word32 *num_frames )
-{
-#ifdef WMOPS
- Word16 i;
- Word32 tot, tot_wc;
-
- /* get operations since last reset (or init), but do not update the counters (except the glob_wc[] maximum)
- so output CAN be called in each frame without problems. The frame counter is NOT updated! */
- tot = WMOPS_frameStat();
- *tot_wm = (Word32) ( total_wmops[currCounter] + ( (float) tot ) * frameRate );
- *num_frames = nbframe[currCounter];
-
- fprintf( stdout, "%10s:WMOPS=%.3f", objectName[currCounter] ? objectName[currCounter] : "", ( (float) tot ) * frameRate );
-
- if ( nbframe[currCounter] != 0 )
- {
- fprintf( stdout, " Average=%.3f", *tot_wm / (float) nbframe[currCounter] );
- }
- fprintf( stdout, " WorstCase=%.3f", ( (float) glob_wc[currCounter] ) * frameRate );
-
- /* Worst worst case printed only when not in DTX mode */
- if ( dtx_mode == 0 )
- {
- tot_wc = 0L;
- for ( i = 0; i < funcid[currCounter]; i++ )
- tot_wc += wc[currCounter][i];
- fprintf( stdout, " WorstWC=%.3f", ( (float) tot_wc ) * frameRate );
- }
- fprintf( stdout, " (%d frames)\n", nbframe[currCounter] );
-#else
- (void) dtx_mode;
- (void) tot_wm;
- (void) num_frames;
-#endif /* ifdef WMOPS */
-}
-
-void generic_WMOPS_output( Word16 dtx_mode, char *test_file_name )
-{
-#ifdef WMOPS
- int saved_value;
- Word16 i;
- Word32 tot, tot_wm, tot_wc, *ptr;
- const Word32 *ptr2;
- Word40 grand_total;
- FILE *WMOPS_file;
-
- saved_value = currCounter;
-
- /* Count the grand_total WMOPS so that % ratio per function group can be displayed. */
- grand_total = 0;
- for ( currCounter = 0; currCounter <= maxCounter; currCounter++ )
- {
- tot = WMOPS_frameStat();
- grand_total += tot;
- }
-
-
- if ( ( WMOPS_file = fopen( WMOPS_DATA_FILENAME, "a" ) ) != NULL )
- {
-
- printf( "opened file %s in order to print WMOPS for each function group.\n", WMOPS_DATA_FILENAME );
-
- /* Print the file header line. */
- fprintf( WMOPS_file, "Test file name\tFunction Name \tFrame\tNb Times Called\tWMOPS\t%% versus grand total" );
-
- if ( nbframe[saved_value] != 0 )
- fprintf( WMOPS_file, "\tAverage" );
-
- fprintf( WMOPS_file, "\tWorstCase" );
-
- /* Worst worst case printed only when not in DTX mode */
- if ( dtx_mode == 0 )
- fprintf( WMOPS_file, "\tWorstWC" );
-
- fprintf( WMOPS_file, "\n" );
-
- /* Print the WMOPS for each Function Group by scanning all the function groups with currCounter index. */
- for ( currCounter = 0; currCounter <= maxCounter; currCounter++ )
- {
-
- fprintf( WMOPS_file, "%s", test_file_name );
- fprintf( WMOPS_file, "\t%s", objectName[currCounter] ? objectName[currCounter] : "" );
- fprintf( WMOPS_file, "\t%d", nbframe[currCounter] );
-
- tot = WMOPS_frameStat();
- tot_wm = (Word32) ( total_wmops[currCounter] + ( (float) tot ) * frameRate );
-
- fprintf( WMOPS_file, "\t\t%ld", nbTimeObjectIsCalled[currCounter] );
- fprintf( WMOPS_file, "\t%.6f", ( (float) tot ) * frameRate );
- fprintf( WMOPS_file, "\t%.3f", ( (float) tot ) / grand_total * 100 );
-
- if ( nbframe[currCounter] != 0 )
- fprintf( WMOPS_file, "\t%.3f", tot_wm / (float) nbframe[currCounter] );
-
- fprintf( WMOPS_file, "\t%.3f", ( (float) glob_wc[currCounter] ) * frameRate );
-
- /* Worst worst case printed only when not in DTX mode */
- if ( dtx_mode == 0 )
- {
- tot_wc = 0L;
- for ( i = 0; i < funcid[currCounter]; i++ )
- tot_wc += wc[currCounter][i];
- fprintf( WMOPS_file, "\t%.3f", ( (float) tot_wc ) * frameRate );
- }
- fprintf( WMOPS_file, "\n" );
- }
-
- /* Print the file Grand Total line */
- fprintf( WMOPS_file, "%s", test_file_name );
- fprintf( WMOPS_file, "\tGrand Total" );
- fprintf( WMOPS_file, "\t%d", nbframe[saved_value] );
- fprintf( WMOPS_file, "\t\t%.6f", ( (float) grand_total ) * frameRate );
- fprintf( WMOPS_file, "\t100.000" );
- fprintf( WMOPS_file, "\n" );
- fclose( WMOPS_file );
- }
- else
- printf( "Can not open file %s for WMOPS editing\n", WMOPS_DATA_FILENAME );
-
-
- if ( ( WMOPS_file = fopen( WMOPS_TOTAL_FILENAME, "a" ) ) != NULL )
- {
- printf( "opened file %s in order to print application's total WMOPS.\n", WMOPS_TOTAL_FILENAME );
- fprintf( WMOPS_file, "%s", test_file_name );
- fprintf( WMOPS_file, "\tframe=%d", nbframe[currCounter] );
- fprintf( WMOPS_file, "\tWMOPS=%.6f", ( (float) grand_total ) * frameRate );
- fprintf( WMOPS_file, "\n" );
- fclose( WMOPS_file );
- }
- else
- printf( "Can not open file %s for WMOPS editing.\n", WMOPS_TOTAL_FILENAME );
-
-
- if ( ( WMOPS_file = fopen( CODE_PROFILE_FILENAME, "a" ) ) != NULL )
- {
-
- printf( "opened file %s in order to print basic operation distribution statistics.\n", CODE_PROFILE_FILENAME );
-
- /* Print the file header line. */
- fprintf( WMOPS_file, "Test file name\tBasic Operation Name\tframe\tWMOPS\t\t%% versus grand total\n" );
-
- /* Print the WMOPS for each Basic Operation across all the defined */
- /* Function Groups. */
- for ( i = 0; i < (Word16) ( sizeof( op_weight ) / sizeof( Word32 ) ); i++ )
- {
- fprintf( WMOPS_file, "%-16s", test_file_name );
- fprintf( WMOPS_file, "\t%s", BasicOperationList[i] );
- fprintf( WMOPS_file, "\t%d", nbframe[0] );
-
- tot = 0;
- ptr = (Word32 *) &multiCounter[0] + i;
- ptr2 = (const Word32 *) &op_weight + i;
- for ( currCounter = 0; currCounter <= maxCounter; currCounter++ )
- {
- tot += ( ( *ptr ) * ( *ptr2 ) );
- ptr += ( sizeof( op_weight ) / sizeof( Word32 ) );
- }
-
- fprintf( WMOPS_file, "\t%.6f", ( (float) tot ) * frameRate );
- fprintf( WMOPS_file, "\t%.3f", ( (float) tot ) / grand_total * 100 );
- fprintf( WMOPS_file, "\n" );
- }
-
- /* Print the file Grand Total line */
- fprintf( WMOPS_file, "%s", test_file_name );
- fprintf( WMOPS_file, "\tGrand Total" );
- fprintf( WMOPS_file, "\t%d", nbframe[saved_value] );
- fprintf( WMOPS_file, "\t%.6f", ( (float) grand_total ) * frameRate );
- fprintf( WMOPS_file, "\t100.000" );
- fprintf( WMOPS_file, "\n" );
- fclose( WMOPS_file );
- }
- else
- printf( "Can not open file %s for basic operations distribution statistic editing\n", CODE_PROFILE_FILENAME );
-
- currCounter = saved_value;
-
-#else
- (void) dtx_mode;
- (void) test_file_name;
-#endif /* ifdef WMOPS */
-}
-/* FROM_EVS_DEV */
-
-
-/* jdr 20120117: add FLC similar functions */
-void BASOP_frame_update( void )
-{
-#ifdef WMOPS
- int i, current;
-#if MAX_CALLERS_SAVED_FRAMES
- int k;
-#endif
- float total = 0.0f;
-
-#ifdef DEBUG
- {
- static int sptr_target = -2;
-
- if ( sptr_target == -2 )
- {
- sptr_target = sptr;
- }
- else
- {
- if ( sptr_target != sptr )
- {
- fprintf( stderr, "BASOP_sub_start/BASOP_sub_end imbalance detected!!!\n" );
- sptr_target = sptr;
- }
- }
- }
-#endif
-
- /* Get current counter */
- current = readCounterId();
-
- /* Update global operation counters */
- for ( i = 1; i <= maxCounter; i++ )
- {
- int j;
-
- for ( j = 0; j < (int) ( sizeof( BASIC_OP ) / sizeof( UWord32 ) ); j++ )
- {
- ( (UWord32 *) &glob_multiCounter )[j] += ( (UWord32 *) &multiCounter[i] )[j];
- }
- }
-
-#if MAX_CALLERS_SAVED_FRAMES
- /* Reset all counters */
- for ( i = 1; i <= maxCounter; i++ )
- {
- callers_frames[0][i] = 0.0f;
- }
-#endif
- /* Reset all counters */
- for ( i = 1; i <= maxCounter; i++ )
- {
- if ( current != i && funcid[i] > 0 )
- {
- setCounter( i );
-
- glob_sum_curr[currCounter] += sum_curr[currCounter];
-
- if ( glob_sum_curr[currCounter] > glob_sum_wc[currCounter] )
- {
- glob_sum_wc[currCounter] = glob_sum_curr[currCounter];
- }
- if ( glob_sum_curr[currCounter] < glob_sum_bc[currCounter] )
- {
- glob_sum_bc[currCounter] = glob_sum_curr[currCounter];
- }
-#if MAX_CALLERS_SAVED_FRAMES
- /* Keep a Copy before it is Reset */
- callers_frames[0][currCounter] = (float) Reset_WMOPS_counter();
- total += callers_frames[0][currCounter];
-#else
- total += (float) Reset_WMOPS_counter();
-#endif
- }
- }
-
-#if MAX_CALLERS_SAVED_FRAMES
- /* Keep Callers for this Worst Case Frame */
- /* Select Slot to Use (Slot 0 is the Current) */
- k = 0;
- for ( i = k + 1; i < MAX_CALLERS_SAVED_FRAMES; i++ )
- {
- /* Is it the Min? */
- if ( callers_totals[i] < callers_totals[k] )
- { /* Yes */
- k = i;
- }
- }
- /* Current Greater than the Min? */
- if ( total > callers_totals[k] )
- {
- k += 1;
- /* Save Info of Callers */
- for ( i = 1; i <= maxCounter; i++ )
- {
- callers_frames[k][i] = callers_frames[0][i];
- }
- if ( i < MAXCOUNTERS )
- callers_frames[k][i] = -1;
- /* Save Total */
- callers_totals[k - 1] = total;
- /* Save Frame Number */
- callers_frames_nos[k - 1] = nbframe[0];
- }
-#endif
- if ( total < glob_bc[0] )
- {
- glob_bc[0] = (Word32) total;
- }
- if ( total > glob_wc[0] )
- {
- glob_wc[0] = (Word32) total;
- }
- /* Restore current counter */
- setCounter( current );
-
- nbframe[0]++;
-#endif /* if WMOPS */
-}
-
-void printStack( char *text, char *Id )
-{
-#ifdef WMOPS
- int i;
- if ( !Id )
- return;
- if ( !strcmp( "*", Id ) || ( !strcmp( Id, objectName[currCounter] ) ) )
- {
- printf( "%s %s", text, objectName[currCounter] );
- for ( i = sptr - 1; i > 0; i-- )
- {
- printf( " <- %s", objectName[stack[i]] );
- }
- printf( "\n" );
- }
-#else
- printf( "%s %s\n", text, Id ? Id : "(no name)" );
-#endif
-}
-
-#ifdef WMOPS
-void BASOP_push_wmops( const char *label )
-{
- int new_flag, prev_counter;
- int i, j;
-
- /* Check if new counter label */
- new_flag = 1;
- for ( i = 1; i <= maxCounter; i++ )
- {
- if ( strcmp( objectName[i], label ) == 0 )
- {
- new_flag = 0;
- break;
- }
- }
-
- prev_counter = readCounterId();
-
- /* Configure new record */
- if ( new_flag )
- {
- i = (int) getCounterId( label );
- setCounter( i );
- Init_WMOPS_counter();
- }
- else
- {
- setCounter( i );
- }
-
-
- /* Push current context onto stack */
- if ( currCounter >= 0 )
- {
- if ( sptr >= MAX_STACK )
- {
- fprintf( stderr, "\r push_wmops(): stack exceeded, try inreasing MAX_STACK\n" );
- exit( -1 );
- }
- stack[sptr++] = prev_counter;
-
- /* Reset accumulated WMOPS */
- sum_stack[sptr] = 0;
-
- /* update call tree */
- for ( j = 0; j < MAXCOUNTERS; j++ )
- {
- if ( call_tree[i][j] == prev_counter )
- {
- break;
- }
- else if ( call_tree[i][j] == -1 )
- {
- call_tree[i][j] = (Word16) prev_counter;
- break;
- }
- }
- }
-
- /*wmops[currCounter].start_selfcnt = ops_cnt;
- wmops[currCounter].start_cnt = ops_cnt;
- nbTimeObjectIsCalled[currCounter]++;*/
-
- incrementNbTimeObjectIsCalled( currCounter );
-
- sum_curr[currCounter] = 0;
-
-#ifdef DEBUG_COUNTER
- printf( "Entering: %s\n", readCounterIdName() );
-#endif
-}
-#endif
-
-Word32 BASOP_pop_wmops( void )
-{
-#ifdef WMOPS
- Word32 ops_cnt;
-
-#ifdef DEBUG_COUNTER
- printf( "Exiting: %s\n", readCounterIdName() );
-#endif
-
- ops_cnt = fwc();
-
- /* Get back previous context from stack */
- if ( sptr > 0 )
- {
- int prevCounter;
-
- sum_stack[sptr] += ops_cnt;
- prevCounter = currCounter;
- setCounter( stack[--sptr] );
- sum_stack[sptr] += sum_stack[sptr + 1];
- sum_curr[prevCounter] += sum_stack[sptr + 1];
- }
- else
- {
- /* current_record = -1; */
- setCounter( 0 );
- }
-
- if ( sum_curr[currCounter] > sum_wc[currCounter] )
- {
- sum_wc[currCounter] = sum_curr[currCounter];
- }
- if ( sum_curr[currCounter] < sum_bc[currCounter] )
- {
- sum_bc[currCounter] = sum_curr[currCounter];
- }
-
- return ops_cnt;
-#else /* if WMOPS */
- return 0;
-#endif /* if WMOPS */
-}
-
-Word32 BASOP_get_wops( void )
-{
- return BASOP_pop_wmops();
-}
-
-
-void WMOPS_destroy( void )
-{
-#ifdef WMOPS
- int i;
-
- /* release the memory allocated for the objectName array */
- for ( i = 0; i < MAXCOUNTERS + 1; i++ )
- {
- if ( NULL != objectName[i] )
- {
- free( objectName[i] );
- objectName[i] = NULL;
- }
- }
-
- maxCounter = 0;
-#endif
-
- return;
-}
-
-
-void WMOPS_output_all( Word16 dtx_mode )
-{
-#ifdef WMOPS
- float ops_cnt = 0.0f;
- int i;
-
- char *sfmts = "%-40s %8s %8s %7s %7s\n";
- char *dfmts = "%-40s %8.2f %8.3f %7.3f %7.3f\n";
- char *sfmt = "%-40s %8s %8s %7s %7s %7s %7s %7s\n";
- char *dfmt = "%-40s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
-
- /*fprintf (stderr, "\nInstruction Type Analysis (for worst case frame):\n\n");*/
- fprintf( stderr, "\nInstruction Type Analysis (for worst case frame number %ld):\n\n", (long int) nbframe[0] ); /* added -- JPA */
- for ( i = 0; i < (int) ( sizeof( BasicOperationList ) / sizeof( char * ) ); i++ )
- {
- if ( ( (UWord32 *) &glob_multiCounter )[i] > 0 )
- fprintf( stderr, "\t%16s: %12d\n", BasicOperationList[i], ( (UWord32 *) &glob_multiCounter )[i] );
- }
-
- fprintf( stderr, "\n\nWeighted MOPS Analysis:\n" );
- fprintf( stderr, "%74s %23s\n", "|------ SELF ------|", "|--- CUMULATIVE ---|" );
- fprintf( stderr, sfmt, " routine", " calls", " min ", " max ", " avg ", " min ", " max ", " avg " );
- fprintf( stderr, sfmt, " ------------------------", " ------", "------", "------", "------", "------", "------", "------" );
- for ( i = 1; i <= maxCounter; i++ )
- {
- if ( nbcalls[i] > 0 )
- {
- fprintf( stderr, dfmt,
- objectName[i],
- ( nbframe[i] == 0 ) ? 0 : (float) nbcalls[i] / (float) nbframe[0],
- ( glob_bc[i] == 0 ) ? 0 : frameRate * (float) glob_bc[i],
- ( glob_wc[i] == 0 ) ? 0 : frameRate * (float) glob_wc[i],
- ( nbframe[i] == 0 ) ? 0 : (float) total_wmops[i] / (float) nbframe[i],
- frameRate * ( glob_sum_bc[i] ),
- frameRate * ( glob_sum_wc[i] ),
- ( nbframe[i] == 0 ) ? 0 : (float) ( total_sum[i] / (float) nbframe[i] ) );
- /* frameRate*(glob_bc[i]+wmops_children_bc[i]), */
- /* frameRate*(glob_wc[i]+wmops_children_wc[i]), */
- /* (nbframe[i] == 0) ? 0 : (float)((total_wmops[i] + total_wmops_children[i]) /(float)nbframe[i])); */
- }
- ops_cnt += total_wmops[i];
- }
-
- fprintf( stderr, sfmts, " -----------------", " ------", "------", "------", "------" );
- if ( nbframe[i] > 0 )
- {
- fprintf( stderr, dfmts,
- "total",
- (double) nbframe[0],
- frameRate * glob_bc[0],
- frameRate * glob_wc[0],
- ( nbframe[0] == 0 ) ? 0 : ops_cnt / nbframe[0] );
- }
-#if 0
- {
- char *sfmtt = "%20s %4s %15s\n";
- char *dfmtt = "%20s %4d ";
-
- fprintf (stderr, "\nCall Tree:\n\n");
- fprintf (stderr, sfmtt, " function", "num", "called by: ");
- fprintf (stderr, sfmtt, "---------------", "---", "--------------");
-
- for (i = 1; i <= maxCounter; i++)
- {
- int j;
-
- fprintf (stderr, dfmtt, objectName[i], i);
- for (j = 0; call_tree[i][j] != -1; j++)
- {
- if (j != 0)
- {
- fprintf (stderr, ", ");
- }
- fprintf (stderr, "%s", objectName[call_tree[i][j]]);
- }
- fprintf (stderr, "\n");
-
- }
- fprintf (stderr, sfmtt, "---------------", "---", "--------------");
- fprintf (stderr, "\n\n");
- }
-#endif
-
-#if 0
- fprintf (stderr, "\n\n");
- for (i=1; i<=maxCounter; i++)
- {
- setCounter(i);
- WMOPS_output(dtx_mode);
- }
-#else
- (void) dtx_mode;
-#endif
-
-#if MAX_CALLERS_SAVED_FRAMES
- for ( i = 1; i <= MAX_CALLERS_SAVED_FRAMES; i++ )
- {
- int j, k, l, m;
- const char *frame_rank[] = { "st", "nd", "rd", "th" };
- float current;
-
- k = 0;
- for ( j = k + 1; j < MAX_CALLERS_SAVED_FRAMES; j++ )
- {
- /* Is it the Max? */
- if ( callers_totals[j] > callers_totals[k] )
- { /* Yes */
- k = j;
- }
- }
- k += 1;
-
- fprintf( stderr, "\nActive Callers Report for %i%s Worst Case Frame #: %i\n",
- i, i <= 3 ? frame_rank[i - 1] : frame_rank[3],
- callers_frames_nos[k - 1] );
- /* Print up to 'MAX_CALLERS_PRINT' Callers */
- current = 0.0f;
- for ( l = 0; l < MAX_CALLERS_PRINT; l++ )
- {
- /* Find Highest Complexity */
- m = 1;
- for ( j = m + 1; j <= maxCounter; j++ )
- {
- if ( callers_frames[k][j] < 0 )
- break;
- if ( callers_frames[k][j] > callers_frames[k][m] )
- m = j;
- }
- /* Done ? */
- if ( callers_frames[k][m] == 0 )
- break;
- fprintf( stderr, " %-52s %10.3f\n", objectName[m], callers_frames[k][m] * frameRate );
- /* Count it */
- current += callers_frames[k][m];
- /* Mark as Done */
- callers_frames[k][m] = 0.0f;
- }
- /* Check if All Printed */
- if ( current + 0.001f < callers_totals[k - 1] )
- {
- fprintf( stderr, " Only first %i Callers have been Printed!\n", MAX_CALLERS_PRINT );
- fprintf( stderr, " %-52s %10.3f\n", "Total for non Printed", ( callers_totals[k - 1] - current ) * frameRate );
- }
- fprintf( stderr, " %-52s %10.3f\n", "Total", callers_totals[k - 1] * frameRate );
- /* Mark as Done */
- callers_totals[k - 1] = 0.0f;
- }
-#endif
- WMOPS_destroy();
-#else
- UNUSED_PARAM( dtx_mode );
-#endif /* if WMOPS */
-}
-void WMOPS_output_all_std( Word16 dtx_mode )
-{
-#ifdef WMOPS
- float ops_cnt = 0.0f;
- int i;
-
- char *sfmts = "%-40s %8s %8s %7s %7s\n";
- char *dfmts = "%-40s %8.2f %8.3f %7.3f %7.3f\n";
- char *sfmt = "%-40s %8s %8s %7s %7s %7s %7s %7s\n";
- char *dfmt = "%-40s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
-
- /*fprintf (stdout, "\nInstruction Type Analysis (for worst case frame):\n\n");*/
- fprintf( stdout, "\nInstruction Type Analysis (for worst case frame number %ld):\n\n", (long int) nbframe[0] ); /* added -- JPA */
- if ( nbframe[0] > 0 )
- {
- for ( i = 0; i < (int) ( sizeof( BasicOperationList ) / sizeof( char * ) ); i++ )
- {
- if ( ( (UWord32 *) &glob_multiCounter )[i] > 0 )
- fprintf( stdout, "\t%16s: %12d\n", BasicOperationList[i], ( (UWord32 *) &glob_multiCounter )[i] );
- }
- }
- fprintf( stdout, "\n\nWeighted MOPS Analysis:\n" );
- fprintf( stdout, "%74s %23s\n", "|------ SELF ------|", "|--- CUMULATIVE ---|" );
- fprintf( stdout, sfmt, " routine", "calls/fr", " min ", " max ", " avg ", " min ", " max ", " avg " );
- fprintf( stdout, sfmt, " ------------------------", " ------", "------", "------", "------", "------", "------", "------" );
- for ( i = 1; i <= maxCounter; i++ )
- {
- fprintf( stdout, dfmt,
- objectName[i],
- ( nbframe[i] == 0 ) ? 0 : (float) nbcalls[i] / (float) nbframe[0],
- ( glob_bc[i] == MAX_32 ) ? 0 : frameRate * (float) glob_bc[i],
- ( glob_wc[i] == 0 ) ? 0 : frameRate * (float) glob_wc[i],
- ( nbframe[i] == 0 ) ? 0 : (float) total_wmops[i] / (float) nbframe[i],
- frameRate * ( glob_sum_bc[i] ),
- frameRate * ( glob_sum_wc[i] ),
- ( nbframe[i] == 0 ) ? 0 : (float) ( ( total_sum[i] ) / (float) nbframe[i] ) );
- /* frameRate*(glob_bc[i]+wmops_children_bc[i]), */
- /* frameRate*(glob_wc[i]+wmops_children_wc[i]), */
- /* (nbframe[i] == 0) ? 0 : (float)((total_sum[i]) /(float)nbframe[i])); */
- ops_cnt += total_wmops[i];
- }
-
- fprintf( stdout, sfmts, " -----------------", " ------", "------", "------", "------" );
- if ( nbframe[0] > 0 )
- {
- fprintf( stdout, dfmts,
- "total",
- (double) nbframe[0],
- frameRate * glob_bc[0],
- frameRate * glob_wc[0],
- ( nbframe[0] == 0 ) ? 0 : ops_cnt / nbframe[0] );
- }
-#if 0
- {
- char *sfmtt = "%20s %4s %15s\n";
- char *dfmtt = "%20s %4d ";
-
- fprintf (stdout, "\nCall Tree:\n\n");
- fprintf (stdout, sfmtt, " function", "num", "called by: ");
- fprintf (stdout, sfmtt, "---------------", "---", "--------------");
-
- for (i = 1; i <= maxCounter; i++)
- {
- int j;
-
- fprintf (stdout, dfmtt, objectName[i], i);
- for (j = 0; call_tree[i][j] != -1; j++)
- {
- if (j != 0)
- {
- fprintf (stdout, ", ");
- }
- fprintf (stdout, "%s", objectName[call_tree[i][j]]);
- }
- fprintf (stdout, "\n");
-
- }
- fprintf (stdout, sfmtt, "---------------", "---", "--------------");
- fprintf (stdout, "\n\n");
- }
-#endif
-
-#if 0
- fprintf (stdout, "\n\n");
- for (i=1; i<=maxCounter; i++)
- {
- setCounter(i);
- WMOPS_output(dtx_mode);
- }
-#else
- (void) dtx_mode;
-#endif
-
-
- WMOPS_destroy();
-
-#else
- UNUSED_PARAM( dtx_mode );
-#endif /* if WMOPS */
-}
-
-
-void Reset_all_WMOPS_counter( void )
-{
-#ifdef WMOPS
- int i;
- int currCounterSave;
-
- currCounterSave = currCounter;
-
- for ( i = 2; i <= maxCounter; i++ )
- {
- setCounter( i );
- Init_WMOPS_counter();
- objectName[i] = 0;
- }
-
- currCounter = currCounterSave;
- maxCounter = 1;
-#endif /* if WMOPS */
-}
-
-/* Returns the total min/max/avg WMOPS values like printed in BASOP_end(). */
-void BASOP_get_total_wmops( double *min, double *max, double *avg )
-{
-#ifdef WMOPS
- if ( min != NULL )
- *min = frameRate * glob_bc[0];
- if ( max != NULL )
- *max = frameRate * glob_wc[0];
- if ( avg != NULL )
- {
- int i;
- double ops_cnt = 0;
- for ( i = 1; i <= maxCounter; i++ )
- ops_cnt += total_wmops[i];
- *avg = ( nbframe[0] == 0 ) ? 0 : ops_cnt / nbframe[0];
- }
-#else
- UNUSED_PARAM( min );
- UNUSED_PARAM( max );
- UNUSED_PARAM( avg );
-#endif /* if WMOPS */
-}
-/* end of file */
-#undef WMC_TOOL_SKIP
diff --git a/lib_com/count.h b/lib_com/count.h
deleted file mode 100644
index 03eb7034b82aecb5a722de72f981040f7689be9a..0000000000000000000000000000000000000000
--- a/lib_com/count.h
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- ===========================================================================
- File: COUNT.H v.2.3 - 30.Nov.2009
- ===========================================================================
-
- ITU-T STL BASIC OPERATORS
-
- PROTOTYPES & DEFINITION FOR COUNTING OPERATIONS
-
- History
- 09.Aug.1999 V1.0.0 Input to UGST from ETSI AMR (count.h);
-
- 26.Jan.2000 V1.1.0 Added counter entries for G.723.1's
- L_mls(), div_l(), i_mult() [from basop32.c]
-
- 05.Jul.2000 V1.2.0 Added counter entries for 32bit shiftless
- operators L_mult0(), L_mac0(), L_msu0()
-
- 03 Nov 04 v2.0 Incorporation of new 32-bit / 40-bit / control
- operators for the ITU-T Standard Tool Library as
- described in Geneva, 20-30 January 2004 WP 3/16 Q10/16
- TD 11 document and subsequent discussions on the
- wp3audio@yahoogroups.com email reflector.
- March 06 v2.1 Changed to improve portability.
- Dec 06 v2.2 Changed to specify frame rate using setFrameRate()
- Adding WMOPS_output_avg() for global average computation
- L_mls() weight of 5.
- div_l() weight of 32.
- i_mult() weight of 3.
- ============================================================================
-*/
-
-
-/******************************************************************************
- * Functions for counting operations.
- *
- * These functions make it possible to measure the wMOPS of a codec.
- *
- * All functions in this file, and in other *.h files, update a structure so
- * that it will be possible to track how many calls to add(), sub(), L_mult()
- * ... was made by the code and to estimate the wMOPS (and MIPS) for a certain
- * part of the code.
- *
- * It is also possible to measure the wMOPS separatly for different parts
- * of the codec.
- *
- * This is done by creating a counter group (getCounterId) for each part of
- * the code that one wants a seperate measure for. Before a part of the code
- * is executed a call to the "setCounter" function is needed to identify
- * which counter group to use.
- *
- * Currently there is a limit of 255 different counter groups.
- *
- * In the end of this file, there is a piece of code illustrating how the
- * functions can be used.
- *
- ******************************************************************************/
-
-
-#ifndef _COUNT_H
-#define _COUNT_H "$Id$"
-
-#include
-
-
-#define MAXCOUNTERS ( 512 )
-#define MAX_CALLERS_SAVED_FRAMES 5 /* # of Frame for which WMOPS Complexity Details will be saved, 0 = Disabled */
-
-int getCounterId( const char *objectName );
-/*
- * Create a counter group, the "objectname" will be used when printing
- * statistics for this counter group.
- *
- * Returns 0 if no more counter groups are available.
- */
-
-
-int readCounterId( void );
-/*
- * Returns the current CounterId.
- */
-
-
-void setCounter( int counterId );
-/*
- * Defines which counter group to use, default is zero.
- */
-
-
-char *readCounterIdName( void );
-/*
- * Returns the current CounterId name.
- */
-void printStack( char *text, char *Id );
-/*
- * print stack
- * text: Any text to print initially
- * Id: NULL, if no prints are wanted
- * "*", if all prints are wanted (default)
- * "pitch_ol" or any other function name
- */
-
-void incrementNbTimeObjectIsCalled( int counterId );
-/*
- * This function enables to increment by 1 a counter
- * tracking the number of times the application enters a groups of functions.
- * If the counterId is not refering to a defined function counter group, then it is
- * the default function group (0) which is impacted.
- *
- */
-
-
-void ClearNbTimeObjectsAreCalled( void );
-/*
- * This function enables to clear to 0 all the counters enabling to
- * track the number of times the application enters any groups of functions.
- */
-
-
-void Init_WMOPS_counter( void );
-/*
- * Initiates the current counter group.
- */
-
-
-Word32 Reset_WMOPS_counter( void );
-/*
- * Resets the current counter group.
- */
-
-
-void WMOPS_output( Word16 notPrintWorstWorstCase );
-/*
- * Prints the statistics to the screen, if the argument is non zero
- * the statistics for worst worst case will not be printed. This is typically
- * done for dtx 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.
- *
- */
-
-
-Word32 fwc( void );
-/*
- * worst worst case counter.
- *
- * This function calculates the worst possible case that can be reached.
- *
- * This is done by calling this function for each subpart of the calculations
- * for a frame. This function then stores the maximum wMOPS for each part.
- *
- * The WMOPS_output function add together all parts and presents the sum.
- */
-
-void setFrameRate( int samplingFreq, int frameLength );
-/*
- * This function can overwrite the value of the frameRate variable that is
- * initialized by the FRAME_RATE constant.
- */
-
-
-#define WMOPS_DATA_FILENAME "wmops_data.txt"
-/*
- * WMOPS_DATA_FILENAME is the macro defining the name of the file
- * where the Weighted Million of Operations per Second (wMOPS)
- * are appended, function group by function group.
- */
-
-
-#define CODE_PROFILE_FILENAME "code_profile.txt"
-/*
- * CODE_PROFILE_FILENAME is the macro defining the name of the file
- * where the Weighted Million of Operations per Second (WMOPS)
- * are appended, basic operation by basic operation.
- */
-
-
-#define WMOPS_TOTAL_FILENAME "wmops_total.txt"
-/*
- * WMOPS_TOTAL_FILENAME is the macro defining the name of the file
- * where the Weighted Million of Operations per Second (WMOPS)
- * are printed, globally for the application.
- */
-
-
-#define FRAME_RATE ( 0.0001F ) /* in this version frame_rate can be overwriten online by the new setFrameRate function */
-/* FRAME_RATE of 0.000025 is corresponding to 40ms frame.*/
-/* FRAME_RATE of 0.00005 is corresponding to 20ms frame.*/
-/* FRAME_RATE of 0.0001 is corresponding to 10ms frame.*/
-/*
- * FRAME_RATE is the macro defining the calling rate of the
- * application to benchmark.
- */
-
-
-/* Global counter variable for calculation of complexity weight */
-typedef struct
-{
- UWord32 add; /* Complexity Weight of 1 */
- UWord32 sub; /* Complexity Weight of 1 */
- UWord32 abs_s; /* Complexity Weight of 1 */
- UWord32 shl; /* Complexity Weight of 1 */
- UWord32 shr; /* Complexity Weight of 1 */
-
- UWord32 extract_h; /* Complexity Weight of 1 */
- UWord32 extract_l; /* Complexity Weight of 1 */
- UWord32 mult; /* Complexity Weight of 1 */
- UWord32 L_mult; /* Complexity Weight of 1 */
- UWord32 negate; /* Complexity Weight of 1 */
-
- UWord32 round; /* Complexity Weight of 1 */
- UWord32 L_mac; /* Complexity Weight of 1 */
- UWord32 L_msu; /* Complexity Weight of 1 */
- UWord32 L_macNs; /* Complexity Weight of 1 */
- UWord32 L_msuNs; /* Complexity Weight of 1 */
-
- UWord32 L_add; /* Complexity Weight of 1 */
- UWord32 L_sub; /* Complexity Weight of 1 */
- UWord32 L_add_c; /* Complexity Weight of 2 */
- UWord32 L_sub_c; /* Complexity Weight of 2 */
- UWord32 L_negate; /* Complexity Weight of 1 */
-
- UWord32 L_shl; /* Complexity Weight of 1 */
- UWord32 L_shr; /* Complexity Weight of 1 */
- UWord32 mult_r; /* Complexity Weight of 1 */
- UWord32 shr_r; /* Complexity Weight of 3 */
- UWord32 mac_r; /* Complexity Weight of 1 */
-
- UWord32 msu_r; /* Complexity Weight of 1 */
- UWord32 L_deposit_h; /* Complexity Weight of 1 */
- UWord32 L_deposit_l; /* Complexity Weight of 1 */
- UWord32 L_shr_r; /* Complexity Weight of 3 */
- UWord32 L_abs; /* Complexity Weight of 1 */
-
- UWord32 L_sat; /* Complexity Weight of 4 */
- UWord32 norm_s; /* Complexity Weight of 1 */
- UWord32 div_s; /* Complexity Weight of 18 */
- UWord32 norm_l; /* Complexity Weight of 1 */
- UWord32 move16; /* Complexity Weight of 1 */
-
- UWord32 move32; /* Complexity Weight of 2 */
- UWord32 Logic16; /* Complexity Weight of 1 */
- UWord32 Logic32; /* Complexity Weight of 2 */
- UWord32 Test; /* Complexity Weight of 2 */
- UWord32 s_max; /* Complexity Weight of 1 */
-
- UWord32 s_min; /* Complexity Weight of 1 */
- UWord32 L_max; /* Complexity Weight of 1 */
- UWord32 L_min; /* Complexity Weight of 1 */
- UWord32 L40_max; /* Complexity Weight of 1 */
- UWord32 L40_min; /* Complexity Weight of 1 */
-
- UWord32 shl_r; /* Complexity Weight of 2 */
- UWord32 L_shl_r; /* Complexity Weight of 2 */
- UWord32 L40_shr_r; /* Complexity Weight of 2 */
- UWord32 L40_shl_r; /* Complexity Weight of 2 */
- UWord32 norm_L40; /* Complexity Weight of 1 */
-
- UWord32 L40_shl; /* Complexity Weight of 1 */
- UWord32 L40_shr; /* Complexity Weight of 1 */
- UWord32 L40_negate; /* Complexity Weight of 1 */
- UWord32 L40_add; /* Complexity Weight of 1 */
- UWord32 L40_sub; /* Complexity Weight of 1 */
-
- UWord32 L40_abs; /* Complexity Weight of 1 */
- UWord32 L40_mult; /* Complexity Weight of 1 */
- UWord32 L40_mac; /* Complexity Weight of 1 */
- UWord32 mac_r40; /* Complexity Weight of 2 */
-
- UWord32 L40_msu; /* Complexity Weight of 1 */
- UWord32 msu_r40; /* Complexity Weight of 2 */
- UWord32 Mpy_32_16_ss; /* Complexity Weight of 2 */
- UWord32 Mpy_32_32_ss; /* Complexity Weight of 2 */
- UWord32 L_mult0; /* Complexity Weight of 1 */
-
- UWord32 L_mac0; /* Complexity Weight of 1 */
- UWord32 L_msu0; /* Complexity Weight of 1 */
- UWord32 lshl; /* Complexity Weight of 1 */
- UWord32 lshr; /* Complexity Weight of 1 */
- UWord32 L_lshl; /* Complexity Weight of 1 */
-
- UWord32 L_lshr; /* Complexity Weight of 1 */
- UWord32 L40_lshl; /* Complexity Weight of 1 */
- UWord32 L40_lshr; /* Complexity Weight of 1 */
- UWord32 s_and; /* Complexity Weight of 1 */
- UWord32 s_or; /* Complexity Weight of 1 */
-
- UWord32 s_xor; /* Complexity Weight of 1 */
- UWord32 L_and; /* Complexity Weight of 1 */
- UWord32 L_or; /* Complexity Weight of 1 */
- UWord32 L_xor; /* Complexity Weight of 1 */
- UWord32 rotl; /* Complexity Weight of 3 */
-
- UWord32 rotr; /* Complexity Weight of 3 */
- UWord32 L_rotl; /* Complexity Weight of 3 */
- UWord32 L_rotr; /* Complexity Weight of 3 */
- UWord32 L40_set; /* Complexity Weight of 1 */
- UWord32 L40_deposit_h; /* Complexity Weight of 1 */
-
- UWord32 L40_deposit_l; /* Complexity Weight of 1 */
- UWord32 L40_deposit32; /* Complexity Weight of 1 */
- UWord32 Extract40_H; /* Complexity Weight of 1 */
- UWord32 Extract40_L; /* Complexity Weight of 1 */
- UWord32 L_Extract40; /* Complexity Weight of 1 */
-
- UWord32 L40_round; /* Complexity Weight of 1 */
- UWord32 L_saturate40; /* Complexity Weight of 1 */
- UWord32 round40; /* Complexity Weight of 1 */
- UWord32 If; /* Complexity Weight of 3 */
- UWord32 Goto; /* Complexity Weight of 2 */
-
- UWord32 Break; /* Complexity Weight of 2 */
- UWord32 Switch; /* Complexity Weight of 6 */
- UWord32 For; /* Complexity Weight of 3 */
- UWord32 While; /* Complexity Weight of 3 */
- UWord32 Continue; /* Complexity Weight of 2 */
-
- UWord32 L_mls; /* Complexity Weight of 1 */
- UWord32 div_l; /* Complexity Weight of 32 */
- UWord32 i_mult; /* Complexity Weight of 1 */
-
-/* New complex basic operators */
-#ifdef COMPLEX_OPERATOR
- UWord32 CL_shr; /* Complexity Weight of 1 */
- UWord32 CL_shl; /* Complexity Weight of 1 */
- UWord32 CL_add; /* Complexity Weight of 1 */
- UWord32 CL_sub; /* Complexity Weight of 1 */
- UWord32 CL_scale; /* Complexity Weight of 1 */
- UWord32 CL_dscale; /* Complexity Weight of 1 */
- UWord32 CL_msu_j; /* Complexity Weight of 1 */
- UWord32 CL_mac_j; /* Complexity Weight of 1 */
- UWord32 CL_move; /* Complexity Weight of 1 */
- UWord32 CL_Extract_real; /* Complexity Weight of 1 */
- UWord32 CL_Extract_imag; /* Complexity Weight of 1 */
- UWord32 CL_form; /* Complexity Weight of 1 */
- UWord32 CL_multr_32x16; /* Complexity Weight of 2 */
- UWord32 CL_negate; /* Complexity Weight of 1 */
- UWord32 CL_conjugate; /* Complexity Weight of 1 */
- UWord32 CL_mul_j; /* Complexity Weight of 1 */
- UWord32 CL_swap_real_imag; /* Complexity Weight of 1 */
- UWord32 C_add; /* Complexity Weight of 1 */
- UWord32 C_sub; /* Complexity Weight of 1 */
- UWord32 C_mul_j; /* Complexity Weight of 1 */
- UWord32 C_multr; /* Complexity Weight of 2 */
- UWord32 C_form; /* Complexity Weight of 1 */
-
- UWord32 C_scale; /* Complexity Weight of 1 */
- UWord32 CL_round32_16; /* Complexity Weight of 1 */
- UWord32 CL_scale_32; /* Complexity Weight of 1 */
- UWord32 CL_dscale_32; /* Complexity Weight of 1 */
- UWord32 CL_multr_32x32; /* Complexity Weight of 2 */
- UWord32 C_mac_r; /* Complexity Weight of 2 */
- UWord32 C_msu_r; /* Complexity Weight of 2 */
- UWord32 C_Extract_real; /* Complexity Weight of 1 */
- UWord32 C_Extract_imag; /* Complexity Weight of 1 */
- UWord32 C_negate; /* Complexity Weight of 1 */
- UWord32 C_conjugate; /* Complexity Weight of 1 */
- UWord32 C_shr; /* Complexity Weight of 1 */
- UWord32 C_shl; /* Complexity Weight of 1 */
-
-#endif /* #ifdef COMPLEX_OPERATOR */
-
-/* New 64 bit basops */
-#ifdef ENH_64_BIT_OPERATOR
- UWord32 move64; /* Complexity Weight of 1 */
- UWord32 W_add_nosat; /* Complexity Weight of 1 */
- UWord32 W_sub_nosat; /* Complexity Weight of 1 */
- UWord32 W_shl; /* Complexity Weight of 1 */
- UWord32 W_shr; /* Complexity Weight of 1 */
- UWord32 W_shl_nosat; /* Complexity Weight of 1 */
- UWord32 W_shr_nosat; /* Complexity Weight of 1 */
- UWord32 W_mac_32_16; /* Complexity Weight of 1 */
- UWord32 W_msu_32_16; /* Complexity Weight of 1 */
- UWord32 W_mult_32_16; /* Complexity Weight of 1 */
- UWord32 W_mult0_16_16; /* Complexity Weight of 1 */
- UWord32 W_mac0_16_16; /* Complexity Weight of 1 */
- UWord32 W_msu0_16_16; /* Complexity Weight of 1 */
- UWord32 W_mult_16_16; /* Complexity Weight of 1 */
- UWord32 W_mac_16_16; /* Complexity Weight of 1 */
- UWord32 W_msu_16_16; /* Complexity Weight of 1 */
- UWord32 W_shl_sat_l; /* Complexity Weight of 1 */
- UWord32 W_sat_l; /* Complexity Weight of 1 */
- UWord32 W_sat_m; /* Complexity Weight of 1 */
- UWord32 W_deposit32_l; /* Complexity Weight of 1 */
- UWord32 W_deposit32_h; /* Complexity Weight of 1 */
- UWord32 W_extract_l; /* Complexity Weight of 1 */
- UWord32 W_extract_h; /* Complexity Weight of 1 */
- UWord32 W_round48_L; /* Complexity Weight of 1 */
- UWord32 W_round32_s; /* Complexity Weight of 1 */
- UWord32 W_norm; /* Complexity Weight of 1 */
-
- UWord32 W_add; /* Complexity Weight of 1 */
- UWord32 W_sub; /* Complexity Weight of 1 */
- UWord32 W_neg; /* Complexity Weight of 1 */
- UWord32 W_abs; /* Complexity Weight of 1 */
- UWord32 W_mult_32_32; /* Complexity Weight of 1 */
- UWord32 W_mult0_32_32; /* Complexity Weight of 1 */
- UWord32 W_lshl; /* Complexity Weight of 1 */
- UWord32 W_lshr; /* Complexity Weight of 1 */
- UWord32 W_round64_L; /* Complexity Weight of 1 */
-
-#endif /* #ifdef ENH_64_BIT_OPERATOR */
-
-#ifdef ENH_32_BIT_OPERATOR
- UWord32 Mpy_32_16_1; /* Complexity Weight of 1 */
- UWord32 Mpy_32_16_r; /* Complexity Weight of 1 */
- UWord32 Mpy_32_32; /* Complexity Weight of 1 */
- UWord32 Mpy_32_32_r; /* Complexity Weight of 1 */
- UWord32 Madd_32_16; /* Complexity Weight of 1 */
- UWord32 Madd_32_16_r; /* Complexity Weight of 1 */
- UWord32 Msub_32_16; /* Complexity Weight of 1 */
- UWord32 Msub_32_16_r; /* Complexity Weight of 1 */
- UWord32 Madd_32_32; /* Complexity Weight of 1 */
- UWord32 Madd_32_32_r; /* Complexity Weight of 1 */
- UWord32 Msub_32_32; /* Complexity Weight of 1 */
- UWord32 Msub_32_32_r; /* Complexity Weight of 1 */
-#endif /* #ifdef ENH_32_BIT_OPERATOR */
-
-#ifdef ENH_U_32_BIT_OPERATOR
- UWord32 UL_addNs; /* Complexity Weight of 1 */
- UWord32 UL_subNs; /* Complexity Weight of 1 */
- UWord32 UL_Mpy_32_32; /* Complexity Weight of 1 */
- UWord32 Mpy_32_32_uu; /* Complexity Weight of 2 */
- UWord32 Mpy_32_16_uu; /* Complexity Weight of 2 */
- UWord32 norm_ul_float; /* Complexity Weight of 1 */
- UWord32 UL_deposit_l; /* Complexity Weight of 1 */
-#endif /* #ifdef ENH_U_32_BIT_OPERATOR */
-
-#ifdef CONTROL_CODE_OPS
- UWord32 LT_16; /* Complexity Weight of 1 */
- UWord32 GT_16; /* Complexity Weight of 1 */
- UWord32 LE_16; /* Complexity Weight of 1 */
- UWord32 GE_16; /* Complexity Weight of 1 */
- UWord32 EQ_16; /* Complexity Weight of 1 */
- UWord32 NE_16; /* Complexity Weight of 1 */
- UWord32 LT_32; /* Complexity Weight of 1 */
- UWord32 GT_32; /* Complexity Weight of 1 */
- UWord32 LE_32; /* Complexity Weight of 1 */
- UWord32 GE_32; /* Complexity Weight of 1 */
- UWord32 EQ_32; /* Complexity Weight of 1 */
- UWord32 NE_32; /* Complexity Weight of 1 */
- UWord32 LT_64; /* Complexity Weight of 1 */
- UWord32 GT_64; /* Complexity Weight of 1 */
- UWord32 LE_64; /* Complexity Weight of 1 */
- UWord32 GE_64; /* Complexity Weight of 1 */
- UWord32 EQ_64; /* Complexity Weight of 1 */
- UWord32 NE_64; /* Complexity Weight of 1 */
-
-#endif /* #ifdef CONTROL_CODE_OPS */
-} BASIC_OP;
-
-
-Word32 TotalWeightedOperation( void );
-Word32 DeltaWeightedOperation( void );
-
-
-void generic_WMOPS_output( Word16 notPrintWorstWorstCase, char *test_file_name );
-/*
- * This function enable to append :
- * - to WMOPS_DATA_FILENAME file, the WMOPS information related
- * to the execution of the application, function group by function
- * group.
- * - to CODE_PROFILE_FILENAME file, the WMOPS information related
- * to the execution of the application, basic operation by basic
- * operation.
- * - to WMOPS_TOTAL_FILENAME file, the total WMOPS information related
- * to the execution of the application.
- *
- * Note that :
- * if the files exists, the data will be written at the end of file.
- *
- * test_file_name : Is a character string referencing each calls to
- * generic_WMOPS_output(). Usually, it is the name of a test
- * sequence file.
- *
- * notPrintWorstWorstCase : Same usage as in WMOPS_output().
- */
-void WMOPS_output_all( Word16 dtx_mode );
-void WMOPS_output_all_std( Word16 dtx_mode );
-
-/*
- * free all allocated counter memory
- */
-void WMOPS_destroy( void );
-
-/* jdr 20120117: add FLC similar functions */
-/* mul 20130729: set BASOP_COUNT_SUBROUTINES to count on a per-BASOP_sub_start()/BASOP_sub_end() base;
- otherwise, count only between BASOP_push_wmops(), BASOP_push_wmops() */
-#define BASOP_COUNT_SUBROUTINES
-void BASOP_push_wmops( const char *label );
-Word32 BASOP_pop_wmops( void );
-
-#define BASOP_init \
- { \
- setFrameRate( 32000, 640 ); \
- Init_WMOPS_counter(); /* 20ms frames */ \
- }
-#define BASOP_end \
- { \
- WMOPS_output_all_std( 0 ); \
- }
-/*#define BASOP_end { WMOPS_output_all(0); }*/
-#define BASOP_end_noprint \
- { \
- WMOPS_destroy(); \
- }
-
-#ifdef BASOP_COUNT_SUBROUTINES
-#define BASOP_sub_start( label ) \
- { \
- BASOP_push_wmops( label ); \
- }
-#define BASOP_sub_end() \
- { \
- BASOP_pop_wmops(); \
- }
-#else
-#define BASOP_sub_start( label )
-#define BASOP_sub_end()
-#endif
-
-void BASOP_frame_update( void );
-void Reset_all_WMOPS_counter( void );
-
-Word32 BASOP_get_wops( void );
-
-/*! Returns the total min/max/avg WMOPS values like printed in BASOP_end(). */
-void BASOP_get_total_wmops( double *min, double *max, double *avg );
-
-
-#define SUB_WMOPS_INIT( label ) BASOP_sub_start( label )
-#define END_SUB_WMOPS BASOP_sub_end()
-
-
-#endif /* _COUNT_H */
-
-
-/* end of file */
diff --git a/lib_com/enh1632.c b/lib_com/enh1632.c
index 1e6c41a0ef9ccb5b558dbb021ee700875ad16f2c..04c22ae97c40afa265e386e9fc2f3e268ef10795 100644
--- a/lib_com/enh1632.c
+++ b/lib_com/enh1632.c
@@ -58,12 +58,6 @@
#define WMC_TOOL_SKIP
-#ifdef WMOPS
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-#endif /* ifdef WMOPS */
-
-
/*****************************************************************************
*
* Constants and Globals
diff --git a/lib_com/enh1632.h b/lib_com/enh1632.h
index 1477c6c8093b3048dcf64e3fbc2b874d49dc9945..eed55ccad44963372710d7919bbb3e9f13eed012 100644
--- a/lib_com/enh1632.h
+++ b/lib_com/enh1632.h
@@ -35,14 +35,6 @@
#include "stl.h"
-
-#ifdef WMOPS
-#include "count.h"
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-#endif /* ifdef WMOPS */
-
-
/*****************************************************************************
*
* Prototypes for enhanced 16/32 bit arithmetic operators
diff --git a/lib_com/enh32.c b/lib_com/enh32.c
index d2466ce6423561dc4139627fcb0c8e1ac3bb7493..64afe89869987ec7073e0cdef0dfe2965f57926f 100644
--- a/lib_com/enh32.c
+++ b/lib_com/enh32.c
@@ -21,15 +21,10 @@
*****************************************************************************/
#include
#include
-#include "enh32.h"
+#include "stl.h"
#define WMC_TOOL_SKIP
-#ifdef WMOPS
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-#endif /* if WMOPS */
-
#ifdef ENH_32_BIT_OPERATOR
/*****************************************************************************
*
diff --git a/lib_com/enh64.c b/lib_com/enh64.c
index a5c0879c03aa148556104431b7a25a8625484236..9eb58c4d399848547a585ff714a0f212adecad7d 100644
--- a/lib_com/enh64.c
+++ b/lib_com/enh64.c
@@ -16,16 +16,10 @@
*****************************************************************************/
#include
#include
-#include "enh64.h"
+#include "stl.h"
#define WMC_TOOL_SKIP
-#ifdef WMOPS
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-#endif /* if WMOPS */
-
-
/*****************************************************************************
*
* Local Functions
diff --git a/lib_com/enhUL32.c b/lib_com/enhUL32.c
index 1fb529104902e45f3aaf110d64c3e165bd20b56a..5650821200a63bc8404fbb31286f78d2d60c27ef 100644
--- a/lib_com/enhUL32.c
+++ b/lib_com/enhUL32.c
@@ -25,16 +25,10 @@
#include
#include
#include "stl.h"
-#include "enhUL32.h"
+#include "stl.h"
#define WMC_TOOL_SKIP
-#ifdef WMOPS
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-#endif /* if WMOPS */
-
-
/*****************************************************************************
*
* Constants and Globals
diff --git a/lib_com/enhUL32.h b/lib_com/enhUL32.h
index 39a79d700d330a41545a87b301b5ae1745581495..d200342b4b24e054ba0e5b92fea5b34d3ed37718 100644
--- a/lib_com/enhUL32.h
+++ b/lib_com/enhUL32.h
@@ -24,12 +24,6 @@
#define UWord64 unsigned long long /* for local use inside UL_Mpy_32_* */
#endif
-#ifdef WMOPS
-#include "count.h"
-extern BASIC_OP multiCounter[MAXCOUNTERS]; /* existing signed counters are reused for unsigedn operators */
-extern int currCounter;
-#endif /* if WMOPS */
-
/*****************************************************************************
*
* Prototypes for enhanced unsigned 32 bit arithmetic operators
diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c
index 12bedd1fb66e9f1c04ac692d049ccc1f46e58839..c37ae1236e3e30a092fe30396e3aaca1207e1986 100644
--- a/lib_com/hq2_noise_inject_fx.c
+++ b/lib_com/hq2_noise_inject_fx.c
@@ -35,7 +35,6 @@
#include "prot_fx.h"
#include "oper_32b.h"
#include "move.h"
-#include "count.h"
/*--------------------------------------------------------------------------*
* hq2_noise_inject()
diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h
index eb529b37c50d98bec9f5aca76c181ae7871bccae..5bff71481a5c4b3a6261213d22d22b099e737e97 100644
--- a/lib_com/ivas_cnst.h
+++ b/lib_com/ivas_cnst.h
@@ -36,6 +36,7 @@
#include
#include "options.h"
#include "cnst.h"
+#include "typedef.h"
/* clang-format off */
diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c
index bfa5a7bb92e82a590ff7d93a1296ae3cc4f6d67f..78603c1db43c9d913d5cff69c6bcb7fce4d16d27 100644
--- a/lib_com/ivas_fb_mixer.c
+++ b/lib_com/ivas_fb_mixer.c
@@ -31,12 +31,13 @@
*******************************************************************************************************/
#include
-#include "options.h"
+#include
#include
+#include "options.h"
#include "prot.h"
#include "ivas_prot.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
-#include
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#include "prot_fx.h"
diff --git a/lib_com/move.h b/lib_com/move.h
index a6f5b353e8aba360d4ff04ad456f62cc960a9873..5c325fb1d5dc2d1b88edbfa6fb222e171e8928d7 100644
--- a/lib_com/move.h
+++ b/lib_com/move.h
@@ -36,13 +36,6 @@
#ifndef _MOVE_H
#define _MOVE_H
-#include "stl.h"
-/* BASOP -> FLC brigde: data move counting */
-
-#ifdef WMOPS
-extern BASIC_OP multiCounter[MAXCOUNTERS];
-extern int currCounter;
-#endif /* ifdef WMOPS */
static __inline void move16( void )
{
diff --git a/lib_com/options.h b/lib_com/options.h
index cacefdab4fdb59427afcd30a35fccb3cd3bb7165..2954fb8a461d87db48d1ba9a91ca0f4291c848b3 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -58,12 +58,17 @@
/*#define WMOPS*/ /* Activate complexity and memory counters */
#ifdef WMOPS
/*#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 ############################ */
#define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */
+#ifndef BASOP_NOGLOB_DEV_USE_GLOBALS
+#define BASOP_NOGLOB_DECLARE_LOCAL
+#endif
#define IVAS_FLOAT_FIXED
#define IVAS_FLOAT_FIXED_CONVERSIONS /* Temporary macro to keep track of intermediate flt to fixed and fixed to flt conversions */
diff --git a/lib_com/rom_com_fx.h b/lib_com/rom_com_fx.h
index 4ab4bf8195b646a8a5f12035aedbfc6d361e3201..5c30ad5da6d01b2350a609285938fef00a34e265 100644
--- a/lib_com/rom_com_fx.h
+++ b/lib_com/rom_com_fx.h
@@ -40,6 +40,9 @@
#ifndef ROM_COM_FX_H
#define ROM_COM_FX_H
+
+#include "typedef.h"
+
/*------------------------------------------------------------------------------*
* FFT transform
*------------------------------------------------------------------------------*/
diff --git a/lib_com/stl.h b/lib_com/stl.h
index 77e55b8668b86fcea757e21530eda7ea030e0e71..6643f5948d80c4a7260efbc6de80b2b20a4a1aee 100644
--- a/lib_com/stl.h
+++ b/lib_com/stl.h
@@ -57,23 +57,11 @@
#ifndef _STL_H
#define _STL_H
-#define ENH_U_32_BIT_OPERATOR
-#define COMPLEX_OPERATOR
-#define CONTROL_CODE_OPS
-#define ENH_32_BIT_OPERATOR
-#define ENH_64_BIT_OPERATOR
-#define BASOP_NOGLOB
-#if defined BASOP_NOGLOB && !defined BASOP_NOGLOB_DEV_USE_GLOBALS
-#define BASOP_NOGLOB_DECLARE_LOCAL
-#endif
-
#include "options.h" /* note: needed until BASOP_NOGLOB is accepted */
#include "typedef.h"
#include "basop32.h"
-#include "count.h"
#include "wmc_auto.h"
#include "move.h"
-#include "control.h"
#include "oper_32b.h"
#include "enh1632.h"
#include "enh40.h"
diff --git a/lib_com/vlpc_2st_com_fx.c b/lib_com/vlpc_2st_com_fx.c
index 3f06d35086b2fa85187431a9bd85ebed2f0ab3df..3fcdf144d6b599ec643c6156e59d1475175697f9 100644
--- a/lib_com/vlpc_2st_com_fx.c
+++ b/lib_com/vlpc_2st_com_fx.c
@@ -6,7 +6,6 @@
#include "options.h"
#include "cnst.h"
#include "prot_fx.h"
-#include "control.h"
#include "basop_util.h"
diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c
index 7bc7bde807706e5faf6efff00a9846e8f1e59b0d..731b01e1c14b7e8cad2fd4b922010941855b5224 100644
--- a/lib_debug/wmc_auto.c
+++ b/lib_debug/wmc_auto.c
@@ -1,5 +1,5 @@
/*
- * (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
#include
#include
+#include
#ifndef _MSC_VER
#include
@@ -29,17 +30,18 @@
#include "options.h"
#include "wmc_auto.h"
-#include "typedef.h"
-#include "count.h"
-
-
#define WMC_TOOL_SKIP /* Skip the instrumentation of this file, if invoked by accident */
+#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
*--------------------------------------------------------------------*/
+
#define MAX_FUNCTION_NAME_LENGTH 200 /* Maximum length of the function name */
#define MAX_PARAMS_LENGTH 200 /* Maximum length of the function parameter string */
#define MAX_NUM_RECORDS 300 /* Initial maximum number of records -> might be increased during runtime, if needed */
@@ -48,6 +50,9 @@
#define DOUBLE_MAX 0x80000000
#define FAC ( FRAMES_PER_SECOND / 1e6 )
+#define FRAMES_PER_SECOND 50.0
+#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
{
char label[MAX_FUNCTION_NAME_LENGTH];
@@ -73,11 +78,10 @@ typedef struct
#endif
} wmops_record;
-double ops_cnt_wmc;
-double prom_cnt_wmc;
+double ops_cnt;
double inst_cnt[NUM_INST];
-static wmops_record* wmops = NULL;
+static wmops_record *wmops = NULL;
static int num_wmops_records, max_num_wmops_records;
static int current_record;
static long update_cnt;
@@ -89,11 +93,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;
@@ -103,9 +169,9 @@ void reset_wmops( void )
max_cnt = 0.0;
min_cnt = DOUBLE_MAX;
start_cnt = 0.0;
- ops_cnt_wmc = 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 ) );
@@ -117,22 +183,20 @@ void reset_wmops( void )
exit( -1 );
}
- /* allocate the BASOP WMOPS counter */
- //if ( multiCounter == NULL )
- //{
- // multiCounter = (BASIC_OP *) malloc( max_num_wmops_records * sizeof( BASIC_OP ) );
- //}
-
- //if ( multiCounter == NULL )
- //{
- // fprintf( stderr, "Error: Unable to Allocate the BASOP WMOPS counter!" );
- // exit( -1 );
- //}
+ /* allocate the list of BASOP WMOPS records */
+ if ( multiCounter == NULL )
+ {
+ multiCounter = (BASIC_OP *) malloc( max_num_wmops_records * sizeof( BASIC_OP ) );
+ }
- BASOP_init
+ if ( multiCounter == NULL )
+ {
+ fprintf( stderr, "Error: Unable to Allocate the BASOP WMOPS counter!" );
+ exit( -1 );
+ }
/* 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" );
@@ -159,13 +223,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 */
@@ -187,12 +246,6 @@ void reset_wmops( void )
wmops_caller_stack[i] = -1;
}
-#ifndef FIX_1054_IF_ELSE_CMPLX
- /* initialize auxiliary BASOP WMOPS variables */
- //call_occurred = 1;
- //funcId_where_last_call_to_else_occurred = INT_MAX;
-#endif
-
return;
}
@@ -200,7 +253,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] = "";
@@ -225,7 +278,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 )
@@ -233,51 +286,43 @@ void push_wmops_fct( const char *label, ... )
/* There is no room for a new WMOPS record -> reallocate the list */
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 ) );
+ 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;
- 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;
+ /* 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[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 )
@@ -288,8 +333,10 @@ void push_wmops_fct( const char *label, ... )
}
wmops_caller_stack[wmops_caller_stack_index++] = current_record;
- /* accumulate op counts */
- wmops[current_record].current_selfcnt += ops_cnt_wmc - wmops[current_record].start_selfcnt;
+ /* 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 */
for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ )
@@ -306,27 +353,31 @@ 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_wmc;
- wmops[index_record].start_cnt = ops_cnt_wmc;
+ wmops[index_record].start_selfcnt = ops_cnt;
+ wmops[index_record].start_cnt = ops_cnt;
wmops[index_record].call_number++;
#ifdef WMOPS_WC_FRAME_ANALYSIS
wmops[index_record].current_call_number++;
#endif
- /* set the ID of BASOP functions counters */
- //Set_BASOP_WMOPS_counter( index_record );
-
- BASOP_push_wmops( func_name );
+ /* set the ID of the current BASOP operations counter */
+ currCounter = index_record;
return;
}
-
void pop_wmops( void )
{
- //long tot;
+ long tot;
/* Check for underflow */
if ( current_record < 0 )
@@ -336,28 +387,33 @@ void pop_wmops( void )
}
/* add the BASOP complexity to the counter */
- //tot = DeltaWeightedOperation();
- //ops_cnt_wmc += tot;
+ tot = DeltaWeightedOperation( currCounter );
+ ops_cnt += tot;
/* update count of current record */
- wmops[current_record].current_selfcnt += ops_cnt_wmc - wmops[current_record].start_selfcnt;
- wmops[current_record].current_cnt += ops_cnt_wmc - wmops[current_record].start_cnt;
+ wmops[current_record].current_selfcnt += ops_cnt - wmops[current_record].start_selfcnt;
+ wmops[current_record].current_cnt += ops_cnt - wmops[current_record].start_cnt;
/* Get back previous context from stack */
if ( wmops_caller_stack_index > 0 )
{
current_record = wmops_caller_stack[--wmops_caller_stack_index];
- wmops[current_record].start_selfcnt = ops_cnt_wmc;
-
- /* set the ID of the previous BASOP counter */
- //Set_BASOP_WMOPS_counter( current_record );
+ wmops[current_record].start_selfcnt = ops_cnt;
}
else
{
current_record = -1;
}
- BASOP_pop_wmops();
+ /* 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;
}
@@ -450,12 +506,11 @@ 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_wmc - start_cnt;
+ current_cnt = ops_cnt - start_cnt;
if ( current_cnt > max_cnt )
{
max_cnt = current_cnt;
@@ -478,192 +533,186 @@ void update_wmops( void )
inst_cnt[i] = 0.0;
}
- start_cnt = ops_cnt_wmc;
+ start_cnt = ops_cnt;
/* increment frame counter */
update_cnt++;
- BASOP_frame_update();
-
return;
}
void print_wmops( void )
{
- //int i, label_len, max_label_len;
+ int i, label_len, max_label_len;
- //char *sfmts = "%*s %8s %8s %7s %7s\n";
- //char *dfmts = "%*s %8.2f %8.3f %7.3f %7.3f\n";
- //char *sfmt = "%*s %8s %8s %7s %7s %7s %7s %7s\n";
- //char *dfmt = "%*s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
+ char *sfmts = "%*s %8s %8s %7s %7s\n";
+ char *dfmts = "%*s %8.2f %8.3f %7.3f %7.3f\n";
+ char *sfmt = "%*s %8s %8s %7s %7s %7s %7s %7s\n";
+ char *dfmt = "%*s %8.2f %8.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n";
- WMOPS_output_all_std( 0 );
- WMOPS_destroy();
- return;
+#ifdef WMOPS_WC_FRAME_ANALYSIS
+ int j;
+ char *sfmtt = "%20s %4s %15s\n";
+ char *dfmtt = "%20s %4d ";
+#endif
+
+ /* calculate maximum label length for compact prinout */
+ max_label_len = 0;
+ for ( i = 0; i < num_wmops_records; i++ )
+ {
+ label_len = strlen( wmops[i].label );
+ if ( label_len > max_label_len )
+ {
+ max_label_len = label_len;
+ }
+ }
+ max_label_len += 4;
+
+ fprintf( stdout, "\n\n --- Complexity analysis [WMOPS] --- \n\n" );
+
+ fprintf( stdout, "%*s %33s %23s\n", max_label_len, "", "|------ SELF ------|", "|--- CUMULATIVE ---|" );
+ fprintf( stdout, sfmt, max_label_len, " routine", " calls", " min ", " max ", " avg ", " min ", " max ", " avg " );
+ fprintf( stdout, sfmt, max_label_len, "---------------", "------", "------", "------", "------", "------", "------", "------" );
+
+ for ( i = 0; i < num_wmops_records; i++ )
+ {
+ fprintf( stdout, dfmt, max_label_len, wmops[i].label, update_cnt == 0 ? 0 : (float) wmops[i].call_number / update_cnt,
+ wmops[i].min_selfcnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_selfcnt,
+ FAC * wmops[i].max_selfcnt,
+ wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_selfcnt / wmops[i].update_cnt,
+ wmops[i].min_cnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_cnt,
+ FAC * wmops[i].max_cnt,
+ wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_cnt / wmops[i].update_cnt );
+ }
+
+ fprintf( stdout, sfmts, max_label_len, "---------------", "------", "------", "------", "------" );
+ fprintf( stdout, dfmts, max_label_len, "total", (float) update_cnt, update_cnt == 0 ? 0 : FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt / update_cnt );
+ fprintf( stdout, "\n" );
+
+#ifdef WMOPS_WC_FRAME_ANALYSIS
+ fprintf( stdout, "\nComplexity analysis for the worst-case frame %ld:\n\n", fnum_cnt_wc );
+ fprintf( stdout, "%*s %8s %10s %12s\n", max_label_len, " routine", " calls", " SELF", " CUMULATIVE" );
+ fprintf( stdout, "%*s %8s %10s %10s\n", max_label_len, "---------------", "------", "------", "----------" );
+
+ for ( i = 0; i < num_wmops_records; i++ )
+ {
+ if ( wmops[i].wc_call_number > 0 )
+ {
+ fprintf( stdout, "%*s %8d %10.3f %12.3f\n", max_label_len, wmops[i].label, wmops[i].wc_call_number, FAC * wmops[i].wc_selfcnt, FAC * wmops[i].wc_cnt );
+ }
+ }
+
+ fprintf( stdout, "\nCall tree for the worst-case frame %ld:\n\n", fnum_cnt_wc );
+ fprintf( stdout, sfmtt, " function", "num", "called by " );
+ fprintf( stdout, sfmtt, "---------------", "---", "--------------" );
+
+ for ( i = 0; i < num_wmops_records; i++ )
+ {
+ if ( wmops[i].wc_call_number > 0 )
+ {
+ fprintf( stdout, dfmtt, wmops[i].label, i );
+ for ( j = 0; wmops[i].call_tree[j] != -1 && j < MAX_CALL_TREE_DEPTH; j++ )
+ {
+ if ( j != 0 )
+ {
+ fprintf( stdout, ", " );
+ }
+ fprintf( stdout, "%d", wmops[i].call_tree[j] );
+ }
+ fprintf( stdout, "\n" );
+ }
+ }
+
+ fprintf( stdout, "\n\n" );
-//#ifdef WMOPS_WC_FRAME_ANALYSIS
-// int j;
-// char *sfmtt = "%20s %4s %15s\n";
-// char *dfmtt = "%20s %4d ";
-//#endif
-
-// /* calculate maximum label length for compact prinout */
-// max_label_len = 0;
-// for ( i = 0; i < num_wmops_records; i++ )
-// {
-// label_len = strlen( wmops[i].label );
-// if ( label_len > max_label_len )
-// {
-// max_label_len = label_len;
-// }
-// }
-// max_label_len += 4;
-//
-// fprintf( stdout, "\n\n --- Complexity analysis [WMOPS] --- \n\n" );
-//
-// fprintf( stdout, "%*s %33s %23s\n", max_label_len, "", "|------ SELF ------|", "|--- CUMULATIVE ---|" );
-// fprintf( stdout, sfmt, max_label_len, " routine", " calls", " min ", " max ", " avg ", " min ", " max ", " avg " );
-// fprintf( stdout, sfmt, max_label_len, "---------------", "------", "------", "------", "------", "------", "------", "------" );
-//
-// for ( i = 0; i < num_wmops_records; i++ )
-// {
-// fprintf( stdout, dfmt, max_label_len, wmops[i].label, update_cnt == 0 ? 0 : (float) wmops[i].call_number / update_cnt,
-// wmops[i].min_selfcnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_selfcnt,
-// FAC * wmops[i].max_selfcnt,
-// wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_selfcnt / wmops[i].update_cnt,
-// wmops[i].min_cnt == DOUBLE_MAX ? 0 : FAC * wmops[i].min_cnt,
-// FAC * wmops[i].max_cnt,
-// wmops[i].update_cnt == 0 ? 0 : FAC * wmops[i].tot_cnt / wmops[i].update_cnt );
-// }
-//
-// fprintf( stdout, sfmts, max_label_len, "---------------", "------", "------", "------", "------" );
-// fprintf( stdout, dfmts, max_label_len, "total", (float) update_cnt, update_cnt == 0 ? 0 : FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt_wmc / update_cnt );
-// fprintf( stdout, "\n" );
-//
-//#ifdef WMOPS_WC_FRAME_ANALYSIS
-// fprintf( stdout, "\nComplexity analysis for the worst-case frame %ld:\n\n", fnum_cnt_wc );
-// fprintf( stdout, "%*s %8s %10s %12s\n", max_label_len, " routine", " calls", " SELF", " CUMULATIVE" );
-// fprintf( stdout, "%*s %8s %10s %10s\n", max_label_len, "---------------", "------", "------", "----------" );
-//
-// for ( i = 0; i < num_wmops_records; i++ )
-// {
-// if ( wmops[i].wc_call_number > 0 )
-// {
-// fprintf( stdout, "%*s %8d %10.3f %12.3f\n", max_label_len, wmops[i].label, wmops[i].wc_call_number, FAC * wmops[i].wc_selfcnt, FAC * wmops[i].wc_cnt );
-// }
-// }
-//
-// fprintf( stdout, "\nCall tree for the worst-case frame %ld:\n\n", fnum_cnt_wc );
-// fprintf( stdout, sfmtt, " function", "num", "called by " );
-// fprintf( stdout, sfmtt, "---------------", "---", "--------------" );
-//
-// for ( i = 0; i < num_wmops_records; i++ )
-// {
-// if ( wmops[i].wc_call_number > 0 )
-// {
-// fprintf( stdout, dfmtt, wmops[i].label, i );
-// for ( j = 0; wmops[i].call_tree[j] != -1 && j < MAX_CALL_TREE_DEPTH; j++ )
-// {
-// if ( j != 0 )
-// {
-// fprintf( stdout, ", " );
-// }
-// fprintf( stdout, "%d", wmops[i].call_tree[j] );
-// }
-// fprintf( stdout, "\n" );
-// }
-// }
-//
-// fprintf( stdout, "\n\n" );
-//
-// fprintf( stdout, "\nInstruction type analysis for the worst-case frame %ld:\n\n", fnum_cnt_wc );
-// for ( i = 0; i < NUM_INST; i++ )
-// {
-// switch ( (enum instructions) i )
-// {
-// case _ADD:
-// fprintf( stdout, "\tAdds: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _ABS:
-// fprintf( stdout, "\tAbsolutes: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _MULT:
-// fprintf( stdout, "\tMultiplies: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _MAC:
-// fprintf( stdout, "\tMACs: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _MOVE:
-// fprintf( stdout, "\tMoves: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _STORE:
-// fprintf( stdout, "\tStores: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _LOGIC:
-// fprintf( stdout, "\tLogicals: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _SHIFT:
-// fprintf( stdout, "\tShifts: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _BRANCH:
-// fprintf( stdout, "\tBranches: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _DIV:
-// fprintf( stdout, "\tDivisions: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _SQRT:
-// fprintf( stdout, "\tSquare Root: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _TRANS:
-// fprintf( stdout, "\tTrans: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _FUNC:
-// fprintf( stdout, "\tFunc Call: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _LOOP:
-// fprintf( stdout, "\tLoop Init: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _INDIRECT:
-// fprintf( stdout, "\tIndirect Addr: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _PTR_INIT:
-// fprintf( stdout, "\tPointer Init: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _TEST:
-// fprintf( stdout, "\tExtra condit.: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _POWER:
-// fprintf( stdout, "\tExponential: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _LOG:
-// fprintf( stdout, "\tLogarithm: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// case _MISC:
-// fprintf( stdout, "\tAll other op.: %12.1f\n", inst_cnt_wc[i] );
-// break;
-// default:
-// fprintf( stdout, "\tERROR: Invalid instruction type: %d\n\n", i );
-// }
-// }
-//#endif
-//
-// /* De-allocate the list of wmops record */
-// if ( wmops != NULL )
-// {
-// free( wmops );
-// }
-//
-// /* De-allocate the list of wmops caller functions */
-// if ( wmops_caller_stack != NULL )
-// {
-// free( wmops_caller_stack );
-// }
-//
-// /* De-allocate the BASOP WMOPS counter */
-// //if ( multiCounter != NULL )
-// //{
-// // free( multiCounter );
-// //}
+ fprintf( stdout, "\nInstruction type analysis for the worst-case frame %ld:\n\n", fnum_cnt_wc );
+ for ( i = 0; i < NUM_INST; i++ )
+ {
+ switch ( (enum instructions) i )
+ {
+ case _ADD:
+ fprintf( stdout, "\tAdds: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _ABS:
+ fprintf( stdout, "\tAbsolutes: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _MULT:
+ fprintf( stdout, "\tMultiplies: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _MAC:
+ fprintf( stdout, "\tMACs: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _MOVE:
+ fprintf( stdout, "\tMoves: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _STORE:
+ fprintf( stdout, "\tStores: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _LOGIC:
+ fprintf( stdout, "\tLogicals: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _SHIFT:
+ fprintf( stdout, "\tShifts: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _BRANCH:
+ fprintf( stdout, "\tBranches: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _DIV:
+ fprintf( stdout, "\tDivisions: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _SQRT:
+ fprintf( stdout, "\tSquare Root: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _TRANS:
+ fprintf( stdout, "\tTrans: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _FUNC:
+ fprintf( stdout, "\tFunc Call: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _LOOP:
+ fprintf( stdout, "\tLoop Init: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _INDIRECT:
+ fprintf( stdout, "\tIndirect Addr: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _PTR_INIT:
+ fprintf( stdout, "\tPointer Init: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _TEST:
+ fprintf( stdout, "\tExtra condit.: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _POWER:
+ fprintf( stdout, "\tExponential: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _LOG:
+ fprintf( stdout, "\tLogarithm: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ case _MISC:
+ fprintf( stdout, "\tAll other op.: %12.1f\n", inst_cnt_wc[i] );
+ break;
+ default:
+ fprintf( stdout, "\tERROR: Invalid instruction type: %d\n\n", i );
+ }
+ }
+#endif
+
+ /* De-allocate the list of wmops record */
+ if ( wmops != NULL )
+ {
+ free( wmops );
+ }
+
+ /* De-allocate the list of wmops caller functions */
+ if ( wmops_caller_stack != NULL )
+ {
+ free( wmops_caller_stack );
+ }
+
+ /* De-allocate the BASOP WMOPS counter */
+ if ( multiCounter != NULL )
+ {
+ free( multiCounter );
+ }
return;
}
@@ -703,8 +752,8 @@ void print_wmops( void )
#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' )
@@ -2129,7 +2178,339 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
#endif /* WMOPS */
+#ifdef CONTROL_CODE_OPS
-#ifndef WMOPS
-int cntr_push_pop = 0; /* global counter for checking balanced push_wmops()/pop_wmops() pairs when WMOPS is not activated */
+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
+ multiCounter[currCounter].GT_16++;
+#endif
+ return F_ret;
+}
+
+int LE_16( short var1, short var2 )
+{
+ int F_ret = 0;
+
+ if ( var1 <= var2 )
+ {
+ F_ret = 1;
+ }
+#ifdef WMOPS
+ multiCounter[currCounter].LE_16++;
+#endif
+ return F_ret;
+}
+
+int GE_16( short var1, short var2 )
+{
+ int F_ret = 0;
+
+ if ( var1 >= var2 )
+ {
+ F_ret = 1;
+ }
+#ifdef WMOPS
+ multiCounter[currCounter].GE_16++;
+#endif
+ return F_ret;
+}
+
+int EQ_16( short var1, short var2 )
+{
+ int F_ret = 0;
+
+ if ( var1 == var2 )
+ {
+ F_ret = 1;
+ }
+#ifdef WMOPS
+ multiCounter[currCounter].EQ_16++;
#endif
+ return F_ret;
+}
+
+int NE_16( short var1, short var2 )
+{
+ 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;
+ }
+#ifdef WMOPS
+ multiCounter[currCounter].GE_64++;
+#endif
+ return F_ret;
+}
+
+int EQ_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].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[CounterId];
+ ptr2 = (unsigned int *) &op_weight;
+
+ 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( unsigned int CounterId )
+{
+ long NewWOper, delta;
+
+ NewWOper = TotalWeightedOperation( CounterId );
+
+ delta = NewWOper - wmops[CounterId].LastWOper;
+ wmops[CounterId].LastWOper = NewWOper;
+
+ return ( delta );
+}
+
+/* Resets BASOP operation counter */
+void Reset_BASOP_WMOPS_counter( unsigned int counterId )
+{
+ int i;
+ long *ptr;
+
+ /* reset the current BASOP operation counter */
+ ptr = (long *) &multiCounter[counterId];
+ for ( i = 0; i < (int) ( sizeof( multiCounter[counterId] ) / sizeof( long ) ); i++ )
+ {
+ *ptr++ = 0;
+ }
+
+ wmops[counterId].LastWOper = 0;
+
+ return;
+}
+
+#endif
\ No newline at end of file
diff --git a/lib_debug/wmc_auto.h b/lib_debug/wmc_auto.h
index 5f5d6d9753f98612762f47dca560f63c7b22ddd6..59bbc5bbf72f54a9ab64216be94d3c5f4ce57800 100644
--- a/lib_debug/wmc_auto.h
+++ b/lib_debug/wmc_auto.h
@@ -1,5 +1,5 @@
/*
- * (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
@@ -30,8 +30,12 @@
#pragma GCC system_header
#endif
-#define FRAMES_PER_SECOND 50.0
-#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) */
+#define ENH_32_BIT_OPERATOR
+#define ENH_64_BIT_OPERATOR
+#define ENH_U_32_BIT_OPERATOR
+#define COMPLEX_OPERATOR
+#define CONTROL_CODE_OPS /* enable control code operators such as LT_16, GT_16, ... */
+#define WMOPS_DISABLE_FCN_CALL_PENALIZATION /* do not count the complexity of function calls */
#ifdef WMOPS
enum instructions
@@ -59,6 +63,30 @@ enum instructions
NUM_INST
};
+extern double ops_cnt;
+extern double inst_cnt[NUM_INST];
+
+/******************************************************************/
+/* NOTES: */
+/* The 'wmc_flag_' flag is global to avoid declaration in every */
+/* function and 'static' to avoid clashing with other modules */
+/* that include this header file. */
+/* */
+/* The declarations of 'wmc_flag_' and 'wops_' in this header */
+/* file prevent the addition of a 'C' file to the Project. */
+/******************************************************************/
+
+/* General Purpose Global int */
+static int wmc_flag_ = 0;
+
+#define push_wmops( ... ) push_wmops_fct( __VA_ARGS__, NULL )
+void push_wmops_fct( const char *label, ... );
+void pop_wmops( void );
+void reset_wmops( void );
+void print_wmops( void );
+void update_wmops( void );
+void update_mem( void );
+
#define _ADD_C 1
#define _ABS_C 1
#define _MULT_C 1
@@ -80,492 +108,157 @@ enum instructions
#define _LOG_C 25
#define _MISC_C 1
-#define _ADD_P 1
-#define _ABS_P 1
-#define _MULT_P 1
-#define _MAC_P 1
-#define _MOVE_P 1
-#define _STORE_P 0
-#define _LOGIC_P 1
-#define _SHIFT_P 1
-#define _BRANCH_P 2
-#define _DIV_P 2
-#define _SQRT_P 2
-#define _TRANS_P 2
-#define _FUNC_P 2 /* need to add number of arguments */
-#define _LOOP_P 1
-#define _INDIRECT_P 2
-#define _PTR_INIT_P 1
-#define _TEST_P 1
-#define _POWER_P 2
-#define _LOG_P 2
-#define _MISC_P 1
-
-#define ADD( x ) \
- { \
- { \
- ops_cnt_wmc += ( _ADD_C * ( x ) ); \
- inst_cnt[_ADD] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _ADD_P * ( x ) ); \
- } \
- } \
- } \
+#define ADD( x ) \
+ { \
+ ops_cnt += ( _ADD_C * ( x ) ); \
+ inst_cnt[_ADD] += ( x ); \
}
-#define ABS( x ) \
- { \
- { \
- ops_cnt_wmc += ( _ABS_C * ( x ) ); \
- inst_cnt[_ABS] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _ABS_P * ( x ) ); \
- } \
- } \
- } \
+#define ABS( x ) \
+ { \
+ ops_cnt += ( _ABS_C * ( x ) ); \
+ inst_cnt[_ABS] += ( x ); \
}
-#define MULT( x ) \
- { \
- { \
- ops_cnt_wmc += ( _MULT_C * ( x ) ); \
- inst_cnt[_MULT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _MULT_P * ( x ) ); \
- } \
- } \
- } \
+#define MULT( x ) \
+ { \
+ ops_cnt += ( _MULT_C * ( x ) ); \
+ inst_cnt[_MULT] += ( x ); \
}
-#define MAC( x ) \
- { \
- { \
- ops_cnt_wmc += ( _MAC_C * ( x ) ); \
- inst_cnt[_MAC] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _MAC_P * ( x ) ); \
- } \
- } \
- } \
+#define MAC( x ) \
+ { \
+ ops_cnt += ( _MAC_C * ( x ) ); \
+ inst_cnt[_MAC] += ( x ); \
}
-#define MOVE( x ) \
- { \
- { \
- ops_cnt_wmc += ( _MOVE_C * ( x ) ); \
- inst_cnt[_MOVE] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _MOVE_P * ( x ) ); \
- } \
- } \
- } \
+#define MOVE( x ) \
+ { \
+ ops_cnt += ( _MOVE_C * ( x ) ); \
+ inst_cnt[_MOVE] += ( x ); \
}
-#define STORE( x ) \
- { \
- { \
- ops_cnt_wmc += ( _STORE_C * ( x ) ); \
- inst_cnt[_STORE] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _STORE_P * ( x ) ); \
- } \
- } \
- } \
+#define STORE( x ) \
+ { \
+ ops_cnt += ( _STORE_C * ( x ) ); \
+ inst_cnt[_STORE] += ( x ); \
}
-#define LOGIC( x ) \
- { \
- { \
- ops_cnt_wmc += ( _LOGIC_C * ( x ) ); \
- inst_cnt[_LOGIC] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _LOGIC_P * ( x ) ); \
- } \
- } \
- } \
+#define LOGIC( x ) \
+ { \
+ ops_cnt += ( _LOGIC_C * ( x ) ); \
+ inst_cnt[_LOGIC] += ( x ); \
}
-#define SHIFT( x ) \
- { \
- { \
- ops_cnt_wmc += ( _SHIFT_C * ( x ) ); \
- inst_cnt[_SHIFT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _SHIFT_P * ( x ) ); \
- } \
- } \
- } \
+#define SHIFT( x ) \
+ { \
+ ops_cnt += ( _SHIFT_C * ( x ) ); \
+ inst_cnt[_SHIFT] += ( x ); \
}
-#define BRANCH( x ) \
- { \
- { \
- ops_cnt_wmc += ( _BRANCH_C * ( x ) ); \
- inst_cnt[_BRANCH] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _BRANCH_P * ( x ) ); \
- } \
- } \
- } \
+#define BRANCH( x ) \
+ { \
+ ops_cnt += ( _BRANCH_C * ( x ) ); \
+ inst_cnt[_BRANCH] += ( x ); \
}
-#define DIV( x ) \
- { \
- { \
- ops_cnt_wmc += ( _DIV_C * ( x ) ); \
- inst_cnt[_DIV] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _DIV_P * ( x ) ); \
- } \
- } \
- } \
+#define DIV( x ) \
+ { \
+ ops_cnt += ( _DIV_C * ( x ) ); \
+ inst_cnt[_DIV] += ( x ); \
}
-#define SQRT( x ) \
- { \
- { \
- ops_cnt_wmc += ( _SQRT_C * ( x ) ); \
- inst_cnt[_SQRT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _SQRT_P * ( x ) ); \
- } \
- } \
- } \
+#define SQRT( x ) \
+ { \
+ ops_cnt += ( _SQRT_C * ( x ) ); \
+ inst_cnt[_SQRT] += ( x ); \
}
-#define TRANS( x ) \
- { \
- { \
- ops_cnt_wmc += ( _TRANS_C * ( x ) ); \
- inst_cnt[_TRANS] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _TRANS_P * ( x ) ); \
- } \
- } \
- } \
+#define TRANS( x ) \
+ { \
+ ops_cnt += ( _TRANS_C * ( x ) ); \
+ inst_cnt[_TRANS] += ( x ); \
}
-#define LOOP( x ) \
- { \
- { \
- ops_cnt_wmc += ( _LOOP_C * ( x ) ); \
- inst_cnt[_LOOP] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _LOOP_P * ( x ) ); \
- } \
- } \
- } \
+#define LOOP( x ) \
+ { \
+ ops_cnt += ( _LOOP_C * ( x ) ); \
+ inst_cnt[_LOOP] += ( x ); \
}
-#define INDIRECT( x ) \
- { \
- { \
- ops_cnt_wmc += ( _INDIRECT_C * ( x ) ); \
- inst_cnt[_INDIRECT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _INDIRECT_P * ( x ) ); \
- } \
- } \
- } \
+#define INDIRECT( x ) \
+ { \
+ ops_cnt += ( _INDIRECT_C * ( x ) ); \
+ inst_cnt[_INDIRECT] += ( x ); \
}
-#define PTR_INIT( x ) \
- { \
- { \
- ops_cnt_wmc += ( _PTR_INIT_C * ( x ) ); \
- inst_cnt[_PTR_INIT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _PTR_INIT_P * ( x ) ); \
- } \
- } \
- } \
+#define PTR_INIT( x ) \
+ { \
+ ops_cnt += ( _PTR_INIT_C * ( x ) ); \
+ inst_cnt[_PTR_INIT] += ( x ); \
}
-#define TEST( x ) \
- { \
- { \
- ops_cnt_wmc += ( _TEST_C * ( x ) ); \
- inst_cnt[_TEST] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _TEST_P * ( x ) ); \
- } \
- } \
- } \
+#define TEST( x ) \
+ { \
+ ops_cnt += ( _TEST_C * ( x ) ); \
+ inst_cnt[_TEST] += ( x ); \
}
-#define POWER( x ) \
- { \
- { \
- ops_cnt_wmc += ( _POWER_C * ( x ) ); \
- inst_cnt[_POWER] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _POWER_P * ( x ) ); \
- } \
- } \
- } \
+#define POWER( x ) \
+ { \
+ ops_cnt += ( _POWER_C * ( x ) ); \
+ inst_cnt[_POWER] += ( x ); \
}
-#define LOG( x ) \
- { \
- { \
- ops_cnt_wmc += ( _LOG_C * ( x ) ); \
- inst_cnt[_LOG] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _LOG_P * ( x ) ); \
- } \
- } \
- } \
+#define LOG( x ) \
+ { \
+ ops_cnt += ( _LOG_C * ( x ) ); \
+ inst_cnt[_LOG] += ( x ); \
}
-#define MISC( x ) \
- { \
- { \
- ops_cnt_wmc += ( _MISC_C * ( x ) ); \
- inst_cnt[_MISC] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _MISC_P * ( x ) ); \
- } \
- } \
- } \
+#define MISC( x ) \
+ { \
+ ops_cnt += ( _MISC_C * ( x ) ); \
+ inst_cnt[_MISC] += ( x ); \
}
-
-#define FUNC( x ) \
- { \
- { \
- ops_cnt_wmc += ( _FUNC_C + _MOVE_C * ( x ) ); \
- inst_cnt[_FUNC]++; \
- inst_cnt[_MOVE] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _FUNC_P + _MOVE_P * ( x ) ); \
- } \
- } \
- } \
- }
-
-#define DADD( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _ADD_C * ( x ) ); \
- inst_cnt[_ADD] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _ADD_P * ( x ) ); \
- } \
- } \
- } \
+#define FUNC( x ) \
+ { \
+ ops_cnt += ( _FUNC_C + _MOVE_C * ( x ) ); \
+ inst_cnt[_FUNC]++; \
+ inst_cnt[_MOVE] += ( x ); \
}
-#define DMULT( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _MULT_C * ( x ) ); \
- inst_cnt[_MULT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _MULT_P * ( x ) ); \
- } \
- } \
- } \
+#define DADD( x ) \
+ { \
+ ops_cnt += ( 2 * _ADD_C * ( x ) ); \
+ inst_cnt[_ADD] += ( x ); \
}
-#define DMAC( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _MAC_C * ( x ) ); \
- inst_cnt[_MAC] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _MAC_P * ( x ) ); \
- } \
- } \
- } \
+#define DMULT( x ) \
+ { \
+ ops_cnt += ( 2 * _MULT_C * ( x ) ); \
+ inst_cnt[_MULT] += ( x ); \
}
-#define DMOVE( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _MOVE_C * ( x ) ); \
- inst_cnt[_MOVE] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _MOVE_P * ( x ) ); \
- } \
- } \
- } \
+#define DMAC( x ) \
+ { \
+ ops_cnt += ( 2 * _MAC_C * ( x ) ); \
+ inst_cnt[_MAC] += ( x ); \
}
-#define DSTORE( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _STORE_C * ( x ) ); \
- inst_cnt[_STORE] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _STORE_P * ( x ) ); \
- } \
- } \
- } \
+#define DMOVE( x ) \
+ { \
+ ops_cnt += ( 2 * _MOVE_C * ( x ) ); \
+ inst_cnt[_MOVE] += ( x ); \
}
-#define DLOGIC( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _LOGIC_C * ( x ) ); \
- inst_cnt[_LOGIC] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _LOGIC_P * ( x ) ); \
- } \
- } \
- } \
+#define DSTORE( x ) \
+ { \
+ ops_cnt += ( 2 * _STORE_C * ( x ) ); \
+ inst_cnt[_STORE] += ( x ); \
}
-#define DSHIFT( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _SHIFT_C * ( x ) ); \
- inst_cnt[_SHIFT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _SHIFT_P * ( x ) ); \
- } \
- } \
- } \
+#define DLOGIC( x ) \
+ { \
+ ops_cnt += ( 2 * _LOGIC_C * ( x ) ); \
+ inst_cnt[_LOGIC] += ( x ); \
}
-#define DDIV( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _DIV_C * ( x ) ); \
- inst_cnt[_DIV] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _DIV_P * ( x ) ); \
- } \
- } \
- } \
+#define DSHIFT( x ) \
+ { \
+ ops_cnt += ( 2 * _SHIFT_C * ( x ) ); \
+ inst_cnt[_SHIFT] += ( x ); \
}
-#define DSQRT( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _SQRT_C * ( x ) ); \
- inst_cnt[_SQRT] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _SQRT_P * ( x ) ); \
- } \
- } \
- } \
+#define DDIV( x ) \
+ { \
+ ops_cnt += ( 2 * _DIV_C * ( x ) ); \
+ inst_cnt[_DIV] += ( x ); \
}
-#define DTRANS( x ) \
- { \
- { \
- ops_cnt_wmc += ( 2 * _TRANS_C * ( x ) ); \
- inst_cnt[_TRANS] += ( x ); \
- { \
- static int pcnt; \
- if ( !pcnt ) \
- { \
- pcnt = 1; \
- prom_cnt_wmc += ( _TRANS_P * ( x ) ); \
- } \
- } \
- } \
+#define DSQRT( x ) \
+ { \
+ ops_cnt += ( 2 * _SQRT_C * ( x ) ); \
+ inst_cnt[_SQRT] += ( x ); \
}
-
-extern double ops_cnt_wmc;
-extern double prom_cnt_wmc;
-extern double inst_cnt[NUM_INST];
-
-#define push_wmops( ... ) push_wmops_fct( __VA_ARGS__, NULL )
-void push_wmops_fct( const char *label, ... );
-void pop_wmops( void );
-void reset_wmops( void );
-void print_wmops( void );
-void update_wmops( void );
-void update_mem( void );
+#define DTRANS( x ) \
+ { \
+ ops_cnt += ( 2 * _TRANS_C * ( x ) ); \
+ inst_cnt[_TRANS] += ( x ); \
+ }
#else
@@ -611,14 +304,6 @@ extern int cntr_push_pop;
#endif
-/* mac & msu (Non Instrumented Versions) */
-#ifndef mac
-#define mac( a, b, c ) ( ( a ) + ( b ) * ( c ) )
-#endif
-#ifndef msu
-#define msu( a, b, c ) ( ( a ) - ( b ) * ( c ) )
-#endif
-
#ifndef WMOPS
/* DESACTIVATE the Counting Mechanism */
#define OP_COUNT_( op, n )
@@ -634,24 +319,8 @@ extern int cntr_push_pop;
#else
-/* '*ops_cnt_ptr' is Used to Avoid: "warning: operation on 'ops_cnt_wmc' may be undefined" with Cygwin gcc Compiler */
-static double *ops_cnt_ptr = &ops_cnt_wmc;
-#define OP_COUNT_( op, x ) ( *ops_cnt_ptr += ( op##_C * ( x ) ), inst_cnt[op] += ( x ) )
-
-/******************************************************************/
-/* NOTES: */
-/* The 'wmc_flag_' flag is global to avoid declaration in every */
-/* function and 'static' to avoid clashing with other modules */
-/* that include this header file. */
-/* */
-/* The declarations of 'wmc_flag_' and 'wops_' in this header */
-/* file prevent the addition of a 'C' file to the Project. */
-/******************************************************************/
-
-/* General Purpose Global Flag */
-static int wmc_flag_ = 0;
-
/* Operation Counter Wrappers */
+#define OP_COUNT_( op, x ) ( ops_cnt += ( op##_C * ( x ) ), inst_cnt[op] += ( x ) )
#define OP_COUNT_WRAPPER1_( op, val ) ( op, val )
#define OP_COUNT_WRAPPER2_( expr ) \
if ( expr, 0 ) \
@@ -683,7 +352,11 @@ static int wmc_flag_ = 0;
#define LOOP_( x ) OP_COUNT_( _LOOP, ( x ) )
#define INDIRECT_( x ) OP_COUNT_( _INDIRECT, ( x ) )
#define PTR_INIT_( x ) OP_COUNT_( _PTR_INIT, ( x ) )
+#ifdef WMOPS_DISABLE_FCN_CALL_PENALIZATION
+#define FUNC_( x ) ( x )
+#else
#define FUNC_( x ) ( OP_COUNT_( _MOVE, ( x ) ), OP_COUNT_( _FUNC, 1 ) )
+#endif
#define MISC_( x ) ABS_( x )
/* Math Operations */
@@ -801,7 +474,6 @@ static int wmc_flag_ = 0;
#define return_ \
OP_COUNT_WRAPPER2_( ( wmc_flag_ = stack_tree_level_, STACK_DEPTH_FCT_RETURN ) ) \
return
-
#define switch_ \
OP_COUNT_WRAPPER2_( ( BRANCH_( 1 ), wmc_flag_ = 1 ) ) \
switch
@@ -917,7 +589,6 @@ st:
/* This Shouldn't Happen */
/* These are Used to Avoid: "warning: 'name' defined but not used" with Cygwin gcc Compiler */
wmc_flag_ = wmc_flag_;
- ops_cnt_ptr = ops_cnt_ptr;
fct( "" );
error:
default:
@@ -995,18 +666,6 @@ typedef enum
USE_32BITS = 2
} Counting_Size;
-#if ( defined( _WIN32 ) && ( _MSC_VER <= 1800 ) && ( _MSC_VER >= 1300 ) )
-#define __func__ __FUNCTION__
-#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ < 199901L
-#if ( __GNUC__ >= 2 )
-#define __func__ __FUNCTION__
-#else
-#define __func__ ""
-#endif
-#elif defined( __GNUC__ )
-#define __func__ __extension__ __FUNCTION__
-#endif
-
#ifdef WMOPS
@@ -1024,11 +683,11 @@ int push_stack( const char *filename, const char *fctname );
int pop_stack( const char *filename, const char *fctname );
#ifdef WMOPS_DETAIL
-#define STACK_DEPTH_FCT_CALL ( push_wmops( __FUNCTION__ ), push_stack( __FILE__, __FUNCTION__ ) ) /* add push_wmops() in all function calls */
-#define STACK_DEPTH_FCT_RETURN ( pop_wmops(), pop_stack( __FILE__, __FUNCTION__ ) ) /* add pop_wmops() in all function returns */
+#define STACK_DEPTH_FCT_CALL ( push_wmops( __func__, "[WMC_AUTO]" ), push_stack( __FILE__, __func__ ) ) /* add push_wmops() in all function calls */
+#define STACK_DEPTH_FCT_RETURN ( pop_wmops(), pop_stack( __FILE__, __func__ ) ) /* add pop_wmops() in all function returns */
#else
-#define STACK_DEPTH_FCT_CALL push_stack( __FILE__, __FUNCTION__ )
-#define STACK_DEPTH_FCT_RETURN pop_stack( __FILE__, __FUNCTION__ )
+#define STACK_DEPTH_FCT_CALL push_stack( __FILE__, __func__ )
+#define STACK_DEPTH_FCT_RETURN pop_stack( __FILE__, __func__ )
#endif
void reset_stack( void );
@@ -1048,4 +707,531 @@ void reset_stack( void );
#endif
+/* Global counter variable for calculation of complexity weight */
+typedef struct
+{
+ unsigned int add; /* Complexity Weight of 1 */
+ unsigned int sub; /* Complexity Weight of 1 */
+ unsigned int abs_s; /* Complexity Weight of 1 */
+ unsigned int shl; /* Complexity Weight of 1 */
+ unsigned int shr; /* Complexity Weight of 1 */
+
+ unsigned int extract_h; /* Complexity Weight of 1 */
+ unsigned int extract_l; /* Complexity Weight of 1 */
+ unsigned int mult; /* Complexity Weight of 1 */
+ unsigned int L_mult; /* Complexity Weight of 1 */
+ unsigned int negate; /* Complexity Weight of 1 */
+
+ unsigned int round; /* Complexity Weight of 1 */
+ unsigned int L_mac; /* Complexity Weight of 1 */
+ unsigned int L_msu; /* Complexity Weight of 1 */
+ unsigned int L_macNs; /* Complexity Weight of 1 */
+ unsigned int L_msuNs; /* Complexity Weight of 1 */
+
+ unsigned int L_add; /* Complexity Weight of 1 */
+ unsigned int L_sub; /* Complexity Weight of 1 */
+ unsigned int L_add_c; /* Complexity Weight of 2 */
+ unsigned int L_sub_c; /* Complexity Weight of 2 */
+ unsigned int L_negate; /* Complexity Weight of 1 */
+
+ unsigned int L_shl; /* Complexity Weight of 1 */
+ unsigned int L_shr; /* Complexity Weight of 1 */
+ unsigned int mult_r; /* Complexity Weight of 1 */
+ unsigned int shr_r; /* Complexity Weight of 3 */
+ unsigned int mac_r; /* Complexity Weight of 1 */
+
+ unsigned int msu_r; /* Complexity Weight of 1 */
+ unsigned int L_deposit_h; /* Complexity Weight of 1 */
+ unsigned int L_deposit_l; /* Complexity Weight of 1 */
+ unsigned int L_shr_r; /* Complexity Weight of 3 */
+ unsigned int L_abs; /* Complexity Weight of 1 */
+
+ unsigned int L_sat; /* Complexity Weight of 4 */
+ unsigned int norm_s; /* Complexity Weight of 1 */
+ unsigned int div_s; /* Complexity Weight of 18 */
+ unsigned int norm_l; /* Complexity Weight of 1 */
+ unsigned int move16; /* Complexity Weight of 1 */
+
+ unsigned int move32; /* Complexity Weight of 2 */
+ unsigned int Logic16; /* Complexity Weight of 1 */
+ unsigned int Logic32; /* Complexity Weight of 2 */
+ unsigned int Test; /* Complexity Weight of 2 */
+ unsigned int s_max; /* Complexity Weight of 1 */
+
+ unsigned int s_min; /* Complexity Weight of 1 */
+ unsigned int L_max; /* Complexity Weight of 1 */
+ unsigned int L_min; /* Complexity Weight of 1 */
+ unsigned int L40_max; /* Complexity Weight of 1 */
+ unsigned int L40_min; /* Complexity Weight of 1 */
+
+ unsigned int shl_r; /* Complexity Weight of 2 */
+ unsigned int L_shl_r; /* Complexity Weight of 2 */
+ unsigned int L40_shr_r; /* Complexity Weight of 2 */
+ unsigned int L40_shl_r; /* Complexity Weight of 2 */
+ unsigned int norm_L40; /* Complexity Weight of 1 */
+
+ unsigned int L40_shl; /* Complexity Weight of 1 */
+ unsigned int L40_shr; /* Complexity Weight of 1 */
+ unsigned int L40_negate; /* Complexity Weight of 1 */
+ unsigned int L40_add; /* Complexity Weight of 1 */
+ unsigned int L40_sub; /* Complexity Weight of 1 */
+
+ unsigned int L40_abs; /* Complexity Weight of 1 */
+ unsigned int L40_mult; /* Complexity Weight of 1 */
+ unsigned int L40_mac; /* Complexity Weight of 1 */
+ unsigned int mac_r40; /* Complexity Weight of 2 */
+
+ unsigned int L40_msu; /* Complexity Weight of 1 */
+ unsigned int msu_r40; /* Complexity Weight of 2 */
+ unsigned int Mpy_32_16_ss; /* Complexity Weight of 2 */
+ unsigned int Mpy_32_32_ss; /* Complexity Weight of 2 */
+ unsigned int L_mult0; /* Complexity Weight of 1 */
+
+ unsigned int L_mac0; /* Complexity Weight of 1 */
+ unsigned int L_msu0; /* Complexity Weight of 1 */
+ unsigned int lshl; /* Complexity Weight of 1 */
+ unsigned int lshr; /* Complexity Weight of 1 */
+ unsigned int L_lshl; /* Complexity Weight of 1 */
+
+ unsigned int L_lshr; /* Complexity Weight of 1 */
+ unsigned int L40_lshl; /* Complexity Weight of 1 */
+ unsigned int L40_lshr; /* Complexity Weight of 1 */
+ unsigned int s_and; /* Complexity Weight of 1 */
+ unsigned int s_or; /* Complexity Weight of 1 */
+
+ unsigned int s_xor; /* Complexity Weight of 1 */
+ unsigned int L_and; /* Complexity Weight of 1 */
+ unsigned int L_or; /* Complexity Weight of 1 */
+ unsigned int L_xor; /* Complexity Weight of 1 */
+ unsigned int rotl; /* Complexity Weight of 3 */
+
+ unsigned int rotr; /* Complexity Weight of 3 */
+ unsigned int L_rotl; /* Complexity Weight of 3 */
+ unsigned int L_rotr; /* Complexity Weight of 3 */
+ unsigned int L40_set; /* Complexity Weight of 1 */
+ unsigned int L40_deposit_h; /* Complexity Weight of 1 */
+
+ unsigned int L40_deposit_l; /* Complexity Weight of 1 */
+ unsigned int L40_deposit32; /* Complexity Weight of 1 */
+ unsigned int Extract40_H; /* Complexity Weight of 1 */
+ unsigned int Extract40_L; /* Complexity Weight of 1 */
+ unsigned int L_Extract40; /* Complexity Weight of 1 */
+
+ unsigned int L40_round; /* Complexity Weight of 1 */
+ unsigned int L_saturate40; /* Complexity Weight of 1 */
+ unsigned int round40; /* Complexity Weight of 1 */
+ unsigned int If; /* Complexity Weight of 3 */
+ unsigned int Goto; /* Complexity Weight of 2 */
+
+ unsigned int Break; /* Complexity Weight of 2 */
+ unsigned int Switch; /* Complexity Weight of 6 */
+ unsigned int For; /* Complexity Weight of 3 */
+ unsigned int While; /* Complexity Weight of 3 */
+ unsigned int Continue; /* Complexity Weight of 2 */
+
+ unsigned int L_mls; /* Complexity Weight of 1 */
+ unsigned int div_l; /* Complexity Weight of 32 */
+ unsigned int i_mult; /* Complexity Weight of 1 */
+
+/* New complex basic operators */
+#ifdef COMPLEX_OPERATOR
+ unsigned int CL_shr; /* Complexity Weight of 1 */
+ unsigned int CL_shl; /* Complexity Weight of 1 */
+ unsigned int CL_add; /* Complexity Weight of 1 */
+ unsigned int CL_sub; /* Complexity Weight of 1 */
+ unsigned int CL_scale; /* Complexity Weight of 1 */
+ unsigned int CL_dscale; /* Complexity Weight of 1 */
+ unsigned int CL_msu_j; /* Complexity Weight of 1 */
+ unsigned int CL_mac_j; /* Complexity Weight of 1 */
+ unsigned int CL_move; /* Complexity Weight of 1 */
+ unsigned int CL_Extract_real; /* Complexity Weight of 1 */
+ unsigned int CL_Extract_imag; /* Complexity Weight of 1 */
+ unsigned int CL_form; /* Complexity Weight of 1 */
+ unsigned int CL_multr_32x16; /* Complexity Weight of 2 */
+ unsigned int CL_negate; /* Complexity Weight of 1 */
+ unsigned int CL_conjugate; /* Complexity Weight of 1 */
+ unsigned int CL_mul_j; /* Complexity Weight of 1 */
+ unsigned int CL_swap_real_imag; /* Complexity Weight of 1 */
+ unsigned int C_add; /* Complexity Weight of 1 */
+ unsigned int C_sub; /* Complexity Weight of 1 */
+ unsigned int C_mul_j; /* Complexity Weight of 1 */
+ unsigned int C_multr; /* Complexity Weight of 2 */
+ unsigned int C_form; /* Complexity Weight of 1 */
+
+ unsigned int C_scale; /* Complexity Weight of 1 */
+ unsigned int CL_round32_16; /* Complexity Weight of 1 */
+ unsigned int CL_scale_32; /* Complexity Weight of 1 */
+ unsigned int CL_dscale_32; /* Complexity Weight of 1 */
+ unsigned int CL_multr_32x32; /* Complexity Weight of 2 */
+ unsigned int C_mac_r; /* Complexity Weight of 2 */
+ unsigned int C_msu_r; /* Complexity Weight of 2 */
+ unsigned int C_Extract_real; /* Complexity Weight of 1 */
+ unsigned int C_Extract_imag; /* Complexity Weight of 1 */
+ unsigned int C_negate; /* Complexity Weight of 1 */
+ unsigned int C_conjugate; /* Complexity Weight of 1 */
+ unsigned int C_shr; /* Complexity Weight of 1 */
+ unsigned int C_shl; /* Complexity Weight of 1 */
+
+#endif /* #ifdef COMPLEX_OPERATOR */
+
+/* New 64 bit basops */
+#ifdef ENH_64_BIT_OPERATOR
+ unsigned int move64; /* Complexity Weight of 1 */
+ unsigned int W_add_nosat; /* Complexity Weight of 1 */
+ unsigned int W_sub_nosat; /* Complexity Weight of 1 */
+ unsigned int W_shl; /* Complexity Weight of 1 */
+ unsigned int W_shr; /* Complexity Weight of 1 */
+ unsigned int W_shl_nosat; /* Complexity Weight of 1 */
+ unsigned int W_shr_nosat; /* Complexity Weight of 1 */
+ unsigned int W_mac_32_16; /* Complexity Weight of 1 */
+ unsigned int W_msu_32_16; /* Complexity Weight of 1 */
+ unsigned int W_mult_32_16; /* Complexity Weight of 1 */
+ unsigned int W_mult0_16_16; /* Complexity Weight of 1 */
+ unsigned int W_mac0_16_16; /* Complexity Weight of 1 */
+ unsigned int W_msu0_16_16; /* Complexity Weight of 1 */
+ unsigned int W_mult_16_16; /* Complexity Weight of 1 */
+ unsigned int W_mac_16_16; /* Complexity Weight of 1 */
+ unsigned int W_msu_16_16; /* Complexity Weight of 1 */
+ unsigned int W_shl_sat_l; /* Complexity Weight of 1 */
+ unsigned int W_sat_l; /* Complexity Weight of 1 */
+ unsigned int W_sat_m; /* Complexity Weight of 1 */
+ unsigned int W_deposit32_l; /* Complexity Weight of 1 */
+ unsigned int W_deposit32_h; /* Complexity Weight of 1 */
+ unsigned int W_extract_l; /* Complexity Weight of 1 */
+ unsigned int W_extract_h; /* Complexity Weight of 1 */
+ unsigned int W_round48_L; /* Complexity Weight of 1 */
+ unsigned int W_round32_s; /* Complexity Weight of 1 */
+ unsigned int W_norm; /* Complexity Weight of 1 */
+
+ unsigned int W_add; /* Complexity Weight of 1 */
+ unsigned int W_sub; /* Complexity Weight of 1 */
+ unsigned int W_neg; /* Complexity Weight of 1 */
+ unsigned int W_abs; /* Complexity Weight of 1 */
+ unsigned int W_mult_32_32; /* Complexity Weight of 1 */
+ unsigned int W_mult0_32_32; /* Complexity Weight of 1 */
+ unsigned int W_lshl; /* Complexity Weight of 1 */
+ unsigned int W_lshr; /* Complexity Weight of 1 */
+ unsigned int W_round64_L; /* Complexity Weight of 1 */
+
+#endif /* #ifdef ENH_64_BIT_OPERATOR */
+
+#ifdef ENH_32_BIT_OPERATOR
+ unsigned int Mpy_32_16_1; /* Complexity Weight of 1 */
+ unsigned int Mpy_32_16_r; /* Complexity Weight of 1 */
+ unsigned int Mpy_32_32; /* Complexity Weight of 1 */
+ unsigned int Mpy_32_32_r; /* Complexity Weight of 1 */
+ unsigned int Madd_32_16; /* Complexity Weight of 1 */
+ unsigned int Madd_32_16_r; /* Complexity Weight of 1 */
+ unsigned int Msub_32_16; /* Complexity Weight of 1 */
+ unsigned int Msub_32_16_r; /* Complexity Weight of 1 */
+ unsigned int Madd_32_32; /* Complexity Weight of 1 */
+ unsigned int Madd_32_32_r; /* Complexity Weight of 1 */
+ unsigned int Msub_32_32; /* Complexity Weight of 1 */
+ unsigned int Msub_32_32_r; /* Complexity Weight of 1 */
+#endif /* #ifdef ENH_32_BIT_OPERATOR */
+
+#ifdef ENH_U_32_BIT_OPERATOR
+ unsigned int UL_addNs; /* Complexity Weight of 1 */
+ unsigned int UL_subNs; /* Complexity Weight of 1 */
+ unsigned int UL_Mpy_32_32; /* Complexity Weight of 1 */
+ unsigned int Mpy_32_32_uu; /* Complexity Weight of 2 */
+ unsigned int Mpy_32_16_uu; /* Complexity Weight of 2 */
+ unsigned int norm_ul_float; /* Complexity Weight of 1 */
+ unsigned int UL_deposit_l; /* Complexity Weight of 1 */
+#endif /* #ifdef ENH_U_32_BIT_OPERATOR */
+
+#ifdef CONTROL_CODE_OPS
+ unsigned int LT_16; /* Complexity Weight of 1 */
+ unsigned int GT_16; /* Complexity Weight of 1 */
+ unsigned int LE_16; /* Complexity Weight of 1 */
+ unsigned int GE_16; /* Complexity Weight of 1 */
+ unsigned int EQ_16; /* Complexity Weight of 1 */
+ unsigned int NE_16; /* Complexity Weight of 1 */
+ unsigned int LT_32; /* Complexity Weight of 1 */
+ unsigned int GT_32; /* Complexity Weight of 1 */
+ unsigned int LE_32; /* Complexity Weight of 1 */
+ unsigned int GE_32; /* Complexity Weight of 1 */
+ unsigned int EQ_32; /* Complexity Weight of 1 */
+ unsigned int NE_32; /* Complexity Weight of 1 */
+ unsigned int LT_64; /* Complexity Weight of 1 */
+ unsigned int GT_64; /* Complexity Weight of 1 */
+ unsigned int LE_64; /* Complexity Weight of 1 */
+ unsigned int GE_64; /* Complexity Weight of 1 */
+ unsigned int EQ_64; /* Complexity Weight of 1 */
+ unsigned int NE_64; /* Complexity Weight of 1 */
+
+#endif /* #ifdef CONTROL_CODE_OPS */
+} BASIC_OP;
+
+#ifdef WMOPS
+extern BASIC_OP *multiCounter;
+extern unsigned int currCounter;
+extern long funcid_total_wmops_at_last_call_to_else;
+extern char func_name_where_last_call_to_else_occurred[];
+
+long TotalWeightedOperation( unsigned int counterId );
+long DeltaWeightedOperation( unsigned int counterId );
+void Reset_BASOP_WMOPS_counter( unsigned int counterId );
+
+#endif
+
+/*****************************************************************************
+ *
+ * Function Name : FOR
+ *
+ * Purpose :
+ *
+ * The macro FOR should be used instead of the 'for' C statement.
+ * The complexity is independent of the number of loop iterations that are
+ * performed.
+ *
+ * Complexity weight : 3 (regardless of number of iterations).
+ *
+ *****************************************************************************/
+#ifndef WMOPS
+#define FOR( a ) for ( a )
+
+#else /* ifndef WMOPS */
+#define FOR( a ) \
+ if ( incrFor(), 0 ) \
+ ; \
+ else \
+ for ( a )
+
+static __inline void incrFor( void )
+{
+ multiCounter[currCounter].For++;
+}
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : WHILE
+ *
+ * Purpose :
+ *
+ * The macro WHILE should be used instead of the 'while' C statement.
+ * The complexity is proportional to the number of loop iterations that
+ * are performed.
+ *
+ * Complexity weight : 4 x 'number of loop iterations'.
+ *
+ *****************************************************************************/
+#ifndef WMOPS
+#define WHILE( a ) while ( a )
+
+#else /* ifndef WMOPS */
+#define WHILE( a ) while ( incrWhile(), a )
+
+static __inline void incrWhile( void )
+{
+ multiCounter[currCounter].While++;
+}
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : DO
+ *
+ * Purpose :
+ *
+ * The macro DO should be used instead of the 'do' C statement.
+ *
+ * Complexity weight : 0 (complexity counted by WHILE macro).
+ *
+ *****************************************************************************/
+#ifndef WMOPS
+#define DO do
+
+#else /* ifndef WMOPS */
+#define DO do
+
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : IF
+ *
+ * Purpose :
+ *
+ * The macro IF should :
+ *
+ * - not be used when :
+ * - the 'if' structure does not have any 'else if' nor 'else' statement
+ * - and it conditions only one DSP basic operations.
+ *
+ * - be used instead of the 'if' C statement in every other case :
+ * - when there is an 'else' or 'else if' statement,
+ * - or when the 'if' conditions several DSP basic operations,
+ * - or when the 'if' conditions a function call.
+ *
+ * Complexity weight : 3
+ *
+ *****************************************************************************/
+
+#ifndef WMOPS
+#define IF( a ) if ( a )
+#else /* ifndef WMOPS */
+#define IF( a ) if ( incrIf( __func__ ), a )
+void incrIf( const char *func_name );
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : ELSE
+ *
+ * Purpose :
+ *
+ * The macro ELSE should be used instead of the 'else' C statement.
+ *
+ * Complexity weight : 3
+ *
+ *****************************************************************************/
+
+#ifndef WMOPS
+#define ELSE else
+#else /* ifndef WMOPS */
+#define ELSE else if ( incrElse( __func__ ), 0 ); else
+void incrElse( const char *func_name );
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : SWITCH
+ *
+ * Purpose :
+ *
+ * The macro SWITCH should be used instead of the 'switch' C statement.
+ *
+ * Complexity weight : 6
+ *
+ *****************************************************************************/
+#ifndef WMOPS
+#define SWITCH( a ) switch ( a )
+
+#else /* ifndef WMOPS */
+#define SWITCH( a ) switch ( incrSwitch(), a )
+
+static __inline void incrSwitch( void )
+{
+ multiCounter[currCounter].Switch++;
+}
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : CONTINUE
+ *
+ * Purpose :
+ *
+ * The macro CONTINUE should be used instead of the 'continue' C statement.
+ *
+ * Complexity weight : 2
+ *
+ *****************************************************************************/
+#ifndef WMOPS
+#define CONTINUE continue
+
+#else /* ifndef WMOPS */
+#define CONTINUE \
+ if ( incrContinue(), 0 ) \
+ ; \
+ else \
+ continue
+
+static __inline void incrContinue( void )
+{
+ multiCounter[currCounter].Continue++;
+}
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : BREAK
+ *
+ * Purpose :
+ *
+ * The macro BREAK should be used instead of the 'break' C statement.
+ *
+ * Complexity weight : 2
+ *
+ *****************************************************************************/
+#ifndef WMOPS
+#define BREAK break
+
+#else /* ifndef WMOPS */
+#define BREAK \
+ if ( incrBreak(), 0 ) \
+ ; \
+ else \
+ break
+
+static __inline void incrBreak( void )
+{
+ multiCounter[currCounter].Break++;
+}
+#endif /* ifndef WMOPS */
+
+
+/*****************************************************************************
+ *
+ * Function Name : GOTO
+ *
+ * Purpose :
+ *
+ * The macro GOTO should be used instead of the 'goto' C statement.
+ *
+ * Complexity weight : 2
+ *
+ *****************************************************************************/
+#ifndef WMOPS
+#define GOTO goto
+
+#else /* ifndef WMOPS */
+#define GOTO \
+ if ( incrGoto(), 0 ) \
+ ; \
+ else \
+ goto
+
+static __inline void incrGoto( void )
+{
+ multiCounter[currCounter].Goto++;
+}
+#endif /* ifndef WMOPS */
+
+
+#ifdef CONTROL_CODE_OPS
+
+extern int LT_16( short var1, short var2 );
+extern int GT_16( short var1, short var2 );
+extern int LE_16( short var1, short var2 );
+extern int GE_16( short var1, short var2 );
+extern int EQ_16( short var1, short var2 );
+extern int NE_16( short var1, short var2 );
+
+extern int LT_32( int L_var1, int L_var2 );
+extern int GT_32( int L_var1, int L_var2 );
+extern int LE_32( int L_var1, int L_var2 );
+extern int GE_32( int L_var1, int L_var2 );
+extern int EQ_32( int L_var1, int L_var2 );
+extern int NE_32( int L_var1, int L_var2 );
+
+extern int LT_64( long long int L64_var1, long long int L64_var2 );
+extern int GT_64( long long int L64_var1, long long int L64_var2 );
+extern int LE_64( long long int L64_var1, long long int L64_var2 );
+extern int GE_64( long long int L64_var1, long long int L64_var2 );
+extern int EQ_64( long long int L64_var1, long long int L64_var2 );
+extern int NE_64( long long int L64_var1, long long int L64_var2 );
+
+#endif /* #ifdef CONTROL_CODE_OPS */
+
+
#endif /* WMOPS_H */
diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c
index cf2b3f7114ad7ccd86faae0d401a5f78e3184776..20f7d297d739e3030ff5c8bdb468b1b7c12a6097 100644
--- a/lib_dec/dec_tcx_fx.c
+++ b/lib_dec/dec_tcx_fx.c
@@ -13,6 +13,7 @@
#include "math.h"
#include "ivas_prot.h"
#include "ivas_prot_fx.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_com_fx.h"
extern const Word16 T_DIV_L_Frame[]; /*0Q15 * 2^-7 */
diff --git a/lib_dec/ivas_agc_dec_fx.c b/lib_dec/ivas_agc_dec_fx.c
index cad6ae2bf9aec929e4e3b419f4ba071fa2597922..8996f087d79a860e574d6b23a6fa30623b42bb68 100644
--- a/lib_dec/ivas_agc_dec_fx.c
+++ b/lib_dec/ivas_agc_dec_fx.c
@@ -31,14 +31,14 @@
*******************************************************************************************************/
#include
+#include
+#include
#include "options.h"
-
#include "prot.h"
#include "prot_fx.h"
#include "ivas_prot.h"
#include "ivas_prot_fx.h"
-#include
-#include
+#include "rom_com.h"
#include "wmc_auto.h"
diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c
index 1075cb682118036ab350e3e79dccd1a7341604fd..35844b5e53d3dd214665bfcf932501ccb765daaf 100644
--- a/lib_dec/ivas_init_dec.c
+++ b/lib_dec/ivas_init_dec.c
@@ -30,16 +30,17 @@
*******************************************************************************************************/
+#include
+#include
+#include
#include "options.h"
#include "ivas_cnst.h"
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_stat_enc.h"
#include "prot.h"
-#include
-#include
-#include
#include "wmc_auto.h"
#include "prot_fx.h"
#include "ivas_prot_fx.h"
diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c
index e118a3d1544ff13632a12b2cba9245c5effea926..9514e5e2a13cf92647264eae718bfc698d9789ff 100644
--- a/lib_dec/ivas_ism_param_dec.c
+++ b/lib_dec/ivas_ism_param_dec.c
@@ -37,6 +37,7 @@
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
#include "prot.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_dec.h"
#include "wmc_auto.h"
diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c
index 999eae9aa2f384b455d36744108c35867dc5ae23..19ee1e68a54f1ed10ef9e29e25eb9526d2b433cf 100644
--- a/lib_dec/ivas_masa_dec.c
+++ b/lib_dec/ivas_masa_dec.c
@@ -31,16 +31,17 @@
*******************************************************************************************************/
#include
-#include "options.h"
#include
+#include
+#include "options.h"
#include "ivas_cnst.h"
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_stat_dec.h"
#include "prot.h"
#include "prot_fx.h"
-#include
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#include "ivas_rom_com_fx.h"
diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c
index 86bcc71f9fbefb480aaf6f368af2d2a68ce10ebc..c1bf455a5f60063f955fff29a969e716e2b9aba9 100644
--- a/lib_dec/ivas_mc_paramupmix_dec.c
+++ b/lib_dec/ivas_mc_paramupmix_dec.c
@@ -31,8 +31,8 @@
*******************************************************************************************************/
#include
-#include "options.h"
#include
+#include "options.h"
#include "cnst.h"
#include "prot.h"
#include "prot_fx.h"
@@ -40,6 +40,7 @@
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
#include "ivas_cnst.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_dec.h"
#include "math.h"
diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c
index 09bec559913c3bceeb66ddf44617b6596a56ca86..e27bc063809994fe3b4b035f7e2632c97890831d 100644
--- a/lib_dec/ivas_sba_dec.c
+++ b/lib_dec/ivas_sba_dec.c
@@ -38,6 +38,7 @@
#include "prot.h"
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_dec.h"
#include
diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
index 75e0156d87bd87a83df6ac10911b30da12f95da7..216888fbe0a87dbe439801dfacb57441400b2bad 100644
--- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
+++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
@@ -37,6 +37,7 @@
#include "prot_fx.h"
#include "ivas_prot.h"
#include "ivas_prot_fx.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_com_fx.h"
#include "ivas_rom_dec.h"
diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c
index 8d8df9e867bc2203b97d475fe3132e0e027d09c6..fdace42d822ae5e85b084285873d70df63bad336 100644
--- a/lib_dec/ivas_spar_decoder.c
+++ b/lib_dec/ivas_spar_decoder.c
@@ -39,6 +39,7 @@
#include "string.h"
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
+#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_dec.h"
#include "ivas_stat_com.h"
diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c
index a65f36f41ebc6115e4234c268e6c532a210377aa..6d4fc967ea10795e9a872894a1396557a3c0e7f7 100644
--- a/lib_dec/ivas_stereo_mdct_stereo_dec.c
+++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c
@@ -32,11 +32,12 @@
#include
#include
-#include "options.h"
#include
+#include "options.h"
#include "ivas_cnst.h"
#include "ivas_prot.h"
#include "prot.h"
+#include "rom_com.h"
#include "wmc_auto.h"
#include "prot_fx.h"
#include "ivas_prot_fx.h"
diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c
index a6c56837d8790f86fa896513c25938584c11bf30..b6eeaf0e1856fe28e137b3ae6a02871179854dca 100644
--- a/lib_dec/jbm_pcmdsp_similarityestimation.c
+++ b/lib_dec/jbm_pcmdsp_similarityestimation.c
@@ -40,6 +40,7 @@
#include
#include
#include
+#include
#include "options.h"
#include "wmc_auto.h"
#include "basop_util.h"
diff --git a/lib_dec/jbm_pcmdsp_window.c b/lib_dec/jbm_pcmdsp_window.c
index d3820ddddcdc850ea9ae27855cb8d1f6c1002f9f..ea15ab7a1f62ff8357cc4eae0284c88a7cd45632 100644
--- a/lib_dec/jbm_pcmdsp_window.c
+++ b/lib_dec/jbm_pcmdsp_window.c
@@ -40,6 +40,7 @@
#include "options.h"
#include "jbm_pcmdsp_window.h"
#include "cnst.h"
+#include "basop_util.h"
#include "wmc_auto.h"
/*-----------------------------------------------------------------------*
diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c
index 3dccb3c87db0eb2e1d7c10006fa60e730c271984..b63668b3874d3c812333b36f1af70fcba5691a06 100644
--- a/lib_dec/lib_dec_fx.c
+++ b/lib_dec/lib_dec_fx.c
@@ -29,22 +29,25 @@
the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
+
#include "lib_dec.h"
+#include
+#include
+#include
#include "ivas_cnst.h"
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
#include "prot.h"
#include "ivas_prot_fx.h"
#include "prot_fx.h"
+
#include "jbm_jb4sb.h"
#include "jbm_pcmdsp_apa.h"
#include "jbm_pcmdsp_fifo.h"
-#include
-#include
-#include
#include "wmc_auto.h"
#define INV_1000_Q31 2147484 /*1/1000 IN Q31*/
+
/*---------------------------------------------------------------------*
* Local structs
*---------------------------------------------------------------------*/
diff --git a/lib_dec/rom_dec.c b/lib_dec/rom_dec.c
index 6e33e724f8acec1d42667e93307ac026b0d8184a..787966f729af56f474673502dad9aecaff4fbaf1 100644
--- a/lib_dec/rom_dec.c
+++ b/lib_dec/rom_dec.c
@@ -37,6 +37,7 @@
#include
#include "options.h"
#include "cnst.h"
+#include "typedef.h"
#include "wmc_auto.h"
/* clang-format off */
diff --git a/lib_dec/rom_dec.h b/lib_dec/rom_dec.h
index f6d35b43f51d94084bd279c3259d5f4f13f30093..f057b804a6080d3830eee5c671cab44a4453aa66 100644
--- a/lib_dec/rom_dec.h
+++ b/lib_dec/rom_dec.h
@@ -40,6 +40,7 @@
#include
#include "options.h"
#include "cnst.h"
+#include "typedef.h"
extern const Word16 h_low_fx[5]; // Q15
extern const Word16 inv_sqi[15]; // Q15
diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c
index 3bde91b035642dc095efe0086f8ff602646c16d4..d35a443d82a1d25aa937d8e2012a071d0f676c1f 100644
--- a/lib_enc/core_enc_init_fx.c
+++ b/lib_enc/core_enc_init_fx.c
@@ -6,9 +6,8 @@
//#include "prot_fx.h"
//#include "basop_mpy.h"
#include "options.h"
-#include "cnst.h" /* Common constants */
+#include "cnst.h"
#include "stl.h"
-#include "count.h"
#include "basop_util.h"
#include "rom_com_fx.h"
#include "ivas_cnst.h"
diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c
index 761542c4f51decbf9c993c49aeaacdc06705ab13..5caa4d0b991e9bc7000187791799913c5fb00250 100644
--- a/lib_enc/ivas_agc_enc.c
+++ b/lib_enc/ivas_agc_enc.c
@@ -32,11 +32,12 @@
#include
+#include
+#include
#include "options.h"
#include "ivas_prot.h"
#include "prot.h"
-#include
-#include
+#include "rom_com.h"
#include "wmc_auto.h"
#include "prot_fx.h"
#include "ivas_prot_fx.h"
diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c
index 1fb611cfb70ec17daadb49db7518e1600a8f075a..c0db284df22b26359436e906377b1dec6a87f88b 100644
--- a/lib_enc/ivas_core_pre_proc_front.c
+++ b/lib_enc/ivas_core_pre_proc_front.c
@@ -78,7 +78,6 @@ static Word16 get_zero_flag( Word32 arr[], Word16 len )
IF( arr[j] != 0 )
{
return 1;
- BREAK;
}
}
return 0;
diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c
index 69d0f1ab936ae73ea6c4c06b57a716fe761552c4..ca61526c8026a8447ca7afa46514be023645ec1e 100644
--- a/lib_enc/lib_enc.c
+++ b/lib_enc/lib_enc.c
@@ -432,7 +432,6 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects(
BREAK;
default:
return IVAS_ERR_INVALID_MASA_CONFIG;
- BREAK;
}
st_ivas = hIvasEnc->st_ivas;
@@ -733,7 +732,6 @@ ivas_error IVAS_ENC_ConfigureForMasa(
BREAK;
default:
return IVAS_ERR_INVALID_MASA_CONFIG;
- BREAK;
}
hIvasEnc->maxBandwidthUser = max_bwidth_user;
diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c
index 9df21a2001573db739f00716b94511c95fec1ac0..259987bba43611a9f4c89041ea1a1ce51cc65533 100644
--- a/lib_enc/nelp_enc_fx.c
+++ b/lib_enc/nelp_enc_fx.c
@@ -31,7 +31,6 @@
*******************************************************************************************************/
#include
-#include "control.h"
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
#include "prot.h" /* Function prototypes */
diff --git a/lib_enc/rom_enc.c b/lib_enc/rom_enc.c
index e83506b918ebd18d67baa9fe72d787ec023d12da..aabc7deefae8579778101ee7e4615ecdb18b95bd 100644
--- a/lib_enc/rom_enc.c
+++ b/lib_enc/rom_enc.c
@@ -36,6 +36,7 @@
#include
#include "options.h"
+#include "typedef.h"
#include "cnst.h"
#include "wmc_auto.h"
diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c
index 455c858e1770b301b289c399acecafb3c74ca84a..c5fdfec9989d2c4628cad638e88fc2d7dcdaef64 100644
--- a/lib_enc/swb_bwe_enc_lr_fx.c
+++ b/lib_enc/swb_bwe_enc_lr_fx.c
@@ -35,7 +35,7 @@
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "rom_com.h"
-#include "enh32.h"
+#include "stl.h"
#include "prot.h"
/*--------------------------------------------------------------------------*
diff --git a/lib_enc/vlpc_1st_cod_fx.c b/lib_enc/vlpc_1st_cod_fx.c
index cc9592739dae011a0653a3dab05f70514937327c..deddb5023f050e318989567a1101cc9c99a90c54 100644
--- a/lib_enc/vlpc_1st_cod_fx.c
+++ b/lib_enc/vlpc_1st_cod_fx.c
@@ -4,7 +4,6 @@
#include
#include "options.h"
-#include "control.h"
#include "cnst.h"
//#include "prot_fx.h"
#include "rom_com_fx.h"
diff --git a/lib_enc/vlpc_2st_cod_fx.c b/lib_enc/vlpc_2st_cod_fx.c
index 0785e9e6e14a161fc9d2c4c60a3e2944714b4e4e..6334684d25f9fb78871a516aaa4d94fb537afb8d 100644
--- a/lib_enc/vlpc_2st_cod_fx.c
+++ b/lib_enc/vlpc_2st_cod_fx.c
@@ -7,7 +7,6 @@
#include "cnst.h"
#include "options.h"
//#include "prot_fx.h"
-#include "control.h"
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h"
diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c
index f0ac32e8ba04cb0de7facc96c5437eebc3ccc208..d8cfec1d133dbcce6d623e7edda4b0229afb9811 100644
--- a/lib_rend/ivas_crend.c
+++ b/lib_rend/ivas_crend.c
@@ -31,24 +31,23 @@
*******************************************************************************************************/
#include
+#include
#include "options.h"
#include "prot.h"
#include "ivas_prot.h"
#include "ivas_prot_rend.h"
#include "ivas_cnst.h"
#include "ivas_rom_rend.h"
-#include
#include "ivas_rom_binaural_crend_head.h"
#include "ivas_stat_rend.h"
#include "lib_rend.h"
+#include "prot_fx.h"
+#include "ivas_prot_fx.h"
#include "wmc_auto.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
-#include "control.h"
-#include "prot_fx.h"
-#include "ivas_prot_fx.h"
#define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) )
#define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) )
diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c
index 6ead07ee06ed9fe0d692a1bb9903b8eec26a8786..204ba19967d227778b32b82e54fda3d659f163be 100644
--- a/lib_rend/ivas_dirac_dec_binaural_functions.c
+++ b/lib_rend/ivas_dirac_dec_binaural_functions.c
@@ -31,9 +31,9 @@
*******************************************************************************************************/
#include
-#include "options.h"
#include
#include
+#include "options.h"
#include "prot.h"
#include "prot_fx.h"
#include "ivas_prot.h"
diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c
index 3e3c1515e82aac4c460492848255aaeaccbc8ae2..b1499839c1fee33c5b1fa03c237c4a5301a0a34d 100644
--- a/lib_rend/ivas_reverb_filter_design.c
+++ b/lib_rend/ivas_reverb_filter_design.c
@@ -39,7 +39,6 @@
#include
#include
#include "wmc_auto.h"
-#include "control.h"
/*------------------------------------------------------------------------------------------*