<div dir="ltr">Thanks, pushed with an additional comment. <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 23, 2014 at 12:18 PM,  <span dir="ltr"><<a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@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 Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
# Date 1419317228 -19800<br>
#      Tue Dec 23 12:17:08 2014 +0530<br>
# Node ID 09cb790f2242df75ba1f3a1e0415c4f34d0ec729<br>
# Parent  c4ec3f22846beb3eedcb187e86be17bd7636aafa<br>
encoder: allocate memory for inter and intra analysis data based on slicetype<br>
<br>
diff -r c4ec3f22846b -r 09cb790f2242 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Tue Dec 23 11:43:32 2014 +0530<br>
+++ b/source/encoder/encoder.cpp        Tue Dec 23 12:17:08 2014 +0530<br>
@@ -462,7 +462,6 @@<br>
         if (m_param->analysisMode == X265_ANALYSIS_LOAD)<br>
         {<br>
             x265_picture* inputPic = const_cast<x265_picture*>(pic_in);<br>
-            allocAnalysis(&inputPic->analysisData);<br>
             readAnalysisFile(&inputPic->analysisData, inFrame->m_poc);<br>
             inFrame->m_analysisData.poc = inFrame->m_poc;<br>
             inFrame->m_analysisData.sliceType = inputPic->analysisData.sliceType;<br>
@@ -624,7 +623,7 @@<br>
         {<br>
             x265_analysis_data* analysis = &frameEnc->m_analysisData;<br>
             analysis->poc = frameEnc->m_poc;<br>
-            analysis->sliceType = frameEnc->m_encData->m_slice->m_poc;<br>
+            analysis->sliceType = frameEnc->m_lowres.sliceType;<br>
             uint32_t widthInCU       = (m_param->sourceWidth  + g_maxCUSize - 1) >> g_maxLog2CUSize;<br>
             uint32_t heightInCU      = (m_param->sourceHeight + g_maxCUSize - 1) >> g_maxLog2CUSize;<br>
<br>
@@ -1558,15 +1557,21 @@<br>
<br>
 void Encoder::allocAnalysis(x265_analysis_data* analysis)<br>
 {<br>
-    analysis_intra_data *intraData = (analysis_intra_data*)analysis->intraData;<br>
-    analysis_inter_data *interData = (analysis_inter_data*)analysis->interData;<br>
-    CHECKED_MALLOC_ZERO(intraData, analysis_intra_data, 1);<br>
-    CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
-    CHECKED_MALLOC(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
-    CHECKED_MALLOC(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);<br>
-    CHECKED_MALLOC(interData, analysis_inter_data, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2);<br>
-    analysis->intraData = intraData;<br>
-    analysis->interData = interData;<br>
+    if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
+    {<br>
+        analysis_intra_data *intraData = (analysis_intra_data*)analysis->intraData;<br>
+        CHECKED_MALLOC_ZERO(intraData, analysis_intra_data, 1);<br>
+        CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        CHECKED_MALLOC(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        CHECKED_MALLOC(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);<br>
+        analysis->intraData = intraData;<br>
+    }<br>
+    else<br>
+    {<br>
+        analysis_inter_data *interData = (analysis_inter_data*)analysis->interData;<br>
+        CHECKED_MALLOC(interData, analysis_inter_data, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2);<br>
+        analysis->interData = interData;<br>
+    }<br>
     return;<br>
<br>
 fail:<br>
@@ -1576,11 +1581,15 @@<br>
<br>
 void Encoder::freeAnalysis(x265_analysis_data* analysis)<br>
 {<br>
-    X265_FREE(((analysis_intra_data*)analysis->intraData)->depth);<br>
-    X265_FREE(((analysis_intra_data*)analysis->intraData)->modes);<br>
-    X265_FREE(((analysis_intra_data*)analysis->intraData)->partSizes);<br>
-    X265_FREE(analysis->interData);<br>
-    X265_FREE(analysis->intraData);<br>
+    if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
+    {<br>
+        X265_FREE(((analysis_intra_data*)analysis->intraData)->depth);<br>
+        X265_FREE(((analysis_intra_data*)analysis->intraData)->modes);<br>
+        X265_FREE(((analysis_intra_data*)analysis->intraData)->partSizes);<br>
+        X265_FREE(analysis->intraData);<br>
+    }<br>
+    else<br>
+        X265_FREE(analysis->interData);<br>
 }<br>
<br>
 void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc)<br>
@@ -1628,6 +1637,9 @@<br>
     X265_FREAD(&analysis->numCUsInFrame, sizeof(int), 1, m_analysisFile);<br>
     X265_FREAD(&analysis->numPartitions, sizeof(int), 1, m_analysisFile);<br>
<br>
+    /* Once read the Slicetype allocate the memory for inter and intra analysis data based on the Slicetype */<br>
+    allocAnalysis(analysis);<br>
+<br>
     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
     {<br>
         X265_FREAD(((analysis_intra_data *)analysis->intraData)->depth, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFile);<br>
_______________________________________________<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" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>