[x265] [PATCH] rc: move structure FrameStats to FrameEncoder class

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Wed Jul 2 20:02:17 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1404205105 -19800
#      Tue Jul 01 14:28:25 2014 +0530
# Node ID f62d90e934084689c2a13b85f66cb87a074a01a9
# Parent  a5a439242bbf367f5d76356b841cfa1ee9e119e4
rc: move structure FrameStats to FrameEncoder class

Stats are not needed post encode, moving it to FrameEncoder.

diff -r a5a439242bbf -r f62d90e93408 source/common/frame.cpp
--- a/source/common/frame.cpp	Wed Jul 02 14:06:12 2014 +0530
+++ b/source/common/frame.cpp	Tue Jul 01 14:28:25 2014 +0530
@@ -45,7 +45,6 @@
     m_reconRowCount.set(0);
     m_countRefEncoders = 0;
     memset(&m_lowres, 0, sizeof(m_lowres));
-    memset(&m_stats, 0, sizeof(m_stats));
     m_next = NULL;
     m_prev = NULL;
     m_qpaAq = NULL;
@@ -135,7 +134,6 @@
     }
     if (param->rc.aqMode)
         memset(m_qpaAq, 0, numRows * sizeof(double));
-    memset(&m_stats, 0, sizeof(m_stats));
 }
 
 void Frame::destroy()
diff -r a5a439242bbf -r f62d90e93408 source/common/frame.h
--- a/source/common/frame.h	Wed Jul 02 14:06:12 2014 +0530
+++ b/source/common/frame.h	Tue Jul 01 14:28:25 2014 +0530
@@ -37,20 +37,6 @@
 
 class Encoder;
 
-/* Current frame stats for 2 pass */
-struct FrameStats
-{
-    /* MV bits (MV+Ref+Block Type) */
-    int         mvBits;
-    /* Texture bits (DCT coefs) */
-    int         coeffBits;
-    int         miscBits;
-    /* CU type counts */
-    int         cuCount_i;
-    int         cuCount_p;
-    int         cuCount_skip;
-};
-
 class Frame
 {
 public:
@@ -98,7 +84,6 @@
     double            m_avgQpAq;    // avg QP as decided by AQ in addition to ratecontrol
     double            m_rateFactor; // calculated based on the Frame QP
     int32_t           m_forceqp;    // Force to use the qp specified in qp file
-    FrameStats        m_stats;   // stats of current frame for multipass encodes
 
     Frame();
     virtual ~Frame();
diff -r a5a439242bbf -r f62d90e93408 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Jul 02 14:06:12 2014 +0530
+++ b/source/encoder/frameencoder.cpp	Tue Jul 01 14:28:25 2014 +0530
@@ -48,6 +48,7 @@
     m_bAllRowsStop = false;
     m_vbvResetTriggerRow = -1;
     m_outStreams = NULL;
+    memset(&m_frameStats, 0, sizeof(m_frameStats));
     memset(&m_rce, 0, sizeof(RateControlEntry));
 }
 
@@ -143,6 +144,7 @@
         ok = false;
     }
 
+    memset(&m_frameStats, 0, sizeof(m_frameStats));
     memset(m_nr.offsetDenoise, 0, sizeof(m_nr.offsetDenoise[0][0]) * 8 * 1024);
     memset(m_nr.residualSumBuf, 0, sizeof(m_nr.residualSumBuf[0][0][0]) * 4 * 8 * 1024);
     memset(m_nr.countBuf, 0, sizeof(m_nr.countBuf[0][0]) * 4 * 8);
@@ -699,9 +701,9 @@
             getBufferSBac(lin)->loadContexts(getSbacCoder(subStrm));
 
         // Collect Frame Stats for 2 pass
-        m_frame->m_stats.mvBits += cu->m_mvBits;
-        m_frame->m_stats.coeffBits += cu->m_coeffBits;
-        m_frame->m_stats.miscBits += cu->m_totalBits - (cu->m_mvBits + cu->m_coeffBits);
+        m_frameStats.mvBits += cu->m_mvBits;
+        m_frameStats.coeffBits += cu->m_coeffBits;
+        m_frameStats.miscBits += cu->m_totalBits - (cu->m_mvBits + cu->m_coeffBits);
     }
 
     if (slice->getPPS()->getCabacInitPresentFlag())
diff -r a5a439242bbf -r f62d90e93408 source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h	Wed Jul 02 14:06:12 2014 +0530
+++ b/source/encoder/frameencoder.h	Tue Jul 01 14:28:25 2014 +0530
@@ -54,6 +54,20 @@
 class ThreadPool;
 class Encoder;
 
+/* Current frame stats for 2 pass */
+struct FrameStats
+{
+    /* MV bits (MV+Ref+Block Type) */
+    int         mvBits;
+    /* Texture bits (DCT coefs) */
+    int         coeffBits;
+    int         miscBits;
+    /* CU type counts */
+    int         cuCount_i;
+    int         cuCount_p;
+    int         cuCount_skip;
+};
+
 // Manages the wave-front processing of a single encoding frame
 class FrameEncoder : public WaveFront, public Thread
 {
@@ -172,6 +186,7 @@
     double                   m_elapsedCompressTime; // elapsed time spent in worker threads
     double                   m_frameTime;           // wall time from frame start to finish
     ThreadLocalData          m_tld;
+    FrameStats               m_frameStats;   // stats of current frame for multipass encodes
     volatile bool            m_bAllRowsStop;
     volatile int             m_vbvResetTriggerRow;
 


More information about the x265-devel mailing list