From 2632ef0396189e40c6415abad52ccbb774edf53f Mon Sep 17 00:00:00 2001 From: Gregory Maxwell <greg@xiph.org> Date: Sun, 17 Nov 2013 08:52:00 -0800 Subject: [PATCH] Add some basic testing for OPUS_{GET|SET}_PREDICTION_DISABLED. --- tests/test_opus_api.c | 10 ++++++++++ tests/test_opus_encode.c | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_opus_api.c b/tests/test_opus_api.c index 6cbd2fa50..204cb2d26 100644 --- a/tests/test_opus_api.c +++ b/tests/test_opus_api.c @@ -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++; diff --git a/tests/test_opus_encode.c b/tests/test_opus_encode.c index e9cda80f2..0e544a443 100644 --- a/tests/test_opus_encode.c +++ b/tests/test_opus_encode.c @@ -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(); -- GitLab