[x265] [PATCH] frameencoder: store the reference state of the picture to FrameEncoder Member variable(m_isReferenced)
Steve Borho
steve at borho.org
Thu Apr 3 21:45:48 CEST 2014
On Thu, Apr 3, 2014 at 6:55 AM, <gopu at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Gopu Govindaswamy
> # Date 1396526097 -19800
> # Thu Apr 03 17:24:57 2014 +0530
> # Node ID 817e8c607eab5cc48501491c066da38f163e0e1c
> # Parent c0362b478e23777120ee2cf3c286ca1f2e740018
This commit message is much better, thanks. I've queued this version
of the patch with the commit message reflowed to 80-char margins
> frameencoder: store the reference state of the picture to FrameEncoder Member variable(m_isReferenced)
try to keep summary lines under 80 chars. In the TortoiseHg settings
dialog, commit tab, you can set "Summary Line Length" to 80. This
will draw a red line in the commit message entry widget, showing you
where the limit is. Obeying the limit is still voluntary, but you
should try to keep the summary succinct and under 80 chars
> We find that reference state of the reference frame changed during the encode when we use frame-thread > 1
> this cause the CU level QP for the frame is non-deterministic, this is leading the non-deterministic
> encoded output for the frame, to avoid this store the reference state of the frame to FrameEncoder->m_isReferenced and
> when the QP is calculate for CU, refer the reference state of the frame from FrameEncoder->m_isReferenced
> this stat will never change during the encode
> Moved slice reference state initialization from dpb to FrameEncoder initSlice()
>
similarly the paragraphs in the longer explanation should be
line-wrapped at 80 chars where possible. CTRL-E in the commit tool
will reflow paragraphs for you to meet the summary line length
requirement.
> diff -r c0362b478e23 -r 817e8c607eab source/encoder/dpb.cpp
> --- a/source/encoder/dpb.cpp Wed Apr 02 22:52:19 2014 -0500
> +++ b/source/encoder/dpb.cpp Thu Apr 03 17:24:57 2014 +0530
> @@ -79,17 +79,6 @@
> m_lastIDR = pocCurr;
> }
> slice->setLastIDR(m_lastIDR);
> -
> - if (slice->getSliceType() != B_SLICE)
> - slice->setReferenced(true);
> - else
> - {
> - if (pic->m_lowres.sliceType == X265_TYPE_BREF)
> - slice->setReferenced(true);
> - else
> - slice->setReferenced(false);
> - }
> -
> slice->setTemporalLayerNonReferenceFlag(!slice->isReferenced());
> // Set the nal unit type
> slice->setNalUnitType(getNalUnitType(pocCurr, m_lastIDR, pic));
> diff -r c0362b478e23 -r 817e8c607eab source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Wed Apr 02 22:52:19 2014 -0500
> +++ b/source/encoder/frameencoder.cpp Thu Apr 03 17:24:57 2014 +0530
> @@ -265,7 +265,18 @@
> int type = pic->m_lowres.sliceType;
> SliceType sliceType = IS_X265_TYPE_B(type) ? B_SLICE : ((type == X265_TYPE_P) ? P_SLICE : I_SLICE);
> slice->setSliceType(sliceType);
> - slice->setReferenced(true);
> +
> + if (sliceType != B_SLICE)
> + m_isReferenced = true;
> + else
> + {
> + if (pic->m_lowres.sliceType == X265_TYPE_BREF)
> + m_isReferenced = true;
> + else
> + m_isReferenced = false;
> + }
> + slice->setReferenced(m_isReferenced);
> +
> slice->setScalingList(m_top->getScalingList());
> slice->getScalingList()->setUseTransformSkip(m_pps.getUseTransformSkip());
> #if LOG_CU_STATISTICS
> @@ -1229,9 +1240,8 @@
> int block_x = (cuAddr * noOfBlocks) - block_y * m_pic->getPicSym()->getFrameWidthInCU();
>
> /* Use cuTree offsets in m_pic->m_lowres.qpOffset if cuTree enabled and
> - * frame is referenced (if P, ignore ref state). Else use AQ offsets */
> - double *qpoffs = ((m_pic->getSlice()->isReferenced() || m_pic->getSlice()->getSliceType() == P_SLICE) && m_cfg->param->rc.cuTree) ?
> - m_pic->m_lowres.qpOffset : m_pic->m_lowres.qpAqOffset;
> + * frame is referenced Else use AQ offsets */
> + double *qpoffs = (m_isReferenced && m_cfg->param->rc.cuTree) ? m_pic->m_lowres.qpOffset : m_pic->m_lowres.qpAqOffset;
>
> int cnt = 0, idx = 0;
> for (int h = 0; h < noOfBlocks && block_y < maxBlockRows; h++, block_y++)
> diff -r c0362b478e23 -r 817e8c607eab source/encoder/frameencoder.h
> --- a/source/encoder/frameencoder.h Wed Apr 02 22:52:19 2014 -0500
> +++ b/source/encoder/frameencoder.h Thu Apr 03 17:24:57 2014 +0530
> @@ -190,6 +190,7 @@
> int m_filterRowDelay;
> Event m_completionEvent;
> int64_t m_totalTime;
> + bool m_isReferenced;
> };
> }
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
--
Steve Borho
More information about the x265-devel
mailing list