shithub: openh264

Download patch

ref: 79157ce6327b171fa7f5a5359730087f4025de38
parent: ef590de0dcd14f4a2c27b90aa2b5a6c60c04adff
author: Sijia Chen <[email protected]>
date: Tue Sep 9 11:05:57 EDT 2014

fix a LTR range problem when LTR num is larger than 2

--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -87,7 +87,7 @@
 
   for (i = 0; i < MAX_SHORT_REF_COUNT + 1; i++)
     pRefList->pShortRefList[i] = NULL;
-  for (i = 0; i < MAX_LONG_REF_COUNT + 1; i++)
+  for (i = 0; i < pCtx->pSvcParam->iLTRRefNum + 1; i++)
     pRefList->pLongRefList[i] = NULL;
   for (i = 0; i < pCtx->pSvcParam->iNumRefFrame + 1; i++)
     SetUnref (pRefList->pRef[i]);
@@ -805,8 +805,43 @@
           }
         }
       }
+    } // end of (int idx = 0; idx < pVaaExt->iNumOfAvailableRef; idx++)
+#if 1
+    FILE* flog = fopen("ReferenceLog.txt","a+");
+    WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,"CurrentFramePoc=%d\n", iPOC);
+    fprintf(flog,"CurrentFramePoc=%d, isLTR=%d\n", iPOC, pCtx->bCurFrameMarkedAsSceneLtr);
+    for (int j=0;j<iNumRef;j++) {
+          SPicture*	 pARefPicture = pRefList->pLongRefList[j];
+          if (pARefPicture!=NULL) {
+          fprintf(flog,"\tRefLot[%d]: iPictureType=%d, bUsedAsRef=%d, bIsLongRef=%d, bIsSceneLTR=%d, uiTemporalId=%d, iFrameNum=%d, iMarkFrameNum=%d, iLongTermPicNum=%d, uiRecieveConfirmed=%d\n",
+              j,
+              pARefPicture->iPictureType,
+              pARefPicture->bUsedAsRef, 
+              pARefPicture->bIsLongRef,
+              pARefPicture->bIsSceneLTR,
+              pARefPicture->uiTemporalId,
+              pARefPicture->iFrameNum,
+              pARefPicture->iMarkFrameNum,
+              pARefPicture->iLongTermPicNum,
+              pARefPicture->uiRecieveConfirmed);
+           WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,"\tRefLot[%d]: iPictureType=%d, bUsedAsRef=%d, bIsLongRef=%d, bIsSceneLTR=%d, uiTemporalId=%d, iFrameNum=%d, iMarkFrameNum=%d, iLongTermPicNum=%d, uiRecieveConfirmed=%d\n",
+              j,
+              pARefPicture->iPictureType,
+              pARefPicture->bUsedAsRef, 
+              pARefPicture->bIsLongRef,
+              pARefPicture->bIsSceneLTR,
+              pARefPicture->uiTemporalId,
+              pARefPicture->iFrameNum,
+              pARefPicture->iMarkFrameNum,
+              pARefPicture->iLongTermPicNum,
+              pARefPicture->uiRecieveConfirmed);
+          }
     }
+    fclose(flog);
+#endif
+
   } else {
+    // dealing with IDR
     WelsResetRefList (pCtx);  //for IDR, SHOULD reset pRef list.
     ResetLtrState (&pCtx->pLtr[pCtx->uiDependencyId]); //SHOULD update it when IDR.
     pCtx->pRefList0[0]	= NULL;
@@ -814,7 +849,6 @@
   if (pCtx->iNumRef0 > iNumRef) {
     pCtx->iNumRef0 = iNumRef;
   }
-  //TBD info update for md &fme
 
   return (pCtx->iNumRef0 > 0 || pCtx->eSliceType == I_SLICE) ? (true) : (false);
 }