Showing the changes to codec/decoder/core/src/pic_queue.cpp (1 of 55 files). Show all
Unified · Split
| @@ -108,18 +108,46 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 107 unmodified lines | |||
| 108 | pPic->iFrameNum = -1; | 108 | pPic->iFrameNum = -1; |
| 109 | pPic->bAvailableFlag = true; | 109 | pPic->bAvailableFlag = true; |
| 110 | 110 | ||
| 111 | uint32_t uiMbWidth = (kiPicWidth + 15) >> 4; | ||
| 112 | uint32_t uiMbHeight = (kiPicHeight + 15) >> 4; | ||
| 113 | uint32_t uiMbCount = uiMbWidth * uiMbHeight; | ||
| 114 | pPic->pMbType = (uint32_t*)pMa->WelsMallocz (uiMbCount * sizeof (uint32_t), | ||
| 115 | "pPic->pMbType"); | ||
| 116 | pPic->pMv[LIST_0] = (int16_t (*)[16][2])pMa->WelsMallocz (uiMbCount * sizeof ( | ||
| 117 | int16_t) * MV_A * MB_BLOCK4x4_NUM, "pPic->pMv[]"); | ||
| 118 | pPic->pMv[LIST_1] = (int16_t (*)[16][2])pMa->WelsMallocz (uiMbCount * sizeof ( | ||
| 119 | int16_t) * MV_A * MB_BLOCK4x4_NUM, "pPic->pMv[]"); | ||
| 120 | pPic->pRefIndex[LIST_0] = (int8_t (*)[16])pMa->WelsMallocz (uiMbCount * sizeof ( | ||
| 121 | int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[]"); | ||
| 122 | pPic->pRefIndex[LIST_1] = (int8_t (*)[16])pMa->WelsMallocz (uiMbCount * sizeof ( | ||
| 123 | int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[]"); | ||
| 111 | return pPic; | 124 | return pPic; |
| 112 | } | 125 | } |
| 113 | 126 | ||
| 114 | void FreePicture (PPicture pPic, CMemoryAlign* pMa) { | 127 | void FreePicture (PPicture pPic, CMemoryAlign* pMa) { |
| 115 | if (NULL != pPic) { | 128 | if (NULL != pPic) { |
| 116 | |||
| 117 | if (pPic->pBuffer[0]) { | 129 | if (pPic->pBuffer[0]) { |
| 118 | pMa->WelsFree (pPic->pBuffer[0], "pPic->pBuffer[0]"); | 130 | pMa->WelsFree (pPic->pBuffer[0], "pPic->pBuffer[0]"); |
| 131 | pPic->pBuffer[0] = NULL; | ||
| 119 | } | 132 | } |
| 120 | 133 | ||
| 121 | pMa->WelsFree (pPic, "pPic"); | 134 | if (pPic->pMbType) { |
| 135 | pMa->WelsFree (pPic->pMbType, "pPic->pMbType"); | ||
| 136 | pPic->pMbType = NULL; | ||
| 137 | } | ||
| 122 | 138 | ||
| 139 | for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) { | ||
| 140 | if (pPic->pMv[listIdx]) { | ||
| 141 | pMa->WelsFree (pPic->pMv[listIdx], "pPic->pMv[]"); | ||
| 142 | pPic->pMv[listIdx] = NULL; | ||
| 143 | } | ||
| 144 | |||
| 145 | if (pPic->pRefIndex[listIdx]) { | ||
| 146 | pMa->WelsFree (pPic->pRefIndex[listIdx], "pPic->pRefIndex[]"); | ||
| 147 | pPic->pRefIndex[listIdx] = NULL; | ||
| 148 | } | ||
| 149 | } | ||
| 150 | pMa->WelsFree (pPic, "pPic"); | ||
| 123 | pPic = NULL; | 151 | pPic = NULL; |
| 124 | } | 152 | } |
| 125 | } | 153 | } |