shithub: openh264

Download patch

ref: 08f7ad3f1fd0e0e5f7a5dd598fc597774fab94ba
parent: 741c12239983961911273f23544545684ddcee12
author: huade <[email protected]>
date: Fri Oct 23 11:46:06 EDT 2015

refact slice header init

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2886,6 +2886,8 @@
       pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps     = &pCtx->pSpsArray[iCurSpsId];
   }
 
+  pBaseSlice->bSliceHeaderExtFlag = (NAL_UNIT_CODED_SLICE_EXT == pCtx->eNalType);
+
   pSlice = pBaseSlice;
   iIdx = 1;
   while (iIdx < iSliceCount) {
@@ -2894,6 +2896,7 @@
     pSlice->sSliceHeaderExt.sSliceHeader.pPps   = pBaseSlice->sSliceHeaderExt.sSliceHeader.pPps;
     pSlice->sSliceHeaderExt.sSliceHeader.iSpsId = pBaseSlice->sSliceHeaderExt.sSliceHeader.iSpsId;
     pSlice->sSliceHeaderExt.sSliceHeader.pSps   = pBaseSlice->sSliceHeaderExt.sSliceHeader.pSps;
+    pSlice->bSliceHeaderExtFlag                 = pBaseSlice->bSliceHeaderExtFlag;
     ++ iIdx;
   }
 
@@ -2906,16 +2909,6 @@
   pNalHdExt->bIdrFlag                   = (pCtx->iFrameNum == 0) && ((pCtx->eNalType == NAL_UNIT_CODED_SLICE_IDR)
                                           || (pCtx->eSliceType == I_SLICE));
   pNalHdExt->uiTemporalId               = pCtx->uiTemporalId;
-
-  pBaseSlice->bSliceHeaderExtFlag       = (NAL_UNIT_CODED_SLICE_EXT == pNalHd->eNalUnitType);
-
-  pSlice = pBaseSlice;
-  iIdx = 1;
-  while (iIdx < iSliceCount) {
-    ++ pSlice;
-    pSlice->bSliceHeaderExtFlag = pBaseSlice->bSliceHeaderExtFlag;
-    ++ iIdx;
-  }
 
   // pEncPic pData
   pCurDq->pEncData[0]   = pEncPic->pData[0];