<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 17, 2017 at 6:45 PM,  <span dir="ltr"><<a href="mailto:gopi.satykrishna@multicorewareinc.com" target="_blank">gopi.satykrishna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Gopi Satykrishna Akisetty <<a href="mailto:gopi.satykrishna@multicorewareinc.com">gopi.satykrishna@<wbr>multicorewareinc.com</a>><br>
# Date 1495026531 -19800<br>
#      Wed May 17 18:38:51 2017 +0530<br>
# Node ID 64cd721100d78b9425d7587445290b<wbr>74715b3a54<br>
# Parent  4b846d3bac97134b8a91e3569bcb9f<wbr>981b47ccc0<br>
rc: Use RcStats information if available from pic_in<br>
<br>
diff -r 4b846d3bac97 -r 64cd721100d7 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt     Wed May 17 17:27:41 2017 +0530<br>
+++ b/source/CMakeLists.txt     Wed May 17 18:38:51 2017 +0530<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 117)<br>
+set(X265_BUILD 118)<br>
 configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
                "${PROJECT_BINARY_DIR}/x265.<wbr>def")<br>
 configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
diff -r 4b846d3bac97 -r 64cd721100d7 source/common/param.cpp<br>
--- a/source/common/param.cpp   Wed May 17 17:27:41 2017 +0530<br>
+++ b/source/common/param.cpp   Wed May 17 18:38:51 2017 +0530<br>
@@ -276,6 +276,7 @@<br>
     param->toneMapFile = NULL;<br>
     param->bDhdr10opt = 0;<br>
     param->bCTUInfo = 0;<br>
+    param->bUseRcStats = 0;<br>
 }<br>
<br>
 int x265_param_default_preset(<wbr>x265_param* param, const char* preset, const char* tune)<br>
diff -r 4b846d3bac97 -r 64cd721100d7 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Wed May 17 17:27:41 2017 +0530<br>
+++ b/source/encoder/encoder.cpp        Wed May 17 18:38:51 2017 +0530<br>
@@ -772,6 +772,32 @@<br>
             inFrame->m_lowres.bScenecut = !!inFrame->m_analysisData.<wbr>bScenecut;<br>
             inFrame->m_lowres.satdCost = inFrame->m_analysisData.<wbr>satdCost;<br>
         }<br>
+        if (m_param->bUseRcStats)<br></blockquote><div><br></div><div>Would be good to also check that pic_in->rcData is valid before casting and using it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+        {<br>
+            RcStats* rc = (RcStats*)pic_in->rcData;<br>
+            m_rateControl->m_accumPQp = rc->cumulativePQp;<br>
+            m_rateControl->m_accumPNorm = rc->cumulativePNorm;<br>
+            m_rateControl->m_isNextGop = true;<br>
+            for (int j = 0; j < 3; j++)<br>
+                m_rateControl->m_<wbr>lastQScaleFor[j] = rc->lastQScaleFor[j];<br>
+            m_rateControl->m_<wbr>wantedBitsWindow = rc->wantedBitsWindow;<br>
+            m_rateControl->m_cplxrSum = rc->cplxrSum;<br>
+            m_rateControl->m_totalBits = rc->totalBits;<br>
+            m_rateControl->m_encodedBits = rc->encodedBits;<br>
+            m_rateControl->m_<wbr>shortTermCplxSum = rc->shortTermCplxSum;<br>
+            m_rateControl->m_<wbr>shortTermCplxCount = rc->shortTermCplxCount;<br>
+            if (m_rateControl->m_isVbv)<br>
+            {<br>
+                m_rateControl->m_<wbr>bufferFillFinal = rc->bufferFillFinal;<br>
+                for (int i = 0; i < 4; i++)<br>
+                {<br>
+                    m_rateControl->m_pred[i].coeff = rc->coeff[i];<br>
+                    m_rateControl->m_pred[i].count = rc->count[i];<br>
+                    m_rateControl->m_pred[i].<wbr>offset = rc->offset[i];<br>
+                }<br>
+            }<br>
+            m_param->bUseRcStats = 0;<br>
+        }<br>
         if (m_reconfigureRc)<br>
             inFrame->m_reconfigureRc = true;<br>
<br>
diff -r 4b846d3bac97 -r 64cd721100d7 source/x265.h<br>
--- a/source/x265.h     Wed May 17 17:27:41 2017 +0530<br>
+++ b/source/x265.h     Wed May 17 18:38:51 2017 +0530<br>
@@ -1408,6 +1408,9 @@<br>
<br>
     /* Determine how x265 react to the content information recieved through the API */<br>
     int       bCTUInfo;<br>
+<br>
+    /* Use ratecontrol statistics from pic_in, if available*/<br>
+    int       bUseRcStats;<br>
 } x265_param;<br>
 /* x265_param_alloc:<br>
  *  Allocates an x265_param instance. The returned param structure is not<br>
______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
</blockquote></div><br></div></div>