[x265] [PATCH] added pixelsub_ps C primitive and function pointer creation

praveen at multicorewareinc.com praveen at multicorewareinc.com
Thu Nov 7 08:01:45 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1383807695 -19800
# Node ID 34ba8955747b66dcf3471fa216d15b97a3b07e0c
# Parent  93cccbe49a93dd4c054ef06aca76974948793613
added pixelsub_ps C primitive and function pointer creation

diff -r 93cccbe49a93 -r 34ba8955747b source/common/pixel.cpp
--- a/source/common/pixel.cpp	Wed Nov 06 19:49:38 2013 -0600
+++ b/source/common/pixel.cpp	Thu Nov 07 12:31:35 2013 +0530
@@ -790,6 +790,22 @@
         b += strideb;
     }
 }
+
+template<int bx, int by>
+void pixelsub_ps_c(int16_t *a, intptr_t dstride, pixel *b0, pixel *b1, intptr_t sstride0, intptr_t sstride1)
+{
+    for (int y = 0; y < by; y++)
+    {
+        for (int x = 0; x < bx; x++)
+        {
+            a[x] = (int16_t)(b0[x] - b1[x]);
+        }
+
+        b0 += sstride0;
+        b1 += sstride1;
+        a += dstride;
+    }
+}
 }  // end anonymous namespace
 
 namespace x265 {
@@ -832,10 +848,12 @@
 
 #define CHROMA(W, H) \
     p.chroma_copy_pp[CHROMA_ ## W ## x ## H] = blockcopy_pp_c<W, H>; \
-    p.chroma_copy_sp[CHROMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>;
+    p.chroma_copy_sp[CHROMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>;\
+    p.chroma_pixelsub_ps[CHROMA_ ## W ## x ## H] = pixelsub_ps_c<W, H>;
 #define LUMA(W, H) \
     p.luma_copy_pp[LUMA_ ## W ## x ## H] = blockcopy_pp_c<W, H>; \
-    p.luma_copy_sp[LUMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>;
+    p.luma_copy_sp[LUMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>;\
+    p.luma_pixelsub_ps[LUMA_ ## W ## x ## H] = pixelsub_ps_c<W, H>;
 
     LUMA(4, 4);
     LUMA(8, 8);
diff -r 93cccbe49a93 -r 34ba8955747b source/common/primitives.h
--- a/source/common/primitives.h	Wed Nov 06 19:49:38 2013 -0600
+++ b/source/common/primitives.h	Thu Nov 07 12:31:35 2013 +0530
@@ -216,6 +216,8 @@
 typedef void (*copy_pp_t)(pixel *dst, intptr_t dstride, pixel *src, intptr_t sstride); // dst is aligned
 typedef void (*copy_sp_t)(pixel *dst, intptr_t dstStride, int16_t *src, intptr_t srcStride);
 
+typedef void (*pixelsub_ps_t)(int16_t *dst, intptr_t dstStride, pixel *src0, pixel *src1, intptr_t srcStride0, intptr_t srcStride1);
+
 /* Define a structure containing function pointers to optimized encoder
  * primitives.  Each pointer can reference either an assembly routine,
  * a vectorized primitive, or a C function. */
@@ -283,6 +285,9 @@
     pixeladd_pp_t   pixeladd_pp;
     pixelavg_pp_t   pixelavg_pp[NUM_LUMA_PARTITIONS];
 
+    pixelsub_ps_t   chroma_pixelsub_ps[NUM_CHROMA_PARTITIONS];
+    pixelsub_ps_t   luma_pixelsub_ps[NUM_LUMA_PARTITIONS];
+
     scale_t         scale1D_128to64;
     scale_t         scale2D_64to32;
     downscale_t     frame_init_lowres_core;


More information about the x265-devel mailing list