[x265] [PATCH] ratecontrol: prevent one layer of non-zero I-slice qp clipping [CHANGES OUTPUT]
deepthi at multicorewareinc.com
deepthi at multicorewareinc.com
Thu Apr 10 09:27:03 CEST 2014
# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1397114813 -19800
# Node ID 1c0f1a4ce209badcca1272f87c3917ec69ee1cc7
# Parent 83ccf2f1453ffd91c9fd8b84b72e3d3daacba6c6
ratecontrol: prevent one layer of non-zero I-slice qp clipping [CHANGES OUTPUT].
This seems to have been an error importing RC code from x264. It could be responsible
for error reports on I-slices (after POC 0) having much higher QP/low visual quality.
Needs review.
diff -r 83ccf2f1453f -r 1c0f1a4ce209 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Thu Apr 10 11:17:46 2014 +0530
+++ b/source/encoder/ratecontrol.cpp Thu Apr 10 12:56:53 2014 +0530
@@ -554,33 +554,34 @@
q = x265_qp2qScale(accumPQp / accumPNorm);
q /= fabs(param->rc.ipFactor);
}
-
- if (param->rc.rateControlMode != X265_RC_CRF)
+ else if(framesDone > 0)
{
- double lqmin = 0, lqmax = 0;
- if (totalBits == 0 && !isVbv)
+ if (param->rc.rateControlMode != X265_RC_CRF)
{
- lqmin = x265_qp2qScale(ABR_INIT_QP_MIN) / lstep;
- lqmax = x265_qp2qScale(ABR_INIT_QP_MAX) * lstep;
- q = Clip3(lqmin, lqmax, q);
- }
- else if (totalBits > 0 || (isVbv && framesDone > 0))
- {
- lqmin = lastQScaleFor[sliceType] / lstep;
- lqmax = lastQScaleFor[sliceType] * lstep;
- if (overflow > 1.1 && framesDone > 3)
- lqmax *= lstep;
- else if (overflow < 0.9)
- lqmin /= lstep;
- q = Clip3(lqmin, lqmax, q);
+ double lqmin = 0, lqmax = 0;
+ if (totalBits == 0 && !isVbv)
+ {
+ lqmin = x265_qp2qScale(ABR_INIT_QP_MIN) / lstep;
+ lqmax = x265_qp2qScale(ABR_INIT_QP_MAX) * lstep;
+ q = Clip3(lqmin, lqmax, q);
+ }
+ else if (totalBits > 0 || (isVbv && framesDone > 0))
+ {
+ lqmin = lastQScaleFor[sliceType] / lstep;
+ lqmax = lastQScaleFor[sliceType] * lstep;
+ if (overflow > 1.1 && framesDone > 3)
+ lqmax *= lstep;
+ else if (overflow < 0.9)
+ lqmin /= lstep;
+ q = Clip3(lqmin, lqmax, q);
+ }
}
}
- else
+ else if (qCompress != 1 && param->rc.rateControlMode == X265_RC_CRF)
{
- if (qCompress != 1 && framesDone == 0)
- q = x265_qp2qScale(ABR_INIT_QP) / fabs(param->rc.ipFactor);
+ q = x265_qp2qScale(ABR_INIT_QP) / fabs(param->rc.ipFactor);
}
-
+
q = Clip3(MIN_QPSCALE, MAX_MAX_QPSCALE, q);
qpNoVbv = x265_qScale2qp(q);
More information about the x265-devel
mailing list