From 39f3a8e6a1cd72413944c895c5e9d99ed4c7f5c5 Mon Sep 17 00:00:00 2001 From: luofl Date: Sat, 20 Apr 2019 20:34:43 +0800 Subject: [PATCH] Fix B-frame without positive reference frames as P-frame. --- Source/Lib/Codec/EbPictureDecisionProcess.c | 6 +++++- Source/Lib/Codec/EbPredictionStructure.c | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/Lib/Codec/EbPictureDecisionProcess.c b/Source/Lib/Codec/EbPictureDecisionProcess.c index 993a57a5b..a725a18b2 100644 --- a/Source/Lib/Codec/EbPictureDecisionProcess.c +++ b/Source/Lib/Codec/EbPictureDecisionProcess.c @@ -1560,8 +1560,12 @@ void* PictureDecisionKernel(void *inputPtr) EbObjectIncLiveCount( paReferenceEntryPtr->pPcsPtr->pPcsWrapperPtr, 1); - + --paReferenceEntryPtr->dependentCount; + } else { + pictureControlSetPtr->sliceType = EB_P_PICTURE; + ((EbPaReferenceObject_t *)pictureControlSetPtr->paReferencePictureWrapperPtr->objectPtr)->sliceType = + EB_P_PICTURE; } } diff --git a/Source/Lib/Codec/EbPredictionStructure.c b/Source/Lib/Codec/EbPredictionStructure.c index ba44ba03d..49db10845 100644 --- a/Source/Lib/Codec/EbPredictionStructure.c +++ b/Source/Lib/Codec/EbPredictionStructure.c @@ -1711,6 +1711,13 @@ static EB_ERRORTYPE PredictionStructureCtor( } } + // Adjust List1 if there is no positive reference frames. + if (predictionStructurePtr->predStructEntryPtrArray[entryIndex]->positiveRefPicsTotalCount == 0 && + predictionStructurePtr->predStructEntryPtrArray[entryIndex]->refList1.referenceListCount > 0) { + predictionStructurePtr->predStructEntryPtrArray[entryIndex]->refList1.referenceList = 0; + predictionStructurePtr->predStructEntryPtrArray[entryIndex]->refList1.referenceListCount = 0; + } + // Adjust Reference Counts if list is empty predictionStructurePtr->predStructEntryPtrArray[entryIndex]->refPicsList0TotalCountMinus1 = (predictionStructurePtr->predStructEntryPtrArray[entryIndex]->refPicsList0TotalCountMinus1 == ~0) ?