[x265] [PATCH] Replaced referance parameter for setDistParam

Steve Borho steve at borho.org
Thu Jul 11 20:07:01 CEST 2013


On Thu, Jul 11, 2013 at 3:40 AM, <praveen at multicorewareinc.com> wrote:

> # HG changeset patch
> # User praveentiwari
> # Date 1373532017 -19800
> # Node ID 7e7b6f6aba0910ba37310f1ececcf42326949e2e
> # Parent  2245a4a8b34da61d4d572b40f10024a4f1013030
> Replaced referance parameter for setDistParam
>

Can't push this one, in this case the use of reference is correct.  The
caller is passing a structure and expects it to be modified.

The places where the HM does this incorrectly are usually pointer
references like this:  TComPic*& rpcRecoYuv
In this case, the recon YUV is an output, it it is entirely retarded to
pass in the pointer to it as a reference unless the function is expected to
move the pointer to another TComPic.  If the function does not do:
 rpcRecoYuv = new TComPic; or some other assignment to the pointer itself,
then you can remove the reference as you remove the hungarian notation.


> diff -r 2245a4a8b34d -r 7e7b6f6aba09 source/Lib/TLibCommon/TComRdCost.cpp
> --- a/source/Lib/TLibCommon/TComRdCost.cpp      Wed Jul 10 22:28:41 2013
> -0500
> +++ b/source/Lib/TLibCommon/TComRdCost.cpp      Thu Jul 11 14:10:17 2013
> +0530
> @@ -118,7 +118,7 @@
>  }
>
>  // Setting the Distortion Parameter for Inter (ME)
> -Void TComRdCost::setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride, DistParam& rcDistParam)
> +Void TComRdCost::setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride, DistParam rcDistParam)
>  {
>      // set Original & Curr Pointer / Stride
>      rcDistParam.fenc = patternKey->getROIY();
> @@ -150,7 +150,7 @@
>  }
>
>  // Setting the Distortion Parameter for Inter (subpel ME with step)
> -Void TComRdCost::setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME)
> +Void TComRdCost::setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride, Int iStep, DistParam rcDistParam, Bool bHADME)
>  {
>      // set Original & Curr Pointer / Stride
>      rcDistParam.fenc = patternKey->getROIY();
> diff -r 2245a4a8b34d -r 7e7b6f6aba09 source/Lib/TLibCommon/TComRdCost.h
> --- a/source/Lib/TLibCommon/TComRdCost.h        Wed Jul 10 22:28:41 2013
> -0500
> +++ b/source/Lib/TLibCommon/TComRdCost.h        Thu Jul 11 14:10:17 2013
> +0530
> @@ -204,8 +204,8 @@
>      // Distortion Functions
>      Void    init();
>
> -    Void    setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride,            DistParam& rcDistParam);
> -    Void    setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME = false);
> +    Void    setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride,            DistParam rcDistParam);
> +    Void    setDistParam(TComPattern* patternKey, Pel* piRefY, Int
> iRefStride, Int iStep, DistParam rcDistParam, Bool bHADME = false);
>
>  private:
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> http://mailman.videolan.org/listinfo/x265-devel
>



-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130711/cb5af648/attachment.html>


More information about the x265-devel mailing list