⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 count.c

📁 最新的ITU-T的宽带语音编解码标准G.729.1,是对原先的G.729的最好的调整.码流输出速率可以进行自适应调整.满足未来通信要求.希望对大家有所帮助.
💻 C
📖 第 1 页 / 共 2 页
字号:
#if WMOPS    Word16 i;    Word32 tot, *ptr, *ptr2;    tot = 0;    ptr = (Word32 *) &multiCounter[currCounter];    ptr2 = (Word32 *) &op_weight;    for (i = 0; i < (sizeof (multiCounter[currCounter])/ sizeof (Word32)); i++) {        tot += ((*ptr++) * (*ptr2++));    }    return ((Word32) tot);#else /* ifdef WMOPS */    return 0; /* Dummy */#endif /* ifdef WMOPS */}Word32 DeltaWeightedOperation () {#if 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) {#if 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;    /* initially clear all counters */    WMOPS_clearMultiCounter();    LastWOper[currCounter] = 0;    funcid[currCounter] = 0;    /* Following line is useful for incrIf(), see control.h */    call_occurred = 1;    funcId_where_last_call_to_else_occurred=MAXCOUNTERS;#endif /* ifdef WMOPS */}void Reset_WMOPS_counter (void) {#if WMOPS    Word32 tot = WMOPS_frameStat();            /* increase the frame counter --> a frame is counted WHEN IT BEGINS */    nbframe[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) * FRAME_RATE;        /* clear counter before new frame starts */    WMOPS_clearMultiCounter();    LastWOper[currCounter] = 0;    funcid[currCounter] = 0;           /* new frame, set function id to zero */#endif /* ifdef WMOPS */}Word32 fwc (void) {/* function worst case */#if WMOPS    Word32 tot;    tot = DeltaWeightedOperation ();    if (tot > wc[currCounter][funcid[currCounter]])        wc[currCounter][funcid[currCounter]] = tot;    funcid[currCounter]++;    return (tot);#else /* ifdef WMOPS */    return 0; /* Dummy */#endif /* ifdef WMOPS */}void WMOPS_output (Word16 dtx_mode) {#if 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) * FRAME_RATE);    fprintf (stdout, "%10s:WMOPS=%.3f",	     objectName[currCounter]?objectName[currCounter]:"",	     ((float) tot) * FRAME_RATE);    if (nbframe[currCounter] != 0)        fprintf (stdout, "  Average=%.3f",                 tot_wm / (float) nbframe[currCounter]);        fprintf (stdout, "  WorstCase=%.3f",             ((float) glob_wc[currCounter]) * FRAME_RATE);    /* 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) * FRAME_RATE);    }    fprintf (stdout, " (%d frames)\n", nbframe[currCounter]);    #endif /* ifdef WMOPS */}void generic_WMOPS_output (Word16 dtx_mode, char *test_file_name){#if WMOPS   int		saved_value;   Word16	i;   Word32	tot, tot_wm, tot_wc, *ptr, *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) * FRAME_RATE);         fprintf (WMOPS_file, "\t\t%ld", nbTimeObjectIsCalled[currCounter]);         fprintf (WMOPS_file, "\t%.6f", ((float) tot) * FRAME_RATE);         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]) * FRAME_RATE);         /* 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) * FRAME_RATE);         }         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) * FRAME_RATE);      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) * FRAME_RATE);      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 <(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 = (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) * FRAME_RATE);         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) * FRAME_RATE);      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;#endif /* ifdef WMOPS */}/* end of file */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -