nareshmlx/opencv-pr huggingface dataset:
**File:** modules/core/include/opencv2/core/matx.hpp
**Change Type:** modified
**Context:** PR #24416: (5.x) Merge 4.x - Contrib: https://github.com/opencv/opencv_contrib/pull/3578 Extra: https://github.com/opencv/opencv_extra/pull/1109 #2310...

**Code Changes:**
```diff
@@ -225,7 +225,7 @@ template<typename _Tp, int m, int n> class Matx
     void copyTo(const _OutputArray& dst) const;
     void convertTo(const _OutputArray& dst, int type, double scale=1., double shift=0.) const;
 
-    _Tp val[m*n]; //< matrix elements
+    _Tp val[m*n]; ///< matrix elements
 };
 
 typedef Matx<float, 1, 2> Matx12f;
```

Review comment:
Got it. My fault.
**File:** modules/dnn/test/test_layers.cpp
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -764,11 +764,15 @@ TEST_F(Layer_RNN_Test, get_set_test)
 
 TEST_P(Test_Caffe_layers, Accum)
 {
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
+    throw SkipTestException("Requires patched protobuf");
+#else
     if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU)
         applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
 
```

Review comment:
Skip exception is more preferable: ```cpp TEST_P(Test_Caffe_layers, Accum) { #ifdef throw SkipTestException("Requires patched protobuf"); #else if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU) applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16); testLayerUsingCaffeModels("accum", false, false, 0.0, 0.0, 2); testLayerUsingCaffeModels("accum_ref", false, false, 0.0, 0.0, 2); #endif }
**File:** cmake/OpenCVFindProtobuf.cmake
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
   set(Protobuf_LIBRARIES "libprotobuf")
   set(HAVE_PROTOBUF TRUE)
 else()
+  # we still need this for command PROTOBUF_GENERATE_CPP.
+  set(protobuf_MODULE_COMPATIBLE ON)
+
   unset(Protobuf_VERSION CACHE)
-  find_package(Protobuf QUIET)
+  find_package(Protobuf QUIET CONFIG)
```

Review comment:
`abseil-cpp` is a direct dependency of Protobuf, not OpenCV. Not sure that it has to be reported.
**File:** modules/dnn/test/test_layers.cpp
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -764,11 +764,15 @@ TEST_F(Layer_RNN_Test, get_set_test)
 
 TEST_P(Test_Caffe_layers, Accum)
 {
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
+    throw SkipTestException("Requires patched protobuf");
+#else
     if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU)
         applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
 
```

Review comment:
Yes, please. It is just a convenient way.
**File:** modules/dnn/CMakeLists.txt
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)
**Review Line:** 247

**Code Changes:**
```diff
 
+if(NOT BUILD_PROTOBUF)
+  if(TARGET opencv_test_dnn)
+    ocv_target_compile_definitions(opencv_test_dnn PRIVATE "OPENCV_DNN_EXTERNAL_PROTOBUF=1")
+  endif()
+endif()
+
 set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
 file(GLOB_RECURSE perf_srcs "${perf_path}/*.cpp")
 file(GLOB_RECURSE perf_hdrs "${perf_path}/*.hpp" "${perf_path}/*.h")
```

Review comment:
Does it mean that `DISABLED_Interp` was always disabled? There was `#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF` but no definition?
**File:** modules/dnn/CMakeLists.txt
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -240,6 +240,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs})
 ocv_add_samples()
 ocv_add_accuracy_tests(${dnn_runtime_libs})
 
+if(NOT BUILD_PROTOBUF)
+  if(TARGET opencv_test_dnn)
+    ocv_target_compile_definitions(opencv_test_dnn PRIVATE "OPENCV_DNN_EXTERNAL_PROTOBUF=1")
+  endif()
+endif()
+
```

Review comment:
Does this need "if(TARGET opencv_test_dnn)" as well? I'm seeing: ``` CMake Error at cmake/OpenCVUtils.cmake:1517 (message): ocv_target_compile_definitions: invalid target: 'opencv_test_dnn' Call Stack (most recent call first): modules/dnn/CMakeLists.txt:258 (ocv_target_compile_definitions) ```
**File:** cmake/OpenCVFindProtobuf.cmake
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
   set(Protobuf_LIBRARIES "libprotobuf")
   set(HAVE_PROTOBUF TRUE)
 else()
+  # we still need this for command PROTOBUF_GENERATE_CPP.
+  set(protobuf_MODULE_COMPATIBLE ON)
+
   unset(Protobuf_VERSION CACHE)
-  find_package(Protobuf QUIET)
+  find_package(Protobuf QUIET CONFIG)
```

Review comment:
Does abseil has cmake package? Can we use `find_package` instead of `pkg_config` and `find_library`?
**File:** cmake/OpenCVFindProtobuf.cmake
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
   set(Protobuf_LIBRARIES "libprotobuf")
   set(HAVE_PROTOBUF TRUE)
 else()
+  # we still need this for command PROTOBUF_GENERATE_CPP.
+  set(protobuf_MODULE_COMPATIBLE ON)
+
   unset(Protobuf_VERSION CACHE)
-  find_package(Protobuf QUIET)
+  find_package(Protobuf QUIET CONFIG)
```

Review comment:
What is the problem with `if'(NOT (Protobuf_VERSION VERSION_LESS 22))`? https://cmake.org/cmake/help/latest/command/if.html#version-less > Any non-integer version component or non-integer trailing part of a version component effectively truncates the string at that point.
**File:** cmake/OpenCVFindProtobuf.cmake
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
   set(Protobuf_LIBRARIES "libprotobuf")
   set(HAVE_PROTOBUF TRUE)
 else()
+  # we still need this for command PROTOBUF_GENERATE_CPP.
+  set(protobuf_MODULE_COMPATIBLE ON)
+
   unset(Protobuf_VERSION CACHE)
-  find_package(Protobuf QUIET)
+  find_package(Protobuf QUIET CONFIG)
```

Review comment:
Use `if(GREATER)` instead.
**File:** cmake/OpenCVFindProtobuf.cmake
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
   set(Protobuf_LIBRARIES "libprotobuf")
   set(HAVE_PROTOBUF TRUE)
 else()
+  # we still need this for command PROTOBUF_GENERATE_CPP.
+  set(protobuf_MODULE_COMPATIBLE ON)
+
   unset(Protobuf_VERSION CACHE)
-  find_package(Protobuf QUIET)
+  find_package(Protobuf QUIET CONFIG)
```

Review comment:
It is not a default configuration. Need to explicitly specify `BUILD_PROTOBUF=OFF` to go here. I believe we could these errors here.
**File:** cmake/OpenCVFindProtobuf.cmake
**Change Type:** modified
**Context:** PR #24372: supporting protobuf v22 and later(with abseil-cpp/C++17)

**Code Changes:**
```diff
@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
   set(Protobuf_LIBRARIES "libprotobuf")
   set(HAVE_PROTOBUF TRUE)
 else()
+  # we still need this for command PROTOBUF_GENERATE_CPP.
+  set(protobuf_MODULE_COMPATIBLE ON)
+
   unset(Protobuf_VERSION CACHE)
-  find_package(Protobuf QUIET)
+  find_package(Protobuf QUIET CONFIG)
```

Review comment:
I'm sorry I have small mistake that is inserting unnecessary blank line.I had created pull request to fix it.
**File:** modules/objdetect/src/aruco/aruco_detector.cpp
**Change Type:** modified
**Context:** PR #24355: add dynamic window in aruco cornerRefinement

**Code Changes:**
```diff
@@ -35,6 +35,8 @@ static inline bool readWrite(DetectorParameters &params, const FileNode* readNod
     check |= readWriteParameter("minMarkerDistanceRate", params.minMarkerDistanceRate, readNode, writeStorage);
     check |= readWriteParameter("cornerRefinementMethod", params.cornerRefinementMethod, readNode, writeStorage);
     check |= readWriteParameter("cornerRefinementWinSize", params.cornerRefinementWinSize, readNode, writeStorage);
+    check |= readWriteParameter("relativeCornerRefinmentWinSize", params.relativeCornerRefinmentWinSize, readNode,
+                                writeStorage);
     check |= readWriteParameter("cornerRefinementMaxIterations", params.cornerRefinementMaxIterations,
                                 readNode, writeStorage);
     check |= readWriteParameter("cornerRefinementMinAccuracy", params.cornerRefinementMinAccuracy,
@@ -847,6 +849,16 @@ struct ArucoDetector::ArucoDetectorImpl {
```

Review comment:
`getAverageArucoPinSize`
**File:** modules/objdetect/include/opencv2/objdetect/aruco_detector.hpp
**Change Type:** modified
**Context:** PR #24355: add dynamic window in aruco cornerRefinement

**Code Changes:**
```diff
@@ -36,6 +36,7 @@ struct CV_EXPORTS_W_SIMPLE DetectorParameters {
         minMarkerDistanceRate = 0.05;
         cornerRefinementMethod = (int)CORNER_REFINE_NONE;
         cornerRefinementWinSize = 5;
+        relativeCornerRefinmentWinSize = 0.3f;
         cornerRefinementMaxIterations = 30;
         cornerRefinementMinAccuracy = 0.1;
         markerBorderBits = 1;
@@ -108,9 +109,27 @@ struct CV_EXPORTS_W_SIMPLE DetectorParameters {
     /** @brief default value CORNER_REFINE_NONE */
```

Review comment:
I propose to name the field as `relativeCornerRefinmentWinSize`. And add information about avarage Aruco pin size and logic to the description.
**File:** modules/dnn/src/onnx/onnx_importer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -383,7 +383,7 @@ void runLayer(LayerParams& params, const std::vector<Mat>& inputs,
     {
         inpShapes[i] = shape(inputs[i]);
         if (i > 0 && ddepth != inputs[i].depth())
-            CV_Error(Error::StsNotImplemented, "Mixed input data types.");
+            CV_Error(Error::StsNotImplemented, cv::format("Mixed input data types. Required type: %d, actual type: %d", ddepth, inputs[i].depth()));
 
         // Quantize and Dequantize layer have different output type than input.
         if (params.type != "Quantize" && params.type != "Dequantize")
```

Review comment:
A bit confusing. Why `if (i == 1)` but not `if (input_i.depth() != CV_32F)`? Also, what happens with input_i after conversion?
**File:** modules/dnn/src/onnx/onnx_importer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -383,7 +383,7 @@ void runLayer(LayerParams& params, const std::vector<Mat>& inputs,
     {
         inpShapes[i] = shape(inputs[i]);
         if (i > 0 && ddepth != inputs[i].depth())
-            CV_Error(Error::StsNotImplemented, "Mixed input data types.");
+            CV_Error(Error::StsNotImplemented, cv::format("Mixed input data types. Required type: %d, actual type: %d", ddepth, inputs[i].depth()));
 
         // Quantize and Dequantize layer have different output type than input.
         if (params.type != "Quantize" && params.type != "Dequantize")
```

Review comment:
I mean it's more clear to do like this: ```cpp for (size_t i = 0; i < node_proto.input_size(); ++i) { auto input = getBlob(node_proto, i); if (input.depth() != CV_32F) input.convertTo(input, CV_32F); inputs.push_back(input); } ```
**File:** modules/dnn/src/onnx/onnx_importer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -383,7 +383,7 @@ void runLayer(LayerParams& params, const std::vector<Mat>& inputs,
     {
         inpShapes[i] = shape(inputs[i]);
         if (i > 0 && ddepth != inputs[i].depth())
-            CV_Error(Error::StsNotImplemented, "Mixed input data types.");
+            CV_Error(Error::StsNotImplemented, cv::format("Mixed input data types. Required type: %d, actual type: %d", ddepth, inputs[i].depth()));
 
         // Quantize and Dequantize layer have different output type than input.
         if (params.type != "Quantize" && params.type != "Dequantize")
```

Review comment:
Same as above, can we check `if (inp.depth() != CV_32F)`;
**File:** modules/dnn/src/onnx/onnx_importer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -383,7 +383,7 @@ void runLayer(LayerParams& params, const std::vector<Mat>& inputs,
     {
         inpShapes[i] = shape(inputs[i]);
         if (i > 0 && ddepth != inputs[i].depth())
-            CV_Error(Error::StsNotImplemented, "Mixed input data types.");
+            CV_Error(Error::StsNotImplemented, cv::format("Mixed input data types. Required type: %d, actual type: %d", ddepth, inputs[i].depth()));
 
         // Quantize and Dequantize layer have different output type than input.
         if (params.type != "Quantize" && params.type != "Dequantize")
```

Review comment:
There is `Where` operator which is parsed by this method as well. I did this just to avoid some potential issues, but still I can try your solution. --- Done.
**File:** modules/dnn/src/layers/const_layer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -62,10 +62,15 @@ class ConstLayerImpl CV_FINAL : public ConstLayer
     {
         std::vector<UMat> outputs;
         outs.getUMatVector(outputs);
-        if (outs.depth() == CV_16S)
-            convertFp16(blobs[0], outputs[0]);
+        if (outs.depth() == CV_16S) {
+            auto blob = blobs[0];
+            if (blob.type() != CV_32F) {
+                blob.convertTo(blob, CV_32F);
```

Review comment:
`if (blob.type() != CV_32F)`
**File:** modules/dnn/src/layers/const_layer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -62,10 +62,15 @@ class ConstLayerImpl CV_FINAL : public ConstLayer
     {
         std::vector<UMat> outputs;
         outs.getUMatVector(outputs);
-        if (outs.depth() == CV_16S)
-            convertFp16(blobs[0], outputs[0]);
+        if (outs.depth() == CV_16S) {
+            auto blob = blobs[0];
+            if (blob.type() != CV_32F) {
+                blob.convertTo(blob, CV_32F);
```

Review comment:
I found that `convertFp16` can do two conversion, fp32 -> fp16 and fp16 -> fp32. Won't it break if `blob.type() == CV_16F`?
**File:** modules/dnn/src/layers/const_layer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -62,10 +62,15 @@ class ConstLayerImpl CV_FINAL : public ConstLayer
     {
         std::vector<UMat> outputs;
         outs.getUMatVector(outputs);
-        if (outs.depth() == CV_16S)
-            convertFp16(blobs[0], outputs[0]);
+        if (outs.depth() == CV_16S) {
+            auto blob = blobs[0];
+            if (blob.type() != CV_32F) {
+                blob.convertTo(blob, CV_32F);
```

Review comment:
Agree, but seems like it didn't work with previous code too. Not sure if `CV_16F` is even supported in dnn.
**File:** modules/dnn/src/layers/const_layer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -62,10 +62,15 @@ class ConstLayerImpl CV_FINAL : public ConstLayer
     {
         std::vector<UMat> outputs;
         outs.getUMatVector(outputs);
-        if (outs.depth() == CV_16S)
-            convertFp16(blobs[0], outputs[0]);
+        if (outs.depth() == CV_16S) {
+            auto blob = blobs[0];
+            if (blob.type() != CV_32F) {
+                blob.convertTo(blob, CV_32F);
```

Review comment:
Yes, we do support `CV_16F` for CPU target (ARM, specifically). We have conv kernels for fp16 and also have real fp16 models in model zoo, https://github.com/opencv/opencv_zoo/tree/main/models/text_recognition_crnn. Also we are trying to convert all models in model zoo to fp16 accuracy, https://github.com/opencv/opencv_zoo/pull/183.
**File:** modules/dnn/src/layers/const_layer.cpp
**Change Type:** modified
**Context:** PR #24386: dnn: fix inconsistent input dtype for nary eltwise layers

**Code Changes:**
```diff
@@ -62,10 +62,15 @@ class ConstLayerImpl CV_FINAL : public ConstLayer
     {
         std::vector<UMat> outputs;
         outs.getUMatVector(outputs);
-        if (outs.depth() == CV_16S)
-            convertFp16(blobs[0], outputs[0]);
+        if (outs.depth() == CV_16S) {
+            auto blob = blobs[0];
+            if (blob.type() != CV_32F) {
+                blob.convertTo(blob, CV_32F);
```

Review comment:
This is `forward_ocl` method, not CPU.
**File:** modules/videoio/test/test_camera.cpp
**Change Type:** modified
**Context:** PR #24240: Added test with V4L CAP_PROP_CONVERT_RGB=false.
**Review Line:** 248

**Code Changes:**
```diff
+    {
+        int pixel_type  = (int)capture.get(cv::CAP_PROP_FORMAT);
+        int channels    = CV_MAT_CN(pixel_type);
+        int pixel_bytes = CV_ELEM_SIZE(pixel_type);
+
+        // YUYV is expected for most of popular USB cam (COLOR_YUV2BGR_YUYV conversion)
+        EXPECT_EQ(2, channels);
+        EXPECT_EQ(2, pixel_bytes);
+
+        capture >> frame;
+    }
```

Review comment:
I think this is not correct assumption, ~e.g on my laptop (pretty regular) I have 3 channels and 3 bytes and the tests fails.~ (_apparently I did not merge 4.x with the fix_), there are several other formats in the try list before YUYV.
**File:** modules/videoio/test/test_camera.cpp
**Change Type:** modified
**Context:** PR #24240: Added test with V4L CAP_PROP_CONVERT_RGB=false.

**Code Changes:**
```diff
@@ -223,6 +223,35 @@ TEST(DISABLED_videoio_camera, v4l_read_framesize)
     capture.release();
 }
 
+TEST(DISABLED_videoio_camera, v4l_rgb_convert)
+{
+    VideoCapture capture(CAP_V4L2);
+    ASSERT_TRUE(capture.isOpened());
+    std::cout << "Camera 0 via " << capture.getBackendName() << " backend" << std::endl;
+    std::cout << " Frame width: " << capture.get(CAP_PROP_FRAME_WIDTH) << std::endl;
```

Review comment:
Lets check if camera uses YUYV by default: ```suggestion if (capture.get(CAP_PROP_FOURCC) != VideoWriter::fourcc('Y', 'U', 'Y', 'V')) { throw SkipTestException("Camera does not support YUYV format"); } ```
**File:** modules/dnn/src/layers/cpu_kernels/fast_gemm_kernels.default.hpp
**Change Type:** modified
**Context:** PR #24315: dnn: hotfixes for fast gemm

**Code Changes:**
```diff
@@ -12,16 +12,16 @@
 #include <opencv2/core/hal/intrin.hpp>
 #include <opencv2/core/utility.hpp> // parallel_for_
 
-#define FAST_GEMM_DEFAULT_STORAGE (1<<20) // 2^20
-#define FAST_GEMM_DEFAULT_MAX_STACKBUF (1 << 14)
+#define FAST_GEMM_STORAGE (1<<20) // 2^20
+#define FAST_GEMM_MAX_STACKBUF (1 << 14)
 
-#define FAST_GEMM_DEFAULT_F32_MC 64
```

Review comment:
It is better to keep this code in `.simd.hpp` (that file is processed anyway including "baseline" pass). Example: `fastAtan64f`
**File:** modules/dnn/src/layers/cpu_kernels/fast_gemm_kernels.default.hpp
**Change Type:** modified
**Context:** PR #24315: dnn: hotfixes for fast gemm

**Code Changes:**
```diff
@@ -12,16 +12,16 @@
 #include <opencv2/core/hal/intrin.hpp>
 #include <opencv2/core/utility.hpp> // parallel_for_
 
-#define FAST_GEMM_DEFAULT_STORAGE (1<<20) // 2^20
-#define FAST_GEMM_DEFAULT_MAX_STACKBUF (1 << 14)
+#define FAST_GEMM_STORAGE (1<<20) // 2^20
+#define FAST_GEMM_MAX_STACKBUF (1 << 14)
 
-#define FAST_GEMM_DEFAULT_F32_MC 64
```

Review comment:
I dont quite understand. If these default kernels are put in `.simd.hpp`, how to make them define only when other sets are not availble (AVX, AVX2, LASX)? For example, we can control this using `#if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_AVX` for AVX / AVX2; what about defaults?
**File:** modules/dnn/src/layers/cpu_kernels/fast_gemm_kernels.default.hpp
**Change Type:** modified
**Context:** PR #24315: dnn: hotfixes for fast gemm

**Code Changes:**
```diff
@@ -12,16 +12,16 @@
 #include <opencv2/core/hal/intrin.hpp>
 #include <opencv2/core/utility.hpp> // parallel_for_
 
-#define FAST_GEMM_DEFAULT_STORAGE (1<<20) // 2^20
-#define FAST_GEMM_DEFAULT_MAX_STACKBUF (1 << 14)
+#define FAST_GEMM_STORAGE (1<<20) // 2^20
+#define FAST_GEMM_MAX_STACKBUF (1 << 14)
 
-#define FAST_GEMM_DEFAULT_F32_MC 64
```

Review comment:
"Defaults" are CPU_BASELINE. --- > other sets are not availble (AVX, AVX2, LASX) CPU_BASELINE could be AVX2 or even AVX512_SKX. All optimization code paths should be properly handled through the single file (.simd.hpp). Baseline code path is generated from this file too. Follow the provided example (it is simple enough). Use the same function name and same parameters for the entry point.
**File:** modules/dnn/src/layers/cpu_kernels/fast_gemm_kernels.default.hpp
**Change Type:** modified
**Context:** PR #24315: dnn: hotfixes for fast gemm

**Code Changes:**
```diff
@@ -12,16 +12,16 @@
 #include <opencv2/core/hal/intrin.hpp>
 #include <opencv2/core/utility.hpp> // parallel_for_
 
-#define FAST_GEMM_DEFAULT_STORAGE (1<<20) // 2^20
-#define FAST_GEMM_DEFAULT_MAX_STACKBUF (1 << 14)
+#define FAST_GEMM_STORAGE (1<<20) // 2^20
+#define FAST_GEMM_MAX_STACKBUF (1 << 14)
 
-#define FAST_GEMM_DEFAULT_F32_MC 64
```

Review comment:
Do you mean something like this in `.simd.hpp`: ```cpp // ... CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN /* fastGemm signatures */ #if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_AVX // ... #endif #if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_LASX // ... #endif #if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) // content of fast_gemm_kernels.default.hpp #endif CV_CPU_OPTIMIZATION_NAMESPACE_END // ... ``` This can lead to redefinitions.
**File:** modules/dnn/src/layers/cpu_kernels/fast_gemm_kernels.default.hpp
**Change Type:** modified
**Context:** PR #24315: dnn: hotfixes for fast gemm

**Code Changes:**
```diff
@@ -12,16 +12,16 @@
 #include <opencv2/core/hal/intrin.hpp>
 #include <opencv2/core/utility.hpp> // parallel_for_
 
-#define FAST_GEMM_DEFAULT_STORAGE (1<<20) // 2^20
-#define FAST_GEMM_DEFAULT_MAX_STACKBUF (1 << 14)
+#define FAST_GEMM_STORAGE (1<<20) // 2^20
+#define FAST_GEMM_MAX_STACKBUF (1 << 14)
 
-#define FAST_GEMM_DEFAULT_F32_MC 64
```

Review comment:
This scheme doesn't violate ODR rule: ``` // .simd.hpp CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN // forward declaration void my_dispatched_function(...) #ifndef CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY ... optional helper functions (see below)... void my_dispatched_function(...) { CV_TRACE_FUNCTION(); #if CV_AVX // CV_TRACE_REGION("AVX"); ... AVX instructions (rewrites successors like AVX2, AVX512 too) ... // CV_TRACE_REGION_NEXT("TAIL"); #elif CV_NEON // CV_TRACE_REGION("NEON"); ... NEON instructions ... // CV_TRACE_REGION_NEXT("TAIL"); #elif CV_LASX // CV_TRACE_REGION("LASX"); ... LASX instructions ... // CV_TRACE_REGION_NEXT("TAIL"); #elif CV_SIMD // CV_TRACE_REGION("SIMD"); ... other universal SIMD ... // CV_TRACE_REGION_NEXT("TAIL"); #endif ... generic C++ (scalar) tail processing ... } #endif // CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY CV_CPU_OPTIMIZATION_NAMESPACE_END ``` If we need helper functions, then make them `static inline` right after `#ifndef CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY`: ``` #if CV_AVX static inline my_avx_helper(...) {} #elif CV_NEON static inline my_neon_helper(...) {} #elif CV_LASX static inline my_lasx_helper(...) {} #elif CV_SIMD static inline my_simd_helper(...) {} #endif static inline my_generic_helper(...) {} ``` (structures should go in anonynous namespace to avoid ODR violation)
**File:** modules/core/src/matrix_transform.cpp
**Change Type:** modified
**Context:** PR #24233: Add HAL implementation hooks to cv::flip() and cv::rotate() functions from core module
**Review Line:** 1105

**Code Changes:**
```diff
 }
 
+void rotate(InputArray _src, OutputArray _dst, int rotateMode)
+{
+    CV_Assert(_src.dims() <= 2);
+    int angle;
+
+    if (_dst.isUMat())
+    {
+        rotateImpl(_src, _dst, rotateMode);
+        return;
```

Review comment:
Missing checks of input parameters constraints.