[FFmpeg-cvslog] tests/checkasm: make randomize_buffers a function for easier debugging

Rodger Combs git at videolan.org
Sat Sep 26 03:39:29 CEST 2015


ffmpeg | branch: master | Rodger Combs <rodger.combs at gmail.com> | Sun Sep 20 21:55:33 2015 -0500| [f559812a84374bd7f5c225be991e62cff83fd089] | committer: Michael Niedermayer

tests/checkasm: make randomize_buffers a function for easier debugging

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 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 eb9228a..46af118 100644
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@ -106,58 +106,64 @@ static void check_ipred(void)
 // c can be an assignment and must not be put under ()
 #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(void)
 {



More information about the ffmpeg-cvslog mailing list