[x265] [PATCH 1 of 3] primitives: add pixelavg primitive

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Thu Oct 3 13:14:22 CEST 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1380772290 -19800
# Node ID a9480c6387a56c8bcd753b37c3e44a73b18f1f25
# Parent  4f68ed1126b6f0b0f24e9959ee3c3e5ade65c822
primitives: add pixelavg primitive

diff -r 4f68ed1126b6 -r a9480c6387a5 source/common/pixel.cpp
--- a/source/common/pixel.cpp	Tue Oct 01 13:46:27 2013 +0530
+++ b/source/common/pixel.cpp	Thu Oct 03 09:21:30 2013 +0530
@@ -579,6 +579,22 @@
     }
 }
 
+template<int lx, int ly>
+void pixelavg_pp(pixel* dst, intptr_t dstride, pixel* src0, pixel* src1, intptr_t sstride0, intptr_t sstride1)
+{
+    for (int y = 0; y < ly; y++)
+    {
+        for (int x = 0; x < lx; x++)
+        {
+            dst[x] = (src0[x] + src1[x] + 1) >> 1;
+        }
+
+        src0 += sstride0;
+        src1 += sstride1;
+        dst += dstride;
+    }
+}
+
 void scale1D_128to64(pixel *dst, pixel *src, intptr_t /*stride*/)
 {
     int x;
@@ -648,6 +664,7 @@
     SET_FUNC_PRIMITIVE_TABLE_C2(sad)
     SET_FUNC_PRIMITIVE_TABLE_C2(sad_x3)
     SET_FUNC_PRIMITIVE_TABLE_C2(sad_x4)
+    SET_FUNC_PRIMITIVE_TABLE_C2(pixelavg_pp)
 
     // satd
     p.satd[PARTITION_4x4]   = satd_4x4;
diff -r 4f68ed1126b6 -r a9480c6387a5 source/common/primitives.h
--- a/source/common/primitives.h	Tue Oct 01 13:46:27 2013 +0530
+++ b/source/common/primitives.h	Thu Oct 03 09:21:30 2013 +0530
@@ -196,6 +196,7 @@
 typedef void (*pixelsub_sp_t)(int bx, int by, short *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
 typedef void (*pixeladd_ss_t)(int bx, int by, short *dst, intptr_t dstride, short *src0, short *src1, intptr_t sstride0, intptr_t sstride1);
 typedef void (*pixeladd_pp_t)(int bx, int by, pixel *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
+typedef void (*pixelavg_pp_t)(pixel *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
 typedef void (*blockfil_s_t)(short *dst, intptr_t dstride, short val);
 
 typedef void (*intra_dc_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width, int bFilter);
@@ -292,6 +293,7 @@
     pixelsub_sp_t   pixelsub_sp;
     pixeladd_ss_t   pixeladd_ss;
     pixeladd_pp_t   pixeladd_pp;
+    pixelavg_pp_t   pixelavg_pp[NUM_PARTITIONS];
 
     filterVwghtd_t  filterVwghtd;
     filterHwghtd_t  filterHwghtd;


More information about the x265-devel mailing list