[FFmpeg-devel] [PATCH 1/3] tests/checkasm: make randomize_buffers a function for easier debugging

Rodger Combs rodger.combs at gmail.com
Mon Sep 21 04:55:33 CEST 2015


---
 tests/checkasm/vp9dsp.c | 108 +++++++++++++++++++++++++-----------------------
 1 file changed, 57 insertions(+), 51 deletions(-)

diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c
index 6c335e9..d1e7167 100644
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@ -104,58 +104,64 @@ static void check_ipred(void)
     } while (0)
 #define setdx(a,b,c,d) setpx(a,b,(c)-(d)+(rnd()%((d)*2+1)))
 #define setsx(a,b,c,d) setdx(a,b,c,(d) << (bit_depth - 8))
+static void randomize_loopfilter_buffers(int bidx, int lineoff, int str,
+                                         int bit_depth, int dir,
+                                         int* E, int* F, int* H, int* I,
+                                         uint8_t *buf0, uint8_t *buf1)
+{
+    uint32_t mask = (1 << bit_depth) - 1;
+    int off = dir ? lineoff : lineoff * 16;
+    int istride = dir ? 1 : 16;
+    int jstride = dir ? str : 1;
+    int i, j;
+    for (i = 0; i < 2; i++) /* flat16 */ {
+        int idx = off + i * istride, p0, q0;
+        setpx(idx,  0, q0 = rnd() & mask);
+        setsx(idx, -1, p0 = q0, E[bidx] >> 2);
+        for (j = 1; j < 8; j++) {
+            setsx(idx, -1 - j, p0, F[bidx]);
+            setsx(idx, j, q0, F[bidx]);
+        }
+    }
+    for (i = 2; i < 4; i++) /* flat8 */ {
+        int idx = off + i * istride, p0, q0;
+        setpx(idx,  0, q0 = rnd() & mask);
+        setsx(idx, -1, p0 = q0, E[bidx] >> 2);
+        for (j = 1; j < 4; j++) {
+            setsx(idx, -1 - j, p0, F[bidx]);
+            setsx(idx, j, q0, F[bidx]);
+        }
+        for (j = 4; j < 8; j++) {
+            setpx(idx, -1 - j, rnd() & mask);
+            setpx(idx, j, rnd() & mask);
+        }
+    }
+    for (i = 4; i < 6; i++) /* regular */ {
+        int idx = off + i * istride, p2, p1, p0, q0, q1, q2;
+        setpx(idx,  0, q0 = rnd() & mask);
+        setsx(idx,  1, q1 = q0, I[bidx]);
+        setsx(idx,  2, q2 = q1, I[bidx]);
+        setsx(idx,  3, q2,      I[bidx]);
+        setsx(idx, -1, p0 = q0, E[bidx] >> 2);
+        setsx(idx, -2, p1 = p0, I[bidx]);
+        setsx(idx, -3, p2 = p1, I[bidx]);
+        setsx(idx, -4, p2,      I[bidx]);
+        for (j = 4; j < 8; j++) {
+            setpx(idx, -1 - j, rnd() & mask);
+            setpx(idx, j, rnd() & mask);
+        }
+    }
+    for (i = 6; i < 8; i++) /* off */ {
+        int idx = off + i * istride;
+        for (j = 0; j < 8; j++) {
+            setpx(idx, -1 - j, rnd() & mask);
+            setpx(idx, j, rnd() & mask);
+        }
+    }
+}
 #define randomize_buffers(bidx, lineoff, str) \
-    do { \
-        uint32_t mask = (1 << bit_depth) - 1; \
-        int off = dir ? lineoff : lineoff * 16; \
-        int istride = dir ? 1 : 16; \
-        int jstride = dir ? str : 1; \
-        int i, j; \
-        for (i = 0; i < 2; i++) /* flat16 */ { \
-            int idx = off + i * istride, p0, q0; \
-            setpx(idx,  0, q0 = rnd() & mask); \
-            setsx(idx, -1, p0 = q0, E[bidx] >> 2); \
-            for (j = 1; j < 8; j++) { \
-                setsx(idx, -1 - j, p0, F[bidx]); \
-                setsx(idx, j, q0, F[bidx]); \
-            } \
-        } \
-        for (i = 2; i < 4; i++) /* flat8 */ { \
-            int idx = off + i * istride, p0, q0; \
-            setpx(idx,  0, q0 = rnd() & mask); \
-            setsx(idx, -1, p0 = q0, E[bidx] >> 2); \
-            for (j = 1; j < 4; j++) { \
-                setsx(idx, -1 - j, p0, F[bidx]); \
-                setsx(idx, j, q0, F[bidx]); \
-            } \
-            for (j = 4; j < 8; j++) { \
-                setpx(idx, -1 - j, rnd() & mask); \
-                setpx(idx, j, rnd() & mask); \
-            } \
-        } \
-        for (i = 4; i < 6; i++) /* regular */ { \
-            int idx = off + i * istride, p2, p1, p0, q0, q1, q2; \
-            setpx(idx,  0, q0 = rnd() & mask); \
-            setsx(idx,  1, q1 = q0, I[bidx]); \
-            setsx(idx,  2, q2 = q1, I[bidx]); \
-            setsx(idx,  3, q2,      I[bidx]); \
-            setsx(idx, -1, p0 = q0, E[bidx] >> 2); \
-            setsx(idx, -2, p1 = p0, I[bidx]); \
-            setsx(idx, -3, p2 = p1, I[bidx]); \
-            setsx(idx, -4, p2,      I[bidx]); \
-            for (j = 4; j < 8; j++) { \
-                setpx(idx, -1 - j, rnd() & mask); \
-                setpx(idx, j, rnd() & mask); \
-            } \
-        } \
-        for (i = 6; i < 8; i++) /* off */ { \
-            int idx = off + i * istride; \
-            for (j = 0; j < 8; j++) { \
-                setpx(idx, -1 - j, rnd() & mask); \
-                setpx(idx, j, rnd() & mask); \
-            } \
-        } \
-    } while (0)
+        randomize_loopfilter_buffers(bidx, lineoff, str, bit_depth, dir, \
+                                     E, F, H, I, buf0, buf1)
 
 static void check_loopfilter()
 {
-- 
2.5.1



More information about the ffmpeg-devel mailing list