[x265] [PATCH] Removed hungarian notation and code cleanup for xDeQuant vector code

Steve Borho steve at borho.org
Sat Jul 6 21:57:33 CEST 2013


On Mon, Jul 1, 2013 at 7:07 AM, <praveen at multicorewareinc.com> wrote:

> # HG changeset patch
> # User praveentiwari
> # Date 1372680448 -19800
> # Node ID 5766e704039448240efce7c633b1f5fd4b2d0b2e
> # Parent  30c0e5591120904f989953e9c74038253d607e45
> Removed hungarian notation and code cleanup for xDeQuant vector code
>
> diff -r 30c0e5591120 -r 5766e7040394 source/common/vec/dct.inc
> --- a/source/common/vec/dct.inc Sun Jun 30 00:03:01 2013 -0500
> +++ b/source/common/vec/dct.inc Mon Jul 01 17:37:28 2013 +0530
> @@ -44,72 +44,72 @@
>  #define IF_FILTER_PREC    6 ///< Log2 of sum of filter taps
>  #define IF_INTERNAL_OFFS (1 << (IF_INTERNAL_PREC - 1)) ///< Offset used
> internally
>
> -void xDeQuant(int bitDepth, const int* pSrc, int* pDes, int iWidth, int
> iHeight, int iPer, int iRem, bool useScalingList, unsigned int
> uiLog2TrSize, int *piDequantCoefOrig)
> +void xDeQuant(int bitDepth, const int* src, int* dst, int width, int
> height, int per, int rem, bool useScalingList, unsigned int log2TrSize, int
> *deQuantCoefOrig)
>

would prefer simpler "dequant" function name


>  {
> -    const int* piQCoef = pSrc;
> -    int* piCoef = pDes;
> +    const int* qCoef = src;
> +    int* coef = dst;
>
>      int g_invQuantScales[6] = { 40, 45, 51, 57, 64, 72 };
>
> -    if (iWidth > 32)
> +    if (width > 32)
>      {
> -        iWidth  = 32;
> -        iHeight = 32;
> +        width  = 32;
> +        height = 32;
>      }
>
> -    int iShift, iAdd;
> -
> -    int iTransformShift = 15 - bitDepth - uiLog2TrSize;
> -
> -    iShift = 6 - iTransformShift;
> +    int shift, valueToAdd;
> +
> +    int transformShift = 15 - bitDepth - log2TrSize;
> +
> +    shift = 6 - transformShift;
>
>      if (useScalingList)
>      {
> -        iShift += 4;
> -        int *piDequantCoef = piDequantCoefOrig;
> -
> -        if (iShift > iPer)
> +        shift += 4;
> +        int *deQuantCoef = deQuantCoefOrig;
> +
> +        if (shift > per)
>          {
> -            iAdd = 1 << (iShift - iPer - 1);
> -            Vec4i IAdd(iAdd);
> -
> -            for (int n = 0; n < iWidth * iHeight; n = n + 8)
> +            valueToAdd = 1 << (shift - per - 1);
> +            Vec4i IAdd(valueToAdd);
> +
> +            for (int n = 0; n < width * height; n = n + 8)
>              {
>                  Vec4i qCoef1, qCoef2, deQuantCoef1, deQuantCoef2;
>
> -                qCoef1.load(piQCoef + n);
> -                qCoef2.load(piQCoef + n + 4);
> -
> -                deQuantCoef1.load(piDequantCoef + n);
> -                deQuantCoef2.load(piDequantCoef + n + 4);
> +                qCoef1.load(qCoef + n);
> +                qCoef2.load(qCoef + n + 4);
> +
> +                deQuantCoef1.load(deQuantCoef + n);
> +                deQuantCoef2.load(deQuantCoef + n + 4);
>
>                  Vec8s qCoef12 = compress_saturated(qCoef1, qCoef2);
>
>                  qCoef1 = extend_low(qCoef12);
>                  qCoef2 = extend_high(qCoef12);
>
> -                qCoef1 =  (qCoef1 *  deQuantCoef1 + IAdd) >> (iShift -
> iPer);
> -                qCoef2 =  (qCoef2 *  deQuantCoef2 + IAdd) >> (iShift -
> iPer);
> +                qCoef1 =  (qCoef1 *  deQuantCoef1 + IAdd) >> (shift -
> per);
> +                qCoef2 =  (qCoef2 *  deQuantCoef2 + IAdd) >> (shift -
> per);
>
>                  qCoef12 = compress_saturated(qCoef1, qCoef2);
>
>                  qCoef1 = extend_low(qCoef12);
> -                qCoef1.store(piCoef + n);
> +                qCoef1.store(coef + n);
>                  qCoef2 = extend_high(qCoef12);
> -                qCoef2.store(piCoef + n + 4);
> +                qCoef2.store(coef + n + 4);
>              }
>          }
>          else
>          {
> -            for (int n = 0; n < iWidth * iHeight; n = n + 8)
> +            for (int n = 0; n < width * height; n = n + 8)
>              {
>                  Vec4i qCoef1, qCoef2, deQuantCoef1, deQuantCoef2;
>
> -                qCoef1.load(piQCoef + n);
> -                qCoef2.load(piQCoef + n + 4);
> -
> -                deQuantCoef1.load(piDequantCoef + n);
> -                deQuantCoef2.load(piDequantCoef + n + 4);
> +                qCoef1.load(qCoef + n);
> +                qCoef2.load(qCoef + n + 4);
> +
> +                deQuantCoef1.load(deQuantCoef + n);
> +                deQuantCoef2.load(deQuantCoef + n + 4);
>
>                  Vec8s qCoef12 = compress_saturated(qCoef1, qCoef2);
>
> @@ -124,46 +124,46 @@
>                  qCoef1 = extend_low(qCoef12);
>                  qCoef2 = extend_high(qCoef12);
>
> -                qCoef1 = qCoef1 << (iPer - iShift);
> -                qCoef2 = qCoef2 << (iPer - iShift);
> +                qCoef1 = qCoef1 << (per - shift);
> +                qCoef2 = qCoef2 << (per - shift);
>
>                  qCoef12 = compress_saturated(qCoef1, qCoef2);
>
>                  qCoef1 = extend_low(qCoef12);
> -                qCoef1.store(piCoef + n);
> +                qCoef1.store(coef + n);
>                  qCoef2 = extend_high(qCoef12);
> -                qCoef2.store(piCoef + n + 4);
> +                qCoef2.store(coef + n + 4);
>              }
>          }
>      }
>      else
>      {
> -        iAdd = 1 << (iShift - 1);
> -        int scale = g_invQuantScales[iRem] << iPer;
> +        valueToAdd = 1 << (shift - 1);
> +        int scale = g_invQuantScales[rem] << per;
>
>          Vec4i Scale(scale);
> -        Vec4i IAdd(iAdd);
> -
> -        for (int n = 0; n < iWidth * iHeight; n = n + 8)
> +        Vec4i IAdd(valueToAdd);
> +
> +        for (int n = 0; n < width * height; n = n + 8)
>          {
>              Vec4i qCoef1, qCoef2;
> -            qCoef1.load(piQCoef + n);
> -            qCoef2.load(piQCoef + n + 4);
> +            qCoef1.load(qCoef + n);
> +            qCoef2.load(qCoef + n + 4);
>
>              Vec8s qCoef12 = compress_saturated(qCoef1, qCoef2);
>
>              qCoef1 = extend_low(qCoef12);
>              qCoef2 = extend_high(qCoef12);
>
> -            qCoef1 = (qCoef1 * Scale + IAdd) >> iShift;
> -            qCoef2 = (qCoef2 * Scale + IAdd) >> iShift;
> +            qCoef1 = (qCoef1 * Scale + IAdd) >> shift;
> +            qCoef2 = (qCoef2 * Scale + IAdd) >> shift;
>
>              qCoef12 = compress_saturated(qCoef1, qCoef2);
>
>              qCoef1 = extend_low(qCoef12);
> -            qCoef1.store(piCoef + n);
> +            qCoef1.store(coef + n);
>              qCoef2 = extend_high(qCoef12);
> -            qCoef2.store(piCoef + n + 4);
> +            qCoef2.store(coef + n + 4);
>          }
>      }
>  }
> _______________________________________________
> 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/20130706/19e2e632/attachment-0001.html>


More information about the x265-devel mailing list