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

Side by Side Diff: tests/test_opus_decode.c

Issue 28553003: Updating Opus to a pre-release of 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Removing failing file Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « tests/test_opus_api.c ('k') | tests/test_opus_encode.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2011 Xiph.Org Foundation 1 /* Copyright (c) 2011 Xiph.Org Foundation
2 Written by Gregory Maxwell */ 2 Written by Gregory Maxwell */
3 /* 3 /*
4 Redistribution and use in source and binary forms, with or without 4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions 5 modification, are permitted provided that the following conditions
6 are met: 6 are met:
7 7
8 - Redistributions of source code must retain the above copyright 8 - Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer. 9 notice, this list of conditions and the following disclaimer.
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 int factor=48000/fsv[t>>1]; 104 int factor=48000/fsv[t>>1];
105 for(fec=0;fec<2;fec++) 105 for(fec=0;fec<2;fec++)
106 { 106 {
107 int dur; 107 int dur;
108 /*Test PLC on a fresh decoder*/ 108 /*Test PLC on a fresh decoder*/
109 out_samples = opus_decode(dec[t], 0, 0, outbuf, 120/factor, fec); 109 out_samples = opus_decode(dec[t], 0, 0, outbuf, 120/factor, fec);
110 if(out_samples!=120/factor)test_failed(); 110 if(out_samples!=120/factor)test_failed();
111 if(opus_decoder_ctl(dec[t], OPUS_GET_LAST_PACKET_DURATION(&dur))!=OPUS_ OK)test_failed(); 111 if(opus_decoder_ctl(dec[t], OPUS_GET_LAST_PACKET_DURATION(&dur))!=OPUS_ OK)test_failed();
112 if(dur!=120/factor)test_failed(); 112 if(dur!=120/factor)test_failed();
113 113
114 /*Test on a size which isn't a multiple of 2.5ms*/
115 out_samples = opus_decode(dec[t], 0, 0, outbuf, 120/factor+2, fec);
116 if(out_samples!=OPUS_BAD_ARG)test_failed();
117
114 /*Test null pointer input*/ 118 /*Test null pointer input*/
115 out_samples = opus_decode(dec[t], 0, -1, outbuf, 120/factor, fec); 119 out_samples = opus_decode(dec[t], 0, -1, outbuf, 120/factor, fec);
116 if(out_samples!=120/factor)test_failed(); 120 if(out_samples!=120/factor)test_failed();
117 out_samples = opus_decode(dec[t], 0, 1, outbuf, 120/factor, fec); 121 out_samples = opus_decode(dec[t], 0, 1, outbuf, 120/factor, fec);
118 if(out_samples!=120/factor)test_failed(); 122 if(out_samples!=120/factor)test_failed();
119 out_samples = opus_decode(dec[t], 0, 10, outbuf, 120/factor, fec); 123 out_samples = opus_decode(dec[t], 0, 10, outbuf, 120/factor, fec);
120 if(out_samples!=120/factor)test_failed(); 124 if(out_samples!=120/factor)test_failed();
121 out_samples = opus_decode(dec[t], 0, fast_rand(), outbuf, 120/factor, f ec); 125 out_samples = opus_decode(dec[t], 0, fast_rand(), outbuf, 120/factor, f ec);
122 if(out_samples!=120/factor)test_failed(); 126 if(out_samples!=120/factor)test_failed();
123 if(opus_decoder_ctl(dec[t], OPUS_GET_LAST_PACKET_DURATION(&dur))!=OPUS_ OK)test_failed(); 127 if(opus_decoder_ctl(dec[t], OPUS_GET_LAST_PACKET_DURATION(&dur))!=OPUS_ OK)test_failed();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 227
224 free(outbuf_int); 228 free(outbuf_int);
225 free(packet); 229 free(packet);
226 return 0; 230 return 0;
227 } 231 }
228 232
229 { 233 {
230 /*We only test a subset of the modes here simply because the longer 234 /*We only test a subset of the modes here simply because the longer
231 durations end up taking a long time.*/ 235 durations end up taking a long time.*/
232 static const int cmodes[4]={16,20,24,28}; 236 static const int cmodes[4]={16,20,24,28};
233 static const opus_uint32 cres[4]={116290185,2172123586,2172123586,21721235 86}; 237 static const opus_uint32 cres[4]={116290185,2172123586u,2172123586u,217212 3586u};
234 static const opus_uint32 lres[3]={3285687739,1481572662,694350475}; 238 static const opus_uint32 lres[3]={3285687739u,1481572662,694350475};
235 static const int lmodes[3]={0,4,8}; 239 static const int lmodes[3]={0,4,8};
236 int mode=fast_rand()%4; 240 int mode=fast_rand()%4;
237 241
238 packet[0]=cmodes[mode]<<3; 242 packet[0]=cmodes[mode]<<3;
239 dec_final_acc=0; 243 dec_final_acc=0;
240 t=fast_rand()%10; 244 t=fast_rand()%10;
241 245
242 for(i=0;i<65536;i++) 246 for(i=0;i<65536;i++)
243 { 247 {
244 int factor=48000/fsv[t>>1]; 248 int factor=48000/fsv[t>>1];
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 fprintf(stderr,"Testing %s decoder. Random seed: %u (%.4X)\n", oversion, isee d, fast_rand() % 65535); 401 fprintf(stderr,"Testing %s decoder. Random seed: %u (%.4X)\n", oversion, isee d, fast_rand() % 65535);
398 if(env_used)fprintf(stderr," Random seed set from the environment (SEED=%s). \n", env_seed); 402 if(env_used)fprintf(stderr," Random seed set from the environment (SEED=%s). \n", env_seed);
399 403
400 /*Setting TEST_OPUS_NOFUZZ tells the tool not to send garbage data 404 /*Setting TEST_OPUS_NOFUZZ tells the tool not to send garbage data
401 into the decoders. This is helpful because garbage data 405 into the decoders. This is helpful because garbage data
402 may cause the decoders to clip, which angers CLANG IOC.*/ 406 may cause the decoders to clip, which angers CLANG IOC.*/
403 test_decoder_code0(getenv("TEST_OPUS_NOFUZZ")!=NULL); 407 test_decoder_code0(getenv("TEST_OPUS_NOFUZZ")!=NULL);
404 408
405 return 0; 409 return 0;
406 } 410 }
OLDNEW
« no previous file with comments | « tests/test_opus_api.c ('k') | tests/test_opus_encode.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698