[x265] [PATCH 3 of 4] replace pointer to coeff by coeffIdx in ipfilter_sp
Min Chen
chenm003 at 163.com
Mon Oct 28 15:24:35 CET 2013
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1382970209 -28800
# Node ID 5f7b3d06d94c6aec44bfd4a7bfb6f6751182b4ed
# Parent 6bc4a571ed625cd23503810cfaa5256a3f32a20d
replace pointer to coeff by coeffIdx in ipfilter_sp
diff -r 6bc4a571ed62 -r 5f7b3d06d94c source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp Mon Oct 28 22:23:13 2013 +0800
+++ b/source/Lib/TLibCommon/TComPrediction.cpp Mon Oct 28 22:23:29 2013 +0800
@@ -499,7 +499,7 @@
int filterSize = NTAPS_LUMA;
int halfFilterSize = (filterSize >> 1);
primitives.ipfilter_ps[FILTER_H_P_S_8](src - (halfFilterSize - 1) * srcStride, srcStride, m_immedVals, tmpStride, width, height + filterSize - 1, g_lumaFilter[xFrac]);
- primitives.ipfilter_sp[FILTER_V_S_P_8](m_immedVals + (halfFilterSize - 1) * tmpStride, tmpStride, dst, dstStride, width, height, g_lumaFilter[yFrac]);
+ primitives.ipfilter_sp[FILTER_V_S_P_8](m_immedVals + (halfFilterSize - 1) * tmpStride, tmpStride, dst, dstStride, width, height, yFrac);
}
}
@@ -590,10 +590,10 @@
int halfFilterSize = (filterSize >> 1);
primitives.ipfilter_ps[FILTER_H_P_S_4](refCb - (halfFilterSize - 1) * refStride, refStride, m_immedVals, extStride, cxWidth, cxHeight + filterSize - 1, g_chromaFilter[xFrac]);
- primitives.ipfilter_sp[FILTER_V_S_P_4](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, g_chromaFilter[yFrac]);
+ primitives.ipfilter_sp[FILTER_V_S_P_4](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, yFrac);
primitives.ipfilter_ps[FILTER_H_P_S_4](refCr - (halfFilterSize - 1) * refStride, refStride, m_immedVals, extStride, cxWidth, cxHeight + filterSize - 1, g_chromaFilter[xFrac]);
- primitives.ipfilter_sp[FILTER_V_S_P_4](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, g_chromaFilter[yFrac]);
+ primitives.ipfilter_sp[FILTER_V_S_P_4](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, yFrac);
}
}
diff -r 6bc4a571ed62 -r 5f7b3d06d94c source/common/ipfilter.cpp
--- a/source/common/ipfilter.cpp Mon Oct 28 22:23:13 2013 +0800
+++ b/source/common/ipfilter.cpp Mon Oct 28 22:23:29 2013 +0800
@@ -37,12 +37,14 @@
namespace {
template<int N>
-void filterVertical_sp_c(int16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, int16_t const *coeff)
+void filterVertical_sp_c(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);
int16_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;
@@ -409,7 +411,7 @@
{
short m_immedVals[(64 + 8) * (64 + 8)];
filterHorizontal_ps_c<N>(src - 3 * srcStride, srcStride, m_immedVals, width, width, height + 7, g_lumaFilter[idxX]);
- filterVertical_sp_c<N>(m_immedVals + 3 * width, width, dst, dstStride, width, height, g_lumaFilter[idxY]);
+ filterVertical_sp_c<N>(m_immedVals + 3 * width, width, dst, dstStride, width, height, idxY);
}
}
diff -r 6bc4a571ed62 -r 5f7b3d06d94c source/common/primitives.h
--- a/source/common/primitives.h Mon Oct 28 22:23:13 2013 +0800
+++ b/source/common/primitives.h Mon Oct 28 22:23:29 2013 +0800
@@ -165,7 +165,7 @@
typedef void (*pixelcmp_x3_t)(pixel *fenc, pixel *fref0, pixel *fref1, pixel *fref2, intptr_t frefstride, int *res);
typedef void (*ipfilter_pp_t)(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, const int16_t *coeff);
typedef void (*ipfilter_ps_t)(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int width, int height, const int16_t *coeff);
-typedef void (*ipfilter_sp_t)(int16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, const int16_t *coeff);
+typedef void (*ipfilter_sp_t)(int16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, const int coeffIdx);
typedef void (*ipfilter_ss_t)(int16_t *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int width, int height, const int16_t *coeff);
typedef void (*ipfilter_p2s_t)(pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int width, int height);
typedef void (*ipfilter_s2p_t)(int16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height);
diff -r 6bc4a571ed62 -r 5f7b3d06d94c source/common/vec/ipfilter-sse41.cpp
--- a/source/common/vec/ipfilter-sse41.cpp Mon Oct 28 22:23:13 2013 +0800
+++ b/source/common/vec/ipfilter-sse41.cpp Mon Oct 28 22:23:29 2013 +0800
@@ -34,6 +34,8 @@
#include <assert.h>
#include <string.h>
+using namespace x265;
+
#if !HIGH_BIT_DEPTH
namespace {
ALIGN_VAR_32(const uint16_t, c_512[16]) =
@@ -42,8 +44,10 @@
};
template<int N>
-void filterVertical_sp(int16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, int16_t const *coeff)
+void filterVertical_sp(int16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, int coeffIdx)
{
+ const int16_t *coeff = (N == 8 ? g_lumaFilter[coeffIdx] : g_chromaFilter[coeffIdx]);
+
src -= (N / 2 - 1) * srcStride;
int offset;
diff -r 6bc4a571ed62 -r 5f7b3d06d94c source/encoder/motion.cpp
--- a/source/encoder/motion.cpp Mon Oct 28 22:23:13 2013 +0800
+++ b/source/encoder/motion.cpp Mon Oct 28 22:23:29 2013 +0800
@@ -1232,7 +1232,7 @@
int filterSize = NTAPS_LUMA;
int halfFilterSize = (filterSize >> 1);
primitives.ipfilter_ps[FILTER_H_P_S_8](fref - (halfFilterSize - 1) * ref->lumaStride, ref->lumaStride, immedVal, blockwidth, blockwidth, realHeight + filterSize - 1, g_lumaFilter[xFrac]);
- primitives.ipfilter_sp[FILTER_V_S_P_8](immedVal + (halfFilterSize - 1) * blockwidth, blockwidth, subpelbuf, FENC_STRIDE, blockwidth, realHeight, g_lumaFilter[yFrac]);
+ primitives.ipfilter_sp[FILTER_V_S_P_8](immedVal + (halfFilterSize - 1) * blockwidth, blockwidth, subpelbuf, FENC_STRIDE, blockwidth, realHeight, yFrac);
}
}
}
diff -r 6bc4a571ed62 -r 5f7b3d06d94c source/test/ipfilterharness.cpp
--- a/source/test/ipfilterharness.cpp Mon Oct 28 22:23:13 2013 +0800
+++ b/source/test/ipfilterharness.cpp Mon Oct 28 22:23:29 2013 +0800
@@ -178,14 +178,14 @@
IPF_vec_output_p,
rand_dstStride,
rand_width,
- rand_height, g_lumaFilter[rand_val]
+ rand_height, rand_val
);
ref(short_buff + 3 * rand_srcStride,
rand_srcStride,
IPF_C_output_p,
rand_dstStride,
rand_width,
- rand_height, g_lumaFilter[rand_val]
+ rand_height, rand_val
);
if (memcmp(IPF_vec_output_p, IPF_C_output_p, ipf_t_size))
@@ -506,7 +506,7 @@
printf("ipfilter_sp %d\t", 8 / (value + 1));
REPORT_SPEEDUP(opt.ipfilter_sp[value], ref.ipfilter_sp[value],
short_buff + maxVerticalfilterHalfDistance * srcStride, srcStride,
- IPF_vec_output_p, dstStride, width, height, g_lumaFilter[val]);
+ IPF_vec_output_p, dstStride, width, height, val);
}
}
More information about the x265-devel
mailing list