[x265] [PATCH] search: remove redundant loacal variables in encodeResAndCalcRdSkipCU
gopu at multicorewareinc.com
gopu at multicorewareinc.com
Thu Sep 18 12:07:59 CEST 2014
# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1411032660 -19800
# Thu Sep 18 15:01:00 2014 +0530
# Node ID 9af870aa267cf5d6ae1ed2d4b413a680d289721b
# Parent c2d80cbd47dc7219aee70a403b8337330bc1b798
search: remove redundant loacal variables in encodeResAndCalcRdSkipCU
diff -r c2d80cbd47dc -r 9af870aa267c source/encoder/search.cpp
--- a/source/encoder/search.cpp Thu Sep 18 12:57:29 2014 +0530
+++ b/source/encoder/search.cpp Thu Sep 18 15:01:00 2014 +0530
@@ -2073,8 +2073,7 @@
{
X265_CHECK(!cu->isIntra(0), "intra CU not expected\n");
- uint32_t log2CUSize = cu->getLog2CUSize(0);
- uint32_t cuSize = 1 << log2CUSize;
+ uint32_t cuSize = 1 << cu->getLog2CUSize(0);
uint32_t depth = cu->getDepth(0);
int hChromaShift = CHROMA_H_SHIFT(m_csp);
@@ -2088,12 +2087,12 @@
outReconYuv->copyFromYuv(predYuv);
// Luma
- int part = partitionFromLog2Size(log2CUSize);
- uint32_t distortion = primitives.sse_pp[part](fencYuv->getLumaAddr(), fencYuv->getStride(), outReconYuv->getLumaAddr(), outReconYuv->getStride());
+ int part = partitionFromLog2Size(cu->getLog2CUSize(0));
+ cu->m_totalDistortion = primitives.sse_pp[part](fencYuv->getLumaAddr(), fencYuv->getStride(), outReconYuv->getLumaAddr(), outReconYuv->getStride());
// Chroma
part = partitionFromSizes(cuSize >> hChromaShift, cuSize >> vChromaShift);
- distortion += m_rdCost.scaleChromaDistCb(primitives.sse_pp[part](fencYuv->getCbAddr(), fencYuv->getCStride(), outReconYuv->getCbAddr(), outReconYuv->getCStride()));
- distortion += m_rdCost.scaleChromaDistCr(primitives.sse_pp[part](fencYuv->getCrAddr(), fencYuv->getCStride(), outReconYuv->getCrAddr(), outReconYuv->getCStride()));
+ cu->m_totalDistortion += m_rdCost.scaleChromaDistCb(primitives.sse_pp[part](fencYuv->getCbAddr(), fencYuv->getCStride(), outReconYuv->getCbAddr(), outReconYuv->getCStride()));
+ cu->m_totalDistortion += m_rdCost.scaleChromaDistCr(primitives.sse_pp[part](fencYuv->getCrAddr(), fencYuv->getCStride(), outReconYuv->getCrAddr(), outReconYuv->getCStride()));
m_entropyCoder->load(m_rdEntropyCoders[depth][CI_CURR_BEST]);
m_entropyCoder->resetBits();
@@ -2102,14 +2101,13 @@
m_entropyCoder->codeSkipFlag(cu, 0);
m_entropyCoder->codeMergeIndex(cu, 0);
- uint32_t bits = m_entropyCoder->getNumberOfWrittenBits();
- cu->m_mvBits = bits;
+ cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
cu->m_coeffBits = 0;
- cu->m_totalBits = bits;
- cu->m_totalDistortion = distortion;
+ cu->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
+
if (m_rdCost.m_psyRd)
{
- int size = log2CUSize - 2;
+ int size = cu->getLog2CUSize(0) - 2;
cu->m_psyEnergy = m_rdCost.psyCost(size, fencYuv->getLumaAddr(), fencYuv->getStride(),
outReconYuv->getLumaAddr(), outReconYuv->getStride());
cu->m_totalPsyCost = m_rdCost.calcPsyRdCost(cu->m_totalDistortion, cu->m_totalBits, cu->m_psyEnergy);
More information about the x265-devel
mailing list