[x265] [PATCH 1 of 1] Filtervertical-short-short and pel-short to support bipred

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Fri Jun 21 14:21:43 CEST 2013


# HG changeset patch
# User Deepthi Devaki
# Date 1371816983 -19800
# Node ID 371e9320d819387ced987a42f55bda2815dcc7ae
# Parent  d2d3ab375431bf58b2bed06650f62cbb5bdd14f3
Filtervertical-short-short and pel-short to support bipred

diff -r d2d3ab375431 -r 371e9320d819 source/common/ipfilter.cpp
--- a/source/common/ipfilter.cpp	Fri Jun 21 10:54:41 2013 +0530
+++ b/source/common/ipfilter.cpp	Fri Jun 21 17:46:23 2013 +0530
@@ -139,6 +139,134 @@
 }
 
 template<int N>
+void filterVertical_short_short(int bitDepth, short *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
+{
+    short c[8];
+
+    c[0] = coeff[0];
+    c[1] = coeff[1];
+    if (N >= 4)
+    {
+        c[2] = coeff[2];
+        c[3] = coeff[3];
+    }
+    if (N >= 6)
+    {
+        c[4] = coeff[4];
+        c[5] = coeff[5];
+    }
+    if (N == 8)
+    {
+        c[6] = coeff[6];
+        c[7] = coeff[7];
+    }
+
+    int cStride =  srcStride;
+    src -= (N / 2 - 1) * cStride;
+    int shift = IF_FILTER_PREC;
+    int row, col;
+    for (row = 0; row < height; row++)
+    {
+        for (col = 0; col < width; col++)
+        {
+            int sum;
+
+            sum  = src[col + 0 * cStride] * c[0];
+            sum += src[col + 1 * cStride] * c[1];
+            if (N >= 4)
+            {
+                sum += src[col + 2 * cStride] * c[2];
+                sum += src[col + 3 * cStride] * c[3];
+            }
+            if (N >= 6)
+            {
+                sum += src[col + 4 * cStride] * c[4];
+                sum += src[col + 5 * cStride] * c[5];
+            }
+            if (N == 8)
+            {
+                sum += src[col + 6 * cStride] * c[6];
+                sum += src[col + 7 * cStride] * c[7];
+            }
+
+            short val = (short)((sum) >> shift);
+            dst[col] = val;
+        }
+
+        src += srcStride;
+        dst += dstStride;
+    }
+}
+
+template<int N>
+void filterVertical_pel_short(int bitDepth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
+{
+    short c[8];
+
+    c[0] = coeff[0];
+    c[1] = coeff[1];
+    if (N >= 4)
+    {
+        c[2] = coeff[2];
+        c[3] = coeff[3];
+    }
+    if (N >= 6)
+    {
+        c[4] = coeff[4];
+        c[5] = coeff[5];
+    }
+    if (N == 8)
+    {
+        c[6] = coeff[6];
+        c[7] = coeff[7];
+    }
+
+    int cStride =  srcStride;
+    src -= (N / 2 - 1) * cStride;
+    Int offset;
+    Short maxVal;
+    Int headRoom = IF_INTERNAL_PREC - bitDepth;
+    Int shift = IF_FILTER_PREC;
+
+    shift -=  headRoom;
+    offset = -IF_INTERNAL_OFFS << shift;
+    maxVal = 0;
+
+    int row, col;
+    for (row = 0; row < height; row++)
+    {
+        for (col = 0; col < width; col++)
+        {
+            int sum;
+
+            sum  = src[col + 0 * cStride] * c[0];
+            sum += src[col + 1 * cStride] * c[1];
+            if (N >= 4)
+            {
+                sum += src[col + 2 * cStride] * c[2];
+                sum += src[col + 3 * cStride] * c[3];
+            }
+            if (N >= 6)
+            {
+                sum += src[col + 4 * cStride] * c[4];
+                sum += src[col + 5 * cStride] * c[5];
+            }
+            if (N == 8)
+            {
+                sum += src[col + 6 * cStride] * c[6];
+                sum += src[col + 7 * cStride] * c[7];
+            }
+
+            short val = (short)((sum + offset) >> shift);
+            dst[col] = val;
+        }
+
+        src += srcStride;
+        dst += dstStride;
+    }
+}
+
+template<int N>
 void CDECL filterHorizontal_pel_short(int bitDepth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff)
 {
     int cStride = 1;
@@ -374,16 +502,21 @@
 {
     p.ipFilter_p_p[FILTER_H_P_P_8] = filterHorizontal_pel_pel<8>;
     p.ipFilter_p_s[FILTER_H_P_S_8] = filterHorizontal_pel_short<8>;
+    p.ipFilter_p_s[FILTER_V_P_S_8] = filterVertical_pel_short<8>;
     p.ipFilter_s_p[FILTER_V_S_P_8] = filterVertical_short_pel<8>;
     p.ipfilterConvert_p_s = filterConvertPelToShort;
     p.ipfilterConvert_s_p = filterConvertShortToPel;
     p.ipFilter_p_p[FILTER_H_P_P_4] = filterHorizontal_pel_pel<4>;
     p.ipFilter_p_s[FILTER_H_P_S_4] = filterHorizontal_pel_short<4>;
+    p.ipFilter_p_s[FILTER_V_P_S_4] = filterVertical_pel_short<4>;
     p.ipFilter_s_p[FILTER_V_S_P_4] = filterVertical_short_pel<4>;
 
     p.ipFilter_p_p[FILTER_V_P_P_8] = filterVertical_pel_pel<8>;
     p.ipFilter_p_p[FILTER_V_P_P_4] = filterVertical_pel_pel<4>;
 
+    p.ipFilter_s_s[FILTER_V_S_S_8] = filterVertical_short_short<8>;
+    p.ipFilter_s_s[FILTER_V_S_S_4] = filterVertical_short_short<4>;
+
     p.filterVmulti = filterVerticalMultiplaneExtend;
     p.filterHmulti = filterHorizontalMultiplane;
 }
diff -r d2d3ab375431 -r 371e9320d819 source/common/primitives.h
--- a/source/common/primitives.h	Fri Jun 21 10:54:41 2013 +0530
+++ b/source/common/primitives.h	Fri Jun 21 17:46:23 2013 +0530
@@ -162,6 +162,8 @@
 {
     FILTER_H_P_S_8,
     FILTER_H_P_S_4,
+    FILTER_V_P_S_8,
+    FILTER_V_P_S_4,
     NUM_IPFILTER_P_S
 };
 
@@ -172,6 +174,13 @@
     NUM_IPFILTER_S_P
 };
 
+enum IPFilterConf_S_S
+{
+    FILTER_V_S_S_8,
+    FILTER_V_S_S_4,
+    NUM_IPFILTER_S_S
+};
+
 // Returns a Partitions enum if the size matches a supported performance primitive,
 // else returns -1 (in which case you should use the slow path)
 int PartitionFromSizes(int Width, int Height);
@@ -185,6 +194,7 @@
 typedef void (CDECL * IPFilter_p_p)(int bit_Depth, pixel *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff);
 typedef void (CDECL * IPFilter_p_s)(int bit_Depth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff);
 typedef void (CDECL * IPFilter_s_p)(int bit_Depth, short *src, int srcStride, pixel *dst, int dstStride, int width, int height, short const *coeff);
+typedef void (CDECL * IPFilter_s_s)(int bitDepth, short *src, int srcStride, short *dst, int dstStride, int width, int height, short const *coeff);
 typedef void (CDECL * IPFilterConvert_p_s)(int bit_Depth, pixel *src, int srcStride, short *dst, int dstStride, int width, int height);
 typedef void (CDECL * IPFilterConvert_s_p)(int bit_Depth, short *src, int srcStride, pixel *dst, int dstStride, int width, int height);
 typedef void (CDECL * blockcpy_p_p)(int bx, int by, pixel *dst, intptr_t dstride, pixel *src, intptr_t sstride); // dst is aligned
@@ -227,6 +237,7 @@
     IPFilter_p_p ipFilter_p_p[NUM_IPFILTER_P_P];
     IPFilter_p_s ipFilter_p_s[NUM_IPFILTER_P_S];
     IPFilter_s_p ipFilter_s_p[NUM_IPFILTER_S_P];
+    IPFilter_s_s ipFilter_s_s[NUM_IPFILTER_S_S];
     IPFilterConvert_p_s ipfilterConvert_p_s;
     IPFilterConvert_s_p ipfilterConvert_s_p;
     blockcpy_p_p cpyblock;     // pixel from pixel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xhevc_deepthid.patch
Type: text/x-patch
Size: 6890 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130621/ba69218b/attachment.bin>


More information about the x265-devel mailing list