[x265-commits] [x265] cleanup: remove c++ ref parameter on xWriteCoefRemainExGo...
Min Chen
chenm003 at 163.com
Thu Mar 13 09:26:59 CET 2014
details: http://hg.videolan.org/x265/rev/47edf909f518
branches:
changeset: 6488:47edf909f518
user: Min Chen <chenm003 at 163.com>
date: Wed Mar 12 15:40:27 2014 -0700
description:
cleanup: remove c++ ref parameter on xWriteCoefRemainExGolomb
Subject: [x265] frameencoder: set QP to all parts of CU. No logic change.
details: http://hg.videolan.org/x265/rev/665355c7e4d9
branches:
changeset: 6489:665355c7e4d9
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Thu Mar 13 06:00:52 2014 +0530
description:
frameencoder: set QP to all parts of CU. No logic change.
Subject: [x265] remove unused trUnitIdx from subtract() and addClip()
details: http://hg.videolan.org/x265/rev/deb3d531790f
branches:
changeset: 6490:deb3d531790f
user: Satoshi Nakagawa <nakagawa424 at oki.com>
date: Thu Mar 13 11:20:05 2014 +0900
description:
remove unused trUnitIdx from subtract() and addClip()
Subject: [x265] Backed out changeset: 524fdbaed8d0
details: http://hg.videolan.org/x265/rev/716dc1c8391a
branches:
changeset: 6491:716dc1c8391a
user: Steve Borho <steve at borho.org>
date: Thu Mar 13 00:36:07 2014 -0500
description:
Backed out changeset: 524fdbaed8d0
bits0 and bits1 include list[N].bits and thus they did include the list
selection bit costs.
Subject: [x265] TEncSearch: switch xGetInterPredictionError() to use SATD [CHANGES OUTPUTS]
details: http://hg.videolan.org/x265/rev/ea5f4ab96610
branches:
changeset: 6492:ea5f4ab96610
user: Steve Borho <steve at borho.org>
date: Thu Mar 13 01:21:05 2014 -0500
description:
TEncSearch: switch xGetInterPredictionError() to use SATD [CHANGES OUTPUTS]
predInterSearch() was having to remeasure the unidir/bidir prediction just
because it wanted to measure merge with sa8d. By switching to satd, a number
of further simplifications can be made.
Subject: [x265] TEncSearch: refactor predInterSearch to avoid redundant work
details: http://hg.videolan.org/x265/rev/a166b8d0a43e
branches:
changeset: 6493:a166b8d0a43e
user: Steve Borho <steve at borho.org>
date: Thu Mar 13 01:45:14 2014 -0500
description:
TEncSearch: refactor predInterSearch to avoid redundant work
Subject: [x265] TEncSearch: merge xGetInterPredictionError into xMergeEstimation
details: http://hg.videolan.org/x265/rev/3a2f801dd535
branches:
changeset: 6494:3a2f801dd535
user: Steve Borho <steve at borho.org>
date: Thu Mar 13 02:02:34 2014 -0500
description:
TEncSearch: merge xGetInterPredictionError into xMergeEstimation
Subject: [x265] TEncSearch: remove redundant EMMS instrutions
details: http://hg.videolan.org/x265/rev/675837ac633f
branches:
changeset: 6495:675837ac633f
user: Steve Borho <steve at borho.org>
date: Thu Mar 13 02:03:38 2014 -0500
description:
TEncSearch: remove redundant EMMS instrutions
predInterSearch uses no float operations, so a single EMMS at the end is
sufficient
Subject: [x265] TEncSearch: recombine merge-only path, now it can be accomplished with continue
details: http://hg.videolan.org/x265/rev/879151f65962
branches:
changeset: 6496:879151f65962
user: Steve Borho <steve at borho.org>
date: Thu Mar 13 03:25:06 2014 -0500
description:
TEncSearch: recombine merge-only path, now it can be accomplished with continue
diffstat:
source/Lib/TLibCommon/TComYuv.cpp | 97 ++----------
source/Lib/TLibCommon/TComYuv.h | 11 +-
source/Lib/TLibEncoder/TEncCu.cpp | 2 +-
source/Lib/TLibEncoder/TEncSbac.cpp | 2 +-
source/Lib/TLibEncoder/TEncSbac.h | 2 +-
source/Lib/TLibEncoder/TEncSearch.cpp | 266 +++++++++++++--------------------
source/Lib/TLibEncoder/TEncSearch.h | 6 +-
source/common/shortyuv.cpp | 51 +++---
source/common/shortyuv.h | 4 +-
source/encoder/compress.cpp | 23 +-
source/encoder/frameencoder.cpp | 2 +-
11 files changed, 168 insertions(+), 298 deletions(-)
diffs (truncated from 801 to 300 lines):
diff -r 5328eec59554 -r 879151f65962 source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibCommon/TComYuv.cpp Thu Mar 13 03:25:06 2014 -0500
@@ -145,15 +145,15 @@ void TComYuv::copyToPartYuv(TComYuv* dst
void TComYuv::copyPartToYuv(TComYuv* dstPicYuv, uint32_t partIdx)
{
pixel* srcY = getLumaAddr(partIdx);
- pixel* dstY = dstPicYuv->getLumaAddr(0);
+ pixel* dstY = dstPicYuv->getLumaAddr();
int part = dstPicYuv->m_part;
primitives.luma_copy_pp[part](dstY, dstPicYuv->getStride(), srcY, getStride());
pixel* srcU = getCbAddr(partIdx);
pixel* srcV = getCrAddr(partIdx);
- pixel* dstU = dstPicYuv->getCbAddr(0);
- pixel* dstV = dstPicYuv->getCrAddr(0);
+ pixel* dstU = dstPicYuv->getCbAddr();
+ pixel* dstV = dstPicYuv->getCrAddr();
primitives.chroma[m_csp].copy_pp[part](dstU, dstPicYuv->getCStride(), srcU, getCStride());
primitives.chroma[m_csp].copy_pp[part](dstV, dstPicYuv->getCStride(), srcV, getCStride());
}
@@ -240,19 +240,19 @@ void TComYuv::copyPartToPartChroma(Short
}
}
-void TComYuv::addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
+void TComYuv::addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t partSize)
{
int part = partitionFromSizes(partSize, partSize);
- addClipLuma(srcYuv0, srcYuv1, trUnitIdx, partSize, part);
- addClipChroma(srcYuv0, srcYuv1, trUnitIdx, partSize >> m_hChromaShift, part);
+ addClipLuma(srcYuv0, srcYuv1, part);
+ addClipChroma(srcYuv0, srcYuv1, part);
}
-void TComYuv::addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part)
+void TComYuv::addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part)
{
- pixel* src0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
- int16_t* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
- pixel* dst = getLumaAddr(trUnitIdx, partSize);
+ pixel* src0 = srcYuv0->getLumaAddr();
+ int16_t* src1 = srcYuv1->getLumaAddr();
+ pixel* dst = getLumaAddr();
uint32_t src0Stride = srcYuv0->getStride();
uint32_t src1Stride = srcYuv1->m_width;
@@ -261,14 +261,14 @@ void TComYuv::addClipLuma(TComYuv* srcYu
primitives.luma_add_ps[part](dst, dststride, src0, src1, src0Stride, src1Stride);
}
-void TComYuv::addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part)
+void TComYuv::addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part)
{
- pixel* srcU0 = srcYuv0->getCbAddr(trUnitIdx, partSize);
- int16_t* srcU1 = srcYuv1->getCbAddr(trUnitIdx, partSize);
- pixel* srcV0 = srcYuv0->getCrAddr(trUnitIdx, partSize);
- int16_t* srcV1 = srcYuv1->getCrAddr(trUnitIdx, partSize);
- pixel* dstU = getCbAddr(trUnitIdx, partSize);
- pixel* dstV = getCrAddr(trUnitIdx, partSize);
+ pixel* srcU0 = srcYuv0->getCbAddr();
+ int16_t* srcU1 = srcYuv1->getCbAddr();
+ pixel* srcV0 = srcYuv0->getCrAddr();
+ int16_t* srcV1 = srcYuv1->getCrAddr();
+ pixel* dstU = getCbAddr();
+ pixel* dstV = getCrAddr();
uint32_t src0Stride = srcYuv0->getCStride();
uint32_t src1Stride = srcYuv1->m_cwidth;
@@ -278,69 +278,6 @@ void TComYuv::addClipChroma(TComYuv* src
primitives.chroma[m_csp].add_ps[part](dstV, dststride, srcV0, srcV1, src0Stride, src1Stride);
}
-void TComYuv::subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- subtractLuma(srcYuv0, srcYuv1, trUnitIdx, partSize);
- subtractChroma(srcYuv0, srcYuv1, trUnitIdx, partSize >> 1);
-}
-
-void TComYuv::subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- int x, y;
-
- pixel* src0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
- pixel* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
- pixel* dst = getLumaAddr(trUnitIdx, partSize);
-
- int src0Stride = srcYuv0->getStride();
- int src1Stride = srcYuv1->getStride();
- int dststride = getStride();
-
- for (y = partSize - 1; y >= 0; y--)
- {
- for (x = partSize - 1; x >= 0; x--)
- {
- dst[x] = src0[x] - src1[x];
- }
-
- src0 += src0Stride;
- src1 += src1Stride;
- dst += dststride;
- }
-}
-
-void TComYuv::subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- int x, y;
-
- pixel* srcU0 = srcYuv0->getCbAddr(trUnitIdx, partSize);
- pixel* srcU1 = srcYuv1->getCbAddr(trUnitIdx, partSize);
- pixel* srcV0 = srcYuv0->getCrAddr(trUnitIdx, partSize);
- pixel* srcV1 = srcYuv1->getCrAddr(trUnitIdx, partSize);
- pixel* dstU = getCbAddr(trUnitIdx, partSize);
- pixel* dstV = getCrAddr(trUnitIdx, partSize);
-
- int src0Stride = srcYuv0->getCStride();
- int src1Stride = srcYuv1->getCStride();
- int dststride = getCStride();
-
- for (y = partSize - 1; y >= 0; y--)
- {
- for (x = partSize - 1; x >= 0; x--)
- {
- dstU[x] = srcU0[x] - srcU1[x];
- dstV[x] = srcV0[x] - srcV1[x];
- }
-
- srcU0 += src0Stride;
- srcU1 += src1Stride;
- srcV0 += src0Stride;
- srcV1 += src1Stride;
- dstU += dststride;
- dstV += dststride;
- }
-}
-
void TComYuv::addAvg(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
{
int x, y;
diff -r 5328eec59554 -r 879151f65962 source/Lib/TLibCommon/TComYuv.h
--- a/source/Lib/TLibCommon/TComYuv.h Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibCommon/TComYuv.h Thu Mar 13 03:25:06 2014 -0500
@@ -140,14 +140,9 @@ public:
// ------------------------------------------------------------------------------------------------------------------
// Clip(srcYuv0 + srcYuv1) -> m_apiBuf
- void addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
- void addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part);
- void addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part);
-
- // srcYuv0 - srcYuv1 -> m_apiBuf
- void subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
- void subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
- void subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
+ void addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t partSize);
+ void addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part);
+ void addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part);
// (srcYuv0 + srcYuv1)/2 for YUV partition
void addAvg(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma);
diff -r 5328eec59554 -r 879151f65962 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Thu Mar 13 03:25:06 2014 -0500
@@ -1584,7 +1584,7 @@ void TEncCu::xFillPCMBuffer(TComDataCU*
uint32_t width = cu->getCUSize(0);
uint32_t height = cu->getCUSize(0);
- Pel* srcY = fencYuv->getLumaAddr(0, width);
+ Pel* srcY = fencYuv->getLumaAddr();
Pel* dstY = cu->getPCMSampleY();
uint32_t srcStride = fencYuv->getStride();
diff -r 5328eec59554 -r 879151f65962 source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp Thu Mar 13 03:25:06 2014 -0500
@@ -1355,7 +1355,7 @@ void TEncSbac::xWriteEpExGolomb(uint32_t
* \param ruiGoRiceParam reference to Rice parameter
* \returns void
*/
-void TEncSbac::xWriteCoefRemainExGolomb(uint32_t symbol, uint32_t ¶m)
+void TEncSbac::xWriteCoefRemainExGolomb(uint32_t symbol, const uint32_t param)
{
int codeNumber = (int)symbol;
uint32_t length;
diff -r 5328eec59554 -r 879151f65962 source/Lib/TLibEncoder/TEncSbac.h
--- a/source/Lib/TLibEncoder/TEncSbac.h Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSbac.h Thu Mar 13 03:25:06 2014 -0500
@@ -147,7 +147,7 @@ private:
void xWriteUnaryMaxSymbol(uint32_t symbol, ContextModel* scmModel, int offset, uint32_t maxSymbol);
void xWriteEpExGolomb(uint32_t symbol, uint32_t count);
- void xWriteCoefRemainExGolomb(uint32_t symbol, uint32_t ¶m);
+ void xWriteCoefRemainExGolomb(uint32_t symbol, const uint32_t param);
void xCopyFrom(TEncSbac* src);
void xCopyContextsFrom(TEncSbac* src);
diff -r 5328eec59554 -r 879151f65962 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Thu Mar 13 03:25:06 2014 -0500
@@ -2049,10 +2049,10 @@ void TEncSearch::IPCMSearch(TComDataCU*
uint32_t chromaOffset = lumaOffset >> 2;
// Luminance
- Pel* fenc = fencYuv->getLumaAddr(0, width);
- int16_t* resi = resiYuv->getLumaAddr(0, width);
- Pel* pred = predYuv->getLumaAddr(0, width);
- Pel* recon = reconYuv->getLumaAddr(0, width);
+ Pel* fenc = fencYuv->getLumaAddr();
+ int16_t* resi = resiYuv->getLumaAddr();
+ Pel* pred = predYuv->getLumaAddr();
+ Pel* recon = reconYuv->getLumaAddr();
Pel* pcm = cu->getPCMSampleY() + lumaOffset;
xEncPCM(cu, 0, fenc, pcm, pred, resi, recon, stride, width, height, TEXT_LUMA);
@@ -2089,18 +2089,6 @@ void TEncSearch::IPCMSearch(TComDataCU*
cu->copyToPic(depth, 0, 0);
}
-uint32_t TEncSearch::xGetInterPredictionError(TComDataCU* cu, int partIdx)
-{
- uint32_t absPartIdx;
- int width, height;
-
- motionCompensation(cu, &m_tmpYuvPred, REF_PIC_LIST_X, partIdx, true, false);
- cu->getPartIndexAndSize(partIdx, absPartIdx, width, height);
- uint32_t cost = m_me.bufSA8D(m_tmpYuvPred.getLumaAddr(absPartIdx), m_tmpYuvPred.getStride());
- x265_emms();
- return cost;
-}
-
/** estimation of best merge coding
* \param cu
* \param fencYuv
@@ -2113,7 +2101,9 @@ uint32_t TEncSearch::xGetInterPrediction
* \param neighCands
* \returns void
*/
-void TEncSearch::xMergeEstimation(TComDataCU* cu, int puIdx, uint32_t& interDir, TComMvField* mvField, uint32_t& mergeIndex, uint32_t& outCost, uint32_t& outbits, TComMvField* mvFieldNeighbours, uint8_t* interDirNeighbours, int& numValidMergeCand)
+void TEncSearch::xMergeEstimation(TComDataCU* cu, int puIdx, uint32_t& interDir, TComMvField* mvField, uint32_t& mergeIndex,
+ uint32_t& outCost, uint32_t& outbits, TComMvField* mvFieldNeighbours, uint8_t* interDirNeighbours,
+ int& numValidMergeCand)
{
uint32_t absPartIdx = 0;
int width = 0;
@@ -2153,7 +2143,8 @@ void TEncSearch::xMergeEstimation(TComDa
cu->getCUMvField(REF_PIC_LIST_1)->m_mv[absPartIdx] = mvFieldNeighbours[1 + 2 * mergeCand].mv;
cu->getCUMvField(REF_PIC_LIST_1)->m_refIdx[absPartIdx] = mvFieldNeighbours[1 + 2 * mergeCand].refIdx;
- uint32_t costCand = xGetInterPredictionError(cu, puIdx);
+ motionCompensation(cu, &m_tmpYuvPred, REF_PIC_LIST_X, puIdx, true, false);
+ uint32_t costCand = m_me.bufSATD(m_tmpYuvPred.getLumaAddr(absPartIdx), m_tmpYuvPred.getStride());
uint32_t bitsCand = mergeCand + 1;
if (mergeCand == m_cfg->param->maxNumMergeCand - 1)
{
@@ -2204,64 +2195,62 @@ void TEncSearch::xRestrictBipredMergeCan
*/
bool TEncSearch::predInterSearch(TComDataCU* cu, TComYuv* predYuv, bool bMergeOnly, bool bChroma)
{
- TComPicYuv *fenc = cu->getSlice()->getPic()->getPicYuvOrg();
- int totalmebits = 0;
+ AMVPInfo amvpInfo[2][MAX_NUM_REF];
/* merge candidate data, cached between calls to xMergeEstimation */
TComMvField mvFieldNeighbours[MRG_MAX_NUM_CANDS << 1];
uint8_t interDirNeighbours[MRG_MAX_NUM_CANDS];
int numValidMergeCand = 0;
- PartSize partSize = cu->getPartitionSize(0);
- int numPart = cu->getNumPartInter();
- if (bMergeOnly && cu->getCUSize(0) > 8 && numPart == 2)
- {
- for (int partIdx = 0; partIdx < numPart; partIdx++)
- {
- uint32_t partAddr;
- int roiWidth, roiHeight;
- cu->getPartIndexAndSize(partIdx, partAddr, roiWidth, roiHeight);
-
- /* xMergeEstimation calls xGetInterPredictionError(), which uses
- * m_me.bufSAD(), which requires the PB size to be initialized */
- Pel* pu = fenc->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr);
- m_me.setSourcePU(pu - fenc->getLumaAddr(), roiWidth, roiHeight);
-
- assert(cu->getPartitionSize(partAddr) != SIZE_2Nx2N);
-
- // find merge cost
- TComMvField mrgMvField[2];
- uint32_t mrgInterDir = 0;
- uint32_t mrgIndex = MAX_UINT;
- uint32_t mrgCost = MAX_UINT;
- uint32_t mrgBits = 0;
- xMergeEstimation(cu, partIdx, mrgInterDir, mrgMvField, mrgIndex, mrgCost, mrgBits, mvFieldNeighbours, interDirNeighbours, numValidMergeCand);
- if (mrgCost == MAX_UINT)
- {
- /* No valid merge modes were found, there is no possible way to
- * perform a valid motion compensation prediction, so early-exit */
- return false;
- }
- // set merge result
More information about the x265-commits
mailing list