Some asm() correction.
[fjl] / idct_test.c
index dd15270..bd39c74 100644 (file)
@@ -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;