History

astyle all

huili2 committed 12 years ago

Commit dc3fae41 parent 101265385 files · +4906 −4701Browse files

Showing the changes to test/processing/ProcessUT_ScrollDetection.cpp (1 of 85 files). Show all

Unified · Split

test/processing/ProcessUT_ScrollDetection.cpp+26−26
@@ -16,36 +16,36 @@ using namespace nsWelsVP; · 15 unmodified lines
1616 ASSERT_TRUE(0); \
1717 }
1818
19−TEST(ScrollDetectionTest,TestScroll)
20−{
19+TEST (ScrollDetectionTest, TestScroll) {
2120 unsigned char* pSrc, *pRef;
22− int iWidthSets[4] = {640,1024,1280,1980};
23− int iHeightSets[4] = {360,768,720,1080};
21+ int iWidthSets[4] = {640, 1024, 1280, 1980};
22+ int iHeightSets[4] = {360, 768, 720, 1080};
2423 int iStride = 0;
2524 int iIdx = 0;
2625
27− for(int i=0; i<4; i++){
26+ for (int i = 0; i < 4; i++) {
2827 int iWidth = iWidthSets[i];
2928 int iHeight = iHeightSets[i];
3029 iStride = iWidth + 16;
31− pSrc = new unsigned char[iHeight*iStride];
32− ASSERT_TRUE(NULL != pSrc);
33− pRef = new unsigned char[iHeight*iStride];
34− ASSERT_MEMORY_FAIL2X(pSrc, pRef)
35− RandomPixelDataGenerator(pRef, iWidth, iHeight, iStride, iIdx );
30+ pSrc = new unsigned char[iHeight * iStride];
31+ ASSERT_TRUE (NULL != pSrc);
32+ pRef = new unsigned char[iHeight * iStride];
33+ ASSERT_MEMORY_FAIL2X (pSrc, pRef)
34+ RandomPixelDataGenerator (pRef, iWidth, iHeight, iStride, iIdx);
3635
37− int iMvRange = iHeight/3;
38− int iScrollMv = rand()%(iMvRange<<1) - iMvRange;
36+ int iMvRange = iHeight / 3;
37+ int iScrollMv = rand() % (iMvRange << 1) - iMvRange;
3938 unsigned char* pSrcTmp = pSrc;
4039 unsigned char* pRefTmp = pRef;
4140
42− for (int j=0;j<iHeight;j++) {
43− if ((j+iScrollMv)>=0 && (j+iScrollMv)<iHeight)
44− for (int i=0;i<iWidth;i++) {
45− memcpy(pSrcTmp , &pRefTmp[(j+iScrollMv)*iStride], iWidth*sizeof(unsigned char));
46− } else {
47− for (int i=0;i<iWidth;i++)
48− pSrcTmp[i] = rand()%256;
41+ for (int j = 0; j < iHeight; j++) {
42+ if ((j + iScrollMv) >= 0 && (j + iScrollMv) < iHeight)
43+ for (int i = 0; i < iWidth; i++) {
44+ memcpy (pSrcTmp , &pRefTmp[ (j + iScrollMv)*iStride], iWidth * sizeof (unsigned char));
45+ }
46+ else {
47+ for (int i = 0; i < iWidth; i++)
48+ pSrcTmp[i] = rand() % 256;
4949 }
5050 pSrcTmp += iStride;
5151 }
@@ -65,16 +65,16 @@ TEST(ScrollDetectionTest,TestScroll) · 13 unmodified lines
6565 int iCoreNum = 1;
6666 unsigned int uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum);
6767
68− CScrollDetection *pTest =new CScrollDetection(uiCPUFlag);
68+ CScrollDetection* pTest = new CScrollDetection (uiCPUFlag);
6969 int iMethodIdx = METHOD_SCROLL_DETECTION;
7070
71− pTest->Set(iMethodIdx, (&sScrollDetectionResult));
72− int ret = pTest->Process(iMethodIdx,&sSrcMap, &sRefMap);
73− EXPECT_EQ(ret,0);
74− pTest->Get(iMethodIdx, (&sScrollDetectionResult));
71+ pTest->Set (iMethodIdx, (&sScrollDetectionResult));
72+ int ret = pTest->Process (iMethodIdx, &sSrcMap, &sRefMap);
73+ EXPECT_EQ (ret, 0);
74+ pTest->Get (iMethodIdx, (&sScrollDetectionResult));
7575
76− EXPECT_EQ(sScrollDetectionResult.bScrollDetectFlag,true);
77− EXPECT_EQ(sScrollDetectionResult.iScrollMvY,iScrollMv);
76+ EXPECT_EQ (sScrollDetectionResult.bScrollDetectFlag, true);
77+ EXPECT_EQ (sScrollDetectionResult.iScrollMvY, iScrollMv);
7878
7979 delete pTest;
8080 delete []pSrc;

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