| 761 | } |
| 762 | |
| 763 | static int32_t SlidingWindow (PWelsDecoderContext pCtx, PRefPic pRefPic) { |
| 764 | PPicture pPic = NULL; |
| 765 | int32_t i = 0; |
| 766 | |
| 767 | if (pRefPic->uiShortRefCount[LIST_0] + pRefPic->uiLongRefCount[LIST_0] >= pCtx->pSps->iNumRefFrames) { |
| 768 | if (pRefPic->uiShortRefCount[LIST_0] == 0) { |
| 769 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "No reference picture in short term list when sliding window"); |
| 770 | return ERR_INFO_INVALID_MMCO_REF_NUM_NOT_ENOUGH; |
| 771 | } |
| 772 | for (i = pRefPic->uiShortRefCount[LIST_0] - 1; i >= 0; i--) { |
| 773 | pPic = WelsDelShortFromList (pRefPic, pRefPic->pShortRefList[LIST_0][i]->iFrameNum); |
| 774 | if (pPic) { |
| 775 | SetUnRef (pPic); |
| 776 | break; |
| 777 | } else { |
| 778 | return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW; |
| 779 | } |
| 780 | } |
| 781 | } |
| 782 | return ERR_NONE; |
| 783 | } |
| 784 | |
| 785 | static PPicture WelsDelShortFromList (PRefPic pRefPic, int32_t iFrameNum) { |
| 786 | int32_t i = 0; |
no test coverage detected