History

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

lyao2 committed 12 years ago

Commit 34ad7191 parent ba8e3f25 files · +102 −5Browse files

Unified · Split

5 files
  1. Makefile +5 −2
  2. build/mktargets.sh +1 −0
  3. codec/processing/src/scrolldetection/ScrollDetection.cpp +2 −3
  4. test/processing/ProcessUT_ScrollDetection.cpp +84 −0
  5. test/processing/targets.mk +10 −0
Makefile+5−2
@@ -70,7 +70,8 @@ ENCODER_INCLUDES = \ · 69 unmodified lines
7070
7171 PROCESSING_INCLUDES = \
7272 -Icodec/processing/interface \
73− -Icodec/processing/src/common
73+ -Icodec/processing/src/common \
74+ -Icodec/processing/src/scrolldetection
7475
7576 GTEST_INCLUDES += \
7677 -Igtest \
@@ -92,6 +93,7 @@ CODEC_UNITTEST_LDFLAGS = -L. $(call LINK_LIB,gtest) $(call LINK_LIB,decoder) $(c · 15 unmodified lines
9293 CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
9394 DECODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -Itest -Itest/decoder
9495 ENCODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(ENCODER_INCLUDES) -Itest -Itest/encoder
96+PROCESSING_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(PROCESSING_INCLUDES) -Itest -Itest/processing
9597 API_TEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) -Itest -Itest/api
9698 .PHONY: test gtest-bootstrap clean
9799
@@ -158,9 +160,10 @@ include build/gtest-targets.mk · 60 unmodified lines
158160 include test/api/targets.mk
159161 include test/decoder/targets.mk
160162 include test/encoder/targets.mk
163+include test/processing/targets.mk
161164 binaries: codec_unittest$(EXEEXT)
162165 BINARIES += codec_unittest$(EXEEXT)
163−codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(API_TEST_OBJS) $(CODEC_UNITTEST_DEPS)
166+codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(PROCESSING_UNITTEST_OBJS) $(API_TEST_OBJS) $(CODEC_UNITTEST_DEPS)
164167 $(QUIET)rm -f $@
165168 $(QUIET_CXX)$(CXX) $(CXX_LINK_O) $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)
166169 endif
build/mktargets.sh+1−0
@@ -9,5 +9,6 @@ python build/mktargets.py --directory codec/console/dec --binary h264dec · 8 unmodified lines
99 python build/mktargets.py --directory codec/console/enc --binary h264enc
1010 python build/mktargets.py --directory test/encoder --prefix encoder_unittest
1111 python build/mktargets.py --directory test/decoder --prefix decoder_unittest
12+python build/mktargets.py --directory test/processing --prefix processing_unittest
1213 python build/mktargets.py --directory test/api --prefix api_test
1314 python build/mktargets.py --directory gtest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc
codec/processing/src/scrolldetection/ScrollDetection.cpp+2−3
@@ -38,9 +38,8 @@ · 37 unmodified lines
3838 WELSVP_NAMESPACE_BEGIN
3939
4040 EResult CScrollDetection::Process(int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap){
41− if (pRefPixMap->pPixel[0] == NULL || pRefPixMap->pPixel[1] == NULL || pRefPixMap->pPixel[2] == NULL
42− || pSrcPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[1] == NULL || pSrcPixMap->pPixel[2] == NULL
43− || pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){
41+ if (pRefPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[0] == NULL ||
42+ pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){
4443 return RET_INVALIDPARAM;
4544 }
4645
test/processing/ProcessUT_ScrollDetection.cpp+84−0
@@ -0,0 +1,84 @@
1+#include <gtest/gtest.h>
2+#include <math.h>
3+#include <string.h>
4+#include "cpu.h"
5+#include "cpu_core.h"
6+#include "typedef.h"
7+#include "IWelsVP.h"
8+#include "ScrollDetection.h"
9+#include "ScrollDetectionFuncs.h"
10+#include "utils/DataGenerator.h"
11+
12+using namespace nsWelsVP;
13+
14+#define ASSERT_MEMORY_FAIL2X(A, B) \
15+ if (NULL == B) { \
16+ delete []A;\
17+ ASSERT_TRUE(0); \
18+ }
19+
20+TEST(ScrollDetectionTest,TestScroll)
21+{
22+ uint8_t* pSrc, *pRef;
23+ int32_t iWidthSets[4] = {640,1024,1280,1980};
24+ int32_t iHeightSets[4] = {360,768,720,1080};
25+ int32_t iStride = 0;
26+ int32_t iIdx = 0;
27+
28+ for(int32_t i=0; i<4; i++){
29+ int32_t iWidth = iWidthSets[i];
30+ int32_t iHeight = iHeightSets[i];
31+ iStride = iWidth + 16;
32+ pSrc = new uint8_t[iHeight*iStride];
33+ ASSERT_TRUE(NULL != pSrc);
34+ pRef = new uint8_t[iHeight*iStride];
35+ ASSERT_MEMORY_FAIL2X(pSrc, pRef)
36+ RandomPixelDataGenerator(pRef, iWidth, iHeight, iStride, iIdx );
37+
38+ int32_t iMvRange = iHeight/3;
39+ int32_t iScrollMv = rand()%(iMvRange<<1) - iMvRange;
40+ uint8_t* pSrcTmp = pSrc;
41+ uint8_t* pRefTmp = pRef;
42+
43+ for (int32_t j=0;j<iHeight;j++) {
44+ if ((j+iScrollMv)>=0 && (j+iScrollMv)<iHeight)
45+ for (int32_t i=0;i<iWidth;i++) {
46+ memcpy(pSrcTmp , &pRefTmp[(j+iScrollMv)*iStride], iWidth*sizeof(uint8_t));
47+ } else {
48+ for (int32_t i=0;i<iWidth;i++)
49+ pSrcTmp[i] = rand()%256;
50+ }
51+ pSrcTmp += iStride;
52+ }
53+
54+
55+ SPixMap sSrcMap = { { 0 } };
56+ SPixMap sRefMap = { { 0 } };
57+
58+ sSrcMap.pPixel[0] = pSrc;
59+ sRefMap.pPixel[0] = pRef;
60+ sSrcMap.iStride[0] = sRefMap.iStride[0] = iStride;
61+ sSrcMap.sRect.iRectWidth = sRefMap.sRect.iRectWidth = iWidth;
62+ sSrcMap.sRect.iRectHeight = sRefMap.sRect.iRectHeight = iHeight;
63+
64+ SScrollDetectionParam sScrollDetectionResult;
65+ WelsMemset (&sScrollDetectionResult, 0, sizeof (sScrollDetectionResult));
66+ int32_t iCoreNum = 1;
67+ uint32_t uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum);
68+
69+ CScrollDetection *pTest =new CScrollDetection(uiCPUFlag);
70+ int32_t iMethodIdx = METHOD_SCROLL_DETECTION;
71+
72+ pTest->Set(iMethodIdx, (&sScrollDetectionResult));
73+ int32_t ret = pTest->Process(iMethodIdx,&sSrcMap, &sRefMap);
74+ EXPECT_EQ(ret,0);
75+ pTest->Get(iMethodIdx, (&sScrollDetectionResult));
76+
77+ EXPECT_EQ(sScrollDetectionResult.bScrollDetectFlag,1);
78+ EXPECT_EQ(sScrollDetectionResult.iScrollMvY,iScrollMv);
79+
80+ delete pTest;
81+ delete []pSrc;
82+ delete []pRef;
83+ }
84+}
test/processing/targets.mk+10−0
@@ -0,0 +1,10 @@
1+PROCESSING_UNITTEST_SRCDIR=test/processing
2+PROCESSING_UNITTEST_CPP_SRCS=\
3+ $(PROCESSING_UNITTEST_SRCDIR)/ProcessUT_ScrollDetection.cpp\
4+
5+PROCESSING_UNITTEST_OBJS += $(PROCESSING_UNITTEST_CPP_SRCS:.cpp=.$(OBJ))
6+
7+OBJS += $(PROCESSING_UNITTEST_OBJS)
8+$(PROCESSING_UNITTEST_SRCDIR)/%.$(OBJ): $(PROCESSING_UNITTEST_SRCDIR)/%.cpp
9+ $(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(PROCESSING_UNITTEST_CFLAGS) $(PROCESSING_UNITTEST_INCLUDES) -c $(CXX_O) $<
10+

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t