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

sagar at multicorewareinc.com sagar at multicorewareinc.com
Wed Sep 10 14:49:02 CEST 2014


# HG changeset patch
# User Sagar Kotecha <sagar at multicorewareinc.com>
# Date 1410350860 -19800
#      Wed Sep 10 17:37:40 2014 +0530
# Node ID 44004db9861ae68799243fd4f2e395c216f2bb36
# Parent  3e8e21de35c0dcae20dd0e3a8e2ccede69612da7
store intra analysis information in buffers

diff -r 3e8e21de35c0 -r 44004db9861a source/common/frame.cpp
--- a/source/common/frame.cpp	Wed Sep 10 17:36:50 2014 +0530
+++ b/source/common/frame.cpp	Wed Sep 10 17:37:40 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 3e8e21de35c0 -r 44004db9861a source/common/frame.h
--- a/source/common/frame.h	Wed Sep 10 17:36:50 2014 +0530
+++ b/source/common/frame.h	Wed Sep 10 17:37:40 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 3e8e21de35c0 -r 44004db9861a source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Wed Sep 10 17:36:50 2014 +0530
+++ b/source/encoder/analysis.cpp	Wed Sep 10 17:37:40 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->bAnalysisDataOut)
+        {
+            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 3e8e21de35c0 -r 44004db9861a source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Sep 10 17:36:50 2014 +0530
+++ b/source/encoder/encoder.cpp	Wed Sep 10 17:37:40 2014 +0530
@@ -338,6 +338,12 @@
             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++;
     }
@@ -386,6 +392,15 @@
             pic_out->stride[1] = recpic->getCStride() * sizeof(pixel);
             pic_out->planes[2] = recpic->getCrAddr();
             pic_out->stride[2] = recpic->getCStride() * sizeof(pixel);
+
+            // pass the buffers to recon for data dump (bAnalysisDataOut = true) and/or to release the buffer(bAnalysisDataIn = true)
+            if (m_param->bAnalysisDataIn || m_param->bAnalysisDataOut)
+            {
+                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)


More information about the x265-devel mailing list