shithub: openh264

Download patch

ref: 59f243b48786e473cf2fb783eaf1d2998db9f51a
parent: b4be8f3f1a6a42e3edf51ddf59b9fb8f2ac55572
author: sijchen <sijchen@cisco.com>
date: Wed Mar 26 12:52:53 EDT 2014

Adjust function interface and add void function for further coworking, adjust test accordingly

--- a/codec/encoder/core/inc/svc_motion_estimate.h
+++ b/codec/encoder/core/inc/svc_motion_estimate.h
@@ -147,11 +147,16 @@
                       const SMVUnitXY ksMinMv, const SMVUnitXY ksMaxMv, const int32_t kiEncStride, const int32_t kiRefStride,
                       int32_t& iBestSadCost);
 
-void LineFullSearch_c(	PSampleSadSatdCostFunc pSad, void *vpMe,
+void LineFullSearch_c(	 void *pFunc, void *vpMe,
                         uint16_t* pMvdTable, const int32_t kiFixedMvd,
                         const int32_t kiEncStride, const int32_t kiRefStride,
                         const int32_t kiMinPos, const int32_t kiMaxPos,
                         const bool bVerticalSearch );
+void VerticalFullSearchUsingSSE41( void *pFunc, void *vpMe,
+														uint16_t* pMvdTable, const int32_t kiFixedMvd,
+														const int32_t kiEncStride, const int32_t kiRefStride,
+													const int32_t kiMinPos, const int32_t kiMaxPos,
+                          const bool bVerticalSearch );
 void WelsMotionCrossSearch(SWelsFuncPtrList *pFuncList,  SDqLayer* pCurLayer, SWelsME * pMe, const SSlice* pSlice);
 
 inline void SetMvWithinIntegerMvRange( const int32_t kiMbWidth, const int32_t kiMbHeight, const int32_t kiMbX, const int32_t kiMbY,
--- a/codec/encoder/core/src/svc_motion_estimate.cpp
+++ b/codec/encoder/core/src/svc_motion_estimate.cpp
@@ -278,13 +278,24 @@
   return false;
 }
 
-void LineFullSearch_c(	PSampleSadSatdCostFunc pSad, void *vpMe,
+void VerticalFullSearchUsingSSE41( void *pFunc, void *vpMe,
+														uint16_t* pMvdTable, const int32_t kiFixedMvd,
+														const int32_t kiEncStride, const int32_t kiRefStride,
+													const int32_t kiMinPos, const int32_t kiMaxPos,
+                          const bool bVerticalSearch )
+{
+  SWelsFuncPtrList *pFuncList      = static_cast<SWelsFuncPtrList *>(pFunc);
+  SWelsME *pMe				                    = static_cast<SWelsME *>(vpMe);
+}
+void LineFullSearch_c(	void *pFunc, void *vpMe,
 													uint16_t* pMvdTable, const int32_t kiFixedMvd,
 													const int32_t kiEncStride, const int32_t kiRefStride,
 													const int32_t kiMinPos, const int32_t kiMaxPos,
                           const bool bVerticalSearch )
 {
+  SWelsFuncPtrList *pFuncList      = static_cast<SWelsFuncPtrList *>(pFunc);
   SWelsME *pMe				                    = static_cast<SWelsME *>(vpMe);
+  PSampleSadSatdCostFunc pSad = pFuncList->sSampleDealingFuncs.pfSampleSad[pMe->uiBlockSize];
   const int32_t kiCurMeBlockPix	= bVerticalSearch?pMe->iCurMeBlockPixY:pMe->iCurMeBlockPixX;
   const int32_t kiStride = bVerticalSearch?kiRefStride:1;
   uint8_t* pRef			      = &pMe->pColoRefMb[(kiMinPos - kiCurMeBlockPix)*kiStride];
@@ -328,7 +339,7 @@
   uint16_t* pMvdCostY = pMe->pMvdCost - iCurMeBlockQpelPixY - pMe->sMvp.iMvY;//do the offset here instead of in the search
 
   //vertical search
-  LineFullSearch_c( pFuncList->sSampleDealingFuncs.pfSampleSad[pMe->uiBlockSize], pMe,
+  LineFullSearch_c( pFuncList, pMe,
     pMvdCostY, pMvdCostX[ iCurMeBlockQpelPixX ],
     kiEncStride, kiRefStride,
     iCurMeBlockPixY + pSlice->sMvStartMin.iMvY,
@@ -336,7 +347,7 @@
 
   //horizontal search
   if (pMe->uiSadCost >= pMe->uiSadCostThreshold) {
-    LineFullSearch_c( pFuncList->sSampleDealingFuncs.pfSampleSad[pMe->uiBlockSize], pMe,
+    LineFullSearch_c( pFuncList, pMe,
       pMvdCostX, pMvdCostY[ iCurMeBlockQpelPixY ],
       kiEncStride, kiRefStride,
       iCurMeBlockPixX + pSlice->sMvStartMin.iMvX,
--- a/test/encoder/EncUT_MotionEstimate.cpp
+++ b/test/encoder/EncUT_MotionEstimate.cpp
@@ -170,7 +170,7 @@
     const int32_t iCurMeBlockQpelPixY = ((iCurMeBlockPixY)<<2);
     uint16_t* pMvdCostX = sMe.pMvdCost - iCurMeBlockQpelPixX - sMe.sMvp.iMvX;	//do the offset here
     uint16_t* pMvdCostY = sMe.pMvdCost - iCurMeBlockQpelPixY - sMe.sMvp.iMvY;
-    LineFullSearch_c ( sFuncList.sSampleDealingFuncs.pfSampleSad[sMe.uiBlockSize], &sMe,
+    LineFullSearch_c ( &sFuncList, &sMe,
                       pMvdCostY, pMvdCostX[ iCurMeBlockQpelPixX ],
                       m_iMaxSearchBlock, m_iWidth,
                       INTPEL_NEEDED_MARGIN,
@@ -232,7 +232,7 @@
     const int32_t iCurMeBlockQpelPixY = ((iCurMeBlockPixY)<<2);
     uint16_t* pMvdCostX = sMe.pMvdCost - iCurMeBlockQpelPixX - sMe.sMvp.iMvX;	//do the offset here
     uint16_t* pMvdCostY = sMe.pMvdCost - iCurMeBlockQpelPixY - sMe.sMvp.iMvY;
-    LineFullSearch_c ( sFuncList.sSampleDealingFuncs.pfSampleSad[sMe.uiBlockSize], &sMe,
+    LineFullSearch_c ( &sFuncList, &sMe,
                       pMvdCostX, pMvdCostY[ iCurMeBlockQpelPixY ],
                       m_iMaxSearchBlock, m_iWidth,
                       INTPEL_NEEDED_MARGIN,