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

Showing the changes to test/processing (2 of 5 files). Show all

Unified · Split

2 files
  1. test/processing/ProcessUT_ScrollDetection.cpp +84 −0
  2. test/processing/targets.mk +10 −0
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