shithub: openh264

Download patch

ref: d7af7cedf9a0af84a2dcfa9dd978ae671673f8ad
parent: 585855b00e8c7195b4038dd2a30ac48fc2908757
parent: fd7cd76b604476ecc6e534178cffd24dce8848d5
author: sijchen <[email protected]>
date: Thu Mar 12 13:27:24 EDT 2015

Merge pull request #1845 from ruil2/rc_check

use each spatial layer qp instead of global qp and update traces

--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -1315,7 +1315,7 @@
                                               pWelsSvcRc->iCost2BitsIntra), pWelsSvcRc->iTargetBits);
         iLumaQp = RcConvertQStep2Qp (pWelsSvcRc->iQStep);
 
-        iLumaQp = WELS_CLIP3 (iLumaQp, pEncCtx->iGlobalQp - DELTA_QP_BGD_THD, pEncCtx->iGlobalQp + DELTA_QP_BGD_THD);
+        iLumaQp = WELS_CLIP3 (iLumaQp, pWelsSvcRc->iLastCalculatedQScale - DELTA_QP_BGD_THD, pWelsSvcRc->iLastCalculatedQScale + DELTA_QP_BGD_THD);
 
       } else {
         iLumaQp = pWelsSvcRc->iLastCalculatedQScale + DELTA_QP_BGD_THD;
@@ -1352,7 +1352,7 @@
 
         pWelsSvcRc->iQStep = WELS_DIV_ROUND ((pTOverRc->iLinearCmplx * iCmplxRatio), (pWelsSvcRc->iTargetBits * INT_MULTIPLY));
         iLumaQp = RcConvertQStep2Qp (pWelsSvcRc->iQStep);
-        iLumaQp = WELS_CLIP3 (iLumaQp, pEncCtx->iGlobalQp - DELTA_QP_BGD_THD, pEncCtx->iGlobalQp + DELTA_QP_BGD_THD);
+        iLumaQp = WELS_CLIP3 (iLumaQp, pWelsSvcRc->iLastCalculatedQScale - DELTA_QP_BGD_THD, pWelsSvcRc->iLastCalculatedQScale + DELTA_QP_BGD_THD);
       }
     } else {
       iLumaQp = pWelsSvcRc->iLastCalculatedQScale + DELTA_QP_BGD_THD;
@@ -1375,8 +1375,8 @@
   float fInstantFps = (uiTimeStamp - pWelsSvcRc->uiLastTimeStamp) > 0 ? (1000.0f / (uiTimeStamp -
                       pWelsSvcRc->uiLastTimeStamp)) : 0;
   WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
-           "[Rc]pEncCtx->iGlobalQp= %d,uiTimeStamp = %lld,uiLastTimeStamp = %lld,InstantFps = %f,settingFps = %f",
-           pEncCtx->iGlobalQp, uiTimeStamp, pWelsSvcRc->uiLastTimeStamp,
+           "[Rc]Tid = %d,Did = %d,pEncCtx->iGlobalQp= %d,iLumaQp = %d,uiTimeStamp = %lld,uiLastTimeStamp = %lld,InstantFps = %f,settingFps = %f",pEncCtx->uiTemporalId,pEncCtx->uiDependencyId,
+           pEncCtx->iGlobalQp, iLumaQp,uiTimeStamp, pWelsSvcRc->uiLastTimeStamp,
            fInstantFps, pDLayerParam->fFrameRate);
   pWelsSvcRc->uiLastTimeStamp = uiTimeStamp;