nareshmlx/opencv-pr huggingface dataset:
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2534: OpenCVConfig.cmake fix after cutting absolute CUDA libraries path

**Code Changes:**
```diff
@@ -210,7 +210,7 @@ foreach(__opttype OPT DBG)
   SET(OpenCV_EXTRA_LIBS_${__opttype} "")
 
   # CUDA
-  if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
+  if(OpenCV_CUDA_VERSION)
     if(NOT CUDA_FOUND)
       find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
     else()
@@ -219,32 +219,41 @@ foreach(__opttype OPT DBG)
```

Review comment:
When I was reviewing the PR that added the original code, I specifically asked to not do what you're currently doing. We shouldn't touch variables with the `CUDA_` prefix, since the config file is executed in someone else's script, and that someone may not be happy that we muck with another module's variables. Same applies to `CUDA_LIBS_PATH` below.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2534: OpenCVConfig.cmake fix after cutting absolute CUDA libraries path

**Code Changes:**
```diff
@@ -210,7 +210,7 @@ foreach(__opttype OPT DBG)
   SET(OpenCV_EXTRA_LIBS_${__opttype} "")
 
   # CUDA
-  if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
+  if(OpenCV_CUDA_VERSION)
     if(NOT CUDA_FOUND)
       find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
     else()
@@ -219,32 +219,41 @@ foreach(__opttype OPT DBG)
```

Review comment:
This is starting to look like duplication. IMO, what you should do here is: 1) Keep these blocks as they were, except instead of `OpenCV_EXTRA_LIBS_${__opttype}`, append to a temporary list (e.g. `OpenCV_CUDA_LIBS`). 2) Do a `foreach` across `OpenCV_CUDA_LIBS`, storing the paths in e.g. `OpenCV_CUDA_LIBS_PATH`.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2534: OpenCVConfig.cmake fix after cutting absolute CUDA libraries path

**Code Changes:**
```diff
@@ -210,7 +210,7 @@ foreach(__opttype OPT DBG)
   SET(OpenCV_EXTRA_LIBS_${__opttype} "")
 
   # CUDA
-  if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
+  if(OpenCV_CUDA_VERSION)
     if(NOT CUDA_FOUND)
       find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
     else()
@@ -219,32 +219,41 @@ foreach(__opttype OPT DBG)
```

Review comment:
You know... perhaps what we should do instead of using relative paths is to fix our exported targets here by replacing the paths to CUDA libraries in the target properties with the paths that we just found. Not saying we should do that right now - that'd be a fairly extensive change and I'm guessing you don't have the time, but definitely something to consider post-release.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2534: OpenCVConfig.cmake fix after cutting absolute CUDA libraries path

**Code Changes:**
```diff
@@ -210,7 +210,7 @@ foreach(__opttype OPT DBG)
   SET(OpenCV_EXTRA_LIBS_${__opttype} "")
 
   # CUDA
-  if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
+  if(OpenCV_CUDA_VERSION)
     if(NOT CUDA_FOUND)
       find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
     else()
@@ -219,32 +219,41 @@ foreach(__opttype OPT DBG)
```

Review comment:
CUDA_LIBS_PATH is my own variable, it is not part of FindCUDA script. Regarding NPP, I'll fix it.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2534: OpenCVConfig.cmake fix after cutting absolute CUDA libraries path

**Code Changes:**
```diff
@@ -210,7 +210,7 @@ foreach(__opttype OPT DBG)
   SET(OpenCV_EXTRA_LIBS_${__opttype} "")
 
   # CUDA
-  if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
+  if(OpenCV_CUDA_VERSION)
     if(NOT CUDA_FOUND)
       find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
     else()
@@ -219,32 +219,41 @@ foreach(__opttype OPT DBG)
```

Review comment:
> CUDA_LIBS_PATH is my own variable But you never know what variables the FindCUDA script will define in the future. Best to keep out of the `CUDA_` namespace.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2534: OpenCVConfig.cmake fix after cutting absolute CUDA libraries path

**Code Changes:**
```diff
@@ -210,7 +210,7 @@ foreach(__opttype OPT DBG)
   SET(OpenCV_EXTRA_LIBS_${__opttype} "")
 
   # CUDA
-  if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
+  if(OpenCV_CUDA_VERSION)
     if(NOT CUDA_FOUND)
       find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
     else()
@@ -219,32 +219,41 @@ foreach(__opttype OPT DBG)
```

Review comment:
You haven't addressed this.
**File:** modules/highgui/include/opencv2/highgui.hpp
**Change Type:** modified
**Context:** PR #2379: write JPEG with optimized coding. - According to several sources (https://github.com/jcupitt/libvips/pull/76), enabling this flag allow to p...

**Code Changes:**
```diff
@@ -217,6 +217,7 @@ enum { IMREAD_UNCHANGED  = -1, // 8bit, color or not
 
 enum { IMWRITE_JPEG_QUALITY     = 1,
        IMWRITE_JPEG_PROGRESSIVE = 2,
+       IMWRITE_JPEG_OPTIMIZE    = 3,
        IMWRITE_PNG_COMPRESSION  = 16,
        IMWRITE_PNG_STRATEGY     = 17,
        IMWRITE_PNG_BILEVEL      = 18,
```

Review comment:
Realign these, please.
**File:** cmake/templates/OpenCV.mk.in
**Change Type:** modified
**Context:** PR #2514: Added guard to prevent from gpu module redefinition in OpenCV.mk

**Code Changes:**
```diff
@@ -152,11 +152,14 @@ ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED),)
     OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED:=on
 endif
 
-ifeq ($(OPENCV_USE_GPU_MODULE),on)
-    include $(CLEAR_VARS)
-    LOCAL_MODULE:=opencv_gpu
-    LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/libopencv_gpu.a
-    include $(PREBUILT_STATIC_LIBRARY)
+ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_GPU_ALREADY_INCLUDED),)
```

Review comment:
Wouldn't this always be false, because it's set in the previous `ifeq`?
**File:** cmake/OpenCVDetectCUDA.cmake
**Change Type:** modified
**Context:** PR #2339: fixed two warnings in gpu sources (-Wshadow, -Wno-sign-promo)
**Review Line:** 184

**Code Changes:**
```diff
@@ -180,6 +180,9 @@ if(CUDA_FOUND)
       # we remove -Wsign-promo as it generates warnings under linux
       string(REPLACE "-Wsign-promo" "" ${var} "${${var}}")
 
+      # we remove -Wno-sign-promo as it generates warnings under linux
+      string(REPLACE "-Wno-sign-promo" "" ${var} "${${var}}")
+
       # we remove -Wno-delete-non-virtual-dtor because it's used for C++ compiler
       # but NVCC uses C compiler by default
       string(REPLACE "-Wno-delete-non-virtual-dtor" "" ${var} "${${var}}")
```

Review comment:
I don't get it. Turning the warning _off_ generates a warning?
**File:** cmake/OpenCVDetectCUDA.cmake
**Change Type:** modified
**Context:** PR #2339: fixed two warnings in gpu sources (-Wshadow, -Wno-sign-promo)
**Review Line:** 184

**Code Changes:**
```diff
@@ -180,6 +180,9 @@ if(CUDA_FOUND)
       # we remove -Wsign-promo as it generates warnings under linux
       string(REPLACE "-Wsign-promo" "" ${var} "${${var}}")
 
+      # we remove -Wno-sign-promo as it generates warnings under linux
+      string(REPLACE "-Wno-sign-promo" "" ${var} "${${var}}")
+
       # we remove -Wno-delete-non-virtual-dtor because it's used for C++ compiler
       # but NVCC uses C compiler by default
       string(REPLACE "-Wno-delete-non-virtual-dtor" "" ${var} "${${var}}")
```

Review comment:
We turn off this warning for `.cu` files, because nvcc call C compiler, which doesn't support `-Wno-sign-promo`: ``` cc1: warning: command line option ‘-Wno-sign-promo’ is valid for C++/ObjC++ but not for C [enabled by default] ```
**File:** data/CMakeLists.txt
**Change Type:** modified
**Context:** PR #2297: Implicit testdata directory permissions setup added.

**Code Changes:**
```diff
@@ -13,6 +13,10 @@ if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
   if(ANDROID)
     install(DIRECTORY ${OPENCV_TEST_DATA_PATH} DESTINATION sdk/etc/testdata COMPONENT tests)
   elseif(NOT WIN32)
-    install(DIRECTORY ${OPENCV_TEST_DATA_PATH} DESTINATION share/OpenCV/testdata COMPONENT tests)
+    # CPack does not set correct permissions by default, so we do it explicitly.
+    install(DIRECTORY ${OPENCV_TEST_DATA_PATH}
+            DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE
+              GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+            DESTINATION share/OpenCV/testdata COMPONENT tests)
```

Review comment:
Aren't these the default directory permissions? Also, you should probably indent the line starting with `GROUP_READ` to the right a little.
**File:** cmake/templates/opencv_run_all_tests.sh.in
**Change Type:** modified
**Context:** PR #2238: Reports path fix for opencv_run_all_tests.sh.in script.

**Code Changes:**
```diff
@@ -6,7 +6,8 @@ export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata
 SUMMARY_STATUS=0
 for t in "$OPENCV_TEST_PATH/"opencv_test_* "$OPENCV_TEST_PATH/"opencv_perf_*;
 do
-  "$t" --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:$t-`date --rfc-3339=date`.xml
+  report="`basename "$t"`-`date --rfc-3339=date`.xml"
+  "$t" --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:"$report"
   TEST_STATUS=$?
   if [ $TEST_STATUS -ne 0 ]; then
     SUMMARY_STATUS=$TEST_STATUS
```

Review comment:
The quotes and the `basename` call I can understand, but what's the point of `$PWD` here? If you don't provide a full path, it's going to output to the current directory anyway. Also, two styles of command substitution on the same line - yuck.
**File:** cmake/OpenCVModule.cmake
**Change Type:** modified
**Context:** PR #2209: OpenCV C/C++/OCL/CUDA samples install path fixed. Install rools for tests added.

**Code Changes:**
```diff
@@ -711,6 +711,9 @@ function(ocv_add_perf_tests)
     else(OCV_DEPENDENCIES_FOUND)
       # TODO: warn about unsatisfied dependencies
     endif(OCV_DEPENDENCIES_FOUND)
+    if(INSTALL_TESTS)
+      install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT tests)
+    endif()
   endif()
 endfunction()
 
```

Review comment:
Neither `etc` nor `share` look like good locations for executable files to me. Also, in the Android case, shouldn't they be put in an architecture-dependent directory?
**File:** cmake/OpenCVPackaging.cmake
**Change Type:** modified
**Context:** PR #2209: OpenCV C/C++/OCL/CUDA samples install path fixed. Install rools for tests added.

**Code Changes:**
```diff
@@ -56,6 +56,12 @@ set(CPACK_DEB_COMPONENT_INSTALL TRUE)
 set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
 set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
 set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
+if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
+  set(prefix "${CMAKE_INSTALL_PREFIX}")
+  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
+                 "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY IMMEDIATE)
+  install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" DESTINATION /etc/profile.d/ COMPONENT tests)
+endif()
```

Review comment:
If `INSTALL_TESTS` is false, does this variable hurt?
**File:** samples/c/CMakeLists.txt
**Change Type:** modified
**Context:** PR #2209: OpenCV C/C++/OCL/CUDA samples install path fixed. Install rools for tests added.

**Code Changes:**
```diff
@@ -54,6 +54,6 @@ endif()
 if (INSTALL_C_EXAMPLES AND NOT WIN32)
   file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
   install(FILES ${C_SAMPLES}
-          DESTINATION share/OpenCV/samples/c
+          DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c
           PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
 endif ()
```

Review comment:
You could use a variable named `NATIVE_SAMPLES_INSTALL_PATH`, or something like that.
**File:** cmake/OpenCVPackaging.cmake
**Change Type:** modified
**Context:** PR #2197: Improvements in package build.
**Review Line:** 5

**Code Changes:**
```diff
 set(CPACK_set_DESTDIR "on")
 
 if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
-  set(CPACK_PACKAGE_DESCRIPTION "Open Computer Vision Library")
-  set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenCV")
+  set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Computer Vision Library")
+  set(CPACK_PACKAGE_DESCRIPTION
+"OpenCV (Open Source Computer Vision Library) is an open source computer vision
+and machine learning software library. OpenCV was built to provide a common
+infrastructure for computer vision applications and to accelerate the use of
+machine perception in the commercial products. Being a BSD-licensed product,
```

Review comment:
maybe 'Open **Source** Computer Vision Library' ? I suggest: 'Open Source Computer Vision Library (OpenCV)'.
**File:** cmake/OpenCVDetectPython.cmake
**Change Type:** modified
**Context:** PR #2175: fix cross-compilation issue with Numpy - This fix was given to me by @tsed

**Code Changes:**
```diff
@@ -81,24 +81,39 @@ if(PYTHON_EXECUTABLE)
     SET(PYTHON_PACKAGES_PATH "${_PYTHON_PACKAGES_PATH}" CACHE PATH "Where to install the python packages.")
 
     if(NOT PYTHON_NUMPY_INCLUDE_DIR)
-      # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
-      execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
-                      RESULT_VARIABLE PYTHON_NUMPY_PROCESS
-                      OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
-                      OUTPUT_STRIP_TRAILING_WHITESPACE)
+      if(CMAKE_CROSSCOMPILING)
```

Review comment:
I don't think this one's needed - you can't use the executable when cross-compiling anyway. (In fact, in various other places we need _host_ Python, which is autodetected.)
**File:** cmake/OpenCVDetectPython.cmake
**Change Type:** modified
**Context:** PR #2175: fix cross-compilation issue with Numpy - This fix was given to me by @tsed

**Code Changes:**
```diff
@@ -81,24 +81,39 @@ if(PYTHON_EXECUTABLE)
     SET(PYTHON_PACKAGES_PATH "${_PYTHON_PACKAGES_PATH}" CACHE PATH "Where to install the python packages.")
 
     if(NOT PYTHON_NUMPY_INCLUDE_DIR)
-      # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
-      execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
-                      RESULT_VARIABLE PYTHON_NUMPY_PROCESS
-                      OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
-                      OUTPUT_STRIP_TRAILING_WHITESPACE)
+      if(CMAKE_CROSSCOMPILING)
```

Review comment:
These need to be `PYTHON_INCLUDE_PATH` and `PYTHON_LIBRARIES`, respectively, to do anything.
**File:** cmake/OpenCVDetectPython.cmake
**Change Type:** modified
**Context:** PR #2175: fix cross-compilation issue with Numpy - This fix was given to me by @tsed

**Code Changes:**
```diff
@@ -81,24 +81,39 @@ if(PYTHON_EXECUTABLE)
     SET(PYTHON_PACKAGES_PATH "${_PYTHON_PACKAGES_PATH}" CACHE PATH "Where to install the python packages.")
 
     if(NOT PYTHON_NUMPY_INCLUDE_DIR)
-      # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
-      execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
-                      RESULT_VARIABLE PYTHON_NUMPY_PROCESS
-                      OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
-                      OUTPUT_STRIP_TRAILING_WHITESPACE)
+      if(CMAKE_CROSSCOMPILING)
```

Review comment:
It's somewhat questionable to request a version number from the user, which is only used for printing back at the user.
**File:** modules/objdetect/src/opencl/cascadedetect.cl
**Change Type:** modified
**Context:** PR #2042: [T-API] opencl optimization for LBP-based face detector
**Review Line:** 19

**Code Changes:**
```diff
 {
-    int featureIdx __attribute__((aligned (4)));
-    float threshold __attribute__((aligned (4))); // for ordered features only
-    float left __attribute__((aligned (4)));
-    float right __attribute__((aligned (4)));
+    float4 st __attribute__((aligned (4)));
 }
 Stump;
 
@@ -30,7 +33,7 @@ __kernel void runHaarClassifierStump(
     int sumstep, int sumoffset,
```

Review comment:
`float4` should be aligned to 16 bytes (the same with `int16` above)
**File:** modules/optim/src/conjugate_gradient.cpp
**Change Type:** added
**Context:** PR #1521: Optim cg - This contribution aims to implement the Nonlinear Conjugate Gradient optimization algorithm for optim module. This work is suppor...

**Code Changes:**
```diff
@@ -0,0 +1,184 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
remove Intel Corporation and Willow Garage from the copyright, put "Copyright (C) 2013, OpenCV Foundation, all rights reserved." instead
**File:** modules/optim/src/conjugate_gradient.cpp
**Change Type:** added
**Context:** PR #1521: Optim cg - This contribution aims to implement the Nonlinear Conjugate Gradient optimization algorithm for optim module. This work is suppor...

**Code Changes:**
```diff
@@ -0,0 +1,184 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
replace "Intel Corporation" with "OpenCV Foundation"
**File:** modules/objdetect/src/erfilter.cpp
**Change Type:** modified
**Context:** PR #1629: Fix a bug in the er tree clean-up process - See discussion in #1520. It's not necessary to walk the er tree in order to clean up the memory ...

**Code Changes:**
```diff
@@ -126,8 +126,6 @@ class CV_EXPORTS ERFilterNM : public ERFilter
                        int d_C1, int d_C2, int d_C3 );
     // merge an ER with its nested parent
     void er_merge( ERStat *parent, ERStat *child );
-    // recursively walk the tree and clean memory
-    void er_tree_clean( ERStat *er );
     // copy extracted regions into the output vector
     ERStat* er_save( ERStat *er, ERStat *parent, ERStat *prev );
     // recursively walk the tree and filter (remove) regions using the callback classifier
@@ -486,7 +484,17 @@ void ERFilterNM::er_tree_extract( InputArray image )
```

Review comment:
Should be `size_t`.
**File:** modules/objdetect/src/erfilter.cpp
**Change Type:** modified
**Context:** PR #1629: Fix a bug in the er tree clean-up process - See discussion in #1520. It's not necessary to walk the er tree in order to clean up the memory ...

**Code Changes:**
```diff
@@ -126,8 +126,6 @@ class CV_EXPORTS ERFilterNM : public ERFilter
                        int d_C1, int d_C2, int d_C3 );
     // merge an ER with its nested parent
     void er_merge( ERStat *parent, ERStat *child );
-    // recursively walk the tree and clean memory
-    void er_tree_clean( ERStat *er );
     // copy extracted regions into the output vector
     ERStat* er_save( ERStat *er, ERStat *parent, ERStat *prev );
     // recursively walk the tree and filter (remove) regions using the callback classifier
@@ -486,7 +484,17 @@ void ERFilterNM::er_tree_extract( InputArray image )
```

Review comment:
I've fixed that, sorry!
**File:** modules/core/src/stat.cpp
**Change Type:** modified
**Context:** PR #1187: Add IPP mean and sum functions

**Code Changes:**
```diff
@@ -439,6 +439,45 @@ cv::Scalar cv::sum( InputArray _src )
 {
     Mat src = _src.getMat();
     int k, cn = src.channels(), depth = src.depth();
+	
+#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
+	size_t total_size = src.total();
+	int rows = src.size[0], cols = (int)(total_size/rows);
+	if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
+	{
```

Review comment:
this is too big overhead. The maximum number of channels is 4, so, please, use: <pre> Ipp64f res[4]; </pre>
**File:** modules/core/src/stat.cpp
**Change Type:** modified
**Context:** PR #1187: Add IPP mean and sum functions

**Code Changes:**
```diff
@@ -439,6 +439,45 @@ cv::Scalar cv::sum( InputArray _src )
 {
     Mat src = _src.getMat();
     int k, cn = src.channels(), depth = src.depth();
+	
+#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
+	size_t total_size = src.total();
+	int rows = src.size[0], cols = (int)(total_size/rows);
+	if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
+	{
```

Review comment:
better way to check for success is to check the return code is non-negative: <pre> if(ippFunc(src.data, src.step[0], sz, &res[0], ippAlgHintAccurate) &gt;=0) return res; </pre>
**File:** modules/core/src/stat.cpp
**Change Type:** modified
**Context:** PR #1187: Add IPP mean and sum functions

**Code Changes:**
```diff
@@ -439,6 +439,45 @@ cv::Scalar cv::sum( InputArray _src )
 {
     Mat src = _src.getMat();
     int k, cn = src.channels(), depth = src.depth();
+	
+#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
+	size_t total_size = src.total();
+	int rows = src.size[0], cols = (int)(total_size/rows);
+	if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
+	{
```

Review comment:
same thing. Use Scalar instead of dynamically-allocated array.
**File:** modules/ocl/include/opencv2/ocl/ocl.hpp
**Change Type:** modified
**Context:** PR #1189: Add sort_by_key for oclMat. - As there was no real cross-platform OpenCL sorting framework (AMD's BOLT library current only supports AMD Ope...

**Code Changes:**
```diff
@@ -1673,6 +1673,31 @@ namespace cv
             oclMat diff_buf;
             oclMat norm_buf;
         };
+        // current supported sorting methods
+        enum
+        {
+            SORT_BITONIC,   // only support power-of-2 buffer size
+            SORT_SELECTION, // cannot sort duplicate keys
+            SORT_MERGE,
```

Review comment:
In OpenCV sortByKey is the preferable style of naming functions, not sort_by_key.
**File:** modules/ocl/include/opencv2/ocl/ocl.hpp
**Change Type:** modified
**Context:** PR #1189: Add sort_by_key for oclMat. - As there was no real cross-platform OpenCL sorting framework (AMD's BOLT library current only supports AMD Ope...

**Code Changes:**
```diff
@@ -1673,6 +1673,31 @@ namespace cv
             oclMat diff_buf;
             oclMat norm_buf;
         };
+        // current supported sorting methods
+        enum
+        {
+            SORT_BITONIC,   // only support power-of-2 buffer size
+            SORT_SELECTION, // cannot sort duplicate keys
+            SORT_MERGE,
```

Review comment:
vecSize is probably irrelevant. Why not use shape of keys and/or values to compute vecSize?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #27254: modules/videoio: add libcamera backend for OpenCV VideoCapture - ### Feature: Add Libcamera backend **Summary:** This pull request introduc...
**Review Line:** 273

**Code Changes:**
```diff
 OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON
   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT XROS AND NOT WINRT
   VERIFY HAVE_GSTREAMER AND GSTREAMER_VERSION VERSION_GREATER "0.99")
+OCV_OPTION(WITH_LIBCAMERA "Include Libcamera support" ON
+  VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
+  VERIFY HAVE_LIBCAMERA OR HAVE_VIDEOIO)
 OCV_OPTION(WITH_GTK "Include GTK support" ON
   VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
   VERIFY HAVE_GTK)
@@ -1720,6 +1723,13 @@ if(ANDROID)
   status("   NDK Camera:"       HAVE_ANDROID_NATIVE_CAMERA THEN "YES"                         ELSE NO)
```

Review comment:
> `OR HAVE_VIDEOIO` Wrong