[x265] motion: set search method/subpel refine for each PU
Deepthi Nandakumar
deepthi at multicorewareinc.com
Wed Mar 2 12:32:03 CET 2016
# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1456913895 -19800
# Wed Mar 02 15:48:15 2016 +0530
# Node ID 09897438eb2c4d95ff773ae716b4f211f5d3e1b3
# Parent 81a6c44e9e4acfcd64d260914886e0039877c10e
motion: set search method/subpel refine for each PU
diff -r 81a6c44e9e4a -r 09897438eb2c source/encoder/motion.cpp
--- a/source/encoder/motion.cpp Wed Mar 02 15:34:41 2016 +0530
+++ b/source/encoder/motion.cpp Wed Mar 02 15:48:15 2016 +0530
@@ -111,10 +111,8 @@
chromaSatd = NULL;
}
-void MotionEstimate::init(int method, int refine, int csp)
+void MotionEstimate::init(int csp)
{
- searchMethod = method;
- subpelRefine = refine;
fencPUYuv.create(FENC_STRIDE, csp);
}
@@ -162,7 +160,7 @@
}
/* Called by lookahead, luma only, no use of PicYuv */
-void MotionEstimate::setSourcePU(pixel *fencY, intptr_t stride, intptr_t
offset, int pwidth, int pheight)
+void MotionEstimate::setSourcePU(pixel *fencY, intptr_t stride, intptr_t
offset, int pwidth, int pheight, const int method, const int refine)
{
partEnum = partitionFromSizes(pwidth, pheight);
X265_CHECK(LUMA_4x4 != partEnum, "4x4 inter partition detected!\n");
@@ -175,13 +173,17 @@
blockOffset = offset;
absPartIdx = ctuAddr = -1;
+ /* Search params */
+ searchMethod = method;
+ subpelRefine = refine;
+
/* copy PU block into cache */
primitives.pu[partEnum].copy_pp(fencPUYuv.m_buf[0], FENC_STRIDE, fencY
+ offset, stride);
X265_CHECK(!bChromaSATD, "chroma distortion measurements impossible in
this code path\n");
}
/* Called by Search::predInterSearch() or --pme equivalent, chroma
residual might be considered */
-void MotionEstimate::setSourcePU(const Yuv& srcFencYuv, int _ctuAddr, int
cuPartIdx, int puPartIdx, int pwidth, int pheight)
+void MotionEstimate::setSourcePU(const Yuv& srcFencYuv, int _ctuAddr, int
cuPartIdx, int puPartIdx, int pwidth, int pheight, const int method, const
int refine)
{
partEnum = partitionFromSizes(pwidth, pheight);
X265_CHECK(LUMA_4x4 != partEnum, "4x4 inter partition detected!\n");
@@ -192,6 +194,10 @@
chromaSatd = primitives.chroma[fencPUYuv.m_csp].pu[partEnum].satd;
+ /* Set search characteristics */
+ searchMethod = method;
+ subpelRefine = refine;
+
/* Enable chroma residual cost if subpelRefine level is greater than 2
and chroma block size
* is an even multiple of 4x4 pixels (indicated by non-null chromaSatd
pointer) */
bChromaSATD = subpelRefine > 2 && chromaSatd && (srcFencYuv.m_csp !=
X265_CSP_I400);
diff -r 81a6c44e9e4a -r 09897438eb2c source/encoder/motion.h
--- a/source/encoder/motion.h Wed Mar 02 15:34:41 2016 +0530
+++ b/source/encoder/motion.h Wed Mar 02 15:48:15 2016 +0530
@@ -70,12 +70,12 @@
static void initScales();
static int hpelIterationCount(int subme);
- void init(int method, int refine, int csp);
+ void init(int csp);
/* Methods called at slice setup */
- void setSourcePU(pixel *fencY, intptr_t stride, intptr_t offset, int
pwidth, int pheight);
- void setSourcePU(const Yuv& srcFencYuv, int ctuAddr, int cuPartIdx,
int puPartIdx, int pwidth, int pheight);
+ void setSourcePU(pixel *fencY, intptr_t stride, intptr_t offset, int
pwidth, int pheight, const int searchMethod, const int subpelRefine);
+ void setSourcePU(const Yuv& srcFencYuv, int ctuAddr, int cuPartIdx,
int puPartIdx, int pwidth, int pheight, const int searchMethod, const int
subpelRefine);
/* buf*() and motionEstimate() methods all use cached fenc pixels and
thus
* require setSourcePU() to be called prior. */
diff -r 81a6c44e9e4a -r 09897438eb2c source/encoder/search.cpp
--- a/source/encoder/search.cpp Wed Mar 02 15:34:41 2016 +0530
+++ b/source/encoder/search.cpp Wed Mar 02 15:48:15 2016 +0530
@@ -77,7 +77,7 @@
m_numLayers = g_log2Size[param.maxCUSize] - 2;
m_rdCost.setPsyRdScale(param.psyRd);
- m_me.init(param.searchMethod, param.subpelRefine, param.internalCsp);
+ m_me.init(param.internalCsp);
bool ok = m_quant.init(param.psyRdoq, scalingList, m_entropyCoder);
if (m_param->noiseReductionIntra || m_param->noiseReductionInter ||
m_param->rc.vbvBufferSize)
@@ -1976,7 +1976,7 @@
slave.m_frame = m_frame;
slave.m_param = m_param;
slave.setLambdaFromQP(pme.mode.cu, m_rdCost.m_qp);
- slave.m_me.setSourcePU(*pme.mode.fencYuv, pme.pu.ctuAddr,
pme.pu.cuAbsPartIdx, pme.pu.puAbsPartIdx, pme.pu.width, pme.pu.height);
+ slave.m_me.setSourcePU(*pme.mode.fencYuv, pme.pu.ctuAddr,
pme.pu.cuAbsPartIdx, pme.pu.puAbsPartIdx, pme.pu.width, pme.pu.height,
m_param->searchMethod, m_param->subpelRefine);
}
/* Perform ME, repeat until no more work is available */
@@ -2076,7 +2076,7 @@
MotionData* bestME = interMode.bestME[puIdx];
PredictionUnit pu(cu, cuGeom, puIdx);
- m_me.setSourcePU(*interMode.fencYuv, pu.ctuAddr, pu.cuAbsPartIdx,
pu.puAbsPartIdx, pu.width, pu.height);
+ m_me.setSourcePU(*interMode.fencYuv, pu.ctuAddr, pu.cuAbsPartIdx,
pu.puAbsPartIdx, pu.width, pu.height, m_param->searchMethod,
m_param->subpelRefine);
/* find best cost merge candidate. note: 2Nx2N merge and bidir are
handled as separate modes */
uint32_t mrgCost = numPart == 1 ? MAX_UINT : mergeEstimation(cu,
cuGeom, pu, puIdx, merge);
diff -r 81a6c44e9e4a -r 09897438eb2c source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp Wed Mar 02 15:34:41 2016 +0530
+++ b/source/encoder/slicetype.cpp Wed Mar 02 15:48:15 2016 +0530
@@ -2081,7 +2081,7 @@
const intptr_t pelOffset = cuSize * cuX + cuSize * cuY *
fenc->lumaStride;
if (bBidir || bDoSearch[0] || bDoSearch[1])
- tld.me.setSourcePU(fenc->lowresPlane[0], fenc->lumaStride,
pelOffset, cuSize, cuSize);
+ tld.me.setSourcePU(fenc->lowresPlane[0], fenc->lumaStride,
pelOffset, cuSize, cuSize, X265_HEX_SEARCH, 1);
/* A small, arbitrary bias to avoid VBV problems caused by
zero-residual lookahead blocks. */
int lowresPenalty = 4;
diff -r 81a6c44e9e4a -r 09897438eb2c source/encoder/slicetype.h
--- a/source/encoder/slicetype.h Wed Mar 02 15:34:41 2016 +0530
+++ b/source/encoder/slicetype.h Wed Mar 02 15:48:15 2016 +0530
@@ -60,8 +60,8 @@
LookaheadTLD()
{
+ me.init(X265_CSP_I400);
me.setQP(X265_LOOKAHEAD_QP);
- me.init(X265_HEX_SEARCH, 1, X265_CSP_I400);
for (int i = 0; i < 4; i++)
wbuffer[i] = NULL;
widthInCU = heightInCU = ncu = paddedLines = 0;
--
Deepthi Nandakumar
Engineering Manager, x265
Multicoreware, Inc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160302/17d7b6ea/attachment-0001.html>
More information about the x265-devel
mailing list