nareshmlx/opencv-pr huggingface dataset:
**File:** cmake/OpenCVCompilerOptimizations.cmake
**Change Type:** modified
**Context:** PR #25901: RISC-V/AArch64: disable CPU features detection - This PR is the first step in fixing current issues with NEON/RVV, FP16, BF16 and other CPU...

**Code Changes:**
```diff
@@ -104,7 +104,7 @@ ocv_optimization_process_obsolete_option(ENABLE_AVX2 AVX2 ON)
 ocv_optimization_process_obsolete_option(ENABLE_FMA3 FMA3 ON)
 
 ocv_optimization_process_obsolete_option(ENABLE_VFPV3 VFPV3 OFF)
-ocv_optimization_process_obsolete_option(ENABLE_NEON NEON OFF)
+ocv_optimization_process_obsolete_option(ENABLE_NEON NEON ON)
 
 ocv_optimization_process_obsolete_option(ENABLE_VSX VSX ON)
 
@@ -170,7 +170,29 @@ elseif(" ${CMAKE_CXX_FLAGS} " MATCHES " -march=native | -xHost | /QxHost ")
```

Review comment:
Lets remove `set(CPU_BASELINE "DETECT")`. Warning message is enough.
**File:** cmake/platforms/OpenCV-Linux.cmake
**Change Type:** modified
**Context:** PR #25901: RISC-V/AArch64: disable CPU features detection - This PR is the first step in fixing current issues with NEON/RVV, FP16, BF16 and other CPU...

**Code Changes:**
```diff
@@ -1 +1,9 @@
-# empty
+if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+    AND NOT CMAKE_CROSSCOMPILING
+    AND NOT CMAKE_TOOLCHAIN_FILE)
+  if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") # Maybe use AARCH64 variable?
+    include(${CMAKE_CURRENT_LIST_DIR}/../../platforms/linux/flags-aarch64.cmake)
+  elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
+    include(${CMAKE_CURRENT_LIST_DIR}/../../platforms/linux/flags-riscv64.cmake)
+  endif()
```

Review comment:
Lets remove this comment as file is not "intentionally empty" anymore.
**File:** platforms/linux/arm.toolchain.cmake
**Change Type:** modified
**Context:** PR #25901: RISC-V/AArch64: disable CPU features detection - This PR is the first step in fixing current issues with NEON/RVV, FP16, BF16 and other CPU...

**Code Changes:**
```diff
@@ -48,32 +48,23 @@ if(NOT DEFINED ARM_LINUX_SYSROOT AND DEFINED GNU_MACHINE)
   set(ARM_LINUX_SYSROOT /usr/${GNU_MACHINE}${FLOAT_ABI_SUFFIX})
 endif()
 
-if(NOT DEFINED CMAKE_CXX_FLAGS)
-  set(CMAKE_CXX_FLAGS           "" CACHE INTERNAL "")
-  set(CMAKE_C_FLAGS             "" CACHE INTERNAL "")
-  set(CMAKE_SHARED_LINKER_FLAGS "" CACHE INTERNAL "")
-  set(CMAKE_MODULE_LINKER_FLAGS "" CACHE INTERNAL "")
-  set(CMAKE_EXE_LINKER_FLAGS    "" CACHE INTERNAL "")
```

Review comment:
My experiments has shown that unfortunately `FLAGS_INIT` vars do not work with regular `FLAGS` variables as I expected. They are not appended to initial value, but override it: ``` cmake \ -DCMAKE_TOOLCHAIN_FILE=/work/opencv/platforms/linux/riscv64-clang.toolchain.cmake \ ../opencv # result: -march=rv64gc ... # this is flag from our toolchain file cmake \ -DCMAKE_TOOLCHAIN_FILE=/work/opencv/platforms/linux/riscv64-clang.toolchain.cmake \ -DCMAKE_CXX_FLAGS="-Werror" \ ../opencv # result: -Werror ... # no -march flags from toolchain file ``` Correct way to add custom flags to cross-compilation in this case will be via * `CMAKE_<LANG>_FLAGS_<CONFIG>` variable, or * `<LANG>FLAGS` environment variable, or * OpenCV-specific variables `OPENCV_EXTRA_<LANG>_FLAGS`, or * custom toolchain-file. I believe this behavior is acceptable because this is how cmake works.
**File:** platforms/linux/flags-aarch64.cmake
**Change Type:** added
**Context:** PR #25901: RISC-V/AArch64: disable CPU features detection - This PR is the first step in fixing current issues with NEON/RVV, FP16, BF16 and other CPU...

**Code Changes:**
```diff
@@ -0,0 +1,19 @@
+# see https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#index-march
+function(ocv_set_platform_flags VAR)
+  unset(flags)
+  if(ENABLE_BF16)
+    set(flags "${flags}+bf16")
+  endif()
+  if(ENABLE_DOTPROD)
+    set(flags "${flags}+dotprod")
+  endif()
```

Review comment:
Also added to the toolchain ability to disable NEON for AArch64 by explicitly setting `ENABLE_NEON` to `OFF`.
**File:** cmake/OpenCVCompilerOptimizations.cmake
**Change Type:** modified
**Context:** PR #25901: RISC-V/AArch64: disable CPU features detection - This PR is the first step in fixing current issues with NEON/RVV, FP16, BF16 and other CPU...

**Code Changes:**
```diff
@@ -104,7 +104,7 @@ ocv_optimization_process_obsolete_option(ENABLE_AVX2 AVX2 ON)
 ocv_optimization_process_obsolete_option(ENABLE_FMA3 FMA3 ON)
 
 ocv_optimization_process_obsolete_option(ENABLE_VFPV3 VFPV3 OFF)
-ocv_optimization_process_obsolete_option(ENABLE_NEON NEON OFF)
+ocv_optimization_process_obsolete_option(ENABLE_NEON NEON ON)
 
 ocv_optimization_process_obsolete_option(ENABLE_VSX VSX ON)
 
@@ -170,7 +170,29 @@ elseif(" ${CMAKE_CXX_FLAGS} " MATCHES " -march=native | -xHost | /QxHost ")
```

Review comment:
The goal is to avoid modifying compiler flags unnecessarily, as this can lead to incompatibilities and performance issues, especially when specific CPU architectures are requested. Users should have the option to manually set flags for dispatched files via CPU_XXX_FLAGS_ON. In the case of RVV, -DCPU_DISPATCH=RVV -DCPU_RVV_FLAGS_ON=-march=rv64gcv can handle dispatched optimizations without affecting the baseline configuration.
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #26234: move the gcc6 compatibility check to occur on a per-directory basis, …

**Code Changes:**
```diff
@@ -353,23 +353,23 @@ function(ocv_target_include_directories target)
   #ocv_debug_message("ocv_target_include_directories(${target} ${ARGN})")
   _ocv_fix_target(target)
   set(__params "")
-  if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
-      ";${ARGN};" MATCHES "/usr/include;")
-    return() # workaround for GCC 6.x bug
-  endif()
-  set(__params "")
   set(__system_params "")
```

Review comment:
> `"${dir}"` Please use `dir MATCHES ...` without variable unpacking.
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #26234: move the gcc6 compatibility check to occur on a per-directory basis, …

**Code Changes:**
```diff
@@ -353,23 +353,23 @@ function(ocv_target_include_directories target)
   #ocv_debug_message("ocv_target_include_directories(${target} ${ARGN})")
   _ocv_fix_target(target)
   set(__params "")
-  if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
-      ";${ARGN};" MATCHES "/usr/include;")
-    return() # workaround for GCC 6.x bug
-  endif()
-  set(__params "")
   set(__system_params "")
```

Review comment:
Use `dir MATCHES "/usr/include$"` See line 309
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #26234: move the gcc6 compatibility check to occur on a per-directory basis, …

**Code Changes:**
```diff
@@ -353,23 +353,23 @@ function(ocv_target_include_directories target)
   #ocv_debug_message("ocv_target_include_directories(${target} ${ARGN})")
   _ocv_fix_target(target)
   set(__params "")
-  if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
-      ";${ARGN};" MATCHES "/usr/include;")
-    return() # workaround for GCC 6.x bug
-  endif()
-  set(__params "")
   set(__system_params "")
```

Review comment:
got it! sorry about that
**File:** doc/tutorials/features2d/akaze_matching/akaze_matching.markdown
**Change Type:** modified
**Context:** PR #25292: features2d cleanup: Move several feature detectors and descriptors to opencv_contrib - features2d cleanup: #24999 The PR moves KAZE, AKAZE,...

**Code Changes:**
```diff
@@ -22,6 +22,8 @@ number of inliers (i.e. matches that fit in the given homography).
 You can find expanded version of this example here:
 <https://github.com/pablofdezalc/test_kaze_akaze_opencv>
 
+\warning You need the [OpenCV contrib module *xfeatures2d*](https://github.com/opencv/opencv_contrib/tree/5.x/modules/xfeatures2d) to be able to use the AKAZE features.
+
 Data
 ----
 
@@ -42,23 +44,23 @@ You can find the images (*graf1.png*, *graf3.png*) and homography (*H1to3p.xml*)
```

Review comment:
Use markdown notation for links.
**File:** doc/tutorials/features2d/akaze_tracking/akaze_tracking.markdown
**Change Type:** modified
**Context:** PR #25292: features2d cleanup: Move several feature detectors and descriptors to opencv_contrib - features2d cleanup: #24999 The PR moves KAZE, AKAZE,...

**Code Changes:**
```diff
@@ -17,6 +17,8 @@ Introduction
 In this tutorial we will compare *AKAZE* and *ORB* local features using them to find matches between
 video frames and track object movements.
 
+\warning You need the [OpenCV contrib module *xfeatures2d*](https://github.com/opencv/opencv_contrib/tree/5.x/modules/xfeatures2d) to be able to use the AKAZE features.
+
 The algorithm is as follows:
 
 -   Detect and describe keypoints on the first frame, manually set object boundaries
```

Review comment:
Use markdown notation for links.
**File:** modules/imgproc/perf/perf_warp.cpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs
**Review Line:** 50

**Code Changes:**
```diff
+        }
+        case CV_16U: {
+            cvtest::fillGradient<uint16_t>(src);
+            if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder<uint16_t>(src, borderColor, 1);
+            break;
+        }
+        case CV_32F: {
+            cvtest::fillGradient<float>(src);
+            if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder<float>(src, borderColor, 1);
+            break;
+        }
```

Review comment:
OpenVX support is removed in https://github.com/opencv/opencv/pull/25197. So I remove this test. Also removed perf data from `$opencv_extra/testdata/perf/imgproc.xml`.
**File:** modules/imgproc/perf/perf_warp.cpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs
**Review Line:** 117

**Code Changes:**
```diff
-
 PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
              Combine(
                  Values( Size(640,480), Size(1920,1080), Size(2592,1944) ),
@@ -168,8 +117,8 @@ PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
     Scalar borderColor = Scalar::all(150);
 
     Mat src(size, type), dst(size, type);
-    cvtest::fillGradient(src);
-    if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1);
+    cvtest::fillGradient<uint8_t>(src);
```

Review comment:
OpenVX support is removed in https://github.com/opencv/opencv/pull/25197. So I remove this test. Also removed perf data from `$opencv_extra/testdata/perf/imgproc.xml`.
**File:** modules/imgproc/CMakeLists.txt
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -10,6 +10,7 @@ ocv_add_dispatched_file(median_blur SSE2 SSE4_1 AVX2)
 ocv_add_dispatched_file(morph SSE2 SSE4_1 AVX2)
 ocv_add_dispatched_file(smooth SSE2 SSE4_1 AVX2)
 ocv_add_dispatched_file(sumpixels SSE2 AVX2 AVX512_SKX)
+ocv_add_dispatched_file(warp_kernels SSE2 SSE4_1 AVX2 NEON NEON_FP16 RVV LASX)
 ocv_define_module(imgproc opencv_core WRAP java objc python js)
 
 ocv_module_include_directories(opencv_imgproc ${ZLIB_INCLUDE_DIRS})
```

Review comment:
what about NEON_FP16?
**File:** modules/imgproc/CMakeLists.txt
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -10,6 +10,7 @@ ocv_add_dispatched_file(median_blur SSE2 SSE4_1 AVX2)
 ocv_add_dispatched_file(morph SSE2 SSE4_1 AVX2)
 ocv_add_dispatched_file(smooth SSE2 SSE4_1 AVX2)
 ocv_add_dispatched_file(sumpixels SSE2 AVX2 AVX512_SKX)
+ocv_add_dispatched_file(warp_kernels SSE2 SSE4_1 AVX2 NEON NEON_FP16 RVV LASX)
 ocv_define_module(imgproc opencv_core WRAP java objc python js)
 
 ocv_module_include_directories(opencv_imgproc ${ZLIB_INCLUDE_DIRS})
```

Review comment:
Added. But actually `FP16` is set to be one of the baselines according to the CMake log: ``` -- CPU/HW features: -- Baseline: NEON FP16 -- Dispatched code generation: NEON_DOTPROD NEON_FP16 NEON_BF16 -- requested: NEON_FP16 NEON_BF16 NEON_DOTPROD -- NEON_DOTPROD (1 files): + NEON_DOTPROD -- NEON_FP16 (3 files): + NEON_FP16 -- NEON_BF16 (0 files): + NEON_BF16 ``` `FP16` enables `NEON_FP16`. So performance testing results are not changing.
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs
**Review Line:** 2231

**Code Changes:**
```diff
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
 inline v_int16x8 v_ceil(const v_float16x8 &a)
@@ -2271,9 +2269,13 @@ inline v_int32x4 v_round(const v_float32x4& a)
 #endif
```

Review comment:
The instruction is not available on armv7, but available on aarch32 and aarch64. We need macro check here.
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -2228,9 +2228,7 @@ inline v_int16x8 v_round(const v_float16x8 &a)
 
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
```

Review comment:
The instruction is available on aarch32 too https://developer.arm.com/architectures/instruction-sets/intrinsics/vcvtmq_s32_f32
**File:** modules/imgproc/perf/perf_warp.cpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -12,7 +12,7 @@ CV_ENUM(InterType, INTER_NEAREST, INTER_LINEAR)
 CV_ENUM(InterTypeExtended, INTER_NEAREST, INTER_LINEAR, WARP_RELATIVE_MAP)
 CV_ENUM(RemapMode, HALF_SIZE, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH)
 
-typedef TestBaseWithParam< tuple<MatType, Size, InterType, BorderMode> > TestWarpAffine;
+typedef TestBaseWithParam< tuple<Size, InterType, BorderMode, MatType> > TestWarpAffine;
 typedef TestBaseWithParam< tuple<Size, InterType, BorderMode, int> > TestWarpPerspective;
 typedef TestBaseWithParam< tuple<Size, InterType, BorderMode, MatType> > TestWarpPerspectiveNear_t;
 typedef TestBaseWithParam< tuple<MatType, Size, InterTypeExtended, BorderMode, RemapMode> > TestRemap;
@@ -21,24 +21,39 @@ void update_map(const Mat& src, Mat& map_x, Mat& map_y, const int remapMode, boo
```

Review comment:
no need in extra line here.
**File:** modules/imgproc/test/test_imgwarp_strict.cpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -150,7 +150,7 @@ void CV_ImageWarpBaseTest::generate_test_data()
     while (depth == CV_8S || depth == CV_32S)
         depth = rng.uniform(0, CV_64F);
 
-    int cn = rng.uniform(1, 4);
+    int cn = rng.uniform(1, 5);
 
     src.create(ssize, CV_MAKE_TYPE(depth, cn));
 
@@ -1045,6 +1045,13 @@ class CV_WarpAffine_Test :
```

Review comment:
please remove.
**File:** modules/imgproc/perf/perf_warp.cpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -12,7 +12,7 @@ CV_ENUM(InterType, INTER_NEAREST, INTER_LINEAR)
 CV_ENUM(InterTypeExtended, INTER_NEAREST, INTER_LINEAR, WARP_RELATIVE_MAP)
 CV_ENUM(RemapMode, HALF_SIZE, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH)
 
-typedef TestBaseWithParam< tuple<MatType, Size, InterType, BorderMode> > TestWarpAffine;
+typedef TestBaseWithParam< tuple<Size, InterType, BorderMode, MatType> > TestWarpAffine;
 typedef TestBaseWithParam< tuple<Size, InterType, BorderMode, int> > TestWarpPerspective;
 typedef TestBaseWithParam< tuple<Size, InterType, BorderMode, MatType> > TestWarpPerspectiveNear_t;
 typedef TestBaseWithParam< tuple<MatType, Size, InterTypeExtended, BorderMode, RemapMode> > TestRemap;
@@ -21,24 +21,39 @@ void update_map(const Mat& src, Mat& map_x, Mat& map_y, const int remapMode, boo
```

Review comment:
Will remove later. Need this for testing purposes.
**File:** modules/imgproc/src/warp_kernels.simd.hpp
**Change Type:** added
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -0,0 +1,2137 @@
+// 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.
+
+#include <numeric>
+#include "precomp.hpp"
+#include "warp_common.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+
```

Review comment:
Will try in the next commit.
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -2228,9 +2228,7 @@ inline v_int16x8 v_round(const v_float16x8 &a)
 
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
```

Review comment:
I was struggled at armv7 support. There is no existing macros indicating if target supports only armv7.
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs
**Review Line:** 2231

**Code Changes:**
```diff
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
 inline v_int16x8 v_ceil(const v_float16x8 &a)
@@ -2271,9 +2269,13 @@ inline v_int32x4 v_round(const v_float32x4& a)
 #endif
```

Review comment:
Do we have an existing macro indicating the target platform is armv7?
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -2228,9 +2228,7 @@ inline v_int16x8 v_round(const v_float16x8 &a)
 
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
```

Review comment:
There is manual "CAROTENE_NEON_ARCH" option. Looks like we need build check or handle march option correctly.
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -2228,9 +2228,7 @@ inline v_int16x8 v_round(const v_float16x8 &a)
 
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
```

Review comment:
> need build check or handle march option correctly. That sounds like a dedicated PR. How about guard it (as well as the above one) with `CV_NEON_AARCH64` for now?
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs
**Review Line:** 2231

**Code Changes:**
```diff
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
 inline v_int16x8 v_ceil(const v_float16x8 &a)
@@ -2271,9 +2269,13 @@ inline v_int32x4 v_round(const v_float32x4& a)
 #endif
```

Review comment:
Input is of type `v_float16x8`. I guess compile flag `+fp16` can only be used with >= `armv8.2a` right? In this case, no need to guard with `__ARM_ARCH > 7` then.
**File:** modules/imgproc/src/warp_kernels.simd.hpp
**Change Type:** added
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -0,0 +1,2137 @@
+// 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.
+
+#include <numeric>
+#include "precomp.hpp"
+#include "warp_common.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+
```

Review comment:
`.simd.hpp` should not have `cv::Mat` or other C++ classes in their API.
**File:** modules/imgproc/src/warp_kernels.simd.hpp
**Change Type:** added
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs
**Review Line:** 91

**Code Changes:**
```diff
+            if( p < 0 )
+                p = -p - 1 + delta;
+            else
+                p = len - 1 - (p - len) - delta;
+        }
+        while( (unsigned)p >= (unsigned)len );
+    }
+    else if( borderType == BORDER_WRAP )
+    {
+        if( p < 0 )
+            p -= ((p-len+1)/len)*len;
```

Review comment:
How to guarantee avoidance of infinite loop?
**File:** modules/imgproc/src/warp_kernels.simd.hpp
**Change Type:** added
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -0,0 +1,2137 @@
+// 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.
+
+#include <numeric>
+#include "precomp.hpp"
+#include "warp_common.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+
```

Review comment:
There are many of those scattered in the code. One of them is: https://github.com/opencv/opencv/blob/babc669dba4c1f55a0acc904e47bf2186aa8f7d1/modules/imgproc/src/bilateral_filter.simd.hpp#L55-L60
**File:** modules/imgproc/src/warp_kernels.simd.hpp
**Change Type:** added
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs
**Review Line:** 91

**Code Changes:**
```diff
+            if( p < 0 )
+                p = -p - 1 + delta;
+            else
+                p = len - 1 - (p - len) - delta;
+        }
+        while( (unsigned)p >= (unsigned)len );
+    }
+    else if( borderType == BORDER_WRAP )
+    {
+        if( p < 0 )
+            p -= ((p-len+1)/len)*len;
```

Review comment:
I don't know. Ask people who wrote that originally: https://github.com/opencv/opencv/blob/babc669dba4c1f55a0acc904e47bf2186aa8f7d1/modules/core/src/copy.cpp#L806-L817
**File:** modules/core/include/opencv2/core/hal/intrin_neon.hpp
**Change Type:** modified
**Context:** PR #25984: imgproc: add optimized warpAffine kernels for 8U/16U/32F + C1/C3/C4 inputs

**Code Changes:**
```diff
@@ -2228,9 +2228,7 @@ inline v_int16x8 v_round(const v_float16x8 &a)
 
 inline v_int16x8 v_floor(const v_float16x8 &a)
 {
-    int16x8_t a1 = vcvtq_s16_f16(a.val);
-    uint16x8_t mask = vcgtq_f16(vcvtq_f16_s16(a1), a.val);
-    return v_int16x8(vaddq_s16(a1, vreinterpretq_s16_u16(mask)));
+    return v_int16x8(vcvtmq_s16_f16(a.val));
 }
 
```

Review comment:
Please use __ARM_ARCH > 7 check. I have armv7 board and test it regularly.