Showing the changes to test/processing/ProcessUT_ScrollDetection.cpp (1 of 1 file). Show all
Unified · Split
| @@ -18,33 +18,33 @@ using namespace nsWelsVP; · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | TEST(ScrollDetectionTest,TestScroll) | 19 | TEST(ScrollDetectionTest,TestScroll) |
| 20 | { | 20 | { |
| 21 | uint8_t* pSrc, *pRef; | 21 | unsigned char* pSrc, *pRef; |
| 22 | int32_t iWidthSets[4] = {640,1024,1280,1980}; | 22 | int iWidthSets[4] = {640,1024,1280,1980}; |
| 23 | int32_t iHeightSets[4] = {360,768,720,1080}; | 23 | int iHeightSets[4] = {360,768,720,1080}; |
| 24 | int32_t iStride = 0; | 24 | int iStride = 0; |
| 25 | int32_t iIdx = 0; | 25 | int iIdx = 0; |
| 26 | 26 | ||
| 27 | for(int32_t i=0; i<4; i++){ | 27 | for(int i=0; i<4; i++){ |
| 28 | int32_t iWidth = iWidthSets[i]; | 28 | int iWidth = iWidthSets[i]; |
| 29 | int32_t iHeight = iHeightSets[i]; | 29 | int iHeight = iHeightSets[i]; |
| 30 | iStride = iWidth + 16; | 30 | iStride = iWidth + 16; |
| 31 | pSrc = new uint8_t[iHeight*iStride]; | 31 | pSrc = new unsigned char[iHeight*iStride]; |
| 32 | ASSERT_TRUE(NULL != pSrc); | 32 | ASSERT_TRUE(NULL != pSrc); |
| 33 | pRef = new uint8_t[iHeight*iStride]; | 33 | pRef = new unsigned char[iHeight*iStride]; |
| 34 | ASSERT_MEMORY_FAIL2X(pSrc, pRef) | 34 | ASSERT_MEMORY_FAIL2X(pSrc, pRef) |
| 35 | RandomPixelDataGenerator(pRef, iWidth, iHeight, iStride, iIdx ); | 35 | RandomPixelDataGenerator(pRef, iWidth, iHeight, iStride, iIdx ); |
| 36 | 36 | ||
| 37 | int32_t iMvRange = iHeight/3; | 37 | int iMvRange = iHeight/3; |
| 38 | int32_t iScrollMv = rand()%(iMvRange<<1) - iMvRange; | 38 | int iScrollMv = rand()%(iMvRange<<1) - iMvRange; |
| 39 | uint8_t* pSrcTmp = pSrc; | 39 | unsigned char* pSrcTmp = pSrc; |
| 40 | uint8_t* pRefTmp = pRef; | 40 | unsigned char* pRefTmp = pRef; |
| 41 | 41 | ||
| 42 | for (int32_t j=0;j<iHeight;j++) { | 42 | for (int j=0;j<iHeight;j++) { |
| 43 | if ((j+iScrollMv)>=0 && (j+iScrollMv)<iHeight) | 43 | if ((j+iScrollMv)>=0 && (j+iScrollMv)<iHeight) |
| 44 | for (int32_t i=0;i<iWidth;i++) { | 44 | for (int i=0;i<iWidth;i++) { |
| 45 | memcpy(pSrcTmp , &pRefTmp[(j+iScrollMv)*iStride], iWidth*sizeof(uint8_t)); | 45 | memcpy(pSrcTmp , &pRefTmp[(j+iScrollMv)*iStride], iWidth*sizeof(unsigned char)); |
| 46 | } else { | 46 | } else { |
| 47 | for (int32_t i=0;i<iWidth;i++) | 47 | for (int i=0;i<iWidth;i++) |
| 48 | pSrcTmp[i] = rand()%256; | 48 | pSrcTmp[i] = rand()%256; |
| 49 | } | 49 | } |
| 50 | pSrcTmp += iStride; | 50 | pSrcTmp += iStride; |
| @@ -62,14 +62,14 @@ TEST(ScrollDetectionTest,TestScroll) · 11 unmodified lines | |||
| 62 | 62 | ||
| 63 | SScrollDetectionParam sScrollDetectionResult; | 63 | SScrollDetectionParam sScrollDetectionResult; |
| 64 | WelsMemset (&sScrollDetectionResult, 0, sizeof (sScrollDetectionResult)); | 64 | WelsMemset (&sScrollDetectionResult, 0, sizeof (sScrollDetectionResult)); |
| 65 | int32_t iCoreNum = 1; | 65 | int iCoreNum = 1; |
| 66 | uint32_t uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum); | 66 | unsigned int uiCPUFlag = WelsCPUFeatureDetect (&iCoreNum); |
| 67 | 67 | ||
| 68 | CScrollDetection *pTest =new CScrollDetection(uiCPUFlag); | 68 | CScrollDetection *pTest =new CScrollDetection(uiCPUFlag); |
| 69 | int32_t iMethodIdx = METHOD_SCROLL_DETECTION; | 69 | int iMethodIdx = METHOD_SCROLL_DETECTION; |
| 70 | 70 | ||
| 71 | pTest->Set(iMethodIdx, (&sScrollDetectionResult)); | 71 | pTest->Set(iMethodIdx, (&sScrollDetectionResult)); |
| 72 | int32_t 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 | ||