<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 11, 2013 at 4:16 AM, <span dir="ltr"><<a href="mailto:deepthidevaki@multicorewareinc.com" target="_blank">deepthidevaki@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Deepthi Devaki <<a href="mailto:deepthidevaki@multicorewareinc.com">deepthidevaki@multicorewareinc.com</a>><br>
# Date 1384164960 -19800<br>
# Node ID c4fea7f56081b96877cc01aae0cb3bcd47169bb6<br>
# Parent 8ca334701a92f895f0750c80f638189ce0d3cf97<br>
no-rdo: cleanups. Remove unnecessary memsets, rearrange computations.<br></blockquote><div><br></div><div>Queued.</div><div><br></div><div>My only problem with this patch is it's limited scope. Ideally this type of cleanup would be done for all of the analysis functions in compress.cpp and TEncSearch.cpp, etc.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r 8ca334701a92 -r c4fea7f56081 source/Lib/TLibEncoder/TEncSearch.cpp<br>
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Mon Nov 11 14:34:27 2013 +0530<br>
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Mon Nov 11 15:46:00 2013 +0530<br>
@@ -1610,7 +1610,7 @@<br>
// Filtered and Unfiltered refAbove and refLeft pointing to above and left.<br>
above = aboveScale;<br>
left = leftScale;<br>
- aboveFiltered = aboveScale;<br>
+ aboveFiltered = aboveScale;<br>
leftFiltered = leftScale;<br>
}<br>
<br>
@@ -2940,34 +2940,29 @@<br>
if (zerocost < cost)<br>
{<br>
const uint32_t qpartnum = cu->getPic()->getNumPartInCU() >> (cu->getDepth(0) << 1);<br>
- ::memset(cu->getTransformIdx(), 0, qpartnum * sizeof(UChar));<br>
::memset(cu->getCbf(TEXT_LUMA), 0, qpartnum * sizeof(UChar));<br>
::memset(cu->getCbf(TEXT_CHROMA_U), 0, qpartnum * sizeof(UChar));<br>
::memset(cu->getCbf(TEXT_CHROMA_V), 0, qpartnum * sizeof(UChar));<br>
- ::memset(cu->getCoeffY(), 0, width * height * sizeof(TCoeff));<br>
- ::memset(cu->getCoeffCb(), 0, width * height * sizeof(TCoeff) >> 2);<br>
- ::memset(cu->getCoeffCr(), 0, width * height * sizeof(TCoeff) >> 2);<br>
- cu->setTransformSkipSubParts(0, 0, 0, 0, cu->getDepth(0));<br>
if (cu->getMergeFlag(0) && cu->getPartitionSize(0) == SIZE_2Nx2N)<br>
{<br>
- cu->setSkipFlagSubParts(true, 0, cu->getDepth(0));<br>
+ cu->getSkipFlag()[0] = true;<br>
}<br>
bits = zerobits;<br>
- outBestResiYuv->clear();<br>
generateRecon(cu, predYuv, outBestResiYuv, outReconYuv, true);<br>
+ distortion = zerodistortion;<br>
}<br>
else<br>
{<br>
xSetResidualQTData(cu, 0, 0, outBestResiYuv, cu->getDepth(0), true);<br>
generateRecon(cu, predYuv, outBestResiYuv, outReconYuv, false);<br>
+<br>
+ int part = partitionFromSizes(width, height);<br>
+ distortion = primitives.sse_pp[part](fencYuv->getLumaAddr(), fencYuv->getStride(), outReconYuv->getLumaAddr(), outReconYuv->getStride());<br>
+ part = partitionFromSizes(width >> 1, height >> 1);<br>
+ distortion += m_rdCost->scaleChromaDistCb(primitives.sse_pp[part](fencYuv->getCbAddr(), fencYuv->getCStride(), outReconYuv->getCbAddr(), outReconYuv->getCStride()));<br>
+ distortion += m_rdCost->scaleChromaDistCr(primitives.sse_pp[part](fencYuv->getCrAddr(), fencYuv->getCStride(), outReconYuv->getCrAddr(), outReconYuv->getCStride()));<br>
}<br>
<br>
- int part = partitionFromSizes(width, height);<br>
- distortion = primitives.sse_pp[part](fencYuv->getLumaAddr(), fencYuv->getStride(), outReconYuv->getLumaAddr(), outReconYuv->getStride());<br>
- part = partitionFromSizes(width >> 1, height >> 1);<br>
- distortion += m_rdCost->scaleChromaDistCb(primitives.sse_pp[part](fencYuv->getCbAddr(), fencYuv->getCStride(), outReconYuv->getCbAddr(), outReconYuv->getCStride()));<br>
- distortion += m_rdCost->scaleChromaDistCr(primitives.sse_pp[part](fencYuv->getCrAddr(), fencYuv->getCStride(), outReconYuv->getCrAddr(), outReconYuv->getCStride()));<br>
-<br>
cu->m_totalBits = bits;<br>
cu->m_totalDistortion = distortion;<br>
cu->m_totalCost = m_rdCost->calcRdCost(distortion, bits);<br>
@@ -2975,25 +2970,13 @@<br>
<br>
uint32_t TEncSearch::estimateZerobits(TComDataCU* cu)<br>
{<br>
- if (cu->isIntra(0))<br>
- {<br>
- return 0;<br>
- }<br>
-<br>
uint32_t zeroResiBits = 0;<br>
<br>
- uint32_t width = cu->getWidth(0);<br>
- uint32_t height = cu->getHeight(0);<br>
-<br>
const uint32_t qpartnum = cu->getPic()->getNumPartInCU() >> (cu->getDepth(0) << 1);<br>
- ::memset(cu->getTransformIdx(), 0, qpartnum * sizeof(UChar));<br>
+<br>
::memset(cu->getCbf(TEXT_LUMA), 0, qpartnum * sizeof(UChar));<br>
::memset(cu->getCbf(TEXT_CHROMA_U), 0, qpartnum * sizeof(UChar));<br>
::memset(cu->getCbf(TEXT_CHROMA_V), 0, qpartnum * sizeof(UChar));<br>
- ::memset(cu->getCoeffY(), 0, width * height * sizeof(TCoeff));<br>
- ::memset(cu->getCoeffCb(), 0, width * height * sizeof(TCoeff) >> 2);<br>
- ::memset(cu->getCoeffCr(), 0, width * height * sizeof(TCoeff) >> 2);<br>
- cu->setTransformSkipSubParts(0, 0, 0, 0, cu->getDepth(0));<br>
<br>
m_rdGoOnSbacCoder->load(m_rdSbacCoders[cu->getDepth(0)][CI_CURR_BEST]);<br>
zeroResiBits = xSymbolBitsInter(cu);<br>
@@ -3035,11 +3018,6 @@<br>
<br>
void TEncSearch::estimateBitsDist(TComDataCU* cu, TShortYUV* resiYuv, uint32_t& bits, uint32_t& distortion, bool curUseRDOQ)<br>
{<br>
- if (cu->isIntra(0))<br>
- {<br>
- return;<br>
- }<br>
-<br>
bits = 0;<br>
distortion = 0;<br>
uint64_t cost = 0;<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>