shithub: openh264

Download patch

ref: 37e67eb5426825d0c7505968ee014e2b1f86b9ee
parent: 8fcef67c70e37e3cb207a26e374a79334eda8bf7
author: Karina <ruil2@cisco.com>
date: Tue Aug 2 10:26:18 EDT 2016

fix dump file issue that removing redundant operation

--- a/codec/encoder/core/inc/encoder.h
+++ b/codec/encoder/core/inc/encoder.h
@@ -92,7 +92,7 @@
  * \brief   Dump reconstruction for dependency layer
  */
 
-extern "C" void DumpDependencyRec (SPicture* pSrcPic, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer);
+extern "C" void DumpDependencyRec (SPicture* pSrcPic, const char* kpFileName, const int8_t kiDid, bool bAppend, SDqLayer* pDqLayer,bool bSimulCastAVC);
 
 /*!
  * \brief   Dump the reconstruction pictures
--- a/codec/encoder/core/inc/encoder_context.h
+++ b/codec/encoder/core/inc/encoder_context.h
@@ -235,7 +235,6 @@
   SStateCtx sWelsCabacContexts[4][WELS_QP_MAX + 1][WELS_CONTEXT_COUNT];
 #ifdef ENABLE_FRAME_DUMP
   bool bDependencyRecFlag[MAX_DEPENDENCY_LAYER];
-  bool bRecFlag;
 #endif
   int64_t            uiLastTimestamp;
 
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -401,18 +401,21 @@
  */
 
 extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend,
-                                   SDqLayer* pDqLayer) {
+                                   SDqLayer* pDqLayer,bool bSimulCastAVC) {
   WelsFileHandle* pDumpRecFile = NULL;
   int32_t iWrittenSize = 0;
   const char* openMode = bAppend ? "ab" : "wb";
-  SWelsSPS* pSpsTmp = (kiDid > BASE_DEPENDENCY_ID) ? & (pDqLayer->sLayerInfo.pSubsetSpsP->pSps) :
-                      pDqLayer->sLayerInfo.pSpsP;
+  SWelsSPS* pSpsTmp = NULL;
+  if(bSimulCastAVC ||(kiDid == BASE_DEPENDENCY_ID)) {
+    pSpsTmp = pDqLayer->sLayerInfo.pSpsP;
+  } else {
+    pSpsTmp = &(pDqLayer->sLayerInfo.pSubsetSpsP->pSps);
+  }
   bool bFrameCroppingFlag = pSpsTmp->bFrameCroppingFlag;
   SCropOffset* pFrameCrop = &pSpsTmp->sFrameCrop;
 
   if (NULL == pCurPicture || NULL == kpFileName || kiDid >= MAX_DEPENDENCY_LAYER)
     return;
-
   if (strlen (kpFileName) > 0) // confirmed_safe_unsafe_usage
     pDumpRecFile = WelsFopen (kpFileName, openMode);
   else {
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3970,9 +3970,9 @@
                  "WelsEncoderEncodeExt()MinCr Checking,codec bitstream size is larger than Level limitation");
     }
 #ifdef ENABLE_FRAME_DUMP
-    if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) {
+    {
       DumpDependencyRec (fsnr, &pSvcParam->sDependencyLayers[iCurDid].sRecFileName[0], iCurDid,
-                         pCtx->bDependencyRecFlag[iCurDid], pCtx->pCurDqLayer);
+                         pCtx->bDependencyRecFlag[iCurDid], pCtx->pCurDqLayer,pSvcParam->bSimulcastAVC);
       pCtx->bDependencyRecFlag[iCurDid] = true;
     }
 #endif//ENABLE_FRAME_DUMP
@@ -4160,13 +4160,6 @@
           1]].sSliceArgument.uiSliceNum) {
     AdjustBaseLayer (pCtx);
   }
-
-#ifdef ENABLE_FRAME_DUMP
-  DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iSpatialLayerNum - 1].sRecFileName[0],
-                pSvcParam->iSpatialLayerNum - 1, pCtx->bRecFlag, pCtx->pCurDqLayer); // pDecPic: final reconstruction output
-  pCtx->bRecFlag = true;
-
-#endif//ENABLE_FRAME_DUMP
 
   // to check number of layers / nals / slices dependencies
   if (iLayerNum > MAX_LAYER_NUM_OF_FRAME) {