| 1385 | } |
| 1386 | |
| 1387 | void CWelsPreProcess::WelsMoveMemoryWrapper (SWelsSvcCodingParam* pSvcParam, SPicture* pDstPic, |
| 1388 | const SSourcePicture* kpSrc, |
| 1389 | const int32_t kiTargetWidth, const int32_t kiTargetHeight) { |
| 1390 | if (VIDEO_FORMAT_I420 != (kpSrc->iColorFormat & (~VIDEO_FORMAT_VFlip))) |
| 1391 | return; |
| 1392 | |
| 1393 | int32_t iSrcWidth = kpSrc->iPicWidth; |
| 1394 | int32_t iSrcHeight = kpSrc->iPicHeight; |
| 1395 | |
| 1396 | if (iSrcHeight > kiTargetHeight) iSrcHeight = kiTargetHeight; |
| 1397 | if (iSrcWidth > kiTargetWidth) iSrcWidth = kiTargetWidth; |
| 1398 | |
| 1399 | // copy from fr26 to fix the odd uiSize failed issue |
| 1400 | if (iSrcWidth & 0x1) -- iSrcWidth; |
| 1401 | if (iSrcHeight & 0x1) -- iSrcHeight; |
| 1402 | |
| 1403 | const int32_t kiSrcTopOffsetY = pSvcParam->SUsedPicRect.iTop; |
| 1404 | const int32_t kiSrcTopOffsetUV = (kiSrcTopOffsetY >> 1); |
| 1405 | const int32_t kiSrcLeftOffsetY = pSvcParam->SUsedPicRect.iLeft; |
| 1406 | const int32_t kiSrcLeftOffsetUV = (kiSrcLeftOffsetY >> 1); |
| 1407 | int32_t iSrcOffset[3] = {0, 0, 0}; |
| 1408 | iSrcOffset[0] = kpSrc->iStride[0] * kiSrcTopOffsetY + kiSrcLeftOffsetY; |
| 1409 | iSrcOffset[1] = kpSrc->iStride[1] * kiSrcTopOffsetUV + kiSrcLeftOffsetUV ; |
| 1410 | iSrcOffset[2] = kpSrc->iStride[2] * kiSrcTopOffsetUV + kiSrcLeftOffsetUV; |
| 1411 | |
| 1412 | uint8_t* pSrcY = kpSrc->pData[0] + iSrcOffset[0]; |
| 1413 | uint8_t* pSrcU = kpSrc->pData[1] + iSrcOffset[1]; |
| 1414 | uint8_t* pSrcV = kpSrc->pData[2] + iSrcOffset[2]; |
| 1415 | const int32_t kiSrcStrideY = kpSrc->iStride[0]; |
| 1416 | const int32_t kiSrcStrideUV = kpSrc->iStride[1]; |
| 1417 | |
| 1418 | uint8_t* pDstY = pDstPic->pData[0]; |
| 1419 | uint8_t* pDstU = pDstPic->pData[1]; |
| 1420 | uint8_t* pDstV = pDstPic->pData[2]; |
| 1421 | const int32_t kiDstStrideY = pDstPic->iLineSize[0]; |
| 1422 | const int32_t kiDstStrideUV = pDstPic->iLineSize[1]; |
| 1423 | |
| 1424 | if (pSrcY) { |
| 1425 | if (iSrcWidth <= 0 || iSrcHeight <= 0 || (iSrcWidth * iSrcHeight > (MAX_MBS_PER_FRAME << 8))) |
| 1426 | return; |
| 1427 | if (kiSrcTopOffsetY >= iSrcHeight || kiSrcLeftOffsetY >= iSrcWidth || iSrcWidth > kiSrcStrideY) |
| 1428 | return; |
| 1429 | } |
| 1430 | if (pDstY) { |
| 1431 | if (kiTargetWidth <= 0 || kiTargetHeight <= 0 || (kiTargetWidth * kiTargetHeight > (MAX_MBS_PER_FRAME << 8))) |
| 1432 | return; |
| 1433 | if (kiTargetWidth > kiDstStrideY) |
| 1434 | return; |
| 1435 | } |
| 1436 | |
| 1437 | if (pSrcY == NULL || pSrcU == NULL || pSrcV == NULL || pDstY == NULL || pDstU == NULL || pDstV == NULL |
| 1438 | || (iSrcWidth & 1) || (iSrcHeight & 1)) { |
| 1439 | } else { |
| 1440 | //i420_to_i420_c |
| 1441 | WelsMoveMemory_c (pDstY, pDstU, pDstV, kiDstStrideY, kiDstStrideUV, |
| 1442 | pSrcY, pSrcU, pSrcV, kiSrcStrideY, kiSrcStrideUV, iSrcWidth, iSrcHeight); |
| 1443 | |
| 1444 | //in VP Process |
nothing calls this directly
no test coverage detected