Added inRange HAL entry point.

This commit is contained in:
Alexander Smorkalov 2025-10-01 10:18:11 +03:00
parent e9bded6ff3
commit c4763279eb
2 changed files with 50 additions and 0 deletions

View File

@ -2113,6 +2113,18 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
convertAndUnrollScalar( lb, src.type(), lbuf, blocksize );
convertAndUnrollScalar( ub, src.type(), ubuf, blocksize );
if (depth == CV_8U && src.dims <= 2) {
uint8_t lb_scalar = lbuf[0];
uint8_t ub_scalar = ubuf[0];
CALL_HAL(inRange_u8, cv_hal_inRange8u, src.data, src.step, dst.data, dst.step, dst.depth(), src.cols, src.rows, src.channels(),
lb_scalar, ub_scalar);
} else if (depth == CV_32F && src.dims <= 2) {
double lb_scalar = lb.ptr<double>(0)[0];
double ub_scalar = ub.ptr<double>(0)[0];
CALL_HAL(inRange_f32, cv_hal_inRange32f, src.data, src.step, dst.data, dst.step, dst.depth(), src.cols, src.rows, src.channels(),
lb_scalar, ub_scalar);
}
}
for( size_t i = 0; i < it.nplanes; i++, ++it )

View File

@ -1138,6 +1138,44 @@ inline int hal_ni_sum(const uchar *src_data, size_t src_step, int src_type, int
#define cv_hal_sum hal_ni_sum
//! @endcond
/**
@brief inRange (lower_bound <= src_value) && (src_value <= upper_bound) ? 255 : 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 dst_depth Destination image depth
@param width Image width
@param height Image height
@param cn number of channels
@param lower_bound Range lower bound
@param upper_bound Range upper bound
*/
inline int hal_ni_inRange8u(const uchar *src_data, size_t src_step,
uchar *dst_data, size_t dst_step, int dst_depth, int width,
int height, int cn, uchar lower_bound, uchar upper_bound) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
/**
@brief inRange (lower_bound <= src_value) && (src_value <= upper_bound) ? 255 : 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 dst_depth Destination image depth
@param width Image width
@param height Image height
@param cn number of channels
@param lower_bound Range lower bound
@param upper_bound Range upper bound
*/
inline int hal_ni_inRange32f(const uchar *src_data, size_t src_step,
uchar *dst_data, size_t dst_step, int dst_depth, int width,
int height, int cn, double lower_bound, double upper_bound) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_inRange8u hal_ni_inRange8u
#define cv_hal_inRange32f hal_ni_inRange32f
//! @endcond
//! @}
#if defined(__clang__)