Squashed commit of the following:
commit f73d6cf0fcae5f401fc2817ab736af996113ca09 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Thu Apr 24 15:02:21 2014 +0800 remove comments commit 75416c2cf6c1ebb7aabf9e8c52d8c7163a8009b7 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Thu Apr 24 14:52:09 2014 +0800 for test commit 7dfb65ce514edcff892bfb3919921cadcce1d055 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Thu Apr 24 14:12:31 2014 +0800 for test commit eff771645e8c349dc4e454ab1751530b3cef18ed Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Thu Apr 24 10:51:34 2014 +0800 for test commit 9c42b9a7a04068e70be94529941f549b58e63780 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Wed Apr 23 17:46:59 2014 +0800 update cpu_flag commit cce3fccc0a4249b82ab2e0e92fe53579ef942799 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Wed Apr 23 17:26:56 2014 +0800 for test commit 3d292995b3c4437a2674a687cc4e8da1b5fb83f5 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Wed Apr 23 16:45:57 2014 +0800 remove space commit c608c2ba7cf010f1dcf8c0344f68536c48e181cb Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Wed Apr 23 16:42:43 2014 +0800 remove tabs commit 3b769342a06e25ad23a2c86f23a94d0d7ca1a4c8 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Wed Apr 23 16:33:55 2014 +0800 refine UT case commit 89b869f0c8f8c9bbd61e9de32caa77877aeae064 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Tue Apr 22 13:40:50 2014 +0800 Squashed commit of the following: commit abe55494134ef8342ffe9566df4e1b3265fe21b6 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Tue Apr 22 10:50:07 2014 +0800 set MV range commit 8c7f70c351e50d945c29118bed8b3781c22b7dbc Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Mon Apr 21 16:53:10 2014 +0800 refinement commit bf35f19a7dc88743aacf8e89e681e0ef3302d40a Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Fri Apr 18 17:24:31 2014 +0800 correct tabs commit 130b7f895d7020bfc571d910966891da93150242 Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Fri Apr 18 17:17:06 2014 +0800 correct format commit 0429703b0844363559dd2b3d44e45034232a9d8f Author: lyao2 <lyao2@LYAO2-WS01.cisco.com> Date: Fri Apr 18 15:12:44 2014 +0800 add scroll UT
This commit is contained in:
parent
ba8e3f2967
commit
34ad719cf2
7
Makefile
7
Makefile
@ -70,7 +70,8 @@ ENCODER_INCLUDES = \
|
||||
|
||||
PROCESSING_INCLUDES = \
|
||||
-Icodec/processing/interface \
|
||||
-Icodec/processing/src/common
|
||||
-Icodec/processing/src/common \
|
||||
-Icodec/processing/src/scrolldetection
|
||||
|
||||
GTEST_INCLUDES += \
|
||||
-Igtest \
|
||||
@ -92,6 +93,7 @@ CODEC_UNITTEST_LDFLAGS = -L. $(call LINK_LIB,gtest) $(call LINK_LIB,decoder) $(c
|
||||
CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
|
||||
DECODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -Itest -Itest/decoder
|
||||
ENCODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(ENCODER_INCLUDES) -Itest -Itest/encoder
|
||||
PROCESSING_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(PROCESSING_INCLUDES) -Itest -Itest/processing
|
||||
API_TEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) -Itest -Itest/api
|
||||
.PHONY: test gtest-bootstrap clean
|
||||
|
||||
@ -158,9 +160,10 @@ include build/gtest-targets.mk
|
||||
include test/api/targets.mk
|
||||
include test/decoder/targets.mk
|
||||
include test/encoder/targets.mk
|
||||
include test/processing/targets.mk
|
||||
binaries: codec_unittest$(EXEEXT)
|
||||
BINARIES += codec_unittest$(EXEEXT)
|
||||
codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(API_TEST_OBJS) $(CODEC_UNITTEST_DEPS)
|
||||
codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(PROCESSING_UNITTEST_OBJS) $(API_TEST_OBJS) $(CODEC_UNITTEST_DEPS)
|
||||
$(QUIET)rm -f $@
|
||||
$(QUIET_CXX)$(CXX) $(CXX_LINK_O) $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)
|
||||
endif
|
||||
|
@ -9,5 +9,6 @@ python build/mktargets.py --directory codec/console/dec --binary h264dec
|
||||
python build/mktargets.py --directory codec/console/enc --binary h264enc
|
||||
python build/mktargets.py --directory test/encoder --prefix encoder_unittest
|
||||
python build/mktargets.py --directory test/decoder --prefix decoder_unittest
|
||||
python build/mktargets.py --directory test/processing --prefix processing_unittest
|
||||
python build/mktargets.py --directory test/api --prefix api_test
|
||||
python build/mktargets.py --directory gtest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc
|
||||
|
@ -38,9 +38,8 @@
|
||||
WELSVP_NAMESPACE_BEGIN
|
||||
|
||||
EResult CScrollDetection::Process(int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap){
|
||||
if (pRefPixMap->pPixel[0] == NULL || pRefPixMap->pPixel[1] == NULL || pRefPixMap->pPixel[2] == NULL
|
||||
|| pSrcPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[1] == NULL || pSrcPixMap->pPixel[2] == NULL
|
||||
|| pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){
|
||||
if (pRefPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[0] == NULL ||
|
||||
pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){
|
||||
return RET_INVALIDPARAM;
|
||||
}
|
||||
|
||||
|
84
test/processing/ProcessUT_ScrollDetection.cpp
Normal file
84
test/processing/ProcessUT_ScrollDetection.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "cpu.h"
|
||||
#include "cpu_core.h"
|
||||
#include "typedef.h"
|
||||
#include "IWelsVP.h"
|
||||
#include "ScrollDetection.h"
|
||||
#include "ScrollDetectionFuncs.h"
|
||||
#include "utils/DataGenerator.h"
|
||||
|
||||
using namespace nsWelsVP;
|
||||
|
||||
#define ASSERT_MEMORY_FAIL2X(A, B) \
|
||||
if (NULL == B) { \
|
||||
delete []A;\
|
||||
ASSERT_TRUE(0); \
|
||||
}
|
||||
|
||||
TEST(ScrollDetectionTest,TestScroll)
|
||||
{
|
||||
uint8_t* pSrc, *pRef;
|
||||
int32_t iWidthSets[4] = {640,1024,1280,1980};
|
||||
int32_t iHeightSets[4] = {360,768,720,1080};
|
||||
int32_t iStride = 0;
|
||||
int32_t iIdx = 0;
|
||||
|
||||
for(int32_t i=0; i<4; i++){
|
||||
int32_t iWidth = iWidthSets[i];
|
||||
int32_t iHeight = iHeightSets[i];
|
||||
iStride = iWidth + 16;
|
||||
pSrc = new uint8_t[iHeight*iStride];
|
||||
ASSERT_TRUE(NULL != pSrc);
|
||||
pRef = new uint8_t[iHeight*iStride];
|
||||
ASSERT_MEMORY_FAIL2X(pSrc, pRef)
|
||||
RandomPixelDataGenerator(pRef, iWidth, iHeight, iStride, iIdx );
|
||||
|
||||
int32_t iMvRange = iHeight/3;
|
||||
int32_t iScrollMv = rand()%(iMvRange<<1) - iMvRange;
|
||||
uint8_t* pSrcTmp = pSrc;
|
||||
uint8_t* pRefTmp = pRef;
|
||||
|
||||
for (int32_t j=0;j<iHeight;j++) {
|
||||
if ((j+iScrollMv)>=0 && (j+iScrollMv)<iHeight)
|
||||
for (int32_t i=0;i<iWidth;i++) {
|
||||
memcpy(pSrcTmp , &pRefTmp[(j+iScrollMv)*iStride], iWidth*sizeof(uint8_t));
|
||||
} else {
|
||||
for (int32_t i=0;i<iWidth;i++)
|
||||
pSrcTmp[i] = rand()%256;
|
||||
}
|
||||
pSrcTmp += iStride;
|
||||
}
|
||||
|
||||
|
||||
SPixMap sSrcMap = { { 0 } };
|
||||
SPixMap sRefMap = { { 0 } };
|
||||
|
||||
sSrcMap.pPixel[0] = pSrc;
|
||||
sRefMap.pPixel[0] = pRef;
|
||||
sSrcMap.iStride[0] = sRefMap.iStride[0] = iStride;
|
||||
sSrcMap.sRect.iRectWidth = sRefMap.sRect.iRectWidth = iWidth;
|
||||
sSrcMap.sRect.iRectHeight = sRefMap.sRect.iRectHeight = iHeight;
|
||||
|
||||
SScrollDetectionParam sScrollDetectionResult;
|
||||
WelsMemset (&sScrollDetectionResult, 0, sizeof (sScrollDetectionResult));
|
||||
int32_t iCoreNum = 1;
|
||||
uint32_t uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum);
|
||||
|
||||
CScrollDetection *pTest =new CScrollDetection(uiCPUFlag);
|
||||
int32_t iMethodIdx = METHOD_SCROLL_DETECTION;
|
||||
|
||||
pTest->Set(iMethodIdx, (&sScrollDetectionResult));
|
||||
int32_t ret = pTest->Process(iMethodIdx,&sSrcMap, &sRefMap);
|
||||
EXPECT_EQ(ret,0);
|
||||
pTest->Get(iMethodIdx, (&sScrollDetectionResult));
|
||||
|
||||
EXPECT_EQ(sScrollDetectionResult.bScrollDetectFlag,1);
|
||||
EXPECT_EQ(sScrollDetectionResult.iScrollMvY,iScrollMv);
|
||||
|
||||
delete pTest;
|
||||
delete []pSrc;
|
||||
delete []pRef;
|
||||
}
|
||||
}
|
10
test/processing/targets.mk
Normal file
10
test/processing/targets.mk
Normal file
@ -0,0 +1,10 @@
|
||||
PROCESSING_UNITTEST_SRCDIR=test/processing
|
||||
PROCESSING_UNITTEST_CPP_SRCS=\
|
||||
$(PROCESSING_UNITTEST_SRCDIR)/ProcessUT_ScrollDetection.cpp\
|
||||
|
||||
PROCESSING_UNITTEST_OBJS += $(PROCESSING_UNITTEST_CPP_SRCS:.cpp=.$(OBJ))
|
||||
|
||||
OBJS += $(PROCESSING_UNITTEST_OBJS)
|
||||
$(PROCESSING_UNITTEST_SRCDIR)/%.$(OBJ): $(PROCESSING_UNITTEST_SRCDIR)/%.cpp
|
||||
$(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(PROCESSING_UNITTEST_CFLAGS) $(PROCESSING_UNITTEST_INCLUDES) -c $(CXX_O) $<
|
||||
|
Loading…
x
Reference in New Issue
Block a user