[x265] [PATCH] analysis: init depth and mode analysis buffer at the begining of CTU compression. Encoder nits

sagar at multicorewareinc.com sagar at multicorewareinc.com
Thu Mar 10 08:29:52 CET 2016


# HG changeset patch
# User Sagar Kotecha<sagar at multicorewareinc.com>
# Date 1457594824 -19800
#      Thu Mar 10 12:57:04 2016 +0530
# Node ID 5a7d55313b7741f3d0bd6134d2451b5989f517ed
# Parent  4a389ff5cdc32a7cd01f1dac39090930b54f2ea1
analysis: init depth and mode analysis buffer at the begining of CTU compression. Encoder nits.

diff -r 4a389ff5cdc3 -r 5a7d55313b77 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Thu Mar 10 11:36:23 2016 +0530
+++ b/source/encoder/analysis.cpp	Thu Mar 10 12:57:04 2016 +0530
@@ -147,6 +147,8 @@
         int numPredDir = m_slice->isInterP() ? 1 : 2;
         m_reuseInterDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData;
         m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];
+        m_reuseDepth = &m_reuseInterDataCTU->depth[ctu.m_cuAddr * ctu.m_numPartitions];
+        m_reuseModes = &m_reuseInterDataCTU->modes[ctu.m_cuAddr * ctu.m_numPartitions];
     }
     ProfileCUScope(ctu, totalCTUTime, totalCTUs);
 
@@ -897,9 +899,7 @@
     bool foundSkip = false;
     if (m_param->analysisMode == X265_ANALYSIS_LOAD)
     {
-        uint8_t* reuseDepth = &m_reuseInterDataCTU->depth[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
-        uint8_t* reuseModes = &m_reuseInterDataCTU->modes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
-        if (mightNotSplit && depth == reuseDepth[cuGeom.absPartIdx] && reuseModes[cuGeom.absPartIdx] == MODE_SKIP)
+        if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx] && m_reuseModes[cuGeom.absPartIdx] == MODE_SKIP)
         {
             md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
             md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -1385,9 +1385,7 @@
 
     if (m_param->analysisMode == X265_ANALYSIS_LOAD)
     {
-        uint8_t* reuseDepth  = &m_reuseInterDataCTU->depth[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
-        uint8_t* reuseModes  = &m_reuseInterDataCTU->modes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
-        if (mightNotSplit && depth == reuseDepth[cuGeom.absPartIdx] && reuseModes[cuGeom.absPartIdx] == MODE_SKIP)
+        if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx] && m_reuseModes[cuGeom.absPartIdx] == MODE_SKIP)
         {
             md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
             md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
diff -r 4a389ff5cdc3 -r 5a7d55313b77 source/encoder/analysis.h
--- a/source/encoder/analysis.h	Thu Mar 10 11:36:23 2016 +0530
+++ b/source/encoder/analysis.h	Thu Mar 10 12:57:04 2016 +0530
@@ -117,9 +117,11 @@
     Mode& compressCTU(CUData& ctu, Frame& frame, const CUGeom& cuGeom, const Entropy& initialContext);
 
 protected:
-    /* Analysis data for load/save modes, keeps getting incremented as CTU analysis proceeds and data is consumed or read */
-    analysis_inter_data* m_reuseInterDataCTU;
-    int32_t*             m_reuseRef;
+    /* Analysis data for save/load mode, writes/reads data based on absPartIdx */
+    analysis_inter_data* m_reuseInterDataCTU;
+    int32_t*             m_reuseRef;
+    uint8_t*             m_reuseDepth;
+    uint8_t*             m_reuseModes;
 
     uint32_t m_splitRefIdx[4];
     uint64_t* cacheCost;
diff -r 4a389ff5cdc3 -r 5a7d55313b77 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu Mar 10 11:36:23 2016 +0530
+++ b/source/encoder/encoder.cpp	Thu Mar 10 12:57:04 2016 +0530
@@ -2116,10 +2116,8 @@
                 absPartIdx += ctu->m_numPartitions >> (depth * 2);
             }
         }
-
     }
 
-
     /* calculate frameRecordSize */
     analysis->frameRecordSize = sizeof(analysis->frameRecordSize) + sizeof(depthBytes) + sizeof(analysis->poc) + sizeof(analysis->sliceType) +
                       sizeof(analysis->numCUsInFrame) + sizeof(analysis->numPartitions) + sizeof(analysis->bScenecut) + sizeof(analysis->satdCost);


More information about the x265-devel mailing list