[x265] [PATCH] multi-pass-opt-distortion: Apply QP offsets even when aq-mode is disabled
Ashok Kumar Mishra
ashok at multicorewareinc.com
Thu Jul 12 08:42:02 CEST 2018
On Wed, Jul 11, 2018 at 7:54 PM, <aruna at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Aruna Matheswaran <aruna at multicorewareinc.com>
> # Date 1530254734 -19800
> # Fri Jun 29 12:15:34 2018 +0530
> # Node ID be4894f073613c44279e0972f0fca7f7b996895e
> # Parent 0106f9f2f867ee20893a317e98c60e9ca626e7d2
> multi-pass-opt-distortion: Apply QP offsets even when aq-mode is disabled
>
> Currently, QP offsets from multi-pass-opt-distortion will not get applied
> on
> baseQP when aq-mode is disabled. This patch enables distortion QP offsets
> to be
> applied even when aq-mode is set to 0 and hence this will be an output
> changing
> commit.
>
> diff -r 0106f9f2f867 -r be4894f07361 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Mon Apr 23 14:16:54 2018 +0530
> +++ b/source/encoder/encoder.cpp Fri Jun 29 12:15:34 2018 +0530
> @@ -2522,6 +2522,7 @@
> void Encoder::initPPS(PPS *pps)
> {
> bool bIsVbv = m_param->rc.vbvBufferSize > 0 &&
> m_param->rc.vbvMaxBitrate > 0;
> + bool bEnableDistOffset = m_param->analysisMultiPassDistortion &&
> m_param->rc.bStatRead;
>
> if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv ||
> m_param->bAQMotion))
> {
> @@ -2529,6 +2530,11 @@
> pps->maxCuDQPDepth = g_log2Size[m_param->maxCUSize] -
> g_log2Size[m_param->rc.qgSize];
> X265_CHECK(pps->maxCuDQPDepth <= 3, "max CU DQP depth cannot be
> greater than 3\n");
> }
> + else if (!m_param->bLossless && bEnableDistOffset)
> + {
> + pps->bUseDQP = true;
> + pps->maxCuDQPDepth = 0;
> + }
> else
> {
> pps->bUseDQP = false;
> diff -r 0106f9f2f867 -r be4894f07361 source/encoder/ratecontrol.cpp
> --- a/source/encoder/ratecontrol.cpp Mon Apr 23 14:16:54 2018 +0530
> +++ b/source/encoder/ratecontrol.cpp Fri Jun 29 12:15:34 2018 +0530
> @@ -2640,8 +2640,9 @@
> FrameData& curEncData = *curFrame->m_encData;
> int64_t actualBits = bits;
> Slice *slice = curEncData.m_slice;
> + bool bEnableDistOffset = m_param->analysisMultiPassDistortion &&
> m_param->rc.bStatRead;
>
> - if (m_param->rc.aqMode || m_isVbv || m_param->bAQMotion)
> + if (m_param->rc.aqMode || m_isVbv || m_param->bAQMotion ||
> bEnableDistOffset)
> {
> if (m_isVbv && !(m_2pass && m_param->rc.rateControlMode ==
> X265_RC_CRF))
> {
> @@ -2655,10 +2656,10 @@
> rce->qpaRc = curEncData.m_avgQpRc;
> }
>
> - if (m_param->rc.aqMode || m_param->bAQMotion)
> + if (m_param->rc.aqMode || m_param->bAQMotion || bEnableDistOffset)
> {
> double avgQpAq = 0;
> - /* determine actual avg encoded QP, after AQ/cutree
> adjustments */
> + /* determine actual avg encoded QP, after
> AQ/cutree/distortion adjustments */
> for (uint32_t i = 0; i < slice->m_sps->numCuInHeight; i++)
> avgQpAq += curEncData.m_rowStat[i].sumQpAq;
>
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
Pushed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180712/ffb11abf/attachment.html>
More information about the x265-devel
mailing list