@@ -225,32 +225,32 @@ These operations allow to reorder or recombine elements in one or multiple vecto
225
225
Element-wise binary and unary operations.
226
226
227
227
- Arithmetics:
228
- @ref operator + (const v_reg &a, const v_reg &b) "+",
229
- @ref operator - (const v_reg &a, const v_reg &b) "-",
230
- @ref operator * (const v_reg &a, const v_reg &b) "*",
231
- @ref operator / (const v_reg &a, const v_reg &b) "/",
228
+ @ref v_add (const v_reg &a, const v_reg &b) "+",
229
+ @ref v_sub (const v_reg &a, const v_reg &b) "-",
230
+ @ref v_mul (const v_reg &a, const v_reg &b) "*",
231
+ @ref v_div (const v_reg &a, const v_reg &b) "/",
232
232
@ref v_mul_expand
233
233
234
234
- Non-saturating arithmetics: @ref v_add_wrap, @ref v_sub_wrap
235
235
236
236
- Bitwise shifts:
237
- @ref operator << (const v_reg &a, int s) "<<",
238
- @ref operator >> (const v_reg &a, int s) ">>",
237
+ @ref v_shl (const v_reg &a, int s) "<<",
238
+ @ref v_shr (const v_reg &a, int s) ">>",
239
239
@ref v_shl, @ref v_shr
240
240
241
241
- Bitwise logic:
242
- @ref operator & (const v_reg &a, const v_reg &b) "&",
243
- @ref operator | (const v_reg &a, const v_reg &b) "|",
244
- @ref operator ^ (const v_reg &a, const v_reg &b) "^",
245
- @ref operator ~ (const v_reg &a) "~"
242
+ @ref v_and (const v_reg &a, const v_reg &b) "&",
243
+ @ref v_or (const v_reg &a, const v_reg &b) "|",
244
+ @ref v_xor (const v_reg &a, const v_reg &b) "^",
245
+ @ref v_not (const v_reg &a) "~"
246
246
247
247
- Comparison:
248
- @ref operator > (const v_reg &a, const v_reg &b) ">",
249
- @ref operator >= (const v_reg &a, const v_reg &b) ">=",
250
- @ref operator < (const v_reg &a, const v_reg &b) "<",
251
- @ref operator <= (const v_reg &a, const v_reg &b) "<=",
252
- @ref operator == (const v_reg &a, const v_reg &b) "==",
253
- @ref operator != (const v_reg &a, const v_reg &b) "!="
248
+ @ref v_gt (const v_reg &a, const v_reg &b) ">",
249
+ @ref v_ge (const v_reg &a, const v_reg &b) ">=",
250
+ @ref v_lt (const v_reg &a, const v_reg &b) "<",
251
+ @ref v_le (const v_reg &a, const v_reg &b) "<=",
252
+ @ref v_eq (const v_reg &a, const v_reg &b) "==",
253
+ @ref v_ne (const v_reg &a, const v_reg &b) "!="
254
254
255
255
- min/max: @ref v_min, @ref v_max
256
256
@@ -573,50 +573,43 @@ enum {
573
573
/* * @brief Add values
574
574
575
575
For all types. */
576
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator +(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
577
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n>& operator +=(v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
576
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_add (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
578
577
579
578
/* * @brief Subtract values
580
579
581
580
For all types. */
582
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator -(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
583
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n>& operator -=(v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
581
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_sub (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
584
582
585
583
/* * @brief Multiply values
586
584
587
585
For 16- and 32-bit integer types and floating types. */
588
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator *(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
589
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n>& operator *=(v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
586
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_mul (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
590
587
591
588
/* * @brief Divide values
592
589
593
590
For floating types only. */
594
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator /(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
595
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n>& operator /=(v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
591
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_div (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
596
592
597
593
598
594
/* * @brief Bitwise AND
599
595
600
596
Only for integer types. */
601
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator &(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
602
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n>& operator &=(v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
597
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_and (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
603
598
604
599
/* * @brief Bitwise OR
605
600
606
601
Only for integer types. */
607
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator |(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
608
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n>& operator |=(v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
602
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_or (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
609
603
610
604
/* * @brief Bitwise XOR
611
605
612
606
Only for integer types.*/
613
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator ^(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
614
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n>& operator ^=(v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
607
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_xor (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b);
615
608
616
609
/* * @brief Bitwise NOT
617
610
618
611
Only for integer types.*/
619
- template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> operator ~ (const v_reg<_Tp, n>& a);
612
+ template <typename _Tp, int n> CV_INLINE v_reg<_Tp, n> v_not (const v_reg<_Tp, n>& a);
620
613
621
614
622
615
#ifndef CV_DOXYGEN
@@ -639,71 +632,55 @@ __CV_EXPAND(macro_name(double, __VA_ARGS__)) \
639
632
CV__HAL_INTRIN_EXPAND_WITH_INTEGER_TYPES (macro_name, __VA_ARGS__) \
640
633
CV__HAL_INTRIN_EXPAND_WITH_FP_TYPES(macro_name, __VA_ARGS__) \
641
634
642
- #define CV__HAL_INTRIN_IMPL_BIN_OP_ (_Tp, bin_op ) \
635
+ #define CV__HAL_INTRIN_IMPL_BIN_OP_ (_Tp, bin_op, func ) \
643
636
template <int n> inline \
644
- v_reg<_Tp, n> operator bin_op (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
637
+ v_reg<_Tp, n> func (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
645
638
{ \
646
639
v_reg<_Tp, n> c; \
647
640
for ( int i = 0 ; i < n; i++ ) \
648
641
c.s [i] = saturate_cast<_Tp>(a.s [i] bin_op b.s [i]); \
649
642
return c; \
650
- } \
651
- template <int n> inline \
652
- v_reg<_Tp, n>& operator bin_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
653
- { \
654
- for ( int i = 0 ; i < n; i++ ) \
655
- a.s [i] = saturate_cast<_Tp>(a.s [i] bin_op b.s [i]); \
656
- return a; \
657
643
}
658
644
659
- #define CV__HAL_INTRIN_IMPL_BIN_OP (bin_op ) CV__HAL_INTRIN_EXPAND_WITH_ALL_TYPES(CV__HAL_INTRIN_IMPL_BIN_OP_, bin_op)
645
+ #define CV__HAL_INTRIN_IMPL_BIN_OP (bin_op, func ) CV__HAL_INTRIN_EXPAND_WITH_ALL_TYPES(CV__HAL_INTRIN_IMPL_BIN_OP_, bin_op, func )
660
646
661
- CV__HAL_INTRIN_IMPL_BIN_OP (+)
662
- CV__HAL_INTRIN_IMPL_BIN_OP(-)
663
- CV__HAL_INTRIN_IMPL_BIN_OP(*)
664
- CV__HAL_INTRIN_EXPAND_WITH_FP_TYPES(CV__HAL_INTRIN_IMPL_BIN_OP_, /)
647
+ CV__HAL_INTRIN_IMPL_BIN_OP (+, v_add )
648
+ CV__HAL_INTRIN_IMPL_BIN_OP(-, v_sub )
649
+ CV__HAL_INTRIN_IMPL_BIN_OP(*, v_mul )
650
+ CV__HAL_INTRIN_EXPAND_WITH_FP_TYPES(CV__HAL_INTRIN_IMPL_BIN_OP_, /, v_div )
665
651
666
- #define CV__HAL_INTRIN_IMPL_BIT_OP_ (_Tp, bit_op ) \
652
+ #define CV__HAL_INTRIN_IMPL_BIT_OP_ (_Tp, bit_op, func ) \
667
653
template <int n> CV_INLINE \
668
- v_reg<_Tp, n> operator bit_op (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
654
+ v_reg<_Tp, n> func (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
669
655
{ \
670
656
v_reg<_Tp, n> c; \
671
657
typedef typename V_TypeTraits<_Tp>::int_type itype; \
672
658
for ( int i = 0 ; i < n; i++ ) \
673
659
c.s [i] = V_TypeTraits<_Tp>::reinterpret_from_int ((itype)(V_TypeTraits<_Tp>::reinterpret_int (a.s [i]) bit_op \
674
660
V_TypeTraits<_Tp>::reinterpret_int (b.s [i]))); \
675
661
return c; \
676
- } \
677
- template <int n> CV_INLINE \
678
- v_reg<_Tp, n>& operator bit_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
679
- { \
680
- typedef typename V_TypeTraits<_Tp>::int_type itype; \
681
- for ( int i = 0 ; i < n; i++ ) \
682
- a.s [i] = V_TypeTraits<_Tp>::reinterpret_from_int ((itype)(V_TypeTraits<_Tp>::reinterpret_int (a.s [i]) bit_op \
683
- V_TypeTraits<_Tp>::reinterpret_int (b.s [i]))); \
684
- return a; \
685
662
}
686
663
687
- #define CV__HAL_INTRIN_IMPL_BIT_OP (bit_op ) \
688
- CV__HAL_INTRIN_EXPAND_WITH_INTEGER_TYPES (CV__HAL_INTRIN_IMPL_BIT_OP_, bit_op) \
689
- CV__HAL_INTRIN_EXPAND_WITH_FP_TYPES(CV__HAL_INTRIN_IMPL_BIT_OP_, bit_op) /* TODO: FIXIT remove this after masks refactoring */
664
+ #define CV__HAL_INTRIN_IMPL_BIT_OP (bit_op, func ) \
665
+ CV__HAL_INTRIN_EXPAND_WITH_INTEGER_TYPES (CV__HAL_INTRIN_IMPL_BIT_OP_, bit_op, func ) \
666
+ CV__HAL_INTRIN_EXPAND_WITH_FP_TYPES(CV__HAL_INTRIN_IMPL_BIT_OP_, bit_op, func ) /* TODO: FIXIT remove this after masks refactoring */
690
667
691
668
692
- CV__HAL_INTRIN_IMPL_BIT_OP(&)
693
- CV__HAL_INTRIN_IMPL_BIT_OP(|)
694
- CV__HAL_INTRIN_IMPL_BIT_OP(^)
669
+ CV__HAL_INTRIN_IMPL_BIT_OP(&, v_and )
670
+ CV__HAL_INTRIN_IMPL_BIT_OP(|, v_or )
671
+ CV__HAL_INTRIN_IMPL_BIT_OP(^, v_xor )
695
672
696
- #define CV__HAL_INTRIN_IMPL_BITWISE_NOT_ (_Tp, dummy ) \
673
+ #define CV__HAL_INTRIN_IMPL_BITWISE_NOT_ (_Tp, dummy, dummy2 ) \
697
674
template <int n> CV_INLINE \
698
- v_reg<_Tp, n> operator ~ (const v_reg<_Tp, n>& a) \
675
+ v_reg<_Tp, n> v_not (const v_reg<_Tp, n>& a) \
699
676
{ \
700
677
v_reg<_Tp, n> c; \
701
678
for ( int i = 0 ; i < n; i++ ) \
702
679
c.s [i] = V_TypeTraits<_Tp>::reinterpret_from_int (~V_TypeTraits<_Tp>::reinterpret_int (a.s [i])); \
703
680
return c; \
704
681
} \
705
682
706
- CV__HAL_INTRIN_EXPAND_WITH_INTEGER_TYPES (CV__HAL_INTRIN_IMPL_BITWISE_NOT_, ~)
683
+ CV__HAL_INTRIN_EXPAND_WITH_INTEGER_TYPES (CV__HAL_INTRIN_IMPL_BITWISE_NOT_, ~, v_not )
707
684
708
685
#endif // !CV_DOXYGEN
709
686
@@ -760,7 +737,6 @@ OPENCV_HAL_IMPL_MATH_FUNC(v_exp, std::exp, _Tp)
760
737
* @note Similar to the behavior of std::log(), \f$ \ln(0) = -\infty \f$.
761
738
*/
762
739
OPENCV_HAL_IMPL_MATH_FUNC (v_log, std::log, _Tp)
763
- #define OPENCV_HAL_MATH_HAVE_LOG 1
764
740
765
741
/* *
766
742
* @brief Error function.
@@ -771,9 +747,7 @@ OPENCV_HAL_IMPL_MATH_FUNC(v_erf, std::erf, _Tp)
771
747
772
748
// ! @cond IGNORED
773
749
OPENCV_HAL_IMPL_MATH_FUNC (v_sin, std::sin, _Tp)
774
- #define OPENCV_HAL_MATH_HAVE_SIN 1
775
750
OPENCV_HAL_IMPL_MATH_FUNC (v_cos, std::cos, _Tp)
776
- #define OPENCV_HAL_MATH_HAVE_COS 1
777
751
// ! @endcond
778
752
779
753
/* * @brief Absolute value of elements
@@ -897,9 +871,9 @@ inline void v_minmax( const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
897
871
898
872
// ! @brief Helper macro
899
873
// ! @ingroup core_hal_intrin_impl
900
- #define OPENCV_HAL_IMPL_CMP_OP (cmp_op ) \
874
+ #define OPENCV_HAL_IMPL_CMP_OP (cmp_op, func ) \
901
875
template <typename _Tp, int n> \
902
- inline v_reg<_Tp, n> operator cmp_op (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
876
+ inline v_reg<_Tp, n> func (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
903
877
{ \
904
878
typedef typename V_TypeTraits<_Tp>::int_type itype; \
905
879
v_reg<_Tp, n> c; \
@@ -911,28 +885,28 @@ inline v_reg<_Tp, n> operator cmp_op(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>
911
885
/* * @brief Less-than comparison
912
886
913
887
For all types except 64-bit integer values. */
914
- OPENCV_HAL_IMPL_CMP_OP (<)
888
+ OPENCV_HAL_IMPL_CMP_OP (<, v_lt )
915
889
916
890
/* * @brief Greater-than comparison
917
891
918
892
For all types except 64-bit integer values. */
919
- OPENCV_HAL_IMPL_CMP_OP (>)
893
+ OPENCV_HAL_IMPL_CMP_OP (>, v_gt )
920
894
921
895
/* * @brief Less-than or equal comparison
922
896
923
897
For all types except 64-bit integer values. */
924
- OPENCV_HAL_IMPL_CMP_OP (<=)
898
+ OPENCV_HAL_IMPL_CMP_OP (<=, v_le )
925
899
926
900
/* * @brief Greater-than or equal comparison
927
901
928
902
For all types except 64-bit integer values. */
929
- OPENCV_HAL_IMPL_CMP_OP (>=)
903
+ OPENCV_HAL_IMPL_CMP_OP (>=, v_ge )
930
904
931
905
/* * @brief Equal comparison */
932
- OPENCV_HAL_IMPL_CMP_OP (==)
906
+ OPENCV_HAL_IMPL_CMP_OP (==, v_eq )
933
907
934
908
/* * @brief Not equal comparison */
935
- OPENCV_HAL_IMPL_CMP_OP (!=)
909
+ OPENCV_HAL_IMPL_CMP_OP (!=, v_ne )
936
910
937
911
template <int n>
938
912
inline v_reg<float , n> v_not_nan (const v_reg<float , n>& a)
@@ -1301,8 +1275,8 @@ template<typename _Tp, int n> inline void v_hsum(const v_reg<_Tp, n>& a,
1301
1275
1302
1276
// ! @brief Helper macro
1303
1277
// ! @ingroup core_hal_intrin_impl
1304
- #define OPENCV_HAL_IMPL_SHIFT_OP (shift_op ) \
1305
- template <typename _Tp, int n> inline v_reg<_Tp, n> operator shift_op (const v_reg<_Tp, n>& a, int imm) \
1278
+ #define OPENCV_HAL_IMPL_SHIFT_OP (shift_op, func ) \
1279
+ template <typename _Tp, int n> inline v_reg<_Tp, n> func (const v_reg<_Tp, n>& a, int imm) \
1306
1280
{ \
1307
1281
v_reg<_Tp, n> c; \
1308
1282
for ( int i = 0 ; i < n; i++ ) \
@@ -1313,12 +1287,12 @@ template<typename _Tp, int n> inline v_reg<_Tp, n> operator shift_op(const v_reg
1313
1287
/* * @brief Bitwise shift left
1314
1288
1315
1289
For 16-, 32- and 64-bit integer values. */
1316
- OPENCV_HAL_IMPL_SHIFT_OP (<< )
1290
+ OPENCV_HAL_IMPL_SHIFT_OP (<<, v_shl )
1317
1291
1318
1292
/* * @brief Bitwise shift right
1319
1293
1320
1294
For 16-, 32- and 64-bit integer values. */
1321
- OPENCV_HAL_IMPL_SHIFT_OP (>> )
1295
+ OPENCV_HAL_IMPL_SHIFT_OP (>>, v_shr )
1322
1296
1323
1297
// ! @brief Helper macro
1324
1298
// ! @ingroup core_hal_intrin_impl
@@ -2942,7 +2916,7 @@ OPENCV_HAL_IMPL_C_REINTERPRET(int64, s64)
2942
2916
// ! @ingroup core_hal_intrin_impl
2943
2917
#define OPENCV_HAL_IMPL_C_SHIFTL (_Tp ) \
2944
2918
template <int shift, int n> inline v_reg<_Tp, n> v_shl (const v_reg<_Tp, n>& a) \
2945
- { return a << shift; }
2919
+ { return v_shl (a, shift) ; }
2946
2920
2947
2921
// ! @name Left shift
2948
2922
// ! @{
@@ -2959,7 +2933,7 @@ OPENCV_HAL_IMPL_C_SHIFTL(int64)
2959
2933
// ! @ingroup core_hal_intrin_impl
2960
2934
#define OPENCV_HAL_IMPL_C_SHIFTR (_Tp ) \
2961
2935
template <int shift, int n> inline v_reg<_Tp, n> v_shr (const v_reg<_Tp, n>& a) \
2962
- { return a >> shift; }
2936
+ { return v_shr (a, shift) ; }
2963
2937
2964
2938
// ! @name Right shift
2965
2939
// ! @{
@@ -3285,7 +3259,7 @@ inline v_reg<float, n> v_matmuladd(const v_reg<float, n>& v,
3285
3259
3286
3260
3287
3261
template <int n> inline v_reg<double , n/2 > v_dotprod_expand (const v_reg<int , n>& a, const v_reg<int , n>& b)
3288
- { return v_fma (v_cvt_f64 (a), v_cvt_f64 (b), v_cvt_f64_high (a) * v_cvt_f64_high (b)); }
3262
+ { return v_fma (v_cvt_f64 (a), v_cvt_f64 (b), v_mul ( v_cvt_f64_high (a), v_cvt_f64_high (b) )); }
3289
3263
template <int n> inline v_reg<double , n/2 > v_dotprod_expand (const v_reg<int , n>& a, const v_reg<int , n>& b,
3290
3264
const v_reg<double , n/2 >& c)
3291
3265
{ return v_fma (v_cvt_f64 (a), v_cvt_f64 (b), v_fma (v_cvt_f64_high (a), v_cvt_f64_high (b), c)); }
0 commit comments