Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add RISC-V HAL implementation for minMaxIdx#26789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
asmorkalov merged 6 commits intoopencv:4.xfromamane-ame:minmax_hal_rvv
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Create a new HAL interface for minMaxIdx with mask_step.
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
  • Loading branch information
@amane-ame@hanliutong
amane-ame andhanliutong committedJan 20, 2025
commit007a989d68dd28ec00c1e175492fc2bb61157485
7 changes: 6 additions & 1 deletion3rdparty/hal_rvv/hal_rvv_1p0/minmax.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,8 @@ namespace cv { namespace cv_hal_rvv {

#undef cv_hal_minMaxIdx
#define cv_hal_minMaxIdx cv::cv_hal_rvv::minMaxIdx
#undef cv_hal_minMaxIdxMaskStep
#define cv_hal_minMaxIdxMaskStep cv::cv_hal_rvv::minMaxIdx

#define HAL_RVV_MINMAXIDX_READTWICE_GENERATOR(D_TYPE, V_TYPE, EEW, EMUL, IS_U, IS_F, F_OR_X, F_OR_S, M_EMUL) \
inline int minMaxIdx_##V_TYPE(const uchar* src_data, size_t src_step, int width, int height, double* minVal, double* maxVal, \
Expand DownExpand Up@@ -261,8 +263,11 @@ HAL_RVV_MINMAXIDX_READONCE_GENERATOR(double, f64, e64, m4, , f, f, f, mf2, m2)
#undef HAL_RVV_MINMAXIDX_READONCE_GENERATOR

inline int minMaxIdx(const uchar* src_data, size_t src_step, int width, int height, int depth, double* minVal, double* maxVal,
int* minIdx, int* maxIdx, uchar* mask, size_t mask_step)
int* minIdx, int* maxIdx, uchar* mask, size_t mask_step = 0)
{
if (!mask_step)
mask_step = src_step;

switch (depth)
{
case CV_8UC1:
Expand Down
21 changes: 19 additions & 2 deletionsmodules/core/src/hal_replacement.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -907,13 +907,30 @@ inline int hal_ni_gemm64fc(const double* src1, size_t src1_step, const double* s
@param minIdx Pointer to the returned minimum and maximum location.
@param maxIdx Pointer to the returned minimum and maximum location.
@param mask Specified array region.
@param mask_step Mask array step.
*/
inline int hal_ni_minMaxIdx(const uchar* src_data, size_t src_step, int width, int height, int depth, double* minVal, double* maxVal,
int* minIdx, int* maxIdx, uchar* mask, size_t mask_step) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
int* minIdx, int* maxIdx, uchar* mask) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }

/**
@brief Finds the global minimum and maximum in an array.
@param src_data Source image
@param src_step Source image
@param width Source image dimensions
@param height Source image dimensions
@param depth Depth of source image
@param minVal Pointer to the returned global minimum and maximum in an array.
@param maxVal Pointer to the returned global minimum and maximum in an array.
@param minIdx Pointer to the returned minimum and maximum location.
@param maxIdx Pointer to the returned minimum and maximum location.
@param mask Specified array region.
@param mask_step Mask array step.
*/
inline int hal_ni_minMaxIdxMaskStep(const uchar* src_data, size_t src_step, int width, int height, int depth, double* minVal, double* maxVal,
int* minIdx, int* maxIdx, uchar* mask, size_t mask_step) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }

//! @cond IGNORED
#define cv_hal_minMaxIdx hal_ni_minMaxIdx
#define cv_hal_minMaxIdxMaskStep hal_ni_minMaxIdxMaskStep
//! @endcond

/**
Expand Down
15 changes: 12 additions & 3 deletionsmodules/core/src/minmax.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1514,13 +1514,22 @@ void cv::minMaxIdx(InputArray _src, double* minVal,

if (src.dims <= 2)
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step);
if ((size_t)src.step == (size_t)mask.step)
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
}
else
{
CALL_HAL(minMaxIdxMaskStep, cv_hal_minMaxIdxMaskStep, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step);
}

}
else if (src.isContinuous() && mask.isContinuous())
{
int res = cv_hal_minMaxIdx(src.data, 0, (int)src.total()*cn, 1, src.depth(),
minVal, maxVal, minIdx, maxIdx, mask.data, 0);
minVal, maxVal, minIdx, maxIdx, mask.data);

if (res == CV_HAL_ERROR_OK)
{
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp