Skip to content

Commit 5ab4623

Browse files
committed
Merge pull request opencv#19430 from alalek:fixup_19216
2 parents cdf73f2 + 30bef20 commit 5ab4623

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

modules/core/include/opencv2/core/hal/intrin_wasm.hpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,16 +1266,17 @@ OPENCV_HAL_IMPL_WASM_BIN_FUNC(v_uint8x16, v_sub_wrap, wasm_i8x16_sub)
12661266
OPENCV_HAL_IMPL_WASM_BIN_FUNC(v_int8x16, v_sub_wrap, wasm_i8x16_sub)
12671267
OPENCV_HAL_IMPL_WASM_BIN_FUNC(v_uint16x8, v_sub_wrap, wasm_i16x8_sub)
12681268
OPENCV_HAL_IMPL_WASM_BIN_FUNC(v_int16x8, v_sub_wrap, wasm_i16x8_sub)
1269-
#if (__EMSCRIPTEN_major__ * 1000000 + __EMSCRIPTEN_minor__ * 1000 + __EMSCRIPTEN_tiny__) >= (2000000)
1269+
#if (__EMSCRIPTEN_major__ * 1000000 + __EMSCRIPTEN_minor__ * 1000 + __EMSCRIPTEN_tiny__) >= (1039012)
12701270
// details: https://github.com/opencv/opencv/issues/18097 ( https://github.com/emscripten-core/emscripten/issues/12018 )
1271+
// 1.39.12: https://github.com/emscripten-core/emscripten/commit/cd801d0f110facfd694212a3c8b2ed2ffcd630e2
12711272
inline v_uint8x16 v_mul_wrap(const v_uint8x16& a, const v_uint8x16& b)
12721273
{
12731274
uchar a_[16], b_[16];
12741275
wasm_v128_store(a_, a.val);
12751276
wasm_v128_store(b_, b.val);
12761277
for (int i = 0; i < 16; i++)
12771278
a_[i] = (uchar)(a_[i] * b_[i]);
1278-
return wasm_v128_load(a_);
1279+
return v_uint8x16(wasm_v128_load(a_));
12791280
}
12801281
inline v_int8x16 v_mul_wrap(const v_int8x16& a, const v_int8x16& b)
12811282
{
@@ -1284,7 +1285,7 @@ inline v_int8x16 v_mul_wrap(const v_int8x16& a, const v_int8x16& b)
12841285
wasm_v128_store(b_, b.val);
12851286
for (int i = 0; i < 16; i++)
12861287
a_[i] = (schar)(a_[i] * b_[i]);
1287-
return wasm_v128_load(a_);
1288+
return v_int8x16(wasm_v128_load(a_));
12881289
}
12891290
#else
12901291
OPENCV_HAL_IMPL_WASM_BIN_FUNC(v_uint8x16, v_mul_wrap, wasm_i8x16_mul)
@@ -1757,8 +1758,8 @@ inline v_uint64x2 v_popcount(const v_uint64x2& a)
17571758
uint64 a_[2], b_[2] = { 0 };
17581759
wasm_v128_store(a_, a.val);
17591760
for (int i = 0; i < 16; i++)
1760-
b_[i / 8] += popCountTable[((uint8*)a_)[i]];
1761-
return wasm_v128_load(b_);
1761+
b_[i / 8] += popCountTable[((uint8_t*)a_)[i]];
1762+
return v_uint64x2(wasm_v128_load(b_));
17621763
}
17631764
inline v_uint8x16 v_popcount(const v_int8x16& a)
17641765
{ return v_popcount(v_reinterpret_as_u8(a)); }
@@ -1938,11 +1939,11 @@ inline v_int32x4 func(const v_float64x2& a) \
19381939
double a_[2]; \
19391940
wasm_v128_store(a_, a.val); \
19401941
int c_[4]; \
1941-
c_[0] = cfunc(a_[i]); \
1942-
c_[1] = cfunc(a_[i]); \
1942+
c_[0] = cfunc(a_[0]); \
1943+
c_[1] = cfunc(a_[1]); \
19431944
c_[2] = 0; \
19441945
c_[3] = 0; \
1945-
return wasm_v128_load(c_); \
1946+
return v_int32x4(wasm_v128_load(c_)); \
19461947
}
19471948

19481949
OPENCV_HAL_IMPL_WASM_MATH_FUNC(v_round, cvRound)
@@ -1960,7 +1961,7 @@ inline v_int32x4 v_round(const v_float64x2& a, const v_float64x2& b)
19601961
c_[1] = cvRound(a_[1]);
19611962
c_[2] = cvRound(b_[0]);
19621963
c_[3] = cvRound(b_[1]);
1963-
return wasm_v128_load(c_);
1964+
return v_int32x4(wasm_v128_load(c_));
19641965
}
19651966

19661967
#define OPENCV_HAL_IMPL_WASM_TRANSPOSE4x4(_Tpvec, suffix) \
@@ -2461,7 +2462,7 @@ inline v_float32x4 v_cvt_f32(const v_float64x2& a)
24612462
c_[1] = (float)(a_[1]);
24622463
c_[2] = 0;
24632464
c_[3] = 0;
2464-
return wasm_v128_load(c_);
2465+
return v_float32x4(wasm_v128_load(c_));
24652466
}
24662467

24672468
inline v_float32x4 v_cvt_f32(const v_float64x2& a, const v_float64x2& b)
@@ -2474,7 +2475,7 @@ inline v_float32x4 v_cvt_f32(const v_float64x2& a, const v_float64x2& b)
24742475
c_[1] = (float)(a_[1]);
24752476
c_[2] = (float)(b_[0]);
24762477
c_[3] = (float)(b_[1]);
2477-
return wasm_v128_load(c_);
2478+
return v_float32x4(wasm_v128_load(c_));
24782479
}
24792480

24802481
inline v_float64x2 v_cvt_f64(const v_int32x4& a)
@@ -2488,7 +2489,7 @@ inline v_float64x2 v_cvt_f64(const v_int32x4& a)
24882489
double c_[2];
24892490
c_[0] = (double)(a_[0]);
24902491
c_[1] = (double)(a_[1]);
2491-
return wasm_v128_load(c_);
2492+
return v_float64x2(wasm_v128_load(c_));
24922493
#endif
24932494
}
24942495

@@ -2503,7 +2504,7 @@ inline v_float64x2 v_cvt_f64_high(const v_int32x4& a)
25032504
double c_[2];
25042505
c_[0] = (double)(a_[2]);
25052506
c_[1] = (double)(a_[3]);
2506-
return wasm_v128_load(c_);
2507+
return v_float64x2(wasm_v128_load(c_));
25072508
#endif
25082509
}
25092510

@@ -2514,7 +2515,7 @@ inline v_float64x2 v_cvt_f64(const v_float32x4& a)
25142515
double c_[2];
25152516
c_[0] = (double)(a_[0]);
25162517
c_[1] = (double)(a_[1]);
2517-
return wasm_v128_load(c_);
2518+
return v_float64x2(wasm_v128_load(c_));
25182519
}
25192520

25202521
inline v_float64x2 v_cvt_f64_high(const v_float32x4& a)
@@ -2524,7 +2525,7 @@ inline v_float64x2 v_cvt_f64_high(const v_float32x4& a)
25242525
double c_[2];
25252526
c_[0] = (double)(a_[2]);
25262527
c_[1] = (double)(a_[3]);
2527-
return wasm_v128_load(c_);
2528+
return v_float64x2(wasm_v128_load(c_));
25282529
}
25292530

25302531
inline v_float64x2 v_cvt_f64(const v_int64x2& a)
@@ -2537,7 +2538,7 @@ inline v_float64x2 v_cvt_f64(const v_int64x2& a)
25372538
double c_[2];
25382539
c_[0] = (double)(a_[0]);
25392540
c_[1] = (double)(a_[1]);
2540-
return wasm_v128_load(c_);
2541+
return v_float64x2(wasm_v128_load(c_));
25412542
#endif
25422543
}
25432544

@@ -2757,7 +2758,7 @@ inline v_float32x4 v_load_expand(const float16_t* ptr)
27572758
float a[4];
27582759
for (int i = 0; i < 4; i++)
27592760
a[i] = ptr[i];
2760-
return wasm_v128_load(a);
2761+
return v_float32x4(wasm_v128_load(a));
27612762
}
27622763

27632764
inline void v_pack_store(float16_t* ptr, const v_float32x4& v)

0 commit comments

Comments
 (0)