[x265] [PATCH] passing lookAheadCost into RCStart() from TEncTop

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Thu Aug 22 21:50:16 CEST 2013


# HG changeset patch
# User Aarthi<aarthi at multicorewareinc.com>
# Date 1377200980 -19800
#      Fri Aug 23 01:19:40 2013 +0530
# Node ID af4aecaae19b1da783d2a5567b7778b34da5f8a6
# Parent  d633a649e2d6297d515e0260a61b6d6d0f0d3ae7
passing lookAheadCost into RCStart() from TEncTop.

diff -r d633a649e2d6 -r af4aecaae19b source/Lib/TLibEncoder/TEncTop.cpp
--- a/source/Lib/TLibEncoder/TEncTop.cpp	Fri Aug 23 00:59:39 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncTop.cpp	Fri Aug 23 01:19:40 2013 +0530
@@ -249,10 +249,10 @@
         // determine references, set QP, etc
         m_dpb->prepareEncode(fenc, curEncoder);
 
-       // m_lookahead->getEstimatedPictureCost(fenc);  // TODO: move into rate control
+       int lookAheadCost =  m_lookahead->getEstimatedPictureCost(fenc);  // TODO: move into rate control
 		if(m_rateControl->rateControlMode == X265_RC_ABR)
 		{
-			m_rateControl->rateControlStart(fenc);
+			m_rateControl->rateControlStart(fenc, lookAheadCost);
 		}
 
         // main encode processing, TBD multi-threading
diff -r d633a649e2d6 -r af4aecaae19b source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Fri Aug 23 00:59:39 2013 +0530
+++ b/source/encoder/ratecontrol.cpp	Fri Aug 23 01:19:40 2013 +0530
@@ -96,17 +96,18 @@
     cbrDecay = 1.0;
 }
 
-void RateControl::rateControlStart(TComPic* pic)
+void RateControl::rateControlStart(TComPic* pic, int lookAheadCost)
 {
     curFrame = pic->getSlice();
     frameType = curFrame->getSliceType();
     rce = new RateControlEntry();
+	lastSatd = lookAheadCost;
     double q = 0;
 
     switch (rateControlMode)
     {
     case X265_RC_ABR:
-        q = qScale2qp(rateEstimateQscale(&pic->m_lowres));
+        q = qScale2qp(rateEstimateQscale());
         break;
     case X265_RC_CQP:
         q = baseQp;
@@ -142,7 +143,7 @@
         accumPQp += qpm;
 }
 
-double RateControl::rateEstimateQscale(Lowres* lframe)
+double RateControl::rateEstimateQscale()
 {
     double q;
     // ratecontrol_entry_t rce = UNINIT(rce);
@@ -195,11 +196,7 @@
          * tolerances, the bit distribution approaches that of 2pass. */
 
         double wantedBits, overflow = 1;
-        int p0 = curFrame->getRefPic(REF_PIC_LIST_0, 0)->getPOC();
-        int p1 = curFrame->getRefPic(REF_PIC_LIST_1, 0)->getPOC();
-        lastSatd = lframe->costEst[curFrame->getPOC() - p0][p1 - curFrame->getPOC()] ;     //TODO:need to get this from lookahead  //x264_rc_analyse_slice( h );
         rce->pCount = ncu;
-
         shortTermCplxSum *= 0.5;
         shortTermCplxCount *= 0.5;
         shortTermCplxSum += lastSatd / (CLIP_DURATION(frameDuration) / BASE_FRAME_DURATION);


More information about the x265-devel mailing list