shithub: openh264

Download patch

ref: 1a2dd0c1f170c20b4d3aab902de3da3940343a03
parent: a1c491499f8816f89a80b9af0a42eced0d3c0e27
author: licaiguo <guolicai@gmail.com>
date: Sat Jan 25 11:12:52 EST 2014

change resolution update logic

--- a/codec/decoder/core/inc/decoder.h
+++ b/codec/decoder/core/inc/decoder.h
@@ -130,11 +130,6 @@
  */
 int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const int32_t kiMbHeight);
 
-/*!
- * \brief	update maximal picture width and height if applicable when receiving a SPS NAL
- */
-void_t UpdateMaxPictureResolution (PWelsDecoderContext pCtx, const int32_t kiCurWidth, const int32_t kiCurHeight);
-
 void_t AssignFuncPointerForRec (PWelsDecoderContext pCtx);
 
 void_t ResetParameterSetsState (PWelsDecoderContext pCtx);
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -185,8 +185,6 @@
 
   int32_t				iImgWidthInPixel;	// width of image in pixel reconstruction picture to be output
   int32_t				iImgHeightInPixel;// height of image in pixel reconstruction picture to be output
-  int32_t				iMaxWidthInSps;	// maximal width of pixel in SPS sets
-  int32_t				iMaxHeightInSps;	// maximal height of pixel in SPS sets
 
   // Derived common elements
   SNalUnitHeader		sCurNalHead;
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -533,9 +533,6 @@
       return iErr;
     }
 
-    if (ERR_NONE == iErr)
-      UpdateMaxPictureResolution (pCtx, iPicWidth, iPicHeight);
-
     break;
 
   case NAL_UNIT_PPS:
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -345,8 +345,6 @@
   if (ERR_NONE != WelsInitMemory (pCtx))
     return;
 
-  pCtx->iMaxWidthInSps	= 0;
-  pCtx->iMaxHeightInSps	= 0;
 #ifdef LONG_TERM_REF
   pCtx->bParamSetsLostFlag = true;
 #else
@@ -683,19 +681,6 @@
   }
 
   return iErr;
-}
-
-/*!
- * \brief	update maximal picture width and height if applicable when receiving a SPS NAL
- */
-void_t UpdateMaxPictureResolution (PWelsDecoderContext pCtx, const int32_t kiCurWidth, const int32_t kiCurHeight) {
-  //any dimension larger than that of current dimension, should modify the max-dimension
-  if ((kiCurWidth * kiCurHeight) > (pCtx->iMaxWidthInSps * pCtx->iMaxHeightInSps)) {
-    pCtx->iMaxWidthInSps	= kiCurWidth;
-    pCtx->iMaxHeightInSps	= kiCurHeight;
-  }
-
-  return;
 }
 
 void_t AssignFuncPointerForRec (PWelsDecoderContext pCtx) {
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -1586,7 +1586,7 @@
   if (NAL_UNIT_CODED_SLICE_IDR == pCurAu->pNalUnitsList[pCurAu->uiStartPos]->sNalHeaderExt.sNalUnitHeader.eNalUnitType ||
       pCurAu->pNalUnitsList[pCurAu->uiStartPos]->sNalHeaderExt.bIdrFlag) {
     WelsResetRefPic (pCtx); //clear ref pPic when IDR NAL
-    iErr = SyncPictureResolutionExt (pCtx, (pCtx->iMaxWidthInSps + 15) >> 4, (pCtx->iMaxHeightInSps + 15) >> 4);
+	iErr = SyncPictureResolutionExt (pCtx, pCtx->pSps->iMbWidth, pCtx->pSps->iMbHeight);
 
     if (ERR_NONE != iErr) {
       WelsLog (pCtx, WELS_LOG_WARNING, "sync picture resolution ext failed,  the error is %d", iErr);