X-Git-Url: https://git.sesse.net/?p=fjl;a=blobdiff_plain;f=idct_test.c;h=bd39c7467e5f0e79ff361daf7b97df92968a55c1;hp=dd15270265c5be2b17226f5cc7aeff70403cada0;hb=19a58db08afd149a862506936093423db756a2dc;hpb=56779091c47e5c61376d7f942cc58b831673e1d7 diff --git a/idct_test.c b/idct_test.c index dd15270..bd39c74 100644 --- a/idct_test.c +++ b/idct_test.c @@ -8,6 +8,7 @@ #include "idct.h" #include "idct_reference.h" #include "idct_float.h" +#include "idct_imprecise_int.h" // Generate random coefficients in the range [-15..15]. void gen_random_coeffs(int16_t* dst, size_t len) @@ -75,8 +76,13 @@ void test_dc_becomes_spread_out(idct_alloc_t* idct_alloc, idct_free_t* idct_free void* userdata = idct_alloc(quant); - for (unsigned i = 0; i < 255*8; ++i) { - uint32_t reference_value = i / 8; + for (unsigned i = -255*8; i < 255*16; ++i) { + int reference_value = i / 8 + 128; + if (reference_value < 0) { + reference_value = 0; + } else if (reference_value > 255) { + reference_value = 255; + } coeff[0] = i; (*idct)(coeff, userdata, output); @@ -144,6 +150,9 @@ int main(void) printf("idct_float:\n"); test_all_idct(idct_float_alloc, idct_float_free, idct_float); + + printf("idct_imprecise_int:\n"); + test_all_idct(idct_imprecise_int_alloc, idct_imprecise_int_free, idct_imprecise_int); printf("All tests pass.\n"); return 0;