]> git.sesse.net Git - ffmpeg/blobdiff - tests/checkasm/vf_blend.c
Merge commit '83fef16b6a8dbbcbd80d159ba3ebe818dbbb2776'
[ffmpeg] / tests / checkasm / vf_blend.c
index be6573045288cbb1a59c6a5f41219c9d27b2ad5c..79bdf9f163d65b4bf7cc7d7cb9aeee59428d51b2 100644 (file)
         }                                     \
     } while (0)
 
-#define check_blend_func()                                                                 \
+#define check_blend_func(depth)                                                            \
     do {                                                                                   \
-        int i;                                                                             \
+        int i, w;                                                                          \
         declare_func(void, const uint8_t *top, ptrdiff_t top_linesize,                     \
                      const uint8_t *bottom, ptrdiff_t bottom_linesize,                     \
                      uint8_t *dst, ptrdiff_t dst_linesize,                                 \
                      ptrdiff_t width, ptrdiff_t height,                                    \
                      struct FilterParams *param, double *values);                          \
+        w = WIDTH / depth;                                                                 \
                                                                                            \
         for (i = 0; i < BUF_UNITS - 1; i++) {                                              \
             int src_offset = i * SIZE_PER_UNIT + i; /* Test various alignments */          \
             int dst_offset = i * SIZE_PER_UNIT; /* dst must be aligned */                  \
             randomize_buffers();                                                           \
-            call_ref(top1 + src_offset, WIDTH, bot1 + src_offset, WIDTH,                   \
-                     dst1 + dst_offset, WIDTH, WIDTH, HEIGHT, &param, NULL);               \
-            call_new(top2 + src_offset, WIDTH, bot2 + src_offset, WIDTH,                   \
-                     dst2 + dst_offset, WIDTH, WIDTH, HEIGHT, &param, NULL);               \
+            call_ref(top1 + src_offset, w, bot1 + src_offset, w,                           \
+                     dst1 + dst_offset, w, w, HEIGHT, &param, NULL);                       \
+            call_new(top2 + src_offset, w, bot2 + src_offset, w,                           \
+                     dst2 + dst_offset, w, w, HEIGHT, &param, NULL);                       \
             if (memcmp(top1, top2, BUF_SIZE) || memcmp(bot1, bot2, BUF_SIZE) || memcmp(dst1, dst2, BUF_SIZE)) \
                 fail();                                                                    \
         }                                                                                  \
-        bench_new(top2, WIDTH / 4, bot2, WIDTH / 4, dst2, WIDTH / 4,                       \
-                  WIDTH / 4, HEIGHT / 4, &param, NULL);                                    \
+        bench_new(top2, w / 4, bot2, w / 4, dst2, w / 4,                                   \
+                  w / 4, HEIGHT / 4, &param, NULL);                                        \
     } while (0)
 
 void checkasm_check_blend(void)
@@ -96,32 +97,44 @@ void checkasm_check_blend(void)
         .opacity = 1.0,
     };
 
-#define check_and_report(name, val)               \
+#define check_and_report(name, val, depth)        \
     param.mode = val;                             \
-    ff_blend_init(&param, 0);                     \
+    ff_blend_init(&param, depth - 1);             \
     if (check_func(param.blend, #name))           \
-        check_blend_func();
+        check_blend_func(depth);
 
-    check_and_report(addition, BLEND_ADDITION)
-    check_and_report(grainmerge, BLEND_GRAINMERGE)
-    check_and_report(and, BLEND_AND)
-    check_and_report(average, BLEND_AVERAGE)
-    check_and_report(darken, BLEND_DARKEN)
-    check_and_report(grainextract, BLEND_GRAINEXTRACT)
-    check_and_report(hardmix, BLEND_HARDMIX)
-    check_and_report(lighten, BLEND_LIGHTEN)
-    check_and_report(multiply, BLEND_MULTIPLY)
-    check_and_report(or, BLEND_OR)
-    check_and_report(phoenix, BLEND_PHOENIX)
-    check_and_report(screen, BLEND_SCREEN)
-    check_and_report(subtract, BLEND_SUBTRACT)
-    check_and_report(xor, BLEND_XOR)
-    check_and_report(difference, BLEND_DIFFERENCE)
-    check_and_report(extremity, BLEND_EXTREMITY)
-    check_and_report(negation, BLEND_NEGATION)
+    check_and_report(addition, BLEND_ADDITION, 1)
+    check_and_report(grainmerge, BLEND_GRAINMERGE, 1)
+    check_and_report(and, BLEND_AND, 1)
+    check_and_report(average, BLEND_AVERAGE, 1)
+    check_and_report(darken, BLEND_DARKEN, 1)
+    check_and_report(grainextract, BLEND_GRAINEXTRACT, 1)
+    check_and_report(hardmix, BLEND_HARDMIX, 1)
+    check_and_report(lighten, BLEND_LIGHTEN, 1)
+    check_and_report(multiply, BLEND_MULTIPLY, 1)
+    check_and_report(or, BLEND_OR, 1)
+    check_and_report(phoenix, BLEND_PHOENIX, 1)
+    check_and_report(screen, BLEND_SCREEN, 1)
+    check_and_report(subtract, BLEND_SUBTRACT, 1)
+    check_and_report(xor, BLEND_XOR, 1)
+    check_and_report(difference, BLEND_DIFFERENCE, 1)
+    check_and_report(extremity, BLEND_EXTREMITY, 1)
+    check_and_report(negation, BLEND_NEGATION, 1)
 
     report("8bit");
 
+    check_and_report(addition_16, BLEND_ADDITION, 2)
+    check_and_report(and_16, BLEND_AND, 2)
+    check_and_report(darken_16, BLEND_DARKEN, 2)
+    check_and_report(difference_16, BLEND_DIFFERENCE, 2)
+    check_and_report(lighten_16, BLEND_LIGHTEN, 2)
+    check_and_report(or_16, BLEND_OR, 2)
+    check_and_report(phoenix_16, BLEND_PHOENIX, 2)
+    check_and_report(subtract_16, BLEND_SUBTRACT, 2)
+    check_and_report(xor_16, BLEND_SUBTRACT, 2)
+
+    report("16bit");
+
     av_freep(&top1);
     av_freep(&top2);
     av_freep(&bot1);