[x265] [PATCH] rc: bug fix for enforcing qpFile in 2 pass(fixes issue #111)

Steve Borho steve at borho.org
Mon Mar 16 23:38:23 CET 2015


On 03/16, aarthi at multicorewareinc.com wrote:
> # HG changeset patch
> # User Aarthi Thirumalai
> # Date 1426501581 -19800
> #      Mon Mar 16 15:56:21 2015 +0530
> # Node ID 2cd5af5a527d595d74fbad748c769bc48dce3e08
> # Parent  74496ce5d8ba9577410875703fef3f4a96362f7c
> rc: bug fix for enforcing qpFile in 2 pass(fixes issue #111)

pushed to default, since this would not apply on stable

> diff -r 74496ce5d8ba -r 2cd5af5a527d source/encoder/ratecontrol.cpp
> --- a/source/encoder/ratecontrol.cpp	Mon Mar 16 10:47:09 2015 +0530
> +++ b/source/encoder/ratecontrol.cpp	Mon Mar 16 15:56:21 2015 +0530
> @@ -1068,7 +1068,7 @@
>          m_qp = (int32_t)(curFrame->m_forceqp + 0.5) - 1;
>          m_qp = x265_clip3(QP_MIN, QP_MAX_MAX, m_qp);
>          rce->qpaRc = curEncData.m_avgQpRc = curEncData.m_avgQpAq = m_qp;
> -        if (m_isAbr)
> +        if (m_isAbr || m_2pass)
>          {
>              rce->qpNoVbv = rce->qpaRc;
>              m_lastQScaleFor[m_sliceType] = x265_qp2qScale(rce->qpaRc);
> @@ -1473,7 +1473,7 @@
>               * tolerances, the bit distribution approaches that of 2pass. */
>  
>              double overflow = 1;
> -            double lqmin = 0, lqmax = 0;
> +            double lqmin = MIN_QPSCALE, lqmax = MAX_MAX_QPSCALE;
>              m_shortTermCplxSum *= 0.5;
>              m_shortTermCplxCount *= 0.5;
>              m_shortTermCplxSum += m_currentSatd / (CLIP_DURATION(m_frameDuration) / BASE_FRAME_DURATION);
> @@ -1534,7 +1534,7 @@
>              q = clipQscale(curFrame, rce, q);
>              /*  clip qp to permissible range after vbv-lookahead estimation to avoid possible
>               * mispredictions by initial frame size predictors */
> -            if (m_isVbv && m_pred[m_sliceType].count == 1)
> +            if (!m_2pass && m_isVbv && m_pred[m_sliceType].count == 1)
>                  q = x265_clip3(lqmin, lqmax, q);
>          }
>          m_lastQScaleFor[m_sliceType] = q;
> diff -r 74496ce5d8ba -r 2cd5af5a527d source/x265.cpp
> --- a/source/x265.cpp	Mon Mar 16 10:47:09 2015 +0530
> +++ b/source/x265.cpp	Mon Mar 16 15:56:21 2015 +0530
> @@ -530,7 +530,7 @@
>      while (pic_in && !b_ctrl_c)
>      {
>          pic_orig.poc = inFrameCount;
> -        if (cliopt.qpfile && !param->rc.bStatRead)
> +        if (cliopt.qpfile)
>          {
>              if (!cliopt.parseQPFile(pic_orig))
>              {
> _______________________________________________
> 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