[x265-commits] [x265] nits
Steve Borho
steve at borho.org
Tue May 27 19:35:08 CEST 2014
details: http://hg.videolan.org/x265/rev/80e6a349a9fb
branches:
changeset: 6921:80e6a349a9fb
user: Steve Borho <steve at borho.org>
date: Sun May 25 11:40:40 2014 -0500
description:
nits
Subject: [x265] add -D__STDC_LIMIT_MACROS=1
details: http://hg.videolan.org/x265/rev/af78d190e57b
branches:
changeset: 6922:af78d190e57b
user: Satoshi Nakagawa <nakagawa424 at oki.com>
date: Sun May 25 12:38:03 2014 +0900
description:
add -D__STDC_LIMIT_MACROS=1
Subject: [x265] TComDataCU: renaming m_totalCost to m_totalRDCost
details: http://hg.videolan.org/x265/rev/812615048da0
branches:
changeset: 6923:812615048da0
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Tue May 27 15:11:08 2014 +0530
description:
TComDataCU: renaming m_totalCost to m_totalRDCost
Subject: [x265] TComDataCU: whitespace nits
details: http://hg.videolan.org/x265/rev/08766d706869
branches:
changeset: 6924:08766d706869
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Tue May 27 15:13:06 2014 +0530
description:
TComDataCU: whitespace nits
Subject: [x265] TComDataCU: introduce new variable m_totalPsyCost
details: http://hg.videolan.org/x265/rev/d84f5d1fbb10
branches:
changeset: 6925:d84f5d1fbb10
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Tue May 27 15:17:34 2014 +0530
description:
TComDataCU: introduce new variable m_totalPsyCost
Subject: [x265] TComDataCU: introduce new variable m_psyEnergy
details: http://hg.videolan.org/x265/rev/1bd3da64eab9
branches:
changeset: 6926:1bd3da64eab9
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Tue May 27 16:07:37 2014 +0530
description:
TComDataCU: introduce new variable m_psyEnergy
Subject: [x265] psyRD: psyRD costs are saved into m_totalPsyCost.
details: http://hg.videolan.org/x265/rev/acd166cf9836
branches:
changeset: 6927:acd166cf9836
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Tue May 27 16:38:36 2014 +0530
description:
psyRD: psyRD costs are saved into m_totalPsyCost.
diffstat:
source/CMakeLists.txt | 1 +
source/Lib/TLibCommon/TComDataCU.cpp | 38 +++++++++++++----
source/Lib/TLibCommon/TComDataCU.h | 4 +-
source/Lib/TLibCommon/TComPrediction.cpp | 2 +-
source/Lib/TLibEncoder/TEncCu.cpp | 69 ++++++++++++++++++++++++-------
source/Lib/TLibEncoder/TEncSearch.cpp | 43 +++++++++----------
source/encoder/compress.cpp | 48 +++++++++++-----------
7 files changed, 131 insertions(+), 74 deletions(-)
diffs (truncated from 611 to 300 lines):
diff -r 5e8cce428457 -r acd166cf9836 source/CMakeLists.txt
--- a/source/CMakeLists.txt Fri May 23 09:11:15 2014 -0500
+++ b/source/CMakeLists.txt Tue May 27 16:38:36 2014 +0530
@@ -126,6 +126,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
endif()
if(GCC)
+ add_definitions(-D__STDC_LIMIT_MACROS=1)
if(X64 AND NOT WIN32)
add_definitions(-fPIC)
endif(X64 AND NOT WIN32)
diff -r 5e8cce428457 -r acd166cf9836 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp Fri May 23 09:11:15 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp Tue May 27 16:38:36 2014 +0530
@@ -214,7 +214,9 @@ void TComDataCU::initCU(TComPic* pic, ui
m_cuPelX = (cuAddr % pic->getFrameWidthInCU()) * g_maxCUSize;
m_cuPelY = (cuAddr / pic->getFrameWidthInCU()) * g_maxCUSize;
m_absIdxInLCU = 0;
- m_totalCost = MAX_INT64;
+ m_psyEnergy = 0;
+ m_totalPsyCost = MAX_INT64;
+ m_totalRDCost = MAX_INT64;
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
@@ -305,7 +307,9 @@ void TComDataCU::initCU(TComPic* pic, ui
*/
void TComDataCU::initEstData(uint32_t depth, int qp)
{
- m_totalCost = MAX_INT64;
+ m_psyEnergy = 0;
+ m_totalPsyCost = MAX_INT64;
+ m_totalRDCost = MAX_INT64;
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
@@ -341,7 +345,9 @@ void TComDataCU::initEstData(uint32_t de
void TComDataCU::initEstData(uint32_t depth)
{
- m_totalCost = MAX_INT64;
+ m_psyEnergy = 0;
+ m_totalPsyCost = MAX_INT64;
+ m_totalRDCost = MAX_INT64;
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
@@ -389,7 +395,9 @@ void TComDataCU::initSubCU(TComDataCU* c
m_cuPelX = cu->getCUPelX() + (g_maxCUSize >> depth) * (partUnitIdx & 1);
m_cuPelY = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
- m_totalCost = MAX_INT64;
+ m_psyEnergy = 0;
+ m_totalPsyCost = MAX_INT64;
+ m_totalRDCost = MAX_INT64;
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
@@ -453,7 +461,9 @@ void TComDataCU::initSubCU(TComDataCU* c
m_cuPelX = cu->getCUPelX() + (g_maxCUSize >> depth) * (partUnitIdx & 1);
m_cuPelY = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
- m_totalCost = MAX_INT64;
+ m_psyEnergy = 0;
+ m_totalPsyCost = MAX_INT64;
+ m_totalRDCost = MAX_INT64;
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
@@ -516,7 +526,9 @@ void TComDataCU::copyToSubCU(TComDataCU*
m_cuPelX = cu->getCUPelX() + (g_maxCUSize >> depth) * (partUnitIdx & 1);
m_cuPelY = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
- m_totalCost = MAX_INT64;
+ m_psyEnergy = 0;
+ m_totalPsyCost = MAX_INT64;
+ m_totalRDCost = MAX_INT64;
m_sa8dCost = MAX_INT64;
m_totalDistortion = 0;
m_totalBits = 0;
@@ -546,8 +558,12 @@ void TComDataCU::copyPartFrom(TComDataCU
{
X265_CHECK(partUnitIdx < 4, "part unit should be less than 4\n");
if (isRDObasedAnalysis)
- m_totalCost += cu->m_totalCost;
+ {
+ m_totalPsyCost += cu->m_totalPsyCost;
+ m_totalRDCost += cu->m_totalRDCost;
+ }
+ m_psyEnergy += cu->m_psyEnergy;
m_totalDistortion += cu->m_totalDistortion;
m_totalBits += cu->m_totalBits;
@@ -607,7 +623,9 @@ void TComDataCU::copyToPic(uint8_t depth
{
TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
- rpcCU->m_totalCost = m_totalCost;
+ rpcCU->m_psyEnergy = m_psyEnergy;
+ rpcCU->m_totalPsyCost = m_totalPsyCost;
+ rpcCU->m_totalRDCost = m_totalRDCost;
rpcCU->m_totalDistortion = m_totalDistortion;
rpcCU->m_totalBits = m_totalBits;
@@ -692,7 +710,9 @@ void TComDataCU::copyToPic(uint8_t depth
uint32_t partStart = partIdx * qNumPart;
uint32_t partOffset = m_absIdxInLCU + partStart;
- cu->m_totalCost = m_totalCost;
+ cu->m_psyEnergy = m_psyEnergy;
+ cu->m_totalPsyCost = m_totalPsyCost;
+ cu->m_totalRDCost = m_totalRDCost;
cu->m_totalDistortion = m_totalDistortion;
cu->m_totalBits = m_totalBits;
diff -r 5e8cce428457 -r acd166cf9836 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Fri May 23 09:11:15 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.h Tue May 27 16:38:36 2014 +0530
@@ -165,7 +165,9 @@ public:
TComDataCU();
virtual ~TComDataCU();
- uint64_t m_totalCost; ///< sum of partition RD costs
+ uint32_t m_psyEnergy;
+ uint64_t m_totalPsyCost;
+ uint64_t m_totalRDCost; ///< sum of partition RD costs
uint32_t m_totalDistortion; ///< sum of partition distortion
uint32_t m_totalBits; ///< sum of partition signal bits
uint64_t m_avgCost[4]; // stores the avg cost of CU's in frame for each depth
diff -r 5e8cce428457 -r acd166cf9836 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp Fri May 23 09:11:15 2014 -0500
+++ b/source/Lib/TLibCommon/TComPrediction.cpp Tue May 27 16:38:36 2014 +0530
@@ -400,7 +400,7 @@ void TComPrediction::xPredInterBi(TComDa
void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, uint32_t partAddr, MV *mv, int width, int height, TComYuv *dstPic)
{
int dstStride = dstPic->getStride();
- pixel *dst = dstPic->getLumaAddr(partAddr);
+ pixel *dst = dstPic->getLumaAddr(partAddr);
int srcStride = refPic->getStride();
int srcOffset = (mv->x >> 2) + (mv->y >> 2) * srcStride;
diff -r 5e8cce428457 -r acd166cf9836 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Fri May 23 09:11:15 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Tue May 27 16:38:36 2014 +0530
@@ -602,7 +602,15 @@ void TEncCu::xCompressIntraCU(TComDataCU
m_entropyCoder->resetBits();
m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
- outBestCU->m_totalCost = 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 @@ void TEncCu::xCompressIntraCU(TComDataCU
m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
}
- outTempCU->m_totalCost = 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())
{
@@ -689,7 +706,7 @@ void TEncCu::xCompressIntraCU(TComDataCU
X265_CHECK(outBestCU->getPartitionSize(0) != SIZE_NONE, "no best partition size\n");
X265_CHECK(outBestCU->getPredictionMode(0) != MODE_NONE, "no best partition mode\n");
- X265_CHECK(outBestCU->m_totalCost != MAX_INT64, "no best partition cost\n");
+ X265_CHECK(outBestCU->m_totalRDCost != MAX_INT64, "no best partition cost\n");
}
void TEncCu::xCompressCU(TComDataCU*& outBestCU, TComDataCU*& outTempCU, uint32_t depth, bool bInsidePicture, PartSize parentSize)
@@ -915,7 +932,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
{
uint32_t rawbits = (2 * X265_DEPTH + X265_DEPTH) * cuSize * cuSize / 2;
uint32_t bestbits = outBestCU->m_totalBits;
- if ((bestbits > rawbits) || (outBestCU->m_totalCost > m_rdCost->calcRdCost(0, rawbits)))
+ if ((bestbits > rawbits) || (outBestCU->m_totalRDCost > m_rdCost->calcRdCost(0, rawbits)))
{
xCheckIntraPCM(outBestCU, outTempCU);
}
@@ -925,7 +942,15 @@ void TEncCu::xCompressCU(TComDataCU*& ou
m_entropyCoder->resetBits();
m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
- outBestCU->m_totalCost = 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 @@ void TEncCu::xCompressCU(TComDataCU*& ou
m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
}
- outTempCU->m_totalCost = 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())
{
@@ -1024,7 +1058,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
X265_CHECK(outBestCU->getPartitionSize(0) != SIZE_NONE, "no best partition size\n");
X265_CHECK(outBestCU->getPredictionMode(0) != MODE_NONE, "no best partition mode\n");
- X265_CHECK(outBestCU->m_totalCost != MAX_INT64, "no best partition cost\n");
+ X265_CHECK(outBestCU->m_totalRDCost != MAX_INT64, "no best partition cost\n");
}
/** finish encoding a cu and handle end-of-slice conditions
@@ -1283,7 +1317,7 @@ void TEncCu::xCheckRDCostMerge2Nx2N(TCom
outTempCU->setSkipFlagSubParts(!outTempCU->getQtRootCbf(0), 0, depth);
int origQP = outTempCU->getQP(0);
xCheckDQP(outTempCU);
- if (outTempCU->m_totalCost < outBestCU->m_totalCost)
+ if (outTempCU->m_totalRDCost < outBestCU->m_totalRDCost)
{
TComDataCU* tmp = outTempCU;
outTempCU = outBestCU;
@@ -1392,13 +1426,13 @@ void TEncCu::xCheckRDCostIntra(TComDataC
if (m_rdCost->psyRdEnabled())
{
int part = g_convertToBit[outTempCU->getCUSize(0)];
- uint32_t psyRdCost = m_rdCost->psyCost(part, m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),
+ 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_totalCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, psyRdCost);
+ outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, outTempCU->m_psyEnergy);
}
else
{
- outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+ outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
}
xCheckDQP(outTempCU);
xCheckBestMode(outBestCU, outTempCU, depth);
@@ -1439,13 +1473,13 @@ void TEncCu::xCheckRDCostIntraInInter(TC
if (m_rdCost->psyRdEnabled())
{
int part = g_convertToBit[outTempCU->getCUSize(0)];
- uint32_t psyRdCost = m_rdCost->psyCost(part, m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),
+ 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_totalCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, psyRdCost);
+ outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits, outTempCU->m_psyEnergy);
}
else
{
- outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+ outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
}
xCheckDQP(outTempCU);
xCheckBestMode(outBestCU, outTempCU, depth);
@@ -1489,7 +1523,7 @@ void TEncCu::xCheckIntraPCM(TComDataCU*&
m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
- outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+ outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
xCheckDQP(outTempCU);
xCheckBestMode(outBestCU, outTempCU, depth);
@@ -1502,7 +1536,10 @@ void TEncCu::xCheckIntraPCM(TComDataCU*&
*/
void TEncCu::xCheckBestMode(TComDataCU*& outBestCU, TComDataCU*& outTempCU, uint32_t depth)
{
- if (outTempCU->m_totalCost < outBestCU->m_totalCost)
+ uint64_t tempCost = m_rdCost->psyRdEnabled() ? outTempCU->m_totalPsyCost : outTempCU->m_totalRDCost;
More information about the x265-commits
mailing list