[x265-commits] [x265] nal: refactor nal code, marshall packets directly into ou...
Steve Borho
steve at borho.org
Fri Jun 20 03:04:01 CEST 2014
details: http://hg.videolan.org/x265/rev/ba9c58a4bee0
branches:
changeset: 7122:ba9c58a4bee0
user: Steve Borho <steve at borho.org>
date: Thu Jun 19 16:22:28 2014 -0500
description:
nal: refactor nal code, marshall packets directly into output buffer
This removes two malloc/free for every NAL unit and removes yet another set of
memcopies at the end of the each frame encode. We're now writing the escaped
NAL packets directly into the buffer handed back to the user.
We preserve the max size of this output buffer to prevent having to do any
reallocations once the encoder is running.
Subject: [x265] encoder: remove useless comment
details: http://hg.videolan.org/x265/rev/82ca012854ea
branches:
changeset: 7123:82ca012854ea
user: Steve Borho <steve at borho.org>
date: Thu Jun 19 16:22:39 2014 -0500
description:
encoder: remove useless comment
Subject: [x265] api: introduce param variables for two-pass encodes
details: http://hg.videolan.org/x265/rev/5063065d7037
branches:
changeset: 7124:5063065d7037
user: Aarthi Thirumalai<aarthi at multicorewareinc.com>
date: Tue Jun 17 14:56:02 2014 +0530
description:
api: introduce param variables for two-pass encodes
Subject: [x265] rc: define default setting and validations for 2 pass states
details: http://hg.videolan.org/x265/rev/c50f3d2aeb4d
branches:
changeset: 7125:c50f3d2aeb4d
user: Aarthi Thirumalai<aarthi at multicorewareinc.com>
date: Tue Jun 17 17:20:46 2014 +0530
description:
rc: define default setting and validations for 2 pass states
Subject: [x265] rc: add 2 pass states in RateControl
details: http://hg.videolan.org/x265/rev/ed85651a2840
branches:
changeset: 7126:ed85651a2840
user: Aarthi Thirumalai<aarthi at multicorewareinc.com>
date: Tue Jun 17 18:44:11 2014 +0530
description:
rc: add 2 pass states in RateControl
Subject: [x265] param: log rc states of m_param in x265_param2string
details: http://hg.videolan.org/x265/rev/ff6e2349cff3
branches:
changeset: 7127:ff6e2349cff3
user: Aarthi Thirumalai<aarthi at multicorewareinc.com>
date: Tue Jun 17 18:32:27 2014 +0530
description:
param: log rc states of m_param in x265_param2string
Subject: [x265] rc: initialize the 2 pass states in rc
details: http://hg.videolan.org/x265/rev/60178ece9879
branches:
changeset: 7128:60178ece9879
user: Aarthi Thirumalai<aarthi at multicorewareinc.com>
date: Tue Jun 17 20:06:02 2014 +0530
description:
rc: initialize the 2 pass states in rc
Subject: [x265] remove reduce code since trHeight always equal to trWidth
details: http://hg.videolan.org/x265/rev/c91e624c4502
branches:
changeset: 7129:c91e624c4502
user: Min Chen <chenm003 at 163.com>
date: Thu Jun 19 14:56:11 2014 -0700
description:
remove reduce code since trHeight always equal to trWidth
Subject: [x265] static m_bLFCrossTileBoundary since all of LCU use same value
details: http://hg.videolan.org/x265/rev/565818adf640
branches:
changeset: 7130:565818adf640
user: Min Chen <chenm003 at 163.com>
date: Thu Jun 19 14:56:46 2014 -0700
description:
static m_bLFCrossTileBoundary since all of LCU use same value
Subject: [x265] move m_blockingStrength to local
details: http://hg.videolan.org/x265/rev/8c875d7341b7
branches:
changeset: 7131:8c875d7341b7
user: Min Chen <chenm003 at 163.com>
date: Thu Jun 19 14:57:03 2014 -0700
description:
move m_blockingStrength to local
Subject: [x265] cu: nits
details: http://hg.videolan.org/x265/rev/c72093672ad1
branches:
changeset: 7132:c72093672ad1
user: Steve Borho <steve at borho.org>
date: Thu Jun 19 18:38:15 2014 -0500
description:
cu: nits
diffstat:
source/CMakeLists.txt | 2 +-
source/Lib/TLibCommon/TComDataCU.h | 4 +-
source/Lib/TLibCommon/TComLoopFilter.cpp | 81 +++------
source/Lib/TLibCommon/TComLoopFilter.h | 19 +-
source/common/common.h | 2 -
source/common/param.cpp | 49 +++++-
source/encoder/api.cpp | 41 +---
source/encoder/encoder.cpp | 153 +++----------------
source/encoder/encoder.h | 13 +-
source/encoder/frameencoder.cpp | 241 +++++++++++-------------------
source/encoder/frameencoder.h | 10 +-
source/encoder/framefilter.cpp | 7 +-
source/encoder/nal.cpp | 90 +++++++++--
source/encoder/nal.h | 25 ++-
source/encoder/ratecontrol.cpp | 137 ++++++++++++++++-
source/encoder/ratecontrol.h | 20 ++-
source/encoder/slicetype.cpp | 2 +-
source/x265.h | 16 ++
18 files changed, 477 insertions(+), 435 deletions(-)
diffs (truncated from 1734 to 300 lines):
diff -r ecccd5401d27 -r c72093672ad1 source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Jun 19 22:13:36 2014 +0900
+++ b/source/CMakeLists.txt Thu Jun 19 18:38:15 2014 -0500
@@ -19,7 +19,7 @@ include(CheckSymbolExists)
include(CheckCXXCompilerFlag)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 22)
+set(X265_BUILD 23)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r ecccd5401d27 -r c72093672ad1 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Thu Jun 19 22:13:36 2014 +0900
+++ b/source/Lib/TLibCommon/TComDataCU.h Thu Jun 19 18:38:15 2014 -0500
@@ -401,9 +401,9 @@ public:
TComDataCU* getPUAboveRight(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, bool bEnforceSliceRestriction = true);
TComDataCU* getPUBelowLeft(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx, bool bEnforceSliceRestriction = true);
- TComDataCU* getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t uiCurrAbsIdxInLCU);
+ TComDataCU* getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t currAbsIdxInLCU);
TComDataCU* getQpMinCuAbove(uint32_t& aPartUnitIdx, uint32_t currAbsIdxInLCU);
- char getRefQP(uint32_t uiCurrAbsIdxInLCU);
+ char getRefQP(uint32_t currAbsIdxInLCU);
TComDataCU* getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset = 1);
TComDataCU* getPUBelowLeftAdi(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset = 1);
diff -r ecccd5401d27 -r c72093672ad1 source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp Thu Jun 19 22:13:36 2014 +0900
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp Thu Jun 19 18:38:15 2014 -0500
@@ -64,18 +64,15 @@ const uint8_t TComLoopFilter::sm_betaTab
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64
};
+bool TComLoopFilter::m_bLFCrossTileBoundary = true;
+
// ====================================================================================================================
// Constructor / destructor / create / destroy
// ====================================================================================================================
TComLoopFilter::TComLoopFilter()
: m_numPartitions(0)
- , m_bLFCrossTileBoundary(true)
{
- for (uint32_t dir = 0; dir < 2; dir++)
- {
- m_blockingStrength[dir] = NULL;
- }
}
TComLoopFilter::~TComLoopFilter()
@@ -93,28 +90,19 @@ void TComLoopFilter::create(uint32_t max
{
destroy();
m_numPartitions = 1 << (maxCuDepth << 1);
- for (uint32_t dir = 0; dir < 2; dir++)
- {
- m_blockingStrength[dir] = new uint8_t[m_numPartitions];
- }
}
void TComLoopFilter::destroy()
{
- for (uint32_t dir = 0; dir < 2; dir++)
- {
- delete [] m_blockingStrength[dir];
- m_blockingStrength[dir] = NULL;
- }
}
-void TComLoopFilter::loopFilterCU(TComDataCU* cu, int dir, bool edgeFilter[])
+void TComLoopFilter::loopFilterCU(TComDataCU* cu, int dir, bool edgeFilter[], uint8_t blockingStrength[])
{
- ::memset(m_blockingStrength[dir], 0, sizeof(uint8_t) * m_numPartitions);
+ ::memset(blockingStrength, 0, sizeof(uint8_t) * m_numPartitions);
::memset(edgeFilter, 0, sizeof(bool) * m_numPartitions);
// CU-based deblocking
- xDeblockCU(cu, 0, 0, dir, edgeFilter);
+ xDeblockCU(cu, 0, 0, dir, edgeFilter, blockingStrength);
}
// ====================================================================================================================
@@ -126,7 +114,7 @@ void TComLoopFilter::loopFilterCU(TComDa
.
\param Edge the direction of the edge in block boundary (horizonta/vertical), which is added newly
*/
-void TComLoopFilter::xDeblockCU(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, const int dir, bool edgeFilter[])
+void TComLoopFilter::xDeblockCU(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, const int dir, bool edgeFilter[], uint8_t blockingStrength[])
{
if (cu->getPic() == 0 || cu->getPartitionSize(absZOrderIdx) == SIZE_NONE)
{
@@ -144,7 +132,7 @@ void TComLoopFilter::xDeblockCU(TComData
uint32_t tpely = cu->getCUPelY() + g_rasterToPelY[g_zscanToRaster[absZOrderIdx]];
if ((lpelx < cu->getSlice()->getSPS()->getPicWidthInLumaSamples()) && (tpely < cu->getSlice()->getSPS()->getPicHeightInLumaSamples()))
{
- xDeblockCU(cu, absZOrderIdx, depth + 1, dir, edgeFilter);
+ xDeblockCU(cu, absZOrderIdx, depth + 1, dir, edgeFilter, blockingStrength);
}
}
@@ -155,8 +143,8 @@ void TComLoopFilter::xDeblockCU(TComData
LFCUParam lfcuParam;
xSetLoopfilterParam(cu, absZOrderIdx, &lfcuParam);
- xSetEdgefilterTU(cu, absZOrderIdx, absZOrderIdx, depth, dir, edgeFilter);
- xSetEdgefilterPU(cu, absZOrderIdx, dir, &lfcuParam, edgeFilter);
+ xSetEdgefilterTU(cu, absZOrderIdx, absZOrderIdx, depth, dir, edgeFilter, blockingStrength);
+ xSetEdgefilterPU(cu, absZOrderIdx, dir, &lfcuParam, edgeFilter, blockingStrength);
for (uint32_t partIdx = absZOrderIdx; partIdx < absZOrderIdx + curNumParts; partIdx++)
{
@@ -172,7 +160,7 @@ void TComLoopFilter::xDeblockCU(TComData
if (edgeFilter[partIdx] && bsCheck)
{
- xGetBoundaryStrengthSingle(cu, dir, partIdx);
+ xGetBoundaryStrengthSingle(cu, dir, partIdx, blockingStrength);
}
}
@@ -184,40 +172,35 @@ void TComLoopFilter::xDeblockCU(TComData
const bool bAlwaysDoChroma = (cu->getChromaFormat() == CHROMA_444);
for (uint32_t e = 0; e < sizeInPU; e += partIdxIncr)
{
- xEdgeFilterLuma(cu, absZOrderIdx, depth, dir, e);
+ xEdgeFilterLuma(cu, absZOrderIdx, depth, dir, e, blockingStrength);
if (bAlwaysDoChroma || (pelsInPart > DEBLOCK_SMALLEST_BLOCK) || (e % ((DEBLOCK_SMALLEST_BLOCK << shiftFactor) / pelsInPart)) == 0)
{
- xEdgeFilterChroma(cu, absZOrderIdx, depth, dir, e);
+ xEdgeFilterChroma(cu, absZOrderIdx, depth, dir, e, blockingStrength);
}
}
}
-void TComLoopFilter::xSetEdgefilterMultiple(TComDataCU* cu, uint32_t scanIdx, uint32_t depth, int dir, int edgeIdx, bool bValue, bool edgeFilter[], uint32_t widthInBaseUnits, uint32_t heightInBaseUnits)
+void TComLoopFilter::xSetEdgefilterMultiple(TComDataCU* cu, uint32_t scanIdx, uint32_t depth, int dir, int edgeIdx, bool bValue, bool edgeFilter[], uint8_t blockingStrength[], uint32_t widthInBaseUnits)
{
if (widthInBaseUnits == 0)
{
widthInBaseUnits = cu->getPic()->getNumPartInCUSize() >> depth;
}
- if (heightInBaseUnits == 0)
- {
- heightInBaseUnits = cu->getPic()->getNumPartInCUSize() >> depth;
- }
- const uint32_t numElem = dir == 0 ? heightInBaseUnits : widthInBaseUnits;
+ const uint32_t numElem = widthInBaseUnits;
X265_CHECK(numElem > 0, "numElem edge filter check\n");
X265_CHECK(widthInBaseUnits > 0, "widthInBaseUnits edge filter check\n");
- X265_CHECK(heightInBaseUnits > 0, "heightInBaseUnits edge filter check\n");
for (uint32_t i = 0; i < numElem; i++)
{
const uint32_t bsidx = xCalcBsIdx(cu, scanIdx, dir, edgeIdx, i);
edgeFilter[bsidx] = bValue;
if (edgeIdx == 0)
{
- m_blockingStrength[dir][bsidx] = bValue;
+ blockingStrength[bsidx] = bValue;
}
}
}
-void TComLoopFilter::xSetEdgefilterTU(TComDataCU* cu, uint32_t absTUPartIdx, uint32_t absZOrderIdx, uint32_t depth, int dir, bool edgeFilter[])
+void TComLoopFilter::xSetEdgefilterTU(TComDataCU* cu, uint32_t absTUPartIdx, uint32_t absZOrderIdx, uint32_t depth, int dir, bool edgeFilter[], uint8_t blockingStrength[])
{
if (cu->getTransformIdx(absZOrderIdx) + cu->getDepth(absZOrderIdx) > depth)
{
@@ -226,29 +209,27 @@ void TComLoopFilter::xSetEdgefilterTU(TC
for (uint32_t partIdx = 0; partIdx < 4; partIdx++, absZOrderIdx += qNumParts)
{
uint32_t nsAddr = absZOrderIdx;
- xSetEdgefilterTU(cu, nsAddr, absZOrderIdx, depth + 1, dir, edgeFilter);
+ xSetEdgefilterTU(cu, nsAddr, absZOrderIdx, depth + 1, dir, edgeFilter, blockingStrength);
}
return;
}
int trWidth = cu->getCUSize(absZOrderIdx) >> cu->getTransformIdx(absZOrderIdx);
- int trHeight = cu->getCUSize(absZOrderIdx) >> cu->getTransformIdx(absZOrderIdx);
uint32_t widthInBaseUnits = trWidth / (g_maxCUSize >> g_maxCUDepth);
- uint32_t heightInBaseUnits = trHeight / (g_maxCUSize >> g_maxCUDepth);
- xSetEdgefilterMultiple(cu, absTUPartIdx, depth, dir, 0, true, edgeFilter, widthInBaseUnits, heightInBaseUnits);
+ xSetEdgefilterMultiple(cu, absTUPartIdx, depth, dir, 0, true, edgeFilter, blockingStrength, widthInBaseUnits);
}
-void TComLoopFilter::xSetEdgefilterPU(TComDataCU* cu, uint32_t absZOrderIdx, int dir, LFCUParam *lfcuParam, bool edgeFilter[])
+void TComLoopFilter::xSetEdgefilterPU(TComDataCU* cu, uint32_t absZOrderIdx, int dir, LFCUParam *lfcuParam, bool edgeFilter[], uint8_t blockingStrength[])
{
const uint32_t depth = cu->getDepth(absZOrderIdx);
const uint32_t widthInBaseUnits = cu->getPic()->getNumPartInCUSize() >> depth;
const uint32_t hWidthInBaseUnits = widthInBaseUnits >> 1;
const uint32_t qWidthInBaseUnits = widthInBaseUnits >> 2;
- xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, 0, (dir == EDGE_VER ? lfcuParam->bLeftEdge : lfcuParam->bTopEdge), edgeFilter);
+ xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, 0, (dir == EDGE_VER ? lfcuParam->bLeftEdge : lfcuParam->bTopEdge), edgeFilter, blockingStrength);
int mode = cu->getPartitionSize(absZOrderIdx);
switch (mode)
@@ -263,12 +244,12 @@ void TComLoopFilter::xSetEdgefilterPU(TC
const int realDir = (mode == SIZE_2NxN ? EDGE_HOR : EDGE_VER);
if (realDir == dir)
- xSetEdgefilterMultiple(cu, absZOrderIdx, depth, realDir, hWidthInBaseUnits, true, edgeFilter);
+ xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, hWidthInBaseUnits, true, edgeFilter, blockingStrength);
break;
}
case SIZE_NxN:
{
- xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, hWidthInBaseUnits, true, edgeFilter);
+ xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, hWidthInBaseUnits, true, edgeFilter, blockingStrength);
break;
}
case SIZE_2NxnU:
@@ -277,7 +258,7 @@ void TComLoopFilter::xSetEdgefilterPU(TC
const int realDir = (mode == SIZE_2NxnU ? EDGE_HOR : EDGE_VER);
if (realDir == dir)
- xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, qWidthInBaseUnits, true, edgeFilter);
+ xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, qWidthInBaseUnits, true, edgeFilter, blockingStrength);
break;
}
case SIZE_2NxnD:
@@ -286,7 +267,7 @@ void TComLoopFilter::xSetEdgefilterPU(TC
const int realDir = (mode == SIZE_2NxnD ? EDGE_HOR : EDGE_VER);
if (realDir == dir)
- xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, widthInBaseUnits - qWidthInBaseUnits, true, edgeFilter);
+ xSetEdgefilterMultiple(cu, absZOrderIdx, depth, dir, widthInBaseUnits - qWidthInBaseUnits, true, edgeFilter, blockingStrength);
break;
}
default:
@@ -342,7 +323,7 @@ void TComLoopFilter::xSetLoopfilterParam
}
}
-void TComLoopFilter::xGetBoundaryStrengthSingle(TComDataCU* cu, int dir, uint32_t absPartIdx)
+void TComLoopFilter::xGetBoundaryStrengthSingle(TComDataCU* cu, int dir, uint32_t absPartIdx, uint8_t blockingStrength[])
{
TComSlice* const slice = cu->getSlice();
@@ -375,7 +356,7 @@ void TComLoopFilter::xGetBoundaryStrengt
uint32_t nsPartQ = partQ;
uint32_t nsPartP = partP;
- if (m_blockingStrength[dir][absPartIdx] && (cuQ->getCbf(nsPartQ, TEXT_LUMA, cuQ->getTransformIdx(nsPartQ)) != 0 || cuP->getCbf(nsPartP, TEXT_LUMA, cuP->getTransformIdx(nsPartP)) != 0))
+ if (blockingStrength[absPartIdx] && (cuQ->getCbf(nsPartQ, TEXT_LUMA, cuQ->getTransformIdx(nsPartQ)) != 0 || cuP->getCbf(nsPartP, TEXT_LUMA, cuP->getTransformIdx(nsPartP)) != 0))
{
bs = 1;
}
@@ -465,10 +446,10 @@ void TComLoopFilter::xGetBoundaryStrengt
} // enf of "if( one of BCBP == 0 )"
} // enf of "if( not Intra )"
- m_blockingStrength[dir][absPartIdx] = bs;
+ blockingStrength[absPartIdx] = bs;
}
-void TComLoopFilter::xEdgeFilterLuma(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, int dir, int edge)
+void TComLoopFilter::xEdgeFilterLuma(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, int dir, int edge, uint8_t blockingStrength[])
{
TComPicYuv* reconYuv = cu->getPic()->getPicYuvRec();
pixel* src = reconYuv->getLumaAddr(cu->getAddr(), absZOrderIdx);
@@ -510,7 +491,7 @@ void TComLoopFilter::xEdgeFilterLuma(TCo
for (uint32_t idx = 0; idx < numParts; idx++)
{
bsAbsIdx = xCalcBsIdx(cu, absZOrderIdx, dir, edge, idx);
- bs = m_blockingStrength[dir][bsAbsIdx];
+ bs = blockingStrength[bsAbsIdx];
if (bs)
{
qpQ = cu->getQP(bsAbsIdx);
@@ -580,7 +561,7 @@ void TComLoopFilter::xEdgeFilterLuma(TCo
}
}
-void TComLoopFilter::xEdgeFilterChroma(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, int dir, int edge)
+void TComLoopFilter::xEdgeFilterChroma(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, int dir, int edge, uint8_t blockingStrength[])
{
TComPicYuv* reconYuv = cu->getPic()->getPicYuvRec();
int stride = reconYuv->getCStride();
@@ -644,7 +625,7 @@ void TComLoopFilter::xEdgeFilterChroma(T
for (uint32_t idx = 0; idx < numParts; idx++)
{
bsAbsIdx = xCalcBsIdx(cu, absZOrderIdx, dir, edge, idx);
- bs = m_blockingStrength[dir][bsAbsIdx];
+ bs = blockingStrength[bsAbsIdx];
if (bs > 1)
{
diff -r ecccd5401d27 -r c72093672ad1 source/Lib/TLibCommon/TComLoopFilter.h
--- a/source/Lib/TLibCommon/TComLoopFilter.h Thu Jun 19 22:13:36 2014 +0900
+++ b/source/Lib/TLibCommon/TComLoopFilter.h Thu Jun 19 18:38:15 2014 -0500
@@ -68,21 +68,20 @@ class TComLoopFilter
private:
uint32_t m_numPartitions;
More information about the x265-commits
mailing list