This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 3d71b9ec9373e836405fea947ea3795cfc079edf
Author:     Jun Zhao <[email protected]>
AuthorDate: Wed May 13 22:55:49 2026 +0800
Commit:     Jun Zhao <[email protected]>
CommitDate: Sun Jun 7 23:29:33 2026 +0000

    tests/checkasm: hevc_pred: use pixel helpers for diagnostic output
    
    Replace plain memcmp+fail() with checkasm_check_pixel_padded() for
    DC, planar, and angular prediction tests. Use PIXEL_RECT for output
    buffers instead of flat arrays.
    
    This enables:
    - Detailed per-pixel difference output when run with 'checkasm -v'
    - Detection of out-of-bounds writes beyond the NxN block area
    - Padding violation reporting (writes past block boundary)
    
    Previously, a test failure would only report "FAILED" with no
    information about which pixels were wrong, making assembly debugging
    difficult. Follows the pattern established in 4d4b301e4a (checkasm:
    hevc_pel: Use helpers for checking for writes out of bounds).
    
    Suggested-by: Martin Storsjö <[email protected]>
    Signed-off-by: Jun Zhao <[email protected]>
---
 tests/checkasm/hevc_pred.c | 120 +++++++++++++++++++++------------------------
 1 file changed, 57 insertions(+), 63 deletions(-)

diff --git a/tests/checkasm/hevc_pred.c b/tests/checkasm/hevc_pred.c
index f26d7fb6d7..a166217441 100644
--- a/tests/checkasm/hevc_pred.c
+++ b/tests/checkasm/hevc_pred.c
@@ -27,30 +27,8 @@
 static const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
 
 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
-#define BUF_SIZE (2 * 64 * 64)  /* Enough for 32x32 with stride=64 */
 #define PRED_SIZE 128           /* Increased to 4 * MAX_TB_SIZE to accommodate 
C code reads */
 
-#define randomize_buffers()                        \
-    do {                                           \
-        uint32_t mask = pixel_mask[bit_depth - 8]; \
-        for (int i = 0; i < BUF_SIZE; i += 4) {    \
-            uint32_t r = rnd() & mask;             \
-            AV_WN32A(buf0 + i, r);                 \
-            AV_WN32A(buf1 + i, r);                 \
-        }                                          \
-        /* Start from -4 so that AV_WN32A writes  \
-         * top[-4..-1] and left[-4..-1], ensuring  \
-         * top[-1] and left[-1] contain known data \
-         * since angular pred references them      \
-         * (e.g. mode 10/26 edge filtering,        \
-         * mode 18 diagonal, V/H neg extension). */\
-        for (int i = -4; i < PRED_SIZE; i += 4) {  \
-            uint32_t r = rnd() & mask;             \
-            AV_WN32A(top + i, r);                  \
-            AV_WN32A(left + i, r);                 \
-        }                                          \
-    } while (0)
-
 #define randomize_ref_buffers()                    \
     do {                                           \
         uint32_t mask = pixel_mask[bit_depth - 8]; \
@@ -62,13 +40,15 @@ static const uint32_t pixel_mask[3] = { 0xffffffff, 
0x01ff01ff, 0x03ff03ff };
     } while (0)
 
 static void check_pred_dc(HEVCPredContext *h,
-                          uint8_t *buf0, uint8_t *buf1,
                           uint8_t *top, uint8_t *left, int bit_depth)
 {
     const char *const block_name[] = { "4x4", "8x8", "16x16", "32x32" };
     const int block_size[] = { 4, 8, 16, 32 };
     int log2_size;
 
+    PIXEL_RECT(buf0, 64, 64);
+    PIXEL_RECT(buf1, 64, 64);
+
     declare_func(void, uint8_t *src, const uint8_t *top,
                  const uint8_t *left, ptrdiff_t stride,
                  int log2_size, int c_idx);
@@ -76,54 +56,63 @@ static void check_pred_dc(HEVCPredContext *h,
     /* Test all 4 sizes: 4x4, 8x8, 16x16, 32x32 */
     for (log2_size = 2; log2_size <= 5; log2_size++) {
         int size = block_size[log2_size - 2];
-        ptrdiff_t stride = 64 * SIZEOF_PIXEL;
 
         if (check_func(h->pred_dc, "hevc_pred_dc_%s_%d",
                        block_name[log2_size - 2], bit_depth)) {
             /* Test with c_idx=0 (luma, with edge smoothing for size < 32) */
-            randomize_buffers();
-            call_ref(buf0, top, left, stride, log2_size, 0);
-            call_new(buf1, top, left, stride, log2_size, 0);
-            if (memcmp(buf0, buf1, size * stride))
-                fail();
+            randomize_ref_buffers();
+            CLEAR_PIXEL_RECT(buf0);
+            CLEAR_PIXEL_RECT(buf1);
+            call_ref(buf0, top, left, buf0_stride, log2_size, 0);
+            call_new(buf1, top, left, buf1_stride, log2_size, 0);
+            checkasm_check_pixel_padded(buf0, buf0_stride,
+                                        buf1, buf1_stride,
+                                        size, size, "dst");
 
             /* Test with c_idx=1 (chroma, no edge smoothing) */
-            randomize_buffers();
-            call_ref(buf0, top, left, stride, log2_size, 1);
-            call_new(buf1, top, left, stride, log2_size, 1);
-            if (memcmp(buf0, buf1, size * stride))
-                fail();
-
-            bench_new(buf1, top, left, stride, log2_size, 0);
+            randomize_ref_buffers();
+            CLEAR_PIXEL_RECT(buf0);
+            CLEAR_PIXEL_RECT(buf1);
+            call_ref(buf0, top, left, buf0_stride, log2_size, 1);
+            call_new(buf1, top, left, buf1_stride, log2_size, 1);
+            checkasm_check_pixel_padded(buf0, buf0_stride,
+                                        buf1, buf1_stride,
+                                        size, size, "dst");
+
+            bench_new(buf1, top, left, buf1_stride, log2_size, 0);
         }
     }
 }
 
 static void check_pred_planar(HEVCPredContext *h,
-                              uint8_t *buf0, uint8_t *buf1,
                               uint8_t *top, uint8_t *left, int bit_depth)
 {
     const char *const block_name[] = { "4x4", "8x8", "16x16", "32x32" };
     const int block_size[] = { 4, 8, 16, 32 };
     int i;
 
+    PIXEL_RECT(buf0, 64, 64);
+    PIXEL_RECT(buf1, 64, 64);
+
     declare_func(void, uint8_t *src, const uint8_t *top,
                  const uint8_t *left, ptrdiff_t stride);
 
     /* Test all 4 sizes: 4x4, 8x8, 16x16, 32x32 */
     for (i = 0; i < 4; i++) {
         int size = block_size[i];
-        ptrdiff_t stride = 64 * SIZEOF_PIXEL;
 
         if (check_func(h->pred_planar[i], "hevc_pred_planar_%s_%d",
                        block_name[i], bit_depth)) {
-            randomize_buffers();
-            call_ref(buf0, top, left, stride);
-            call_new(buf1, top, left, stride);
-            if (memcmp(buf0, buf1, size * stride))
-                fail();
-
-            bench_new(buf1, top, left, stride);
+            randomize_ref_buffers();
+            CLEAR_PIXEL_RECT(buf0);
+            CLEAR_PIXEL_RECT(buf1);
+            call_ref(buf0, top, left, buf0_stride);
+            call_new(buf1, top, left, buf1_stride);
+            checkasm_check_pixel_padded(buf0, buf0_stride,
+                                        buf1, buf1_stride,
+                                        size, size, "dst");
+
+            bench_new(buf1, top, left, buf1_stride);
         }
     }
 }
@@ -141,20 +130,21 @@ static void check_pred_planar(HEVCPredContext *h,
  * Each category has 4 NEON functions for 4x4, 8x8, 16x16, 32x32 sizes.
  */
 static void check_pred_angular(HEVCPredContext *h,
-                               uint8_t *buf0, uint8_t *buf1,
                                uint8_t *top, uint8_t *left, int bit_depth)
 {
     const char *const block_name[] = { "4x4", "8x8", "16x16", "32x32" };
     const int block_size[] = { 4, 8, 16, 32 };
     int i, mode;
 
+    PIXEL_RECT(buf0, 64, 64);
+    PIXEL_RECT(buf1, 64, 64);
+
     declare_func(void, uint8_t *src, const uint8_t *top,
                  const uint8_t *left, ptrdiff_t stride, int c_idx, int mode);
 
     /* Test all 4 sizes */
     for (i = 0; i < 4; i++) {
         int size = block_size[i];
-        ptrdiff_t stride = 64 * SIZEOF_PIXEL;
 
         /* Test all 33 angular modes (2-34) */
         for (mode = 2; mode <= 34; mode++) {
@@ -178,23 +168,29 @@ static void check_pred_angular(HEVCPredContext *h,
                            "hevc_pred_angular_%s_%s_mode%d_%d",
                            block_name[i], mode_category, mode, bit_depth)) {
                 /* Test with c_idx=0 (luma) */
-                randomize_buffers();
-                call_ref(buf0, top, left, stride, 0, mode);
-                call_new(buf1, top, left, stride, 0, mode);
-                if (memcmp(buf0, buf1, size * stride))
-                    fail();
+                randomize_ref_buffers();
+                CLEAR_PIXEL_RECT(buf0);
+                CLEAR_PIXEL_RECT(buf1);
+                call_ref(buf0, top, left, buf0_stride, 0, mode);
+                call_new(buf1, top, left, buf1_stride, 0, mode);
+                checkasm_check_pixel_padded(buf0, buf0_stride,
+                                            buf1, buf1_stride,
+                                            size, size, "dst");
 
                 /* Test with c_idx=1 (chroma) for modes 10/26 to cover
                  * the edge filtering skip path */
                 if (mode == 10 || mode == 26) {
-                    randomize_buffers();
-                    call_ref(buf0, top, left, stride, 1, mode);
-                    call_new(buf1, top, left, stride, 1, mode);
-                    if (memcmp(buf0, buf1, size * stride))
-                        fail();
+                    randomize_ref_buffers();
+                    CLEAR_PIXEL_RECT(buf0);
+                    CLEAR_PIXEL_RECT(buf1);
+                    call_ref(buf0, top, left, buf0_stride, 1, mode);
+                    call_new(buf1, top, left, buf1_stride, 1, mode);
+                    checkasm_check_pixel_padded(buf0, buf0_stride,
+                                                buf1, buf1_stride,
+                                                size, size, "dst");
                 }
 
-                bench_new(buf1, top, left, stride, 0, mode);
+                bench_new(buf1, top, left, buf1_stride, 0, mode);
             }
         }
     }
@@ -305,8 +301,6 @@ static void check_ref_filter_strong(HEVCPredContext *h,
 
 void checkasm_check_hevc_pred(void)
 {
-    LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
-    LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
     LOCAL_ALIGNED_32(uint8_t, top_buf, [PRED_SIZE + 16]);
     LOCAL_ALIGNED_32(uint8_t, left_buf, [PRED_SIZE + 16]);
     /* Add offset of 8 bytes to allow negative indexing (top[-1], left[-1]) */
@@ -318,7 +312,7 @@ void checkasm_check_hevc_pred(void)
         HEVCPredContext h;
 
         ff_hevc_pred_init(&h, bit_depth);
-        check_pred_dc(&h, buf0, buf1, top, left, bit_depth);
+        check_pred_dc(&h, top, left, bit_depth);
     }
     report("pred_dc");
 
@@ -326,7 +320,7 @@ void checkasm_check_hevc_pred(void)
         HEVCPredContext h;
 
         ff_hevc_pred_init(&h, bit_depth);
-        check_pred_planar(&h, buf0, buf1, top, left, bit_depth);
+        check_pred_planar(&h, top, left, bit_depth);
     }
     report("pred_planar");
 
@@ -334,7 +328,7 @@ void checkasm_check_hevc_pred(void)
         HEVCPredContext h;
 
         ff_hevc_pred_init(&h, bit_depth);
-        check_pred_angular(&h, buf0, buf1, top, left, bit_depth);
+        check_pred_angular(&h, top, left, bit_depth);
     }
     report("pred_angular");
 

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to