Add some basic testing for OPUS_{GET|SET}_PREDICTION_DISABLED.
authorGregory Maxwell <greg@xiph.org>
Sun, 17 Nov 2013 16:52:00 +0000 (08:52 -0800)
committerGregory Maxwell <greg@xiph.org>
Sun, 17 Nov 2013 16:52:00 +0000 (08:52 -0800)
tests/test_opus_api.c
tests/test_opus_encode.c

index 6cbd2fa..204cb2d 100644 (file)
@@ -1352,6 +1352,16 @@ opus_int32 test_enc_api(void)
      "    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++;
index e9cda80..0e544a4 100644 (file)
@@ -308,7 +308,9 @@ int run_test1(int no_fuzz)
          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();