[x265-commits] [x265] refine YUV and coeff buffer
Satoshi Nakagawa
nakagawa424 at oki.com
Thu May 29 23:14:55 CEST 2014
details: http://hg.videolan.org/x265/rev/260752f39b27
branches:
changeset: 6936:260752f39b27
user: Satoshi Nakagawa <nakagawa424 at oki.com>
date: Wed May 28 16:48:47 2014 +0900
description:
refine YUV and coeff buffer
Subject: [x265] preset: disable rectangular and AMP partitions at medium preset
details: http://hg.videolan.org/x265/rev/b42827682323
branches:
changeset: 6937:b42827682323
user: Steve Borho <steve at borho.org>
date: Wed May 28 20:07:17 2014 -0500
description:
preset: disable rectangular and AMP partitions at medium preset
This gives a considerable speed-up (50-70%) at the default preset for not much
loss in compression efficiency (2-3%). AMP is rarely useful, at non-RDO presets
we were only considering AMP merge anyway, and rect can be approximated by a
split and two merges.
Subject: [x265] cmake: 32-bit macho compiles need _ prefixes on exported functions
details: http://hg.videolan.org/x265/rev/d4932f6e964b
branches:
changeset: 6938:d4932f6e964b
user: Steve Borho <steve at borho.org>
date: Thu May 29 13:07:28 2014 -0500
description:
cmake: 32-bit macho compiles need _ prefixes on exported functions
Subject: [x265] ratecontrol: improve visual quality and bitrate savings in ABR.
details: http://hg.videolan.org/x265/rev/7cbe7e7a75c4
branches:
changeset: 6939:7cbe7e7a75c4
user: Aarthi Thirumalai
date: Thu May 29 23:29:41 2014 +0530
description:
ratecontrol: improve visual quality and bitrate savings in ABR.
Try to prevent ABR over-compensation after I frames by amortizing the cost over
the next few frames;
Improve ABR quality with frame parallelism - enable frame parallelism only after first
few P frames to prevent excessive qp fluctuations.
Fix initial I frame qp. when cu tree is enabled, the qp decided arbitrarily is
too low. This causes a huge qp spike in immediate P frames.Tuned cplxrSum
for intial I frame so that a more appropriate qp is chosen.
Subject: [x265] rc: cleanups for clarity
details: http://hg.videolan.org/x265/rev/58420e834424
branches:
changeset: 6940:58420e834424
user: Steve Borho <steve at borho.org>
date: Thu May 29 16:04:51 2014 -0500
description:
rc: cleanups for clarity
diffstat:
doc/reST/cli.rst | 4 +-
doc/reST/presets.rst | 4 +-
source/Lib/TLibCommon/TComDataCU.cpp | 38 +-
source/Lib/TLibCommon/TComDataCU.h | 12 +-
source/Lib/TLibCommon/TComPattern.cpp | 4 +-
source/Lib/TLibCommon/TComPattern.h | 4 +-
source/Lib/TLibCommon/TComPicYuv.cpp | 30 +-
source/Lib/TLibCommon/TComPicYuv.h | 39 +-
source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp | 51 +---
source/Lib/TLibCommon/TComYuv.cpp | 91 +++----
source/Lib/TLibCommon/TComYuv.h | 46 +--
source/Lib/TLibEncoder/TEncEntropy.cpp | 8 +-
source/Lib/TLibEncoder/TEncSearch.cpp | 245 ++++++++------------
source/Lib/TLibEncoder/TEncSearch.h | 10 +-
source/cmake/CMakeASM_YASMInformation.cmake | 2 +-
source/common/param.cpp | 21 +-
source/common/shortyuv.cpp | 108 ++++-----
source/common/shortyuv.h | 48 +--
source/encoder/encoder.cpp | 15 +
source/encoder/encoder.h | 1 +
source/encoder/ratecontrol.cpp | 66 +++-
source/encoder/ratecontrol.h | 6 +
source/encoder/reference.cpp | 2 +-
23 files changed, 363 insertions(+), 492 deletions(-)
diffs (truncated from 1871 to 300 lines):
diff -r e9776dfd1471 -r 58420e834424 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed May 28 20:39:40 2014 -0500
+++ b/doc/reST/cli.rst Thu May 29 16:04:51 2014 -0500
@@ -365,7 +365,7 @@ Temporal / motion search options
.. option:: --rect, --no-rect
Enable analysis of rectangular motion partitions Nx2N and 2NxN
- (50/50 splits, two directions). Default enabled
+ (50/50 splits, two directions). Default disabled
.. option:: --amp, --no-amp
@@ -373,7 +373,7 @@ Temporal / motion search options
directions). This setting has no effect if rectangular partitions
are disabled. Even though there are four possible AMP partitions,
only the most likely candidate is tested, based on the results of
- the rectangular mode tests. Default enabled
+ the rectangular mode tests. Default disabled
.. option:: --max-merge <1..5>
diff -r e9776dfd1471 -r 58420e834424 doc/reST/presets.rst
--- a/doc/reST/presets.rst Wed May 28 20:39:40 2014 -0500
+++ b/doc/reST/presets.rst Thu May 29 16:04:51 2014 -0500
@@ -38,9 +38,9 @@ The presets adjust encoder parameters to
+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
| subme | 0 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 4 | 5 |
+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
-| rect | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
+| rect | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
-| amp | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
+| amp | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
| max-merge | 2 | 2 | 2 | 2 | 2 | 2 | 3 | 3 | 4 | 5 |
+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
diff -r e9776dfd1471 -r 58420e834424 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp Wed May 28 20:39:40 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp Thu May 29 16:04:51 2014 -0500
@@ -80,9 +80,9 @@ TComDataCU::TComDataCU()
m_cbf[0] = NULL;
m_cbf[1] = NULL;
m_cbf[2] = NULL;
- m_trCoeffY = NULL;
- m_trCoeffCb = NULL;
- m_trCoeffCr = NULL;
+ m_trCoeff[0] = NULL;
+ m_trCoeff[1] = NULL;
+ m_trCoeff[2] = NULL;
m_iPCMFlags = NULL;
m_iPCMSampleY = NULL;
m_iPCMSampleCb = NULL;
@@ -148,9 +148,9 @@ bool TComDataCU::create(uint32_t numPart
CHECKED_MALLOC(m_mvpIdx[0], uint8_t, numPartition * 2);
m_mvpIdx[1] = m_mvpIdx[0] + numPartition;
- CHECKED_MALLOC(m_trCoeffY, coeff_t, sizeL + sizeC * 2);
- m_trCoeffCb = m_trCoeffY + sizeL;
- m_trCoeffCr = m_trCoeffY + sizeL + sizeC;
+ CHECKED_MALLOC(m_trCoeff[0], coeff_t, sizeL + sizeC * 2);
+ m_trCoeff[1] = m_trCoeff[0] + sizeL;
+ m_trCoeff[2] = m_trCoeff[0] + sizeL + sizeC;
CHECKED_MALLOC(m_iPCMFlags, bool, numPartition);
CHECKED_MALLOC(m_iPCMSampleY, pixel, sizeL + sizeC * 2);
@@ -177,7 +177,7 @@ void TComDataCU::destroy()
X265_FREE(m_chromaIntraDir);
X265_FREE(m_trIdx);
X265_FREE(m_transformSkip[0]);
- X265_FREE(m_trCoeffY);
+ X265_FREE(m_trCoeff[0]);
X265_FREE(m_iPCMFlags);
X265_FREE(m_iPCMSampleY);
X265_FREE(m_mvpIdx[0]);
@@ -607,12 +607,12 @@ void TComDataCU::copyPartFrom(TComDataCU
uint32_t tmp = g_maxCUSize * g_maxCUSize >> (depth << 1);
uint32_t tmp2 = partUnitIdx * tmp;
- memcpy(m_trCoeffY + tmp2, cu->getCoeffY(), sizeof(coeff_t) * tmp);
+ memcpy(m_trCoeff[0] + tmp2, cu->getCoeffY(), sizeof(coeff_t) * tmp);
memcpy(m_iPCMSampleY + tmp2, cu->getPCMSampleY(), sizeof(pixel) * tmp);
tmp >>= m_hChromaShift + m_vChromaShift;
tmp2 >>= m_hChromaShift + m_vChromaShift;
- memcpy(m_trCoeffCb + tmp2, cu->getCoeffCb(), sizeof(coeff_t) * tmp);
- memcpy(m_trCoeffCr + tmp2, cu->getCoeffCr(), sizeof(coeff_t) * tmp);
+ memcpy(m_trCoeff[1] + tmp2, cu->m_trCoeff[1], sizeof(coeff_t) * tmp);
+ memcpy(m_trCoeff[2] + tmp2, cu->m_trCoeff[2], sizeof(coeff_t) * tmp);
memcpy(m_iPCMSampleCb + tmp2, cu->getPCMSampleCb(), sizeof(pixel) * tmp);
memcpy(m_iPCMSampleCr + tmp2, cu->getPCMSampleCr(), sizeof(pixel) * tmp);
}
@@ -665,12 +665,12 @@ void TComDataCU::copyToPic(uint8_t depth
uint32_t tmp = (g_maxCUSize * g_maxCUSize) >> (depth << 1);
uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
- memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeffY, sizeof(coeff_t) * tmp);
+ memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeff[0], sizeof(coeff_t) * tmp);
memcpy(rpcCU->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(pixel) * tmp);
tmp >>= m_hChromaShift + m_vChromaShift;
tmp2 >>= m_hChromaShift + m_vChromaShift;
- memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(coeff_t) * tmp);
- memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(coeff_t) * tmp);
+ memcpy(rpcCU->m_trCoeff[1] + tmp2, m_trCoeff[1], sizeof(coeff_t) * tmp);
+ memcpy(rpcCU->m_trCoeff[2] + tmp2, m_trCoeff[2], sizeof(coeff_t) * tmp);
memcpy(rpcCU->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(pixel) * tmp);
memcpy(rpcCU->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(pixel) * tmp);
}
@@ -695,11 +695,11 @@ void TComDataCU::copyCodedToPic(uint8_t
uint32_t tmp = (g_maxCUSize * g_maxCUSize) >> (depth << 1);
uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
- memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeffY, sizeof(coeff_t) * tmp);
+ memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeff[0], sizeof(coeff_t) * tmp);
tmp >>= m_hChromaShift + m_vChromaShift;
tmp2 >>= m_hChromaShift + m_vChromaShift;
- memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(coeff_t) * tmp);
- memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(coeff_t) * tmp);
+ memcpy(rpcCU->m_trCoeff[1] + tmp2, m_trCoeff[1], sizeof(coeff_t) * tmp);
+ memcpy(rpcCU->m_trCoeff[2] + tmp2, m_trCoeff[2], sizeof(coeff_t) * tmp);
}
void TComDataCU::copyToPic(uint8_t depth, uint32_t partIdx, uint32_t partDepth)
@@ -748,12 +748,12 @@ void TComDataCU::copyToPic(uint8_t depth
uint32_t tmp = (g_maxCUSize * g_maxCUSize) >> ((depth + partDepth) << 1);
uint32_t tmp2 = partOffset << m_pic->getLog2UnitSize() * 2;
- memcpy(cu->getCoeffY() + tmp2, m_trCoeffY, sizeof(coeff_t) * tmp);
+ memcpy(cu->getCoeffY() + tmp2, m_trCoeff[0], sizeof(coeff_t) * tmp);
memcpy(cu->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(pixel) * tmp);
tmp >>= m_hChromaShift + m_vChromaShift;
tmp2 >>= m_hChromaShift + m_vChromaShift;
- memcpy(cu->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(coeff_t) * tmp);
- memcpy(cu->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(coeff_t) * tmp);
+ memcpy(cu->m_trCoeff[1] + tmp2, m_trCoeff[1], sizeof(coeff_t) * tmp);
+ memcpy(cu->m_trCoeff[2] + tmp2, m_trCoeff[2], sizeof(coeff_t) * tmp);
memcpy(cu->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(pixel) * tmp);
memcpy(cu->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(pixel) * tmp);
}
diff -r e9776dfd1471 -r 58420e834424 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Wed May 28 20:39:40 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.h Thu May 29 16:04:51 2014 -0500
@@ -112,9 +112,7 @@ private:
uint8_t* m_transformSkip[3]; ///< array of transform skipping flags
uint8_t* m_cbf[3]; ///< array of coded block flags (CBF)
TComCUMvField m_cuMvField[2]; ///< array of motion vectors
- coeff_t* m_trCoeffY; ///< transformed coefficient buffer (Y)
- coeff_t* m_trCoeffCb; ///< transformed coefficient buffer (Cb)
- coeff_t* m_trCoeffCr; ///< transformed coefficient buffer (Cr)
+ coeff_t* m_trCoeff[3]; ///< transformed coefficient buffer
pixel* m_iPCMSampleY; ///< PCM sample buffer (Y)
pixel* m_iPCMSampleCb; ///< PCM sample buffer (Cb)
@@ -279,11 +277,13 @@ public:
TComCUMvField* getCUMvField(int e) { return &m_cuMvField[e]; }
- coeff_t*& getCoeffY() { return m_trCoeffY; }
+ coeff_t* getCoeffY() { return m_trCoeff[0]; }
- coeff_t*& getCoeffCb() { return m_trCoeffCb; }
+ coeff_t* getCoeffCb() { return m_trCoeff[1]; }
- coeff_t*& getCoeffCr() { return m_trCoeffCr; }
+ coeff_t* getCoeffCr() { return m_trCoeff[2]; }
+
+ coeff_t* getCoeff(TextType ttype) { return m_trCoeff[ttype]; }
pixel*& getPCMSampleY() { return m_iPCMSampleY; }
diff -r e9776dfd1471 -r 58420e834424 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp Wed May 28 20:39:40 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.cpp Thu May 29 16:04:51 2014 -0500
@@ -163,7 +163,7 @@ void TComPattern::initAdiPattern(TComDat
}
}
-void TComPattern::initAdiPatternChroma(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, pixel* adiBuf, int chromaId)
+void TComPattern::initAdiPatternChroma(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, pixel* adiBuf, uint32_t chromaId)
{
pixel* roiOrigin;
pixel* adiTemp;
@@ -175,7 +175,7 @@ void TComPattern::initAdiPatternChroma(T
initIntraNeighbors(cu, zOrderIdxInPart, partDepth, TEXT_CHROMA, &intraNeighbors);
uint32_t tuSize = intraNeighbors.tuSize;
- roiOrigin = (chromaId == 1) ? cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), cu->getZorderIdxInCU() + zOrderIdxInPart) : cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), cu->getZorderIdxInCU() + zOrderIdxInPart);
+ roiOrigin = cu->getPic()->getPicYuvRec()->getChromaAddr(chromaId, cu->getAddr(), cu->getZorderIdxInCU() + zOrderIdxInPart);
adiTemp = getAdiChromaBuf(chromaId, tuSize, adiBuf);
fillReferenceSamples(roiOrigin, picStride, adiTemp, intraNeighbors);
diff -r e9776dfd1471 -r 58420e834424 source/Lib/TLibCommon/TComPattern.h
--- a/source/Lib/TLibCommon/TComPattern.h Wed May 28 20:39:40 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.h Thu May 29 16:04:51 2014 -0500
@@ -70,7 +70,7 @@ class TComPattern
public:
// access functions of ADI buffers
- static pixel* getAdiChromaBuf(int chromaId, int tuSize, pixel* adiBuf)
+ static pixel* getAdiChromaBuf(uint32_t chromaId, int tuSize, pixel* adiBuf)
{
return adiBuf + (chromaId == 1 ? 0 : 2 * ADI_BUF_STRIDE * (tuSize * 2 + 1));
}
@@ -86,7 +86,7 @@ public:
/// set chroma parameters from CU data for accessing ADI data
static void initAdiPatternChroma(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth,
- pixel* adiBuf, int chromaId);
+ pixel* adiBuf, uint32_t chromaId);
static void initIntraNeighbors(TComDataCU* cu, uint32_t zOrderIdxInPart, uint32_t partDepth, TextType cType, IntraNeighbors *IntraNeighbors);
diff -r e9776dfd1471 -r 58420e834424 source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp Wed May 28 20:39:40 2014 -0500
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp Thu May 29 16:04:51 2014 -0500
@@ -46,13 +46,13 @@ using namespace x265;
TComPicYuv::TComPicYuv()
{
- m_picBufY = NULL; // Buffer (including margin)
- m_picBufU = NULL;
- m_picBufV = NULL;
+ m_picBuf[0] = NULL; // Buffer (including margin)
+ m_picBuf[1] = NULL;
+ m_picBuf[2] = NULL;
- m_picOrgY = NULL; // m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
- m_picOrgU = NULL;
- m_picOrgV = NULL;
+ m_picOrg[0] = NULL; // m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
+ m_picOrg[1] = NULL;
+ m_picOrg[2] = NULL;
m_cuOffsetY = NULL;
m_cuOffsetC = NULL;
@@ -88,13 +88,13 @@ bool TComPicYuv::create(int picWidth, in
m_strideC = ((m_numCuInWidth * g_maxCUSize) >> m_hChromaShift) + (m_chromaMarginX * 2);
int maxHeight = m_numCuInHeight * g_maxCUSize;
- CHECKED_MALLOC(m_picBufY, pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
- CHECKED_MALLOC(m_picBufU, pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
- CHECKED_MALLOC(m_picBufV, pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
+ CHECKED_MALLOC(m_picBuf[0], pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
+ CHECKED_MALLOC(m_picBuf[1], pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
+ CHECKED_MALLOC(m_picBuf[2], pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
- m_picOrgY = m_picBufY + m_lumaMarginY * getStride() + m_lumaMarginX;
- m_picOrgU = m_picBufU + m_chromaMarginY * getCStride() + m_chromaMarginX;
- m_picOrgV = m_picBufV + m_chromaMarginY * getCStride() + m_chromaMarginX;
+ m_picOrg[0] = m_picBuf[0] + m_lumaMarginY * getStride() + m_lumaMarginX;
+ m_picOrg[1] = m_picBuf[1] + m_chromaMarginY * getCStride() + m_chromaMarginX;
+ m_picOrg[2] = m_picBuf[2] + m_chromaMarginY * getCStride() + m_chromaMarginX;
/* TODO: these four buffers are the same for every TComPicYuv in the encoder */
CHECKED_MALLOC(m_cuOffsetY, int, m_numCuInWidth * m_numCuInHeight);
@@ -127,9 +127,9 @@ fail:
void TComPicYuv::destroy()
{
- X265_FREE(m_picBufY);
- X265_FREE(m_picBufU);
- X265_FREE(m_picBufV);
+ X265_FREE(m_picBuf[0]);
+ X265_FREE(m_picBuf[1]);
+ X265_FREE(m_picBuf[2]);
X265_FREE(m_cuOffsetY);
X265_FREE(m_cuOffsetC);
X265_FREE(m_buOffsetY);
diff -r e9776dfd1471 -r 58420e834424 source/Lib/TLibCommon/TComPicYuv.h
--- a/source/Lib/TLibCommon/TComPicYuv.h Wed May 28 20:39:40 2014 -0500
+++ b/source/Lib/TLibCommon/TComPicYuv.h Thu May 29 16:04:51 2014 -0500
@@ -64,13 +64,9 @@ public:
// YUV buffer
// ------------------------------------------------------------------------------------------------
- pixel* m_picBufY; ///< Buffer (including margin)
- pixel* m_picBufU;
- pixel* m_picBufV;
+ pixel* m_picBuf[3]; ///< Buffer (including margin)
- pixel* m_picOrgY; ///< m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
- pixel* m_picOrgU;
- pixel* m_picOrgV;
+ pixel* m_picOrg[3]; ///< m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
// ------------------------------------------------------------------------------------------------
// Parameter for general YUV buffer usage
@@ -131,32 +127,31 @@ public:
// Access function for picture buffer
// ------------------------------------------------------------------------------------------------
- // Access starting position of picture buffer with margin
- pixel* getBufY() { return m_picBufY; }
+ // Access starting position of original picture
+ pixel* getLumaAddr() { return m_picOrg[0]; }
- pixel* getBufU() { return m_picBufU; }
+ pixel* getCbAddr() { return m_picOrg[1]; }
- pixel* getBufV() { return m_picBufV; }
+ pixel* getCrAddr() { return m_picOrg[2]; }
More information about the x265-commits
mailing list