nareshmlx/opencv-pr huggingface dataset:
**File:** README.md
**Change Type:** modified
**Context:** PR #26733: Add usage instructions to README - ## How to Run This Project 1. Make sure you have installed all required dependencies (CMake, Python, etc...
**Review Line:** 44

**Code Changes:**
```diff
+## How to Run This Project
+
+1. Make sure you have installed all required dependencies (CMake, Python, etc.).
+2. Clone the repository and open the project in your preferred IDE or command line.
+3. Build the project using CMake or your IDE’s build settings.
+4. Run the executable or Python scripts depending on your setup.
```

Review comment:
Agreed. There added notes are incomplete and not accurate anyway. Proper place is documentation / Wiki pages.
**File:** modules/core/src/alloc.cpp
**Change Type:** modified
**Context:** PR #24844: Make use of C++11 std::aligned_alloc where available - This is more like a food for thought, not a final state ready to be merged. As I see...
**Review Line:** 152

**Code Changes:**
```diff
-        return;
-    }
+#if defined(_MSC_VER)
+	_aligned_free(ptr);
+#else
+	free(ptr);
 #endif
-    if(ptr)
-    {
-        uchar* udata = ((uchar**)ptr)[-1];
-        CV_DbgAssert(udata < (uchar*)ptr &&
```

Review comment:
I wornder if runtime / build time switcher for disabling aligned allocation are still relevant
**File:** modules/core/src/alloc.cpp
**Change Type:** modified
**Context:** PR #24844: Make use of C++11 std::aligned_alloc where available - This is more like a food for thought, not a final state ready to be merged. As I see...
**Review Line:** 133

**Code Changes:**
```diff
-        if(!ptr)
-            return OutOfMemoryError(size);
-        return ptr;
-    }
+#if defined(_MSC_VER)
+	void* ptr = _aligned_alloc(size, CV_MALLOC_ALIGN);
+#else
+	void* ptr = std::aligned_alloc(size, CV_MALLOC_ALIGN);
 #endif
-    uchar* udata = (uchar*)malloc(size + sizeof(void*) + CV_MALLOC_ALIGN);
-    if(!udata)
```

Review comment:
Windows does not have std::aligned_alloc as their free() method does not support freeing such blocks. I will add comment regarding this limitation it a further commits.
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #27070: Fix Ninja/RPATH CMake error when building with VS in WSL2 - This PR fixes an issue where building OpenCV with Ninja in WSL2 fails due to a ...
**Review Line:** 1595

**Code Changes:**
```diff
@@ -1592,7 +1592,7 @@ function(ocv_add_library target)
   if(APPLE_FRAMEWORK AND BUILD_SHARED_LIBS)
     message(STATUS "Setting Apple target properties for ${target}")
 
-    set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG 1)
+    set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
 
     if((IOS OR XROS) AND NOT MAC_CATALYST)
       set(OPENCV_APPLE_INFO_PLIST "${CMAKE_BINARY_DIR}/ios/Info.plist")
```

Review comment:
Need to check for non-empty value since CMake 3.20.1 already set this: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5980 Also see #8009 - there are more places of that.
**File:** platforms/ios/build_framework.py
**Change Type:** modified
**Context:** PR #27088: Added Swift compiler flag to CMake for iOS build - Changes Made Added -DCMAKE_Swift_COMPILER=/usr/bin/swift in build_framework.py. Why Made...
**Review Line:** 138

**Code Changes:**
```diff
+                import shutil
+                swift_compiler = shutil.which("swift")
+                if swift_compiler:
+                    cmake_flags.append(f"-DCMAKE_Swift_COMPILER={swift_compiler}")
+                else:
+                    print("Error: Swift compiler not found!")
                 cmake_flags.append("-DSWIFT_DISABLED=1")
 
                 cmake_flags.append("-DIOS=1")  # Build the iOS codebase
```

Review comment:
The default swift compiler in PATH is found by CMake automatically the patch does not make sense.
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/warpAffine.hpp
**Change Type:** added
**Context:** PR #26969: Optimization for cv::hal::warpAffine for 8U

**Code Changes:**
```diff
@@ -0,0 +1,78 @@
+// 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_RVV_WARPAFFINE_HPP_INCLUDED
+#define OPENCV_HAL_RVV_WARPAFFINE_HPP_INCLUDED
+
+#include <riscv_vector.h>
+namespace cv { namespace cv_hal_rvv {
+#define INTER_BITS 5
```

Review comment:
No need to overload the HAL function with CV_HAL_ERROR_NOT_IMPLEMENTED. it's done automatically by OpenCV.
**File:** 3rdparty/hal_rvv/hal_rvv.hpp
**Change Type:** modified
**Context:** PR #26969: Optimization for cv::hal::warpAffine for 8U
**Review Line:** 33

**Code Changes:**
```diff
@@ -29,6 +29,8 @@
 #include "hal_rvv_1p0/atan.hpp" // core
 #include "hal_rvv_1p0/split.hpp" // core
 #include "hal_rvv_1p0/flip.hpp" // core
+#include "hal_rvv_1p0/warpAffine.hpp" // imgproc
+#include "hal_rvv_1p0/flip.hpp" // core
 #endif
 
 #endif
```

Review comment:
duplicated include
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/warpAffine.hpp
**Change Type:** added
**Context:** PR #26969: Optimization for cv::hal::warpAffine for 8U
**Review Line:** 47

**Code Changes:**
```diff
+static int warpAffineBlockline(int *adelta, int *bdelta, short* xy, short* alpha, int X0, int Y0, int bw) {
+    const int AB_BITS = MAX(10, (int)INTER_BITS);
+    int vl, x1 = 0;
+    for (; x1 < bw; x1 += vl) {
+        // set vl
+        vl = __riscv_vsetvl_e32m8(bw - x1);
+        // load i32 for adelta
+        auto v_adelta = __riscv_vle32_v_i32m8(adelta + x1, vl);
+        auto v_bdelta = __riscv_vle32_v_i32m8(bdelta + x1, vl);
+        // add i32
+        v_adelta = __riscv_vadd_vx_i32m8(v_adelta, X0, vl);
```

Review comment:
Can you please vary lmul and compare performance with m2/m4/m8?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #26282: Fix default build type message for Visual Studio, Xcode, Unix Makefiles and other generators
**Review Line:** 123

**Code Changes:**
```diff
+      message(STATUS "Unix Makefiles = Generates standard UNIX makefiles.")
+    elseif(CMAKE_GENERATOR MATCHES "Ninja")
+      message(STATUS "Ninja = Generates build.ninja files.")
+    elseif(CMAKE_GENERATOR MATCHES "Watcom WMake")
+      message(STATUS "Watcom WMake = Generates Watcom WMake makefiles.")
+    endif()
+
+    message(STATUS "'Release' build type is used by default for ${CMAKE_GENERATOR}. Use CMAKE_BUILD_TYPE to specify the build type (e.g., Release or Debug).")
+
+    # sets the default build type to Release for single-configuration generators
+    set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE)
```

Review comment:
It's part of `cmake --help` message. Why do we need it here?
**File:** modules/dnn/test/test_layers.cpp
**Change Type:** modified
**Context:** PR #25581: Convert single layer caffe tests to onnx format
**Review Line:** 68

**Code Changes:**
```diff
@@ -65,13 +65,26 @@ static String _tf(TString filename)
 class Test_Caffe_layers : public DNNTestLayer
 {
 public:
+    void testLayerUsingOnnxModels(const String& basename, bool useCommonInputBlob = true, double l1 = 0.0, double lInf = 0.0,
+                                   int numInps = 1, int numOuts = 1)
+    {
+        _testLayerUsingModels(basename, false, true, useCommonInputBlob, l1, lInf, numInps, numOuts);
+    }
+
```

Review comment:
Onnx layers tests should be in `test_onnx_importer.cpp`. If we want to extract the tests for Caffe layer, I think we should move them to `test_onnx_importer.cpp`.
**File:** modules/dnn/test/test_layers.cpp
**Change Type:** modified
**Context:** PR #25581: Convert single layer caffe tests to onnx format
**Review Line:** 68

**Code Changes:**
```diff
@@ -65,13 +65,26 @@ static String _tf(TString filename)
 class Test_Caffe_layers : public DNNTestLayer
 {
 public:
+    void testLayerUsingOnnxModels(const String& basename, bool useCommonInputBlob = true, double l1 = 0.0, double lInf = 0.0,
+                                   int numInps = 1, int numOuts = 1)
+    {
+        _testLayerUsingModels(basename, false, true, useCommonInputBlob, l1, lInf, numInps, numOuts);
+    }
+
```

Review comment:
Keep tests as simple as possible. There are no tests for tests so test code should avoid complications. It makes sense to create new set of ONNX tests. At least we don't break already existed tests.
**File:** modules/python/package/cv2/__init__.py
**Change Type:** modified
**Context:** PR #16008: Python module: replace config.py files by config.ini - The OpenCV Python module currently installs and reads at runtime a config.py file an...
**Review Line:** 6

**Code Changes:**
```diff
@@ -3,6 +3,7 @@
 '''
 import os
 import sys
+import configparser
 
 try:
     import numpy
@@ -35,31 +36,32 @@ def bootstrap():
     PYTHON_EXTENSIONS_PATHS = []
```

Review comment:
In Python2 it is named `ConfigParser`.
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #16435: Blobfromimage in Dnn DetectionModel -  ### This pull-request changes This resolves issue #14659 A new version of ```blobFromImage()``` whic...
**Review Line:** 1280

**Code Changes:**
```diff
          CV_WRAP void detect(InputArray frame, CV_OUT std::vector<int>& classIds,
                              CV_OUT std::vector<float>& confidences, CV_OUT std::vector<Rect>& boxes,
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
+         CV_WRAP Mat blobFromImages(InputArray images_, double scalefactor = 1.0,
+             Size size = Size(), const Scalar& mean = Scalar(),
+             bool swapRB = false, Rect crop = Rect(), int ddepth = CV_32F);
+
+         CV_WRAP Mat blobFromImage(InputArray image, double scalefactor = 1.0,
+             Size size = Size(), const Scalar& mean = Scalar(),
+             bool swapRB = false, Rect crop = Rect(), int ddepth = CV_32F);
      };
```

Review comment:
That should be a static method at cv::dnn namespace.
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #16435: Blobfromimage in Dnn DetectionModel -  ### This pull-request changes This resolves issue #14659 A new version of ```blobFromImage()``` whic...
**Review Line:** 1280

**Code Changes:**
```diff
          CV_WRAP void detect(InputArray frame, CV_OUT std::vector<int>& classIds,
                              CV_OUT std::vector<float>& confidences, CV_OUT std::vector<Rect>& boxes,
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
+         CV_WRAP Mat blobFromImages(InputArray images_, double scalefactor = 1.0,
+             Size size = Size(), const Scalar& mean = Scalar(),
+             bool swapRB = false, Rect crop = Rect(), int ddepth = CV_32F);
+
+         CV_WRAP Mat blobFromImage(InputArray image, double scalefactor = 1.0,
+             Size size = Size(), const Scalar& mean = Scalar(),
+             bool swapRB = false, Rect crop = Rect(), int ddepth = CV_32F);
      };
```

Review comment:
I mean it should work in the same way as existing `blobFromImage` so defined as `cv::dnn::blobFromImage`, no in `DetectionModel`. There are three different issues actually: 1) blobFromImage with cv::Rect 2) correct detection outputs from DetectionModel considering crop=True 3) somehow retrieve the ROI position which is determined inside blobFromImage with crop=True So first, I'd like to recommend to take a look at (2) issue to fix object detection with crop=True.
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #16435: Blobfromimage in Dnn DetectionModel -  ### This pull-request changes This resolves issue #14659 A new version of ```blobFromImage()``` whic...
**Review Line:** 1280

**Code Changes:**
```diff
          CV_WRAP void detect(InputArray frame, CV_OUT std::vector<int>& classIds,
                              CV_OUT std::vector<float>& confidences, CV_OUT std::vector<Rect>& boxes,
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
+         CV_WRAP Mat blobFromImages(InputArray images_, double scalefactor = 1.0,
+             Size size = Size(), const Scalar& mean = Scalar(),
+             bool swapRB = false, Rect crop = Rect(), int ddepth = CV_32F);
+
+         CV_WRAP Mat blobFromImage(InputArray image, double scalefactor = 1.0,
+             Size size = Size(), const Scalar& mean = Scalar(),
+             bool swapRB = false, Rect crop = Rect(), int ddepth = CV_32F);
      };
```

Review comment:
The dimensions of the bbox computed are according to the size of the cropped image so multiplying the height and width by 1/resizeFactor should give the dimensions of the actual bbox
**File:** package.xml
**Change Type:** added
**Context:** PR #16322: Add package for cmake project - This PR simply adds a package.xml used for build tools like catkin or colcon, allowing for the essential bu...
**Review Line:** 14

**Code Changes:**
```diff
+  <maintainer email="opencv@opencv.org">opencv</maintainer>
+  <license>BSD</license>
+
+  <buildtool_depend>cmake</buildtool_depend>
+  
+  <build_depend>eigen</build_depend>
+
+  <export>
+    <build_type>cmake</build_type>
+  </export>
+</package>
```

Review comment:
Is this list really complete?
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...

**Code Changes:**
```diff
@@ -94,14 +94,30 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
         {
             v_uint8 v_zero = vx_setzero_u8();
 
-            for( ; x <= size.width - v_uint8::nlanes; x += v_uint8::nlanes )
+            for( ; x <= size.width - v_uint8::nlanes * 2; x += v_uint8::nlanes * 2)
             {
                 v_uint8 v_src   = vx_load(src  + x),
                         v_dst   = vx_load(dst  + x),
                         v_nmask = vx_load(mask + x) == v_zero;
```

Review comment:
Please use straightforward condition: `x <= size.width - v_uint8x16::nlanes * 2`. `& -stride` trick assumes that initial and all `x` values are multiplier of `stride` and stride is power of 2 (or we should add assertion for that).
**File:** modules/core/test/test_intrin_utils.hpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...

**Code Changes:**
```diff
@@ -1278,6 +1278,109 @@ template<typename R> struct TheTest
         return *this;
     }
 
+// Expansion for all possible calls of v_permute
+#define _expand_1(val, wrap) wrap(val[0])
+#define _expand_2(val, wrap) _expand_1(val,wrap) , wrap(val[1])
+#define _expand_3(val, wrap) _expand_2(val,wrap) , wrap(val[2])
+#define _expand_4(val, wrap) _expand_3(val,wrap) , wrap(val[3])
+#define _expand_5(val, wrap) _expand_4(val,wrap) , wrap(val[4])
```

Review comment:
I think it make sense to include test for 2 vector permute as well to ensure compatibility if/when multi vector permute support will be extended to other platforms
**File:** modules/core/include/opencv2/core/hal/intrin_cpp.hpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...
**Review Line:** 2599

**Code Changes:**
```diff
+@endcode
+
+@note this API is dependent on the compiler check CV_SIMD128_PERMUTE > 0
+      or CV_SIMD_PERMUTE > 0.
+*/
+inline v_uint8x16 v_permute(const v_uint8x16& ctrl, const v_uint8x16& a)
+{
+    return v_permute(ctrl, a, a);
+}
+
 inline void v_cleanup() {}
```

Review comment:
IMO 2-vector permute should be added here(with proper notes regarding CV_SIMD_PERMUTE meaning) as well.
**File:** modules/core/test/test_intrin_utils.hpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...

**Code Changes:**
```diff
@@ -1278,6 +1278,109 @@ template<typename R> struct TheTest
         return *this;
     }
 
+// Expansion for all possible calls of v_permute
+#define _expand_1(val, wrap) wrap(val[0])
+#define _expand_2(val, wrap) _expand_1(val,wrap) , wrap(val[1])
+#define _expand_3(val, wrap) _expand_2(val,wrap) , wrap(val[2])
+#define _expand_4(val, wrap) _expand_3(val,wrap) , wrap(val[3])
+#define _expand_5(val, wrap) _expand_4(val,wrap) , wrap(val[4])
```

Review comment:
Shouldn't it be `#define _expand_16(val, wrap) _expand_15(val,wrap) , wrap(val[15])` ?
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...

**Code Changes:**
```diff
@@ -94,14 +94,30 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
         {
             v_uint8 v_zero = vx_setzero_u8();
 
-            for( ; x <= size.width - v_uint8::nlanes; x += v_uint8::nlanes )
+            for( ; x <= size.width - v_uint8::nlanes * 2; x += v_uint8::nlanes * 2)
             {
                 v_uint8 v_src   = vx_load(src  + x),
                         v_dst   = vx_load(dst  + x),
                         v_nmask = vx_load(mask + x) == v_zero;
```

Review comment:
`v_uint8::nlanes` should be used here
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...

**Code Changes:**
```diff
@@ -94,14 +94,30 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
         {
             v_uint8 v_zero = vx_setzero_u8();
 
-            for( ; x <= size.width - v_uint8::nlanes; x += v_uint8::nlanes )
+            for( ; x <= size.width - v_uint8::nlanes * 2; x += v_uint8::nlanes * 2)
             {
                 v_uint8 v_src   = vx_load(src  + x),
                         v_dst   = vx_load(dst  + x),
                         v_nmask = vx_load(mask + x) == v_zero;
```

Review comment:
`v_uint8::nlanes` also
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...

**Code Changes:**
```diff
@@ -94,14 +94,30 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
         {
             v_uint8 v_zero = vx_setzero_u8();
 
-            for( ; x <= size.width - v_uint8::nlanes; x += v_uint8::nlanes )
+            for( ; x <= size.width - v_uint8::nlanes * 2; x += v_uint8::nlanes * 2)
             {
                 v_uint8 v_src   = vx_load(src  + x),
                         v_dst   = vx_load(dst  + x),
                         v_nmask = vx_load(mask + x) == v_zero;
```

Review comment:
IMO it would be better to use uniform way to define intrinsic cycles everywhere ``` for( ; x <= size.width - v_uint8x16::nlanes * 3; x += v_uint8x16::nlanes * 3, mx += v_uint8x16::nlanes ) ```
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...
**Review Line:** 204

**Code Changes:**
```diff
+                v_uint8 dst2 = vx_load(dst + x + v_uint8::nlanes * 2);
+
+                // Use a permute to "expand" a value of 0 or -1.
+                v_uint8 m24v0 = v_permute(p0, m8v);
+                v_uint8 m24v1 = v_permute(p1, m8v);
+                v_uint8 m24v2 = v_permute(p2, m8v);
+
+                dst0 = v_select(m24v0, dst0, src0);
+                dst1 = v_select(m24v1, dst1, src1);
+                dst2 = v_select(m24v2, dst2, src2);
+                vx_store(dst + x, dst0);
```

Review comment:
As I mentioned in #15613 lets introduce more specific intrinsic for that. - manipulation with control parameter in implementations doesn't looks good (it is not universal and generic) - this way is not optimal for processing of that task - take a look on `v_zip()` - it interleaves two registers. Here we need interleaving of three registers. - lets try to avoid conditional compilation - we already have `v_store_interleave()`. Here we don't need "storing". We need just interleaving from registers into registers. But... - but even interleaving would not work with masks in the future (see OE-29 - AVX512): there are plans to rework masks support completely (masks type will be a separate "abstract" type with reduced amount of operations). - so, finally, it is better to introduce here more specific intrinsic: `void v_select3(mask, a1, b1, c1, a2, b2, c2, dst_a, dst_b, dst_c)` (merge these v_permute + v_select operations). It can be implemented with optimal performance for each architecture.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...
**Review Line:** 204

**Code Changes:**
```diff
+                v_uint8 dst2 = vx_load(dst + x + v_uint8::nlanes * 2);
+
+                // Use a permute to "expand" a value of 0 or -1.
+                v_uint8 m24v0 = v_permute(p0, m8v);
+                v_uint8 m24v1 = v_permute(p1, m8v);
+                v_uint8 m24v2 = v_permute(p2, m8v);
+
+                dst0 = v_select(m24v0, dst0, src0);
+                dst1 = v_select(m24v1, dst1, src1);
+                dst2 = v_select(m24v2, dst2, src2);
+                vx_store(dst + x, dst0);
```

Review comment:
I think updating this patch would be highly contingent on the choose of HAL API exposed for masks. I can only assume this would heavily bias towards AVX512. AFAIK composite types (e.g 8u3) don't map onto the HAL. Maybe `v_memmove_triplet(dstp, srcp, maskp, ntriplets)`?
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...
**Review Line:** 204

**Code Changes:**
```diff
+                v_uint8 dst2 = vx_load(dst + x + v_uint8::nlanes * 2);
+
+                // Use a permute to "expand" a value of 0 or -1.
+                v_uint8 m24v0 = v_permute(p0, m8v);
+                v_uint8 m24v1 = v_permute(p1, m8v);
+                v_uint8 m24v2 = v_permute(p2, m8v);
+
+                dst0 = v_select(m24v0, dst0, src0);
+                dst1 = v_select(m24v1, dst1, src1);
+                dst2 = v_select(m24v2, dst2, src2);
+                vx_store(dst + x, dst0);
```

Review comment:
I'm looking at the OpenCV code and I can see uses for a generic v_permute (or v_shuffle) instruction(s) in other areas. v_permute would need both single and double input registers (besides the control vector). Without these instructions, work in these areas might not be able to be done.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #15596: Improve copymask and implement SIMD extensions - ### This pullrequest vectorizes more copyMask variants Improve masked copy performance by ...
**Review Line:** 204

**Code Changes:**
```diff
+                v_uint8 dst2 = vx_load(dst + x + v_uint8::nlanes * 2);
+
+                // Use a permute to "expand" a value of 0 or -1.
+                v_uint8 m24v0 = v_permute(p0, m8v);
+                v_uint8 m24v1 = v_permute(p1, m8v);
+                v_uint8 m24v2 = v_permute(p2, m8v);
+
+                dst0 = v_select(m24v0, dst0, src0);
+                dst1 = v_select(m24v1, dst1, src1);
+                dst2 = v_select(m24v2, dst2, src2);
+                vx_store(dst + x, dst0);
```

Review comment:
I am still waiting on community feedback before refactoring this patchset. I think v_permute is well defined for most architectures. I can drop copymask patch while consensus is being developed for masked operations. Other than my suggestion above, I lack insight into what a good HAL would look like for such operations.