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

Appearance settings

Commit 2969b67

Browse filesBrowse files
committed
Fix 27003.
1 parent 46dbc57 commit 2969b67
Copy full SHA for 2969b67

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed

‎modules/core/include/opencv2/core/hal/intrin_rvv_scalable.hpp

Copy file name to clipboardExpand all lines: modules/core/include/opencv2/core/hal/intrin_rvv_scalable.hpp
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,17 @@ inline v_int64 v_dotprod_expand_fast(const v_int16& a, const v_int16& b, const v
21302130
// 32 >> 64f
21312131
#if CV_SIMD_SCALABLE_64F
21322132
inline v_float64 v_dotprod_expand_fast(const v_int32& a, const v_int32& b)
2133-
{ return v_cvt_f64(v_dotprod_fast(a, b)); }
2133+
{
2134+
vfloat64m1_t zero = __riscv_vfmv_v_f_f64m1(0, VTraits<vuint64m1_t>::vlanes());
2135+
auto prod_i64 = __riscv_vwmul(a, b, VTraits<v_int32>::vlanes());
2136+
// Convert to f64 before reduction to avoid overflow: #27003
2137+
auto prod_f64 = __riscv_vfcvt_f(prod_i64, VTraits<v_int32>::vlanes());
2138+
return __riscv_vset( // Needs v_float64 (vfloat64m2_t) here.
2139+
v_setall_f64(0.0f), // zero_f64m2
2140+
0,
2141+
__riscv_vfredusum_tu(zero, prod_f64, zero, VTraits<v_int32>::vlanes())
2142+
);
2143+
}
21342144
inline v_float64 v_dotprod_expand_fast(const v_int32& a, const v_int32& b, const v_float64& c)
21352145
{ return v_add(v_dotprod_expand_fast(a, b) , c); }
21362146
#endif

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.