From 4df4c1d757766365cbc8c41f267d147f5c4b6d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 26 Jan 2015 13:44:18 +0200 Subject: [PATCH] Prepare the shared MC test code for adding an encoder MC test --- test/decoder/DecUT_MotionCompensation.cpp | 61 ++++---- test/mc_test_common.h | 176 +++++++++++----------- 2 files changed, 122 insertions(+), 115 deletions(-) diff --git a/test/decoder/DecUT_MotionCompensation.cpp b/test/decoder/DecUT_MotionCompensation.cpp index 4acf6597..af51b901 100644 --- 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" diff --git a/test/mc_test_common.h b/test/mc_test_common.h index 37c7c3e0..bf1ee6e6 100644 --- a/test/mc_test_common.h +++ b/test/mc_test_common.h @@ -108,8 +108,8 @@ static void MCChromaAnchor (uint8_t* pDstU, uint8_t* pDstV, int32_t iDstStride, } /**********************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 @@ TEST(McCopy_c,iW##x##iH) \ 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