shithub: openh264

Download patch

ref: 4df4c1d757766365cbc8c41f267d147f5c4b6d36
parent: 49af2b592db59d09c58cd880ece236950581369e
author: Martin Storsjö <[email protected]>
date: Mon Jan 26 08:44:18 EST 2015

Prepare the shared MC test code for adding an encoder MC test

--- a/test/decoder/DecUT_MotionCompensation.cpp
+++ b/test/decoder/DecUT_MotionCompensation.cpp
@@ -4,34 +4,41 @@
 #include "cpu.h"
 using namespace WelsDec;
 
-#define DEF_MCCOPYTESTS    \
-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 LUMA_FUNC(funcs, src, srcstride, dst, dststride, mvx, mvy, width, height) \
+  sMcFunc.pMcLumaFunc (src, srcstride, dst, dststride, mvx, mvy, width, height)
 
-#define DEF_LUMA_MCTEST(a,b) \
-DEF_LUMA_MCTEST_SUBCASE(a,b,4,4)  \
-DEF_LUMA_MCTEST_SUBCASE(a,b,4,8)  \
-DEF_LUMA_MCTEST_SUBCASE(a,b,8,4)  \
-DEF_LUMA_MCTEST_SUBCASE(a,b,8,8)  \
-DEF_LUMA_MCTEST_SUBCASE(a,b,16,8) \
-DEF_LUMA_MCTEST_SUBCASE(a,b,8,16) \
-DEF_LUMA_MCTEST_SUBCASE(a,b,16,16)
+#define CHROMA_FUNC sMcFunc.pMcChromaFunc
 
-#define DEF_CHROMA_MCTEST(a,b) \
-DEF_CHROMA_MCTEST_SUBCASE(a,b,2,2) \
-DEF_CHROMA_MCTEST_SUBCASE(a,b,2,4) \
-DEF_CHROMA_MCTEST_SUBCASE(a,b,4,2) \
-DEF_CHROMA_MCTEST_SUBCASE(a,b,4,4) \
-DEF_CHROMA_MCTEST_SUBCASE(a,b,4,8) \
-DEF_CHROMA_MCTEST_SUBCASE(a,b,8,4) \
-DEF_CHROMA_MCTEST_SUBCASE(a,b,8,8)
+#define PREFIX
+
+#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)
+
+#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)
+
+#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"
--- a/test/mc_test_common.h
+++ b/test/mc_test_common.h
@@ -108,8 +108,8 @@
 }
 
 /**********************MC Unit Test OPENH264 Code Begin******************************/
-#define DEF_MCCOPYTEST(iW,iH, forceC) \
-TEST(McCopy_c,iW##x##iH) \
+#define DEF_MCCOPYTEST(pfx, iW,iH, forceC) \
+TEST(pfx##McCopy_c,iW##x##iH) \
 {                             \
     SMcFunc sMcFunc;      \
     int32_t iCpuCores = 1; \
@@ -138,7 +138,7 @@
       memset(uDstAnchor,0,sizeof(uint8_t)*MC_BUFF_HEIGHT*MC_BUFF_DST_STRIDE);\
       memset(uDstTest,0,sizeof(uint8_t)*MC_BUFF_HEIGHT*MC_BUFF_DST_STRIDE);  \
       MCCopyAnchor(uSrcAnchor[0],MC_BUFF_SRC_STRIDE,uDstAnchor[0],MC_BUFF_DST_STRIDE,iW,iH);   \
-      sMcFunc.pMcLumaFunc(uSrcTest[0],MC_BUFF_SRC_STRIDE,uDstTest[0],MC_BUFF_DST_STRIDE,0,0,iW,iH); \
+      LUMA_FUNC(&sMcFunc,uSrcTest[0],MC_BUFF_SRC_STRIDE,uDstTest[0],MC_BUFF_DST_STRIDE,0,0,iW,iH); \
       for(int32_t j=0;j<MC_BUFF_HEIGHT;j++)   \
       {                                                                             \
         for(int32_t i=0;i<MC_BUFF_DST_STRIDE;i++)                                  \
@@ -149,10 +149,10 @@
     }\
 }
 
-DEF_MCCOPYTESTS
+DEF_MCCOPYTESTS (PREFIX)
 
-#define DEF_LUMA_MCTEST_SUBCASE(a,b,iW,iH) \
-TEST(McHorVer##a##b##_c,iW##x##iH)  \
+#define DEF_LUMA_MCTEST_SUBCASE(pfx,a,b,iW,iH) \
+TEST(pfx##McHorVer##a##b##_c,iW##x##iH)  \
 {                       \
     SMcFunc sMcFunc;  \
     uint8_t uSrcAnchor[4][MC_BUFF_HEIGHT][MC_BUFF_SRC_STRIDE]; \
@@ -188,7 +188,7 @@
       memset(uDstTest,0,sizeof(uint8_t)*MC_BUFF_HEIGHT*MC_BUFF_DST_STRIDE); \
       MCHalfPelFilterAnchor(uSrcInputAnchor[1],uSrcInputAnchor[2],uSrcInputAnchor[3],uSrcInputAnchor[0],MC_BUFF_SRC_STRIDE,iW+1,iH+1,pBuf+4); \
       MCLumaAnchor(uDstAnchor[0],MC_BUFF_DST_STRIDE,uSrcInputAnchor,MC_BUFF_SRC_STRIDE,a,b,iW,iH); \
-      sMcFunc.pMcLumaFunc(&uSrcTest[4][4],MC_BUFF_SRC_STRIDE,uDstTest[0],MC_BUFF_DST_STRIDE,a,b,iW,iH);\
+      LUMA_FUNC(&sMcFunc,&uSrcTest[4][4],MC_BUFF_SRC_STRIDE,uDstTest[0],MC_BUFF_DST_STRIDE,a,b,iW,iH);\
       for(int32_t j=0;j<MC_BUFF_HEIGHT;j++)   \
       {                                                                             \
           for(int32_t i=0;i<MC_BUFF_DST_STRIDE;i++)                                  \
@@ -199,24 +199,24 @@
     }\
 }
 
-DEF_LUMA_MCTEST (0, 1)
-DEF_LUMA_MCTEST (0, 2)
-DEF_LUMA_MCTEST (0, 3)
-DEF_LUMA_MCTEST (1, 0)
-DEF_LUMA_MCTEST (1, 1)
-DEF_LUMA_MCTEST (1, 2)
-DEF_LUMA_MCTEST (1, 3)
-DEF_LUMA_MCTEST (2, 0)
-DEF_LUMA_MCTEST (2, 1)
-DEF_LUMA_MCTEST (2, 2)
-DEF_LUMA_MCTEST (2, 3)
-DEF_LUMA_MCTEST (3, 0)
-DEF_LUMA_MCTEST (3, 1)
-DEF_LUMA_MCTEST (3, 2)
-DEF_LUMA_MCTEST (3, 3)
+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(a,b,iW,iH) \
-TEST(McChromaWithFragMv_##a##b##_c,iW##x##iH)  \
+#define DEF_CHROMA_MCTEST_SUBCASE(pfx,a,b,iW,iH) \
+TEST(pfx##McChromaWithFragMv_##a##b##_c,iW##x##iH)  \
 {                       \
     SMcFunc sMcFunc;  \
     uint8_t uSrcAnchor[MC_BUFF_HEIGHT][MC_BUFF_SRC_STRIDE*2]; \
@@ -247,7 +247,7 @@
       memset(uDstAnchor2,0,sizeof(uint8_t)*MC_BUFF_HEIGHT*MC_BUFF_DST_STRIDE); \
       memset(uDstTest,0,sizeof(uint8_t)*MC_BUFF_HEIGHT*MC_BUFF_DST_STRIDE);     \
       MCChromaAnchor(uDstAnchor1[0],uDstAnchor2[0],MC_BUFF_DST_STRIDE,uSrcAnchor[0],MC_BUFF_SRC_STRIDE*2,a,b,iW,iH); \
-      sMcFunc.pMcChromaFunc(uSrcTest[0],MC_BUFF_SRC_STRIDE,uDstTest[0],MC_BUFF_DST_STRIDE,a,b,iW,iH);\
+      CHROMA_FUNC(uSrcTest[0],MC_BUFF_SRC_STRIDE,uDstTest[0],MC_BUFF_DST_STRIDE,a,b,iW,iH);\
       for(int32_t j=0;j<MC_BUFF_HEIGHT;j++)   \
       {                                                                             \
           for(int32_t i=0;i<MC_BUFF_DST_STRIDE;i++)                                  \
@@ -258,73 +258,73 @@
     }\
 }
 
-DEF_CHROMA_MCTEST (0, 1)
-DEF_CHROMA_MCTEST (0, 2)
-DEF_CHROMA_MCTEST (0, 3)
-DEF_CHROMA_MCTEST (0, 4)
-DEF_CHROMA_MCTEST (0, 5)
-DEF_CHROMA_MCTEST (0, 6)
-DEF_CHROMA_MCTEST (0, 7)
+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 (1, 0)
-DEF_CHROMA_MCTEST (1, 1)
-DEF_CHROMA_MCTEST (1, 2)
-DEF_CHROMA_MCTEST (1, 3)
-DEF_CHROMA_MCTEST (1, 4)
-DEF_CHROMA_MCTEST (1, 5)
-DEF_CHROMA_MCTEST (1, 6)
-DEF_CHROMA_MCTEST (1, 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 (2, 0)
-DEF_CHROMA_MCTEST (2, 1)
-DEF_CHROMA_MCTEST (2, 2)
-DEF_CHROMA_MCTEST (2, 3)
-DEF_CHROMA_MCTEST (2, 4)
-DEF_CHROMA_MCTEST (2, 5)
-DEF_CHROMA_MCTEST (2, 6)
-DEF_CHROMA_MCTEST (2, 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 (3, 0)
-DEF_CHROMA_MCTEST (3, 1)
-DEF_CHROMA_MCTEST (3, 2)
-DEF_CHROMA_MCTEST (3, 3)
-DEF_CHROMA_MCTEST (3, 4)
-DEF_CHROMA_MCTEST (3, 5)
-DEF_CHROMA_MCTEST (3, 6)
-DEF_CHROMA_MCTEST (3, 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 (4, 0)
-DEF_CHROMA_MCTEST (4, 1)
-DEF_CHROMA_MCTEST (4, 2)
-DEF_CHROMA_MCTEST (4, 3)
-DEF_CHROMA_MCTEST (4, 4)
-DEF_CHROMA_MCTEST (4, 5)
-DEF_CHROMA_MCTEST (4, 6)
-DEF_CHROMA_MCTEST (4, 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 (5, 0)
-DEF_CHROMA_MCTEST (5, 1)
-DEF_CHROMA_MCTEST (5, 2)
-DEF_CHROMA_MCTEST (5, 3)
-DEF_CHROMA_MCTEST (5, 4)
-DEF_CHROMA_MCTEST (5, 5)
-DEF_CHROMA_MCTEST (5, 6)
-DEF_CHROMA_MCTEST (5, 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 (6, 0)
-DEF_CHROMA_MCTEST (6, 1)
-DEF_CHROMA_MCTEST (6, 2)
-DEF_CHROMA_MCTEST (6, 3)
-DEF_CHROMA_MCTEST (6, 4)
-DEF_CHROMA_MCTEST (6, 5)
-DEF_CHROMA_MCTEST (6, 6)
-DEF_CHROMA_MCTEST (6, 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 (7, 0)
-DEF_CHROMA_MCTEST (7, 1)
-DEF_CHROMA_MCTEST (7, 2)
-DEF_CHROMA_MCTEST (7, 3)
-DEF_CHROMA_MCTEST (7, 4)
-DEF_CHROMA_MCTEST (7, 5)
-DEF_CHROMA_MCTEST (7, 6)
-DEF_CHROMA_MCTEST (7, 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)