From 2a10087d5e88a05f71c2c3c224e658ec5bbf4fa4 Mon Sep 17 00:00:00 2001 From: Peter Kasting Date: Tue, 9 Jun 2015 17:26:40 -0700 Subject: [PATCH] Manual cleanups following clang-formatting. This primarily addresses two things: * Tab characters still present, mostly in comments * printfs split across multiple lines in a suboptimal way Along the way this fixes a few spelling errors and other minor changes. BUG=none R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/52689004 Cr-Commit-Position: refs/heads/master@{#9406} --- .../codecs/isac/fix/test/test_iSACfixfloat.c | 88 +++---- .../test/ReleaseTest-API/ReleaseTest-API.cc | 212 ++++++--------- .../codecs/isac/main/test/simpleKenny.c | 111 ++++---- .../audio_coding/neteq/test/RTPencode.cc | 247 +++++++----------- 4 files changed, 271 insertions(+), 387 deletions(-) diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c index 218b97bb0c..96688b9fc2 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c @@ -33,7 +33,7 @@ #include #define CLOCKS_PER_SEC 1000 -// FILE *histfile, *ratefile; +// FILE *histfile, *ratefile; /* function for reading audio data from PCM file */ int readframe(int16_t* data, FILE* inp, int length) { @@ -106,7 +106,7 @@ int main(int argc, char* argv[]) { uint16_t streamdata[600]; int16_t speechType[1]; - // int16_t *iSACstruct; + // int16_t* iSACstruct; char version_number[20]; int mode = -1, tmp, nbTest = 0; /*,sss;*/ @@ -147,37 +147,23 @@ int main(int argc, char* argv[]) { printf("./kenny.exe [-I] bottleneck_value infile outfile \n\n"); printf("with:\n"); - printf( - "[-I] : if -I option is specified, the coder " - "will use\n"); - printf( - " an instantaneous Bottleneck value. If " - "not, it\n"); - printf( - " will be an adaptive Bottleneck " - "value.\n\n"); - printf( - "bottleneck_value : the value of the bottleneck provided " - "either\n"); - printf( - " as a fixed value (e.g. 25000) or\n"); - printf( - " read from a file (e.g. " - "bottleneck.txt)\n\n"); - printf("[-m] mode : Mode (encoder - decoder):\n"); - printf( - " : 0 - float - float \n"); - printf( - " : 1 - float - fix \n"); - printf( - " : 2 - fix - float \n"); - printf(" : 3 - fix - fix \n"); - printf("[-PLC] : Test PLC packetlosses\n"); - printf( - "[-NB] num : Test NB interfaces, num=1 encNB, num=2 " - "decNB\n"); - printf("infile : Normal speech input file\n\n"); - printf("outfile : Speech output file\n\n"); + printf("[-I] : If -I option is specified, the coder will use\n"); + printf(" an instantaneous Bottleneck value. If not, it\n"); + printf(" will be an adaptive Bottleneck value.\n\n"); + printf("bottleneck_value: The value of the bottleneck provided either\n"); + printf(" as a fixed value (e.g. 25000) or\n"); + printf(" read from a file (e.g. bottleneck.txt)\n\n"); + printf("[-m] mode : Mode (encoder - decoder):\n"); + printf(" 0 - float - float\n"); + printf(" 1 - float - fix\n"); + printf(" 2 - fix - float\n"); + printf(" 3 - fix - fix\n\n"); + printf("[-PLC] : Test PLC packetlosses\n\n"); + printf("[-NB] num : Test NB interfaces:\n"); + printf(" 1 - encNB\n"); + printf(" 2 - decNB\n\n"); + printf("infile : Normal speech input file\n\n"); + printf("outfile : Speech output file\n\n"); printf("Example usage:\n\n"); printf("./kenny.exe -I bottleneck.txt -m 1 speechIn.pcm speechOut.pcm\n\n"); exit(0); @@ -240,12 +226,12 @@ int main(int argc, char* argv[]) { fscanf(f_bn, "%d", &bottleneck); } - /* Bottleneck is a cosine function - * Matlab code for writing the bottleneck file: - * BottleNeck_10ms = 20e3 + 10e3 * cos((0:5999)/5999*2*pi); - * fid = fopen('bottleneck.txt', 'wb'); - * fprintf(fid, '%d\n', BottleNeck_10ms); fclose(fid); - */ + /* Bottleneck is a cosine function + * Matlab code for writing the bottleneck file: + * BottleNeck_10ms = 20e3 + 10e3 * cos((0:5999)/5999*2*pi); + * fid = fopen('bottleneck.txt', 'wb'); + * fprintf(fid, '%d\n', BottleNeck_10ms); fclose(fid); + */ } } else { printf("\nfixed bottleneck rate of %d bits/s\n\n", bottleneck); @@ -284,9 +270,6 @@ int main(int argc, char* argv[]) { /* Initialize the ISAC and BN structs */ WebRtcIsac_create(&ISAC_main_inst); - /* WebRtcIsacfix_AssignSize(&sss); - iSACstruct=malloc(sss); - WebRtcIsacfix_Assign(&ISACFIX_main_inst,iSACstruct);*/ WebRtcIsacfix_Create(&ISACFIX_main_inst); BN_data.send_time = 0; @@ -311,7 +294,7 @@ int main(int argc, char* argv[]) { /* exit if returned with error */ errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); printf("\n\n Error in initialization: %d.\n\n", errtype); - // exit(EXIT_FAILURE); + // exit(EXIT_FAILURE); } } @@ -328,7 +311,7 @@ int main(int argc, char* argv[]) { /* exit if returned with error */ errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); printf("\n\n Error in initialization: %d.\n\n", errtype); - // exit(EXIT_FAILURE); + // exit(EXIT_FAILURE); } } @@ -424,22 +407,23 @@ int main(int argc, char* argv[]) { /* exit if returned with error */ errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst); printf("\n\nError in encoder: %d.\n\n", errtype); - // exit(EXIT_FAILURE); + // exit(EXIT_FAILURE); } } else if (mode == 2 || mode == 3) { /* iSAC encoding */ - if (nbTest != 1) + if (nbTest != 1) { stream_len = WebRtcIsacfix_Encode(ISACFIX_main_inst, shortdata, (uint8_t*)streamdata); - else + } else { stream_len = WebRtcIsacfix_EncodeNb(ISACFIX_main_inst, shortdata, streamdata); + } if (stream_len < 0) { /* exit if returned with error */ errtype = WebRtcIsacfix_GetErrorCode(ISACFIX_main_inst); printf("\n\nError in encoder: %d.\n\n", errtype); - // exit(EXIT_FAILURE); + // exit(EXIT_FAILURE); } } @@ -608,8 +592,8 @@ int main(int argc, char* argv[]) { } #ifdef _DEBUG - printf("\n\ntotal bits = %d bits", totalbits); - printf("\nmeasured average bitrate = %0.3f kbits/s", + printf("\n\ntotal bits = %d bits", totalbits); + printf("\nmeasured average bitrate = %0.3f kbits/s", (double)totalbits * (FS / 1000) / totalsmpls); printf("\n"); #endif /* _DEBUG */ @@ -628,8 +612,8 @@ int main(int argc, char* argv[]) { WebRtcIsac_Free(ISAC_main_inst); WebRtcIsacfix_Free(ISACFIX_main_inst); - // fclose(histfile); - // fclose(ratefile); + // fclose(histfile); + // fclose(ratefile); return 0; } diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc index 1a20ca5878..f6bfcdcd83 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc +++ b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc @@ -23,15 +23,13 @@ #include "utility.h" /* Defines */ -#define SEED_FILE \ - "randseed.txt" /* Used when running decoder on garbage data */ -#define MAX_FRAMESAMPLES \ - 960 /* max number of samples per frame \ - (= 60 ms frame & 16 kHz) or \ - (= 30 ms frame & 32 kHz) */ -#define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */ +#define SEED_FILE "randseed.txt" /* Used when running decoder on garbage data */ +#define MAX_FRAMESAMPLES 960 /* max number of samples per frame + (= 60 ms frame & 16 kHz) or + (= 30 ms frame & 32 kHz) */ +#define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */ #define SWBFRAMESAMPLES_10ms 320 -//#define FS 16000 /* sampling frequency (Hz) */ +//#define FS 16000 /* sampling frequency (Hz) */ #ifdef WIN32 #define CLOCKS_PER_SEC 1000 /* Runtime statistics */ @@ -121,80 +119,56 @@ int main(int argc, char* argv[]) { printf("Usage:\n\n"); printf("./kenny.exe [-I] bottleneck_value infile outfile \n\n"); printf("with:\n"); - printf( - "[-FS num] : sampling frequency in kHz, valid values are 16 & " - "32,\n"); - printf(" with 16 as default.\n"); - printf( - "[-I] : if -I option is specified, the coder will use\n"); - printf( - " an instantaneous Bottleneck value. If not, it\n"); - printf(" will be an adaptive Bottleneck value.\n\n"); - printf("[-assign] : Use Assign API.\n"); - printf("[-B num] : the value of the bottleneck provided either\n"); - printf( - " as a fixed value in bits/sec (e.g. 25000) or\n"); - printf(" read from a file (e.g. bottleneck.txt)\n\n"); - printf( - "[-INITRATE num] : Set a new value for initial rate. Note! Only used " - "in \n"); - printf(" adaptive mode.\n\n"); - printf( - "[-FL num] : Set (initial) frame length in msec. Valid length " - "are \n"); - printf(" 30 and 60 msec.\n\n"); - printf( - "[-FIXED_FL] : Frame length will be fixed to initial value.\n\n"); - printf( - "[-MAX num] : Set the limit for the payload size of iSAC in " - "bytes. \n"); - printf(" Minimum 100 maximum 400.\n\n"); - printf( - "[-MAXRATE num] : Set the maxrate for iSAC in bits per second. \n"); - printf(" Minimum 32000, maximum 53400.\n\n"); - printf( - "[-F num] : if -F option is specified, the test function\n"); - printf( - " will run the iSAC API fault scenario specified by " - "the\n"); - printf(" supplied number.\n"); - printf( - " F 1 - Call encoder prior to init encoder call\n"); - printf( - " F 2 - Call decoder prior to init decoder call\n"); - printf(" F 3 - Call decoder prior to encoder call\n"); - printf( - " F 4 - Call decoder with a too short coded " - "sequence\n"); - printf( - " F 5 - Call decoder with a too long coded " - "sequence\n"); - printf(" F 6 - Call decoder with random bit stream\n"); - printf( - " F 7 - Call init encoder/decoder at random during " - "a call\n"); - printf( - " F 8 - Call encoder/decoder without having " - "allocated memory \n"); - printf(" for encoder/decoder instance\n"); - printf(" F 9 - Call decodeB without calling decodeA\n"); - printf(" F 10 - Call decodeB with garbage data\n"); - printf("[-PL num] : if -PL option is specified \n"); - printf( - "[-T rate file] : test trans-coding with target bottleneck 'rate' " - "bits/sec\n"); - printf(" the output file is written to 'file'\n"); - printf( - "[-LOOP num] : number of times to repeat coding the input file " - "for stress testing\n"); - // printf("[-CE num] : Test of APIs used by Conference Engine.\n"); - // printf(" CE 1 - getNewBitstream, getBWE \n"); - // printf(" (CE 2 - RESERVED for transcoding)\n"); - // printf(" CE 3 - getSendBWE, setSendBWE. \n\n"); - // printf("-L filename : write the logging info into file + printf("[-FS num] : sampling frequency in kHz, valid values are\n"); + printf(" 16 & 32, with 16 as default.\n"); + printf("[-I] : if -I option is specified, the coder will use\n"); + printf(" an instantaneous Bottleneck value. If not, it\n"); + printf(" will be an adaptive Bottleneck value.\n"); + printf("[-assign] : Use Assign API.\n"); + printf("[-B num] : the value of the bottleneck provided either\n"); + printf(" as a fixed value in bits/sec (e.g. 25000) or\n"); + printf(" read from a file (e.g. bottleneck.txt)\n"); + printf("[-INITRATE num] : Set a new value for initial rate. Note! Only\n"); + printf(" used in adaptive mode.\n"); + printf("[-FL num] : Set (initial) frame length in msec. Valid\n"); + printf(" lengths are 30 and 60 msec.\n"); + printf("[-FIXED_FL] : Frame length will be fixed to initial value.\n"); + printf("[-MAX num] : Set the limit for the payload size of iSAC\n"); + printf(" in bytes. Minimum 100 maximum 400.\n"); + printf("[-MAXRATE num] : Set the maxrate for iSAC in bits per second.\n"); + printf(" Minimum 32000, maximum 53400.\n"); + printf("[-F num] : if -F option is specified, the test function\n"); + printf(" will run the iSAC API fault scenario\n"); + printf(" specified by the supplied number.\n"); + printf(" F 1 - Call encoder prior to init encoder call\n"); + printf(" F 2 - Call decoder prior to init decoder call\n"); + printf(" F 3 - Call decoder prior to encoder call\n"); + printf(" F 4 - Call decoder with a too short coded\n"); + printf(" sequence\n"); + printf(" F 5 - Call decoder with a too long coded\n"); + printf(" sequence\n"); + printf(" F 6 - Call decoder with random bit stream\n"); + printf(" F 7 - Call init encoder/decoder at random\n"); + printf(" during a call\n"); + printf(" F 8 - Call encoder/decoder without having\n"); + printf(" allocated memory for encoder/decoder\n"); + printf(" instance\n"); + printf(" F 9 - Call decodeB without calling decodeA\n"); + printf(" F 10 - Call decodeB with garbage data\n"); + printf("[-PL num] : if -PL option is specified \n"); + printf("[-T rate file] : test trans-coding with target bottleneck\n"); + printf(" 'rate' bits/sec\n"); + printf(" the output file is written to 'file'\n"); + printf("[-LOOP num] : number of times to repeat coding the input\n"); + printf(" file for stress testing\n"); + // printf("[-CE num] : Test of APIs used by Conference Engine.\n"); + // printf(" CE 1 - getNewBitstream, getBWE \n"); + // printf(" (CE 2 - RESERVED for transcoding)\n"); + // printf(" CE 3 - getSendBWE, setSendBWE. \n"); + // printf("-L filename : write the logging info into file // (appending)\n"); - printf("infile : Normal speech input file\n\n"); - printf("outfile : Speech output file\n\n"); + printf("infile : Normal speech input file\n"); + printf("outfile : Speech output file\n"); exit(0); } @@ -252,10 +226,8 @@ int main(int argc, char* argv[]) { rateBPS = atoi(argv[i + 1]); setControlBWE = 1; if ((rateBPS < 10000) || (rateBPS > 32000)) { - printf( - "\n%d is not a initial rate. Valid values are in the range 10000 " - "to 32000.\n", - rateBPS); + printf("\n%d is not a initial rate. Valid values are in the range " + "10000 to 32000.\n", rateBPS); exit(0); } printf("New initial rate: %d\n", rateBPS); @@ -266,10 +238,8 @@ int main(int argc, char* argv[]) { if (!strcmp("-FL", argv[i])) { framesize = atoi(argv[i + 1]); if ((framesize != 30) && (framesize != 60)) { - printf( - "\n%d is not a valid frame length. Valid length are 30 and 60 " - "msec.\n", - framesize); + printf("\n%d is not a valid frame length. Valid length are 30 and 60 " + "msec.\n", framesize); exit(0); } setControlBWE = 1; @@ -303,10 +273,8 @@ int main(int argc, char* argv[]) { testNum = atoi(argv[i + 1]); printf("Fault test: %d\n", testNum); if (testNum < 1 || testNum > 10) { - printf( - "\n%d is not a valid Fault Scenario number. Valid Fault Scenarios " - "are numbered 1-10.\n", - testNum); + printf("\n%d is not a valid Fault Scenario number. Valid Fault " + "Scenarios are numbered 1-10.\n", testNum); exit(0); } i++; @@ -364,10 +332,8 @@ int main(int argc, char* argv[]) { sscanf(argv[i], "%s", bottleneck_file); f_bn = fopen(bottleneck_file, "rb"); if (f_bn == NULL) { - printf( - "Error No value provided for BottleNeck and cannot read file " - "%s.\n", - bottleneck_file); + printf("Error No value provided for BottleNeck and cannot read file " + "%s.\n", bottleneck_file); exit(0); } else { printf("reading bottleneck rates from file %s\n\n", bottleneck_file); @@ -379,12 +345,12 @@ int main(int argc, char* argv[]) { } } - /* Bottleneck is a cosine function - * Matlab code for writing the bottleneck file: - * BottleNeck_10ms = 20e3 + 10e3 * cos((0:5999)/5999*2*pi); - * fid = fopen('bottleneck.txt', 'wb'); - * fprintf(fid, '%d\n', BottleNeck_10ms); fclose(fid); - */ + /* Bottleneck is a cosine function + * Matlab code for writing the bottleneck file: + * BottleNeck_10ms = 20e3 + 10e3 * cos((0:5999)/5999*2*pi); + * fid = fopen('bottleneck.txt', 'wb'); + * fprintf(fid, '%d\n', BottleNeck_10ms); fclose(fid); + */ } } else { printf("\nfixed bottleneck rate of %d bits/s\n\n", bottleneck); @@ -651,8 +617,7 @@ int main(int argc, char* argv[]) { int16_t indexStream; uint8_t auxUW8; - /************************* Main Transcoding stream - * *******************************/ + /******************** Main Transcoding stream ********************/ WebRtcIsac_GetDownLinkBwIndex(ISAC_main_inst, &bnIdxTC, &jitterInfoTC); streamLenTransCoding = WebRtcIsac_GetNewBitStream( @@ -895,28 +860,23 @@ int main(int argc, char* argv[]) { framecnt++; /* Error test number 10, garbage data */ - // if(testNum == 10) - //{ - // /* Test to run decoder with garbage data */ - // if( (seedfile = fopen(SEED_FILE, "a+t") ) == NULL ) - // { - // fprintf(stderr, "Error: Could not open file %s\n", SEED_FILE); - // } - // else - // { - // fprintf(seedfile, "ok\n\n"); - // fclose(seedfile); - // } - //} + // if (testNum == 10) + // { + // /* Test to run decoder with garbage data */ + // if ((seedfile = fopen(SEED_FILE, "a+t")) == NULL) { + // fprintf(stderr, "Error: Could not open file %s\n", SEED_FILE); + // } else { + // fprintf(seedfile, "ok\n\n"); + // fclose(seedfile); + // } + // } /* Error test number 10, garbage data */ - // if(testNum == 10) - //{ - // /* Test to run decoder with garbage data */ - // for ( i = 0; i < stream_len; i++) - // { - // streamdata[i] = (short) (streamdata[i] + (short) rand()); - // } - //} + // if (testNum == 10) { + // /* Test to run decoder with garbage data */ + // for (i = 0; i < stream_len; i++) { + // streamdata[i] = (short) (streamdata[i] + (short) rand()); + // } + // } totalsmpls += declen; totalbits += 8 * stream_len; diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c b/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c index b1d8a2418f..a664e0ac10 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c @@ -122,39 +122,30 @@ int main(int argc, char* argv[]) { printf("\n\nWrong number of arguments or flag values.\n\n"); printf("Usage:\n\n"); - printf("%s infile outfile -bn bottelneck [options] \n\n", argv[0]); + printf("%s infile outfile -bn bottleneck [options]\n\n", argv[0]); printf("with:\n"); - printf("-I................... indicates encoding in instantaneous mode.\n"); - printf( - "-bn bottleneck....... the value of the bottleneck in bit/sec, e.g. " - "39742,\n"); - printf( - " in instantaneous (channel-independent) " - "mode.\n\n"); - printf("infile............... Normal speech input file\n\n"); - printf("outfile.............. Speech output file\n\n"); + printf("-I.............. indicates encoding in instantaneous mode.\n"); + printf("-bn bottleneck.. the value of the bottleneck in bit/sec, e.g.\n"); + printf(" 39742, in instantaneous (channel-independent)\n"); + printf(" mode.\n\n"); + printf("infile.......... Normal speech input file\n\n"); + printf("outfile......... Speech output file\n\n"); printf("OPTIONS\n"); printf("-------\n"); - printf( - "-fs sampFreq......... sampling frequency of codec 16 or 32 (default) " - "kHz.\n"); - printf("-plim payloadLim..... payload limit in bytes,\n"); - printf(" default is the maximum possible.\n"); - printf("-rlim rateLim........ rate limit in bits/sec, \n"); - printf(" default is the maimum possible.\n"); - printf("-h file.............. record histogram and *append* to 'file'.\n"); - printf( - "-ave file............ record average rate of 3 sec intervales and " - "*append* to 'file'.\n"); - printf("-ploss............... packet-loss percentage.\n"); - printf("-enc................. do only encoding and store the bit-stream\n"); - printf( - "-dec................. the input file is a bit-stream, decode it.\n"); - - printf("\n"); + printf("-fs sampFreq.... sampling frequency of codec 16 or 32 (default)\n"); + printf(" kHz.\n"); + printf("-plim payloadLim payload limit in bytes, default is the maximum\n"); + printf(" possible.\n"); + printf("-rlim rateLim... rate limit in bits/sec, default is the maximum\n"); + printf(" possible.\n"); + printf("-h file......... record histogram and *append* to 'file'.\n"); + printf("-ave file....... record average rate of 3 sec intervales and\n"); + printf(" *append* to 'file'.\n"); + printf("-ploss.......... packet-loss percentage.\n"); + printf("-enc............ do only encoding and store the bit-stream\n"); + printf("-dec............ the input file is a bit-stream, decode it.\n\n"); printf("Example usage:\n\n"); - printf("%s speechIn.pcm speechOut.pcm -B 40000 -fs 32 \n\n", argv[0]); - + printf("%s speechIn.pcm speechOut.pcm -B 40000 -fs 32\n\n", argv[0]); printf("structure size %d bytes\n", size); exit(0); @@ -205,10 +196,8 @@ int main(int argc, char* argv[]) { break; } default: - printf( - "A sampling frequency of %d kHz is not supported,\ -valid values are 8 and 16.\n", - sampFreqKHz); + printf("A sampling frequency of %d kHz is not supported, valid values are" + " 8 and 16.\n", sampFreqKHz); exit(-1); } payloadLimit = (int16_t)readParamInt(argc, argv, "-plim", 400); @@ -268,18 +257,17 @@ valid values are 8 and 16.\n", return -1; } - //{ - // int32_t b1, b2; - // FILE* fileID = fopen("GetBNTest.txt", "w"); - // b2 = 32100; - // while(b2 <= 52000) - // { - // WebRtcIsac_Control(ISAC_main_inst, b2, frameSize); - // WebRtcIsac_GetUplinkBw(ISAC_main_inst, &b1); - // fprintf(fileID, "%5d %5d\n", b2, b1); - // b2 += 10; - // } - //} + // { + // int32_t b1, b2; + // FILE* fileID = fopen("GetBNTest.txt", "w"); + // b2 = 32100; + // while (b2 <= 52000) { + // WebRtcIsac_Control(ISAC_main_inst, b2, frameSize); + // WebRtcIsac_GetUplinkBw(ISAC_main_inst, &b1); + // fprintf(fileID, "%5d %5d\n", b2, b1); + // b2 += 10; + // } + // } if (codingMode == 1) { if (WebRtcIsac_Control(ISAC_main_inst, bottleneck, frameSize) < 0) { @@ -445,9 +433,9 @@ valid values are 8 and 16.\n", rateRCU = ((double)totalBitsRCU * (sampFreqKHz)) / (double)totalsmpls; printf("\n\n"); - printf("Sampling Rate......................... %d kHz\n", sampFreqKHz); - printf("Payload Limit......................... %d bytes \n", payloadLimit); - printf("Rate Limit............................ %d bits/sec \n", rateLimit); + printf("Sampling Rate............... %d kHz\n", sampFreqKHz); + printf("Payload Limit............... %d bytes \n", payloadLimit); + printf("Rate Limit.................. %d bits/sec \n", rateLimit); #ifdef WIN32 #ifdef HAVE_DEBUG_INFO @@ -463,24 +451,24 @@ valid values are 8 and 16.\n", #endif // WIN32 printf("\n"); - printf("Measured bit-rate..................... %0.3f kbps\n", rate); - printf("Measured RCU bit-ratre................ %0.3f kbps\n", rateRCU); - printf("Maximum bit-rate/payloadsize.......... %0.3f / %d\n", + printf("Measured bit-rate........... %0.3f kbps\n", rate); + printf("Measured RCU bit-ratre...... %0.3f kbps\n", rateRCU); + printf("Maximum bit-rate/payloadsize %0.3f / %d\n", maxStreamLen * 8 / 0.03, maxStreamLen); - printf("Measured packet-loss.................. %0.1f%% \n", + printf("Measured packet-loss........ %0.1f%% \n", 100.0f * (float)lostPacketCntr / (float)packetCntr); - //#ifdef HAVE_DEBUG_INFO - // printf("Measured lower-band bit-rate.......... %0.3f kbps (%.0f%%)\n", + // #ifdef HAVE_DEBUG_INFO + // printf("Measured lower-band bit-rate %0.3f kbps (%.0f%%)\n", // rateLB, (double)(rateLB) * 100. /(double)(rate)); - // printf("Measured upper-band bit-rate.......... %0.3f kbps (%.0f%%)\n", + // printf("Measured upper-band bit-rate %0.3f kbps (%.0f%%)\n", // rateUB, (double)(rateUB) * 100. /(double)(rate)); // - // printf("Maximum payload lower-band............ %d bytes (%0.3f kbps)\n", + // printf("Maximum payload lower-band.. %d bytes (%0.3f kbps)\n", // debugInfo.maxPayloadLB, debugInfo.maxPayloadLB * 8.0 / 0.03); - // printf("Maximum payload upper-band............ %d bytes (%0.3f kbps)\n", + // printf("Maximum payload upper-band.. %d bytes (%0.3f kbps)\n", // debugInfo.maxPayloadUB, debugInfo.maxPayloadUB * 8.0 / 0.03); - //#endif + // #endif printf("\n"); @@ -488,10 +476,9 @@ valid values are 8 and 16.\n", #ifdef WIN32 runtime = (double)(clock() / (double)CLOCKS_PER_SEC - starttime); length_file = ((double)framecnt * (double)declen / (sampFreqKHz * 1000)); - printf("Length of speech file................ %.1f s\n", length_file); - printf( - "Time to run iSAC..................... %.2f s (%.2f %% of realtime)\n\n", - runtime, (100 * runtime / length_file)); + printf("Length of speech file....... %.1f s\n", length_file); + printf("Time to run iSAC............ %.2f s (%.2f %% of realtime)\n\n", + runtime, (100 * runtime / length_file)); #endif printf("\n\n_______________________________________________\n"); diff --git a/webrtc/modules/audio_coding/neteq/test/RTPencode.cc b/webrtc/modules/audio_coding/neteq/test/RTPencode.cc index 87f9494f0e..7d8d60de51 100644 --- a/webrtc/modules/audio_coding/neteq/test/RTPencode.cc +++ b/webrtc/modules/audio_coding/neteq/test/RTPencode.cc @@ -305,14 +305,12 @@ int main(int argc, char* argv[]) { if ((argc != 6) && (argc != 7)) { /* print help text and exit */ printf("Application to encode speech into an RTP stream.\n"); - printf( - "The program reads a PCM file and encodes is using the specified " - "codec.\n"); - printf( - "The coded speech is packetized in RTP packest and written to the " - "output file.\n"); - printf( - "The format of the RTP stream file is simlilar to that of rtpplay,\n"); + printf("The program reads a PCM file and encodes is using the specified " + "codec.\n"); + printf("The coded speech is packetized in RTP packest and written to the " + "output file.\n"); + printf("The format of the RTP stream file is simlilar to that of " + "rtpplay,\n"); printf("but with the receive time euqal to 0 for all packets.\n"); printf("Usage:\n\n"); printf("%s PCMfile RTPfile frameLen codec useVAD bitrate\n", argv[0]); @@ -322,9 +320,8 @@ int main(int argc, char* argv[]) { printf("RTPfile : RTP stream output file\n\n"); - printf( - "frameLen : 80...960... Number of samples per packet (limit " - "depends on codec)\n\n"); + printf("frameLen : 80...960... Number of samples per packet (limit " + "depends on codec)\n\n"); printf("codecName\n"); #ifdef CODEC_PCM16B @@ -346,43 +343,36 @@ int main(int argc, char* argv[]) { printf(" : pcmu g711 u-law (8kHz)\n"); #endif #ifdef CODEC_G729 - printf( - " : g729 G729 (8kHz and 8kbps) CELP (One-Three " - "frame(s)/packet)\n"); + printf(" : g729 G729 (8kHz and 8kbps) CELP (One-Three " + "frame(s)/packet)\n"); #endif #ifdef CODEC_G729_1 - printf( - " : g729.1 G729.1 (16kHz) variable rate (8--32 " - "kbps)\n"); + printf(" : g729.1 G729.1 (16kHz) variable rate (8--32 " + "kbps)\n"); #endif #ifdef CODEC_G722_1_16 - printf( - " : g722.1_16 G722.1 coder (16kHz) (g722.1 with " - "16kbps)\n"); + printf(" : g722.1_16 G722.1 coder (16kHz) (g722.1 with " + "16kbps)\n"); #endif #ifdef CODEC_G722_1_24 - printf( - " : g722.1_24 G722.1 coder (16kHz) (the 24kbps " - "version)\n"); + printf(" : g722.1_24 G722.1 coder (16kHz) (the 24kbps " + "version)\n"); #endif #ifdef CODEC_G722_1_32 - printf( - " : g722.1_32 G722.1 coder (16kHz) (the 32kbps " - "version)\n"); + printf(" : g722.1_32 G722.1 coder (16kHz) (the 32kbps " + "version)\n"); #endif #ifdef CODEC_G722_1C_24 - printf( - " : g722.1C_24 G722.1 C coder (32kHz) (the 24kbps " - "version)\n"); + printf(" : g722.1C_24 G722.1 C coder (32kHz) (the 24kbps " + "version)\n"); #endif #ifdef CODEC_G722_1C_32 - printf( - " : g722.1C_32 G722.1 C coder (32kHz) (the 32kbps " - "version)\n"); + printf(" : g722.1C_32 G722.1 C coder (32kHz) (the 32kbps " + "version)\n"); #endif #ifdef CODEC_G722_1C_48 - printf( - " : g722.1C_48 G722.1 C coder (32kHz) (the 48kbps)\n"); + printf(" : g722.1C_48 G722.1 C coder (32kHz) (the 48kbps " + "version)\n"); #endif #ifdef CODEC_G726 @@ -392,39 +382,34 @@ int main(int argc, char* argv[]) { printf(" : g726_40 G726 coder (8kHz) 40kbps\n"); #endif #ifdef CODEC_AMR - printf( - " : AMRXk Adaptive Multi Rate CELP codec (8kHz)\n"); - printf( - " X = 4.75, 5.15, 5.9, 6.7, 7.4, 7.95, 10.2 " - "or 12.2\n"); + printf(" : AMRXk Adaptive Multi Rate CELP codec " + "(8kHz)\n"); + printf(" X = 4.75, 5.15, 5.9, 6.7, 7.4, 7.95, " + "10.2 or 12.2\n"); #endif #ifdef CODEC_AMRWB - printf( - " : AMRwbXk Adaptive Multi Rate Wideband CELP codec " - "(16kHz)\n"); - printf( - " X = 7, 9, 12, 14, 16, 18, 20, 23 or 24\n"); + printf(" : AMRwbXk Adaptive Multi Rate Wideband CELP " + "codec (16kHz)\n"); + printf(" X = 7, 9, 12, 14, 16, 18, 20, 23 or " + "24\n"); #endif #ifdef CODEC_ILBC printf(" : ilbc iLBC codec (8kHz and 13.8kbps)\n"); #endif #ifdef CODEC_ISAC - printf( - " : isac iSAC (16kHz and 32.0 kbps). To set rate " - "specify a rate parameter as last parameter\n"); + printf(" : isac iSAC (16kHz and 32.0 kbps). To set " + "rate specify a rate parameter as last parameter\n"); #endif #ifdef CODEC_ISAC_SWB - printf( - " : isacswb iSAC SWB (32kHz and 32.0-52.0 kbps). To " - "set rate specify a rate parameter as last parameter\n"); + printf(" : isacswb iSAC SWB (32kHz and 32.0-52.0 kbps). " + "To set rate specify a rate parameter as last parameter\n"); #endif #ifdef CODEC_GSMFR printf(" : gsmfr GSM FR codec (8kHz and 13kbps)\n"); #endif #ifdef CODEC_G722 - printf( - " : g722 g722 coder (16kHz) (the 64kbps " - "version)\n"); + printf(" : g722 g722 coder (16kHz) (the 64kbps " + "version)\n"); #endif #ifdef CODEC_SPEEX_8 printf(" : speex8 speex coder (8 kHz)\n"); @@ -434,14 +419,12 @@ int main(int argc, char* argv[]) { #endif #ifdef CODEC_RED #ifdef CODEC_G711 - printf( - " : red_pcm Redundancy RTP packet with 2*G711A " - "frames\n"); + printf(" : red_pcm Redundancy RTP packet with 2*G711A " + "frames\n"); #endif #ifdef CODEC_ISAC - printf( - " : red_isac Redundancy RTP packet with 2*iSAC " - "frames\n"); + printf(" : red_isac Redundancy RTP packet with 2*iSAC " + "frames\n"); #endif #endif printf("\n"); @@ -451,12 +434,11 @@ int main(int argc, char* argv[]) { printf("useVAD : 0 Voice Activity Detection is switched off\n"); printf(" : 1 Voice Activity Detection is switched on\n\n"); #else - printf( - "useVAD : 0 Voice Activity Detection switched off (on not " - "supported)\n\n"); + printf("useVAD : 0 Voice Activity Detection switched off (on not " + "supported)\n\n"); #endif - printf( - "bitrate : Codec bitrate in bps (only applies to vbr codecs)\n\n"); + printf("bitrate : Codec bitrate in bps (only applies to vbr " + "codecs)\n\n"); return (0); } @@ -528,43 +510,36 @@ int main(int argc, char* argv[]) { if (argc != 7) { if (usedCodec == webrtc::kDecoderISAC) { bitrate = 32000; - printf( - "Running iSAC at default bitrate of 32000 bps (to specify " - "explicitly add the bps as last parameter)\n"); + printf("Running iSAC at default bitrate of 32000 bps (to specify " + "explicitly add the bps as last parameter)\n"); } else // (usedCodec==webrtc::kDecoderISACswb) { bitrate = 56000; - printf( - "Running iSAC at default bitrate of 56000 bps (to specify " - "explicitly add the bps as last parameter)\n"); + printf("Running iSAC at default bitrate of 56000 bps (to specify " + "explicitly add the bps as last parameter)\n"); } } else { bitrate = atoi(argv[6]); if (usedCodec == webrtc::kDecoderISAC) { if ((bitrate < 10000) || (bitrate > 32000)) { - printf( - "Error: iSAC bitrate must be between 10000 and 32000 bps (%i is " - "invalid)\n", - bitrate); + printf("Error: iSAC bitrate must be between 10000 and 32000 bps (%i " + "is invalid)\n", bitrate); exit(0); } printf("Running iSAC at bitrate of %i bps\n", bitrate); } else // (usedCodec==webrtc::kDecoderISACswb) { if ((bitrate < 32000) || (bitrate > 56000)) { - printf( - "Error: iSAC SWB bitrate must be between 32000 and 56000 bps (%i " - "is invalid)\n", - bitrate); + printf("Error: iSAC SWB bitrate must be between 32000 and 56000 bps " + "(%i is invalid)\n", bitrate); exit(0); } } } } else { if (argc == 7) { - printf( - "Error: Bitrate parameter can only be specified for iSAC, G.723, and " - "G.729.1\n"); + printf("Error: Bitrate parameter can only be specified for iSAC, G.723, " + "and G.729.1\n"); exit(0); } } @@ -972,23 +947,19 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, (enc_frameSize == 400) || (enc_frameSize == 480)) { ok = WebRtcG729_CreateEnc(&G729enc_inst[k]); if (ok != 0) { - printf( - "Error: Couldn't allocate memory for G729 encoding " - "instance\n"); + printf("Error: Couldn't allocate memory for G729 encoding " + "instance\n"); exit(0); } } else { - printf( - "\nError: g729 only supports 10, 20, 30, 40, 50 or 60 " - "ms!!\n\n"); + printf("\nError: g729 only supports 10, 20, 30, 40, 50 or 60 " + "ms!!\n\n"); exit(0); } WebRtcG729_EncoderInit(G729enc_inst[k], vad); if ((vad == 1) && (enc_frameSize != 80)) { - printf( - "\nError - This simulation only supports VAD for G729 at 10ms " - "packets (not %dms)\n", - (enc_frameSize >> 3)); + printf("\nError - This simulation only supports VAD for G729 at " + "10ms packets (not %dms)\n", (enc_frameSize >> 3)); } } else { printf("\nError - g729 is only developed for 8kHz \n"); @@ -1003,9 +974,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, (enc_frameSize == 960)) { ok = WebRtcG7291_Create(&G729_1_inst[k]); if (ok != 0) { - printf( - "Error: Couldn't allocate memory for G.729.1 codec " - "instance\n"); + printf("Error: Couldn't allocate memory for G.729.1 codec " + "instance\n"); exit(0); } } else { @@ -1016,9 +986,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, (bitrate % 2000 == 0)) || (bitrate == 8000))) { /* must be 8, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, or 32 kbps */ - printf( - "\nError: G.729.1 bitrate must be 8000 or 12000--32000 in " - "steps of 2000 bps\n"); + printf("\nError: G.729.1 bitrate must be 8000 or 12000--32000 in " + "steps of 2000 bps\n"); exit(0); } WebRtcG7291_EncoderInit(G729_1_inst[k], bitrate, 0 /* flag8kHz*/, @@ -1036,9 +1005,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, (enc_frameSize == 480)) { ok = WebRtcSpeex_CreateEnc(&SPEEX8enc_inst[k], sampfreq); if (ok != 0) { - printf( - "Error: Couldn't allocate memory for Speex encoding " - "instance\n"); + printf("Error: Couldn't allocate memory for Speex encoding " + "instance\n"); exit(0); } } else { @@ -1046,9 +1014,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, exit(0); } if ((vad == 1) && (enc_frameSize != 160)) { - printf( - "\nError - This simulation only supports VAD for Speex at 20ms " - "packets (not %dms)\n", + printf("\nError - This simulation only supports VAD for Speex at " + "20ms packets (not %dms)\n", (enc_frameSize >> 3)); vad = 0; } @@ -1057,9 +1024,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, if (ok != 0) exit(0); } else { - printf( - "\nError - Speex8 called with sample frequency other than 8 " - "kHz.\n\n"); + printf("\nError - Speex8 called with sample frequency other than 8 " + "kHz.\n\n"); } break; #endif @@ -1070,9 +1036,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, (enc_frameSize == 960)) { ok = WebRtcSpeex_CreateEnc(&SPEEX16enc_inst[k], sampfreq); if (ok != 0) { - printf( - "Error: Couldn't allocate memory for Speex encoding " - "instance\n"); + printf("Error: Couldn't allocate memory for Speex encoding " + "instance\n"); exit(0); } } else { @@ -1080,9 +1045,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, exit(0); } if ((vad == 1) && (enc_frameSize != 320)) { - printf( - "\nError - This simulation only supports VAD for Speex at 20ms " - "packets (not %dms)\n", + printf("\nError - This simulation only supports VAD for Speex at " + "20ms packets (not %dms)\n", (enc_frameSize >> 4)); vad = 0; } @@ -1091,9 +1055,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, if (ok != 0) exit(0); } else { - printf( - "\nError - Speex16 called with sample frequency other than 16 " - "kHz.\n\n"); + printf("\nError - Speex16 called with sample frequency other than 16 " + "kHz.\n\n"); } break; #endif @@ -1268,9 +1231,8 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, if (sampfreq == 16000) { ok = WebRtcAmrWb_CreateEnc(&AMRWBenc_inst[k]); if (ok != 0) { - printf( - "Error: Couldn't allocate memory for AMRWB encoding " - "instance\n"); + printf("Error: Couldn't allocate memory for AMRWB encoding " + "instance\n"); exit(0); } if (((enc_frameSize / 320) < 0) || ((enc_frameSize / 320) > 3) || @@ -1311,16 +1273,15 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, if (sampfreq == 8000) { ok = WebRtcIlbcfix_EncoderCreate(&iLBCenc_inst[k]); if (ok != 0) { - printf( - "Error: Couldn't allocate memory for iLBC encoding instance\n"); + printf("Error: Couldn't allocate memory for iLBC encoding " + "instance\n"); exit(0); } if ((enc_frameSize == 160) || (enc_frameSize == 240) || (enc_frameSize == 320) || (enc_frameSize == 480)) { } else { - printf( - "\nError - iLBC only supports 160, 240, 320 and 480 " - "enc_frameSize (20, 30, 40 and 60 ms)\n"); + printf("\nError - iLBC only supports 160, 240, 320 and 480 " + "enc_frameSize (20, 30, 40 and 60 ms)\n"); exit(0); } if ((enc_frameSize == 160) || (enc_frameSize == 320)) { @@ -1351,17 +1312,15 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, } WebRtcIsac_EncoderInit(ISAC_inst[k], 1); if ((bitrate < 10000) || (bitrate > 32000)) { - printf( - "\nError - iSAC bitrate has to be between 10000 and 32000 bps " - "(not %i)\n", + printf("\nError - iSAC bitrate has to be between 10000 and 32000 " + "bps (not %i)\n", bitrate); exit(0); } WebRtcIsac_Control(ISAC_inst[k], bitrate, enc_frameSize >> 4); } else { - printf( - "\nError - iSAC only supports 480 or 960 enc_frameSize (30 or 60 " - "ms)\n"); + printf("\nError - iSAC only supports 480 or 960 enc_frameSize (30 or " + "60 ms)\n"); exit(0); } break; @@ -1381,17 +1340,14 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, } WebRtcIsacfix_EncoderInit(ISAC_inst[k], 1); if ((bitrate < 10000) || (bitrate > 32000)) { - printf( - "\nError - iSAC bitrate has to be between 10000 and 32000 bps " - "(not %i)\n", - bitrate); + printf("\nError - iSAC bitrate has to be between 10000 and 32000 " + "bps (not %i)\n", bitrate); exit(0); } WebRtcIsacfix_Control(ISAC_inst[k], bitrate, enc_frameSize >> 4); } else { - printf( - "\nError - iSAC only supports 480 or 960 enc_frameSize (30 or 60 " - "ms)\n"); + printf("\nError - iSAC only supports 480 or 960 enc_frameSize (30 or " + "60 ms)\n"); exit(0); } break; @@ -1416,16 +1372,14 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, } WebRtcIsac_EncoderInit(ISACSWB_inst[k], 1); if ((bitrate < 32000) || (bitrate > 56000)) { - printf( - "\nError - iSAC SWB bitrate has to be between 32000 and 56000 " - "bps (not %i)\n", - bitrate); + printf("\nError - iSAC SWB bitrate has to be between 32000 and " + "56000 bps (not %i)\n", bitrate); exit(0); } WebRtcIsac_Control(ISACSWB_inst[k], bitrate, enc_frameSize >> 5); } else { - printf( - "\nError - iSAC SWB only supports 960 enc_frameSize (30 ms)\n"); + printf("\nError - iSAC SWB only supports 960 enc_frameSize (30 " + "ms)\n"); exit(0); } break; @@ -1435,16 +1389,15 @@ int NetEQTest_init_coders(webrtc::NetEqDecoder coder, if (sampfreq == 8000) { ok = WebRtcGSMFR_CreateEnc(&GSMFRenc_inst[k]); if (ok != 0) { - printf( - "Error: Couldn't allocate memory for GSM FR encoding " - "instance\n"); + printf("Error: Couldn't allocate memory for GSM FR encoding " + "instance\n"); exit(0); } if ((enc_frameSize == 160) || (enc_frameSize == 320) || (enc_frameSize == 480)) { } else { - printf( - "\nError - GSM FR must have a multiple of 160 enc_frameSize\n"); + printf("\nError - GSM FR must have a multiple of 160 " + "enc_frameSize\n"); exit(0); } WebRtcGSMFR_EncoderInit(GSMFRenc_inst[k], 0);