<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 4, 2017 at 1:10 PM, Divya Manivannan <span dir="ltr"><<a href="mailto:divya@multicorewareinc.com" target="_blank">divya@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 Divya Manivannan <<a href="mailto:divya@multicorewareinc.com">divya@multicorewareinc.com</a>><br>
# Date 1506315677 -19800<br>
#      Mon Sep 25 10:31:17 2017 +0530<br>
# Node ID 623fd118479831744b7b114bdce3f0<wbr>026c006f68<br>
# Parent  30998ebc3a3b7503f62e9ed520d7c6<wbr>7acca92b33<br>
Fix dts calculation when disabling lookahead in analysis load mode<br></blockquote><div><br></div><div>Pushed to default branch</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r 30998ebc3a3b -r 623fd1184798 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Tue Oct 03 19:54:22 2017 +0530<br>
+++ b/source/encoder/encoder.cpp        Mon Sep 25 10:31:17 2017 +0530<br>
@@ -911,6 +911,7 @@<br>
                         if (m_param->scaleFactor)<br>
                             factor = m_param->scaleFactor * 2;<br>
                         pic_out->analysisData.<wbr>numCuInHeight = outFrame->m_analysisData.<wbr>numCuInHeight;<br>
+                        pic_out->analysisData.<wbr>lookahead.dts = outFrame->m_dts;<br>
                         pic_out->analysisData.satdCost *= factor;<br>
                         pic_out->analysisData.<wbr>lookahead.keyframe = outFrame->m_lowres.bKeyframe;<br>
                         pic_out->analysisData.<wbr>lookahead.lastMiniGopBFrame = outFrame->m_lowres.<wbr>bLastMiniGopBFrame;<br>
@@ -1099,6 +1100,7 @@<br>
             }<br>
             if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->bDisableLookahead)<br>
             {<br>
+                frameEnc->m_dts = frameEnc->m_analysisData.<wbr>lookahead.dts;<br>
                 for (uint32_t index = 0; index < frameEnc->m_analysisData.<wbr>numCuInHeight; index++)<br>
                 {<br>
                     frameEnc->m_encData->m_<wbr>rowStat[index].intraSatdForVbv = frameEnc->m_analysisData.<wbr>lookahead.intraSatdForVbv[<wbr>index];<br>
@@ -1162,16 +1164,19 @@<br>
             frameEnc->m_encData->m_slice-><wbr>m_iNumRPSInSPS = m_sps.spsrpsNum;<br>
<br>
             curEncoder->m_rce.encodeOrder = frameEnc->m_encodeOrder = m_encodedFrameNum++;<br>
-            if (m_bframeDelay)<br>
+            if (m_param->analysisReuseMode != X265_ANALYSIS_LOAD || !m_param->bDisableLookahead)<br>
             {<br>
-                int64_t *prevReorderedPts = m_prevReorderedPts;<br>
-                frameEnc->m_dts = m_encodedFrameNum > m_bframeDelay<br>
-                    ? prevReorderedPts[(m_<wbr>encodedFrameNum - m_bframeDelay) % m_bframeDelay]<br>
-                    : frameEnc->m_reorderedPts - m_bframeDelayTime;<br>
-                prevReorderedPts[m_<wbr>encodedFrameNum % m_bframeDelay] = frameEnc->m_reorderedPts;<br>
+                if (m_bframeDelay)<br>
+                {<br>
+                    int64_t *prevReorderedPts = m_prevReorderedPts;<br>
+                    frameEnc->m_dts = m_encodedFrameNum > m_bframeDelay<br>
+                        ? prevReorderedPts[(m_<wbr>encodedFrameNum - m_bframeDelay) % m_bframeDelay]<br>
+                        : frameEnc->m_reorderedPts - m_bframeDelayTime;<br>
+                    prevReorderedPts[m_<wbr>encodedFrameNum % m_bframeDelay] = frameEnc->m_reorderedPts;<br>
+                }<br>
+                else<br>
+                    frameEnc->m_dts = frameEnc->m_reorderedPts;<br>
             }<br>
-            else<br>
-                frameEnc->m_dts = frameEnc->m_reorderedPts;<br>
<br>
             /* Allocate analysis data before encode in save mode. This is allocated in frameEnc */<br>
             if (m_param->analysisReuseMode == X265_ANALYSIS_SAVE)<br>
diff -r 30998ebc3a3b -r 623fd1184798 source/x265.h<br>
--- a/source/x265.h     Tue Oct 03 19:54:22 2017 +0530<br>
+++ b/source/x265.h     Mon Sep 25 10:31:17 2017 +0530<br>
@@ -100,6 +100,7 @@<br>
     int       keyframe;<br>
     int       lastMiniGopBFrame;<br>
     int       plannedType[X265_LOOKAHEAD_MAX + 1];<br>
+    int64_t   dts;<br>
 } x265_lookahead_data;<br>
<br>
 /* Stores all analysis data for a single frame */<br>
<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>
<br></blockquote></div><br></div></div>