nareshmlx/opencv-pr huggingface dataset:
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** modified
**Context:** PR #12516: core:unv Change behaviour of 16-bit multiply operator - This patch paves the way for #12064 Merge with opencv_contrib: opencv/opencv_contri...
**Review Line:** 672

**Code Changes:**
```diff
+{
+    v_int16x16 c, d;
+    v_mul_expand(a, b, c, d);
+    return v_pack(c, d);
+}
+inline v_uint16x16 operator * (const v_uint16x16& a, const v_uint16x16& b)
+{
+    __m256i pl = _mm256_mullo_epi16(a.val, b.val);
+    __m256i ph = _mm256_mulhi_epu16(a.val, b.val);
+    __m256i p0 = _mm256_unpacklo_epi16(pl, ph);
+    __m256i p1 = _mm256_unpackhi_epi16(pl, ph);
```

Review comment:
Exactly except avx2::uint16 & int64 due performance lose, but I had to implement forward declarations for theses intrinsics in order to re-implement saturation * operations .
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #12596: Add Shufflenet support in ONNX - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/523 ``` force_builders=Custom docker_ima...
**Review Line:** 366

**Code Changes:**
```diff
 
+TEST_P(Test_ONNX_nets, Shufflenet)
+{
+    if (backend == DNN_BACKEND_INFERENCE_ENGINE &&
+         (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_OPENCL || target == DNN_TARGET_MYRIAD))
+        throw SkipTestException("");
+    testONNXModels("shufflenet", pb);
+}
+
 INSTANTIATE_TEST_CASE_P(/**/, Test_ONNX_nets, dnnBackendsAndTargets());
 
```

Review comment:
This test is failed for Myriad target. Please skip it for a while.
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #12596: Add Shufflenet support in ONNX - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/523 ``` force_builders=Custom docker_ima...
**Review Line:** 116

**Code Changes:**
```diff
+TEST_P(Test_ONNX_layers, Transpose)
+{
+    if (backend == DNN_BACKEND_INFERENCE_ENGINE &&
+         (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_OPENCL || target == DNN_TARGET_MYRIAD))
+        throw SkipTestException("");
+    testONNXModels("transpose");
+}
+
 TEST_P(Test_ONNX_layers, Multiplication)
 {
     if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16 ||
```

Review comment:
Tests are failed for Inference Engine backend. Let's skip it or modify a test to work with 4D data.
**File:** modules/core/include/opencv2/core/base.hpp
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...
**Review Line:** 445

**Code Changes:**
```diff
-#define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10)
-
-#define CV_Assert_N(...) do { __CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0)
+#define CV_Assert_2( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_1( __VA_ARGS__ ))
+#define CV_Assert_3( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_2( __VA_ARGS__ ))
+#define CV_Assert_4( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_3( __VA_ARGS__ ))
+#define CV_Assert_5( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_4( __VA_ARGS__ ))
+#define CV_Assert_6( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_5( __VA_ARGS__ ))
+#define CV_Assert_7( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_6( __VA_ARGS__ ))
+#define CV_Assert_8( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_7( __VA_ARGS__ ))
+#define CV_Assert_9( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_8( __VA_ARGS__ ))
```

Review comment:
We should keep order of checks like C++ `if` do. Example: ``` CV_Assert_N(obj, obj->isValid); ``` We want exception here instead of `SIGSEGV` signal.
**File:** modules/core/include/opencv2/core/base.hpp
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...
**Review Line:** 445

**Code Changes:**
```diff
-#define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10)
-
-#define CV_Assert_N(...) do { __CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0)
+#define CV_Assert_2( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_1( __VA_ARGS__ ))
+#define CV_Assert_3( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_2( __VA_ARGS__ ))
+#define CV_Assert_4( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_3( __VA_ARGS__ ))
+#define CV_Assert_5( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_4( __VA_ARGS__ ))
+#define CV_Assert_6( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_5( __VA_ARGS__ ))
+#define CV_Assert_7( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_6( __VA_ARGS__ ))
+#define CV_Assert_8( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_7( __VA_ARGS__ ))
+#define CV_Assert_9( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_8( __VA_ARGS__ ))
```

Review comment:
> We should keep order of checks like C++ if do. So basically, I should write `CV_Assert_1(expr); __CV_EXPAND(CV_Assert_1( __VA_ARGS__ ))` instead of `__CV_EXPAND(CV_Assert_1( __VA_ARGS__ )); CV_Assert_1(expr)` > We want exception here instead of `SIGSEGV` signal. Shall I change how `CV_Assert` is implemented?
**File:** modules/core/include/opencv2/core/base.hpp
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...
**Review Line:** 445

**Code Changes:**
```diff
-#define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10)
-
-#define CV_Assert_N(...) do { __CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0)
+#define CV_Assert_2( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_1( __VA_ARGS__ ))
+#define CV_Assert_3( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_2( __VA_ARGS__ ))
+#define CV_Assert_4( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_3( __VA_ARGS__ ))
+#define CV_Assert_5( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_4( __VA_ARGS__ ))
+#define CV_Assert_6( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_5( __VA_ARGS__ ))
+#define CV_Assert_7( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_6( __VA_ARGS__ ))
+#define CV_Assert_8( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_7( __VA_ARGS__ ))
+#define CV_Assert_9( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_8( __VA_ARGS__ ))
```

Review comment:
Right. No, it is just a comment for the example when it tries dereferencing NULL pointer before actual NULL check.
**File:** modules/dnn/include/opencv2/dnn/dnn.inl.hpp
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...

**Code Changes:**
```diff
@@ -199,6 +199,16 @@ inline void DictValue::release()
     case Param::REAL:
         delete pd;
         break;
+    case Param::BOOLEAN:
+    case Param::MAT:
+    case Param::MAT_VECTOR:
+    case Param::ALGORITHM:
+    case Param::FLOAT:
+    case Param::UNSIGNED_INT:
```

Review comment:
Without "default:" branch and `switch` statement over "enum" - compilers / static analyzers are able to detect missing entries. It is useful when adding new entries to avoid missing of code refactoring. Adding "default" blocks this detection, so this is non-wanted change (here and below). Build-time warning is preferable than runtime error.
**File:** modules/dnn/include/opencv2/dnn/dnn.inl.hpp
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...

**Code Changes:**
```diff
@@ -199,6 +199,16 @@ inline void DictValue::release()
     case Param::REAL:
         delete pd;
         break;
+    case Param::BOOLEAN:
+    case Param::MAT:
+    case Param::MAT_VECTOR:
+    case Param::ALGORITHM:
+    case Param::FLOAT:
+    case Param::UNSIGNED_INT:
```

Review comment:
Please use this pattern: https://github.com/alalek/opencv/commit/pr12310_enum_unhandled
**File:** modules/features2d/src/kaze/AKAZEFeatures.cpp
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...

**Code Changes:**
```diff
@@ -377,7 +377,7 @@ ocl_pm_g2(InputArray Lx_, InputArray Ly_, OutputArray Lflow_, float kcontrast)
 #endif // HAVE_OPENCL
 
 static inline void
-compute_diffusivity(InputArray Lx, InputArray Ly, OutputArray Lflow, float kcontrast, int diffusivity)
+compute_diffusivity(InputArray Lx, InputArray Ly, OutputArray Lflow, float kcontrast, KAZE::DiffusivityType diffusivity)
 {
   CV_INSTRUMENT_REGION();
 
@@ -398,7 +398,7 @@ compute_diffusivity(InputArray Lx, InputArray Ly, OutputArray Lflow, float kcont
```

Review comment:
Initial code is buggy. The first argument for `CV_Error()` should be from `cv::Error` enum: ``` CV_Error_(Error::StsError, ("Diffusivity is not supported: %d", static_cast<int>(diffusivity))); ```
**File:** modules/features2d/src/hal_replacement.hpp
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...

**Code Changes:**
```diff
@@ -66,7 +66,7 @@
    @param width,height Source image dimensions
    @param type FAST type
 */
-inline int hal_ni_FAST_dense(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
+inline int hal_ni_FAST_dense(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, cv::FastFeatureDetector::DetectorType type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
 
 //! @cond IGNORED
 #define cv_hal_FAST_dense hal_ni_FAST_dense
@@ -94,7 +94,7 @@ inline int hal_ni_FAST_NMS(const uchar* src_data, size_t src_step, uchar* dst_da
```

Review comment:
I believe we should not touch "int" in "hal" headers. However for reference we can write with comment hint: ``` int/*cv::FastFeatureDetector::DetectorType*/ type ```
**File:** modules/core/include/opencv2/core/cvdef.h
**Change Type:** modified
**Context:** PR #12310: Introduce enum interface for type-safety - - Merge #12601 first to avoid breaking JS bindings - Merge with opencv/opencv_contrib#1744 ### T...
**Review Line:** 467

**Code Changes:**
```diff
+__CV_ENUM_FLAGS_BITWISE_AND      (EnumType, EnumType, EnumType);                                      \
+__CV_ENUM_FLAGS_BITWISE_XOR      (EnumType, EnumType, EnumType);                                      \
+                                                                                                      \
+__CV_ENUM_FLAGS_BITWISE_OR_EQ    (EnumType, EnumType);                                                \
+__CV_ENUM_FLAGS_BITWISE_AND_EQ   (EnumType, EnumType);                                                \
+__CV_ENUM_FLAGS_BITWISE_XOR_EQ   (EnumType, EnumType);                                                \
+
 /****************************************************************************************\
 *                                    static analysys                                     *
 \****************************************************************************************/
```

Review comment:
I am observing multiple warnings with GCC 7: ``` ../opencv/modules/core/include/opencv2/core/cvdef.h:460:44: warning: extra ‘;’ [-Wpedantic] __CV_ENUM_FLAGS_BITWISE_NOT (EnumType); \ ^ ../opencv/modules/core/include/opencv2/core/mat.hpp:566:1: note: in expansion of macro ‘CV_ENUM_FLAGS’ ``` Probably we have to remove last semicolon in this and other declarations.
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #12502: dnn(test): fix failures of 32-bit builders

**Code Changes:**
```diff
@@ -210,7 +210,11 @@ TEST_P(Test_ONNX_nets, RCNN_ILSVRC13)
     testONNXModels("rcnn_ilsvrc13", pb);
 }
 
+#ifdef OPENCV_32BIT_CONFIGURATION
+TEST_P(Test_ONNX_nets, DISABLED_VGG16)  // memory usage >2Gb
+#else
 TEST_P(Test_ONNX_nets, VGG16)
+#endif
 {
```

Review comment:
Is it observed for both Linux and Windows configs? In example, there is a test which is skipped only for Win32 builds: https://github.com/opencv/opencv/blob/10ae0c4364ecf1bebf3a80f7a6570142e4da7632/modules/dnn/test/test_caffe_importer.cpp#L154-L155
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #12502: dnn(test): fix failures of 32-bit builders

**Code Changes:**
```diff
@@ -210,7 +210,11 @@ TEST_P(Test_ONNX_nets, RCNN_ILSVRC13)
     testONNXModels("rcnn_ilsvrc13", pb);
 }
 
+#ifdef OPENCV_32BIT_CONFIGURATION
+TEST_P(Test_ONNX_nets, DISABLED_VGG16)  // memory usage >2Gb
+#else
 TEST_P(Test_ONNX_nets, VGG16)
+#endif
 {
```

Review comment:
These tests use ~2.5Gb RAM, so it is better to disable them on any 32-bit configuration. It would be nice to disable for 32-bit configurations other tests too which require >1Gb RAM.
**File:** modules/dnn/src/layers/pooling_layer.cpp
**Change Type:** modified
**Context:** PR #12497: dnn: remove raw SSE2 implementation -  ### This pullrequest changes - remove raw SSE2 implementation - Unfortunately, neither test_dnn nor ...

**Code Changes:**
```diff
@@ -488,19 +488,16 @@ class PoolingLayerImpl CV_FINAL : public PoolingLayer
                                             max_val0 = v_max(max_val0, v0);
                                             max_val1 = v_max(max_val1, v1);
                                         }
-#if CV_SSE2
                                     else if( stride_w == 2 )
                                         for (int k = 0; k < kernel_w*kernel_h; k++)
                                         {
                                             int index = ofsptr[k];
-                                            v_float32x4 v00 = v_load(srcData1 + index), v01 = v_load(srcData1 + index + 4);
```

Review comment:
why not use `v_float32x4`?
**File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...

**Code Changes:**
```diff
@@ -60,255 +60,72 @@
 // access from within opencv code more accessible
 namespace cv {
 
-#ifndef CV_DOXYGEN
-
-#ifdef CV_CPU_DISPATCH_MODE
-#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE __CV_CAT(hal_, CV_CPU_DISPATCH_MODE)
-#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN namespace __CV_CAT(hal_, CV_CPU_DISPATCH_MODE) {
-#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END }
```

Review comment:
Code doesn't look consistent. There mess of `CV_SIMD` / `CV_SIMD128`. Update: It is better (clear) to write in the end: ``` #if CV_SIMD128 || CV_SIMD256 #define CV_SIMD 1 #else #define CV_SIMD 0 #endif ```
**File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...
**Review Line:** 311

**Code Changes:**
```diff
+    typedef v_uint64x4   v_uint64;
+    typedef v_int64x4    v_int64;
+    typedef v_float32x8  v_float32;
+    #if CV_SIMD256_64F
+    typedef v_float64x4  v_float64;
+    #endif
+    #if CV_FP16
+    typedef v_float16x16  v_float16;
+    CV_INTRIN_DEFINE_WIDE_INTRIN(short, v_float16, f16, v256, load_f16)
+    #endif
+    CV_INTRIN_DEFINE_WIDE_INTRIN_ALL_TYPES(v256)
```

Review comment:
Fallback ? ``` #elif CV_SIMD128_64F typedef v_float64x2 v_float64; ```
**File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...
**Review Line:** 216

**Code Changes:**
```diff
-    static v_int64x2 all(int64 val) { return v_setall_s64(val); }
+#define CV_INTRIN_DEFINE_WIDE_INTRIN(typ, vtyp, short_typ, prefix, loadsfx) \
+    inline vtyp vx_setall_##short_typ(typ v) { return prefix##_setall_##short_typ(v); } \
+    inline vtyp vx_setzero_##short_typ() { return prefix##_setzero_##short_typ(); } \
+    inline vtyp vx_##loadsfx(const typ* ptr) { return prefix##_##loadsfx(ptr); } \
+    inline vtyp vx_##loadsfx##_aligned(const typ* ptr) { return prefix##_##loadsfx##_aligned(ptr); } \
+    inline void vx_store(typ* ptr, const vtyp& v) { return v_store(ptr, v); } \
+    inline void vx_store_aligned(typ* ptr, const vtyp& v) { return v_store_aligned(ptr, v); }
+
+#define CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(typ, wtyp, prefix) \
+inline wtyp vx_load_expand(const typ* ptr) { return prefix##_load_expand(ptr); }
```

Review comment:
Looks like `loadsfx` is always "load".
**File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...

**Code Changes:**
```diff
@@ -60,255 +60,72 @@
 // access from within opencv code more accessible
 namespace cv {
 
-#ifndef CV_DOXYGEN
-
-#ifdef CV_CPU_DISPATCH_MODE
-#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE __CV_CAT(hal_, CV_CPU_DISPATCH_MODE)
-#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN namespace __CV_CAT(hal_, CV_CPU_DISPATCH_MODE) {
-#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END }
```

Review comment:
For backward compatibility would be nice to keep: - `value_type` - `uint_type` (and perhaps `reinterpret_uint()`)
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** added
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...
**Review Line:** 222

**Code Changes:**
```diff
+                float v4, float v5, float v6, float v7)
+    {
+        val = _mm256_setr_ps(v0, v1, v2, v3, v4, v5, v6, v7);
+    }
+    v_float32x8() : val(_mm256_setzero_ps()) {}
+    float get0() const { return _mm_cvtss_f32(_mm256_castps256_ps128(val)); }
+};
+
+struct v_uint64x4
+{
+    typedef uint64 lane_type;
```

Review comment:
[`_mm256_cvtss_f32`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#techs=AVX&text=_mm256_cvtss_f32&expand=1827)
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** added
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...
**Review Line:** 262

**Code Changes:**
```diff
+
+    explicit v_float64x4(__m256d v) : val(v) {}
+    v_float64x4(double v0, double v1, double v2, double v3)
+    { val = _mm256_setr_pd(v0, v1, v2, v3); }
+    v_float64x4() : val(_mm256_setzero_pd()) {}
+    double get0() const { return _mm_cvtsd_f64(_mm256_castpd256_pd128(val)); }
+};
+
+struct v_float16x16
+{
+    typedef short lane_type;
```

Review comment:
AVX2: `_mm256_cvtsd_f64()`
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** added
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...

**Code Changes:**
```diff
@@ -0,0 +1,2016 @@
+// 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_INTRIN_AVX_HPP
+#define OPENCV_HAL_INTRIN_AVX_HPP
+
+#define CV_SIMD256 1
+#define CV_SIMD256_64F 1
```

Review comment:
AVX2: `_mm256_cvtsi256_si32()`
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** added
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...

**Code Changes:**
```diff
@@ -0,0 +1,2016 @@
+// 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_INTRIN_AVX_HPP
+#define OPENCV_HAL_INTRIN_AVX_HPP
+
+#define CV_SIMD256 1
+#define CV_SIMD256_64F 1
```

Review comment:
[`_mm256_extract_epi64()`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#techs=AVX,AVX2,FMA&text=int64&expand=2291) here and below for `v_int64x4`
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** added
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...
**Review Line:** 1167

**Code Changes:**
```diff
+OPENCV_HAL_IMPL_AVX_ABS(int32x8,  epi32)
+
+inline v_float32x8 v_abs(const v_float32x8& x)
+{ return x & v_float32x8(_mm256_castsi256_ps(_mm256_set1_epi32(0x7fffffff))); }
+inline v_float64x4 v_abs(const v_float64x4& x)
+{ return x & v_float64x4(_mm256_castsi256_pd(_mm256_srli_epi64(_mm256_set1_epi64x(-1), 1))); }
+
+/** Absolute difference **/
+inline v_uint8x32 v_absdiff(const v_uint8x32& a, const v_uint8x32& b)
+{ return v_add_wrap(a - b,  b - a); }
+inline v_uint16x16 v_absdiff(const v_uint16x16& a, const v_uint16x16& b)
```

Review comment:
AVX2: `_mm256_abs_epi8`, `_mm256_abs_epi16`, `_mm256_abs_epi32`
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** added
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...

**Code Changes:**
```diff
@@ -0,0 +1,2016 @@
+// 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_INTRIN_AVX_HPP
+#define OPENCV_HAL_INTRIN_AVX_HPP
+
+#define CV_SIMD256 1
+#define CV_SIMD256_64F 1
```

Review comment:
```.diff -CV_CPU_HAS_SUPPORT_AVX2 +CV_CPU_HAS_SUPPORT_AVX ```
**File:** modules/core/src/mathfuncs_core.simd.hpp
**Change Type:** modified
**Context:** PR #11953: Wide univ intrinsics - this is reworked and updated #10708 by @seiko2plus: #### Tasks - [x] Prepare universal intrinsics to expand (#11022)...
**Review Line:** 127

**Code Changes:**
```diff
+            // if it's inplace operation, we cannot repeatedly process
+            // the tail for the second time, so we have to use the
+            // scalar code
+            if( i == 0 || angle == X || angle == Y )
+                break;
+            i = len - VECSZ*2;
         }
-        return i;
-    }
-private:
-    v_atan<float> impl;
```

Review comment:
if it's inplace operation and something is wrong then X/Y are already corrupted. IMHO, vectorized loops in this file are malformed. Proper design pattern is: ``` for( ; i <= len - BLOCK_SIZE; i += BLOCK_SIZE) { // no more 'if's ... } for( ; i < len; i++ ) { ... } ```