提交 ac2dc295 编写于 作者: A Alexander Alekhin

Merge pull request #15852 from akhakim:gauss_blur_kernel_5x5

......@@ -599,6 +599,7 @@ static void run_sepfilter(Buffer& dst, const View& src,
{
constexpr int kMax = 11;
GAPI_Assert(kxLen <= kMax && kyLen <= kMax);
GAPI_Assert(kxLen == kyLen);
const SRC *in[kMax];
DST *out;
......@@ -625,6 +626,13 @@ static void run_sepfilter(Buffer& dst, const View& src,
int border = xborder;
run_sepfilter3x3_impl(out, in, width, chan, kx, ky, border, scale, delta, buf, y, y0);
}
else if (kxLen == 5 && kyLen == 5)
{
int y = dst.y();
int y0 = dst.priv().writeStart();
run_sepfilter5x5_impl(out, in, width, chan, kx, ky, xborder, scale, delta, buf, y, y0);
}
else
{
int length = chan * width;
......@@ -788,7 +796,9 @@ GAPI_FLUID_KERNEL(GFluidGaussBlur, cv::gapi::imgproc::GGaussBlur, true)
Buffer& dst,
Buffer& scratch)
{
int kxsize = ksize.width;
GAPI_Assert(ksize.height == ksize.width);
GAPI_Assert((ksize.height == 3) || (ksize.height == 5));
const int kxsize = ksize.width;
int kysize = ksize.height;
auto *kx = scratch.OutLine<float>(); // cached kernX data
......@@ -801,7 +811,7 @@ GAPI_FLUID_KERNEL(GFluidGaussBlur, cv::gapi::imgproc::GGaussBlur, true)
constexpr int buffSize = 5;
GAPI_Assert(ksize.height <= buffSize);
float *buf[buffSize]{};
float *buf[buffSize] = { nullptr };
buf[0] = ky + kysize;
for (int i = 1; i < ksize.height; ++i)
......
......@@ -119,6 +119,28 @@ RUN_SEPFILTER3X3_IMPL( float, float)
#undef RUN_SEPFILTER3X3_IMPL
#define RUN_SEPFILTER5x5_IMPL(DST, SRC) \
void run_sepfilter5x5_impl(DST out[], const SRC *in[], int width, int chan, \
const float kx[], const float ky[], int border, \
float scale, float delta, \
float *buf[], int y, int y0) \
{ \
CV_CPU_DISPATCH(run_sepfilter5x5_impl, \
(out, in, width, chan, kx, ky, border, scale, delta, buf,y, y0), \
CV_CPU_DISPATCH_MODES_ALL); \
}
RUN_SEPFILTER5x5_IMPL(uchar, uchar)
RUN_SEPFILTER5x5_IMPL(short, uchar)
RUN_SEPFILTER5x5_IMPL(float, uchar)
RUN_SEPFILTER5x5_IMPL(ushort, ushort)
RUN_SEPFILTER5x5_IMPL(short, ushort)
RUN_SEPFILTER5x5_IMPL(float, ushort)
RUN_SEPFILTER5x5_IMPL(short, short)
RUN_SEPFILTER5x5_IMPL(float, short)
RUN_SEPFILTER5x5_IMPL(float, float)
#undef RUN_SEPFILTER5x5_IMPL
//-------------------------
//
// Fluid kernels: Filter 2D
......
......@@ -78,6 +78,25 @@ RUN_SEPFILTER3X3_IMPL( float, float)
#undef RUN_SEPFILTER3X3_IMPL
#define RUN_SEPFILTER5x5_IMPL(DST, SRC) \
void run_sepfilter5x5_impl(DST out[], const SRC *in[], int width, int chan, \
const float kx[], const float ky[], int border, \
float scale, float delta, \
float *buf[], int y, int y0);
RUN_SEPFILTER5x5_IMPL(uchar, uchar)
RUN_SEPFILTER5x5_IMPL(short, uchar)
RUN_SEPFILTER5x5_IMPL(float, uchar)
RUN_SEPFILTER5x5_IMPL(ushort, ushort)
RUN_SEPFILTER5x5_IMPL(short, ushort)
RUN_SEPFILTER5x5_IMPL(float, ushort)
RUN_SEPFILTER5x5_IMPL(short, short)
RUN_SEPFILTER5x5_IMPL(float, short)
RUN_SEPFILTER5x5_IMPL(float, float)
#undef RUN_SEPFILTER5x5_IMPL
//-------------------------
//
// Fluid kernels: Filter 2D
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册