<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 16, 2013 at 1:43 PM, <span dir="ltr"><<a href="mailto:aarthi@multicorewareinc.com" target="_blank">aarthi@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Aarthi Thirumalai<br>
# Date 1379356988 -19800<br>
# Tue Sep 17 00:13:08 2013 +0530<br>
# Node ID baeddbdc9ec349002f574bfc1763927f487cc88d<br>
# Parent 9a727efab9fa4048eed7330abe28cf7e088590fb<br>
ABR - Removed unused states, cleaned up the comments.<br>
<br>
Removed states that are not used in ABR or CQP rate contnrol modes.<br></blockquote><div><br></div><div>Queued; I'll push this tomorrow if no-one complains</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r 9a727efab9fa -r baeddbdc9ec3 source/encoder/ratecontrol.cpp<br>
--- a/source/encoder/ratecontrol.cpp Mon Sep 16 22:57:07 2013 +0530<br>
+++ b/source/encoder/ratecontrol.cpp Tue Sep 17 00:13:08 2013 +0530<br>
@@ -61,7 +61,7 @@<br>
ncu = (int)((param->sourceHeight * param->sourceWidth) / pow((int)param->maxCUSize, 2.0));<br>
lastNonBPictType = -1;<br>
baseQp = param->rc.qp;<br>
- qpm = qp = baseQp;<br>
+ qp = baseQp;<br>
<br>
// heuristics- encoder specific<br>
qCompress = param->rc.qCompress; // tweak and test for x265.<br>
@@ -101,7 +101,7 @@<br>
<br>
//qstep - value set as encoder specific.<br>
lstep = pow(2, param->rc.qpStep / 6.0);<br>
- cbrDecay = 1.0;<br>
+<br>
}<br>
<br>
void RateControl::rateControlStart(TComPic* pic, Lookahead *l, RateControlEntry* rce)<br>
@@ -116,8 +116,7 @@<br>
lastSatd = l->getEstimatedPictureCost(pic);<br>
double q = qScale2qp(rateEstimateQscale(rce));<br>
qp = Clip3(MIN_QP, MAX_QP, (int)(q + 0.5));<br>
- rce->qpaRc = qpm = q;<br>
- rce->newQp = qp;<br>
+ rce->qpaRc = q;<br>
accumPQpUpdate();<br>
break;<br>
}<br>
@@ -146,15 +145,14 @@<br>
accumPNorm *= .95;<br>
accumPNorm += 1;<br>
if (frameType == I_SLICE)<br>
- accumPQp += qpm + ipOffset;<br>
+ accumPQp += qp + ipOffset;<br>
else<br>
- accumPQp += qpm;<br>
+ accumPQp += qp;<br>
}<br>
<br>
double RateControl::rateEstimateQscale(RateControlEntry *rce)<br>
{<br>
double q;<br>
- // ratecontrol_entry_t rce = UNINIT(rce);<br>
int pictType = frameType;<br>
<br>
if (pictType == B_SLICE)<br>
@@ -207,8 +205,6 @@<br>
* tolerances, the bit distribution approaches that of 2pass. */<br>
<br>
double wantedBits, overflow = 1;<br>
- rce->pCount = ncu;<br>
-<br>
shortTermCplxSum *= 0.5;<br>
shortTermCplxCount *= 0.5;<br>
shortTermCplxSum += lastSatd / (CLIP_DURATION(frameDuration) / BASE_FRAME_DURATION);<br>
@@ -217,7 +213,6 @@<br>
rce->blurredComplexity = shortTermCplxSum / shortTermCplxCount;<br>
rce->mvBits = 0;<br>
rce->pictType = pictType;<br>
- //need to checked where it is initialized<br>
q = getQScale(rce, wantedBitsWindow / cplxrSum);<br>
<br>
/* ABR code can potentially be counterproductive in CBR, so just don't bother.<br>
@@ -236,7 +231,6 @@<br>
}<br>
<br>
if (pictType == I_SLICE && keyFrameInterval > 1<br>
- /* should test _next_ pict type, but that isn't decided yet */<br>
&& lastNonBPictType != I_SLICE)<br>
{<br>
q = qp2qScale(accumPQp / accumPNorm);<br>
@@ -270,12 +264,10 @@<br>
q = Clip3(lqmin, lqmax, q);<br>
}<br>
<br>
- //FIXME use get_diff_limited_q() ?<br>
double lmin1 = lmin[pictType];<br>
double lmax1 = lmax[pictType];<br>
q = Clip3(lmin1, lmax1, q);<br>
- lastQScaleFor[pictType] =<br>
- lastQScale = q;<br>
+ lastQScaleFor[pictType] = q;<br>
<br>
if (curFrame->getPOC() == 0)<br>
lastQScaleFor[P_SLICE] = q * fabs(ipFactor);<br>
@@ -300,12 +292,11 @@<br>
{<br>
rce->lastRceq = q;<br>
q /= rateFactor;<br>
- lastQScale = q;<br>
}<br>
return q;<br>
}<br>
<br>
-/* After encoding one frame, save stats and update ratecontrol state */<br>
+/* After encoding one frame, update ratecontrol state */<br>
int RateControl::rateControlEnd(int64_t bits, RateControlEntry* rce)<br>
{<br>
if (rateControlMode == X265_RC_ABR)<br>
@@ -320,9 +311,7 @@<br>
* Not perfectly accurate with B-refs, but good enough. */<br>
cplxrSum += bits * qp2qScale(rce->qpaRc) / (rce->lastRceq * fabs(pbFactor));<br>
}<br>
- cplxrSum *= cbrDecay;<br>
wantedBitsWindow += frameDuration * bitrate;<br>
- wantedBitsWindow *= cbrDecay;<br>
rce = NULL;<br>
}<br>
totalBits += bits;<br>
diff -r 9a727efab9fa -r baeddbdc9ec3 source/encoder/ratecontrol.h<br>
--- a/source/encoder/ratecontrol.h Mon Sep 16 22:57:07 2013 +0530<br>
+++ b/source/encoder/ratecontrol.h Tue Sep 17 00:13:08 2013 +0530<br>
@@ -35,12 +35,10 @@<br>
struct RateControlEntry<br>
{<br>
int pictType;<br>
- int pCount;<br>
- int newQp;<br>
int texBits;<br>
int mvBits;<br>
double blurredComplexity;<br>
- double qpaRc; /* average of macroblocks' qp before aq */<br>
+ double qpaRc;<br>
double lastRceq;<br>
};<br>
<br>
@@ -54,9 +52,7 @@<br>
int keyFrameInterval; /* TODO: need to initialize in init */<br>
int qp; /* updated qp for current frame */<br>
int baseQp; /* CQP base QP */<br>
- double frameDuration; /* current frame duration in seconds */<br>
- double qpm; /* qp for current macroblock: precise double for AQ */<br>
-<br>
+ double frameDuration; /* current frame duration in seconds */<br>
double bitrate;<br>
double rateTolerance;<br>
double qCompress;<br>
@@ -71,11 +67,8 @@<br>
int lastNonBPictType;<br>
double accumPQp; /* for determining I-frame quant */<br>
double accumPNorm;<br>
- double lastQScale;<br>
double lastQScaleFor[3]; /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */<br>
double lstep;<br>
- double qpNoVbv; /* QP for the current frame if 1-pass VBV was disabled. */<br>
- double cbrDecay;<br>
double lmin[3]; /* min qscale by frame type */<br>
double lmax[3];<br>
double shortTermCplxSum;<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>