OLD | NEW |
1 /* Copyright (c) 2011 Xiph.Org Foundation | 1 /* Copyright (c) 2011-2013 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 |
11 - Redistributions in binary form must reproduce the above copyright | 11 - Redistributions in binary form must reproduce the above copyright |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 { | 240 { |
241 int rate; | 241 int rate; |
242 int modes[13]={0,0,0,1,1,1,1,2,2,2,2,2,2}; | 242 int modes[13]={0,0,0,1,1,1,1,2,2,2,2,2,2}; |
243 int rates[13]={6000,12000,48000,16000,32000,48000,64000,512000,13000,24
000,48000,64000,96000}; | 243 int rates[13]={6000,12000,48000,16000,32000,48000,64000,512000,13000,24
000,48000,64000,96000}; |
244 int frame[13]={960*2,960,480,960,960,960,480,960*3,960*3,960,480,240,12
0}; | 244 int frame[13]={960*2,960,480,960,960,960,480,960*3,960*3,960,480,240,12
0}; |
245 rate=rates[j]+fast_rand()%rates[j]; | 245 rate=rates[j]+fast_rand()%rates[j]; |
246 count=i=0; | 246 count=i=0; |
247 do { | 247 do { |
248 int bw,len,out_samples,frame_size; | 248 int bw,len,out_samples,frame_size; |
249 frame_size=frame[j]; | 249 frame_size=frame[j]; |
250 if(fast_rand()%50==0)opus_encoder_ctl(enc, OPUS_RESET_STATE); | 250 if(fast_rand()%100==0)opus_encoder_ctl(enc, OPUS_RESET_STATE); |
| 251 if(fast_rand()%10==0){ |
| 252 int complex=fast_rand()%11; |
| 253 if(opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY(complex))!=OPUS_OK)t
est_failed(); |
| 254 } |
251 if(fast_rand()%50==0)opus_decoder_ctl(dec, OPUS_RESET_STATE); | 255 if(fast_rand()%50==0)opus_decoder_ctl(dec, OPUS_RESET_STATE); |
252 if(opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(rc==0))!=OPUS_OK)test_f
ailed(); | 256 if(opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(rc==0))!=OPUS_OK)test_f
ailed(); |
253 if(opus_encoder_ctl(enc, OPUS_SET_FORCE_MODE(MODE_SILK_ONLY+modes[j]
))!=OPUS_OK)test_failed(); | 257 if(opus_encoder_ctl(enc, OPUS_SET_FORCE_MODE(MODE_SILK_ONLY+modes[j]
))!=OPUS_OK)test_failed(); |
254 if(opus_encoder_ctl(enc, OPUS_SET_DTX(fast_rand()&1))!=OPUS_OK)test_
failed(); | 258 if(opus_encoder_ctl(enc, OPUS_SET_DTX(fast_rand()&1))!=OPUS_OK)test_
failed(); |
255 if(opus_encoder_ctl(enc, OPUS_SET_BITRATE(rate))!=OPUS_OK)test_faile
d(); | 259 if(opus_encoder_ctl(enc, OPUS_SET_BITRATE(rate))!=OPUS_OK)test_faile
d(); |
256 if(opus_encoder_ctl(enc, OPUS_SET_FORCE_CHANNELS((rates[j]>=64000?2:
1)))!=OPUS_OK)test_failed(); | 260 if(opus_encoder_ctl(enc, OPUS_SET_FORCE_CHANNELS((rates[j]>=64000?2:
1)))!=OPUS_OK)test_failed(); |
257 if(opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY((count>>2)%11))!=OPUS_O
K)test_failed(); | 261 if(opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY((count>>2)%11))!=OPUS_O
K)test_failed(); |
258 if(opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC((fast_rand()&15)&
(fast_rand()%15)))!=OPUS_OK)test_failed(); | 262 if(opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC((fast_rand()&15)&
(fast_rand()%15)))!=OPUS_OK)test_failed(); |
259 bw=modes[j]==0?OPUS_BANDWIDTH_NARROWBAND+(fast_rand()%3): | 263 bw=modes[j]==0?OPUS_BANDWIDTH_NARROWBAND+(fast_rand()%3): |
260 modes[j]==1?OPUS_BANDWIDTH_SUPERWIDEBAND+(fast_rand()&1): | 264 modes[j]==1?OPUS_BANDWIDTH_SUPERWIDEBAND+(fast_rand()&1): |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 439 |
436 /*Setting TEST_OPUS_NOFUZZ tells the tool not to send garbage data | 440 /*Setting TEST_OPUS_NOFUZZ tells the tool not to send garbage data |
437 into the decoders. This is helpful because garbage data | 441 into the decoders. This is helpful because garbage data |
438 may cause the decoders to clip, which angers CLANG IOC.*/ | 442 may cause the decoders to clip, which angers CLANG IOC.*/ |
439 run_test1(getenv("TEST_OPUS_NOFUZZ")!=NULL); | 443 run_test1(getenv("TEST_OPUS_NOFUZZ")!=NULL); |
440 | 444 |
441 fprintf(stderr,"Tests completed successfully.\n"); | 445 fprintf(stderr,"Tests completed successfully.\n"); |
442 | 446 |
443 return 0; | 447 return 0; |
444 } | 448 } |
OLD | NEW |