mirror of
https://github.com/opencv/opencv.git
synced 2025-07-30 01:06:38 +08:00

Add RISC-V HAL implementation for meanStdDev #26624 `meanStdDev` benefits from the Universal Intrinsic backend of RVV, but we also found that the performance on the `8UC4` type is worse than the scalar version when there is a mask, and there is no optimization implementation on `32FC1`. This patch implements `meanStdDev` function in RVV_HAL using native intrinsic, significantly optimizing the performance for `8UC1`, `8UC4` and `32FC1`. This patch is tested on BPI-F3 for both gcc 14.2 and clang 19.1. ``` $ opencv_test_core --gtest_filter="*MeanStdDev*" $ opencv_perf_core --gtest_filter="Size_MatType_meanStdDev* ```  ### 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
28 lines
790 B
C++
28 lines
790 B
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
|
|
#ifndef OPENCV_HAL_RVV_HPP_INCLUDED
|
|
#define OPENCV_HAL_RVV_HPP_INCLUDED
|
|
|
|
#include "opencv2/core/hal/interface.h"
|
|
|
|
#ifndef CV_HAL_RVV_071_ENABLED
|
|
# if defined(__GNUC__) && __GNUC__ == 10 && __GNUC_MINOR__ == 4 && defined(__THEAD_VERSION__) && defined(__riscv_v) && __riscv_v == 7000
|
|
# define CV_HAL_RVV_071_ENABLED 1
|
|
# else
|
|
# define CV_HAL_RVV_071_ENABLED 0
|
|
# endif
|
|
#endif
|
|
|
|
#if CV_HAL_RVV_071_ENABLED
|
|
#include "version/hal_rvv_071.hpp"
|
|
#endif
|
|
|
|
#if defined(__riscv_v) && __riscv_v == 1000000
|
|
#include "hal_rvv_1p0/merge.hpp" // core
|
|
#include "hal_rvv_1p0/mean.hpp" // core
|
|
#endif
|
|
|
|
#endif
|