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

Side by Side Diff: webrtc/modules/audio_coding/codecs/ilbc/test/iLBC_testLib.c

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 months 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 25 matching lines...) Expand all
36 * exefile_name.exe <infile> <bytefile> <outfile> 36 * exefile_name.exe <infile> <bytefile> <outfile>
37 * 37 *
38 *---------------------------------------------------------------*/ 38 *---------------------------------------------------------------*/
39 39
40 int main(int argc, char* argv[]) 40 int main(int argc, char* argv[])
41 { 41 {
42 FILE *ifileid,*efileid,*ofileid, *chfileid; 42 FILE *ifileid,*efileid,*ofileid, *chfileid;
43 short encoded_data[55], data[240], speechType; 43 short encoded_data[55], data[240], speechType;
44 int len; 44 int len;
45 short mode, pli; 45 short mode, pli;
46 size_t readlen;
46 int blockcount = 0; 47 int blockcount = 0;
47 48
48 IlbcEncoderInstance *Enc_Inst; 49 IlbcEncoderInstance *Enc_Inst;
49 IlbcDecoderInstance *Dec_Inst; 50 IlbcDecoderInstance *Dec_Inst;
50 #ifdef JUNK_DATA 51 #ifdef JUNK_DATA
51 int i; 52 int i;
52 FILE *seedfile; 53 FILE *seedfile;
53 unsigned int random_seed = (unsigned int) time(NULL);//1196764538 54 unsigned int random_seed = (unsigned int) time(NULL);//1196764538
54 #endif 55 #endif
55 56
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 fclose(seedfile); 120 fclose(seedfile);
120 } 121 }
121 #endif 122 #endif
122 123
123 /* Initialization */ 124 /* Initialization */
124 WebRtcIlbcfix_EncoderInit(Enc_Inst, mode); 125 WebRtcIlbcfix_EncoderInit(Enc_Inst, mode);
125 WebRtcIlbcfix_DecoderInit(Dec_Inst, mode); 126 WebRtcIlbcfix_DecoderInit(Dec_Inst, mode);
126 127
127 /* loop over input blocks */ 128 /* loop over input blocks */
128 #ifdef SPLIT_10MS 129 #ifdef SPLIT_10MS
129 while(fread(data, sizeof(short), 80, ifileid) == 80) { 130 readlen = 80;
130 #else 131 #else
131 while((short)fread(data,sizeof(short),(mode<<3),ifileid)==(mode<<3)) { 132 readlen = (size_t)(mode << 3);
132 #endif 133 #endif
134 while(fread(data, sizeof(short), readlen, ifileid) == readlen) {
133 blockcount++; 135 blockcount++;
134 136
135 /* encoding */ 137 /* encoding */
136 fprintf(stderr, "--- Encoding block %i --- ",blockcount); 138 fprintf(stderr, "--- Encoding block %i --- ",blockcount);
137 #ifdef SPLIT_10MS 139 len=WebRtcIlbcfix_Encode(Enc_Inst, data, (short)readlen, encoded_data);
138 len=WebRtcIlbcfix_Encode(Enc_Inst, data, 80, encoded_data);
139 #else
140 len=WebRtcIlbcfix_Encode(Enc_Inst, data, (short)(mode<<3), encoded_data);
141 #endif
142 fprintf(stderr, "\r"); 140 fprintf(stderr, "\r");
143 141
144 #ifdef JUNK_DATA 142 #ifdef JUNK_DATA
145 for ( i = 0; i < len; i++) { 143 for ( i = 0; i < len; i++) {
146 encoded_data[i] = (short) (encoded_data[i] + (short) rand()); 144 encoded_data[i] = (short) (encoded_data[i] + (short) rand());
147 } 145 }
148 #endif 146 #endif
149 /* write byte file */ 147 /* write byte file */
150 if(len != 0){ //len may be 0 in 10ms split case 148 if(len != 0){ //len may be 0 in 10ms split case
151 fwrite(encoded_data,1,len,efileid); 149 fwrite(encoded_data,1,len,efileid);
152 }
153 150
154 if(len != 0){ //len may be 0 in 10ms split case
155 /* get channel data if provided */ 151 /* get channel data if provided */
156 if (argc==6) { 152 if (argc==6) {
157 if (fread(&pli, sizeof(int16_t), 1, chfileid)) { 153 if (fread(&pli, sizeof(int16_t), 1, chfileid)) {
158 if ((pli!=0)&&(pli!=1)) { 154 if ((pli!=0)&&(pli!=1)) {
159 fprintf(stderr, "Error in channel file\n"); 155 fprintf(stderr, "Error in channel file\n");
160 exit(0); 156 exit(0);
161 } 157 }
162 if (pli==0) { 158 if (pli==0) {
163 /* Packet loss -> remove info from frame */ 159 /* Packet loss -> remove info from frame */
164 memset(encoded_data, 0, sizeof(int16_t)*25); 160 memset(encoded_data, 0, sizeof(int16_t)*25);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 WebRtcIlbcfix_EncoderFree(Enc_Inst); 196 WebRtcIlbcfix_EncoderFree(Enc_Inst);
201 WebRtcIlbcfix_DecoderFree(Dec_Inst); 197 WebRtcIlbcfix_DecoderFree(Dec_Inst);
202 198
203 /* close files */ 199 /* close files */
204 fclose(ifileid); 200 fclose(ifileid);
205 fclose(efileid); 201 fclose(efileid);
206 fclose(ofileid); 202 fclose(ofileid);
207 203
208 return 0; 204 return 0;
209 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698