[x265] [PATCH 1 of 2] no-rdo: Add supporting functions in TComDataCU for moving residual encoding to depth 0
deepthidevaki at multicorewareinc.com
deepthidevaki at multicorewareinc.com
Fri Nov 22 12:13:51 CET 2013
# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1385118716 -19800
# Node ID 883d9279fde14aad2f2042c5aaaa2c98700a9b8b
# Parent 5009254d3d3ac92e90b1551444c5eb32ba2f8d31
no-rdo: Add supporting functions in TComDataCU for moving residual encoding to depth 0
copyToSubCU - copies only cu-fields required for residual encoding from LCU to a temp CU
copyCodedtoPic - copy the resulting fields after residual encoding to the pic
diff -r 5009254d3d3a -r 883d9279fde1 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp Fri Nov 22 00:17:46 2013 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp Fri Nov 22 16:41:56 2013 +0530
@@ -464,6 +464,40 @@
m_cuColocated[1] = cu->getCUColocated(REF_PIC_LIST_1);
}
+void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth)
+{
+ assert(partUnitIdx < 4);
+
+ uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
+
+ m_pic = cu->getPic();
+ m_slice = m_pic->getSlice();
+ m_cuAddr = cu->getAddr();
+ m_absIdxInLCU = cu->getZorderIdxInCU() + partOffset;
+
+ m_cuPelX = cu->getCUPelX() + (g_maxCUWidth >> depth) * (partUnitIdx & 1);
+ m_cuPelY = cu->getCUPelY() + (g_maxCUHeight >> depth) * (partUnitIdx >> 1);
+
+ m_totalCost = MAX_INT64;
+ m_totalDistortion = 0;
+ m_totalBits = 0;
+ m_numPartitions = cu->getTotalNumPart() >> 2;
+
+ TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
+ int sizeInUchar = sizeof(UChar) * m_numPartitions;
+ int sizeInChar = sizeof(char) * m_numPartitions;
+
+ memcpy(m_skipFlag, rpcCU->getSkipFlag() + m_absIdxInLCU, sizeof(*m_skipFlag) * m_numPartitions);
+ memcpy(m_qp, rpcCU->getQP() + m_absIdxInLCU, sizeInChar);
+
+ memcpy(m_partSizes, rpcCU->getPartitionSize() + m_absIdxInLCU, sizeof(*m_partSizes) * m_numPartitions);
+ memcpy(m_predModes, rpcCU->getPredictionMode() + m_absIdxInLCU, sizeof(*m_predModes) * m_numPartitions);
+
+ memcpy(m_depth, rpcCU->getDepth() + m_absIdxInLCU, sizeInUchar);
+ memcpy(m_width, rpcCU->getWidth() + m_absIdxInLCU, sizeInUchar);
+ memcpy(m_height, rpcCU->getHeight() + m_absIdxInLCU, sizeInUchar);
+}
+
// --------------------------------------------------------------------------------------------------------------------
// Copy
// --------------------------------------------------------------------------------------------------------------------
@@ -603,6 +637,32 @@
memcpy(rpcCU->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(Pel) * tmp);
}
+void TComDataCU::copyCodedToPic(UChar depth)
+{
+ TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
+
+ int sizeInUchar = sizeof(UChar) * m_numPartitions;
+
+ memcpy(rpcCU->getSkipFlag() + m_absIdxInLCU, m_skipFlag, sizeof(*m_skipFlag) * m_numPartitions);
+ memcpy(rpcCU->getTransformIdx() + m_absIdxInLCU, m_trIdx, sizeInUchar);
+ memcpy(rpcCU->getTransformSkip(TEXT_LUMA) + m_absIdxInLCU, m_transformSkip[0], sizeInUchar);
+ memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_U) + m_absIdxInLCU, m_transformSkip[1], sizeInUchar);
+ memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_V) + m_absIdxInLCU, m_transformSkip[2], sizeInUchar);
+
+ memcpy(rpcCU->getCbf(TEXT_LUMA) + m_absIdxInLCU, m_cbf[0], sizeInUchar);
+ memcpy(rpcCU->getCbf(TEXT_CHROMA_U) + m_absIdxInLCU, m_cbf[1], sizeInUchar);
+ memcpy(rpcCU->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], sizeInUchar);
+
+ uint32_t tmp = (g_maxCUWidth * g_maxCUHeight) >> (depth << 1);
+ uint32_t tmp2 = m_absIdxInLCU * m_pic->getMinCUWidth() * m_pic->getMinCUHeight();
+ memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeffY, sizeof(TCoeff) * tmp);
+
+ tmp = ((g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_hChromaShift)) >> (depth << 1);
+ tmp2 = m_absIdxInLCU * (m_pic->getMinCUWidth() >> m_hChromaShift) * (m_pic->getMinCUHeight() >> m_vChromaShift);
+ memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(TCoeff) * tmp);
+ memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(TCoeff) * tmp);
+}
+
void TComDataCU::copyToPic(UChar depth, uint32_t partIdx, uint32_t partDepth)
{
TComDataCU* cu = m_pic->getCU(m_cuAddr);
diff -r 5009254d3d3a -r 883d9279fde1 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Fri Nov 22 00:17:46 2013 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h Fri Nov 22 16:41:56 2013 +0530
@@ -196,9 +196,10 @@
void initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, int qp);
void copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, bool isRDObasedAnalysis = true);
-
+ void copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth);
void copyToPic(UChar depth);
void copyToPic(UChar depth, uint32_t partIdx, uint32_t partDepth);
+ void copyCodedToPic(UChar depth);
// -------------------------------------------------------------------------------------------------------------------
// member functions for CU description
More information about the x265-devel
mailing list