[x265] [PATCH 3 of 4] dump intra analysis information

sagar at multicorewareinc.com sagar at multicorewareinc.com
Tue Sep 9 11:23:01 CEST 2014


# HG changeset patch
# User Sagar Kotecha <sagar at multicorewareinc.com>
# Date 1410252851 -19800
#      Tue Sep 09 14:24:11 2014 +0530
# Node ID 3c02887100033f399135f2a774d8253eecb971e3
# Parent  2f993103d6b6cd35cbe52bd624c8eef0d1b85be4
dump intra analysis information

diff -r 2f993103d6b6 -r 3c0288710003 source/common/frame.cpp
--- a/source/common/frame.cpp	Tue Sep 09 12:13:20 2014 +0530
+++ b/source/common/frame.cpp	Tue Sep 09 14:24:11 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 2f993103d6b6 -r 3c0288710003 source/common/frame.h
--- a/source/common/frame.h	Tue Sep 09 12:13:20 2014 +0530
+++ b/source/common/frame.h	Tue Sep 09 14:24:11 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 2f993103d6b6 -r 3c0288710003 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Tue Sep 09 12:13:20 2014 +0530
+++ b/source/encoder/analysis.cpp	Tue Sep 09 14:24:11 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 2f993103d6b6 -r 3c0288710003 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Sep 09 12:13:20 2014 +0530
+++ b/source/encoder/encoder.cpp	Tue Sep 09 14:24:11 2014 +0530
@@ -331,6 +331,12 @@
             else
                 m_rateControl->calcAdaptiveQuantFrame(pic);
         }
+        if (pic_in->intraInterData.intraData)
+        {
+            pic->m_intraData = pic_in->intraInterData.intraData;
+            pic->m_interData = pic_in->intraInterData.interData;
+        }
+
         m_lookahead->addPicture(pic, pic_in->sliceType);
         m_numDelayedPic++;
     }
@@ -379,6 +385,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->intraInterData.interData = out->m_interData;
+                pic_out->intraInterData.intraData = out->m_intraData;
+                pic_out->intraInterData.numCUsInFrame = out->m_picSym->getNumberOfCUsInFrame();
+                pic_out->intraInterData.numPartitions = out->m_picSym->getNumPartition();
+            }
         }
 
         if (slice->m_sliceType == P_SLICE)


More information about the x265-devel mailing list