mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Merge pull request #27160 from amane-ame:resize_hal_rvv
Add RISC-V HAL implementation for cv::resize #27160 This patch implements `cv_hal_resize` using native intrinsics, optimizing the performance of `cv::resize` for `CV_INTER_NEAREST/CV_INTER_NEAREST_EXACT/CV_INTER_LINEAR/CV_INTER_LINEAR_EXACT/CV_INTER_AREA` modes. Tested on MUSE-PI (Spacemit X60) for both gcc 14.2 and clang 20.1. ``` $ ./opencv_test_imgproc --gtest_filter="*Resize*:*resize*" $ ./opencv_perf_imgproc --gtest_filter="*Resize*:*resize*" --perf_min_samples=300 --perf_force_samples=300 ``` View the full perf table here: [hal_rvv_resize.pdf](https://github.com/user-attachments/files/19480756/hal_rvv_resize.pdf) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Vendored
+1
@@ -53,6 +53,7 @@
|
||||
#include "hal_rvv_1p0/warp.hpp" // imgproc
|
||||
#include "hal_rvv_1p0/thresh.hpp" // imgproc
|
||||
#include "hal_rvv_1p0/histogram.hpp" // imgproc
|
||||
#include "hal_rvv_1p0/resize.hpp" // imgproc
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+2
-26
@@ -521,16 +521,7 @@ inline int sepFilter(cvhalFilter2D *context, uchar* src_data, size_t src_step, u
|
||||
|
||||
uchar* _dst_data = dst_data;
|
||||
size_t _dst_step = dst_step;
|
||||
size_t size = sizeof(char);
|
||||
switch (data->dst_type)
|
||||
{
|
||||
case CV_16SC1:
|
||||
size = sizeof(short);
|
||||
break;
|
||||
case CV_32FC1:
|
||||
size = sizeof(float);
|
||||
break;
|
||||
}
|
||||
const size_t size = CV_ELEM_SIZE(data->dst_type);
|
||||
std::vector<uchar> dst;
|
||||
if (src_data == _dst_data)
|
||||
{
|
||||
@@ -2136,22 +2127,7 @@ inline int boxFilter(const uchar* src_data, size_t src_step, uchar* dst_data, si
|
||||
|
||||
uchar* _dst_data = dst_data;
|
||||
size_t _dst_step = dst_step;
|
||||
size_t size = cn;
|
||||
switch (dst_depth)
|
||||
{
|
||||
case CV_8U:
|
||||
case CV_8S:
|
||||
size *= sizeof(char);
|
||||
break;
|
||||
case CV_16U:
|
||||
case CV_16S:
|
||||
size *= sizeof(short);
|
||||
break;
|
||||
case CV_32F:
|
||||
case CV_32S:
|
||||
size *= sizeof(float);
|
||||
break;
|
||||
}
|
||||
const size_t size = CV_ELEM_SIZE(dst_type);
|
||||
std::vector<uchar> dst;
|
||||
if (src_data == _dst_data)
|
||||
{
|
||||
|
||||
+1
-1
@@ -1121,7 +1121,7 @@ inline int normDiff(const uchar* src1, size_t src1_step, const uchar* src2, size
|
||||
|
||||
bool src_continuous = (src1_step == width * elem_size_tab[depth] * cn || (src1_step != width * elem_size_tab[depth] * cn && height == 1));
|
||||
src_continuous &= (src2_step == width * elem_size_tab[depth] * cn || (src2_step != width * elem_size_tab[depth] * cn && height == 1));
|
||||
bool mask_continuous = (mask_step == width);
|
||||
bool mask_continuous = (mask_step == static_cast<size_t>(width));
|
||||
size_t nplanes = 1;
|
||||
size_t size = width * height;
|
||||
if ((mask && (!src_continuous || !mask_continuous)) || !src_continuous) {
|
||||
|
||||
+1006
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user