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 | 16 | ASSERT_TRUE(0); \ |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | −TEST(ScrollDetectionTest,TestScroll) | |
| 20 | −{ | |
| 19 | +TEST (ScrollDetectionTest, TestScroll) { | |
| 21 | 20 | 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}; | |
| 24 | 23 | int iStride = 0; |
| 25 | 24 | int iIdx = 0; |
| 26 | 25 | |
| 27 | − for(int i=0; i<4; i++){ | |
| 26 | + for (int i = 0; i < 4; i++) { | |
| 28 | 27 | int iWidth = iWidthSets[i]; |
| 29 | 28 | int iHeight = iHeightSets[i]; |
| 30 | 29 | 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); | |
| 36 | 35 | |
| 37 | − int iMvRange = iHeight/3; | |
| 38 | − int iScrollMv = rand()%(iMvRange<<1) - iMvRange; | |
| 36 | + int iMvRange = iHeight / 3; | |
| 37 | + int iScrollMv = rand() % (iMvRange << 1) - iMvRange; | |
| 39 | 38 | unsigned char* pSrcTmp = pSrc; |
| 40 | 39 | unsigned char* pRefTmp = pRef; |
| 41 | 40 | |
| 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; | |
| 49 | 49 | } |
| 50 | 50 | pSrcTmp += iStride; |
| 51 | 51 | } |
| @@ -65,16 +65,16 @@ TEST(ScrollDetectionTest,TestScroll) · 13 unmodified lines | ||
| 65 | 65 | int iCoreNum = 1; |
| 66 | 66 | unsigned int uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum); |
| 67 | 67 | |
| 68 | − CScrollDetection *pTest =new CScrollDetection(uiCPUFlag); | |
| 68 | + CScrollDetection* pTest = new CScrollDetection (uiCPUFlag); | |
| 69 | 69 | int iMethodIdx = METHOD_SCROLL_DETECTION; |
| 70 | 70 | |
| 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)); | |
| 75 | 75 | |
| 76 | − EXPECT_EQ(sScrollDetectionResult.bScrollDetectFlag,true); | |
| 77 | − EXPECT_EQ(sScrollDetectionResult.iScrollMvY,iScrollMv); | |
| 76 | + EXPECT_EQ (sScrollDetectionResult.bScrollDetectFlag, true); | |
| 77 | + EXPECT_EQ (sScrollDetectionResult.iScrollMvY, iScrollMv); | |
| 78 | 78 | |
| 79 | 79 | delete pTest; |
| 80 | 80 | delete []pSrc; |