Added HAL function for popular bit-exact branch of GaussianBlur with sigma=0.

pull/25397/head
Alexander Smorkalov 10 months ago
parent 197626a5bf
commit f643964c68
  1. 25
      modules/imgproc/src/hal_replacement.hpp
  2. 28
      modules/imgproc/src/smooth.dispatch.cpp

@ -855,7 +855,7 @@ inline int hal_ni_boxFilter(const uchar* src_data, size_t src_step, uchar* dst_d
//! @endcond //! @endcond
/** /**
@brief Blurs an image using a Gaussian filter. @brief Blurs an image using a generic Gaussian filter.
@param src_data Source image data @param src_data Source image data
@param src_step Source image step @param src_step Source image step
@param dst_data Destination image data @param dst_data Destination image data
@ -880,6 +880,29 @@ inline int hal_ni_gaussianBlur(const uchar* src_data, size_t src_step, uchar* ds
#define cv_hal_gaussianBlur hal_ni_gaussianBlur #define cv_hal_gaussianBlur hal_ni_gaussianBlur
//! @endcond //! @endcond
/**
@brief Blurs an image using a symmetric Gaussian filter with square kernel and sigma=0.
@param src_data Source image data
@param src_step Source image step
@param dst_data Destination image data
@param dst_step Destination image step
@param width Source image width
@param height Source image height
@param depth Depth of source and destination image
@param cn Number of channels
@param margin_left Left margins for source image
@param margin_top Top margins for source image
@param margin_right Right margins for source image
@param margin_bottom Bottom margins for source image
@param ksize Width of kernel
@param border_type Border type
*/
inline int hal_ni_gaussianBlurBinomial(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int depth, int cn, size_t margin_left, size_t margin_top, size_t margin_right, size_t margin_bottom, size_t ksize, int border_type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_gaussianBlurBinomial hal_ni_gaussianBlurBinomial
//! @endcond
/** /**
@brief Computes Sobel derivatives @brief Computes Sobel derivatives
@param src_depth Depth of source image @param src_depth Depth of source image

@ -683,8 +683,22 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
if (src.data == dst.data) if (src.data == dst.data)
src = src.clone(); src = src.clone();
if ((sigma1 == 0.0) && (sigma2 == 0.0) && (ksize.height == ksize.width))
{
Point ofs;
Size wsz(src.cols, src.rows);
Mat src2 = src;
if(!(borderType & BORDER_ISOLATED))
src2.locateROI( wsz, ofs );
CALL_HAL(gaussianBlurBinomial, cv_hal_gaussianBlurBinomial, src2.ptr(), src2.step, dst.ptr(), dst.step, src2.cols, src2.rows, sdepth, cn,
ofs.x, ofs.y, wsz.width - src2.cols - ofs.x, wsz.height - src2.rows - ofs.y, ksize.width, borderType&~BORDER_ISOLATED);
}
CV_CPU_DISPATCH(GaussianBlurFixedPoint, (src, dst, (const uint16_t*)&fkx[0], (int)fkx.size(), (const uint16_t*)&fky[0], (int)fky.size(), borderType), CV_CPU_DISPATCH(GaussianBlurFixedPoint, (src, dst, (const uint16_t*)&fkx[0], (int)fkx.size(), (const uint16_t*)&fky[0], (int)fky.size(), borderType),
CV_CPU_DISPATCH_MODES_ALL); CV_CPU_DISPATCH_MODES_ALL);
return; return;
} }
} }
@ -720,8 +734,22 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
if (src.data == dst.data) if (src.data == dst.data)
src = src.clone(); src = src.clone();
if ((sigma1 == 0.0) && (sigma2 == 0.0) && (ksize.height == ksize.width))
{
Point ofs;
Size wsz(src.cols, src.rows);
Mat src2 = src;
if(!(borderType & BORDER_ISOLATED))
src2.locateROI( wsz, ofs );
CALL_HAL(gaussianBlurBinomial, cv_hal_gaussianBlurBinomial, src2.ptr(), src2.step, dst.ptr(), dst.step, src2.cols, src2.rows, sdepth, cn,
ofs.x, ofs.y, wsz.width - src2.cols - ofs.x, wsz.height - src2.rows - ofs.y, ksize.width, borderType&~BORDER_ISOLATED);
}
CV_CPU_DISPATCH(GaussianBlurFixedPoint, (src, dst, (const uint32_t*)&fkx[0], (int)fkx.size(), (const uint32_t*)&fky[0], (int)fky.size(), borderType), CV_CPU_DISPATCH(GaussianBlurFixedPoint, (src, dst, (const uint32_t*)&fkx[0], (int)fkx.size(), (const uint32_t*)&fky[0], (int)fky.size(), borderType),
CV_CPU_DISPATCH_MODES_ALL); CV_CPU_DISPATCH_MODES_ALL);
return; return;
} }
} }

Loading…
Cancel
Save