Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
Add RISC-V HAL implementation for cv::dft and cv::dct#26865
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
0f8e18f582f68b32f36b94503b1af41fbb7589ffeee5e1b540d16cdd2d3feabef84bd6a6b90719c598afFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,68 +1,65 @@ | ||
| // 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. | ||
| #ifndefOPENCV_HAL_RVV_MINMAX_HPP_INCLUDED | ||
| #defineOPENCV_HAL_RVV_MINMAX_HPP_INCLUDED | ||
| #include <riscv_vector.h> | ||
| namespace cv { namespace cv_hal_rvv { namespace minmax { | ||
fengyuentau marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| #undef cv_hal_minMaxIdx | ||
| #define cv_hal_minMaxIdx cv::cv_hal_rvv::minmax::minMaxIdx | ||
| #undef cv_hal_minMaxIdxMaskStep | ||
| #define cv_hal_minMaxIdxMaskStep cv::cv_hal_rvv::minmax::minMaxIdx | ||
| template<typename T> struct rvv; | ||
| #define HAL_RVV_GENERATOR(T, EEW, TYPE, IS_U, EMUL, M_EMUL, B_LEN) \ | ||
| template<> struct rvv<T> \ | ||
| { \ | ||
| using vec_t = v##IS_U##int##EEW##EMUL##_t; \ | ||
| using bool_t = vbool##B_LEN##_t; \ | ||
| static inline size_t vsetvlmax() { return __riscv_vsetvlmax_e##EEW##EMUL(); } \ | ||
| static inline size_t vsetvl(size_t a) { return __riscv_vsetvl_e##EEW##EMUL(a); } \ | ||
| static inline vec_t vmv_v_x(T a, size_t b) { return __riscv_vmv_v_x_##TYPE##EMUL(a, b); } \ | ||
| static inline vec_t vle(const T* a, size_t b) { return __riscv_vle##EEW##_v_##TYPE##EMUL(a, b); } \ | ||
| static inline vuint8##M_EMUL##_t vle_mask(const uchar* a, size_t b) { return __riscv_vle8_v_u8##M_EMUL(a, b); } \ | ||
| static inline vec_t vmin_tu(vec_t a, vec_t b, vec_t c, size_t d) { return __riscv_vmin##IS_U##_tu(a, b, c, d); } \ | ||
| static inline vec_t vmax_tu(vec_t a, vec_t b, vec_t c, size_t d) { return __riscv_vmax##IS_U##_tu(a, b, c, d); } \ | ||
| static inline vec_t vmin_tumu(bool_t a, vec_t b, vec_t c, vec_t d, size_t e) { return __riscv_vmin##IS_U##_tumu(a, b, c, d, e); } \ | ||
| static inline vec_t vmax_tumu(bool_t a, vec_t b, vec_t c, vec_t d, size_t e) { return __riscv_vmax##IS_U##_tumu(a, b, c, d, e); } \ | ||
| static inline vec_t vredmin(vec_t a, vec_t b, size_t c) { return __riscv_vredmin##IS_U(a, b, c); } \ | ||
| static inline vec_t vredmax(vec_t a, vec_t b, size_t c) { return __riscv_vredmax##IS_U(a, b, c); } \ | ||
| }; | ||
| HAL_RVV_GENERATOR(uchar , 8 , u8 , u, m1, m1 , 8 ) | ||
| HAL_RVV_GENERATOR(schar , 8 , i8 , , m1, m1 , 8 ) | ||
| HAL_RVV_GENERATOR(ushort, 16, u16, u, m1, mf2, 16) | ||
| HAL_RVV_GENERATOR(short , 16, i16, , m1, mf2, 16) | ||
| #undef HAL_RVV_GENERATOR | ||
| #define HAL_RVV_GENERATOR(T, NAME, EEW, TYPE, IS_F, F_OR_S, F_OR_X, EMUL, M_EMUL, P_EMUL, B_LEN) \ | ||
| template<> struct rvv<T> \ | ||
| { \ | ||
| using vec_t = v##NAME##EEW##EMUL##_t; \ | ||
| using bool_t = vbool##B_LEN##_t; \ | ||
| static inline size_t vsetvlmax() { return __riscv_vsetvlmax_e##EEW##EMUL(); } \ | ||
| static inline size_t vsetvl(size_t a) { return __riscv_vsetvl_e##EEW##EMUL(a); } \ | ||
| static inline vec_t vmv_v_x(T a, size_t b) { return __riscv_v##IS_F##mv_v_##F_OR_X##_##TYPE##EMUL(a, b); } \ | ||
| static inline vuint32##P_EMUL##_t vid(size_t a) { return __riscv_vid_v_u32##P_EMUL(a); } \ | ||
| static inline vuint32##P_EMUL##_t vundefined() { return __riscv_vundefined_u32##P_EMUL(); } \ | ||
| static inline vec_t vle(const T* a, size_t b) { return __riscv_vle##EEW##_v_##TYPE##EMUL(a, b); } \ | ||
| static inline vuint8##M_EMUL##_t vle_mask(const uchar* a, size_t b) { return __riscv_vle8_v_u8##M_EMUL(a, b); } \ | ||
| static inline bool_t vmlt(vec_t a, vec_t b, size_t c) { return __riscv_vm##F_OR_S##lt(a, b, c); } \ | ||
| static inline bool_t vmgt(vec_t a, vec_t b, size_t c) { return __riscv_vm##F_OR_S##gt(a, b, c); } \ | ||
| static inline bool_t vmlt_mu(bool_t a, bool_t b, vec_t c, vec_t d, size_t e) { return __riscv_vm##F_OR_S##lt##_mu(a, b, c, d, e); } \ | ||
| static inline bool_t vmgt_mu(bool_t a, bool_t b, vec_t c, vec_t d, size_t e) { return __riscv_vm##F_OR_S##gt##_mu(a, b, c, d, e); } \ | ||
| static inline T vmv_x_s(vec_t a) { return __riscv_v##IS_F##mv_##F_OR_X(a); } \ | ||
| }; | ||
| HAL_RVV_GENERATOR(int , int , 32, i32, , s, x, m4, m1 , m4, 8 ) | ||
| HAL_RVV_GENERATOR(float , float, 32, f32, f, f, f, m4, m1 , m4, 8 ) | ||
| HAL_RVV_GENERATOR(double, float, 64, f64, f, f, f, m4, mf2, m2, 16) | ||
| #undef HAL_RVV_GENERATOR | ||
| template<typename T> | ||
| inline int minMaxIdxReadTwice(const uchar* src_data, size_t src_step, int width, int height, double* minVal, double* maxVal, | ||
| @@ -330,6 +327,6 @@ inline int minMaxIdx(const uchar* src_data, size_t src_step, int width, int heig | ||
| return CV_HAL_ERROR_NOT_IMPLEMENTED; | ||
| } | ||
| }}} | ||
| #endif | ||
Uh oh!
There was an error while loading.Please reload this page.