Showing the changes to codec/decoder/core/src/pic_queue.cpp (1 of 12 files). Show all
Unified · Split
| @@ -44,7 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | namespace WelsDec { |
| 46 | 46 | |
| 47 | −void FreePicture (PPicture pPic); | |
| 47 | +void FreePicture (PPicture pPic, CMemoryAlign* pMa); | |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | ///////////////////////////////////Recycled queue management for pictures/////////////////////////////////// |
| @@ -68,8 +68,9 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 17 unmodified lines | ||
| 68 | 68 | int32_t iPicChromaHeight = 0; |
| 69 | 69 | int32_t iLumaSize = 0; |
| 70 | 70 | int32_t iChromaSize = 0; |
| 71 | + CMemoryAlign* pMa = pCtx->pMemAlign; | |
| 71 | 72 | |
| 72 | − pPic = (PPicture) WelsMallocz (sizeof (SPicture), "PPicture"); | |
| 73 | + pPic = (PPicture) pMa->WelsMallocz (sizeof (SPicture), "PPicture"); | |
| 73 | 74 | WELS_VERIFY_RETURN_IF (NULL, NULL == pPic); |
| 74 | 75 | |
| 75 | 76 | memset (pPic, 0, sizeof (SPicture)); |
| @@ -88,9 +89,9 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 12 unmodified lines | ||
| 88 | 89 | pPic->iLinesize[0] = iPicWidth; |
| 89 | 90 | pPic->iLinesize[1] = pPic->iLinesize[2] = iPicChromaWidth; |
| 90 | 91 | } else { |
| 91 | − pPic->pBuffer[0] = static_cast<uint8_t*> (WelsMallocz (iLumaSize /* luma */ | |
| 92 | − + (iChromaSize << 1) /* Cb,Cr */, "_pic->buffer[0]")); | |
| 93 | − WELS_VERIFY_RETURN_PROC_IF (NULL, NULL == pPic->pBuffer[0], FreePicture (pPic)); | |
| 92 | + pPic->pBuffer[0] = static_cast<uint8_t*> (pMa->WelsMallocz (iLumaSize /* luma */ | |
| 93 | + + (iChromaSize << 1) /* Cb,Cr */, "_pic->buffer[0]")); | |
| 94 | + WELS_VERIFY_RETURN_PROC_IF (NULL, NULL == pPic->pBuffer[0], FreePicture (pPic, pMa)); | |
| 94 | 95 | |
| 95 | 96 | memset (pPic->pBuffer[0], 128, (iLumaSize + (iChromaSize << 1))); |
| 96 | 97 | pPic->iLinesize[0] = iPicWidth; |
| @@ -110,14 +111,14 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 13 unmodified lines | ||
| 110 | 111 | return pPic; |
| 111 | 112 | } |
| 112 | 113 | |
| 113 | −void FreePicture (PPicture pPic) { | |
| 114 | +void FreePicture (PPicture pPic, CMemoryAlign* pMa) { | |
| 114 | 115 | if (NULL != pPic) { |
| 115 | 116 | |
| 116 | 117 | if (pPic->pBuffer[0]) { |
| 117 | − WelsFree (pPic->pBuffer[0], "pPic->pBuffer[0]"); | |
| 118 | + pMa->WelsFree (pPic->pBuffer[0], "pPic->pBuffer[0]"); | |
| 118 | 119 | } |
| 119 | 120 | |
| 120 | − WelsFree (pPic, "pPic"); | |
| 121 | + pMa->WelsFree (pPic, "pPic"); | |
| 121 | 122 | |
| 122 | 123 | pPic = NULL; |
| 123 | 124 | } |