[x265] [PATCH 4 of 5] zone: reconfigure rate control parameters
Kalyan Goswami
kalyan at multicorewareinc.com
Wed Dec 26 09:33:49 CET 2018
Pushed
Thanks,
Kalyan Goswami, PhD
Video Architect @ MulticoreWare
http: <http://www.multicorewareinc.com/>//www.multicorewareinc.com
<http://www.multicorewareinc.com/>
+91 9884989331
On Thu, Dec 20, 2018 at 11:09 AM Pooja Venkatesan <
pooja at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Pooja Venkatesan <pooja at multicorewareinc.com>
> # Date 1544770736 -19800
> # Fri Dec 14 12:28:56 2018 +0530
> # Node ID 1a62483c0b7549ef677ce2f343e9c7f1fcd45c44
> # Parent 587431d49124b5e990883a919ec9eaf8b3708c34
> zone: reconfigure rate control parameters
>
> diff -r 587431d49124 -r 1a62483c0b75 source/common/param.cpp
> --- a/source/common/param.cpp Fri Dec 14 12:26:15 2018 +0530
> +++ b/source/common/param.cpp Fri Dec 14 12:28:56 2018 +0530
> @@ -637,6 +637,21 @@
> }
> OPT("b-intra") p->bIntraInBFrames = atobool(value);
> OPT("scaling-list") p->scalingLists = strdup(value);
> + OPT("crf")
> + {
> + p->rc.rfConstant = atof(value);
> + p->rc.rateControlMode = X265_RC_CRF;
> + }
> + OPT("qp")
> + {
> + p->rc.qp = atoi(value);
> + p->rc.rateControlMode = X265_RC_CQP;
> + }
> + OPT("bitrate")
> + {
> + p->rc.bitrate = atoi(value);
> + p->rc.rateControlMode = X265_RC_ABR;
> + }
> OPT("aq-mode") p->rc.aqMode = atoi(value);
> OPT("aq-strength") p->rc.aqStrength = atof(value);
> OPT("nr-intra") p->noiseReductionIntra = atoi(value);
> diff -r 587431d49124 -r 1a62483c0b75 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Fri Dec 14 12:26:15 2018 +0530
> +++ b/source/encoder/encoder.cpp Fri Dec 14 12:28:56 2018 +0530
> @@ -2643,6 +2643,16 @@
> p->bEnableTransformSkip = zone->bEnableTransformSkip;
> p->bEnableAMP = zone->bEnableAMP;
>
> + if (m_param->rc.rateControlMode == X265_RC_ABR)
> + p->rc.bitrate = zone->rc.bitrate;
> + if (m_param->rc.rateControlMode == X265_RC_CRF)
> + p->rc.rfConstant = zone->rc.rfConstant;
> + if (m_param->rc.rateControlMode == X265_RC_CQP)
> + {
> + p->rc.qp = zone->rc.qp;
> + p->rc.aqMode = X265_AQ_NONE;
> + }
> +
> memcpy(zone, p, sizeof(x265_param));
> }
>
> diff -r 587431d49124 -r 1a62483c0b75 source/encoder/ratecontrol.cpp
> --- a/source/encoder/ratecontrol.cpp Fri Dec 14 12:26:15 2018 +0530
> +++ b/source/encoder/ratecontrol.cpp Fri Dec 14 12:28:56 2018 +0530
> @@ -741,6 +741,20 @@
> if (m_param->rc.rfConstantMin)
> m_rateFactorMaxDecrement = m_param->rc.rfConstant -
> m_param->rc.rfConstantMin;
> }
> + if (m_param->rc.rateControlMode == X265_RC_CQP)
> + {
> + m_qp = m_param->rc.qp;
> + if (m_qp && !m_param->bLossless)
> + {
> + m_qpConstant[P_SLICE] = m_qp;
> + m_qpConstant[I_SLICE] = x265_clip3(QP_MIN, QP_MAX_MAX,
> (int)(m_qp - m_ipOffset + 0.5));
> + m_qpConstant[B_SLICE] = x265_clip3(QP_MIN, QP_MAX_MAX,
> (int)(m_qp + m_pbOffset + 0.5));
> + }
> + else
> + {
> + m_qpConstant[P_SLICE] = m_qpConstant[I_SLICE] =
> m_qpConstant[B_SLICE] = m_qp;
> + }
> + }
> m_bitrate = m_param->rc.bitrate * 1000;
> }
>
> @@ -1231,6 +1245,17 @@
> rce->keptAsRef = IS_REFERENCED(curFrame);
> m_predType = getPredictorType(curFrame->m_lowres.sliceType,
> m_sliceType);
> rce->poc = m_curSlice->m_poc;
> +
> + /* change ratecontrol stats for next zone if specified */
> + for (int i = 0; i < m_param->rc.zonefileCount; i++)
> + {
> + if (m_param->rc.zones[i].startFrame == curFrame->m_encodeOrder)
> + {
> + m_param = m_param->rc.zones[i].zoneParam;
> + reconfigureRC();
> + init(*m_curSlice->m_sps);
> + }
> + }
> if (m_param->rc.bStatRead)
> {
> X265_CHECK(rce->poc >= 0 && rce->poc < m_numEntries, "bad encode
> ordinal\n");
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20181226/a45135bc/attachment.html>
More information about the x265-devel
mailing list