| 512 | } |
| 513 | |
| 514 | int32_t WelsInitScaledPic (SWelsSvcCodingParam* pParam, Scaled_Picture* pScaledPicture, CMemoryAlign* pMemoryAlign) { |
| 515 | bool bInputPicNeedScaling = JudgeNeedOfScaling (pParam, pScaledPicture); |
| 516 | if (bInputPicNeedScaling) { |
| 517 | pScaledPicture->pScaledInputPicture = AllocPicture (pMemoryAlign, pParam->SUsedPicRect.iWidth, |
| 518 | pParam->SUsedPicRect.iHeight, false, 0); |
| 519 | if (pScaledPicture->pScaledInputPicture == NULL) |
| 520 | return -1; |
| 521 | |
| 522 | // Avoid valgrind false positives. |
| 523 | // |
| 524 | // X86 SIMD downsampling routines may, for convenience, read slightly beyond |
| 525 | // the input data and into the alignment padding area beyond each line. This |
| 526 | // causes valgrind to warn about uninitialized values even if these values |
| 527 | // only affect lanes of a SIMD vector that are effectively never used. |
| 528 | // |
| 529 | // Avoid these false positives by zero-initializing the padding area beyond |
| 530 | // each line of the source buffer used for downsampling. |
| 531 | SPicture* pPic = pScaledPicture->pScaledInputPicture; |
| 532 | ClearEndOfLinePadding (pPic->pData[0], pPic->iLineSize[0], pPic->iWidthInPixel, pPic->iHeightInPixel); |
| 533 | ClearEndOfLinePadding (pPic->pData[1], pPic->iLineSize[1], pPic->iWidthInPixel >> 1, pPic->iHeightInPixel >> 1); |
| 534 | ClearEndOfLinePadding (pPic->pData[2], pPic->iLineSize[2], pPic->iWidthInPixel >> 1, pPic->iHeightInPixel >> 1); |
| 535 | } |
| 536 | return 0; |
| 537 | } |
| 538 | |
| 539 | void FreeScaledPic (Scaled_Picture* pScaledPicture, CMemoryAlign* pMemoryAlign) { |
| 540 | if (pScaledPicture->pScaledInputPicture) { |
no test coverage detected