[x265] [PATCH 1 of 2] Adding function pointer array and C primitive for luma hps filter functions

nabajit at multicorewareinc.com nabajit at multicorewareinc.com
Wed Nov 6 08:04:00 CET 2013


# HG changeset patch
# User Nabajit Deka
# Date 1383720945 -19800
#      Wed Nov 06 12:25:45 2013 +0530
# Node ID 4745dfc5490381a906c8a87d057a75626f260c41
# Parent  7cdcf1a03d93f8f007d9d111129d29ab31513310
Adding function pointer array and C primitive for luma hps filter functions.

diff -r 7cdcf1a03d93 -r 4745dfc54903 source/common/ipfilter.cpp
--- a/source/common/ipfilter.cpp	Tue Nov 05 14:53:10 2013 -0600
+++ b/source/common/ipfilter.cpp	Wed Nov 06 12:25:45 2013 +0530
@@ -391,6 +391,43 @@
 }
 
 template<int N, int width, int height>
+void interp_horiz_ps_c(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx)
+{
+    int16_t const * coeff = (N == 4) ? g_chromaFilter[coeffIdx] : g_lumaFilter[coeffIdx];
+    int headRoom = IF_INTERNAL_PREC - X265_DEPTH;
+    int shift = IF_FILTER_PREC - headRoom;
+    int offset = -IF_INTERNAL_OFFS << shift;
+    src -= N / 2 - 1;
+
+    int row, col;
+    for (row = 0; row < height; row++)
+    {
+        for (col = 0; col < width; col++)
+        {
+            int sum;
+
+            sum  = src[col + 0] * coeff[0];
+            sum += src[col + 1] * coeff[1];
+            sum += src[col + 2] * coeff[2];
+            sum += src[col + 3] * coeff[3];
+            if (N == 8)
+            {
+                sum += src[col + 4] * coeff[4];
+                sum += src[col + 5] * coeff[5];
+                sum += src[col + 6] * coeff[6];
+                sum += src[col + 7] * coeff[7];
+            }
+
+            int16_t val = (int16_t)(sum + offset) >> shift;
+            dst[col] = val;
+        }
+
+        src += srcStride;
+        dst += dstStride;
+    }
+}
+
+template<int N, int width, int height>
 void interp_vert_pp_c(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
 {
     int16_t const * c = (N == 4) ? g_chromaFilter[coeffIdx] : g_lumaFilter[coeffIdx];
@@ -491,6 +528,7 @@
 
 #define LUMA(W, H) \
     p.luma_hpp[LUMA_ ## W ## x ## H]     = interp_horiz_pp_c<8, W, H>; \
+    p.luma_hps[LUMA_ ## W ## x ## H]     = interp_horiz_ps_c<8, W, H>;\
     p.luma_vpp[LUMA_ ## W ## x ## H]     = interp_vert_pp_c<8, W, H>; \
     p.luma_vps[LUMA_ ## W ## x ## H]     = interp_vert_ps_c<8, W, H>; \
     p.luma_hvpp[LUMA_ ## W ## x ## H]    = interp_hv_pp_c<8, W, H>;
diff -r 7cdcf1a03d93 -r 4745dfc54903 source/common/primitives.h
--- a/source/common/primitives.h	Tue Nov 05 14:53:10 2013 -0600
+++ b/source/common/primitives.h	Wed Nov 06 12:25:45 2013 +0530
@@ -254,6 +254,7 @@
     extendCURowBorder_t extendRowBorder;
     filter_pp_t     chroma_hpp[NUM_CHROMA_PARTITIONS];
     filter_pp_t     luma_hpp[NUM_LUMA_PARTITIONS];
+    filter_ps_t     luma_hps[NUM_LUMA_PARTITIONS];
     filter_pp_t     chroma_vpp[NUM_CHROMA_PARTITIONS];
     filter_pp_t     luma_vpp[NUM_LUMA_PARTITIONS];
     filter_ps_t     luma_vps[NUM_LUMA_PARTITIONS];


More information about the x265-devel mailing list