shithub: openh264

Download patch

ref: d623bd0334f5b6d2a2d091f4d81de0d8a47c15fd
parent: 1eb688264b7221ab4fcdb596d239eed795af1e7d
parent: bc1850a54d2798d0eac2d35420034e3f87d7196f
author: Licai Guo <[email protected]>
date: Tue Mar 4 04:31:07 EST 2014

Merge pull request #396 from volvet/refine_frame_idx

remove uiFrameIdxRc

--- a/codec/encoder/core/inc/encoder_context.h
+++ b/codec/encoder/core/inc/encoder_context.h
@@ -151,7 +151,6 @@
   // Derived
   int32_t						iCodingIndex;
   int32_t						iFrameIndex;			// count how many frames elapsed during coding context currently
-  uint32_t					uiFrameIdxRc;           //only for RC
   int32_t						iFrameNum;				// current frame number coding
   int32_t						iPOC;					// frame iPOC
   EWelsSliceType				eSliceType;			// currently coding slice type
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -213,12 +213,8 @@
   InitBits (&pEncCtx->pOut->sBsWrite, pEncCtx->pOut->pBsBuffer, pEncCtx->pOut->uiSize);
 
   if (keFrameType == WELS_FRAME_TYPE_P) {
-    if (pEncCtx->pSvcParam->uiIntraPeriod) {
-      ++pEncCtx->iFrameIndex;
-    }
+    ++pEncCtx->iFrameIndex;
 
-    ++pEncCtx->uiFrameIdxRc;
-
     if (pEncCtx->iPOC < (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2)     // if iPOC type is no 0, this need be modification
       pEncCtx->iPOC			+= 2;	// for POC type 0
     else
@@ -237,10 +233,7 @@
     pEncCtx->iFrameNum		= 0;
     pEncCtx->iPOC			= 0;
     pEncCtx->bEncCurFrmAsIdrFlag = false;
-    if (pEncCtx->pSvcParam->uiIntraPeriod) {
-      pEncCtx->iFrameIndex = 0;
-    }
-    pEncCtx->uiFrameIdxRc = 0;
+    pEncCtx->iFrameIndex = 0;
 
     pEncCtx->eNalType		= NAL_UNIT_CODED_SLICE_IDR;
     pEncCtx->eSliceType	= I_SLICE;
@@ -286,7 +279,7 @@
   // perform scene change detection
   if ((!pSvcParam->bEnableSceneChangeDetect) || pEncCtx->pVaa->bIdrPeriodFlag ||
       (kiSpatialNum < pSvcParam->iSpatialLayerNum)
-      || (pEncCtx->uiFrameIdxRc < (VGOP_SIZE << 1))) { // avoid too frequent I frame coding, rc control
+      || (pEncCtx->iFrameIndex < (VGOP_SIZE << 1))) { // avoid too frequent I frame coding, rc control
     bSceneChangeFlag = false;
   } else {
     bSceneChangeFlag = pEncCtx->pVaa->bSceneChangeFlag;
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -678,7 +678,7 @@
 
   WelsLog (pEncCtx, WELS_LOG_INFO,
            "[Rc] encoding_qp%d, qp = %3d, index = %8d, iTid = %1d, used = %8d, target = %8d, remaingbits = %8d\n",
-           pEncCtx->uiDependencyId, pWelsSvcRc->iAverageFrameQp, pEncCtx->uiFrameIdxRc, pEncCtx->uiTemporalId,
+           pEncCtx->uiDependencyId, pWelsSvcRc->iAverageFrameQp, pEncCtx->iFrameIndex, pEncCtx->uiTemporalId,
            pWelsSvcRc->iFrameDqBits,
            pWelsSvcRc->iTargetBits, pWelsSvcRc->iRemainingBits);
 }