History

Fix ossz-buzz reported bug 13185: make the code to be more readable.

xiaotiansf committed 7 years ago

Commit 0fc55021 parent cbc0adb1 file · +19 −15Browse files

Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 1 file). Show all

Unified · Split

codec/decoder/core/src/decoder.cpp+19−15
@@ -165,6 +165,24 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 164 unmodified lines
165 return ERR_NONE;165 return ERR_NONE;
166}166}
167 167
168static void ResetRefPicReferences (const PWelsDecoderContext& pCtx, const PPicture& inPPic) {
169 //seach and reset the references of deleted references.
170 for (int32_t list = LIST_0; list < LIST_A; ++list) {
171 int32_t refIdx = 0;
172 PPicture pPic = pCtx->sRefPic.pRefList[list][refIdx];
173 while (refIdx < MAX_DPB_COUNT && pPic != NULL) {
174 ++refIdx;
175 int32_t ref = 0;
176 while (ref < MAX_DPB_COUNT && *pPic->pRefPic[ref] != NULL) {
177 if (*pPic->pRefPic[ref] == inPPic) {
178 *pPic->pRefPic[ref] = NULL;
179 }
180 ++ref;
181 }
182 }
183 }
184}
185
168static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,186static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
169 const int32_t kiPicWidth, const int32_t kiPicHeight, const int32_t kiNewSize) {187 const int32_t kiPicWidth, const int32_t kiPicHeight, const int32_t kiNewSize) {
170 PPicBuff pPicOldBuf = *ppPicBuf;188 PPicBuff pPicOldBuf = *ppPicBuf;
@@ -212,22 +230,8 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 41 unmodified lines
212 for (iPicIdx = iDelIdx; iPicIdx < kiOldSize; iPicIdx++) {230 for (iPicIdx = iDelIdx; iPicIdx < kiOldSize; iPicIdx++) {
213 if (iPrevPicIdx != iPicIdx) {231 if (iPrevPicIdx != iPicIdx) {
214 if (pPicOldBuf->ppPic[iPicIdx] != NULL) {232 if (pPicOldBuf->ppPic[iPicIdx] != NULL) {
233 ResetRefPicReferences (pCtx, pPicOldBuf->ppPic[iPicIdx]);
215 FreePicture (pPicOldBuf->ppPic[iPicIdx], pMa);234 FreePicture (pPicOldBuf->ppPic[iPicIdx], pMa);
216 //seach and reset the references of deleted references.
217 for (int32_t list = LIST_0; list < LIST_A; ++list) {
218 int32_t refIdx = 0;
219 PPicture pPic = pCtx->sRefPic.pRefList[list][refIdx];
220 while (refIdx < MAX_DPB_COUNT && pPic != NULL) {
221 ++refIdx;
222 int32_t ref = 0;
223 while (ref < MAX_DPB_COUNT && *pPic->pRefPic[ref] != NULL) {
224 if (*pPic->pRefPic[ref] == pPicOldBuf->ppPic[iPicIdx]) {
225 *pPic->pRefPic[ref] = NULL;
226 }
227 ++ref;
228 }
229 }
230 }
231 pPicOldBuf->ppPic[iPicIdx] = NULL;235 pPicOldBuf->ppPic[iPicIdx] = NULL;
232 }236 }
233 }237 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t