[x265] [PATCH 3 of 4] store analysis information in buffers

sagar at multicorewareinc.com sagar at multicorewareinc.com
Thu Sep 11 15:55:17 CEST 2014


# HG changeset patch
# User Sagar Kotecha <sagar at multicorewareinc.com>
# Date 1410443605 -19800
#      Thu Sep 11 19:23:25 2014 +0530
# Node ID 089f8764b2ebe7f6eb5f29133cdc62e799e74587
# Parent  707d9fe762d987803aef15760cb4a6ff01965c32
store analysis information in buffers

diff -r 707d9fe762d9 -r 089f8764b2eb source/common/frame.cpp
--- a/source/common/frame.cpp	Thu Sep 11 19:21:37 2014 +0530
+++ b/source/common/frame.cpp	Thu Sep 11 19:23:25 2014 +0530
@@ -51,6 +51,8 @@
     m_avgQpRc = 0;
     m_avgQpAq = 0;
     m_bChromaPlanesExtended = false;
+    m_intraData = NULL;
+    m_interData = NULL;
 }
 
 Frame::~Frame()
diff -r 707d9fe762d9 -r 089f8764b2eb source/common/frame.h
--- a/source/common/frame.h	Thu Sep 11 19:21:37 2014 +0530
+++ b/source/common/frame.h	Thu Sep 11 19:23:25 2014 +0530
@@ -83,6 +83,9 @@
     double            m_rateFactor; // calculated based on the Frame QP
     int32_t           m_forceqp;    // Force to use the qp specified in qp file
 
+    x265_intra_data*  m_intraData;  // intra analysis information
+    x265_inter_data*  m_interData;  // inter analysis information
+
     Frame();
     virtual ~Frame();
 
diff -r 707d9fe762d9 -r 089f8764b2eb source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Thu Sep 11 19:21:37 2014 +0530
+++ b/source/encoder/analysis.cpp	Thu Sep 11 19:23:25 2014 +0530
@@ -312,6 +312,14 @@
     if (m_bestCU[0]->m_slice->m_sliceType == I_SLICE)
     {
         compressIntraCU(m_bestCU[0], m_tempCU[0], false, cu, cu->m_CULocalData);
+        if (m_param->analysisMode == 1)
+        {
+            memcpy(&m_bestCU[0]->m_pic->m_intraData->depth[cu->getAddr() * cu->m_numPartitions], m_bestCU[0]->getDepth(), sizeof(uint8_t) * cu->getTotalNumPart());
+            memcpy(&m_bestCU[0]->m_pic->m_intraData->modes[cu->getAddr() * cu->m_numPartitions], m_bestCU[0]->getLumaIntraDir(), sizeof(uint8_t) * cu->getTotalNumPart());
+            memcpy(&m_bestCU[0]->m_pic->m_intraData->partSizes[cu->getAddr() * cu->m_numPartitions], m_bestCU[0]->getPartitionSize(), sizeof(char) * cu->getTotalNumPart());
+            m_bestCU[0]->m_pic->m_intraData->cuAddr[cu->getAddr()] = cu->getAddr();
+            m_bestCU[0]->m_pic->m_intraData->poc[cu->getAddr()]    = cu->m_pic->m_POC;
+        }
         if (m_param->bLogCuStats || m_param->rc.bStatWrite)
         {
             uint32_t i = 0;
diff -r 707d9fe762d9 -r 089f8764b2eb source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu Sep 11 19:21:37 2014 +0530
+++ b/source/encoder/encoder.cpp	Thu Sep 11 19:23:25 2014 +0530
@@ -341,6 +341,11 @@
             else
                 m_rateControl->calcAdaptiveQuantFrame(pic);
         }
+        if (pic_in->analysisData.intraData)
+        {
+            pic->m_intraData = pic_in->analysisData.intraData;
+            pic->m_interData = pic_in->analysisData.interData;
+        }
         m_lookahead->addPicture(pic, pic_in->sliceType);
         m_numDelayedPic++;
     }
@@ -391,6 +396,14 @@
             pic_out->stride[2] = recpic->getCStride() * sizeof(pixel);
         }
 
+        if (m_param->analysisMode)
+        {
+            pic_out->analysisData.interData = out->m_interData;
+            pic_out->analysisData.intraData = out->m_intraData;
+            pic_out->analysisData.numCUsInFrame = out->m_picSym->getNumberOfCUsInFrame();
+            pic_out->analysisData.numPartitions = out->m_picSym->getNumPartition();
+        }
+
         if (slice->m_sliceType == P_SLICE)
         {
             if (slice->m_weightPredTable[0][0][0].bPresentFlag)


More information about the x265-devel mailing list