[x265] [PATCH] added pixel_add_ps_c as a primitve

praveen at multicorewareinc.com praveen at multicorewareinc.com
Wed Nov 20 08:25:52 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1384932328 -19800
# Node ID ac2997ec873a64a5c27a6e94b18c5d7879ffdaf0
# Parent  f38139868da6d4336953cd7662d751b11ab3aa1e
added pixel_add_ps_c as a primitve

diff -r f38139868da6 -r ac2997ec873a source/common/pixel.cpp
--- a/source/common/pixel.cpp	Tue Nov 19 12:33:08 2013 -0600
+++ b/source/common/pixel.cpp	Wed Nov 20 12:55:28 2013 +0530
@@ -794,6 +794,22 @@
         a += dstride;
     }
 }
+
+template<int bx, int by>
+void pixel_add_ps_c(pixel *a, int dstride, pixel *b0, int16_t *b1, int sstride0, int sstride1)
+  {
+    for (int y = 0; y < by; y++)
+    {
+      for (int x = 0; x < bx; x++)
+      {
+        a[x] = (pixel)ClipY(b0[x] + b1[x]);
+      }
+
+      b0 += sstride0;
+      b1 += sstride1;
+      a += dstride;
+    }
+  }
 }  // end anonymous namespace
 
 namespace x265 {
@@ -838,13 +854,15 @@
     p.chroma_copy_pp[CSP_I420][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_ps[CHROMA_ ## W ## x ## H] = blockcopy_ps_c<W, H>;\
-    p.chroma_sub_ps[CSP_I420][CHROMA_ ## W ## x ## H] = pixel_sub_ps_c<W, H>;
+    p.chroma_sub_ps[CSP_I420][CHROMA_ ## W ## x ## H] = pixel_sub_ps_c<W, H>;\
+    p.chroma_add_ps[CSP_I420][CHROMA_ ## W ## x ## H] = pixel_add_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_ps[LUMA_ ## W ## x ## H] = blockcopy_ps_c<W, H>;\
-    p.luma_sub_ps[LUMA_ ## W ## x ## H] = pixel_sub_ps_c<W, H>;
+    p.luma_sub_ps[LUMA_ ## W ## x ## H] = pixel_sub_ps_c<W, H>;\
+    p.luma_add_ps[LUMA_ ## W ## x ## H] = pixel_add_ps_c<W, H>;
 
     LUMA(4, 4);
     LUMA(8, 8);
diff -r f38139868da6 -r ac2997ec873a source/common/primitives.h
--- a/source/common/primitives.h	Tue Nov 19 12:33:08 2013 -0600
+++ b/source/common/primitives.h	Wed Nov 20 12:55:28 2013 +0530
@@ -218,6 +218,7 @@
 typedef void (*copy_ps_t)(int16_t *dst, intptr_t dstStride, pixel *src, intptr_t srcStride);
 
 typedef void (*pixel_sub_ps_t)(int16_t *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
+typedef void (*pixel_add_ps_t)(pixel *a, int dstride, pixel *b0, int16_t *b1, int sstride0, int sstride1);
 
 /* Define a structure containing function pointers to optimized encoder
  * primitives.  Each pointer can reference either an assembly routine,
@@ -251,6 +252,8 @@
 
     pixel_sub_ps_t  luma_sub_ps[NUM_LUMA_PARTITIONS];
     pixel_sub_ps_t  chroma_sub_ps[NUM_CSP][NUM_CHROMA_PARTITIONS];
+    pixel_add_ps_t  luma_add_ps[NUM_LUMA_PARTITIONS];
+    pixel_add_ps_t  chroma_add_ps[NUM_CSP][NUM_CHROMA_PARTITIONS];
 
     ipfilter_ps_t   ipfilter_ps[NUM_IPFILTER_P_S];
     ipfilter_sp_t   ipfilter_sp[NUM_IPFILTER_S_P];


More information about the x265-devel mailing list