<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 26, 2013 at 12:09 AM, <span dir="ltr"><<a href="mailto:sumalatha@multicorewareinc.com" target="_blank">sumalatha@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 sumalatha<br>
# Date 1372161004 -19800<br>
# Node ID 6340ea9b1119e28fe467e895ccc1c02b035c9b8b<br>
# Parent e11febad302c5b4c1e183b8cf945b25a00e9b726<br>
Included merge mode for FMD = ON. Changed the xComputeCostMerge2Nx2N() to calculate the SATD cost and decide the mode based on that.<br></blockquote><div><br></div><div style>I pushed this patch earlier today</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff -r e11febad302c -r 6340ea9b1119 source/Lib/TLibEncoder/TEncCu.h<br>
--- a/source/Lib/TLibEncoder/TEncCu.h Tue Jun 25 16:47:14 2013 +0530<br>
+++ b/source/Lib/TLibEncoder/TEncCu.h Tue Jun 25 17:20:04 2013 +0530<br>
@@ -149,7 +149,7 @@<br>
Void xCheckBestMode(TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth);<br>
<br>
Void xCheckRDCostMerge2Nx2N(TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool *earlyDetectionSkipMode);<br>
- Void xComputeCostMerge2Nx2N(TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool *earlyDetectionSkipMode);<br>
+ Void xComputeCostMerge2Nx2N(TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU);<br>
Void xComputeCostIntrainInter(TComDataCU*& rpcTempCU, PartSize eSize,UInt index);<br>
Void xCheckRDCostInter(TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false);<br>
Void xComputeCostInter(TComDataCU*& rpcTempCU, PartSize ePartSize, UInt Index, Bool bUseMRG = false);<br>
diff -r e11febad302c -r 6340ea9b1119 source/encoder/compress.cpp<br>
--- a/source/encoder/compress.cpp Tue Jun 25 16:47:14 2013 +0530<br>
+++ b/source/encoder/compress.cpp Tue Jun 25 17:20:04 2013 +0530<br>
@@ -23,7 +23,7 @@<br>
<br>
#include "TLibEncoder/TEncCu.h"<br>
#include <math.h><br>
-<br>
+#include <common.h><br>
#if _MSC_VER<br>
#pragma warning (disable: 4244)<br>
#pragma warning (disable: 4018)<br>
@@ -87,7 +87,7 @@<br>
* \param rpcTempCU<br>
* \returns Void<br>
*/<br>
-Void TEncCu::xComputeCostMerge2Nx2N(TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool *earlyDetectionSkipMode)<br>
+Void TEncCu::xComputeCostMerge2Nx2N(TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU)<br>
{<br>
assert(rpcTempCU->getSlice()->getSliceType() != I_SLICE);<br>
TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists<br>
@@ -114,7 +114,6 @@<br>
mergeCandBuffer[ui] = 0;<br>
}<br>
<br>
- Bool bestIsSkip = false;<br>
<br>
UInt iteration;<br>
if (rpcTempCU->isLosslessCoded(0))<br>
@@ -126,14 +125,8 @@<br>
iteration = 2;<br>
}<br>
<br>
- for (UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual)<br>
- {<br>
for (UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand)<br>
{<br>
- if (!(uiNoResidual == 1 && mergeCandBuffer[uiMergeCand] == 1))<br>
- {<br>
- if (!(bestIsSkip && uiNoResidual == 0))<br>
- {<br>
// set MC parameters<br>
rpcTempCU->setPredModeSubParts(MODE_INTER, 0, uhDepth); // interprets depth relative to LCU level<br>
rpcTempCU->setCUTransquantBypassSubParts(m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth);<br>
@@ -146,28 +139,19 @@<br>
<br>
// do MC<br>
m_pcPredSearch->motionCompensation(rpcTempCU, m_ppcPredYuvMode[4][uhDepth]);<br>
-<br>
+<br>
/*Todo: Fix the satd cost estimates. Why is merge being chosen in high motion areas: estimated distortion is too low?*/<br>
<br>
- me_merge.setSourcePU(0,rpcTempCU->getWidth(0),rpcTempCU->getHeight(0));<br>
- rpcTempCU->getTotalDistortion() = me_merge.bufSATD((pixel*)m_ppcPredYuvTemp[uhDepth]->getLumaAddr(),<br>
- m_ppcPredYuvTemp[uhDepth]->getStride());<br>
- rpcTempCU->getTotalCost() = rpcTempCU->getTotalDistortion();<br>
- x265_emms();<br>
-<br>
-<br>
- if (uiNoResidual == 0)<br>
- {<br>
- if (rpcTempCU->getQtRootCbf(0) == 0)<br>
- {<br>
- mergeCandBuffer[uiMergeCand] = 1;<br>
- }<br>
- }<br>
-<br>
- rpcTempCU->setSkipFlagSubParts(rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth);<br>
+ m_pcPredSearch->encodeResAndCalcRdInterCU(rpcTempCU,<br>
+ m_ppcOrigYuv[uhDepth],<br>
+ m_ppcPredYuvMode[4][uhDepth],<br>
+ m_ppcResiYuvTemp[uhDepth],<br>
+ m_ppcResiYuvBest[uhDepth],<br>
+ m_ppcRecoYuvTemp[uhDepth],<br>
+ (true));<br>
+<br>
Int orgQP = rpcTempCU->getQP(0);<br>
<br>
- //xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);<br>
if (rpcTempCU->getTotalCost() < rpcBestCU->getTotalCost())<br>
{<br>
TComDataCU* tmp = rpcTempCU;<br>
@@ -181,45 +165,19 @@<br>
}<br>
<br>
rpcTempCU->initEstData(uhDepth, orgQP);<br>
+ }<br>
+<br>
+<br>
+<br>
+<br>
+ me_merge.setSourcePU(0,rpcBestCU->getWidth(0),rpcBestCU->getHeight(0));<br>
+ rpcBestCU->getTotalDistortion() = me_merge.bufSATD((pixel*) m_ppcPredYuvMode[3][uhDepth]->getLumaAddr(),<br>
+ m_ppcPredYuvMode[3][uhDepth]->getStride());<br>
+ rpcBestCU->getTotalCost() = rpcBestCU->getTotalDistortion();<br>
+ x265_emms();<br>
<br>
- if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip)<br>
- {<br>
- bestIsSkip = rpcTempCU->getQtRootCbf(0) == 0;<br>
- }<br>
- }<br>
- }<br>
- }<br>
+<br>
<br>
- if (uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection())<br>
- {<br>
- if (rpcTempCU->getQtRootCbf(0) == 0)<br>
- {<br>
- if (rpcTempCU->getMergeFlag(0))<br>
- {<br>
- *earlyDetectionSkipMode = true;<br>
- }<br>
- else<br>
- {<br>
- Int absoulte_MV = 0;<br>
- for (UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++)<br>
- {<br>
- if (rpcTempCU->getSlice()->getNumRefIdx(RefPicList(uiRefListIdx)) > 0)<br>
- {<br>
- TComCUMvField* pcCUMvField = rpcTempCU->getCUMvField(RefPicList(uiRefListIdx));<br>
- Int iHor = abs(pcCUMvField->getMvd(0).x);<br>
- Int iVer = abs(pcCUMvField->getMvd(0).y);<br>
- absoulte_MV += iHor + iVer;<br>
- }<br>
- }<br>
-<br>
- if (absoulte_MV == 0)<br>
- {<br>
- *earlyDetectionSkipMode = true;<br>
- }<br>
- }<br>
- }<br>
- }<br>
- }<br>
}<br>
<br>
Void TEncCu::xComputeCostInter(TComDataCU*& rpcTempCU, PartSize ePartSize, UInt Index, Bool bUseMRG)<br>
@@ -301,9 +259,9 @@<br>
}<br>
<br>
/*Compute Merge Cost */<br>
-#if 0<br>
- Bool earlyDetectionSkipMode = false;<br>
- xComputeCostMerge2Nx2N(m_MergeBestCU[uiDepth], m_MergeCU[uiDepth], &earlyDetectionSkipMode);<br>
+#if 1<br>
+<br>
+ xComputeCostMerge2Nx2N(m_MergeBestCU[uiDepth], m_MergeCU[uiDepth]);<br>
rpcBestCU = m_MergeBestCU[uiDepth];<br>
YuvTemp = m_ppcPredYuvMode[3][uiDepth];<br>
m_ppcPredYuvMode[3][uiDepth] = m_ppcPredYuvBest[uiDepth];<br>
@@ -328,12 +286,13 @@<br>
}<br>
<br>
/*Choose best mode; initialise rpcBestCU to 2Nx2N*/<br>
-<br>
+ if(m_InterCU_2Nx2N[uiDepth]->getTotalCost()<rpcBestCU->getTotalCost()) {<br>
rpcBestCU = m_InterCU_2Nx2N[uiDepth];<br>
<br>
YuvTemp = m_ppcPredYuvMode[0][uiDepth];<br>
m_ppcPredYuvMode[0][uiDepth] = m_ppcPredYuvBest[uiDepth];<br>
m_ppcPredYuvBest[uiDepth] = YuvTemp;<br>
+ }<br>
<br>
if (m_InterCU_Nx2N[uiDepth]->getTotalCost() < rpcBestCU->getTotalCost())<br>
{<br>
@@ -353,6 +312,7 @@<br>
}<br>
<br>
/* Perform encode residual for the best mode chosen only*/<br>
+<br>
m_pcPredSearch->encodeResAndCalcRdInterCU(rpcBestCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvBest[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcResiYuvBest[uiDepth], m_ppcRecoYuvBest[uiDepth], false);<br>
<br>
/* Disable recursive analysis for whole CUs temporarily*/<br>
<br>_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="http://mailman.videolan.org/listinfo/x265-devel" target="_blank">http://mailman.videolan.org/listinfo/x265-devel</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>