<div dir="ltr"><div>Resending these set of patches after addressing all the comments in a while, Please omit these.<br><br>Thanks,<br>Snehaa.G</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 25, 2020 at 11:30 PM <<a href="mailto:x265-devel-request@videolan.org" target="_blank">x265-devel-request@videolan.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send x265-devel mailing list submissions to<br>
        <a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:x265-devel-request@videolan.org" target="_blank">x265-devel-request@videolan.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:x265-devel-owner@videolan.org" target="_blank">x265-devel-owner@videolan.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of x265-devel digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: [PATCH] zone: Fix BufferRate mismatch and log unclipped<br>
      BufferFillFinal into csv (Aruna Matheswaran)<br>
   2. Re: [PATCH] Add option to get global maxrate (Aruna Matheswaran)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 25 Feb 2020 22:39:59 +0530<br>
From: Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com" target="_blank">aruna@multicorewareinc.com</a>><br>
To: Development for x265 <<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a>><br>
Subject: Re: [x265] [PATCH] zone: Fix BufferRate mismatch and log<br>
        unclipped BufferFillFinal into csv<br>
Message-ID:<br>
        <<a href="mailto:CAOdJ0O4z594TUpoo%2BkM3OOYjnrz%2BJf5BVWGGXqv-2cgjE%2BLrRw@mail.gmail.com" target="_blank">CAOdJ0O4z594TUpoo+kM3OOYjnrz+Jf5BVWGGXqv-2cgjE+LrRw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
On Wed, Feb 19, 2020 at 3:28 PM Snehaa Giridharan <<br>
<a href="mailto:snehaa@multicorewareinc.com" target="_blank">snehaa@multicorewareinc.com</a>> wrote:<br>
<br>
> # HG changeset patch<br>
> # User Snehaa Giridharan <<a href="mailto:snehaa@multicorewareinc.com" target="_blank">snehaa@multicorewareinc.com</a>><br>
> # Date 1575548701 -19800<br>
> #      Thu Dec 05 17:55:01 2019 +0530<br>
> # Node ID 495e78dfd32bcdeee0c48a8732eba135be12cb8e<br>
> # Parent  ce3a4929efca3034bce12b7449d73ed2e03f9b4d<br>
> zone: Fix BufferRate mismatch and log unclipped BufferFillFinal into csv<br>
><br>
> This commit fixes<br>
> - Mismatch in BufferRate<br>
><br>
Please brief this.<br>
<br>
> - Log UnclippedBufferFillFinal into csv when csvloglevel greater than 1<br>
><br>
> diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst<br>
> --- a/doc/reST/cli.rst<br>
> +++ b/doc/reST/cli.rst<br>
> @@ -107,6 +107,9 @@<br>
><br>
>   **BufferFillFinal** Buffer bits available after removing the frame out<br>
> of CPB.<br>
><br>
> + **UnclippedBufferFillFinal** Unclipped buffer bits available after<br>
> removing the frame<br>
> + out of CPB only used for csv logging purpose.<br>
> +<br>
>   **Latency** Latency in terms of number of frames between when the frame<br>
>   was given in and when the frame is given out.<br>
><br>
> diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp<br>
> --- a/source/encoder/api.cpp<br>
> +++ b/source/encoder/api.cpp<br>
> @@ -1294,6 +1294,8 @@<br>
>                      fprintf(csvfp, "RateFactor, ");<br>
>                  if (param->rc.vbvBufferSize)<br>
>                      fprintf(csvfp, "BufferFill, BufferFillFinal, ");<br>
> +                if (param->csvLogLevel >= 2)<br>
><br>
Need to check if  param->rc.vbvBufferSize  is set.<br>
<br>
> +                    fprintf(csvfp, "UnclippedBufferFillFinal, ");<br>
>                  if (param->bEnablePsnr)<br>
>                      fprintf(csvfp, "Y PSNR, U PSNR, V PSNR, YUV PSNR, ");<br>
>                  if (param->bEnableSsim)<br>
> @@ -1405,6 +1407,8 @@<br>
>          fprintf(param->csvfpt, "%.3lf,", frameStats->rateFactor);<br>
>      if (param->rc.vbvBufferSize)<br>
>          fprintf(param->csvfpt, "%.3lf, %.3lf,", frameStats->bufferFill,<br>
> frameStats->bufferFillFinal);<br>
> +    if (param->csvLogLevel >= 2)<br>
><br>
Same here.<br>
<br>
> +        fprintf(param->csvfpt, "%.3lf,",<br>
> frameStats->unclippedBufferFillFinal);<br>
>      if (param->bEnablePsnr)<br>
>          fprintf(param->csvfpt, "%.3lf, %.3lf, %.3lf, %.3lf,",<br>
> frameStats->psnrY, frameStats->psnrU, frameStats->psnrV, frameStats->psnr);<br>
>      if (param->bEnableSsim)<br>
> diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>
> --- a/source/encoder/encoder.cpp<br>
> +++ b/source/encoder/encoder.cpp<br>
> @@ -3012,6 +3012,8 @@<br>
>              frameStats->ipCostRatio = curFrame->m_lowres.ipCostRatio;<br>
>          frameStats->bufferFill = m_rateControl->m_bufferFillActual;<br>
>          frameStats->bufferFillFinal = m_rateControl->m_bufferFillFinal;<br>
> +        if (m_param->csvLogLevel >= 2)<br>
> +            frameStats->unclippedBufferFillFinal =<br>
> m_rateControl->m_unclippedBufferFillFinal;<br>
>          frameStats->frameLatency = inPoc - poc;<br>
>          if (m_param->rc.rateControlMode == X265_RC_CRF)<br>
>              frameStats->rateFactor = curEncData.m_rateFactor;<br>
> diff --git a/source/encoder/ratecontrol.cpp<br>
> b/source/encoder/ratecontrol.cpp<br>
> --- a/source/encoder/ratecontrol.cpp<br>
> +++ b/source/encoder/ratecontrol.cpp<br>
> @@ -2745,7 +2745,9 @@<br>
>          x265_log(m_param, X265_LOG_WARNING, "poc:%d, VBV underflow (%.0f<br>
> bits)\n", rce->poc, m_bufferFillFinal);<br>
><br>
>      m_bufferFillFinal = X265_MAX(m_bufferFillFinal, 0);<br>
> -    m_bufferFillFinal += m_bufferRate;<br>
> +    m_bufferFillFinal += rce->bufferRate;<br>
> +    if (m_param->csvLogLevel >= 2)<br>
> +        m_unclippedBufferFillFinal = m_bufferFillFinal;<br>
><br>
>      if (m_param->rc.bStrictCbr)<br>
>      {<br>
> @@ -2755,14 +2757,14 @@<br>
>              filler += FILLER_OVERHEAD * 8;<br>
>          }<br>
>          m_bufferFillFinal -= filler;<br>
> -        bufferBits = X265_MIN(bits + filler + m_bufferExcess,<br>
> m_bufferRate);<br>
> +        bufferBits = X265_MIN(bits + filler + m_bufferExcess,<br>
> rce->bufferRate);<br>
>          m_bufferExcess = X265_MAX(m_bufferExcess - bufferBits + bits +<br>
> filler, 0);<br>
>          m_bufferFillActual += bufferBits - bits - filler;<br>
>      }<br>
>      else<br>
>      {<br>
>          m_bufferFillFinal = X265_MIN(m_bufferFillFinal, m_bufferSize);<br>
> -        bufferBits = X265_MIN(bits + m_bufferExcess, m_bufferRate);<br>
> +        bufferBits = X265_MIN(bits + m_bufferExcess, rce->bufferRate);<br>
>          m_bufferExcess = X265_MAX(m_bufferExcess - bufferBits + bits, 0);<br>
>          m_bufferFillActual += bufferBits - bits;<br>
>          m_bufferFillActual = X265_MIN(m_bufferFillActual, m_bufferSize);<br>
> diff --git a/source/encoder/ratecontrol.h b/source/encoder/ratecontrol.h<br>
> --- a/source/encoder/ratecontrol.h<br>
> +++ b/source/encoder/ratecontrol.h<br>
> @@ -157,6 +157,7 @@<br>
>      double m_rateFactorConstant;<br>
>      double m_bufferSize;<br>
>      double m_bufferFillFinal;  /* real buffer as of the last finished<br>
> frame */<br>
> +    double m_unclippedBufferFillFinal; /* real unclipped buffer as of the<br>
> last finished frame used to log in CSV*/<br>
>      double m_bufferFill;       /* planned buffer, if all in-progress<br>
> frames hit their bit budget */<br>
>      double m_bufferRate;       /* # of bits added to buffer_fill after<br>
> each frame */<br>
>      double m_vbvMaxRate;       /* in kbps */<br>
> diff --git a/source/x265.h b/source/x265.h<br>
> --- a/source/x265.h<br>
> +++ b/source/x265.h<br>
> @@ -304,6 +304,7 @@<br>
>      double           totalFrameTime;<br>
>      double           vmafFrameScore;<br>
>      double           bufferFillFinal;<br>
> +    double           unclippedBufferFillFinal;<br>
><br>
Increment X265_BUILD.<br>
<br>
>  } x265_frame_stats;<br>
><br>
>  typedef struct x265_ctu_info_t<br>
><br>
> --<br>
> *Thanks and Regards,*<br>
> *Snehaa.G*<br>
> _______________________________________________<br>
> x265-devel mailing list<br>
> <a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
><br>
<br>
<br>
-- <br>
Regards,<br>
*Aruna Matheswaran,*<br>
Video Codec Engineer,<br>
Media & AI analytics BU,<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.videolan.org/pipermail/x265-devel/attachments/20200225/322c9a40/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.videolan.org/pipermail/x265-devel/attachments/20200225/322c9a40/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 25 Feb 2020 23:30:15 +0530<br>
From: Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com" target="_blank">aruna@multicorewareinc.com</a>><br>
To: Development for x265 <<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a>><br>
Subject: Re: [x265] [PATCH] Add option to get global maxrate<br>
Message-ID:<br>
        <<a href="mailto:CAOdJ0O4cF3CemHx%2B7jScShRg9vy8674pucKYL3J1W5LoQ2R0fA@mail.gmail.com" target="_blank">CAOdJ0O4cF3CemHx+7jScShRg9vy8674pucKYL3J1W5LoQ2R0fA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
On Wed, Feb 19, 2020 at 3:28 PM Snehaa Giridharan <<br>
<a href="mailto:snehaa@multicorewareinc.com" target="_blank">snehaa@multicorewareinc.com</a>> wrote:<br>
<br>
> # HG changeset patch<br>
> # User Snehaa Giridharan <<a href="mailto:snehaa@multicorewareinc.com" target="_blank">snehaa@multicorewareinc.com</a>><br>
> # Date 1582105413 -19800<br>
> #      Wed Feb 19 15:13:33 2020 +0530<br>
> # Node ID 968e8839eade282f6cd687d43c18bb4ee512ee01<br>
> # Parent  495e78dfd32bcdeee0c48a8732eba135be12cb8e<br>
> Add option to get global maxrate<br>
><br>
> This global maxrate can be used for HRD signaling<br>
><br>
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>
> --- a/source/CMakeLists.txt<br>
> +++ b/source/CMakeLists.txt<br>
> @@ -29,7 +29,7 @@<br>
>  option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br>
>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br>
>  # X265_BUILD must be incremented each time the public API is changed<br>
> -set(X265_BUILD 189)<br>
> +set(X265_BUILD 190)<br>
>  configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
>                 "${PROJECT_BINARY_DIR}/x265.def")<br>
>  configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
> diff --git a/source/common/param.cpp b/source/common/param.cpp<br>
> --- a/source/common/param.cpp<br>
> +++ b/source/common/param.cpp<br>
> @@ -286,6 +286,7 @@<br>
>      param->rc.bEnableConstVbv = 0;<br>
>      param->bResetZoneConfig = 1;<br>
>      param->reconfigWindowSize = 0;<br>
> +    param->decoderVbvMaxRate = 0;<br>
><br>
>      /* Video Usability Information (VUI) */<br>
>      param->vui.aspectRatioIdc = 0;<br>
> @@ -2435,6 +2436,7 @@<br>
>      dst->rc.zonefileCount = src->rc.zonefileCount;<br>
>      dst->reconfigWindowSize = src->reconfigWindowSize;<br>
>      dst->bResetZoneConfig = src->bResetZoneConfig;<br>
> +    dst->decoderVbvMaxRate = src->decoderVbvMaxRate;<br>
><br>
Missing corresponding entries in info SEI and x265_check_param.<br>
<br>
><br>
>      if (src->rc.zonefileCount && src->rc.zones)<br>
>      {<br>
> diff --git a/source/encoder/ratecontrol.cpp<br>
> b/source/encoder/ratecontrol.cpp<br>
> --- a/source/encoder/ratecontrol.cpp<br>
> +++ b/source/encoder/ratecontrol.cpp<br>
> @@ -335,7 +335,7 @@<br>
>          int vbvBufferSize = m_param->rc.vbvBufferSize * 1000;<br>
>          int vbvMaxBitrate = m_param->rc.vbvMaxBitrate * 1000;<br>
><br>
> -        if (m_param->bEmitHRDSEI)<br>
> +        if (m_param->bEmitHRDSEI && !m_param->decoderVbvMaxRate)<br>
>          {<br>
>              const HRDInfo* hrd = &sps.vuiParameters.hrdParameters;<br>
>              vbvBufferSize = hrd->cpbSizeValue << (hrd->cpbSizeScale +<br>
> CPB_SHIFT);<br>
> @@ -781,8 +781,10 @@<br>
>      // Init HRD<br>
>      HRDInfo* hrd = &sps.vuiParameters.hrdParameters;<br>
>      hrd->cbrFlag = m_isCbr;<br>
> -    if (m_param->reconfigWindowSize)<br>
> +    if (m_param->reconfigWindowSize) {<br>
>          hrd->cbrFlag = 0;<br>
> +        vbvMaxBitrate = m_param->decoderVbvMaxRate * 1000;<br>
> +    }<br>
><br>
>      // normalize HRD size and rate to the value / scale notation<br>
>      hrd->bitRateScale = x265_clip3(0, 15, calcScale(vbvMaxBitrate) -<br>
> BR_SHIFT);<br>
> diff --git a/source/x265.h b/source/x265.h<br>
> --- a/source/x265.h<br>
> +++ b/source/x265.h<br>
> @@ -1905,6 +1905,9 @@<br>
><br>
>      /* Edge variance threshold for quad tree establishment. */<br>
>      float    edgeVarThreshold;<br>
> +<br>
> + /*Maxrate that could be signaled to the decoder. Default 0. API only. */<br>
> + int         decoderVbvMaxRate;<br>
><br>
Indentation issue.<br>
Add an entry for the same in cli.rst<br>
<br>
>  } x265_param;<br>
><br>
>  /* x265_param_alloc:<br>
><br>
> --<br>
> *Thanks and Regards,*<br>
> *Snehaa.G*<br>
> _______________________________________________<br>
> x265-devel mailing list<br>
> <a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
><br>
<br>
<br>
-- <br>
Regards,<br>
*Aruna Matheswaran,*<br>
Video Codec Engineer,<br>
Media & AI analytics BU,<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.videolan.org/pipermail/x265-devel/attachments/20200225/3c76d7f2/attachment.html" rel="noreferrer" target="_blank">http://mailman.videolan.org/pipermail/x265-devel/attachments/20200225/3c76d7f2/attachment.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br>
<br>
------------------------------<br>
<br>
End of x265-devel Digest, Vol 81, Issue 39<br>
******************************************<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><i><font face="georgia, serif">Thanks and Regards,</font></i></div><div><i><b><font face="georgia, serif">Snehaa.G</font></b></i></div></div></div></div></div></div></div></div></div></div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid #d3d4de">
        <tr>
        <td style="width:55px;padding-top:13px"><a href="https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=5d1cffcc-cd7a-478a-8410-76188ea236f6" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
                <td style="width:470px;padding-top:12px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">I’m protected online with Avast Free Antivirus. <a href="https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=5d1cffcc-cd7a-478a-8410-76188ea236f6" target="_blank" style="color:#4453ea">Get it here — it’s free forever.</a>
                </td>
        </tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div><div id="gmail-m_-8154922652414539344DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid rgb(211,212,222)">
        <tbody><tr>
        <td style="width:55px;padding-top:13px"><a href="https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=5d1cffcc-cd7a-478a-8410-76188ea236f6" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
                <td style="width:470px;padding-top:12px;color:rgb(65,66,78);font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">I’m protected online with Avast Free Antivirus. <a href="https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=5d1cffcc-cd7a-478a-8410-76188ea236f6" style="color:rgb(68,83,234)" target="_blank">Get it here — it’s free forever.</a>
                </td>
        </tr>
</tbody></table><a href="#m_-8154922652414539344_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>