| 688 | return ERR_NONE; |
| 689 | } |
| 690 | static int32_t MMCOProcess (PWelsDecoderContext pCtx, PRefPic pRefPic, uint32_t uiMmcoType, |
| 691 | int32_t iShortFrameNum, uint32_t uiLongTermPicNum, int32_t iLongTermFrameIdx, int32_t iMaxLongTermFrameIdx) { |
| 692 | PPicture pPic = NULL; |
| 693 | int32_t i = 0; |
| 694 | int32_t iRet = ERR_NONE; |
| 695 | |
| 696 | switch (uiMmcoType) { |
| 697 | case MMCO_SHORT2UNUSED: |
| 698 | pPic = WelsDelShortFromListSetUnref (pRefPic, iShortFrameNum); |
| 699 | if (pPic == NULL) { |
| 700 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "MMCO_SHORT2UNUSED: delete an empty entry from short term list"); |
| 701 | } |
| 702 | break; |
| 703 | case MMCO_LONG2UNUSED: |
| 704 | pPic = WelsDelLongFromListSetUnref (pRefPic, uiLongTermPicNum); |
| 705 | if (pPic == NULL) { |
| 706 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "MMCO_LONG2UNUSED: delete an empty entry from long term list"); |
| 707 | } |
| 708 | break; |
| 709 | case MMCO_SHORT2LONG: |
| 710 | if (iLongTermFrameIdx > pRefPic->iMaxLongTermFrameIdx) { |
| 711 | return ERR_INFO_INVALID_MMCO_LONG_TERM_IDX_EXCEED_MAX; |
| 712 | } |
| 713 | pPic = WelsDelShortFromList (pRefPic, iShortFrameNum); |
| 714 | if (pPic == NULL) { |
| 715 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "MMCO_LONG2LONG: delete an empty entry from short term list"); |
| 716 | break; |
| 717 | } |
| 718 | WelsDelLongFromListSetUnref (pRefPic, iLongTermFrameIdx); |
| 719 | #ifdef LONG_TERM_REF |
| 720 | pCtx->bCurAuContainLtrMarkSeFlag = true; |
| 721 | pCtx->iFrameNumOfAuMarkedLtr = iShortFrameNum; |
| 722 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "ex_mark_avc():::MMCO_SHORT2LONG:::LTR marking....iFrameNum: %d", |
| 723 | pCtx->iFrameNumOfAuMarkedLtr); |
| 724 | #endif |
| 725 | |
| 726 | MarkAsLongTerm (pRefPic, iShortFrameNum, iLongTermFrameIdx, uiLongTermPicNum); |
| 727 | break; |
| 728 | case MMCO_SET_MAX_LONG: |
| 729 | pRefPic->iMaxLongTermFrameIdx = iMaxLongTermFrameIdx; |
| 730 | for (i = 0 ; i < pRefPic->uiLongRefCount[LIST_0]; i++) { |
| 731 | if (pRefPic->pLongRefList[LIST_0][i]->iLongTermFrameIdx > pRefPic->iMaxLongTermFrameIdx) { |
| 732 | WelsDelLongFromListSetUnref (pRefPic, pRefPic->pLongRefList[LIST_0][i]->iLongTermFrameIdx); |
| 733 | } |
| 734 | } |
| 735 | break; |
| 736 | case MMCO_RESET: |
| 737 | WelsResetRefPic (pCtx); |
| 738 | pCtx->pLastDecPicInfo->bLastHasMmco5 = true; |
| 739 | break; |
| 740 | case MMCO_LONG: |
| 741 | if (iLongTermFrameIdx > pRefPic->iMaxLongTermFrameIdx) { |
| 742 | return ERR_INFO_INVALID_MMCO_LONG_TERM_IDX_EXCEED_MAX; |
| 743 | } |
| 744 | WelsDelLongFromListSetUnref (pRefPic, iLongTermFrameIdx); |
| 745 | if (pRefPic->uiLongRefCount[LIST_0] + pRefPic->uiShortRefCount[LIST_0] >= WELS_MAX (1, pCtx->pSps->iNumRefFrames)) { |
| 746 | return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW; |
| 747 | } |
no test coverage detected