Showing the changes to test/processing/ProcessUT_ScrollDetection.cpp (1 of 85 files). Show all
Unified · Split
| @@ -16,36 +16,36 @@ using namespace nsWelsVP; · 15 unmodified lines | |||
| 16 | ASSERT_TRUE(0); \ | 16 | ASSERT_TRUE(0); \ |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | TEST(ScrollDetectionTest,TestScroll) | 19 | TEST (ScrollDetectionTest, TestScroll) { |
| 20 | { | ||
| 21 | unsigned char* pSrc, *pRef; | 20 | unsigned char* pSrc, *pRef; |
| 22 | int iWidthSets[4] = {640,1024,1280,1980}; | 21 | int iWidthSets[4] = {640, 1024, 1280, 1980}; |
| 23 | int iHeightSets[4] = {360,768,720,1080}; | 22 | int iHeightSets[4] = {360, 768, 720, 1080}; |
| 24 | int iStride = 0; | 23 | int iStride = 0; |
| 25 | int iIdx = 0; | 24 | int iIdx = 0; |
| 26 | 25 | ||
| 27 | for(int i=0; i<4; i++){ | 26 | for (int i = 0; i < 4; i++) { |
| 28 | int iWidth = iWidthSets[i]; | 27 | int iWidth = iWidthSets[i]; |
| 29 | int iHeight = iHeightSets[i]; | 28 | int iHeight = iHeightSets[i]; |
| 30 | iStride = iWidth + 16; | 29 | iStride = iWidth + 16; |
| 31 | pSrc = new unsigned char[iHeight*iStride]; | 30 | pSrc = new unsigned char[iHeight * iStride]; |
| 32 | ASSERT_TRUE(NULL != pSrc); | 31 | ASSERT_TRUE (NULL != pSrc); |
| 33 | pRef = new unsigned char[iHeight*iStride]; | 32 | pRef = new unsigned char[iHeight * iStride]; |
| 34 | ASSERT_MEMORY_FAIL2X(pSrc, pRef) | 33 | ASSERT_MEMORY_FAIL2X (pSrc, pRef) |
| 35 | RandomPixelDataGenerator(pRef, iWidth, iHeight, iStride, iIdx ); | 34 | RandomPixelDataGenerator (pRef, iWidth, iHeight, iStride, iIdx); |
| 36 | 35 | ||
| 37 | int iMvRange = iHeight/3; | 36 | int iMvRange = iHeight / 3; |
| 38 | int iScrollMv = rand()%(iMvRange<<1) - iMvRange; | 37 | int iScrollMv = rand() % (iMvRange << 1) - iMvRange; |
| 39 | unsigned char* pSrcTmp = pSrc; | 38 | unsigned char* pSrcTmp = pSrc; |
| 40 | unsigned char* pRefTmp = pRef; | 39 | unsigned char* pRefTmp = pRef; |
| 41 | 40 | ||
| 42 | for (int j=0;j<iHeight;j++) { | 41 | for (int j = 0; j < iHeight; j++) { |
| 43 | if ((j+iScrollMv)>=0 && (j+iScrollMv)<iHeight) | 42 | if ((j + iScrollMv) >= 0 && (j + iScrollMv) < iHeight) |
| 44 | for (int i=0;i<iWidth;i++) { | 43 | for (int i = 0; i < iWidth; i++) { |
| 45 | memcpy(pSrcTmp , &pRefTmp[(j+iScrollMv)*iStride], iWidth*sizeof(unsigned char)); | 44 | memcpy (pSrcTmp , &pRefTmp[ (j + iScrollMv)*iStride], iWidth * sizeof (unsigned char)); |
| 46 | } else { | 45 | } |
| 47 | for (int i=0;i<iWidth;i++) | 46 | else { |
| 48 | pSrcTmp[i] = rand()%256; | 47 | for (int i = 0; i < iWidth; i++) |
| 48 | pSrcTmp[i] = rand() % 256; | ||
| 49 | } | 49 | } |
| 50 | pSrcTmp += iStride; | 50 | pSrcTmp += iStride; |
| 51 | } | 51 | } |
| @@ -65,16 +65,16 @@ TEST(ScrollDetectionTest,TestScroll) · 13 unmodified lines | |||
| 65 | int iCoreNum = 1; | 65 | int iCoreNum = 1; |
| 66 | unsigned int uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum); | 66 | unsigned int uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum); |
| 67 | 67 | ||
| 68 | CScrollDetection *pTest =new CScrollDetection(uiCPUFlag); | 68 | CScrollDetection* pTest = new CScrollDetection (uiCPUFlag); |
| 69 | int iMethodIdx = METHOD_SCROLL_DETECTION; | 69 | int iMethodIdx = METHOD_SCROLL_DETECTION; |
| 70 | 70 | ||
| 71 | pTest->Set(iMethodIdx, (&sScrollDetectionResult)); | 71 | pTest->Set (iMethodIdx, (&sScrollDetectionResult)); |
| 72 | int ret = pTest->Process(iMethodIdx,&sSrcMap, &sRefMap); | 72 | int ret = pTest->Process (iMethodIdx, &sSrcMap, &sRefMap); |
| 73 | EXPECT_EQ(ret,0); | 73 | EXPECT_EQ (ret, 0); |
| 74 | pTest->Get(iMethodIdx, (&sScrollDetectionResult)); | 74 | pTest->Get (iMethodIdx, (&sScrollDetectionResult)); |
| 75 | 75 | ||
| 76 | EXPECT_EQ(sScrollDetectionResult.bScrollDetectFlag,true); | 76 | EXPECT_EQ (sScrollDetectionResult.bScrollDetectFlag, true); |
| 77 | EXPECT_EQ(sScrollDetectionResult.iScrollMvY,iScrollMv); | 77 | EXPECT_EQ (sScrollDetectionResult.iScrollMvY, iScrollMv); |
| 78 | 78 | ||
| 79 | delete pTest; | 79 | delete pTest; |
| 80 | delete []pSrc; | 80 | delete []pSrc; |