[x265] [PATCH] rc: record RF details in csv for 2 pass CRF

Aarthi Priya Thirumalai aarthi at multicorewareinc.com
Wed Nov 25 11:40:48 CET 2015


# HG changeset patch
# User Aarthi Thirumalai <aarthi at multicorewareinc.com>
# Date 1448384595 -19800
#      Tue Nov 24 22:33:15 2015 +0530
# Node ID 7b84524dc44236071ba33f5858a6c38a909162d2
# Parent  e90c2d74de88459dd18837765a310a462d9679ec
rc: record RF details in csv for 2 pass CRF

diff -r e90c2d74de88 -r 7b84524dc442 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Mon Nov 23 12:26:45 2015 +0530
+++ b/source/encoder/ratecontrol.cpp Tue Nov 24 22:33:15 2015 +0530
@@ -2239,10 +2239,11 @@
     {
         if (m_param->rc.rateControlMode == X265_RC_ABR &&
!m_param->rc.bStatRead)
             checkAndResetABR(rce, true);
+    }

-        if (m_param->rc.rateControlMode == X265_RC_CRF)
+     if (m_param->rc.rateControlMode == X265_RC_CRF)
         {
-            if (int(curEncData.m_avgQpRc + 0.5) == slice->m_sliceQp)
+            if (curEncData.m_avgQpRc - rce->qpNoVbv < 1)
                 curEncData.m_rateFactor = m_rateFactorConstant;
             else
             {
@@ -2253,7 +2254,6 @@
                     x265_qp2qScale(int(curEncData.m_avgQpRc + 0.5) +
mbtree_offset);
             }
         }
-    }

     if (m_isAbr && !m_isAbrReset)
     {


On Wed, Nov 25, 2015 at 12:33 PM, Deepthi Nandakumar <
deepthi at multicorewareinc.com> wrote:

> can you resend this patch, conflicts with your earlier one.
>
> On Tue, Nov 24, 2015 at 11:47 PM, <aarthi at multicorewareinc.com> wrote:
>
>> # HG changeset patch
>> # User Aarthi Thirumalai <aarthi at multicorewareinc.com>
>> # Date 1448384595 -19800
>> #      Tue Nov 24 22:33:15 2015 +0530
>> # Branch stable
>> # Node ID d17f491e06152f4627152a36169c272651bd5e3d
>> # Parent  0c49c9cc75e4c1ef9534a28b49b97b9107636f5d
>> rc: record RF details in csv for 2 pass CRF
>>
>> diff -r 0c49c9cc75e4 -r d17f491e0615 source/encoder/ratecontrol.cpp
>> --- a/source/encoder/ratecontrol.cpp    Mon Nov 23 14:06:10 2015 +0530
>> +++ b/source/encoder/ratecontrol.cpp    Tue Nov 24 22:33:15 2015 +0530
>> @@ -1141,6 +1141,7 @@
>>      }
>>      if (!m_isAbr && m_2pass && m_param->rc.rateControlMode ==
>> X265_RC_CRF)
>>      {
>> +        rce->oldQScale = rce->qScale;
>>          rce->qScale = rce->newQScale;
>>          rce->qpaRc = curEncData.m_avgQpRc = curEncData.m_avgQpAq =
>> x265_qScale2qp(rce->newQScale);
>>          m_qp = int(rce->qpaRc + 0.5);
>> @@ -1704,6 +1705,7 @@
>>              bool isFrameAfterScenecut = m_sliceType!= I_SLICE &&
>> m_curSlice->m_refPicList[0][0]->m_lowres.bScenecut;
>>              if (!m_2pass && m_isVbv && isFrameAfterScenecut)
>>                  q = x265_clip3(lqmin, lqmax, q);
>> +            rce->qScale = q;
>>          }
>>          m_lastQScaleFor[m_sliceType] = q;
>>          if ((m_curSlice->m_poc == 0 || m_lastQScaleFor[P_SLICE] < q) &&
>> !(m_2pass && !m_isVbv))
>> @@ -2337,10 +2339,12 @@
>>      {
>>          if (m_param->rc.rateControlMode == X265_RC_ABR &&
>> !m_param->rc.bStatRead)
>>              checkAndResetABR(rce, true);
>> +    }
>>
>> -        if (m_param->rc.rateControlMode == X265_RC_CRF)
>> +     if (m_param->rc.rateControlMode == X265_RC_CRF)
>>          {
>> -            if (int(curEncData.m_avgQpRc + 0.5) == slice->m_sliceQp)
>> +            if ((int(curEncData.m_avgQpRc + 0.5) == slice->m_sliceQp &&
>> !m_2pass) ||
>> +                (rce->oldQScale == rce->qScale))
>>                  curEncData.m_rateFactor = m_rateFactorConstant;
>>              else
>>              {
>> @@ -2351,7 +2355,6 @@
>>                      x265_qp2qScale(int(curEncData.m_avgQpRc + 0.5) +
>> mbtree_offset);
>>              }
>>          }
>> -    }
>>
>>      if (m_isAbr && !m_isAbrReset)
>>      {
>> diff -r 0c49c9cc75e4 -r d17f491e0615 source/encoder/ratecontrol.h
>> --- a/source/encoder/ratecontrol.h      Mon Nov 23 14:06:10 2015 +0530
>> +++ b/source/encoder/ratecontrol.h      Tue Nov 24 22:33:15 2015 +0530
>> @@ -101,6 +101,7 @@
>>      double   qScale;
>>      double   newQScale;
>>      double   newQp;
>> +    double   oldQScale;
>>      int      mvBits;
>>      int      miscBits;
>>      int      coeffBits;
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>>
>
>
>
> --
> Deepthi Nandakumar
> Engineering Manager, x265
> Multicoreware, Inc
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20151125/d37989ce/attachment.html>


More information about the x265-devel mailing list