[x265] [PATCH] rc: Fix rowStat computation in const-vbv

Ashok Kumar Mishra ashok at multicorewareinc.com
Fri Oct 12 08:57:52 CEST 2018


On Wed, Oct 10, 2018 at 2:22 PM <aruna at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Aruna Matheswaran <aruna at multicorewareinc.com>
> # Date 1539151768 -19800
> #      Wed Oct 10 11:39:28 2018 +0530
> # Node ID 9f74ae7aa489ed0c981dbf1f4a8dddd771046490
> # Parent  fd517ae68f93dbfdd1bff45a9dd8e626523542b6
> rc: Fix rowStat computation in const-vbv
>
> diff -r fd517ae68f93 -r 9f74ae7aa489 source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp   Tue Sep 25 16:02:31 2018 +0530
> +++ b/source/encoder/frameencoder.cpp   Wed Oct 10 11:39:28 2018 +0530
> @@ -1599,11 +1599,11 @@
>              if (!m_param->bEnableWavefront && col == numCols - 1)
>              {
>                  double qpBase = curEncData.m_cuStat[cuAddr].baseQp;
> -                int reEncode =
> m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase,
> m_sliceBaseRow, sliceId);
> +                curRow.reEncode =
> m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase,
> m_sliceBaseRow, sliceId);
>                  qpBase = x265_clip3((double)m_param->rc.qpMin,
> (double)m_param->rc.qpMax, qpBase);
>                  curEncData.m_rowStat[row].rowQp = qpBase;
>                  curEncData.m_rowStat[row].rowQpScale =
> x265_qp2qScale(qpBase);
> -                if (reEncode < 0)
> +                if (curRow.reEncode < 0)
>                  {
>                      x265_log(m_param, X265_LOG_DEBUG, "POC %d row %d -
> encode restart required for VBV, to %.2f from %.2f\n",
>                          m_frame->m_poc, row, qpBase,
> curEncData.m_cuStat[cuAddr].baseQp);
> @@ -1642,17 +1642,19 @@
>                              curEncData.m_rowStat[r].sumQpRc +=
> curEncData.m_cuStat[c].baseQp;
>                              curEncData.m_rowStat[r].numEncodedCUs = c;
>                          }
> +                        if (curRow.reEncode < 0)
> +                            break;
>                          startCuAddr = EndCuAddr - numCols;
>                          EndCuAddr = startCuAddr + 1;
>                      }
>                  }
>                  double qpBase = curEncData.m_cuStat[cuAddr].baseQp;
> -                int reEncode =
> m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase,
> m_sliceBaseRow, sliceId);
> +                curRow.reEncode =
> m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase,
> m_sliceBaseRow, sliceId);
>                  qpBase = x265_clip3((double)m_param->rc.qpMin,
> (double)m_param->rc.qpMax, qpBase);
>                  curEncData.m_rowStat[row].rowQp = qpBase;
>                  curEncData.m_rowStat[row].rowQpScale =
> x265_qp2qScale(qpBase);
>
> -                if (reEncode < 0)
> +                if (curRow.reEncode < 0)
>                  {
>                      x265_log(m_param, X265_LOG_DEBUG, "POC %d row %d -
> encode restart required for VBV, to %.2f from %.2f\n",
>                               m_frame->m_poc, row, qpBase,
> curEncData.m_cuStat[cuAddr].baseQp);
> diff -r fd517ae68f93 -r 9f74ae7aa489 source/encoder/frameencoder.h
> --- a/source/encoder/frameencoder.h     Tue Sep 25 16:02:31 2018 +0530
> +++ b/source/encoder/frameencoder.h     Wed Oct 10 11:39:28 2018 +0530
> @@ -97,6 +97,8 @@
>      volatile uint32_t completed;
>      volatile uint32_t avgQPComputed;
>
> +    volatile int      reEncode;
> +
>      /* called at the start of each frame to initialize state */
>      void init(Entropy& initContext, unsigned int sid)
>      {
> @@ -105,6 +107,7 @@
>          completed = 0;
>          avgQPComputed = 0;
>          sliceId = sid;
> +        reEncode = 0;
>          memset(&rowStats, 0, sizeof(rowStats));
>          rowGoOnCoder.load(initContext);
>      }
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel



Thank you. Pushed to stable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20181012/dca295d8/attachment.html>


More information about the x265-devel mailing list