[x265] [PATCH 1 of 3] rc: initalize states to hold frame statistics used in two pass
aarthi at multicorewareinc.com
aarthi at multicorewareinc.com
Wed Jun 25 19:24:16 CEST 2014
# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1403716605 -19800
# Wed Jun 25 22:46:45 2014 +0530
# Node ID e71e34d02d7777e228eab43edf1910a71a44417d
# Parent 09450ac6dc7d0f495582bf327488612755df1719
rc: initalize states to hold frame statistics used in two pass
frame stats includes mv bits,DC coeff bits and number of Intra, Inter and Skip Cus per frame.
diff -r 09450ac6dc7d -r e71e34d02d77 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp Tue Jun 24 15:41:55 2014 +0900
+++ b/source/Lib/TLibCommon/TComDataCU.cpp Wed Jun 25 22:46:45 2014 +0530
@@ -252,6 +252,8 @@
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
+ m_mvBits = 0;
+ m_coeffBits = 0;
m_numPartitions = pic->getNumPartInCU();
char* qp = pic->getCU(getAddr())->getQP();
m_baseQp = pic->getCU(getAddr())->m_baseQp;
@@ -345,6 +347,8 @@
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
+ m_mvBits = 0;
+ m_coeffBits = 0;
uint8_t cuSize = g_maxCUSize >> depth;
@@ -383,6 +387,8 @@
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
+ m_mvBits = 0;
+ m_coeffBits = 0;
uint8_t cuSize = g_maxCUSize >> depth;
@@ -433,6 +439,9 @@
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
+ m_mvBits = 0;
+ m_coeffBits = 0;
+
m_numPartitions = cu->getTotalNumPart() >> 2;
for (int i = 0; i < 4; i++)
@@ -499,6 +508,8 @@
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
+ m_mvBits = 0;
+ m_coeffBits = 0;
m_numPartitions = cu->getTotalNumPart() >> 2;
for (int i = 0; i < 4; i++)
@@ -564,6 +575,8 @@
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
+ m_mvBits = 0;
+ m_coeffBits = 0;
m_numPartitions = cu->getTotalNumPart() >> 2;
TComDataCU* otherCU = m_pic->getCU(m_cuAddr);
@@ -598,6 +611,8 @@
m_psyEnergy += cu->m_psyEnergy;
m_totalDistortion += cu->m_totalDistortion;
m_totalBits += cu->m_totalBits;
+ m_mvBits += cu->m_mvBits;
+ m_coeffBits += cu->m_coeffBits;
uint32_t offset = cu->getTotalNumPart() * partUnitIdx;
uint32_t numPartition = cu->getTotalNumPart();
@@ -660,6 +675,8 @@
cu->m_totalRDCost = m_totalRDCost;
cu->m_totalDistortion = m_totalDistortion;
cu->m_totalBits = m_totalBits;
+ cu->m_mvBits = m_mvBits;
+ cu->m_coeffBits = m_coeffBits;
int sizeInBool = sizeof(bool) * m_numPartitions;
int sizeInChar = sizeof(char) * m_numPartitions;
@@ -747,6 +764,8 @@
cu->m_totalRDCost = m_totalRDCost;
cu->m_totalDistortion = m_totalDistortion;
cu->m_totalBits = m_totalBits;
+ cu->m_mvBits = m_mvBits;
+ cu->m_coeffBits = m_coeffBits;
int sizeInBool = sizeof(bool) * qNumPart;
int sizeInChar = sizeof(char) * qNumPart;
diff -r 09450ac6dc7d -r e71e34d02d77 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Tue Jun 24 15:41:55 2014 +0900
+++ b/source/Lib/TLibCommon/TComDataCU.h Wed Jun 25 22:46:45 2014 +0530
@@ -202,6 +202,8 @@
uint32_t m_count[4];
uint64_t m_sa8dCost;
double m_baseQp; //Qp of Cu set from RateControl/Vbv.
+ uint32_t m_mvBits; // Mv bits + Ref + block type
+ uint32_t m_coeffBits; // Texture bits (DCT Coeffs)
// -------------------------------------------------------------------------------------------------------------------
// create / destroy / initialize / copy
diff -r 09450ac6dc7d -r e71e34d02d77 source/common/frame.cpp
--- a/source/common/frame.cpp Tue Jun 24 15:41:55 2014 +0900
+++ b/source/common/frame.cpp Wed Jun 25 22:46:45 2014 +0530
@@ -45,6 +45,7 @@
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;
@@ -134,6 +135,7 @@
}
if (param->rc.aqMode)
memset(m_qpaAq, 0, numRows * sizeof(double));
+ memset(&m_stats, 0, sizeof(m_stats));
}
void Frame::destroy()
diff -r 09450ac6dc7d -r e71e34d02d77 source/common/frame.h
--- a/source/common/frame.h Tue Jun 24 15:41:55 2014 +0900
+++ b/source/common/frame.h Wed Jun 25 22:46:45 2014 +0530
@@ -37,6 +37,20 @@
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:
@@ -84,6 +98,7 @@
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();
More information about the x265-devel
mailing list