diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_opus_decode.c | 14 | ||||
-rw-r--r-- | tests/test_opus_encode.c | 12 |
2 files changed, 24 insertions, 2 deletions
diff --git a/tests/test_opus_decode.c b/tests/test_opus_decode.c index 503a863b..b7fa26e8 100644 --- a/tests/test_opus_decode.c +++ b/tests/test_opus_decode.c @@ -41,7 +41,7 @@ #include "test_opus_common.h" #define MAX_PACKET (1500) -#define MAX_FRAME_SAMP (288000) +#define MAX_FRAME_SAMP (5760) extern int jackpot; int test_decoder_code0(void) @@ -52,6 +52,8 @@ int test_decoder_code0(void) int t; opus_int32 i; OpusDecoder *dec[5*2]; + opus_int32 decsize; + OpusDecoder *decbak; opus_uint32 dec_final_range1,dec_final_range2,dec_final_acc; unsigned char *packet; unsigned char modes[4096]; @@ -89,6 +91,10 @@ int test_decoder_code0(void) } } + decsize=opus_decoder_get_size(2); + decbak=(OpusDecoder *)malloc(decsize); + if(decbak==NULL)test_failed(); + for(t=0;t<5*2;t++) { int factor=48000/fsv[t>>1]; @@ -263,6 +269,12 @@ int test_decoder_code0(void) packet[0]=modes[i]<<2; for(t=0;t<5*2;t++)expected[t]=opus_decoder_get_nb_samples(dec[t],packet,plen); for(j=0;j<plen;j++)packet[j+1]=(fast_rand()|fast_rand())&255; + memcpy(decbak,dec[0],decsize); + if(opus_decode(decbak, packet, plen+1, outbuf, MAX_FRAME_SAMP, 1)!=expected[0])test_failed(); + memcpy(decbak,dec[0],decsize); + if(opus_decode(decbak, 0, 0, outbuf, MAX_FRAME_SAMP, 1)<20)test_failed(); + memcpy(decbak,dec[0],decsize); + if(opus_decode(decbak, 0, 0, outbuf, MAX_FRAME_SAMP, 0)<20)test_failed(); for(t=0;t<5*2;t++) { out_samples = opus_decode(dec[t], packet, plen+1, outbuf, MAX_FRAME_SAMP, 0); diff --git a/tests/test_opus_encode.c b/tests/test_opus_encode.c index ba080b40..6af3a3ce 100644 --- a/tests/test_opus_encode.c +++ b/tests/test_opus_encode.c @@ -44,7 +44,7 @@ #define MAX_PACKET (1500) #define SAMPLES (48000*30) #define SSAMPLES (SAMPLES/3) -#define MAX_FRAME_SAMP (288000) +#define MAX_FRAME_SAMP (5760) #define PI (3.141592653589793238462643f) @@ -215,6 +215,11 @@ int run_test1(void) if(out_samples!=frame_size)test_failed(); if(opus_decoder_ctl(dec, OPUS_GET_FINAL_RANGE(&dec_final_range))!=OPUS_OK)test_failed(); if(enc_final_range!=dec_final_range)test_failed(); + /*LBRR decode*/ + out_samples = opus_decode(dec_err[0], packet, len, out2buf, MAX_FRAME_SAMP, (fast_rand()&3)!=0); + if(out_samples!=frame_size)test_failed(); + out_samples = opus_decode(dec_err[1], packet, (fast_rand()&3)==0?0:len, out2buf, MAX_FRAME_SAMP, (fast_rand()&7)!=0); + if(out_samples<120)test_failed(); i+=frame_size; count++; }while(i<(SSAMPLES-MAX_FRAME_SAMP)); @@ -258,6 +263,11 @@ int run_test1(void) if(out_samples!=frame_size*6)test_failed(); if(opus_decoder_ctl(dec, OPUS_GET_FINAL_RANGE(&dec_final_range))!=OPUS_OK)test_failed(); if(enc_final_range!=dec_final_range)test_failed(); + /*LBRR decode*/ + out_samples = opus_decode(dec_err[8], packet, len, out2buf, MAX_FRAME_SAMP, (fast_rand()&3)!=0); + if(out_samples!=frame_size)test_failed(); + out_samples = opus_decode(dec_err[9], packet, (fast_rand()&3)==0?0:len, out2buf, MAX_FRAME_SAMP, (fast_rand()&7)!=0); + if(out_samples<20)test_failed(); i+=frame_size; count++; }while(i<(SSAMPLES/6-MAX_FRAME_SAMP)); |