[x265] [PATCH] slicetype:lookaheadrow variable initialization using MACRO and removed the init()

Steve Borho steve at borho.org
Tue Oct 29 08:53:07 CET 2013


On Tue, Oct 29, 2013 at 2:41 AM, Gopu Govindaswamy <
gopu at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Gopu Govindaswamy <gopu at multicorewareinc.com>
> # Date 1383032464 -19800
> # Node ID 70f5410baece7d2b1d2c278611dadacf768c2b0e
> # Parent  8846f5cf6d8d1b06496055a1bc756ed4dd3fa1c5
> slicetype:lookaheadrow variable initialization using MACRO and removed the
> init()
>
> diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.cpp
> --- a/source/encoder/slicetype.cpp      Tue Oct 29 01:05:47 2013 -0500
> +++ b/source/encoder/slicetype.cpp      Tue Oct 29 13:11:04 2013 +0530
> @@ -191,6 +191,13 @@
>  }
>
>  #define NUM_CUS (widthInCU > 2 && heightInCU > 2 ? (widthInCU - 2) *
> (heightInCU - 2) : widthInCU * heightInCU)
> +#define INIT(lrows)    lrows.costEst = 0; \
> +    lrows.costEstAq = 0; \
> +    lrows.costIntra = 0; \
> +    lrows.costIntraAq = 0; \
> +    lrows.intraMbs = 0; \
> +    lrows.active = false; \
> +    lrows.completed = 0;
>

All this does is obsfucate the initialization, which was only done in one
place to begin with.

The functions which need to be cleaned up are ones like these:

TShortYUV::clear, TComDataCU::initCU, TComDataCU::initSubCU,
TComDataCU::setSubPart

And these aren't quick tasks, each function needs to be carefully analyzed
to figure out how much is necessary and what can be left out, and which
memsets could be combined.


>  int Lookahead::estimateFrameCost(int p0, int p1, int b, bool
> bIntraPenalty)
>  {
> @@ -218,7 +225,8 @@
>
>          for (int i = 0; i < heightInCU; i++)
>          {
> -            lhrows[i].init();
> +            LookaheadRow &lrows = lhrows[i];
> +            INIT(lrows);
>              lhrows[i].me.setSourcePlane(fenc->lowresPlane[0],
> fenc->lumaStride);
>          }
>
> @@ -275,17 +283,6 @@
>      return score;
>  }
>
> -void LookaheadRow::init()
> -{
> -    costEst = 0;
> -    costEstAq = 0;
> -    costIntra = 0;
> -    costIntraAq = 0;
> -    intraMbs = 0;
> -    active = false;
> -    completed = 0;
> -}
> -
>  void LookaheadRow::estimateCUCost(int cux, int cuy, int p0, int p1, int
> b, bool bDoSearch[2])
>  {
>      Lowres *fref0 = frames[p0];
> diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.h
> --- a/source/encoder/slicetype.h        Tue Oct 29 01:05:47 2013 -0500
> +++ b/source/encoder/slicetype.h        Tue Oct 29 13:11:04 2013 +0530
> @@ -67,7 +67,6 @@
>          X265_FREE(predictions);
>      }
>
> -    void init();
>
>      void estimateCUCost(int cux, int cuy, int p0, int p1, int b, bool
> bDoSearch[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: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131029/6eb7f267/attachment-0001.html>


More information about the x265-devel mailing list