[x265] [PATCH] psy-rd: fix bug in chroma psyEnergy for intra 4x4
deepthi at multicorewareinc.com
deepthi at multicorewareinc.com
Mon Sep 22 05:23:49 CEST 2014
# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1411356220 -19800
# Mon Sep 22 08:53:40 2014 +0530
# Node ID d1c2b82de4db401e6e85316e5db4dd738a5f36a5
# Parent 817abe294c8b3e60f88093841d208fbb96bf8403
psy-rd: fix bug in chroma psyEnergy for intra 4x4
Also add TODO, for all psyCost calculations
diff -r 817abe294c8b -r d1c2b82de4db source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Sun Sep 21 23:18:49 2014 +0530
+++ b/source/encoder/analysis.cpp Mon Sep 22 08:53:40 2014 +0530
@@ -724,6 +724,7 @@
outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
outTempCU->m_coeffBits = outTempCU->m_totalBits - outTempCU->m_mvBits;
+ /* TODO: add chroma psyEnergy also to psyCost*/
if (m_rdCost.m_psyRd)
{
int part = outTempCU->getLog2CUSize(0) - 2;
diff -r 817abe294c8b -r d1c2b82de4db source/encoder/search.cpp
--- a/source/encoder/search.cpp Sun Sep 21 23:18:49 2014 +0530
+++ b/source/encoder/search.cpp Mon Sep 22 08:53:40 2014 +0530
@@ -841,7 +841,8 @@
}
/* returns distortion */
-uint32_t Search::xRecurIntraChromaCodingQT(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv)
+uint32_t Search::xRecurIntraChromaCodingQT(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv,
+ uint32_t& psyEnergy)
{
uint32_t fullDepth = cu->getDepth(0) + trDepth;
uint32_t trMode = cu->getTransformIdx(absPartIdx);
@@ -1016,7 +1017,7 @@
if (splitIntoSubTUs)
offsetSubTUCBFs(cu, (TextType)chromaId, trDepth, absPartIdx);
}
- cu->m_psyEnergy = singlePsyEnergy;
+ psyEnergy = singlePsyEnergy;
}
else
{
@@ -1027,13 +1028,14 @@
uint32_t absPartIdxSub = absPartIdx;
for (uint32_t part = 0; part < 4; part++, absPartIdxSub += qPartsDiv)
{
- outDist += xRecurIntraChromaCodingQT(cu, trDepth + 1, absPartIdxSub, fencYuv, predYuv, resiYuv);
- splitPsyEnergy += cu->m_psyEnergy;
+ uint32_t psyEnergyTemp = 0;
+ outDist += xRecurIntraChromaCodingQT(cu, trDepth + 1, absPartIdxSub, fencYuv, predYuv, resiYuv, psyEnergyTemp);
+ splitPsyEnergy += psyEnergyTemp;
splitCbfU |= cu->getCbf(absPartIdxSub, TEXT_CHROMA_U, trDepth + 1);
splitCbfV |= cu->getCbf(absPartIdxSub, TEXT_CHROMA_V, trDepth + 1);
}
- cu->m_psyEnergy = splitPsyEnergy;
+ psyEnergy = splitPsyEnergy;
for (uint32_t offs = 0; offs < 4 * qPartsDiv; offs++)
{
cu->getCbf(TEXT_CHROMA_U)[absPartIdx + offs] |= (splitCbfU << trDepth);
@@ -1529,7 +1531,8 @@
// chroma coding
cu->setChromIntraDirSubParts(modeList[mode], absPartIdxC, depth + initTrDepth);
- uint32_t dist = xRecurIntraChromaCodingQT(cu, initTrDepth, absPartIdxC, fencYuv, predYuv, resiYuv);
+ uint32_t psyEnergy = 0;
+ uint32_t dist = xRecurIntraChromaCodingQT(cu, initTrDepth, absPartIdxC, fencYuv, predYuv, resiYuv, psyEnergy);
if (cu->m_slice->m_pps->bTransformSkipEnabled)
m_entropyCoder->load(m_rdEntropyCoders[depth][CI_CURR_BEST]);
@@ -1537,7 +1540,7 @@
uint32_t bits = xGetIntraBitsQTChroma(cu, initTrDepth, absPartIdxC, tuIterator.absPartIdxStep);
uint64_t cost = 0;
if (m_rdCost.m_psyRd)
- cost = m_rdCost.calcPsyRdCost(dist, bits, cu->m_psyEnergy);
+ cost = m_rdCost.calcPsyRdCost(dist, bits, psyEnergy);
else
cost = m_rdCost.calcRdCost(dist, bits);
diff -r 817abe294c8b -r d1c2b82de4db source/encoder/search.h
--- a/source/encoder/search.h Sun Sep 21 23:18:49 2014 +0530
+++ b/source/encoder/search.h Mon Sep 22 08:53:40 2014 +0530
@@ -118,7 +118,8 @@
uint32_t xRecurIntraCodingQT(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, TComYuv* fencYuv, TComYuv* predYuv,
ShortYuv* resiYuv, bool bAllowRQTSplit, uint64_t& dRDCost, uint32_t& puBits, uint32_t depthRange[2]);
- uint32_t xRecurIntraChromaCodingQT(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv);
+ uint32_t xRecurIntraChromaCodingQT(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv,
+ uint32_t& psyEnergy);
uint32_t xIntraCodingChromaBlk(TComDataCU* cu, uint32_t absPartIdx, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv,
int16_t* reconQt, uint32_t reconQtStride, coeff_t* coeff, uint32_t& cbf, uint32_t chromaId, uint32_t log2TrSizeC);
More information about the x265-devel
mailing list