ref: 2632ef0396189e40c6415abad52ccbb774edf53f
parent: 0c7c4254313f49ad6c409baaee460787652286b4
author: Gregory Maxwell <[email protected]>
date: Sun Nov 17 03:52:00 EST 2013
Add some basic testing for OPUS_{GET|SET}_PREDICTION_DISABLED.
--- a/tests/test_opus_api.c
+++ b/tests/test_opus_api.c
@@ -1352,6 +1352,16 @@
" OPUS_SET_LSB_DEPTH ........................... OK.\n",
" OPUS_GET_LSB_DEPTH ........................... OK.\n")
+ err=opus_encoder_ctl(enc,OPUS_GET_PREDICTION_DISABLED(&i));
+ if(i!=0)test_failed();
+ cfgs++;
+ err=opus_encoder_ctl(enc,OPUS_GET_PREDICTION_DISABLED((opus_int32 *)NULL));
+ if(err!=OPUS_BAD_ARG)test_failed();
+ cfgs++;
+ CHECK_SETGET(OPUS_SET_PREDICTION_DISABLED(i),OPUS_GET_PREDICTION_DISABLED(&i),-1,2,1,0,
+ " OPUS_SET_PREDICTION_DISABLED ................. OK.\n",
+ " OPUS_GET_PREDICTION_DISABLED ................. OK.\n")
+
err=opus_encoder_ctl(enc,OPUS_GET_EXPERT_FRAME_DURATION((opus_int32 *)NULL));
if(err!=OPUS_BAD_ARG)test_failed();
cfgs++;
--- a/tests/test_opus_encode.c
+++ b/tests/test_opus_encode.c
@@ -308,7 +308,9 @@
if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_BITRATE(rate))!=OPUS_OK)test_failed();
count=i=0;
do {
- int len,out_samples,frame_size,loss;
+ int pred,len,out_samples,frame_size,loss;
+ if(opus_multistream_encoder_ctl(MSenc, OPUS_GET_PREDICTION_DISABLED(&pred))!=OPUS_OK)test_failed();
+ if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_PREDICTION_DISABLED((fast_rand()&15)<(pred?11:4)))!=OPUS_OK)test_failed();
frame_size=frame[j];
if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_COMPLEXITY((count>>2)%11))!=OPUS_OK)test_failed();
if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_PACKET_LOSS_PERC((fast_rand()&15)&(fast_rand()%15)))!=OPUS_OK)test_failed();