shithub: openh264

Download patch

ref: cf5edec5ae21423690c6a4aa16996a2d1c0e92c3
parent: 81467fd93eb81c6671171de0c8b8aa15f04efefb
parent: 1711b497e330de3b5bb1cf7074249d9c2a259424
author: sijchen <[email protected]>
date: Mon May 5 06:29:35 EDT 2014

Merge pull request #785 from mstorsjo/fix-me-test

Fix occasional errors in the motion estimation tests by correcting the range limits

--- a/test/encoder/EncUT_MotionEstimate.cpp
+++ b/test/encoder/EncUT_MotionEstimate.cpp
@@ -147,7 +147,7 @@
   int32_t iTryTimes=100;
 
   sTargetMv.iMvX = 0;
-  sTargetMv.iMvY = WELS_MAX(INTPEL_NEEDED_MARGIN, rand()%m_iHeight-INTPEL_NEEDED_MARGIN);
+  sTargetMv.iMvY = -sMe.iCurMeBlockPixY + INTPEL_NEEDED_MARGIN + rand()%(m_iHeight - 16 - 2*INTPEL_NEEDED_MARGIN);
   bDataGeneratorSucceed = false;
   bFoundMatch = false;
   while (!bFoundMatch && (iTryTimes--)>0) {
@@ -174,7 +174,7 @@
                       pMvdCostY, pMvdCostX[ iCurMeBlockQpelPixX ],
                       m_iMaxSearchBlock, m_iWidth,
                       INTPEL_NEEDED_MARGIN,
-                      m_iHeight-INTPEL_NEEDED_MARGIN, true );
+                      m_iHeight-INTPEL_NEEDED_MARGIN-16, true );
 
     //the last selection may be affected by MVDcost, that is when smaller MvY will be better
     bFoundMatch = (sMe.sMv.iMvX==0
@@ -207,7 +207,7 @@
   bool bFoundMatch = false;
   int32_t iTryTimes=100;
 
-  sTargetMv.iMvX = WELS_MAX(INTPEL_NEEDED_MARGIN, rand()%m_iWidth-INTPEL_NEEDED_MARGIN);
+  sTargetMv.iMvX = -sMe.iCurMeBlockPixX + INTPEL_NEEDED_MARGIN + rand()%(m_iWidth - 16 - 2*INTPEL_NEEDED_MARGIN);
   sTargetMv.iMvY = 0;
   bDataGeneratorSucceed = false;
   bFoundMatch = false;
@@ -235,7 +235,7 @@
                       pMvdCostX, pMvdCostY[ iCurMeBlockQpelPixY ],
                       m_iMaxSearchBlock, m_iWidth,
                       INTPEL_NEEDED_MARGIN,
-                      m_iWidth-INTPEL_NEEDED_MARGIN, false );
+                      m_iWidth-INTPEL_NEEDED_MARGIN-16, false );
 
     //the last selection may be affected by MVDcost, that is when smaller MvY will be better
     bFoundMatch = (sMe.sMv.iMvY==0
@@ -276,7 +276,7 @@
   int32_t iTryTimes=100;
 
   sTargetMv.iMvX = 0;
-  sTargetMv.iMvY = WELS_MAX(INTPEL_NEEDED_MARGIN, rand()%m_iHeight-INTPEL_NEEDED_MARGIN);
+  sTargetMv.iMvY = -sMe.iCurMeBlockPixY + INTPEL_NEEDED_MARGIN + rand()%(m_iHeight - 16 - 2*INTPEL_NEEDED_MARGIN);
   bDataGeneratorSucceed = false;
   bFoundMatch = false;
   while (!bFoundMatch && (iTryTimes--)>0) {
@@ -303,7 +303,7 @@
                       pMvdCostY, pMvdCostX[ iCurMeBlockQpelPixX ],
                       m_iMaxSearchBlock, m_iWidth,
                       INTPEL_NEEDED_MARGIN,
-                      m_iHeight-INTPEL_NEEDED_MARGIN, true );
+                      m_iHeight-INTPEL_NEEDED_MARGIN-16, true );
 
     //the last selection may be affected by MVDcost, that is when smaller MvY will be better
     bFoundMatch = (sMe.sMv.iMvX==0
@@ -316,7 +316,7 @@
     //it is possible that ref at differnt position is identical, but that should be under a low probability
   }
 }
-/*
+
 TEST_F(MotionEstimateTest, TestHorizontalSearch_SSE41)
 {
   const int32_t kiMaxBlock16Sad = 72000;//a rough number
@@ -341,7 +341,7 @@
   bool bFoundMatch = false;
   int32_t iTryTimes=100;
 
-  sTargetMv.iMvX = WELS_MAX(INTPEL_NEEDED_MARGIN, rand()%m_iWidth-INTPEL_NEEDED_MARGIN);
+  sTargetMv.iMvX = -sMe.iCurMeBlockPixX + INTPEL_NEEDED_MARGIN + rand()%(m_iWidth - 16 - 2*INTPEL_NEEDED_MARGIN);
   sTargetMv.iMvY = 0;
   bDataGeneratorSucceed = false;
   bFoundMatch = false;
@@ -369,7 +369,7 @@
                       pMvdCostX, pMvdCostY[ iCurMeBlockQpelPixY ],
                       m_iMaxSearchBlock, m_iWidth,
                       INTPEL_NEEDED_MARGIN,
-                      m_iWidth-INTPEL_NEEDED_MARGIN, false );
+                      m_iWidth-INTPEL_NEEDED_MARGIN-16, false );
 
     //the last selection may be affected by MVDcost, that is when smaller MvY will be better
     bFoundMatch = (sMe.sMv.iMvY==0
@@ -382,5 +382,4 @@
     //it is possible that ref at differnt position is identical, but that should be under a low probability
   }
 }
-*/
-#endif
\ No newline at end of file
+#endif