MCPcopy Create free account
hub / github.com/cisco/openh264 / DoLineTest

Method DoLineTest

test/encoder/EncUT_MotionEstimate.cpp:294–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292 }
293}
294void MotionEstimateTest::DoLineTest (PLineFullSearchFunc func, bool vertical) {
295 const int32_t kiMaxBlock16Sad = 72000;//a rough number
296 SWelsFuncPtrList sFuncList;
297 SWelsME sMe;
298
299 const uint8_t kuiQp = rand() % 52;
300 InitMe (kuiQp, 648, m_uiMvdTableSize, m_pMvdCostTable, &sMe);
301
302 SMVUnitXY sTargetMv;
303 WelsInitSampleSadFunc (&sFuncList, 0); //test c functions
304 WelsInitMeFunc (&sFuncList, WelsCPUFeatureDetect (NULL), 1);
305
306 uint8_t* pRefPicCenter = m_pRefData + (m_iHeight / 2) * m_iWidth + (m_iWidth / 2);
307 sMe.iCurMeBlockPixX = (m_iWidth / 2);
308 sMe.iCurMeBlockPixY = (m_iHeight / 2);
309
310 bool bDataGeneratorSucceed = false;
311 bool bFoundMatch = false;
312 int32_t iTryTimes = 100;
313
314 if (vertical) {
315 sTargetMv.iMvX = 0;
316 sTargetMv.iMvY = -sMe.iCurMeBlockPixY + INTPEL_NEEDED_MARGIN + rand() % (m_iHeight - 16 - 2 * INTPEL_NEEDED_MARGIN);
317 } else {
318 sTargetMv.iMvX = -sMe.iCurMeBlockPixX + INTPEL_NEEDED_MARGIN + rand() % (m_iWidth - 16 - 2 * INTPEL_NEEDED_MARGIN);
319 sTargetMv.iMvY = 0;
320 }
321 bDataGeneratorSucceed = false;
322 bFoundMatch = false;
323 while (!bFoundMatch && (iTryTimes--) > 0) {
324 if (!YUVPixelDataGenerator (m_pRefData, m_iWidth, m_iHeight, m_iWidth))
325 continue;
326
327 bDataGeneratorSucceed = true;
328 CopyTargetBlock (m_pSrcBlock, 16, sTargetMv, m_iWidth, pRefPicCenter);
329
330 //clean the sMe status
331 sMe.uiBlockSize = rand() % 5;
332 sMe.pEncMb = m_pSrcBlock;
333 sMe.pRefMb = pRefPicCenter;
334 sMe.pColoRefMb = pRefPicCenter;
335 sMe.sMv.iMvX = sMe.sMv.iMvY = 0;
336 sMe.uiSadCost = sMe.uiSatdCost = kiMaxBlock16Sad;
337 const int32_t iCurMeBlockPixX = sMe.iCurMeBlockPixX;
338 const int32_t iCurMeBlockQpelPixX = ((iCurMeBlockPixX) << 2);
339 const int32_t iCurMeBlockPixY = sMe.iCurMeBlockPixY;
340 const int32_t iCurMeBlockQpelPixY = ((iCurMeBlockPixY) << 2);
341 uint16_t* pMvdCostX = sMe.pMvdCost - iCurMeBlockQpelPixX - sMe.sMvp.iMvX; //do the offset here
342 uint16_t* pMvdCostY = sMe.pMvdCost - iCurMeBlockQpelPixY - sMe.sMvp.iMvY;
343 uint16_t* pMvdCost = vertical ? pMvdCostY : pMvdCostX;
344 int iSize = vertical ? m_iHeight : m_iWidth;
345
346 //the last selection may be affected by MVDcost, that is when smaller MvY will be better
347 if (vertical) {
348 func (&sFuncList, &sMe,
349 pMvdCost,
350 m_iMaxSearchBlock, m_iWidth,
351 INTPEL_NEEDED_MARGIN - sMe.iCurMeBlockPixY,

Callers

nothing calls this directly

Calls 5

WelsInitSampleSadFuncFunction · 0.85
WelsInitMeFuncFunction · 0.85
WelsCPUFeatureDetectFunction · 0.85
CopyTargetBlockFunction · 0.85
InitMeFunction · 0.70

Tested by

no test coverage detected