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
70 70
71PROCESSING_INCLUDES = \71PROCESSING_INCLUDES = \
72 -Icodec/processing/interface \72 -Icodec/processing/interface \
73 -Icodec/processing/src/common73 -Icodec/processing/src/common \
74 -Icodec/processing/src/scrolldetection
74 75
75GTEST_INCLUDES += \76GTEST_INCLUDES += \
76 -Igtest \77 -Igtest \
@@ -92,6 +93,7 @@ CODEC_UNITTEST_LDFLAGS = -L. $(call LINK_LIB,gtest) $(call LINK_LIB,decoder) $(c · 15 unmodified lines
92CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)93CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
93DECODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -Itest -Itest/decoder94DECODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -Itest -Itest/decoder
94ENCODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(ENCODER_INCLUDES) -Itest -Itest/encoder95ENCODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(ENCODER_INCLUDES) -Itest -Itest/encoder
96PROCESSING_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(PROCESSING_INCLUDES) -Itest -Itest/processing
95API_TEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) -Itest -Itest/api97API_TEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) -Itest -Itest/api
96.PHONY: test gtest-bootstrap clean98.PHONY: test gtest-bootstrap clean
97 99
@@ -158,9 +160,10 @@ include build/gtest-targets.mk · 60 unmodified lines
158include test/api/targets.mk160include test/api/targets.mk
159include test/decoder/targets.mk161include test/decoder/targets.mk
160include test/encoder/targets.mk162include test/encoder/targets.mk
163include test/processing/targets.mk
161binaries: codec_unittest$(EXEEXT)164binaries: codec_unittest$(EXEEXT)
162BINARIES += codec_unittest$(EXEEXT)165BINARIES += codec_unittest$(EXEEXT)
163codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(API_TEST_OBJS) $(CODEC_UNITTEST_DEPS)166codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(PROCESSING_UNITTEST_OBJS) $(API_TEST_OBJS) $(CODEC_UNITTEST_DEPS)
164 $(QUIET)rm -f $@167 $(QUIET)rm -f $@
165 $(QUIET_CXX)$(CXX) $(CXX_LINK_O) $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)168 $(QUIET_CXX)$(CXX) $(CXX_LINK_O) $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)
166endif169endif
build/mktargets.sh+1−0
@@ -9,5 +9,6 @@ python build/mktargets.py --directory codec/console/dec --binary h264dec · 8 unmodified lines
9python build/mktargets.py --directory codec/console/enc --binary h264enc9python build/mktargets.py --directory codec/console/enc --binary h264enc
10python build/mktargets.py --directory test/encoder --prefix encoder_unittest10python build/mktargets.py --directory test/encoder --prefix encoder_unittest
11python build/mktargets.py --directory test/decoder --prefix decoder_unittest11python build/mktargets.py --directory test/decoder --prefix decoder_unittest
12python build/mktargets.py --directory test/processing --prefix processing_unittest
12python build/mktargets.py --directory test/api --prefix api_test13python build/mktargets.py --directory test/api --prefix api_test
13python build/mktargets.py --directory gtest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc14python 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
38WELSVP_NAMESPACE_BEGIN38WELSVP_NAMESPACE_BEGIN
39 39
40EResult CScrollDetection::Process(int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap){40EResult CScrollDetection::Process(int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap){
41 if (pRefPixMap->pPixel[0] == NULL || pRefPixMap->pPixel[1] == NULL || pRefPixMap->pPixel[2] == NULL41 if (pRefPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[0] == NULL ||
42 || pSrcPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[1] == NULL || pSrcPixMap->pPixel[2] == NULL42 pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){
43 || pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){
44 return RET_INVALIDPARAM;43 return RET_INVALIDPARAM;
45 }44 }
46 45
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
12using namespace nsWelsVP;
13
14#define ASSERT_MEMORY_FAIL2X(A, B) \
15 if (NULL == B) { \
16 delete []A;\
17 ASSERT_TRUE(0); \
18 }
19
20TEST(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 @@
1PROCESSING_UNITTEST_SRCDIR=test/processing
2PROCESSING_UNITTEST_CPP_SRCS=\
3 $(PROCESSING_UNITTEST_SRCDIR)/ProcessUT_ScrollDetection.cpp\
4
5PROCESSING_UNITTEST_OBJS += $(PROCESSING_UNITTEST_CPP_SRCS:.cpp=.$(OBJ))
6
7OBJS += $(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