X-Git-Url: https://git.sesse.net/?p=fjl;a=blobdiff_plain;f=idct_test.c;h=bd39c7467e5f0e79ff361daf7b97df92968a55c1;hp=78374f89860b4f788bcee3d2c62fed8c9ac8a3bb;hb=a4009687c73083dd0290285a065740a83e27e855;hpb=13b48c4e2de5ceb4922ee47db32dd1a18edfffe4 diff --git a/idct_test.c b/idct_test.c index 78374f8..bd39c74 100644 --- a/idct_test.c +++ b/idct_test.c @@ -6,6 +6,9 @@ #include "benchmark.h" #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) @@ -73,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); @@ -142,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;