shithub: openh264

Download patch

ref: 10e2f90b7ea1b08b164e4185d864d536f7a245ff
parent: ca97f78ae828617e877951b9f1341ac67974ce52
author: Martin Storsjö <martin@martin.st>
date: Mon Jan 26 10:13:25 EST 2015

Bundle MC tests for all motion vectors in one single test

This speeds up the compile time from 21.3 to 2.6 seconds
for the MC test files.

This makes it slightly harder to see exactly which test
failed on a quick glance, but it makes the overall structure of
the unit test output more manageable and readable, by reducing
the number of tests from 1300 to 430.

--- a/test/decoder/DecUT_MotionCompensation.cpp
+++ b/test/decoder/DecUT_MotionCompensation.cpp
@@ -9,36 +9,31 @@
 
 #define CHROMA_FUNC sMcFunc.pMcChromaFunc
 
-#define PREFIX
+#include "mc_test_common.h"
 
-#define DEF_MCCOPYTESTS(pfx)  \
-DEF_MCCOPYTEST (pfx, 2, 2, 1)   \
-DEF_MCCOPYTEST (pfx, 2, 4, 1)   \
-DEF_MCCOPYTEST (pfx, 4, 2, 0)   \
-DEF_MCCOPYTEST (pfx, 4, 4, 0)   \
-DEF_MCCOPYTEST (pfx, 4, 8, 0)   \
-DEF_MCCOPYTEST (pfx, 8, 4, 0)   \
-DEF_MCCOPYTEST (pfx, 8, 8, 0)   \
-DEF_MCCOPYTEST (pfx, 16, 8, 0)  \
-DEF_MCCOPYTEST (pfx, 8, 16, 0)  \
-DEF_MCCOPYTEST (pfx, 16, 16, 0)
+DEF_MCCOPYTEST (, 2, 2, 1)
+DEF_MCCOPYTEST (, 2, 4, 1)
+DEF_MCCOPYTEST (, 4, 2, 0)
+DEF_MCCOPYTEST (, 4, 4, 0)
+DEF_MCCOPYTEST (, 4, 8, 0)
+DEF_MCCOPYTEST (, 8, 4, 0)
+DEF_MCCOPYTEST (, 8, 8, 0)
+DEF_MCCOPYTEST (, 16, 8, 0)
+DEF_MCCOPYTEST (, 8, 16, 0)
+DEF_MCCOPYTEST (, 16, 16, 0)
 
-#define DEF_LUMA_MCTEST(pfx,a,b) \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,4,4)  \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,4,8)  \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,8,4)  \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,8,8)  \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,16,8) \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,8,16) \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,16,16)
+DEF_LUMA_MCTEST (, 4, 4)
+DEF_LUMA_MCTEST (, 4, 8)
+DEF_LUMA_MCTEST (, 8, 4)
+DEF_LUMA_MCTEST (, 8, 8)
+DEF_LUMA_MCTEST (, 16, 8)
+DEF_LUMA_MCTEST (, 8, 16)
+DEF_LUMA_MCTEST (, 16, 16)
 
-#define DEF_CHROMA_MCTEST(pfx,a,b) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,2,2) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,2,4) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,4,2) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,4,4) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,4,8) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,8,4) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,8,8)
-
-#include "mc_test_common.h"
+DEF_CHROMA_MCTEST (, 2, 2)
+DEF_CHROMA_MCTEST (, 2, 4)
+DEF_CHROMA_MCTEST (, 4, 2)
+DEF_CHROMA_MCTEST (, 4, 4)
+DEF_CHROMA_MCTEST (, 4, 8)
+DEF_CHROMA_MCTEST (, 8, 4)
+DEF_CHROMA_MCTEST (, 8, 8)
--- a/test/encoder/EncUT_MotionCompensation.cpp
+++ b/test/encoder/EncUT_MotionCompensation.cpp
@@ -18,24 +18,19 @@
 
 #define CHROMA_FUNC sMcFunc.pfChromaMc
 
-#define PREFIX Enc
+#include "mc_test_common.h"
 
-#define DEF_MCCOPYTESTS(pfx)    \
-DEF_MCCOPYTEST (pfx, 16, 8, 0)  \
-DEF_MCCOPYTEST (pfx, 16, 16, 0)
+DEF_MCCOPYTEST (Enc, 16, 8, 0)
+DEF_MCCOPYTEST (Enc, 16, 16, 0)
 
-#define DEF_LUMA_MCTEST(pfx,a,b) \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,16,8) \
-DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,16,16)
+DEF_LUMA_MCTEST (Enc, 16, 8)
+DEF_LUMA_MCTEST (Enc, 16, 16)
 
-#define DEF_CHROMA_MCTEST(pfx,a,b) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,4,2) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,4,4) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,4,8) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,8,4) \
-DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,8,8)
-
-#include "mc_test_common.h"
+DEF_CHROMA_MCTEST (Enc, 4, 2)
+DEF_CHROMA_MCTEST (Enc, 4, 4)
+DEF_CHROMA_MCTEST (Enc, 4, 8)
+DEF_CHROMA_MCTEST (Enc, 8, 4)
+DEF_CHROMA_MCTEST (Enc, 8, 8)
 
 TEST (EncMcAvg, PixelAvg) {
   SMcFunc sMcFunc;
--- a/test/mc_test_common.h
+++ b/test/mc_test_common.h
@@ -149,11 +149,11 @@
     }\
 }
 
-DEF_MCCOPYTESTS (PREFIX)
-
-#define DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,iW,iH) \
-TEST(pfx##McHorVer##a##b##_c,iW##x##iH)  \
+#define DEF_LUMA_MCTEST(pfx,iW,iH) \
+TEST(pfx##McHorVer,iW##x##iH)  \
 {                       \
+    for (int32_t a = 0; a < 4; a++) { \
+    for (int32_t b = 0; b < 4; b++) { \
     SMcFunc sMcFunc;  \
     uint8_t uSrcAnchor[4][MC_BUFF_HEIGHT][MC_BUFF_SRC_STRIDE]; \
     uint8_t uSrcTest[MC_BUFF_HEIGHT][MC_BUFF_SRC_STRIDE];      \
@@ -197,27 +197,15 @@
           }                                                                             \
       }                                                                                \
     }\
+    }\
+    }\
 }
 
-DEF_LUMA_MCTEST (PREFIX, 0, 1)
-DEF_LUMA_MCTEST (PREFIX, 0, 2)
-DEF_LUMA_MCTEST (PREFIX, 0, 3)
-DEF_LUMA_MCTEST (PREFIX, 1, 0)
-DEF_LUMA_MCTEST (PREFIX, 1, 1)
-DEF_LUMA_MCTEST (PREFIX, 1, 2)
-DEF_LUMA_MCTEST (PREFIX, 1, 3)
-DEF_LUMA_MCTEST (PREFIX, 2, 0)
-DEF_LUMA_MCTEST (PREFIX, 2, 1)
-DEF_LUMA_MCTEST (PREFIX, 2, 2)
-DEF_LUMA_MCTEST (PREFIX, 2, 3)
-DEF_LUMA_MCTEST (PREFIX, 3, 0)
-DEF_LUMA_MCTEST (PREFIX, 3, 1)
-DEF_LUMA_MCTEST (PREFIX, 3, 2)
-DEF_LUMA_MCTEST (PREFIX, 3, 3)
-
-#define DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,iW,iH) \
-TEST(pfx##McChromaWithFragMv_##a##b##_c,iW##x##iH)  \
+#define DEF_CHROMA_MCTEST(pfx,iW,iH) \
+TEST(pfx##McChroma,iW##x##iH)  \
 {                       \
+    for (int32_t a = 0; a < 8; a++) { \
+    for (int32_t b = 0; b < 8; b++) { \
     SMcFunc sMcFunc;  \
     uint8_t uSrcAnchor[MC_BUFF_HEIGHT][MC_BUFF_SRC_STRIDE*2]; \
     uint8_t uSrcTest[MC_BUFF_HEIGHT][MC_BUFF_SRC_STRIDE];      \
@@ -256,75 +244,6 @@
           }                                                                             \
       }                                                                                 \
     }\
+    }\
+    }\
 }
-
-DEF_CHROMA_MCTEST (PREFIX, 0, 1)
-DEF_CHROMA_MCTEST (PREFIX, 0, 2)
-DEF_CHROMA_MCTEST (PREFIX, 0, 3)
-DEF_CHROMA_MCTEST (PREFIX, 0, 4)
-DEF_CHROMA_MCTEST (PREFIX, 0, 5)
-DEF_CHROMA_MCTEST (PREFIX, 0, 6)
-DEF_CHROMA_MCTEST (PREFIX, 0, 7)
-
-DEF_CHROMA_MCTEST (PREFIX, 1, 0)
-DEF_CHROMA_MCTEST (PREFIX, 1, 1)
-DEF_CHROMA_MCTEST (PREFIX, 1, 2)
-DEF_CHROMA_MCTEST (PREFIX, 1, 3)
-DEF_CHROMA_MCTEST (PREFIX, 1, 4)
-DEF_CHROMA_MCTEST (PREFIX, 1, 5)
-DEF_CHROMA_MCTEST (PREFIX, 1, 6)
-DEF_CHROMA_MCTEST (PREFIX, 1, 7)
-
-DEF_CHROMA_MCTEST (PREFIX, 2, 0)
-DEF_CHROMA_MCTEST (PREFIX, 2, 1)
-DEF_CHROMA_MCTEST (PREFIX, 2, 2)
-DEF_CHROMA_MCTEST (PREFIX, 2, 3)
-DEF_CHROMA_MCTEST (PREFIX, 2, 4)
-DEF_CHROMA_MCTEST (PREFIX, 2, 5)
-DEF_CHROMA_MCTEST (PREFIX, 2, 6)
-DEF_CHROMA_MCTEST (PREFIX, 2, 7)
-
-DEF_CHROMA_MCTEST (PREFIX, 3, 0)
-DEF_CHROMA_MCTEST (PREFIX, 3, 1)
-DEF_CHROMA_MCTEST (PREFIX, 3, 2)
-DEF_CHROMA_MCTEST (PREFIX, 3, 3)
-DEF_CHROMA_MCTEST (PREFIX, 3, 4)
-DEF_CHROMA_MCTEST (PREFIX, 3, 5)
-DEF_CHROMA_MCTEST (PREFIX, 3, 6)
-DEF_CHROMA_MCTEST (PREFIX, 3, 7)
-
-DEF_CHROMA_MCTEST (PREFIX, 4, 0)
-DEF_CHROMA_MCTEST (PREFIX, 4, 1)
-DEF_CHROMA_MCTEST (PREFIX, 4, 2)
-DEF_CHROMA_MCTEST (PREFIX, 4, 3)
-DEF_CHROMA_MCTEST (PREFIX, 4, 4)
-DEF_CHROMA_MCTEST (PREFIX, 4, 5)
-DEF_CHROMA_MCTEST (PREFIX, 4, 6)
-DEF_CHROMA_MCTEST (PREFIX, 4, 7)
-
-DEF_CHROMA_MCTEST (PREFIX, 5, 0)
-DEF_CHROMA_MCTEST (PREFIX, 5, 1)
-DEF_CHROMA_MCTEST (PREFIX, 5, 2)
-DEF_CHROMA_MCTEST (PREFIX, 5, 3)
-DEF_CHROMA_MCTEST (PREFIX, 5, 4)
-DEF_CHROMA_MCTEST (PREFIX, 5, 5)
-DEF_CHROMA_MCTEST (PREFIX, 5, 6)
-DEF_CHROMA_MCTEST (PREFIX, 5, 7)
-
-DEF_CHROMA_MCTEST (PREFIX, 6, 0)
-DEF_CHROMA_MCTEST (PREFIX, 6, 1)
-DEF_CHROMA_MCTEST (PREFIX, 6, 2)
-DEF_CHROMA_MCTEST (PREFIX, 6, 3)
-DEF_CHROMA_MCTEST (PREFIX, 6, 4)
-DEF_CHROMA_MCTEST (PREFIX, 6, 5)
-DEF_CHROMA_MCTEST (PREFIX, 6, 6)
-DEF_CHROMA_MCTEST (PREFIX, 6, 7)
-
-DEF_CHROMA_MCTEST (PREFIX, 7, 0)
-DEF_CHROMA_MCTEST (PREFIX, 7, 1)
-DEF_CHROMA_MCTEST (PREFIX, 7, 2)
-DEF_CHROMA_MCTEST (PREFIX, 7, 3)
-DEF_CHROMA_MCTEST (PREFIX, 7, 4)
-DEF_CHROMA_MCTEST (PREFIX, 7, 5)
-DEF_CHROMA_MCTEST (PREFIX, 7, 6)
-DEF_CHROMA_MCTEST (PREFIX, 7, 7)