[x265-commits] [x265] compress: save CABAC context in merge modes for lower RD ...
Deepthi Nandakumar
deepthi at multicorewareinc.com
Fri Jul 11 09:14:42 CEST 2014
details: http://hg.videolan.org/x265/rev/52cda492abf5
branches:
changeset: 7302:52cda492abf5
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Jul 11 07:42:46 2014 +0530
description:
compress: save CABAC context in merge modes for lower RD levels.
Subject: [x265] compress: save CABAC context after inter/merge decision
details: http://hg.videolan.org/x265/rev/b728ca41433f
branches:
changeset: 7303:b728ca41433f
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Jul 11 07:47:30 2014 +0530
description:
compress: save CABAC context after inter/merge decision
Subject: [x265] compress: save CABAC context after intra decision.
details: http://hg.videolan.org/x265/rev/65d4f5b4fd3a
branches:
changeset: 7304:65d4f5b4fd3a
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Jul 11 07:50:35 2014 +0530
description:
compress: save CABAC context after intra decision.
Since CABAC encode happens only for rd > 2
Subject: [x265] compress: save CABAC context for rd = 2 after inter/intra encodes
details: http://hg.videolan.org/x265/rev/1c8573c886b1
branches:
changeset: 7305:1c8573c886b1
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Jul 11 07:52:56 2014 +0530
description:
compress: save CABAC context for rd = 2 after inter/intra encodes
Subject: [x265] derive TEncCu from TEncSearch
details: http://hg.videolan.org/x265/rev/25e9c85aea1f
branches:
changeset: 7306:25e9c85aea1f
user: Steve Borho <steve at borho.org>
date: Thu Jul 10 22:32:24 2014 -0500
description:
derive TEncCu from TEncSearch
TEncSearch methods are only callable from TEncCu methods. and there is much
duplication in their data members. This removes a lot of redundancy and removes
a lot of pointer dereferences
Subject: [x265] search: make RDCost and TComTrQuant member instances of TEncSearch
details: http://hg.videolan.org/x265/rev/77aeba71695e
branches:
changeset: 7307:77aeba71695e
user: Steve Borho <steve at borho.org>
date: Thu Jul 10 23:15:24 2014 -0500
description:
search: make RDCost and TComTrQuant member instances of TEncSearch
Both of these structs are required by TEncSearch, it cannot operate without them
There is always a 1::1 correlation with each. There is no reason at all to
allocated them separately in TLD and then link them all together. Much simpler
for them to be members of the TEncSearch class.
Subject: [x265] zero stride for zeroPel[]
details: http://hg.videolan.org/x265/rev/a96d3ed11aaf
branches:
changeset: 7308:a96d3ed11aaf
user: Satoshi Nakagawa <nakagawa424 at oki.com>
date: Fri Jul 11 13:29:49 2014 +0900
description:
zero stride for zeroPel[]
Subject: [x265] cli: retrieve params from the encoder, in case logging flags have changed
details: http://hg.videolan.org/x265/rev/c9a7be09cdc0
branches:
changeset: 7309:c9a7be09cdc0
user: Steve Borho <steve at borho.org>
date: Fri Jul 11 00:33:22 2014 -0500
description:
cli: retrieve params from the encoder, in case logging flags have changed
For instance, if the user asked for --lossless --ssim, the encoder will disable
SSIM for lossless encodes and we don't want the CLI to report SSIM stats that
were never measured.
Subject: [x265] cu: nits
details: http://hg.videolan.org/x265/rev/2d0fd0241025
branches:
changeset: 7310:2d0fd0241025
user: Steve Borho <steve at borho.org>
date: Fri Jul 11 02:07:13 2014 -0500
description:
cu: nits
Subject: [x265] cu: directly use param fields for lossless coding options
details: http://hg.videolan.org/x265/rev/e171ad8bc8a3
branches:
changeset: 7311:e171ad8bc8a3
user: Steve Borho <steve at borho.org>
date: Fri Jul 11 01:44:43 2014 -0500
description:
cu: directly use param fields for lossless coding options
Remove m_CUTransquantBypass, m_TransquantBypassEnableFlag
diffstat:
source/Lib/TLibEncoder/TEncCu.cpp | 223 ++++++-----------
source/Lib/TLibEncoder/TEncCu.h | 14 +-
source/Lib/TLibEncoder/TEncSearch.cpp | 425 ++++++++++++++++-----------------
source/Lib/TLibEncoder/TEncSearch.h | 9 +-
source/common/common.h | 6 +
source/encoder/compress.cpp | 185 ++++++--------
source/encoder/cturow.cpp | 22 -
source/encoder/cturow.h | 4 -
source/encoder/encoder.cpp | 11 +-
source/encoder/encoder.h | 4 +-
source/encoder/frameencoder.cpp | 14 +-
source/encoder/frameencoder.h | 6 -
source/encoder/rdcost.h | 2 +-
source/x265.cpp | 3 +
14 files changed, 391 insertions(+), 537 deletions(-)
diffs (truncated from 2364 to 300 lines):
diff -r e3e077965c39 -r e171ad8bc8a3 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Thu Jul 10 19:29:46 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Fri Jul 11 01:44:43 2014 -0500
@@ -66,15 +66,33 @@ TEncCu::TEncCu()
m_bestMergeRecoYuv = NULL;
m_origYuv = NULL;
for (int i = 0; i < MAX_PRED_TYPES; i++)
+ m_modePredYuv[i] = NULL;
+
+ m_sbacCoder = NULL;
+ m_rdSbacCoders = NULL;
+}
+
+bool TEncCu::init(Encoder* top)
+{
+ m_param = top->m_param;
+ m_trQuant.init(top->m_bEnableRDOQ);
+ if (top->m_useScalingListId == SCALING_LIST_OFF)
{
- m_modePredYuv[i] = NULL;
+ m_trQuant.setFlatScalingList();
+ m_trQuant.setUseScalingList(false);
+ }
+ else if (top->m_useScalingListId == SCALING_LIST_DEFAULT)
+ {
+ m_trQuant.setScalingList(top->getScalingList());
+ m_trQuant.setUseScalingList(true);
}
- m_search = NULL;
- m_trQuant = NULL;
- m_rdCost = NULL;
- m_sbacCoder = NULL;
- m_rdSbacCoders = NULL;
+ m_rdCost.setPsyRdScale(m_param->psyRd);
+ m_bEnableRDOQ = top->m_bEnableRDOQ;
+ m_bFrameParallel = top->m_totalFrameThreads > 1;
+ m_numLayers = top->m_quadtreeTULog2MaxSize - top->m_quadtreeTULog2MinSize + 1;
+
+ return initSearch();
}
/**
@@ -302,14 +320,6 @@ void TEncCu::destroy()
m_origYuv = NULL;
}
-/** \param pcEncTop pointer of encoder class
- */
-void TEncCu::init(Encoder* top)
-{
- m_param = top->m_param;
- m_CUTransquantBypass = top->m_CUTransquantBypassFlagValue;
-}
-
// ====================================================================================================================
// Public member functions
// ====================================================================================================================
@@ -342,9 +352,7 @@ void TEncCu::compressCU(TComDataCU* cu)
int next = numPartition >> (part * 2);
m_log->qTreeIntraCnt[part]++;
if (part == g_maxCUDepth - 1 && cu->getPartitionSize(i) != SIZE_2Nx2N)
- {
m_log->cntIntraNxN++;
- }
else
{
m_log->cntIntra[part]++;
@@ -513,15 +521,11 @@ void TEncCu::xCompressIntraCU(TComDataCU
Frame* pic = outBestCU->getPic();
if (depth == 0)
- {
// get original YUV data from picture
m_origYuv[depth]->copyFromPicYuv(pic->getPicYuvOrg(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU());
- }
else
- {
// copy partition YUV from depth 0 CTU cache
m_origYuv[0]->copyPartToYuv(m_origYuv[depth], outBestCU->getZorderIdxInCU());
- }
uint32_t cuSize = outTempCU->getCUSize(0);
TComSlice* slice = outTempCU->getSlice();
@@ -543,30 +547,21 @@ void TEncCu::xCompressIntraCU(TComDataCU
if (depth == g_maxCUDepth - g_addCUDepth)
{
if (cuSize > (1 << slice->getSPS()->getQuadtreeTULog2MinSize()))
- {
xCheckRDCostIntra(outBestCU, outTempCU, SIZE_NxN);
- }
}
m_sbacCoder->resetBits();
m_sbacCoder->codeSplitFlag(outBestCU, 0, depth);
outBestCU->m_totalBits += m_sbacCoder->getNumberOfWrittenBits(); // split bits
- if (m_rdCost->psyRdEnabled())
- {
- outBestCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits,
- outBestCU->m_psyEnergy);
- }
+ 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);
- }
+ outBestCU->m_totalRDCost = m_rdCost.calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
}
// copy original YUV samples in lossless mode
if (outBestCU->isLosslessCoded(0))
- {
xFillOrigYUVBuffer(outBestCU, m_origYuv[depth]);
- }
// further split
if (depth < g_maxCUDepth - g_addCUDepth)
@@ -612,15 +607,10 @@ void TEncCu::xCompressIntraCU(TComDataCU
outTempCU->m_totalBits += m_sbacCoder->getNumberOfWrittenBits(); // split bits
}
- if (m_rdCost->psyRdEnabled())
- {
- outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits,
- outTempCU->m_psyEnergy);
- }
+ 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);
- }
+ outTempCU->m_totalRDCost = m_rdCost.calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
if ((g_maxCUSize >> depth) == slice->getPPS()->getMinCuDQPSize() && slice->getPPS()->getUseDQP())
{
@@ -643,9 +633,7 @@ void TEncCu::xCompressIntraCU(TComDataCU
X265_CHECK(foundNonZeroCbf, "expected to find non-zero CBF\n");
}
else
- {
outTempCU->setQPSubParts(outTempCU->getRefQP(targetPartIdx), 0, depth); // set QP to default QP
- }
}
m_rdSbacCoders[nextDepth][CI_NEXT_BEST].store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
@@ -660,7 +648,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");
- if (m_rdCost->psyRdEnabled())
+ if (m_rdCost.psyRdEnabled())
{
X265_CHECK(outBestCU->m_totalPsyCost != MAX_INT64, "no best partition cost\n");
}
@@ -677,15 +665,11 @@ void TEncCu::xCompressCU(TComDataCU*& ou
Frame* pic = outBestCU->getPic();
if (depth == 0)
- {
// get original YUV data from picture
m_origYuv[depth]->copyFromPicYuv(pic->getPicYuvOrg(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU());
- }
else
- {
// copy partition YUV from depth 0 CTU cache
m_origYuv[0]->copyPartToYuv(m_origYuv[depth], outBestCU->getZorderIdxInCU());
- }
// variable for Early CU determination
bool bSubBranch = true;
@@ -729,9 +713,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
xCheckRDCostInter(outBestCU, outTempCU, SIZE_2Nx2N);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
}
@@ -760,18 +742,14 @@ void TEncCu::xCompressCU(TComDataCU*& ou
xCheckRDCostInter(outBestCU, outTempCU, SIZE_Nx2N);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_Nx2N)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
if (doNotBlockPu)
{
xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxN);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxN)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
}
@@ -791,18 +769,14 @@ void TEncCu::xCompressCU(TComDataCU*& ou
xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnU);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnU)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
if (doNotBlockPu)
{
xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnD);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnD)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
}
else if (bTestMergeAMP_Hor)
@@ -812,18 +786,14 @@ void TEncCu::xCompressCU(TComDataCU*& ou
xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnU, true);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnU)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
if (doNotBlockPu)
{
xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnD, true);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnD)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
}
@@ -835,9 +805,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
xCheckRDCostInter(outBestCU, outTempCU, SIZE_nLx2N);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_nLx2N)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
if (doNotBlockPu)
{
@@ -852,9 +820,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
xCheckRDCostInter(outBestCU, outTempCU, SIZE_nLx2N, true);
outTempCU->initEstData();
if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_nLx2N)
- {
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
- }
}
if (doNotBlockPu)
{
@@ -888,15 +854,10 @@ void TEncCu::xCompressCU(TComDataCU*& ou
m_sbacCoder->resetBits();
m_sbacCoder->codeSplitFlag(outBestCU, 0, depth);
outBestCU->m_totalBits += m_sbacCoder->getNumberOfWrittenBits(); // split bits
- if (m_rdCost->psyRdEnabled())
- {
- outBestCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits,
- outBestCU->m_psyEnergy);
- }
+ 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);
- }
+ outBestCU->m_totalRDCost = m_rdCost.calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
// Early CU determination
if (outBestCU->isSkipped(0))
@@ -928,14 +889,11 @@ void TEncCu::xCompressCU(TComDataCU*& ou
(subBestPartCU->getCUPelY() < slice->getSPS()->getPicHeightInLumaSamples())))
{
subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
+
if (0 == partUnitIdx) //initialize RD with previous depth buffer
- {
m_rdSbacCoders[nextDepth][CI_CURR_BEST].load(m_rdSbacCoders[depth][CI_CURR_BEST]);
- }
else
- {
m_rdSbacCoders[nextDepth][CI_CURR_BEST].load(m_rdSbacCoders[nextDepth][CI_NEXT_BEST]);
- }
xCompressCU(subBestPartCU, subTempPartCU, nextDepth, bInsidePicture);
outTempCU->copyPartFrom(subBestPartCU, partUnitIdx, nextDepth); // Keep best part data to current temporary data.
@@ -955,15 +913,10 @@ void TEncCu::xCompressCU(TComDataCU*& ou
outTempCU->m_totalBits += m_sbacCoder->getNumberOfWrittenBits(); // split bits
}
- if (m_rdCost->psyRdEnabled())
- {
More information about the x265-commits
mailing list