shithub: openh264

Download patch

ref: f57bb5042ad88215ba50eaa97624424cb46880e5
parent: bcb76d383b778b944bf75bdea4f02c1c3c0bcf37
parent: 8ee85918c886d1152e53047cc3d26fda981498ac
author: ruil2 <[email protected]>
date: Fri Apr 25 05:03:01 EDT 2014

Merge pull request #747 from ganyangbbl/resolution_issue

fix resolution setting issue

--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -127,12 +127,8 @@
         continue;
       if (strTag[0].compare ("FrameWidth") == 0) {
         pDLayer->iVideoWidth	= atoi (strTag[1].c_str());
-        pSvcParam.iPicWidth = WELS_MAX(pSvcParam.iPicWidth, pDLayer->iVideoWidth);
-        //pSvcParam.iPicWidth stands for the target output resolution
       } else if (strTag[0].compare ("FrameHeight") == 0) {
         pDLayer->iVideoHeight	= atoi (strTag[1].c_str());
-        pSvcParam.iPicHeight = WELS_MAX(pSvcParam.iPicHeight, pDLayer->iVideoHeight);
-        //pSvcParam.iPicHeight stands for the target output resolution
       } else if (strTag[0].compare ("FrameRateOut") == 0) {
         pDLayer->fFrameRate = (float)atof (strTag[1].c_str());
       }else if (strTag[0].compare ("ReconFile") == 0) {
@@ -511,8 +507,6 @@
       unsigned int	iLayer = atoi (argv[n++]);
       SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
       pDLayer->iVideoWidth =  atoi (argv[n++]);
-      pSvcParam.iPicWidth = WELS_MAX(pSvcParam.iPicWidth, pDLayer->iVideoWidth);
-      //pSvcParam.iPicWidth stands for the target output resolution
     }
 
     else if (!strcmp (pCommand, "-dh") && (n + 1 < argc)) {
@@ -519,8 +513,6 @@
       unsigned int	iLayer = atoi (argv[n++]);
       SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
       pDLayer->iVideoHeight =  atoi (argv[n++]);
-      pSvcParam.iPicHeight = WELS_MAX(pSvcParam.iPicHeight, pDLayer->iVideoHeight);
-      //pSvcParam.iPicHeight stands for the target output resolution
     }
 
      else if (!strcmp (pCommand, "-frout") && (n + 1 < argc)) {
@@ -906,6 +898,11 @@
   pSrcPic->pData[2] = pSrcPic->pData[1] + (iSourceWidth*iSourceHeight>>2);
 
   //update sSvcParam
+  for (int iLayer=0; iLayer<sSvcParam.iSpatialLayerNum; iLayer++) {
+    SSpatialLayerConfig* pDLayer = &sSvcParam.sSpatialLayers[iLayer];
+    sSvcParam.iPicWidth = WELS_MAX(sSvcParam.iPicWidth, pDLayer->iVideoWidth);
+    sSvcParam.iPicHeight = WELS_MAX(sSvcParam.iPicHeight, pDLayer->iVideoHeight);
+  }
   //if target output resolution is not set, use the source size
   sSvcParam.iPicWidth = (!sSvcParam.iPicWidth)?iSourceWidth:sSvcParam.iPicWidth;
   sSvcParam.iPicHeight =  (!sSvcParam.iPicHeight)?iSourceHeight:sSvcParam.iPicHeight;