OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int16_t rateBPS = 0; | 66 int16_t rateBPS = 0; |
67 int16_t fixedFL = 0; | 67 int16_t fixedFL = 0; |
68 int16_t payloadSize = 0; | 68 int16_t payloadSize = 0; |
69 int32_t payloadRate = 0; | 69 int32_t payloadRate = 0; |
70 int setControlBWE = 0; | 70 int setControlBWE = 0; |
71 short FL, testNum; | 71 short FL, testNum; |
72 char version_number[20]; | 72 char version_number[20]; |
73 FILE* plFile; | 73 FILE* plFile; |
74 int32_t sendBN; | 74 int32_t sendBN; |
75 | 75 |
76 #ifdef _DEBUG | 76 #if !defined(NDEBUG) |
77 FILE* fy; | 77 FILE* fy; |
78 double kbps; | 78 double kbps; |
79 #endif /* _DEBUG */ | 79 #endif |
80 size_t totalbits = 0; | 80 size_t totalbits = 0; |
81 int totalsmpls = 0; | 81 int totalsmpls = 0; |
82 | 82 |
83 /* If use GNS file */ | 83 /* If use GNS file */ |
84 FILE* fp_gns = NULL; | 84 FILE* fp_gns = NULL; |
85 char gns_file[100]; | 85 char gns_file[100]; |
86 size_t maxStreamLen30 = 0; | 86 size_t maxStreamLen30 = 0; |
87 size_t maxStreamLen60 = 0; | 87 size_t maxStreamLen60 = 0; |
88 short sampFreqKHz = 32; | 88 short sampFreqKHz = 32; |
89 short samplesIn10Ms; | 89 short samplesIn10Ms; |
90 short useAssign = 0; | 90 short useAssign = 0; |
91 // FILE logFile; | 91 // FILE logFile; |
92 bool doTransCoding = false; | 92 bool doTransCoding = false; |
93 int32_t rateTransCoding = 0; | 93 int32_t rateTransCoding = 0; |
94 uint8_t streamDataTransCoding[1200]; | 94 uint8_t streamDataTransCoding[1200]; |
95 size_t streamLenTransCoding = 0; | 95 size_t streamLenTransCoding = 0; |
96 FILE* transCodingFile = NULL; | 96 FILE* transCodingFile = NULL; |
97 FILE* transcodingBitstream = NULL; | 97 FILE* transcodingBitstream = NULL; |
98 size_t numTransCodingBytes = 0; | 98 size_t numTransCodingBytes = 0; |
99 | 99 |
100 /* only one structure used for ISAC encoder */ | 100 /* only one structure used for ISAC encoder */ |
101 ISACStruct* ISAC_main_inst = NULL; | 101 ISACStruct* ISAC_main_inst = NULL; |
102 ISACStruct* decoderTransCoding = NULL; | 102 ISACStruct* decoderTransCoding = NULL; |
103 | 103 |
104 BottleNeckModel BN_data; | 104 BottleNeckModel BN_data; |
105 | 105 |
106 #ifdef _DEBUG | 106 #if !defined(NDEBUG) |
107 fy = fopen("bit_rate.dat", "w"); | 107 fy = fopen("bit_rate.dat", "w"); |
108 fclose(fy); | 108 fclose(fy); |
109 fy = fopen("bytes_frames.dat", "w"); | 109 fy = fopen("bytes_frames.dat", "w"); |
110 fclose(fy); | 110 fclose(fy); |
111 #endif /* _DEBUG */ | 111 #endif |
112 | 112 |
113 /* Handling wrong input arguments in the command line */ | 113 /* Handling wrong input arguments in the command line */ |
114 if ((argc < 3) || (argc > 17)) { | 114 if ((argc < 3) || (argc > 17)) { |
115 printf("\n\nWrong number of arguments or flag values.\n\n"); | 115 printf("\n\nWrong number of arguments or flag values.\n\n"); |
116 | 116 |
117 printf("\n"); | 117 printf("\n"); |
118 WebRtcIsac_version(version_number); | 118 WebRtcIsac_version(version_number); |
119 printf("iSAC-swb version %s \n\n", version_number); | 119 printf("iSAC-swb version %s \n\n", version_number); |
120 | 120 |
121 printf("Usage:\n\n"); | 121 printf("Usage:\n\n"); |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 /* Error test number 10, garbage data */ | 878 /* Error test number 10, garbage data */ |
879 // if (testNum == 10) { | 879 // if (testNum == 10) { |
880 // /* Test to run decoder with garbage data */ | 880 // /* Test to run decoder with garbage data */ |
881 // for (i = 0; i < stream_len; i++) { | 881 // for (i = 0; i < stream_len; i++) { |
882 // streamdata[i] = (short) (streamdata[i] + (short) rand()); | 882 // streamdata[i] = (short) (streamdata[i] + (short) rand()); |
883 // } | 883 // } |
884 // } | 884 // } |
885 | 885 |
886 totalsmpls += declen; | 886 totalsmpls += declen; |
887 totalbits += 8 * stream_len; | 887 totalbits += 8 * stream_len; |
888 #ifdef _DEBUG | 888 #if !defined(NDEBUG) |
889 kbps = ((double)sampFreqKHz * 1000.) / ((double)cur_framesmpls) * 8.0 * | 889 kbps = ((double)sampFreqKHz * 1000.) / ((double)cur_framesmpls) * 8.0 * |
890 stream_len / 1000.0; // kbits/s | 890 stream_len / 1000.0; // kbits/s |
891 fy = fopen("bit_rate.dat", "a"); | 891 fy = fopen("bit_rate.dat", "a"); |
892 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); | 892 fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); |
893 fclose(fy); | 893 fclose(fy); |
894 | 894 |
895 #endif /* _DEBUG */ | 895 #endif |
896 } | 896 } |
897 printf("\n"); | 897 printf("\n"); |
898 printf("total bits = %" PRIuS " bits\n", totalbits); | 898 printf("total bits = %" PRIuS " bits\n", totalbits); |
899 printf("measured average bitrate = %0.3f kbits/s\n", | 899 printf("measured average bitrate = %0.3f kbits/s\n", |
900 (double)totalbits * (sampFreqKHz) / totalsmpls); | 900 (double)totalbits * (sampFreqKHz) / totalsmpls); |
901 if (doTransCoding) { | 901 if (doTransCoding) { |
902 printf("Transcoding average bit-rate = %0.3f kbps\n", | 902 printf("Transcoding average bit-rate = %0.3f kbps\n", |
903 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); | 903 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); |
904 fclose(transCodingFile); | 904 fclose(transCodingFile); |
905 } | 905 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 fprintf(stderr, " transcoding rate %.0f kbps", | 938 fprintf(stderr, " transcoding rate %.0f kbps", |
939 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); | 939 (double)numTransCodingBytes * 8.0 * (sampFreqKHz) / totalsmpls); |
940 } | 940 } |
941 | 941 |
942 fclose(inp); | 942 fclose(inp); |
943 fclose(outp); | 943 fclose(outp); |
944 WebRtcIsac_Free(ISAC_main_inst); | 944 WebRtcIsac_Free(ISAC_main_inst); |
945 | 945 |
946 exit(0); | 946 exit(0); |
947 } | 947 } |
OLD | NEW |