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