shithub: openh264

Download patch

ref: a3e60a1c6f7c092e9dab8bb55da7fb83fc45a916
parent: a0328cda800787777cb19b84e50e84a60a370fb8
parent: 741c12239983961911273f23544545684ddcee12
author: HaiboZhu <[email protected]>
date: Tue Oct 27 11:07:54 EDT 2015

Merge pull request #2186 from shihuade/PSliceRefact_V1.0

change the AbsDiffPicNumMinus1 check logic

--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -637,6 +637,13 @@
   if (pCtx->iNumRef0 > 0)
     iAbsDiffPicNumMinus1 = pCtx->iFrameNum - (pCtx->pRefList0[0]->iFrameNum) - 1;
 
+  if (iAbsDiffPicNumMinus1 < 0) {
+    WelsLog(&(pCtx->sLogCtx), WELS_LOG_INFO, "WelsUpdateRefSyntax():::uiAbsDiffPicNumMinus1:%d", iAbsDiffPicNumMinus1);
+    iAbsDiffPicNumMinus1 += (1 << (pCtx->pSps->uiLog2MaxFrameNum));
+    WelsLog(&(pCtx->sLogCtx), WELS_LOG_INFO, "WelsUpdateRefSyntax():::uiAbsDiffPicNumMinus1< 0, update as:%d",
+             iAbsDiffPicNumMinus1);
+  }
+
   for (iIdx = 0; iIdx < kiCountSliceNum; iIdx++) {
     SSliceHeaderExt*    pSliceHdrExt        = &pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iIdx].sSliceHeaderExt;
     SSliceHeader*       pSliceHdr           = &pSliceHdrExt->sSliceHeader;
@@ -647,12 +654,6 @@
     pSliceHdr->uiRefCount = pCtx->iNumRef0;
     if (pCtx->iNumRef0 > 0) {
       if ((!pCtx->pRefList0[0]->bIsLongRef) || (!pCtx->pSvcParam->bEnableLongTermReference)) {
-        if (iAbsDiffPicNumMinus1 < 0) {
-          WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "WelsUpdateRefSyntax():::uiAbsDiffPicNumMinus1:%d", iAbsDiffPicNumMinus1);
-          iAbsDiffPicNumMinus1 += (1 << (pCtx->pSps->uiLog2MaxFrameNum));
-          WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "WelsUpdateRefSyntax():::uiAbsDiffPicNumMinus1< 0, update as:%d",
-                   iAbsDiffPicNumMinus1);
-        }
 
         pRefReorder->SReorderingSyntax[0].uiReorderingOfPicNumsIdc = 0;
         pRefReorder->SReorderingSyntax[0].uiAbsDiffPicNumMinus1    = iAbsDiffPicNumMinus1;