[x265] [PATCH] motion: bypass the ME search if any of MVC Cost is Zero
Steve Borho
steve at borho.org
Thu Jun 25 18:01:53 CEST 2015
On 06/25, gopu at multicorewareinc.com wrote:
> # HG changeset patch
> # User Gopu Govindaswamy <gopu at multicorewareinc.com>
> # Date 1435217502 -19800
> # Thu Jun 25 13:01:42 2015 +0530
> # Node ID 58a40cd36ed9aa5c5ab94bb8ab2cda8c36a12b05
> # Parent b1af4c36f48a4500a4912373ebcda9a5540b5c15
> motion: bypass the ME search if any of MVC Cost is Zero
>
> diff -r b1af4c36f48a -r 58a40cd36ed9 source/encoder/motion.cpp
> --- a/source/encoder/motion.cpp Wed Jun 24 10:36:15 2015 -0500
> +++ b/source/encoder/motion.cpp Thu Jun 25 13:01:42 2015 +0530
> @@ -616,6 +616,7 @@
> MV pmv = qmvp.clipped(qmvmin, qmvmax);
> MV bestpre = pmv;
> int bprecost;
> + int mvcCost = COST_MAX;
>
> if (ref->isLowres)
> bprecost = ref->lowresQPelCost(fenc, blockOffset, pmv, sad);
> @@ -650,7 +651,7 @@
> int cost = ref->lowresQPelCost(fenc, blockOffset, m, sad) + mvcost(m);
> if (cost < bprecost)
> {
> - bprecost = cost;
> + mvcCost = bprecost = cost;
how is mvcCost different from bprecost?
> bestpre = m;
> }
> }
> @@ -666,7 +667,7 @@
> int cost = subpelCompare(ref, m, sad) + mvcost(m);
> if (cost < bprecost)
> {
> - bprecost = cost;
> + mvcCost = bprecost = cost;
> bestpre = m;
> }
> }
> @@ -676,6 +677,10 @@
> pmv = pmv.roundToFPel();
> MV omv = bmv; // current search origin or starting point
>
> + //bypass the ME search if any of MVC Cost is Zero
space after //
> + if (!mvcCost)
> + goto me_early_exit;
blech
All this needs to do, in theory, is that if it finds an MVC with 0 sad
cost, then it immediately returns with sad + mvcost(mvc).
it's possible there are multiple MVC candidates with 0 sad cost, in
which case we would want to return the one with the cheapest mv cost.
but this may not be worth the trouble (especially since a different AMVP
may be selected after motion estimation returns).
> switch (searchMethod)
> {
> case X265_DIA_SEARCH:
> @@ -1112,6 +1117,8 @@
> break;
> }
>
> +me_early_exit:
> +
> if (bprecost < bcost)
> {
> bmv = bestpre;
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
--
Steve Borho
More information about the x265-devel
mailing list