[x265] [PATCH] primitves: add c primitives for the following :

Aarthi Priya Thirumalai aarthi at multicorewareinc.com
Sat Oct 12 05:21:25 CEST 2013


On Oct 12, 2013 3:33 AM, "Steve Borho" <steve at borho.org> wrote:
>
>
>
>
> On Fri, Oct 11, 2013 at 5:40 AM, Aarthi Thirumalai <
aarthi at multicorewareinc.com> wrote:
>>
>> # HG changeset patch
>> # User Aarthi Thirumalai
>> # Date 1381488011 -19800
>> #      Fri Oct 11 16:10:11 2013 +0530
>> # Node ID 9b9c6766967dc99cab93c3e09514346606125b3e
>> # Parent  c6d89dc62e191f56f63dbcb1781a6494da50a70d
>> primitves: add c primitives for the following :
>>
>> compute AC energy for each block
>> copy pixels of chroma plane
>>
>> diff -r c6d89dc62e19 -r 9b9c6766967d source/common/pixel.cpp
>> --- a/source/common/pixel.cpp   Fri Oct 11 01:47:53 2013 -0500
>> +++ b/source/common/pixel.cpp   Fri Oct 11 16:10:11 2013 +0530
>> @@ -688,6 +688,33 @@
>>      }
>>      return ssim;
>>  }
>> +
>> +template<int w, int h>
>> +uint64_t pixel_var(pixel *pix, intptr_t i_stride)
>> +{
>> +    uint32_t sum = 0, sqr = 0;
>> +    for (int y = 0; y < h; y++)
>> +    {
>> +        for (int x = 0; x < w; x++)
>> +        {
>> +            sum += pix[x];
>> +            sqr += pix[x] * pix[x];
>> +        }
>> +        pix += i_stride;
>> +    }
>> +    return sum + ((uint64_t)sqr << 32);
>> +}
>> +
>
>
> we should to add a _c suffix to the C primitives, I know we haven't been
consistent with that but we should try to catch up
>
>>
>> +void plane_copy_deinterleave_chroma(pixel *dstu, intptr_t dstuStride,
pixel *dstv, intptr_t dstvStride,
>> +                                    pixel *src,  intptr_t srcStride,
int w, int h)
>> +{
>> +    for (int y = 0; y < h; y++, dstu += dstuStride, dstv += dstvStride,
src += srcStride)
>> +        for (int x = 0; x < w; x++)
>> +        {
>> +            dstu[x] = src[2 * x];
>> +            dstv[x] = src[2 * x + 1];
>> +        }
>> +}
>>  }  // end anonymous namespace
>>
>>  namespace x265 {
>> @@ -905,5 +932,9 @@
>>      p.frame_init_lowres_core = frame_init_lowres_core;
>>      p.ssim_4x4x2_core = ssim_4x4x2_core;
>>      p.ssim_end_4 = ssim_end_4;
>> +
>> +    p.var[PARTITION_16x16] = pixel_var<16,16>;
>> +    p.var[PARTITION_8x8] = pixel_var<8,8>;
>> +    p.plane_copy_deinterleave_c = plane_copy_deinterleave_chroma;
>>  }
>>  }
>> diff -r c6d89dc62e19 -r 9b9c6766967d source/common/primitives.h
>> --- a/source/common/primitives.h        Fri Oct 11 01:47:53 2013 -0500
>> +++ b/source/common/primitives.h        Fri Oct 11 16:10:11 2013 +0530
>> @@ -202,6 +202,8 @@
>>  typedef void (*extendCURowBorder_t)(pixel* txt, intptr_t stride, int
width, int height, int marginX);
>>  typedef void (*ssim_4x4x2_core_t)(const pixel *pix1, intptr_t stride1,
const pixel *pix2, intptr_t stride2, ssim_t sums[2][4]);
>>  typedef float (*ssim_end4_t)(ssim_t sum0[5][4], ssim_t sum1[5][4], int
width);
>> +typedef uint64_t (*var_t)(pixel *pix, intptr_t stride);
>> +typedef void (*plane_copy_deinterleave_t)(pixel *dstu, intptr_t
dstuStride, pixel *dstv, intptr_t dstvStride, pixel *src,  intptr_t
srcStride, int w, int h);
>>
>>  /* Define a structure containing function pointers to optimized encoder
>>   * primitives.  Each pointer can reference either an assembly routine,
>> @@ -261,6 +263,8 @@
>>      downscale_t     frame_init_lowres_core;
>>      ssim_4x4x2_core_t ssim_4x4x2_core;
>>      ssim_end4_t       ssim_end_4;
>> +    var_t             var[NUM_PARTITIONS];
>> +    plane_copy_deinterleave_t plane_copy_deinterleave_c;
>
>
> does the _c at the end here imply chroma?
Yes. Implies chroma
>
>>
>>  };
>>
>>  /* This copy of the table is what gets used by the encoder.
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>
>
>
>
> --
> Steve Borho
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131012/1ebee37c/attachment.html>


More information about the x265-devel mailing list