<div dir="ltr">Pushed - with the following change<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 8, 2015 at 5:35 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 1419397499 -19800<br>
#      Wed Dec 24 10:34:59 2014 +0530<br>
# Node ID 24da7b0accdafb1f9e7e54182c114cb264d09bab<br>
# Parent  ee358bb8ea82a68c5efe56120f8a2657ff59c983<br>
analysis: simplify inter analysis structure to share more inter analysis data<br>
<br>
diff -r ee358bb8ea82 -r 24da7b0accda source/common/common.h<br>
--- a/source/common/common.h    Wed Jan 07 15:18:13 2015 +0530<br>
+++ b/source/common/common.h    Wed Dec 24 10:34:59 2014 +0530<br>
@@ -356,7 +356,7 @@<br>
 /* Stores inter (motion estimation) analysis data for a single frame */<br>
 struct analysis_inter_data<br>
 {<br>
-    int      ref;<br>
+    int32_t*    ref;<br>
 };<br>
<br>
 /* Stores intra analysis data for a single frame. This struct needs better packing */<br>
diff -r ee358bb8ea82 -r 24da7b0accda source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp       Wed Jan 07 15:18:13 2015 +0530<br>
+++ b/source/encoder/analysis.cpp       Wed Dec 24 10:34:59 2014 +0530<br>
@@ -133,9 +133,14 @@<br>
     uint32_t numPartition = ctu.m_numPartitions;<br>
     if (m_param->analysisMode)<br>
     {<br>
-        m_reuseIntraDataCTU = (analysis_intra_data *)m_frame->m_analysisData.intraData;<br>
-        int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
-        m_reuseInterDataCTU = (analysis_inter_data *)m_frame->m_analysisData.interData + ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir;<br>
+        if (m_slice->m_sliceType == I_SLICE)<br>
+            m_reuseIntraDataCTU = (analysis_intra_data *)m_frame->m_analysisData.intraData;<br>
+        else<br>
+        {<br>
+            int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
+            m_reuseInterDataCTU = (analysis_inter_data *)m_frame->m_analysisData.interData;<br>
+            reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];<br>
+        }<br>
     }<br>
<br>
     if (m_slice->m_sliceType == I_SLICE)<br>
@@ -1436,8 +1441,8 @@<br>
             MotionData* bestME = interMode.bestME[part];<br>
             for (int32_t i = 0; i < numPredDir; i++)<br>
             {<br>
-                bestME[i].ref = m_reuseInterDataCTU->ref;<br>
-                m_reuseInterDataCTU++;<br>
+                bestME[i].ref = *reuseRef;<br>
+                reuseRef++;<br>
             }<br>
         }<br>
     }<br>
@@ -1464,8 +1469,8 @@<br>
                 MotionData* bestME = interMode.bestME[puIdx];<br>
                 for (int32_t i = 0; i < numPredDir; i++)<br>
                 {<br>
-                    m_reuseInterDataCTU->ref = bestME[i].ref;<br>
-                    m_reuseInterDataCTU++;<br>
+                    *reuseRef = bestME[i].ref;<br>
+                    reuseRef++;<br>
                 }<br>
             }<br>
         }<br>
@@ -1491,8 +1496,8 @@<br>
             MotionData* bestME = interMode.bestME[puIdx];<br>
             for (int32_t i = 0; i < numPredDir; i++)<br>
             {<br>
-                bestME[i].ref = m_reuseInterDataCTU->ref;<br>
-                m_reuseInterDataCTU++;<br>
+                bestME[i].ref = *reuseRef;<br>
+                reuseRef++;<br>
             }<br>
         }<br>
     }<br>
@@ -1508,8 +1513,8 @@<br>
                 MotionData* bestME = interMode.bestME[puIdx];<br>
                 for (int32_t i = 0; i < numPredDir; i++)<br>
                 {<br>
-                    m_reuseInterDataCTU->ref = bestME[i].ref;<br>
-                    m_reuseInterDataCTU++;<br>
+                    *reuseRef = bestME[i].ref;<br>
+                    reuseRef++;<br>
                 }<br>
             }<br>
         }<br>
diff -r ee358bb8ea82 -r 24da7b0accda source/encoder/analysis.h<br>
--- a/source/encoder/analysis.h Wed Jan 07 15:18:13 2015 +0530<br>
+++ b/source/encoder/analysis.h Wed Dec 24 10:34:59 2014 +0530<br>
@@ -77,6 +77,7 @@<br>
     /* Analysis data for load/save modes, keeps getting incremented as CTU analysis proceeds and data is consumed or read */<br>
     analysis_intra_data* m_reuseIntraDataCTU;<br>
     analysis_inter_data* m_reuseInterDataCTU;<br>
+    int32_t* reuseRef;<br>
     Analysis();<br>
     bool create(ThreadLocalData* tld);<br>
     void destroy();<br>
diff -r ee358bb8ea82 -r 24da7b0accda source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Wed Jan 07 15:18:13 2015 +0530<br>
+++ b/source/encoder/encoder.cpp        Wed Dec 24 10:34:59 2014 +0530<br>
@@ -1576,7 +1576,8 @@<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>
+        CHECKED_MALLOC_ZERO(interData, analysis_inter_data, 1);<br>
+        CHECKED_MALLOC(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2);<br>
         analysis->interData = interData;<br>
     }<br>
     return;<br>
@@ -1596,7 +1597,10 @@<br>
         X265_FREE(analysis->intraData);<br>
     }<br>
     else<br>
+    {<br>
+        X265_FREE(((analysis_inter_data*)analysis->interData)->ref);<br>
         X265_FREE(analysis->interData);<br>
+    }<br>
 }<br>
<br>
 void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc)<br>
@@ -1657,13 +1661,13 @@<br>
     }<br>
     else if (analysis->sliceType == X265_TYPE_P)<br>
     {<br>
-        X265_FREAD(analysis->interData, sizeof(analysis_inter_data), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU, m_analysisFile);<br>
+        X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU, m_analysisFile);<br>
         consumedBytes += frameRecordSize;<br>
         totalConsumedBytes = consumedBytes;<br>
     }<br>
     else<br>
     {<br>
-        X265_FREAD(analysis->interData, sizeof(analysis_inter_data), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2, m_analysisFile);<br>
+        X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2, m_analysisFile);<br>
         consumedBytes += frameRecordSize;<br>
     }<br>
 #undef X265_FREAD<br>
@@ -1687,9 +1691,9 @@<br>
     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)<br>
         analysis->frameRecordSize += sizeof(uint8_t) * analysis->numCUsInFrame * analysis->numPartitions * 3;<br>
     else if (analysis->sliceType == X265_TYPE_P)<br>
-        analysis->frameRecordSize += sizeof(analysis_inter_data) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU;<br>
+        analysis->frameRecordSize += sizeof(int32_t) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU;<br>
     else<br>
-        analysis->frameRecordSize += sizeof(analysis_inter_data) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2;<br>
+        analysis->frameRecordSize += sizeof(int32_t) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2;<br>
<br></blockquote><div>The above change is not required, especially as I expect you'll add more fields to analysis_inter_data shortly.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     X265_FWRITE(&analysis->frameRecordSize, sizeof(uint32_t), 1, m_analysisFile);<br>
     X265_FWRITE(&analysis->poc, sizeof(int), 1, m_analysisFile);<br>
@@ -1705,11 +1709,11 @@<br>
     }<br>
     else if (analysis->sliceType == X265_TYPE_P)<br>
     {<br>
-        X265_FWRITE(analysis->interData, sizeof(analysis_inter_data), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU, m_analysisFile);<br>
+        X265_FWRITE(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU, m_analysisFile);<br>
     }<br>
     else<br>
     {<br>
-        X265_FWRITE(analysis->interData, sizeof(analysis_inter_data), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2, m_analysisFile);<br>
+        X265_FWRITE(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * 2, m_analysisFile);<br>
     }<br>
 #undef X265_FWRITE<br>
 }<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></div></div>