Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c

Issue 1429513004: Switch usage of _DEBUG macro to NDEBUG. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: REBASE Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 int16_t shortdata[FRAMESAMPLES_10ms]; 105 int16_t shortdata[FRAMESAMPLES_10ms];
106 int16_t decoded[MAX_FRAMESAMPLES]; 106 int16_t decoded[MAX_FRAMESAMPLES];
107 uint16_t streamdata[600]; 107 uint16_t streamdata[600];
108 int16_t speechType[1]; 108 int16_t speechType[1];
109 109
110 // int16_t* iSACstruct; 110 // int16_t* iSACstruct;
111 111
112 char version_number[20]; 112 char version_number[20];
113 int mode = -1, tmp, nbTest = 0; /*,sss;*/ 113 int mode = -1, tmp, nbTest = 0; /*,sss;*/
114 114
115 #ifdef _DEBUG 115 #if !defined(NDEBUG)
116 FILE* fy; 116 FILE* fy;
117 double kbps; 117 double kbps;
118 size_t totalbits = 0; 118 size_t totalbits = 0;
119 int totalsmpls = 0; 119 int totalsmpls = 0;
120 #endif /* _DEBUG */ 120 #endif
121 121
122 /* only one structure used for ISAC encoder */ 122 /* only one structure used for ISAC encoder */
123 ISAC_MainStruct* ISAC_main_inst; 123 ISAC_MainStruct* ISAC_main_inst;
124 ISACFIX_MainStruct* ISACFIX_main_inst; 124 ISACFIX_MainStruct* ISACFIX_main_inst;
125 125
126 BottleNeckModel BN_data; 126 BottleNeckModel BN_data;
127 f_bn = NULL; 127 f_bn = NULL;
128 128
129 #ifdef _DEBUG 129 #if !defined(NDEBUG)
130 fy = fopen("bit_rate.dat", "w"); 130 fy = fopen("bit_rate.dat", "w");
131 fclose(fy); 131 fclose(fy);
132 fy = fopen("bytes_frames.dat", "w"); 132 fy = fopen("bytes_frames.dat", "w");
133 fclose(fy); 133 fclose(fy);
134 #endif /* _DEBUG */ 134 #endif
135 135
136 // histfile = fopen("histo.dat", "ab"); 136 // histfile = fopen("histo.dat", "ab");
137 // ratefile = fopen("rates.dat", "ab"); 137 // ratefile = fopen("rates.dat", "ab");
138 138
139 /* handling wrong input arguments in the command line */ 139 /* handling wrong input arguments in the command line */
140 if ((argc < 6) || (argc > 10)) { 140 if ((argc < 6) || (argc > 10)) {
141 printf("\n\nWrong number of arguments or flag values.\n\n"); 141 printf("\n\nWrong number of arguments or flag values.\n\n");
142 142
143 printf("\n"); 143 printf("\n");
144 WebRtcIsacfix_version(version_number); 144 WebRtcIsacfix_version(version_number);
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 582 }
583 } 583 }
584 584
585 /* Write decoded speech frame to file */ 585 /* Write decoded speech frame to file */
586 fwrite(decoded, sizeof(int16_t), declen, outp); 586 fwrite(decoded, sizeof(int16_t), declen, outp);
587 } 587 }
588 588
589 fprintf(stderr, " \rframe = %d", framecnt); 589 fprintf(stderr, " \rframe = %d", framecnt);
590 framecnt++; 590 framecnt++;
591 591
592 #ifdef _DEBUG 592 #if !defined(NDEBUG)
593 593
594 totalsmpls += declen; 594 totalsmpls += declen;
595 totalbits += 8 * stream_len; 595 totalbits += 8 * stream_len;
596 kbps = (double)FS / (double)cur_framesmpls * 8.0 * stream_len / 1000.0; 596 kbps = (double)FS / (double)cur_framesmpls * 8.0 * stream_len / 1000.0;
597 fy = fopen("bit_rate.dat", "a"); 597 fy = fopen("bit_rate.dat", "a");
598 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); 598 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps);
599 fclose(fy); 599 fclose(fy);
600 600
601 #endif /* _DEBUG */ 601 #endif
602 } 602 }
603 603
604 #ifdef _DEBUG 604 #if !defined(NDEBUG)
605 printf("\n\ntotal bits = %" PRIuS " bits", totalbits); 605 printf("\n\ntotal bits = %" PRIuS " bits", totalbits);
606 printf("\nmeasured average bitrate = %0.3f kbits/s", 606 printf("\nmeasured average bitrate = %0.3f kbits/s",
607 (double)totalbits * (FS / 1000) / totalsmpls); 607 (double)totalbits * (FS / 1000) / totalsmpls);
608 printf("\n"); 608 printf("\n");
609 #endif /* _DEBUG */ 609 #endif
610 610
611 /* Runtime statistics */ 611 /* Runtime statistics */
612 runtime = (double)(clock() / (double)CLOCKS_PER_SEC - starttime); 612 runtime = (double)(clock() / (double)CLOCKS_PER_SEC - starttime);
613 length_file = ((double)framecnt * (double)declen / FS); 613 length_file = ((double)framecnt * (double)declen / FS);
614 printf("\n\nLength of speech file: %.1f s\n", length_file); 614 printf("\n\nLength of speech file: %.1f s\n", length_file);
615 printf("Time to run iSAC: %.2f s (%.2f %% of realtime)\n\n", runtime, 615 printf("Time to run iSAC: %.2f s (%.2f %% of realtime)\n\n", runtime,
616 (100 * runtime / length_file)); 616 (100 * runtime / length_file));
617 printf("---------------------END----------------------\n"); 617 printf("---------------------END----------------------\n");
618 618
619 fclose(inp); 619 fclose(inp);
620 fclose(outp); 620 fclose(outp);
621 621
622 WebRtcIsac_Free(ISAC_main_inst); 622 WebRtcIsac_Free(ISAC_main_inst);
623 WebRtcIsacfix_Free(ISACFIX_main_inst); 623 WebRtcIsacfix_Free(ISACFIX_main_inst);
624 624
625 // fclose(histfile); 625 // fclose(histfile);
626 // fclose(ratefile); 626 // fclose(ratefile);
627 627
628 return 0; 628 return 0;
629 } 629 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698