[x265] [PATCH 2 of 6] rc: tune midframe vbv logic for B frames

Steve Borho steve at borho.org
Wed Nov 26 20:04:11 CET 2014


On 11/27, aarthi at multicorewareinc.com wrote:
> # HG changeset patch
> # User Aarthi Thirumalai
> # Date 1416389001 -19800
> #      Wed Nov 19 14:53:21 2014 +0530
> # Node ID 58f220140bc59d8373d253f97959bd02541f6338
> # Parent  3eff27c39259ee0ecf7eca715c5a754a584dae37
> rc: tune midframe vbv logic for B frames
> 
> diff -r 3eff27c39259 -r 58f220140bc5 source/encoder/ratecontrol.cpp
> --- a/source/encoder/ratecontrol.cpp	Fri Nov 21 18:07:42 2014 +0530
> +++ b/source/encoder/ratecontrol.cpp	Wed Nov 19 14:53:21 2014 +0530
> @@ -1885,13 +1885,15 @@
>                  }
>                  totalSatdBits += int32_t(pred_s);
>              }
> -            else
> +            else if (picType == P_SLICE)
>              {
>                  /* Our QP is lower than the reference! */
>                  double pred_intra = predictSize(rce->rowPred[1], qScale, intraCost);
>                  /* Sum: better to overestimate than underestimate by using only one of the two predictors. */
>                  totalSatdBits += int32_t(pred_intra + pred_s);
>              }
> +            else
> +              totalSatdBits += int32_t(pred_s);

We use C style casts everywhere else, I'll fix these two with this patch

>          }
>      }
>  
> @@ -1946,14 +1948,6 @@
>  
>      if (row < sps.numCuInHeight - 1)
>      {
> -        /* B-frames shouldn't use lower QP than their reference frames. */
> -        if (rce->sliceType == B_SLICE)
> -        {
> -            Frame* refSlice1 = curEncData.m_slice->m_refPicList[0][0];
> -            Frame* refSlice2 = curEncData.m_slice->m_refPicList[1][0];
> -            qpMin = X265_MAX(qpMin, X265_MAX(refSlice1->m_encData->m_rowStat[row].diagQp, refSlice2->m_encData->m_rowStat[row].diagQp));
> -            qpVbv = X265_MAX(qpVbv, qpMin);
> -        }
>          /* More threads means we have to be more cautious in letting ratecontrol use up extra bits. */
>          double rcTol = bufferLeftPlanned / m_param->frameNumThreads * m_param->rc.rateTolerance;
>          int32_t encodedBitsSoFar = 0;
> _______________________________________________
> 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