Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 1 file). Show all
Unified · Split
| @@ -116,10 +116,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 115 unmodified lines | |||
| 116 | } | 116 | } |
| 117 | // copy old PicBuf to new PicBuf | 117 | // copy old PicBuf to new PicBuf |
| 118 | memcpy (pPicNewBuf->ppPic, pPicOldBuf->ppPic, kiOldSize * sizeof (PPicture)); | 118 | memcpy (pPicNewBuf->ppPic, pPicOldBuf->ppPic, kiOldSize * sizeof (PPicture)); |
| 119 | // initialize context in queue | 119 | |
| 120 | pPicNewBuf->iCapacity = kiNewSize; | ||
| 121 | pPicNewBuf->iCurrentIdx = pPicOldBuf->iCurrentIdx; | ||
| 122 | *ppPicBuf = pPicNewBuf; | ||
| 123 | 120 | ||
| 124 | // increase new PicBuf | 121 | // increase new PicBuf |
| 125 | for (iPicIdx = kiOldSize; iPicIdx < kiNewSize; ++ iPicIdx) { | 122 | for (iPicIdx = kiOldSize; iPicIdx < kiNewSize; ++ iPicIdx) { |
| @@ -129,7 +126,18 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 3 unmodified lines | |||
| 129 | } | 126 | } |
| 130 | pPicNewBuf->ppPic[iPicIdx] = pPic; | 127 | pPicNewBuf->ppPic[iPicIdx] = pPic; |
| 131 | } | 128 | } |
| 132 | 129 | // initialize context in queue | |
| 130 | pPicNewBuf->iCapacity = kiNewSize; | ||
| 131 | pPicNewBuf->iCurrentIdx = pPicOldBuf->iCurrentIdx; | ||
| 132 | *ppPicBuf = pPicNewBuf; | ||
| 133 | |||
| 134 | for(int32_t i = 0; i < pPicNewBuf->iCapacity; i++) { | ||
| 135 | pPicNewBuf->ppPic[i]->bUsedAsRef = false; | ||
| 136 | pPicNewBuf->ppPic[i]->bIsLongRef = false; | ||
| 137 | pPicNewBuf->ppPic[i]->uiRefCount = 0; | ||
| 138 | pPicNewBuf->ppPic[i]->bAvailableFlag = true; | ||
| 139 | pPicNewBuf->ppPic[i]->bIsComplete = false; | ||
| 140 | } | ||
| 133 | // remove old PicBuf | 141 | // remove old PicBuf |
| 134 | if (pPicOldBuf->ppPic != NULL) { | 142 | if (pPicOldBuf->ppPic != NULL) { |
| 135 | WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue"); | 143 | WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue"); |
| @@ -138,7 +146,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 2 unmodified lines | |||
| 138 | pPicOldBuf->iCapacity = 0; | 146 | pPicOldBuf->iCapacity = 0; |
| 139 | pPicOldBuf->iCurrentIdx = 0; | 147 | pPicOldBuf->iCurrentIdx = 0; |
| 140 | WelsFree (pPicOldBuf, "pPicOldBuf"); | 148 | WelsFree (pPicOldBuf, "pPicOldBuf"); |
| 141 | 149 | pPicOldBuf = NULL; | |
| 142 | return 0; | 150 | return 0; |
| 143 | } | 151 | } |
| 144 | 152 | ||
| @@ -195,6 +203,13 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 50 unmodified lines | |||
| 195 | pPicNewBuf->iCapacity = kiNewSize; | 203 | pPicNewBuf->iCapacity = kiNewSize; |
| 196 | *ppPicBuf = pPicNewBuf; | 204 | *ppPicBuf = pPicNewBuf; |
| 197 | 205 | ||
| 206 | for(int32_t i = 0; i < pPicNewBuf->iCapacity; i++) { | ||
| 207 | pPicNewBuf->ppPic[i]->bUsedAsRef = false; | ||
| 208 | pPicNewBuf->ppPic[i]->bIsLongRef = false; | ||
| 209 | pPicNewBuf->ppPic[i]->uiRefCount = 0; | ||
| 210 | pPicNewBuf->ppPic[i]->bAvailableFlag = true; | ||
| 211 | pPicNewBuf->ppPic[i]->bIsComplete = false; | ||
| 212 | } | ||
| 198 | // remove old PicBuf | 213 | // remove old PicBuf |
| 199 | if (pPicOldBuf->ppPic != NULL) { | 214 | if (pPicOldBuf->ppPic != NULL) { |
| 200 | WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue"); | 215 | WelsFree (pPicOldBuf->ppPic, "pPicOldBuf->queue"); |
| @@ -203,6 +218,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 2 unmodified lines | |||
| 203 | pPicOldBuf->iCapacity = 0; | 218 | pPicOldBuf->iCapacity = 0; |
| 204 | pPicOldBuf->iCurrentIdx = 0; | 219 | pPicOldBuf->iCurrentIdx = 0; |
| 205 | WelsFree (pPicOldBuf, "pPicOldBuf"); | 220 | WelsFree (pPicOldBuf, "pPicOldBuf"); |
| 221 | pPicOldBuf = NULL; | ||
| 206 | 222 | ||
| 207 | return 0; | 223 | return 0; |
| 208 | } | 224 | } |