nareshmlx/opencv-pr huggingface dataset:
**File:** modules/imgproc/src/deriv.cpp
**Change Type:** modified
**Context:** PR #2614: IPP: cv::Laplacian - check_regression=_aplaci_ test_filter=_aplaci_ test_modules=imgproc build_examples=OFF
**Review Line:** 582

**Code Changes:**
```diff
         ddepth = sdepth;
     _dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) );
 
+#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
+    if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
+        ((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)))
+    {
+        int iscale = saturate_cast<int>(scale), idelta = saturate_cast<int>(delta);
+        bool floatScale = std::fabs(scale - iscale) > DBL_EPSILON, needScale = iscale != 1;
+        bool floatDelta = std::fabs(delta - idelta) > DBL_EPSILON, needDelta = delta != 0;
+        int borderTypeNI = borderType & ~BORDER_ISOLATED;
```

Review comment:
Is this condition valid: `(borderType & BORDER_ISOLATED) == 0`?
**File:** modules/imgproc/src/deriv.cpp
**Change Type:** modified
**Context:** PR #2614: IPP: cv::Laplacian - check_regression=_aplaci_ test_filter=_aplaci_ test_modules=imgproc build_examples=OFF

**Code Changes:**
```diff
@@ -577,6 +577,64 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
         ddepth = sdepth;
     _dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) );
 
+#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
+    if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
+        ((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)))
+    {
+        int iscale = saturate_cast<int>(scale), idelta = saturate_cast<int>(delta);
+        bool floatScale = std::fabs(scale - iscale) > DBL_EPSILON, needScale = iscale != 1;
```

Review comment:
Separate common function will be great for this conversion.
**File:** modules/imgproc/src/deriv.cpp
**Change Type:** modified
**Context:** PR #2614: IPP: cv::Laplacian - check_regression=_aplaci_ test_filter=_aplaci_ test_modules=imgproc build_examples=OFF

**Code Changes:**
```diff
@@ -577,6 +577,64 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
         ddepth = sdepth;
     _dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) );
 
+#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
+    if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
+        ((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)))
+    {
+        int iscale = saturate_cast<int>(scale), idelta = saturate_cast<int>(delta);
+        bool floatScale = std::fabs(scale - iscale) > DBL_EPSILON, needScale = iscale != 1;
```

Review comment:
Is result checked?
**File:** modules/imgproc/src/deriv.cpp
**Change Type:** modified
**Context:** PR #2614: IPP: cv::Laplacian - check_regression=_aplaci_ test_filter=_aplaci_ test_modules=imgproc build_examples=OFF

**Code Changes:**
```diff
@@ -577,6 +577,64 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
         ddepth = sdepth;
     _dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) );
 
+#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
+    if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) != 0 || !_src.isSubmatrix()) &&
+        ((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)))
+    {
+        int iscale = saturate_cast<int>(scale), idelta = saturate_cast<int>(delta);
+        bool floatScale = std::fabs(scale - iscale) > DBL_EPSILON, needScale = iscale != 1;
```

Review comment:
BTW, It is hard to debug multiline macro.
**File:** modules/imgproc/src/deriv.cpp
**Change Type:** modified
**Context:** PR #2614: IPP: cv::Laplacian - check_regression=_aplaci_ test_filter=_aplaci_ test_modules=imgproc build_examples=OFF
**Review Line:** 616

**Code Changes:**
```diff
+            if (sdepth == CV_8U && ddepth == CV_16S && !floatScale && !floatDelta)
+            {
+                IPP_FILTER_LAPLACIAN(Ipp8u, Ipp16s, 8u16s);
+
+                if (needScale && status >= 0)
+                    status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, (Ipp16s *)dst.data, (int)dst.step, roisize, 0);
+                if (needDelta && status >= 0)
+                    status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, (Ipp16s *)dst.data, (int)dst.step, roisize, 0);
+            }
+            else if (sdepth == CV_32F && ddepth == CV_32F)
+            {
```

Review comment:
Result is not checked if `needScale && needDelta`
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.
**Review Line:** 1883

**Code Changes:**
```diff
                         return (int)(message.wParam << 16);
                     }
+
+                    // Intercept Ctrl+C for copy to clipboard
+                    if ('C' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
+                        ::PostMessage(message.hwnd, WM_COPY, 0, 0);
+
                 default:
                     DispatchMessage(&message);
                     is_processed = 1;
```

Review comment:
This seems like a rather roundabout way of doing it. Why not do the copy either right here, or in a `WM_KEYDOWN` handler in `MainWindowProc`? Moreover, the documentation for `WM_COPY` says it's to be used with edit controls or combo boxes, and while I don't think it makes this use an error, it's still questionable.
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.

**Code Changes:**
```diff
@@ -1286,6 +1286,10 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 
     switch(uMsg)
     {
+    case WM_COPY:
+        ::WindowProc(hwnd, uMsg, wParam, lParam); // call highgui proc. There may be a better way to do this.
+        break;
+
     case WM_DESTROY:
 
```

Review comment:
The indentation suddenly changed from 4 spaces to 3 here. Please fix.
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.
**Review Line:** 1883

**Code Changes:**
```diff
                         return (int)(message.wParam << 16);
                     }
+
+                    // Intercept Ctrl+C for copy to clipboard
+                    if ('C' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
+                        ::PostMessage(message.hwnd, WM_COPY, 0, 0);
+
                 default:
                     DispatchMessage(&message);
                     is_processed = 1;
```

Review comment:
> In modules/highgui/src/window_w32.cpp: > > > @@ -1789,6 +1868,11 @@ static LRESULT CALLBACK HGToolbarProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPAR > > is_processed = 1; > > return (int)(message.wParam << 16); > > } > > + > > - // Intercept Ctrl+C for copy to clipboard > > - if ('C' == message.wParam && (::GetKeyState(VK_CONTROL)>>15)) > > - ::PostMessage(message.hwnd, WM_COPY, 0, 0); > > This seems like a rather roundabout way of doing it. Why not do the copy > either right here, or in a WM_KEYDOWN handler in MainWindowProc? > > That's true, but the whole code is kind-of roundabout. I don't really > understand why there are 2, or even 3 (if you count cvWaitKey), proc > functions and message handlers. > The thing is that not every key-stroke (combination) actually gets to > MainWindowProc. Also this way waitKey() can return immediately while the copy is done via the Windows message queue. Moreover, the documentation for WM_COPY says it's to be used with edit > controls or combo boxes, and while I don't think it makes this use an > error, it's still questionable. > > Indeed, but why define a new message value when there is one already > available to say the same thing. > If ever it will be deemed important to add a menu, it will still be able to > use the same WM_COPY, or the one I used can be replaced with a custom value.
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.
**Review Line:** 1883

**Code Changes:**
```diff
                         return (int)(message.wParam << 16);
                     }
+
+                    // Intercept Ctrl+C for copy to clipboard
+                    if ('C' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
+                        ::PostMessage(message.hwnd, WM_COPY, 0, 0);
+
                 default:
                     DispatchMessage(&message);
                     is_processed = 1;
```

Review comment:
> That's true, but the whole code is kind-of roundabout. I don't really understand why there are 2, or even 3 (if you count cvWaitKey), proc functions and message handlers. One of them is for the top-level window; the other is for the child window that actually displays the image. `cvWaitKey` handles certain messages itself, because it has to return when a key has been pressed. > The thing is that not every key-stroke (combination) actually gets to MainWindowProc. Are you saying that Ctrl+C doesn't? It seems like it would be dispatched by the `default:` branch below. > Also this way waitKey() can return immediately while the copy is done via the Windows message queue. Does it take a sizeable amount of time? And why would it return immediately anyway? This branch doesn't break out of the message loop. > Indeed, but why define a new message value when there is one already available to say the same thing. Why use an additional message at all? It seems like `WM_KEYDOWN` is more than enough. > If ever it will be deemed important to add a menu, it will still be able to use the same WM_COPY, or the one I used can be replaced with a custom value. Not really following you, but it seems like one could simply use a function.
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.
**Review Line:** 1515

**Code Changes:**
```diff
+
+                // The image copied to the clipboard will be in its original size, regardless if the window itself was resized.
+
+                // Render the image to the dc/bitmap (at original size).
+                if (!::BitBlt( memDC, 0, 0, size.cx, size.cy, window->dc, 0, 0, SRCCOPY ))
+                    break;
+
+                // Finally, set bitmap to clipboard
+                ::SetClipboardData(CF_BITMAP, memBM);
+            } while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant"
+
```

Review comment:
There's some duplication here with `WM_PAINT`. Could you perhaps refactor it into a "DrawImageIntoDC" function, or something like that?
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.

**Code Changes:**
```diff
@@ -1286,6 +1286,10 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 
     switch(uMsg)
     {
+    case WM_COPY:
+        ::WindowProc(hwnd, uMsg, wParam, lParam); // call highgui proc. There may be a better way to do this.
+        break;
+
     case WM_DESTROY:
 
```

Review comment:
Come on, this isn't Perl. What's wrong with `if (thing) Release(thing);`?
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.
**Review Line:** 1515

**Code Changes:**
```diff
+
+                // The image copied to the clipboard will be in its original size, regardless if the window itself was resized.
+
+                // Render the image to the dc/bitmap (at original size).
+                if (!::BitBlt( memDC, 0, 0, size.cx, size.cy, window->dc, 0, 0, SRCCOPY ))
+                    break;
+
+                // Finally, set bitmap to clipboard
+                ::SetClipboardData(CF_BITMAP, memBM);
+            } while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant"
+
```

Review comment:
The code is not identical, specifically in it's error handling. I didn't write the original code so I wanted to make as few changes as possible. I prefer not to go refactoring this code as I don't completely understand why it was written as it was.
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2179: [HighGUI] On Windows: Support Ctrl+C to copy image to clipboard. - Added support for copying the image to the clipboard.
**Review Line:** 1883

**Code Changes:**
```diff
                         return (int)(message.wParam << 16);
                     }
+
+                    // Intercept Ctrl+C for copy to clipboard
+                    if ('C' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
+                        ::PostMessage(message.hwnd, WM_COPY, 0, 0);
+
                 default:
                     DispatchMessage(&message);
                     is_processed = 1;
```

Review comment:
I tried various versions of inserting the Ctrl+C handler into the code. This is what worked. As I said, I don't completely understand the the proc flow as it is implemented, but some things are not passed-on and others skip directly further down. This is how I got it to work with as few trade-offs as possible.
**File:** cmake/OpenCVCompilerOptions.cmake
**Change Type:** modified
**Context:** PR #2338: gcov tool support added.

**Code Changes:**
```diff
@@ -187,6 +187,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
     add_extra_compiler_option(-ffunction-sections)
   endif()
 
+  if(ENABLE_COVERAGE)
+    set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} --coverage")
+    set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --coverage")
+  endif()
+
   set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG")
```

Review comment:
Why not `add_extra_compiler_option`?
**File:** modules/imgproc/src/opencl/bilateral.cl
**Change Type:** modified
**Context:** PR #2612: OCL: bilateral filter optimization (Pullreq/140319) - Optimizations for bilateral filter check_regression=OCL_ilateral_ test_module=imgproc

**Code Changes:**
```diff
@@ -54,9 +54,11 @@
 #error "cn should be <= 4"
 #endif
 
+//Read pixels as integers
+// Intel Device - Read Pixels as floats
 __kernel void bilateral(__global const uchar * src, int src_step, int src_offset,
                         __global uchar * dst, int dst_step, int dst_offset, int dst_rows, int dst_cols,
-                        __constant float * color_weight, __constant float * space_weight, __constant int * space_ofs)
+                        __constant float * space_weight, __constant int * space_ofs)
```

Review comment:
`as_float(gauss_color_coeff)` is wrong here, because `gauss_color_coeff` is float constant passed via compiler defines.
**File:** modules/imgproc/src/opencl/bilateral.cl
**Change Type:** modified
**Context:** PR #2612: OCL: bilateral filter optimization (Pullreq/140319) - Optimizations for bilateral filter check_regression=OCL_ilateral_ test_module=imgproc
**Review Line:** 101

**Code Changes:**
```diff
+#ifdef INTEL_DEVICE
+#if cn == 1
+//for single channgel x4 sized images.
+__kernel void bilateral_float4(__global const uchar * src, int src_step, int src_offset,
+                               __global uchar * dst, int dst_step, int dst_offset, int dst_rows, int dst_cols,
+                               __constant float * space_weight, __constant int * space_ofs)
+{
+    int x = get_global_id(0);
+    int y = get_global_id(1);
+    if (y < dst_rows && x < dst_cols / 4 )
+    {
```

Review comment:
It is very hard to maintain copy-pasted code from the different places. So we prefer to have single kernel with templated datatypes (float_t) and operations (convert_uchar_t). It will be great to have optimizations with minimal changes.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #2428: OCL: copyMakeBorder 3-channel - Merge with Itseez/opencv_extra#156 check_regression=OCL_CopyMakeBorder_

**Code Changes:**
```diff
@@ -782,18 +782,26 @@ namespace cv {
 static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
                                 int left, int right, int borderType, const Scalar& value )
 {
-    int type = _src.type(), cn = CV_MAT_CN(type);
+    int type = _src.type(), cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type);
     bool isolated = (borderType & BORDER_ISOLATED) != 0;
     borderType &= ~cv::BORDER_ISOLATED;
 
     if ( !(borderType == BORDER_CONSTANT || borderType == BORDER_REPLICATE || borderType == BORDER_REFLECT ||
```

Review comment:
use `T` instead of `PIXTYPE`
**File:** modules/core/src/opencl/copymakeborder.cl
**Change Type:** modified
**Context:** PR #2428: OCL: copyMakeBorder 3-channel - Merge with Itseez/opencv_extra#156 check_regression=OCL_CopyMakeBorder_

**Code Changes:**
```diff
@@ -42,14 +42,26 @@
 #endif
 #endif
 
+#if cn != 3
+#define loadpix(addr)  *(__global const T*)(addr)
+#define storepix(val, addr)  *(__global T*)(addr) = val
+#define TSIZE ((int)sizeof(T))
+#define convertScalar(a) (a)
+#else
```

Review comment:
`(int)` is redundant
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #2428: OCL: copyMakeBorder 3-channel - Merge with Itseez/opencv_extra#156 check_regression=OCL_CopyMakeBorder_

**Code Changes:**
```diff
@@ -782,18 +782,26 @@ namespace cv {
 static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
                                 int left, int right, int borderType, const Scalar& value )
 {
-    int type = _src.type(), cn = CV_MAT_CN(type);
+    int type = _src.type(), cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type);
     bool isolated = (borderType & BORDER_ISOLATED) != 0;
     borderType &= ~cv::BORDER_ISOLATED;
 
     if ( !(borderType == BORDER_CONSTANT || borderType == BORDER_REPLICATE || borderType == BORDER_REFLECT ||
```

Review comment:
Some kernels from #2326 use `PIXTYPE` & `PIXTYPE1` instead of `T`, other kernels use `T` & `T1`. Do we have any approved agreement?
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #2428: OCL: copyMakeBorder 3-channel - Merge with Itseez/opencv_extra#156 check_regression=OCL_CopyMakeBorder_

**Code Changes:**
```diff
@@ -782,18 +782,26 @@ namespace cv {
 static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
                                 int left, int right, int borderType, const Scalar& value )
 {
-    int type = _src.type(), cn = CV_MAT_CN(type);
+    int type = _src.type(), cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type);
     bool isolated = (borderType & BORDER_ISOLATED) != 0;
     borderType &= ~cv::BORDER_ISOLATED;
 
     if ( !(borderType == BORDER_CONSTANT || borderType == BORDER_REPLICATE || borderType == BORDER_REFLECT ||
```

Review comment:
Originally the OpenCL kernels for `resize` have these alien names (I mean `PIXTYPE`) and I don't want to propagate them to another kernels.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #2428: OCL: copyMakeBorder 3-channel - Merge with Itseez/opencv_extra#156 check_regression=OCL_CopyMakeBorder_

**Code Changes:**
```diff
@@ -782,18 +782,26 @@ namespace cv {
 static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
                                 int left, int right, int borderType, const Scalar& value )
 {
-    int type = _src.type(), cn = CV_MAT_CN(type);
+    int type = _src.type(), cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type);
     bool isolated = (borderType & BORDER_ISOLATED) != 0;
     borderType &= ~cv::BORDER_ISOLATED;
 
     if ( !(borderType == BORDER_CONSTANT || borderType == BORDER_REPLICATE || borderType == BORDER_REFLECT ||
```

Review comment:
But we introduce `loadpix` and `storepix` macro. And `PIXTYPE` looks better here than `T`.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #2428: OCL: copyMakeBorder 3-channel - Merge with Itseez/opencv_extra#156 check_regression=OCL_CopyMakeBorder_

**Code Changes:**
```diff
@@ -782,18 +782,26 @@ namespace cv {
 static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
                                 int left, int right, int borderType, const Scalar& value )
 {
-    int type = _src.type(), cn = CV_MAT_CN(type);
+    int type = _src.type(), cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type);
     bool isolated = (borderType & BORDER_ISOLATED) != 0;
     borderType &= ~cv::BORDER_ISOLATED;
 
     if ( !(borderType == BORDER_CONSTANT || borderType == BORDER_REPLICATE || borderType == BORDER_REFLECT ||
```

Review comment:
We should follow the current notation - `T` is used everywhere. And mixing `T` and `PIXTYPE` downgrades the code readability
**File:** modules/core/src/arithm.cpp
**Change Type:** modified
**Context:** PR #1292: Add optional NEON intrinsics to core/src/arithm.cpp - I wrote some vector-processing code using NEON compiler intrinsics, and in the future ...

**Code Changes:**
```diff
@@ -54,21 +54,23 @@ namespace cv
 
 struct NOP {};
 
-#if CV_SSE2
+#if CV_SSE2 || CV_NEON
 
 #define FUNCTOR_TEMPLATE(name)          \
     template<typename T> struct name {}
 
```

Review comment:
We already include this somewhere in the headers.
**File:** modules/core/src/arithm.cpp
**Change Type:** modified
**Context:** PR #1292: Add optional NEON intrinsics to core/src/arithm.cpp - I wrote some vector-processing code using NEON compiler intrinsics, and in the future ...

**Code Changes:**
```diff
@@ -54,21 +54,23 @@ namespace cv
 
 struct NOP {};
 
-#if CV_SSE2
+#if CV_SSE2 || CV_NEON
 
 #define FUNCTOR_TEMPLATE(name)          \
     template<typename T> struct name {}
 
```

Review comment:
This is a C99 header. It can't be used.
**File:** modules/core/src/arithm.cpp
**Change Type:** modified
**Context:** PR #1292: Add optional NEON intrinsics to core/src/arithm.cpp - I wrote some vector-processing code using NEON compiler intrinsics, and in the future ...

**Code Changes:**
```diff
@@ -54,21 +54,23 @@ namespace cv
 
 struct NOP {};
 
-#if CV_SSE2
+#if CV_SSE2 || CV_NEON
 
 #define FUNCTOR_TEMPLATE(name)          \
     template<typename T> struct name {}
 
```

Review comment:
I think you can do this in a more elegant way. Change e.g. `_VAdd8u` into a template `VAdd<T>` that's specialized for every needed `T`. Then in e.g. `add8u` you can use `VAdd<uchar>` as the template parameter. You'll also need to write a similar template for load/store intrinsics. After that, you get get rid of all the casts here and also in `vBinOp*`. You can also write a helper macro to generate these specializations (as the only difference seems to be the name of the struct and of the called intrinsic) but that's up to you.
**File:** modules/core/src/arithm.cpp
**Change Type:** modified
**Context:** PR #1292: Add optional NEON intrinsics to core/src/arithm.cpp - I wrote some vector-processing code using NEON compiler intrinsics, and in the future ...

**Code Changes:**
```diff
@@ -54,21 +54,23 @@ namespace cv
 
 struct NOP {};
 
-#if CV_SSE2
+#if CV_SSE2 || CV_NEON
 
 #define FUNCTOR_TEMPLATE(name)          \
     template<typename T> struct name {}
 
```

Review comment:
You're right, I'm going to do it with specialized templates