nareshmlx/opencv-pr huggingface dataset:
**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)...

**Code Changes:**
```diff
@@ -22,7 +22,6 @@ void log32f(const float *src, float *dst, int n);
 void log64f(const double *src, double *dst, int n);
 float fastAtan2(float y, float x);
 
-
 #ifndef CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
 
 using namespace std;
@@ -36,162 +35,140 @@ static const float atan2_p7 = -0.04432655554792128f*(float)(180/CV_PI);
 
```

Review comment:
`fastAtan32f()` is function with `CV_INSTRUMENT_REGION()` (required for OpenCV entry-points, but using this inside of "per-element" loops should be avoided). Performance may be terrible, than computation in doubles. Do we have performance tests for this?
**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:
IMHO, this should support `CV_AVX` too.
**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:** 212

**Code Changes:**
```diff
 
-template <> struct V_RegTrait128<int64> {
-    typedef v_int64x2 reg;
-    static v_int64x2 zero() { return v_setzero_s64(); }
-    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); } \
```

Review comment:
It would be nice, for "internal" macros using `CV__` prefix (with double underscores). - ASCII code of '_' is greater than A-Z, so IDE with auto-completion shows normal macros at first. - These macros are filtered out from Doxygen [automatically](https://github.com/opencv/opencv/blob/3.4.2/doc/Doxyfile.in#L110)
**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:** 883

**Code Changes:**
```diff
+    v_uint8x32 res;
+    // ESAC control[3] ? [127:0] = 0
+    __m256i swapz = _mm256_permute2x128_si256(a.val, a.val, _MM_SHUFFLE(2, 0, 0, 1));
+
+    if (imm == 0)
+        return a;
+    if (imm == 16)
+        res.val = swapz;
+    else if (imm < 16)
+        res.val = _mm256_alignr_epi8(swapz, a.val, imm);
+    else if (imm < 32)
```

Review comment:
What is about definition of template specialization instead of `if`? At least we don't need "swapz" in this case.
**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` is not supported by some compilers
**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:
nope, sometimes it's load_f16
**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:** 79

**Code Changes:**
```diff
+        typedef w_type_ w_type; \
+        typedef q_type_ q_type; \
+        typedef sum_type_ sum_type; \
+        enum { nlanes128 = nlanes128_ }; \
+    \
+        static inline int_type reinterpret_int(type x) \
+        { \
+            union { type l; int_type i; } v; \
+            v.l = x; \
+            return v.i; \
+        } \
```

Review comment:
Please restore this code block on this place (exact after "namespace cv {"). All HAL intrinsic types must be guarded, including "V_TypeTraits".
**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:
there is no `_mm256_abs_p(s|d)`, unfortunately
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -16,19 +16,18 @@ namespace cv
 {
 using std::vector;
 
-class QRDecode
+class QRDetect
 {
 public:
-    void init(Mat src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
+    void init(const Mat& src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
```

Review comment:
`const Mat& src` + `CV_Assert(!src.empty());`
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -16,19 +16,18 @@ namespace cv
 {
 using std::vector;
 
-class QRDecode
+class QRDetect
 {
 public:
-    void init(Mat src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
+    void init(const Mat& src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
```

Review comment:
It is really strange source image pre-processing: add more resize artifacts to detect something.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -16,19 +16,18 @@ namespace cv
 {
 using std::vector;
 
-class QRDecode
+class QRDetect
 {
 public:
-    void init(Mat src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
+    void init(const Mat& src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
```

Review comment:
> bin_barcode = Mat::zeros(barcode.size(), CV_8UC1); initialization is useless due the next line
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -16,19 +16,18 @@ namespace cv
 {
 using std::vector;
 
-class QRDecode
+class QRDetect
 {
 public:
-    void init(Mat src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
+    void init(const Mat& src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
```

Review comment:
Keep local variables scope small (it is not used outside of inner loop). Declare in below: ```.diff -future_pixel = 255; +uint8_t future_pixel = 255; ``` --- In the function beginning it is fine to declare constants.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -16,19 +16,18 @@ namespace cv
 {
 using std::vector;
 
-class QRDecode
+class QRDetect
 {
 public:
-    void init(Mat src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
+    void init(const Mat& src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
```

Review comment:
replace the signature to `QRDetect::separateVerticalLines(const vector<Vec3d>& list_lines)`. Never pass `vector<>` by value
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -16,19 +16,18 @@ namespace cv
 {
 using std::vector;
 
-class QRDecode
+class QRDetect
 {
 public:
-    void init(Mat src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
+    void init(const Mat& src, double eps_vertical_ = 0.2, double eps_horizontal_ = 0.1);
```

Review comment:
use `cvRound()` or `saturate_cast<int>()` for better accuracy.
**File:** samples/cpp/live_detect_qrcode.cpp
**Change Type:** added
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -0,0 +1,170 @@
+#include "opencv2/objdetect.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/highgui.hpp"
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace cv;
+
```

Review comment:
"Cannot open a camera"
**File:** samples/cpp/live_detect_qrcode.cpp
**Change Type:** added
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -0,0 +1,170 @@
+#include "opencv2/objdetect.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/highgui.hpp"
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace cv;
+
```

Review comment:
1. use cvRound() instead of static_cast for better accuracy 2. do not pass fps to getMatWithQRCodeContour() function. Instead, render it right here. Or put it to a separate function. It's more logical. Visualization should be de-coupled from the processing part.
**File:** samples/cpp/live_detect_qrcode.cpp
**Change Type:** added
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -0,0 +1,170 @@
+#include "opencv2/objdetect.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/highgui.hpp"
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace cv;
+
```

Review comment:
the logic of the sample is weird. Please, change it to the following: * no parameters - use `camera` mode. * `i` is set - `show_image` * both `i` and `o` are set - `save_image`.
**File:** samples/cpp/live_detect_qrcode.cpp
**Change Type:** added
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -0,0 +1,170 @@
+#include "opencv2/objdetect.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/highgui.hpp"
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace cv;
+
```

Review comment:
please, change it to a loop from 0 to 4.
**File:** samples/cpp/live_detect_qrcode.cpp
**Change Type:** added
**Context:** PR #12204: Objdetect: QRCode detector: Optimization search lines and added sample - 1. Optimization function - searchVerticalLines (new name searchHor...

**Code Changes:**
```diff
@@ -0,0 +1,170 @@
+#include "opencv2/objdetect.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/highgui.hpp"
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace cv;
+
```

Review comment:
pass boolean flag instead of fps=-1. It's also interesting to see how much time the algorithm spends when there is no QR code. That is, FPS should be _always_ displayed.
**File:** modules/core/include/opencv2/core/hal/interface.h
**Change Type:** modified
**Context:** PR #12463: added basic support for CV_16F (the new datatype etc.) - CV_USRTYPE1 is now equal to CV_16F, which may break some [rarely used] functionali...
**Review Line:** 79

**Code Changes:**
```diff
@@ -76,6 +76,7 @@ typedef signed char schar;
 #define CV_32F  5
 #define CV_64F  6
 #define CV_USRTYPE1 7
+#define CV_16F  7
 
 #define CV_MAT_DEPTH_MASK       (CV_DEPTH_MAX - 1)
 #define CV_MAT_DEPTH(flags)     ((flags) & CV_MAT_DEPTH_MASK)
@@ -124,6 +125,12 @@ typedef signed char schar;
 #define CV_64FC3 CV_MAKETYPE(CV_64F,3)
```

Review comment:
> #define CV_USRTYPE1 7 Lets leave message for users about compatibility/migration problems: ``` #define CV_USRTYPE1 (void)"CV_USRTYPE1 support has been dropped in OpenCV 4.0" ```
**File:** modules/core/src/rand.cpp
**Change Type:** modified
**Context:** PR #12463: added basic support for CV_16F (the new datatype etc.) - CV_USRTYPE1 is now equal to CV_16F, which may break some [rarely used] functionali...

**Code Changes:**
```diff
@@ -48,18 +48,6 @@
 
 #include "precomp.hpp"
 
-#if defined _WIN32 || defined WINCE
-    #include <windows.h>
-    #undef small
-    #undef min
-    #undef max
-    #undef abs
```

Review comment:
Early error detection: #8300 Filling **empty** Mat with random numbers is not a normal use case of OpenCV.
**File:** modules/ts/src/ts_perf.cpp
**Change Type:** modified
**Context:** PR #12463: added basic support for CV_16F (the new datatype etc.) - CV_USRTYPE1 is now equal to CV_16F, which may break some [rarely used] functionali...
**Review Line:** 2211

**Code Changes:**
```diff
         case CV_32S: *os << "32S"; break;
         case CV_32F: *os << "32F"; break;
         case CV_64F: *os << "64F"; break;
-        case CV_USRTYPE1: *os << "USRTYPE1"; break;
+        case CV_USRTYPE1: *os << "16F"; break;
         default: *os << "INVALID_TYPE"; break;
     }
     *os << 'C' << CV_MAT_CN((int)t);
```

Review comment:
It is time to replace this switch to something of: ``` depthToString(t) typeToString(t) ```
**File:** modules/core/include/opencv2/core/hal/interface.h
**Change Type:** modified
**Context:** PR #12463: added basic support for CV_16F (the new datatype etc.) - CV_USRTYPE1 is now equal to CV_16F, which may break some [rarely used] functionali...
**Review Line:** 79

**Code Changes:**
```diff
@@ -76,6 +76,7 @@ typedef signed char schar;
 #define CV_32F  5
 #define CV_64F  6
 #define CV_USRTYPE1 7
+#define CV_16F  7
 
 #define CV_MAT_DEPTH_MASK       (CV_DEPTH_MAX - 1)
 #define CV_MAT_DEPTH(flags)     ((flags) & CV_MAT_DEPTH_MASK)
@@ -124,6 +125,12 @@ typedef signed char schar;
 #define CV_64FC3 CV_MAKETYPE(CV_64F,3)
```

Review comment:
there are a few places where USRTYPE1 is still used, but need to be adjusted, e.g. Torch importer in DNN.
**File:** modules/ts/src/ts_perf.cpp
**Change Type:** modified
**Context:** PR #12463: added basic support for CV_16F (the new datatype etc.) - CV_USRTYPE1 is now equal to CV_16F, which may break some [rarely used] functionali...
**Review Line:** 2211

**Code Changes:**
```diff
         case CV_32S: *os << "32S"; break;
         case CV_32F: *os << "32F"; break;
         case CV_64F: *os << "64F"; break;
-        case CV_USRTYPE1: *os << "USRTYPE1"; break;
+        case CV_USRTYPE1: *os << "16F"; break;
         default: *os << "INVALID_TYPE"; break;
     }
     *os << 'C' << CV_MAT_CN((int)t);
```

Review comment:
the naive change to typeToString(t) breaks the perf tests because of different naming conventions. Let's leave it as-is for now
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** modified
**Context:** PR #12063: further improvements in split & merge; started using non-temporary store instructions - 1. changed `static const __m128/256` to const `__m1...
**Review Line:** 309

**Code Changes:**
```diff
     { _mm256_storeu_si256((__m256i*)ptr, a.val); }                    \
     inline void v_store_aligned(_Tp* ptr, const _Tpvec& a)            \
     { _mm256_store_si256((__m256i*)ptr, a.val); }                     \
+    inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a)    \
+    { _mm256_stream_si256((__m256i*)ptr, a.val); }                    \
+    inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \
+    { \
+        if( mode == hal::STORE_UNALIGNED ) \
+            _mm256_storeu_si256((__m256i*)ptr, a.val); \
+        else if( mode == hal::STORE_ALIGNED_NOCACHE )  \
+            _mm256_stream_si256((__m256i*)ptr, a.val); \
```

Review comment:
> mode I would like to avoid using this as a regular function parameter. Overwise somebody would try to pass this parameters dynamically via several function calls making code unreadable. I already fixed sporadic crashes caused by improper usage of aligned memory access with unaligned pointers. Don't make debugging more harder. Separate functions with different names are preferable (added). Or at least template parameter instead of this regular.
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** modified
**Context:** PR #12063: further improvements in split & merge; started using non-temporary store instructions - 1. changed `static const __m128/256` to const `__m1...
**Review Line:** 309

**Code Changes:**
```diff
     { _mm256_storeu_si256((__m256i*)ptr, a.val); }                    \
     inline void v_store_aligned(_Tp* ptr, const _Tpvec& a)            \
     { _mm256_store_si256((__m256i*)ptr, a.val); }                     \
+    inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a)    \
+    { _mm256_stream_si256((__m256i*)ptr, a.val); }                    \
+    inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \
+    { \
+        if( mode == hal::STORE_UNALIGNED ) \
+            _mm256_storeu_si256((__m256i*)ptr, a.val); \
+        else if( mode == hal::STORE_ALIGNED_NOCACHE )  \
+            _mm256_stream_si256((__m256i*)ptr, a.val); \
```

Review comment:
> sporadic crashes I would be very happy if they crash on my developer machine. Mentioned crashes are usually on remote machine without any debugger attached. Only "printf" debugging and manual code inspection (and "aligned" suffix without any visible pre-checks really helps to "see" that bugs). Also values of template parameters / different names are visible on stack traces. Parameters are not shown (release mode).
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** modified
**Context:** PR #12063: further improvements in split & merge; started using non-temporary store instructions - 1. changed `static const __m128/256` to const `__m1...
**Review Line:** 309

**Code Changes:**
```diff
     { _mm256_storeu_si256((__m256i*)ptr, a.val); }                    \
     inline void v_store_aligned(_Tp* ptr, const _Tpvec& a)            \
     { _mm256_store_si256((__m256i*)ptr, a.val); }                     \
+    inline void v_store_aligned_nocache(_Tp* ptr, const _Tpvec& a)    \
+    { _mm256_stream_si256((__m256i*)ptr, a.val); }                    \
+    inline void v_store(_Tp* ptr, const _Tpvec& a, hal::StoreMode mode) \
+    { \
+        if( mode == hal::STORE_UNALIGNED ) \
+            _mm256_storeu_si256((__m256i*)ptr, a.val); \
+        else if( mode == hal::STORE_ALIGNED_NOCACHE )  \
+            _mm256_stream_si256((__m256i*)ptr, a.val); \
```

Review comment:
it does not matter; it will show that it crashed inside v_store(ptr, reg, mode), not just in v_store(ptr, reg). Then you can try to modify the intrinsic to disable aligned and aligned_cache branches and recompile the code. If the crash is gone, the root cause if found. It's no different than putting if statements one level up.
**File:** modules/dnn/include/opencv2/dnn/dict.hpp
**Change Type:** modified
**Context:** PR #12071: Added ONNX parser with AlexNet support - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/499 related #11008 ``` force_bui...

**Code Changes:**
```diff
@@ -141,6 +141,9 @@ class CV_EXPORTS Dict
     template<typename T>
     const T &set(const String &key, const T &value);
 
+    //! Erase @p key from the dictionary.
+    void erase(const String &key);
+
     friend std::ostream &operator<<(std::ostream &stream, const Dict &dict);
 
     std::map<String, DictValue>::const_iterator begin() const;
```

Review comment:
Please update a comment comparing to method
**File:** modules/dnn/include/opencv2/dnn/dnn.inl.hpp
**Change Type:** modified
**Context:** PR #12071: Added ONNX parser with AlexNet support - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/499 related #11008 ``` force_bui...

**Code Changes:**
```diff
@@ -364,6 +364,11 @@ inline const T &Dict::set(const String &key, const T &value)
     return value;
 }
 
+inline void Dict::erase(const String &key)
+{
+    dict.erase(key);
+}
+
 inline std::ostream &operator<<(std::ostream &stream, const Dict &dict)
```

Review comment:
I think a single `dict.erase(key);` is enough here.
**File:** modules/dnn/src/onnx/onnx_importer.cpp
**Change Type:** added
**Context:** PR #12071: Added ONNX parser with AlexNet support - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/499 related #11008 ``` force_bui...

**Code Changes:**
```diff
@@ -0,0 +1,585 @@
+// 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.
+
+// Copyright (C) 2018, Intel Corporation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+
```

Review comment:
`create` methods allocates a data but the following line replaces data pointer => memory leak.