[x265] [PATCH 5 of 5] psyRD: psyRD costs are saved into m_totalPsyCost
deepthi at multicorewareinc.com
deepthi at multicorewareinc.com
Tue May 27 18:38:19 CEST 2014
# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1401188916 -19800
# Tue May 27 16:38:36 2014 +0530
# Node ID 4f1f578090e4c05a054b3e73468773f8a4d810b3
# Parent 2ab3e192144abb9b236cb75551ec755676959e97
psyRD: psyRD costs are saved into m_totalPsyCost.
diff -r 2ab3e192144a -r 4f1f578090e4 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Tue May 27 16:07:37 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Tue May 27 16:38:36 2014 +0530
@@ -602,7 +602,15 @@
m_entropyCoder->resetBits();
m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
- outBestCU->m_totalRDCost = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
+ if (m_rdCost->psyRdEnabled())
+ {
+ outBestCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits,
+ outBestCU->m_psyEnergy);
+ }
+ else
+ {
+ outBestCU->m_totalRDCost = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
+ }
}
outTempCU->initEstData(depth);
@@ -649,7 +657,16 @@
m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
}
- outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+
+ if (m_rdCost->psyRdEnabled())
+ {
+ outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits,
+ outTempCU->m_psyEnergy);
+ }
+ else
+ {
+ outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+ }
if ((g_maxCUSize >> depth) == slice->getPPS()->getMinCuDQPSize() && slice->getPPS()->getUseDQP())
{
@@ -925,7 +942,15 @@
m_entropyCoder->resetBits();
m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
- outBestCU->m_totalRDCost = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
+ if (m_rdCost->psyRdEnabled())
+ {
+ outBestCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits,
+ outBestCU->m_psyEnergy);
+ }
+ else
+ {
+ outBestCU->m_totalRDCost = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
+ }
// Early CU determination
if (outBestCU->isSkipped(0))
@@ -984,7 +1009,16 @@
m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
}
- outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+
+ if (m_rdCost->psyRdEnabled())
+ {
+ outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits,
+ outTempCU->m_psyEnergy);
+ }
+ else
+ {
+ outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+ }
if ((g_maxCUSize >> depth) == slice->getPPS()->getMinCuDQPSize() && slice->getPPS()->getUseDQP())
{
@@ -1394,7 +1428,7 @@
int part = g_convertToBit[outTempCU->getCUSize(0)];
outTempCU->m_psyEnergy = m_rdCost->psyCost(part, m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),
m_tmpRecoYuv[depth]->getLumaAddr(), m_tmpRecoYuv[depth]->getStride());
- outTempCU->m_totalRDCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, outTempCU->m_psyEnergy);
+ outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, outTempCU->m_psyEnergy);
}
else
{
@@ -1441,7 +1475,7 @@
int part = g_convertToBit[outTempCU->getCUSize(0)];
outTempCU->m_psyEnergy = m_rdCost->psyCost(part, m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),
m_tmpRecoYuv[depth]->getLumaAddr(), m_tmpRecoYuv[depth]->getStride());
- outTempCU->m_totalRDCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, outTempCU->m_psyEnergy);
+ outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, outTempCU->m_psyEnergy);
}
else
{
@@ -1502,7 +1536,10 @@
*/
void TEncCu::xCheckBestMode(TComDataCU*& outBestCU, TComDataCU*& outTempCU, uint32_t depth)
{
- if (outTempCU->m_totalRDCost < outBestCU->m_totalRDCost)
+ uint64_t tempCost = m_rdCost->psyRdEnabled() ? outTempCU->m_totalPsyCost : outTempCU->m_totalRDCost;
+ uint64_t bestCost = m_rdCost->psyRdEnabled() ? outBestCU->m_totalPsyCost : outBestCU->m_totalRDCost;
+
+ if (tempCost < bestCost)
{
TComYuv* yuv;
// Change Information data
diff -r 2ab3e192144a -r 4f1f578090e4 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Tue May 27 16:07:37 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Tue May 27 16:38:36 2014 +0530
@@ -2697,7 +2697,7 @@
int size = g_convertToBit[cuSize];
cu->m_psyEnergy = m_rdCost->psyCost(size, fencYuv->getLumaAddr(), fencYuv->getStride(),
outReconYuv->getLumaAddr(), outReconYuv->getStride());
- cu->m_totalRDCost = m_rdCost->calcPsyRdCost(cu->m_totalDistortion, cu->m_totalBits, cu->m_psyEnergy);
+ cu->m_totalPsyCost = m_rdCost->calcPsyRdCost(cu->m_totalDistortion, cu->m_totalBits, cu->m_psyEnergy);
}
else
{
@@ -2788,16 +2788,15 @@
int size = g_convertToBit[cuSize];
cu->m_psyEnergy = m_rdCost->psyCost(size, fencYuv->getLumaAddr(), fencYuv->getStride(),
outReconYuv->getLumaAddr(), outReconYuv->getStride());
- bcost = m_rdCost->calcPsyRdCost(bdist, bestBits, cu->m_psyEnergy);
+ cu->m_totalPsyCost = m_rdCost->calcPsyRdCost(bdist, bestBits, cu->m_psyEnergy);
}
else
{
- bcost = m_rdCost->calcRdCost(bdist, bestBits);
+ cu->m_totalRDCost = m_rdCost->calcRdCost(bdist, bestBits);
}
cu->m_totalBits = bestBits;
cu->m_totalDistortion = bdist;
- cu->m_totalRDCost = bcost;
-
+
if (cu->isSkipped(0))
{
cu->clearCbf(0, cu->getDepth(0));
More information about the x265-devel
mailing list