Ignore:
Timestamp:
Apr 18, 2009 3:15:34 PM (11 years ago)
Author:
bennylp
Message:

More ticket #774: compilation error for VS8 and make build system due to last modifications in libg7221codec and pjmedia_test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/third_party/g7221/common/stl-files/count.h

    r2616 r2617  
    1 /* 
    2  =========================================================================== 
    3  COUNT.H 
    4  ~~~~~~~ 
    5  
    6  Prototypes and definitions for counting operations 
    7  
    8  These functions, and the ones in basop32.h, makes it possible to 
    9  measure the wMOPS of a codec. 
    10  
    11  All functions in this file, and in basop32.h, updates a structure 
    12  so that it will be possible the see how many calls to add, mul mulAdd 
    13  ... that the code made, and estimate the wMOPS (and MIPS) for a 
    14  sertain part of code 
    15  
    16  It is also possible to measure the wMOPS separatly for different 
    17  parts of the codec. 
    18  
    19  This is done by creating a counter group (getCounterId) for each part 
    20  of the code that one wants a separte measure for. Before a part of 
    21  the code is executed a call to the "setCounter" function is needed to 
    22  identify which counter group to use. 
    23  
    24  Currently there is a limit of 255 different counter groups. 
    25  
    26  In the end of this file there is a pice of code illustration how the 
    27  functions can be used. 
    28  
    29  History 
    30  ~~~~~~~ 
    31  09.Aug.1999 V1.0.0 Input to UGST from ETSI AMR (count.h);  
    32  26.Jan.2000 V1.1.0 Added counter entries for G.723.1's  
    33                     L_mls(), div_l(), i_mult() [from basop32.c] 
    34  05.Jul.2000 V1.2.0 Added counter entries for 32bit shiftless  
    35                     operators L_mult0(), L_mac0(), L_msu0() 
    36  =========================================================================== 
    37 */ 
    38 #if 0 
     1/* $Id: config.h 2427 2009-01-22 20:30:32Z bennylp $ */ 
     2/*  
     3 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) 
     4 * 
     5 * This program is free software; you can redistribute it and/or modify 
     6 * it under the terms of the GNU General Public License as published by 
     7 * the Free Software Foundation; either version 2 of the License, or 
     8 * (at your option) any later version. 
     9 * 
     10 * This program is distributed in the hope that it will be useful, 
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 * GNU General Public License for more details. 
     14 * 
     15 * You should have received a copy of the GNU General Public License 
     16 * along with this program; if not, write to the Free Software 
     17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
     18 */ 
    3919#ifndef COUNT_H 
    40 #define COUNT_H "$Id $" 
    41  
    42 #define MAXCOUNTERS 256 
    43  
    44 int getCounterId(char *objectName); 
    45 /* 
    46  * Create a counter group, the "objectname" will be used when printing 
    47  * statistics for this counter group. 
    48  * 
    49  * Returns 0 if no more counter groups are available. 
    50  */ 
    51  
    52 void setCounter(int counterId); 
    53 /* 
    54  * Defines which counter group to use, default is zero. 
    55  */ 
    56  
    57 void Init_WMOPS_counter (void); 
    58 /* 
    59  * Initiates the current counter group. 
    60  */ 
    61  
    62 void Reset_WMOPS_counter (void); 
    63 /* 
    64  * Resets the current counter group. 
    65  */ 
    66  
    67 void WMOPS_output (Word16 notPrintWorstWorstCase); 
    68 /* 
    69  * Prints the statistics to the screen, if the argument if non zero 
    70  * the statistics for worst worst case will not be printed. This is typically 
    71  * done for dtx frames. 
    72  * 
    73  */ 
    74  
    75 PJ_INLINE(Word32) fwc (void) 
    76 { 
    77 #if WMOPS 
    78     Word32 tot; 
    79  
    80     tot = DeltaWeightedOperation (); 
    81     if (tot > wc[currCounter][funcid[currCounter]]) 
    82         wc[currCounter][funcid[currCounter]] = tot; 
    83  
    84     funcid[currCounter]++; 
    85  
    86     return (tot); 
    87 #else 
    88     return 0; /* Dummy */ 
    89 #endif 
    90 } 
    91  
    92 /* 
    93  * worst worst case counter. 
    94  * 
    95  * This function calculates the worst possible case that can be reached. 
    96  * 
    97  * This is done by calling this function for each subpart of the calculations 
    98  * for a frame. This function then stores the maximum wMOPS for each part. 
    99  * 
    100  * The WMOPS_output function add together all parts and presents the sum. 
    101  */ 
    102 PJ_INLINE(void) move16 (void) 
    103 { 
    104 #if WMOPS 
    105     multiCounter[currCounter].DataMove16++; 
    106 #endif 
    107 } 
    108  
    109 PJ_INLINE(void) move32 (void) 
    110 { 
    111 #if WMOPS 
    112     multiCounter[currCounter].DataMove32++; 
    113 #endif 
    114 } 
    115  
    116 PJ_INLINE(void )logic16 (void) 
    117 { 
    118 #if WMOPS 
    119     multiCounter[currCounter].Logic16++; 
    120 #endif 
    121 } 
    122  
    123 PJ_INLINE(void) logic32 (void) 
    124 { 
    125 #if WMOPS 
    126     multiCounter[currCounter].Logic32++; 
    127 #endif 
    128 } 
    129  
    130 PJ_INLINE(void) test (void) 
    131 { 
    132 #if WMOPS 
    133     multiCounter[currCounter].Test++; 
    134 #endif 
    135 } 
    136  
    137  
    138 /* 
    139  * The functions above increases the corresponding operation counter for 
    140  * the current counter group. 
    141  */ 
    142  
    143 typedef struct 
    144 { 
    145     Word32 add;        /* Complexity Weight of 1 */ 
    146     Word32 sub; 
    147     Word32 abs_s; 
    148     Word32 shl; 
    149     Word32 shr; 
    150     Word32 extract_h; 
    151     Word32 extract_l; 
    152     Word32 mult; 
    153     Word32 L_mult; 
    154     Word32 negate; 
    155     Word32 round; 
    156     Word32 L_mac; 
    157     Word32 L_msu; 
    158     Word32 L_macNs; 
    159     Word32 L_msuNs; 
    160     Word32 L_add;      /* Complexity Weight of 2 */ 
    161     Word32 L_sub; 
    162     Word32 L_add_c; 
    163     Word32 L_sub_c; 
    164     Word32 L_negate; 
    165     Word32 L_shl; 
    166     Word32 L_shr; 
    167     Word32 mult_r; 
    168     Word32 shr_r; 
    169     Word32 shift_r; 
    170     Word32 mac_r; 
    171     Word32 msu_r; 
    172     Word32 L_deposit_h; 
    173     Word32 L_deposit_l; 
    174     Word32 L_shr_r;    /* Complexity Weight of 3 */ 
    175     Word32 L_shift_r; 
    176     Word32 L_abs; 
    177     Word32 L_sat;      /* Complexity Weight of 4 */ 
    178     Word32 norm_s;     /* Complexity Weight of 15 */ 
    179     Word32 div_s;      /* Complexity Weight of 18 */ 
    180     Word32 norm_l;     /* Complexity Weight of 30 */ 
    181     Word32 DataMove16; /* Complexity Weight of 1 */ 
    182     Word32 DataMove32; /* Complexity Weight of 2 */ 
    183     Word32 Logic16;    /* Complexity Weight of 1 */ 
    184     Word32 Logic32;    /* Complexity Weight of 2 */ 
    185     Word32 Test;       /* Complexity Weight of 2 */ 
    186                        /* Counters for G.723.1 basic operators*/ 
    187     Word32 L_mls;      /* Complexity Weight of 1 */ 
    188     Word32 div_l;      /* Complexity Weight of 1 */ 
    189     Word32 i_mult;     /* Complexity Weight of 1 */ 
    190     Word32 L_mult0;    /* Complexity Weight of 1 */ 
    191     Word32 L_mac0;     /* Complexity Weight of 1 */ 
    192     Word32 L_msu0;     /* Complexity Weight of 1 */ 
    193                        /* Counters for G.722.1 basic operators*/ 
    194     Word32 LU_shl;     /* Complexity Weight of 1 */ 
    195     Word32 LU_shr;     /* Complexity Weight of 1 */ 
    196 } 
    197 BASIC_OP; 
    198  
    199 #ifdef THISISANEXAMPLE_0123456789 
    200 /* 
    201   ----------------------------------------------------------------------- 
    202   Example of how count.h could be used. 
    203   
    204   In the example below it is assumed that the init_OBJECT functions 
    205   does not use any calls to counter.h or basic_op.h. If this is the 
    206   case a call to the function Reset_WMOPS_counter() must be done after 
    207   each call to init_OBJECT if these operations is not to be included 
    208   in the statistics. 
    209   ----------------------------------------------------------------------- 
    210 */ 
    211  
    212 int main() 
    213 {  
    214   int spe1Id,spe2Id,cheId; 
    215   
    216   /* initiate counters and objects */ 
    217   spe1Id=getCounterId("Spe 5k8");  
    218   setCounter(spe1Id);  
    219   Init_WMOPS_counter ();  
    220   init_spe1(...); 
    221   
    222   spe2Id=getCounterId("Spe 12k2");  
    223   setCounter(spe2Id);  
    224   Init_WMOPS_counter ();  
    225   init_spe2(...); 
    226   
    227   cheId=getCounterId("Channel encoder");  
    228   setCounter(cheId);  
    229   Init_WMOPS_counter ();  
    230   init_che(...);  
    231   ... 
    232   
    233   while(data) 
    234   {  
    235     test();             /* Note this call to test(); */ 
    236     if(useSpe1) 
    237       setCounter(spe1Id);  
    238     else  
    239       setCounter(spe2Id);  
    240     Reset_WMOPS_counter(); 
    241     speEncode(...); 
    242     WMOPS_output(0);    /* Normal routine for displaying WMOPS info */ 
    243      
    244     setCounter(cheId);  
    245     Reset_WMOPS_counter(); 
    246     preChannelInter(...); fwc(); /* Note the call to fwc() for each part */ 
    247     convolve(...); fwc();        /* of the channel encoder. */ 
    248     interleave(...); fwc(); 
    249     WMOPS_output(0);    /* Normal routine for displaying WMOPS info */ 
    250   } 
    251 } 
    252 #endif /* Example */ 
    253  
    254 #endif /* COUNT_H */ 
    255 #else 
     20#define COUNT_H 
    25621 
    25722#define move16() 
Note: See TracChangeset for help on using the changeset viewer.