[x265] [PATCH] rc: Fix inconsistency in --const-vbv (issue #381)
Ashok Kumar Mishra
ashok at multicorewareinc.com
Fri Dec 22 14:32:05 CET 2017
On Fri, Dec 22, 2017 at 3:51 PM, <aruna at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Aruna Matheswaran <aruna at multicorewareinc.com>
> # Date 1512624552 -19800
> # Thu Dec 07 10:59:12 2017 +0530
> # Branch stable
> # Node ID 2e684b80d90fac3d674fbbcd4b41572e4337b736
> # Parent 78c0f2c8ba087b38e291226a9555b4b4dab323a5
> rc: Fix inconsistency in --const-vbv (issue #381)
>
> VBV intializations during ABR-reset is removed.
> Inconsistent rowTotalBits in rc-update with --const-vbv is fixed.
>
> diff -r 78c0f2c8ba08 -r 2e684b80d90f source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Fri Dec 22 12:48:37 2017 +0530
> +++ b/source/encoder/frameencoder.cpp Thu Dec 07 10:59:12 2017 +0530
> @@ -1746,8 +1746,8 @@
> if (rowInSlice == rowCount)
> {
> m_rowSliceTotalBits[sliceId] = 0;
> - if (bIsVbv)
> - {
> + if (bIsVbv && !(m_param->rc.bEnableConstVbv &&
> m_param->bEnableWavefront))
> + {
> for (uint32_t i = m_sliceBaseRow[sliceId]; i < rowCount +
> m_sliceBaseRow[sliceId]; i++)
> m_rowSliceTotalBits[sliceId] +=
> curEncData.m_rowStat[i].encodedBits;
> }
> diff -r 78c0f2c8ba08 -r 2e684b80d90f source/encoder/ratecontrol.cpp
> --- a/source/encoder/ratecontrol.cpp Fri Dec 22 12:48:37 2017 +0530
> +++ b/source/encoder/ratecontrol.cpp Thu Dec 07 10:59:12 2017 +0530
> @@ -219,6 +219,7 @@
> m_param->rc.vbvMaxBitrate = x265_clip3(0, 2000000,
> m_param->rc.vbvMaxBitrate);
> m_param->rc.vbvBufferInit = x265_clip3(0.0, 2000000.0,
> m_param->rc.vbvBufferInit);
> m_param->vbvBufferEnd = x265_clip3(0.0, 2000000.0,
> m_param->vbvBufferEnd);
> + m_initVbv = false;
> m_singleFrameVbv = 0;
> m_rateTolerance = 1.0;
>
> @@ -319,7 +320,7 @@
>
> bool RateControl::init(const SPS& sps)
> {
> - if (m_isVbv)
> + if (m_isVbv && !m_initVbv)
> {
> /* We don't support changing the ABR bitrate right now,
> * so if the stream starts as CBR, keep it CBR. */
> @@ -353,6 +354,7 @@
> m_bufferFillFinal = m_bufferSize * m_param->rc.vbvBufferInit;
> m_bufferFillActual = m_bufferFillFinal;
> m_bufferExcess = 0;
> + m_initVbv = true;
> }
>
> m_totalBits = 0;
> diff -r 78c0f2c8ba08 -r 2e684b80d90f source/encoder/ratecontrol.h
> --- a/source/encoder/ratecontrol.h Fri Dec 22 12:48:37 2017 +0530
> +++ b/source/encoder/ratecontrol.h Thu Dec 07 10:59:12 2017 +0530
> @@ -132,6 +132,7 @@
> bool m_isGrainEnabled;
> bool m_isAbrReset;
> bool m_isNextGop;
> + bool m_initVbv;
> int m_lastAbrResetPoc;
>
> double m_rateTolerance;
>
> _______________________________________________
> 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/20171222/46d2f15b/attachment.html>
More information about the x265-devel
mailing list