nareshmlx/opencv-pr huggingface dataset:
**File:** modules/imgproc/test/test_contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...
**Review Line:** 105

**Code Changes:**
```diff
+        rectangle(img32s, r, Scalar::all(255), FILLED);
+
+        const vector<Point> ext_ref {r.tl(),
+                                     r.tl() + Point(0, r.height - 1),
+                                     r.br() + Point(-1, -1),
+                                     r.tl() + Point(r.width - 1, 0)};
+        const vector<Point> int_ref {ext_ref[0] + Point(0, 1),
+                                     ext_ref[0] + Point(1, 0),
+                                     ext_ref[3] + Point(-1, 0),
+                                     ext_ref[3] + Point(0, 1),
+                                     ext_ref[2] + Point(0, -1),
```

Review comment:
Previous variant is better.
**File:** modules/imgproc/test/test_contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,606 @@
+// 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 "opencv2/imgproc/types_c.h"
+#include "test_precomp.hpp"
+#include "opencv2/ts/ocl_test.hpp"
+#include "opencv2/imgproc/detail/legacy.hpp"
+
```

Review comment:
the same, align `.at()` calls one per line
**File:** modules/imgproc/test/test_contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,606 @@
+// 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 "opencv2/imgproc/types_c.h"
+#include "test_precomp.hpp"
+#include "opencv2/ts/ocl_test.hpp"
+#include "opencv2/imgproc/detail/legacy.hpp"
+
```

Review comment:
`#if 0` is preferable
**File:** modules/imgproc/test/test_contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,606 @@
+// 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 "opencv2/imgproc/types_c.h"
+#include "test_precomp.hpp"
+#include "opencv2/ts/ocl_test.hpp"
+#include "opencv2/imgproc/detail/legacy.hpp"
+
```

Review comment:
`cvtest::debugLevel >= 10` - 1 print/write result data/images - 10 show windows
**File:** modules/imgproc/src/contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,697 @@
+// 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 "opencv2/imgproc.hpp"
+#include "precomp.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+#include "opencv2/core/check.hpp"
+#include "opencv2/core/utils/logger.hpp"
```

Review comment:
We can enclosure a block of code between `// clang-format on` - `// clang-format off` comments to ignore it. But I believe in general it is better to avoid alignment of values or comments in such blocks to simplify future merges. Thus I chose to disable these rules: `AlignConsecutiveAssignments: None` and other `AlignConsecutive*` options (see https://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html for details)
**File:** modules/imgproc/src/contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,697 @@
+// 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 "opencv2/imgproc.hpp"
+#include "precomp.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+#include "opencv2/core/check.hpp"
+#include "opencv2/core/utils/logger.hpp"
```

Review comment:
This would require setting option `SpacesBeforeTrailingComments: 2` **and** changing comments to `//`- I'll apply these changes.
**File:** modules/imgproc/src/contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,697 @@
+// 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 "opencv2/imgproc.hpp"
+#include "precomp.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+#include "opencv2/core/check.hpp"
+#include "opencv2/core/utils/logger.hpp"
```

Review comment:
Slightly improved by `BreakBeforeBinaryOperators: None`
**File:** modules/imgproc/src/contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,697 @@
+// 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 "opencv2/imgproc.hpp"
+#include "precomp.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+#include "opencv2/core/check.hpp"
+#include "opencv2/core/utils/logger.hpp"
```

Review comment:
Also fixed by `BreakBeforeBinaryOperators: None`
**File:** modules/imgproc/src/contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,697 @@
+// 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 "opencv2/imgproc.hpp"
+#include "precomp.hpp"
+#include "opencv2/core/hal/intrin.hpp"
+#include "opencv2/core/check.hpp"
+#include "opencv2/core/utils/logger.hpp"
```

Review comment:
Fixed by `BreakBeforeBinaryOperators: None`
**File:** modules/imgproc/test/test_contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...
**Review Line:** 105

**Code Changes:**
```diff
+        rectangle(img32s, r, Scalar::all(255), FILLED);
+
+        const vector<Point> ext_ref {r.tl(),
+                                     r.tl() + Point(0, r.height - 1),
+                                     r.br() + Point(-1, -1),
+                                     r.tl() + Point(r.width - 1, 0)};
+        const vector<Point> int_ref {ext_ref[0] + Point(0, 1),
+                                     ext_ref[0] + Point(1, 0),
+                                     ext_ref[3] + Point(-1, 0),
+                                     ext_ref[3] + Point(0, 1),
+                                     ext_ref[2] + Point(0, -1),
```

Review comment:
Seems to be improved by setting `PenaltyIndentedWhitespace: 1`
**File:** modules/imgproc/test/test_contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,606 @@
+// 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 "opencv2/imgproc/types_c.h"
+#include "test_precomp.hpp"
+#include "opencv2/ts/ocl_test.hpp"
+#include "opencv2/imgproc/detail/legacy.hpp"
+
```

Review comment:
Will remove this code
**File:** modules/imgproc/test/test_contours_new.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,606 @@
+// 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 "opencv2/imgproc/types_c.h"
+#include "test_precomp.hpp"
+#include "opencv2/ts/ocl_test.hpp"
+#include "opencv2/imgproc/detail/legacy.hpp"
+
```

Review comment:
Can not make clang-format to align continuations properly when breaks are before binary operators, perhaps it is some sort of a bug. So I decided to switch to `BreakBeforeBinaryOperators: None` in the end :slightly_frowning_face: This code will be: ```.cpp if (img.at<uchar>(y, x) != 0 && ((img.at<uchar>(y - 1, x) == 0) || (img.at<uchar>(y + 1, x) == 0) || (img.at<uchar>(y, x + 1) == 0) || (img.at<uchar>(y, x - 1) == 0))) { ```
**File:** modules/imgproc/src/contours_approx.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...

**Code Changes:**
```diff
@@ -0,0 +1,354 @@
+// 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 "opencv2/core/base.hpp"
+#include "opencv2/core/types.hpp"
+#include "opencv2/imgproc.hpp"
+#include "contours_common.hpp"
+#include <vector>
```

Review comment:
This is fixed by setting `BreakBeforeBinaryOperators: None`
**File:** modules/imgproc/src/contours_link.cpp
**Change Type:** added
**Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu...
**Review Line:** 255

**Code Changes:**
```diff
+            rns[prev_point].link = rns[lower_run].next;
+            connect_flag = ICV_SINGLE;
+            lower_run = rns[rns[lower_run].next].next;
+            continue;
+        }
+        rns[rns[lower_run].next] = rns[rns[lower_run].next];
+        rns[lower_run].link = rns[lower_run].next;
+
+        // First point of contour
+        ext_rns.push_back(lower_run);
+        lower_run = rns[rns[lower_run].next].next;
```

Review comment:
Yes, this is a problem, but not serious - there should be no operation, like in the original code: https://github.com/opencv/opencv/blob/f4ebf7c0a6b2ee845a395ae3dac59927eb862894/modules/imgproc/src/contours.cpp#L1636-L1664 I'll fix it soon.
**File:** 3rdparty/libpng/CMakeLists.txt
**Change Type:** modified
**Context:** PR #25580: 3rdparty: update libpng 1.6.43

**Code Changes:**
```diff
@@ -9,63 +9,207 @@ else()
   project(${PNG_LIBRARY} C)
 endif()
 
-if(NOT WIN32)
-  find_library(M_LIBRARY
-    NAMES m
-    PATHS /usr/lib /usr/local/lib
-  )
-  if(NOT M_LIBRARY)
```

Review comment:
Duplicate. There is another instance above.
**File:** 3rdparty/libpng/CMakeLists.txt
**Change Type:** modified
**Context:** PR #25580: 3rdparty: update libpng 1.6.43

**Code Changes:**
```diff
@@ -9,63 +9,207 @@ else()
   project(${PNG_LIBRARY} C)
 endif()
 
-if(NOT WIN32)
-  find_library(M_LIBRARY
-    NAMES m
-    PATHS /usr/lib /usr/local/lib
-  )
-  if(NOT M_LIBRARY)
```

Review comment:
no space after `if` in CMake scripts.
**File:** 3rdparty/libpng/CMakeLists.txt
**Change Type:** modified
**Context:** PR #25580: 3rdparty: update libpng 1.6.43

**Code Changes:**
```diff
@@ -9,63 +9,207 @@ else()
   project(${PNG_LIBRARY} C)
 endif()
 
-if(NOT WIN32)
-  find_library(M_LIBRARY
-    NAMES m
-    PATHS /usr/lib /usr/local/lib
-  )
-  if(NOT M_LIBRARY)
```

Review comment:
> `VISIBLE_IF BUILD_PNG` Not needed.
**File:** modules/objdetect/test/test_charucodetection.cpp
**Change Type:** modified
**Context:** PR #25673: fixed marker generation in charuco board

**Code Changes:**
```diff
@@ -81,6 +81,18 @@ static Mat projectCharucoBoard(aruco::CharucoBoard& board, Mat cameraMatrix, dou
     return img;
 }
 
+static bool borderPixelsHaveSameColor(const Mat& image, uint8_t color) {
+    for (int j = 0; j < image.cols; j++) {
+        if (image.at<uint8_t>(0, j) != color || image.at<uint8_t>(image.rows-1, j) != color)
+            return false;
+    }
+    for (int i = 0; i < image.rows; i++) {
```

Review comment:
I propose to extract checks as a local function or two to make the logic obvious. It's very hard to understand the code without attached image. The attached image is not visible, if you just read code in git or try to fix some bug.
**File:** modules/objdetect/test/test_charucodetection.cpp
**Change Type:** modified
**Context:** PR #25673: fixed marker generation in charuco board

**Code Changes:**
```diff
@@ -81,6 +81,18 @@ static Mat projectCharucoBoard(aruco::CharucoBoard& board, Mat cameraMatrix, dou
     return img;
 }
 
+static bool borderPixelsHaveSameColor(const Mat& image, uint8_t color) {
+    for (int j = 0; j < image.cols; j++) {
+        if (image.at<uint8_t>(0, j) != color || image.at<uint8_t>(image.rows-1, j) != color)
+            return false;
+    }
+    for (int i = 0; i < image.rows; i++) {
```

Review comment:
I made the test simple: ``` //The test checks the inner and outer borders of the Aruco markers. //In the inner border of Aruco marker, all pixels should be black. //In the outer border of Aruco marker, all pixels should be white. Mat markerImg = arucoZone(borderRect); bool markerBorderIsBlack = borderPixelsHaveSameColor(markerImg, 0); ASSERT_EQ(markerBorderIsBlack, true); Mat markerOuterBorder = markerImg; markerOuterBorder.adjustROI(1, 1, 1, 1); bool markerOuterBorderIsWhite = borderPixelsHaveSameColor(markerOuterBorder, 255); ASSERT_EQ(markerOuterBorderIsWhite, true); ```
**File:** modules/objdetect/test/test_charucodetection.cpp
**Change Type:** modified
**Context:** PR #25673: fixed marker generation in charuco board

**Code Changes:**
```diff
@@ -81,6 +81,18 @@ static Mat projectCharucoBoard(aruco::CharucoBoard& board, Mat cameraMatrix, dou
     return img;
 }
 
+static bool borderPixelsHaveSameColor(const Mat& image, uint8_t color) {
+    for (int j = 0; j < image.cols; j++) {
+        if (image.at<uint8_t>(0, j) != color || image.at<uint8_t>(image.rows-1, j) != color)
+            return false;
+    }
+    for (int i = 0; i < image.rows; i++) {
```

Review comment:
borderPixelsHaveSameColor: ``` static bool borderPixelsHaveSameColor(const Mat& image, uint8_t color) { for (int j = 0; j < image.cols; j++) { if (image.at<uint8_t>(0, j) != color || image.at<uint8_t>(image.rows-1, j) != color) return false; } for (int i = 0; i < image.rows; i++) { if (image.at<uint8_t>(i, 0) != color || image.at<uint8_t>(i, image.cols-1) != color) return false; } return true; } ```
**File:** modules/core/src/minmax.cpp
**Change Type:** modified
**Context:** PR #25563: Transform offset to indeces for MatND in minMaxIdx HAL

**Code Changes:**
```diff
@@ -1510,18 +1510,29 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
 
     Mat src = _src.getMat(), mask = _mask.getMat();
 
-    int _minIdx, _maxIdx;
-    int* min_offset = (cn == 1) ? minIdx : &_minIdx;
-    int* max_offset = (cn == 1) ? maxIdx : &_maxIdx;
     if (src.dims <= 2)
     {
-        CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows, src.depth(),
```

Review comment:
```suggestion int res = cv_hal_minMaxIdx(src.data, 0, (int)src.total()*cn, 1, src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data); if (res == CV_HAL_ERROR_OK) { if (minIdx) ofs2idx(src, minIdx[0], minIdx); if (maxIdx) ofs2idx(src, maxIdx[0], maxIdx); return; } else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) { CV_Error_(cv::Error::StsInternal, ("HAL implementation minMaxIdx ==> " CVAUX_STR(cv_hal_minMaxIdx) " returned %d (0x%08x)", res, res)); } ``` The reason I prefer not to use separate `min_offset` and `max_offset` values is to permit optimisation in the HAL code in the case that `minIdx` and `maxIdx` are null.
**File:** modules/core/src/minmax.cpp
**Change Type:** modified
**Context:** PR #25563: Transform offset to indeces for MatND in minMaxIdx HAL
**Review Line:** 1526

**Code Changes:**
```diff
+                                   minVal, maxVal, minIdx, maxIdx, mask.data);
+
+        if (res == CV_HAL_ERROR_OK)
+        {
+            if (minIdx)
+                ofs2idx(src, minIdx[0], minIdx);
+            if (maxIdx)
+                ofs2idx(src, maxIdx[0], maxIdx);
+            return;
+        }
+        else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED)
```

Review comment:
KleidiCV's tests fail with the head of the OpenCV 4.x branch. Specifically this: https://gitlab.arm.com/kleidi/kleidicv/-/blob/main/conformity/opencv/test_min_max.cpp?ref_type=heads#L59 In KleidiCV 0.1.0 we did not enable minmax in the HAL so from our point of view it's fine for us to change how the HAL should work. If the HAL code should return an offset instead of 2-dimensional indices then that makes KleidiCV's code simpler. So I'm happy to either change these indices from 0 to 1, or to require that the HAL returns an offset and we will change KleidiCV to match.
**File:** modules/core/src/minmax.cpp
**Change Type:** modified
**Context:** PR #25563: Transform offset to indeces for MatND in minMaxIdx HAL
**Review Line:** 1526

**Code Changes:**
```diff
+                                   minVal, maxVal, minIdx, maxIdx, mask.data);
+
+        if (res == CV_HAL_ERROR_OK)
+        {
+            if (minIdx)
+                ofs2idx(src, minIdx[0], minIdx);
+            if (maxIdx)
+                ofs2idx(src, maxIdx[0], maxIdx);
+            return;
+        }
+        else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED)
```

Review comment:
OK, let's do like this so that HAL should return offset. I'll prepare PR to OpenCV which documents such behaviour.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #25625: core: deployment compatibility for old mac after Accelerate New LAPACK fix

**Code Changes:**
```diff
@@ -1,3 +1,26 @@
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+  set(_apple_device_min_target_os_version "13.3")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+  set(_apple_device_min_target_os_version "16.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+  set(_apple_device_min_target_os_version "9.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
+  set(_apple_device_min_target_os_version "16.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS")
```

Review comment:
Looks like the check is redundant. In case if `CMAKE_OSX_DEPLOYMENT_TARGET` match requirements, then all headers and libs are already available. Host system version is not important.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #25625: core: deployment compatibility for old mac after Accelerate New LAPACK fix

**Code Changes:**
```diff
@@ -1,3 +1,26 @@
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+  set(_apple_device_min_target_os_version "13.3")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+  set(_apple_device_min_target_os_version "16.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+  set(_apple_device_min_target_os_version "9.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
+  set(_apple_device_min_target_os_version "16.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS")
```

Review comment:
Agreed. It's almost always wrong to inspect anything about the host system, it's bad for cross-compilation generally, on all platforms. You should not call `sw_vers` at all.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #25625: core: deployment compatibility for old mac after Accelerate New LAPACK fix

**Code Changes:**
```diff
@@ -1,3 +1,26 @@
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+  set(_apple_device_min_target_os_version "13.3")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+  set(_apple_device_min_target_os_version "16.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+  set(_apple_device_min_target_os_version "9.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
+  set(_apple_device_min_target_os_version "16.4")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS")
```

Review comment:
Something else has just occurred to me: this won't work on other Darwin variants (iOS, tvOS, visionOS, etc) because they have different version numbers. For this reason, the `NOT IOS` check would be better as `IS MACOS`. Another alternative is not to do any of this guessing and just let the user/programmer define `ACCELERATE_NEW_LAPACK` and `ACCELERATE_LAPACK_ILP64` if he wants them. The most important part is that OpenCV's code contains various `#ifdef ACCELERATE_NEW_LAPACK` conditions to support the newer mode (which I believe you did already).
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #25625: core: deployment compatibility for old mac after Accelerate New LAPACK fix
**Review Line:** 135

**Code Changes:**
```diff
-        add_compile_definitions(ACCELERATE_NEW_LAPACK)
-        add_compile_definitions(ACCELERATE_LAPACK_ILP64)
-      endif()
+    if(LAPACK_IMPL STREQUAL "LAPACK/Apple" AND OPENCV_OSX_USE_ACCELERATE_NEW_LAPACK)
+      message(STATUS "LAPACK(${LAPACK_IMPL}): Accelerate New LAPACK is enabled.")
+      set(LAPACK_TRY_COMPILE_DEF "-DACCELERATE_NEW_LAPACK")
+      add_compile_definitions(ACCELERATE_NEW_LAPACK)
+      add_compile_definitions(ACCELERATE_LAPACK_ILP64)
     endif()
 
     try_compile(__VALID_LAPACK
```

Review comment:
I don't think it's necessary to try-compile this, but I guess it's not harmful.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #25625: core: deployment compatibility for old mac after Accelerate New LAPACK fix
**Review Line:** 135

**Code Changes:**
```diff
-        add_compile_definitions(ACCELERATE_NEW_LAPACK)
-        add_compile_definitions(ACCELERATE_LAPACK_ILP64)
-      endif()
+    if(LAPACK_IMPL STREQUAL "LAPACK/Apple" AND OPENCV_OSX_USE_ACCELERATE_NEW_LAPACK)
+      message(STATUS "LAPACK(${LAPACK_IMPL}): Accelerate New LAPACK is enabled.")
+      set(LAPACK_TRY_COMPILE_DEF "-DACCELERATE_NEW_LAPACK")
+      add_compile_definitions(ACCELERATE_NEW_LAPACK)
+      add_compile_definitions(ACCELERATE_LAPACK_ILP64)
     endif()
 
     try_compile(__VALID_LAPACK
```

Review comment:
Just to keep aligned with what we are doing.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #25625: core: deployment compatibility for old mac after Accelerate New LAPACK fix
**Review Line:** 15

**Code Changes:**
```diff
+  set(_apple_device_min_target_os_version "1.0")
+endif()
+
+if(DEFINED _apple_device_min_target_os_version AND
+   ("${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_GREATER "${_apple_device_min_target_os_version}" OR
+    "${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_EQUAL "${_apple_device_min_target_os_version}"))
+  set(_apple_device_has_required_min_os_version ON)
+else()
+  set(_apple_device_has_required_min_os_version OFF)
+endif()
+
```

Review comment:
Condition can be simplified ```suggestion if(_apple_device_min_target_os_version AND (${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_GREATER_EQUAL ${_apple_device_min_target_os_version})) ```