[x265] [PATCH] ipfilter.cpp: Delete redundant filterVertical_sp_c function

Gerda Zsejke More gerdazsejke.more at arm.com
Fri Feb 21 16:18:09 UTC 2025


Functionality wise filterVertical_sp_c and interp_vert_sp_c are
identical. Delete implementaion of filterVertical_sp_c and call
interp_vert_sp_c function instead in interp_hv_pp_c.
---
 source/common/ipfilter.cpp             | 45 +-------------------------
 source/common/ppc/ipfilter_altivec.cpp |  4 +--
 2 files changed, 2 insertions(+), 47 deletions(-)

diff --git a/source/common/ipfilter.cpp b/source/common/ipfilter.cpp
index 2140d0e3c..e90681532 100644
--- a/source/common/ipfilter.cpp
+++ b/source/common/ipfilter.cpp
@@ -316,56 +316,13 @@ void interp_vert_ss_c(const int16_t* src, intptr_t srcStride, int16_t* dst, intp
     }
 }
 
-template<int N>
-void filterVertical_sp_c(const int16_t* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int width, int height, int coeffIdx)
-{
-    int headRoom = IF_INTERNAL_PREC - X265_DEPTH;
-    int shift = IF_FILTER_PREC + headRoom;
-    int offset = (1 << (shift - 1)) + (IF_INTERNAL_OFFS << IF_FILTER_PREC);
-    uint16_t maxVal = (1 << X265_DEPTH) - 1;
-    const int16_t* coeff = (N == 8 ? g_lumaFilter[coeffIdx] : g_chromaFilter[coeffIdx]);
-
-    src -= (N / 2 - 1) * srcStride;
-
-    int row, col;
-    for (row = 0; row < height; row++)
-    {
-        for (col = 0; col < width; col++)
-        {
-            int sum;
-
-            sum  = src[col + 0 * srcStride] * coeff[0];
-            sum += src[col + 1 * srcStride] * coeff[1];
-            sum += src[col + 2 * srcStride] * coeff[2];
-            sum += src[col + 3 * srcStride] * coeff[3];
-            if (N == 8)
-            {
-                sum += src[col + 4 * srcStride] * coeff[4];
-                sum += src[col + 5 * srcStride] * coeff[5];
-                sum += src[col + 6 * srcStride] * coeff[6];
-                sum += src[col + 7 * srcStride] * coeff[7];
-            }
-
-            int16_t val = (int16_t)((sum + offset) >> shift);
-
-            val = (val < 0) ? 0 : val;
-            val = (val > maxVal) ? maxVal : val;
-
-            dst[col] = (pixel)val;
-        }
-
-        src += srcStride;
-        dst += dstStride;
-    }
-}
-
 template<int N, int width, int height>
 void interp_hv_pp_c(const pixel* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int idxX, int idxY)
 {
     ALIGN_VAR_32(int16_t, immed[width * (height + N - 1)]);
 
     interp_horiz_ps_c<N, width, height>(src, srcStride, immed, width, idxX, 1);
-    filterVertical_sp_c<N>(immed + (N / 2 - 1) * width, width, dst, dstStride, width, height, idxY);
+    interp_vert_sp_c<N, width, height>(immed + (N / 2 - 1) * width, width, dst, dstStride, idxY);
 }
 
 #define CHROMA_420(W, H) \
diff --git a/source/common/ppc/ipfilter_altivec.cpp b/source/common/ppc/ipfilter_altivec.cpp
index 6db8dbe6b..11dd726dd 100644
--- a/source/common/ppc/ipfilter_altivec.cpp
+++ b/source/common/ppc/ipfilter_altivec.cpp
@@ -808,9 +808,7 @@ void interp_hv_pp_altivec(const pixel* src, intptr_t srcStride, pixel* dst, intp
     short immedVals[(64 + 8) * (64 + 8)];
 
     interp_horiz_ps_altivec<N, width, height>(src, srcStride, immedVals, width, idxX, 1);
-
-    //!!filterVertical_sp_c<N>(immedVals + 3 * width, width, dst, dstStride, width, height, idxY);
-    filterVertical_sp_altivec<N,width,height>(immedVals + 3 * width, width, dst, dstStride, idxY);
+    filterVertical_sp_altivec<N, width, height>(immedVals + 3 * width, width, dst, dstStride, idxY);
 }
 
 //ORIGINAL
-- 
2.39.5 (Apple Git-154)



More information about the x265-devel mailing list