[FFmpeg-cvslog] checkasm/h264dsp: add missing pixel_mask values

James Almer git at videolan.org
Wed May 15 05:18:09 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue May 14 23:17:30 2024 -0300| [8670615743eb36d7b3e9b522266518796df7ec54] | committer: James Almer

checkasm/h264dsp: add missing pixel_mask values

Fixes "runtime error: index 4 out of bounds for type 'uint32_t [3]'" errors
after commit 4ced36744ee0bea5fb7a20d1b2926c588f89ea0b.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8670615743eb36d7b3e9b522266518796df7ec54
---

 tests/checkasm/h264dsp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
index 30ac81e71e..cb180cc44f 100644
--- a/tests/checkasm/h264dsp.c
+++ b/tests/checkasm/h264dsp.c
@@ -27,17 +27,17 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem_internal.h"
 
-static const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
+static const uint32_t pixel_mask[5] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff, 0x0fff0fff, 0x3fff3fff };
 static const uint32_t pixel_mask_lf[3] = { 0xff0fff0f, 0x01ff000f, 0x03ff000f };
 
 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
 #define SIZEOF_COEF  (2 * ((bit_depth + 7) / 8))
 #define PIXEL_STRIDE 16
 
-#define randomize_buffers()                                                  \
+#define randomize_buffers(idx)                                               \
     do {                                                                     \
         int x, y;                                                            \
-        uint32_t mask = pixel_mask[bit_depth - 8];                           \
+        uint32_t mask = pixel_mask[(idx)];                                   \
         for (y = 0; y < sz; y++) {                                           \
             for (x = 0; x < PIXEL_STRIDE; x += 4) {                          \
                 AV_WN32A(src + y * PIXEL_STRIDE + x, rnd() & mask);          \
@@ -189,7 +189,7 @@ static void check_idct(void)
         bit_depth = depths[i];
         ff_h264dsp_init(&h, bit_depth, 1);
         for (sz = 4; sz <= 8; sz += 4) {
-            randomize_buffers();
+            randomize_buffers(i);
 
             if (sz == 4)
                 dct4x4(coef, bit_depth);
@@ -277,7 +277,7 @@ static void check_idct_multiple(void)
                 int offset = (block_y * 16 + block_x) * SIZEOF_PIXEL;
                 int nnz = rnd() % 3;
 
-                randomize_buffers();
+                randomize_buffers(bit_depth - 8);
                 if (sz == 4)
                     dct4x4(coef, bit_depth);
                 else



More information about the ffmpeg-cvslog mailing list