[x265] [PATCH] slicetype: selected best cu cost and added into rowsatd, lowrescost, costest and intrambs

Steve Borho steve at borho.org
Wed Aug 14 11:14:55 CEST 2013


On Wed, Aug 14, 2013 at 3:46 AM, <gopu at multicorewareinc.com> wrote:

> # HG changeset patch
> # User ggopu
> # Date 1376469957 -19800
> # Node ID 80b5866ef7565be1e07d94c0a0a90543f416d106
> # Parent  11cce4de927a519602849cb0e206753da4c4759c
> slicetype: selected best cu cost and added into rowsatd, lowrescost,
> costest and intrambs
>
> diff -r 11cce4de927a -r 80b5866ef756 source/encoder/slicetype.cpp
> --- a/source/encoder/slicetype.cpp      Wed Aug 14 00:59:31 2013 -0500
> +++ b/source/encoder/slicetype.cpp      Wed Aug 14 14:15:57 2013 +0530
> @@ -192,7 +192,7 @@
>      return score;
>  }
>
> -int Lookahead::estimateCUCost(int cux, int cuy, int p0, int p1, int b,
> int do_search[2])
> +void Lookahead::estimateCUCost(int cux, int cuy, int p0, int p1, int b,
> int do_search[2])
>  {
>      LookaheadFrame *fref0 = frames[p0];
>      LookaheadFrame *fref1 = frames[p1];
> @@ -251,10 +251,10 @@
>          // TODO: add bidir
>      }
>
> +    int bcost = me.COST_MAX, cost;
>      if (!fenc->bIntraCalculated)
>      {
>          Int nLog2SizeMinus2 = g_convertToBit[cu_size]; // partition size
> -        int bcost = me.COST_MAX, cost;
>
>          fenc->bIntraCalculated = true;
>
> @@ -294,8 +294,25 @@
>          }
>          fenc->lowresMvCosts[0][0][cu_xy] = bcost;
>      }
> -
> -    return 0;
> +
> +    if (!b_bidir)
> +    {
> +        int icost = *fenc_costs[0];
> +        /* best inter cost */
> +        if(*fenc_costs[1] < icost)  icost = *fenc_costs[1];
>

this should just be:
  int bestInterCost = X265_MIN(*fenc_costs[0], *fenc_costs[1]);


> +
> +        /* best CU cost */
> +        if(icost < bcost)  bcost = icost;
>

space between if and ()


> +
> +        fenc->intraMbs[b - p0] += bcost;
>

intraMBs is supposed to be a count of macroblocks which had intra best cost


> +    }
>

for bidir estimations, bcost is not taking inter into account, which makes
all the lines below wrong


> +
> +    if (p0 != p1)
> +    {
> +        fenc->rowSatds[b - p0][p1 - b][cuy] += bcost;
> +        fenc->costEst[b - p0][p1 - b] += bcost;
> +        fenc->lowresCosts[b - p0][p1 -b][cu_xy] += (uint16_t) bcost;
>

you should be assigning lowresCost of the CU here, not incrementing


> +    }
>  }
>
>  #if 0
> diff -r 11cce4de927a -r 80b5866ef756 source/encoder/slicetype.h
> --- a/source/encoder/slicetype.h        Wed Aug 14 00:59:31 2013 -0500
> +++ b/source/encoder/slicetype.h        Wed Aug 14 14:15:57 2013 +0530
> @@ -60,7 +60,7 @@
>      void slicetypeDecide();
>
>      int estimateFrameCost(int p0, int p1, int b, int bIntraPenalty);
> -    int estimateCUCost(int cux, int cuy, int p0, int p1, int b, int
> do_search[2]);
> +    void estimateCUCost(int cux, int cuy, int p0, int p1, int b, int
> do_search[2]);
>  };
>
>  }
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>



-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.videolan.org/private/x265-devel/attachments/20130814/823cd7dd/attachment-0001.html>


More information about the x265-devel mailing list