Showing the changes to codec/decoder/core/src/pic_queue.cpp (1 of 5 files). Show all
Unified · Split
| @@ -82,19 +82,25 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 81 unmodified lines | |||
| 82 | iLumaSize = iPicWidth * iPicHeight; | 82 | iLumaSize = iPicWidth * iPicHeight; |
| 83 | iChromaSize = iPicChromaWidth * iPicChromaHeight; | 83 | iChromaSize = iPicChromaWidth * iPicChromaHeight; |
| 84 | 84 | ||
| 85 | pPic->pBuffer[0] = static_cast<uint8_t*> (WelsMallocz (iLumaSize /* luma */ | 85 | if (pCtx->bParseOnly) { |
| 86 | + (iChromaSize << 1) /* Cb,Cr */, "_pic->buffer[0]")); | 86 | pPic->pBuffer[0] = pPic->pBuffer[1] = pPic->pBuffer[2] = NULL; |
| 87 | memset (pPic->pBuffer[0], 128, (iLumaSize + (iChromaSize << 1))); | 87 | pPic->pData[0] = pPic->pData[1] = pPic->pData[2] = NULL; |
| 88 | 88 | pPic->iLinesize[0] = iPicWidth; | |
| 89 | WELS_VERIFY_RETURN_PROC_IF (NULL, NULL == pPic->pBuffer[0], FreePicture (pPic)); | 89 | pPic->iLinesize[1] = pPic->iLinesize[2] = iPicChromaWidth; |
| 90 | pPic->iLinesize[0] = iPicWidth; | 90 | } else { |
| 91 | pPic->iLinesize[1] = pPic->iLinesize[2] = iPicChromaWidth; | 91 | pPic->pBuffer[0] = static_cast<uint8_t*> (WelsMallocz (iLumaSize /* luma */ |
| 92 | pPic->pBuffer[1] = pPic->pBuffer[0] + iLumaSize; | 92 | + (iChromaSize << 1) /* Cb,Cr */, "_pic->buffer[0]")); |
| 93 | pPic->pBuffer[2] = pPic->pBuffer[1] + iChromaSize; | 93 | memset (pPic->pBuffer[0], 128, (iLumaSize + (iChromaSize << 1))); |
| 94 | pPic->pData[0] = pPic->pBuffer[0] + (1 + pPic->iLinesize[0]) * PADDING_LENGTH; | 94 | |
| 95 | pPic->pData[1] = pPic->pBuffer[1] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[1]) * PADDING_LENGTH) >> 1); | 95 | WELS_VERIFY_RETURN_PROC_IF (NULL, NULL == pPic->pBuffer[0], FreePicture (pPic)); |
| 96 | pPic->pData[2] = pPic->pBuffer[2] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[2]) * PADDING_LENGTH) >> 1); | 96 | pPic->iLinesize[0] = iPicWidth; |
| 97 | 97 | pPic->iLinesize[1] = pPic->iLinesize[2] = iPicChromaWidth; | |
| 98 | pPic->pBuffer[1] = pPic->pBuffer[0] + iLumaSize; | ||
| 99 | pPic->pBuffer[2] = pPic->pBuffer[1] + iChromaSize; | ||
| 100 | pPic->pData[0] = pPic->pBuffer[0] + (1 + pPic->iLinesize[0]) * PADDING_LENGTH; | ||
| 101 | pPic->pData[1] = pPic->pBuffer[1] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[1]) * PADDING_LENGTH) >> 1); | ||
| 102 | pPic->pData[2] = pPic->pBuffer[2] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[2]) * PADDING_LENGTH) >> 1); | ||
| 103 | } | ||
| 98 | pPic->iPlanes = 3; // yv12 in default | 104 | pPic->iPlanes = 3; // yv12 in default |
| 99 | pPic->iWidthInPixel = kiPicWidth; | 105 | pPic->iWidthInPixel = kiPicWidth; |
| 100 | pPic->iHeightInPixel = kiPicHeight; | 106 | pPic->iHeightInPixel = kiPicHeight; |