From 193cf558e87d77323361432623a12e121eb64db9 Mon Sep 17 00:00:00 2001 From: Michael Platings Date: Mon, 20 Jan 2025 14:56:35 +0000 Subject: [PATCH] Update to OpenCV 4.11 Remove WITH_PNG=OFF setting in ci-opencv.sh to avoid a warning-as-error for an unused function in opencv/modules/core/test/test_arithm.cpp Change test patterns in ci-opencv.sh to be more specific to avoid matching some new long-running tests in OpenCV. --- .devcontainer/Dockerfile | 2 +- .gitlab-ci.yml | 2 +- .vscode/tasks.json | 4 +- SECURITY.md | 2 +- .../opencv/extra_benchmarks/opencv-4.11.patch | 792 ++++++++++++++++++ adapters/opencv/opencv-4.11.patch | 230 +++++ conformity/opencv/CMakeLists.txt | 2 +- doc/build.md | 10 +- docker/Dockerfile | 2 +- scripts/benchmark/README.md | 6 +- scripts/ci-opencv.sh | 26 +- 11 files changed, 1049 insertions(+), 29 deletions(-) create mode 100644 adapters/opencv/extra_benchmarks/opencv-4.11.patch create mode 100644 adapters/opencv/opencv-4.11.patch diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 84e67fc9e..43b64e59a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # If changing this image ID, please also change it in .gitlab-ci.yml -FROM registry.gitlab.arm.com/kleidi/kleidicv:14 +FROM registry.gitlab.arm.com/kleidi/kleidicv:15 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4259d256d..e21b491c1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # If changing this image ID, please also change it in .devcontainer/Dockerfile -image: registry.gitlab.arm.com/kleidi/kleidicv:14 +image: registry.gitlab.arm.com/kleidi/kleidicv:15 variables: KUBERNETES_CPU_REQUEST: "16" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0b50bc5dd..69421be06 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -209,8 +209,8 @@ "options": { "env": { "CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/.devcontainer/clang_toolchain.cmake", - "OPENCV_VERSION": "4.10.0", - "OPENCV_URL": "/opt/opencv-4.10.0.tar.gz" + "OPENCV_VERSION": "4.11.0", + "OPENCV_URL": "/opt/opencv-4.11.0.tar.gz" } }, "group": { diff --git a/SECURITY.md b/SECURITY.md index e27647d87..1c04b0903 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -14,4 +14,4 @@ Scripts within this project may download and patch third party sources. These third party sources are: * Google Test 1.12.1. * Google Benchmark 1.8.3. -* OpenCV 4.10.0 (and its dependencies) +* OpenCV 4.11.0 (and its dependencies) diff --git a/adapters/opencv/extra_benchmarks/opencv-4.11.patch b/adapters/opencv/extra_benchmarks/opencv-4.11.patch new file mode 100644 index 000000000..f2380dd60 --- /dev/null +++ b/adapters/opencv/extra_benchmarks/opencv-4.11.patch @@ -0,0 +1,792 @@ +// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates +// SPDX-FileCopyrightText: Copyright (C) 2000-2022, Intel Corporation, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2015-2023, OpenCV Foundation, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2008-2016, Itseez Inc., all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2019-2023, Xperience AI, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2019-2022, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2022-2023, Southern University of Science And Technology, all rights reserved. +// SPDX-FileCopyrightText: Third party copyrights are property of their respective owners. +// +// SPDX-License-Identifier: Apache-2.0 + +diff --git a/modules/core/perf/perf_arithm.cpp b/modules/core/perf/perf_arithm.cpp +index d98eb9abb3..29dbf23adf 100644 +--- a/modules/core/perf/perf_arithm.cpp ++++ b/modules/core/perf/perf_arithm.cpp +@@ -447,7 +447,7 @@ PERF_TEST_P_(BinaryOpTest, transposeND) + + INSTANTIATE_TEST_CASE_P(/*nothing*/ , BinaryOpTest, + testing::Combine( +- testing::Values(szVGA, sz720p, sz1080p), ++ testing::Values(szVGA, sz720p, sz1080p, sz2160p), + testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_8SC1, CV_16SC1, CV_16SC2, CV_16SC3, CV_16SC4, CV_32SC1, CV_32FC1) + ) + ); +@@ -726,7 +726,7 @@ PERF_TEST_P_(RotateTest, rotate) + + INSTANTIATE_TEST_CASE_P(/*nothing*/ , RotateTest, + testing::Combine( +- testing::Values(szVGA, sz720p, sz1080p), ++ testing::Values(szVGA, sz720p, sz1080p, sz2160p), + testing::Values(ROTATE_180, ROTATE_90_CLOCKWISE, ROTATE_90_COUNTERCLOCKWISE), + testing::Values(CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4, CV_8SC1, CV_16SC1, CV_16SC2, CV_16SC3, CV_16SC4, CV_32SC1, CV_32FC1) + ) +diff --git a/modules/core/perf/perf_compare.cpp b/modules/core/perf/perf_compare.cpp +index be706e1a83..862b8b7c35 100644 +--- a/modules/core/perf/perf_compare.cpp ++++ b/modules/core/perf/perf_compare.cpp +@@ -11,7 +11,7 @@ typedef perf::TestBaseWithParam Size_MatType_CmpType; + + PERF_TEST_P( Size_MatType_CmpType, compare, + testing::Combine( +- testing::Values(::perf::szVGA, ::perf::sz1080p), ++ testing::Values(::perf::szVGA, ::perf::sz1080p, ::perf::sz2160p), + testing::Values(CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1), + CmpType::all() + ) +diff --git a/modules/core/perf/perf_convertTo.cpp b/modules/core/perf/perf_convertTo.cpp +index 344d81cb8a..ef5a3aa7d2 100644 +--- a/modules/core/perf/perf_convertTo.cpp ++++ b/modules/core/perf/perf_convertTo.cpp +@@ -4,17 +4,18 @@ namespace opencv_test + { + using namespace perf; + +-typedef tuple Size_DepthSrc_DepthDst_Channels_alpha_t; +-typedef perf::TestBaseWithParam Size_DepthSrc_DepthDst_Channels_alpha; ++typedef tuple Size_DepthSrc_DepthDst_Channels_alpha_beta_t; ++typedef perf::TestBaseWithParam Size_DepthSrc_DepthDst_Channels_alpha_beta; + +-PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo, ++PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha_beta, convertTo, + testing::Combine + ( +- testing::Values(szVGA, sz1080p), ++ testing::Values(sz1080p, sz2160p), + testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), + testing::Values(CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F), + testing::Values(1, 4), +- testing::Values(1.0, 1./255) ++ testing::Values(1.0, 1./255, 1.234), ++ testing::Values(0, 4.567) + ) + ) + { +@@ -23,6 +24,7 @@ PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo, + int depthDst = get<2>(GetParam()); + int channels = get<3>(GetParam()); + double alpha = get<4>(GetParam()); ++ double beta = get<5>(GetParam()); + + int maxValue = 255; + +@@ -31,7 +33,7 @@ PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo, + Mat dst(sz, CV_MAKETYPE(depthDst, channels)); + + int runs = (sz.width <= 640) ? 8 : 1; +- TEST_CYCLE_MULTIRUN(runs) src.convertTo(dst, depthDst, alpha); ++ TEST_CYCLE_MULTIRUN(runs) src.convertTo(dst, depthDst, alpha, beta); + + double eps = depthSrc <= CV_32S && (depthDst <= CV_32S || depthDst == CV_64F) ? 1e-12 : (FLT_EPSILON * maxValue); + eps = eps * std::max(1.0, fabs(alpha)); +diff --git a/modules/core/perf/perf_exp.cpp b/modules/core/perf/perf_exp.cpp +new file mode 100644 +index 0000000000..6b20e19a0c +--- /dev/null ++++ b/modules/core/perf/perf_exp.cpp +@@ -0,0 +1,59 @@ ++#include "perf_precomp.hpp" ++ ++namespace opencv_test ++{ ++using namespace perf; ++ ++typedef perf::TestBaseWithParam Exp; ++ ++PERF_TEST_P( Exp, ExpAnyInput, ++ testing::Combine ++ ( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_32FC4) ++ ) ++ ) ++{ ++ cv::RNG rng(0); ++ ++ Size sz = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ ++ Mat src(sz, type); ++ Mat dst(sz, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() cv::exp(src, dst); ++ ++ SANITY_CHECK(dst); ++} ++ ++PERF_TEST_P( Exp, ExpSmallInput, ++ testing::Combine ++ ( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_32F) ++ ) ++ ) ++{ ++ cv::RNG rng(0); ++ ++ Size sz = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ ++ Mat src(sz, type); ++ Mat dst(sz, type); ++ ++ // Keping input values in a range where output's 1st derivative is ++ // manageable (0.001 < exp'(x) < 1000) ++ rng.fill(src, cv::RNG::UNIFORM, -7.0, 7.0); ++ ++ declare.out(dst); ++ ++ TEST_CYCLE() cv::exp(src, dst); ++ ++ SANITY_CHECK(dst); ++} ++ ++} // namespace +diff --git a/modules/core/perf/perf_inRangeScalar.cpp b/modules/core/perf/perf_inRangeScalar.cpp +new file mode 100644 +index 0000000000..9ecca30b6c +--- /dev/null ++++ b/modules/core/perf/perf_inRangeScalar.cpp +@@ -0,0 +1,34 @@ ++#include "perf_precomp.hpp" ++ ++namespace opencv_test ++{ ++using namespace perf; ++ ++typedef tuple Size_TypeSrc_lb_ub_t; ++typedef perf::TestBaseWithParam Size_TypeSrc_lb_ub; ++ ++PERF_TEST_P( Size_TypeSrc_lb_ub, inRangeScalar, ++ testing::Combine ++ ( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_32FC1), ++ testing::Values(1), ++ testing::Values(2) ++ ) ++ ) ++{ ++ Size size = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ Mat lb (1, 1, type, get<2>(GetParam())); ++ Mat ub (1, 1, type, get<3>(GetParam())); ++ Mat src(size, type); ++ Mat dst(size, CV_8UC1); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() inRange( src, lb, ub, dst ); ++ ++ SANITY_CHECK(dst); ++} ++ ++} // namespace +diff --git a/modules/core/perf/perf_minMaxIdx.cpp b/modules/core/perf/perf_minMaxIdx.cpp +new file mode 100644 +index 0000000000..b5c4ddad05 +--- /dev/null ++++ b/modules/core/perf/perf_minMaxIdx.cpp +@@ -0,0 +1,34 @@ ++#include "perf_precomp.hpp" ++ ++namespace opencv_test ++{ ++using namespace perf; ++ ++PERF_TEST_P(Size_MatType, minMaxVals, testing::Combine( ++ testing::Values(TYPICAL_MAT_SIZES), ++ testing::Values(CV_8UC1, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1) ++ ) ++ ) ++{ ++ Size sz = get<0>(GetParam()); ++ int matType = get<1>(GetParam()); ++ ++ Mat src(sz, matType); ++ double minVal, maxVal; ++ ++ if (matType == CV_8U) ++ randu(src, 1, 254 /*do not include 0 and 255 to avoid early exit on 1 byte data*/); ++ else if (matType == CV_8S) ++ randu(src, -127, 126); ++ else ++ warmup(src, WARMUP_RNG); ++ ++ declare.in(src); ++ ++ TEST_CYCLE() cv::minMaxIdx(src, &minVal, &maxVal, nullptr, nullptr); ++ ++ SANITY_CHECK(minVal, 1e-12); ++ SANITY_CHECK(maxVal, 1e-12); ++} ++ ++} // namespace +diff --git a/modules/core/perf/perf_transpose.cpp b/modules/core/perf/perf_transpose.cpp +new file mode 100644 +index 0000000000..7c6a4afaf2 +--- /dev/null ++++ b/modules/core/perf/perf_transpose.cpp +@@ -0,0 +1,50 @@ ++#include "perf_precomp.hpp" ++ ++namespace opencv_test ++{ ++using namespace perf; ++ ++typedef perf::TestBaseWithParam Transpose; ++ ++PERF_TEST_P( Transpose, Copy, ++ testing::Combine ++ ( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8U, CV_16U, CV_32S, CV_64F) ++ ) ++ ) ++{ ++ Size sz = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ ++ Mat src(sz, type); ++ Mat dst(sz, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() cv::transpose(src, dst); ++ ++ SANITY_CHECK(dst); ++} ++ ++PERF_TEST_P( Transpose, InPlace, ++ testing::Combine ++ ( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8U, CV_16U, CV_32S, CV_64F) ++ ) ++ ) ++{ ++ Size sz = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ ++ Mat src(sz, type); ++ ++ declare.in(src, WARMUP_RNG); ++ ++ TEST_CYCLE() cv::transpose(src, src); ++ ++ SANITY_CHECK(src); ++} ++ ++} // namespace +diff --git a/modules/imgproc/perf/perf_blur.cpp b/modules/imgproc/perf/perf_blur.cpp +index a0904156a0..8095b59fe1 100644 +--- a/modules/imgproc/perf/perf_blur.cpp ++++ b/modules/imgproc/perf/perf_blur.cpp +@@ -35,6 +35,7 @@ PERF_TEST_P(Size_MatType_kSize, medianBlur, + + CV_ENUM(BorderType3x3, BORDER_REPLICATE, BORDER_CONSTANT) + CV_ENUM(BorderType, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_REFLECT101) ++CV_ENUM(BorderTypeKleidiCV, BORDER_REPLICATE, BORDER_REFLECT, BORDER_REFLECT101, BORDER_WRAP) + + typedef tuple Size_MatType_BorderType3x3_t; + typedef perf::TestBaseWithParam Size_MatType_BorderType3x3; +@@ -48,10 +49,12 @@ typedef perf::TestBaseWithParam Size_ksize_BorderType; + typedef tuple Size_MatType_BorderType_ksize_t; + typedef perf::TestBaseWithParam Size_MatType_BorderType_ksize; + ++typedef tuple Size_MatType_BorderTypeKleidiCV_t; ++typedef perf::TestBaseWithParam Size_MatType_BorderTypeKleidiCV; + + PERF_TEST_P(Size_MatType_BorderType3x3, gaussianBlur3x3, + testing::Combine( +- testing::Values(szODD, szQVGA, szVGA, sz720p), ++ testing::Values(szODD, szQVGA, szVGA, sz720p, sz1080p, sz2160p), + testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), + BorderType3x3::all() + ) +@@ -71,6 +74,28 @@ PERF_TEST_P(Size_MatType_BorderType3x3, gaussianBlur3x3, + SANITY_CHECK(dst, 1); + } + ++PERF_TEST_P(Size_MatType_BorderType3x3, gaussianBlur3x3_CustomSigma, ++ testing::Combine( ++ testing::Values(szODD, szQVGA, szVGA, sz720p, sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), ++ BorderType3x3::all() ++ ) ++ ) ++{ ++ Size size = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ BorderType3x3 btype = get<2>(GetParam()); ++ ++ Mat src(size, type); ++ Mat dst(size, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() GaussianBlur(src, dst, Size(3,3), 2.2, 2.2, btype); ++ ++ SANITY_CHECK(dst, 1); ++} ++ + PERF_TEST_P(Size_MatType_BorderType3x3, blur3x3, + testing::Combine( + testing::Values(szODD, szQVGA, szVGA, sz720p), +@@ -198,7 +223,7 @@ PERF_TEST_P(Size_MatType_BorderType_ksize, box_inplace, + + PERF_TEST_P(Size_MatType_BorderType, gaussianBlur5x5, + testing::Combine( +- testing::Values(szODD, szQVGA, szVGA, sz720p), ++ testing::Values(szODD, szQVGA, szVGA, sz720p, sz1080p, sz2160p), + testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), + BorderType::all() + ) +@@ -218,6 +243,116 @@ PERF_TEST_P(Size_MatType_BorderType, gaussianBlur5x5, + SANITY_CHECK(dst, 1); + } + ++PERF_TEST_P(Size_MatType_BorderType, gaussianBlur5x5_CustomSigma, ++ testing::Combine( ++ testing::Values(szODD, szQVGA, szVGA, sz720p, sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), ++ BorderType::all() ++ ) ++ ) ++{ ++ Size size = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ BorderType btype = get<2>(GetParam()); ++ ++ Mat src(size, type); ++ Mat dst(size, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() GaussianBlur(src, dst, Size(5,5), 2.2, 2.2, btype); ++ ++ SANITY_CHECK(dst, 1); ++} ++ ++PERF_TEST_P(Size_MatType_BorderTypeKleidiCV, gaussianBlur7x7, ++ testing::Combine( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_8UC4), ++ BorderTypeKleidiCV::all() ++ ) ++ ) ++{ ++ Size size = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ BorderTypeKleidiCV btype = get<2>(GetParam()); ++ ++ Mat src(size, type); ++ Mat dst(size, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() GaussianBlur(src, dst, Size(7,7), 0, 0, btype); ++ ++ SANITY_CHECK(dst, 1); ++} ++ ++PERF_TEST_P(Size_MatType_BorderTypeKleidiCV, gaussianBlur7x7_CustomSigma, ++ testing::Combine( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_8UC4), ++ BorderTypeKleidiCV::all() ++ ) ++ ) ++{ ++ Size size = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ BorderTypeKleidiCV btype = get<2>(GetParam()); ++ ++ Mat src(size, type); ++ Mat dst(size, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() GaussianBlur(src, dst, Size(7,7), 2.2, 2.2, btype); ++ ++ SANITY_CHECK(dst, 1); ++} ++ ++PERF_TEST_P(Size_MatType_BorderTypeKleidiCV, gaussianBlur15x15, ++ testing::Combine( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_8UC4), ++ BorderTypeKleidiCV::all() ++ ) ++ ) ++{ ++ Size size = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ BorderTypeKleidiCV btype = get<2>(GetParam()); ++ ++ Mat src(size, type); ++ Mat dst(size, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() GaussianBlur(src, dst, Size(15,15), 0, 0, btype); ++ ++ SANITY_CHECK(dst, 1); ++} ++ ++PERF_TEST_P(Size_MatType_BorderTypeKleidiCV, gaussianBlur15x15_CustomSigma, ++ testing::Combine( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_8UC4), ++ BorderTypeKleidiCV::all() ++ ) ++ ) ++{ ++ Size size = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ BorderTypeKleidiCV btype = get<2>(GetParam()); ++ ++ Mat src(size, type); ++ Mat dst(size, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ TEST_CYCLE() GaussianBlur(src, dst, Size(15,15), 2.2, 2.2, btype); ++ ++ SANITY_CHECK(dst, 1); ++} ++ + PERF_TEST_P(Size_MatType_BorderType, blur5x5, + testing::Combine( + testing::Values(szVGA, sz720p), +diff --git a/modules/imgproc/perf/perf_cvt_color.cpp b/modules/imgproc/perf/perf_cvt_color.cpp +index 5915b507ce..4a8c02df40 100644 +--- a/modules/imgproc/perf/perf_cvt_color.cpp ++++ b/modules/imgproc/perf/perf_cvt_color.cpp +@@ -319,7 +319,7 @@ typedef perf::TestBaseWithParam Size_CvtMode; + + PERF_TEST_P(Size_CvtMode, cvtColor8u, + testing::Combine( +- testing::Values(::perf::szODD, ::perf::szVGA, ::perf::sz1080p), ++ testing::Values(::perf::szODD, ::perf::szVGA, ::perf::sz1080p, ::perf::sz2160p), + CvtMode::all() + ) + ) +@@ -435,7 +435,7 @@ typedef perf::TestBaseWithParam Size_CvtMode2; + + PERF_TEST_P(Size_CvtMode2, cvtColorYUV420, + testing::Combine( +- testing::Values(szVGA, sz1080p, Size(130, 60)), ++ testing::Values(szVGA, sz1080p, sz2160p, Size(130, 60)), + CvtMode2::all() + ) + ) +diff --git a/modules/imgproc/perf/perf_morph.cpp b/modules/imgproc/perf/perf_morph.cpp +index dc9e975a21..1b73c5eaee 100644 +--- a/modules/imgproc/perf/perf_morph.cpp ++++ b/modules/imgproc/perf/perf_morph.cpp +@@ -39,4 +39,64 @@ PERF_TEST_P(Size_MatType, dilate, TYPICAL_MATS_MORPH) + SANITY_CHECK(dst); + } + ++typedef tuple MorphParams_t; ++typedef perf::TestBaseWithParam Erode; ++typedef perf::TestBaseWithParam Dilate; ++ ++PERF_TEST_P(Erode, big, ++ testing::Combine( ++ testing::Values(::perf::sz1080p, ::perf::sz2160p), ++ testing::Values(CV_8UC1), ++ testing::Values(3, 5, 17) ++ )) ++{ ++ Size sz = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ int kernelSize = get<2>(GetParam()); ++ ++ Mat src(sz, type); ++ Mat dst(sz, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ const cv::MorphShapes morph_shape = cv::MorphShapes::MORPH_RECT; ++ const cv::Size kernel{kernelSize, kernelSize}; ++ const cv::Point anchor{-1, -1}; ++ ++ cv::Mat element = cv::getStructuringElement(morph_shape, kernel, anchor); ++ ++ TEST_CYCLE() erode(src, dst, element, cv::Point(-1, -1), 1, ++ cv::BorderTypes::BORDER_CONSTANT, cv::Scalar(0xAA)); ++ ++ SANITY_CHECK(dst); ++} ++ ++PERF_TEST_P(Dilate, big, ++ testing::Combine( ++ testing::Values(::perf::sz1080p, ::perf::sz2160p), ++ testing::Values(CV_8UC1), ++ testing::Values(3, 5, 17) ++ )) ++{ ++ Size sz = get<0>(GetParam()); ++ int type = get<1>(GetParam()); ++ int kernelSize = get<2>(GetParam()); ++ ++ Mat src(sz, type); ++ Mat dst(sz, type); ++ ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ const cv::MorphShapes morph_shape = cv::MorphShapes::MORPH_RECT; ++ const cv::Size kernel{kernelSize, kernelSize}; ++ const cv::Point anchor{-1, -1}; ++ ++ cv::Mat element = cv::getStructuringElement(morph_shape, kernel, anchor); ++ ++ TEST_CYCLE() dilate(src, dst, element, cv::Point(-1, -1), 1, ++ cv::BorderTypes::BORDER_CONSTANT, cv::Scalar(0xAA)); ++ ++ SANITY_CHECK(dst); ++} ++ + } // namespace +diff --git a/modules/imgproc/perf/perf_pyramids.cpp b/modules/imgproc/perf/perf_pyramids.cpp +index 5dd5b9cece..42c83b2903 100644 +--- a/modules/imgproc/perf/perf_pyramids.cpp ++++ b/modules/imgproc/perf/perf_pyramids.cpp +@@ -6,7 +6,7 @@ + namespace opencv_test { + + PERF_TEST_P(Size_MatType, pyrDown, testing::Combine( +- testing::Values(sz1080p, sz720p, szVGA, szQVGA, szODD), ++ testing::Values(sz1080p, sz720p, szVGA, szQVGA, szODD, sz2160p), + testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16SC1, CV_16SC3, CV_16SC4, CV_32FC1, CV_32FC3, CV_32FC4) + ) + ) +diff --git a/modules/imgproc/perf/perf_remap.cpp b/modules/imgproc/perf/perf_remap.cpp +index bd2129d233..351c082bed 100644 +--- a/modules/imgproc/perf/perf_remap.cpp ++++ b/modules/imgproc/perf/perf_remap.cpp +@@ -6,25 +6,28 @@ + namespace opencv_test { + + CV_ENUM(InterType, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_LANCZOS4) ++CV_ENUM(BorderType, BORDER_REPLICATE, BORDER_CONSTANT) + +-typedef TestBaseWithParam< tuple > TestRemap; ++typedef TestBaseWithParam< tuple > TestRemap; + + PERF_TEST_P( TestRemap, Remap, + Combine( +- Values( szVGA, sz1080p ), +- Values( CV_16UC1, CV_16SC1, CV_32FC1 ), ++ Values( szVGA, sz1080p, sz2160p ), ++ Values( CV_8UC1, CV_16UC1, CV_16SC1, CV_32FC1 ), + Values( CV_16SC2, CV_32FC1, CV_32FC2 ), +- InterType::all() ++ InterType::all(), ++ BorderType::all() + ) + ) + { + Size sz; +- int src_type, map1_type, inter_type; ++ int src_type, map1_type, inter_type, border_type; + + sz = get<0>(GetParam()); + src_type = get<1>(GetParam()); + map1_type = get<2>(GetParam()); + inter_type = get<3>(GetParam()); ++ border_type = get<4>(GetParam()); + + Mat src(sz, src_type), dst(sz, src_type), map1(sz, map1_type), map2; + if (map1_type == CV_32FC1) +@@ -62,7 +65,7 @@ PERF_TEST_P( TestRemap, Remap, + declare.in(src, WARMUP_RNG).out(dst).time(20); + + int runs = (sz.width <= 640) ? 3 : 1; +- TEST_CYCLE_MULTIRUN(runs) remap(src, dst, map1, map2, inter_type); ++ TEST_CYCLE_MULTIRUN(runs) remap(src, dst, map1, map2, inter_type, border_type); + + SANITY_CHECK(dst); + } +diff --git a/modules/imgproc/perf/perf_resize.cpp b/modules/imgproc/perf/perf_resize.cpp +index 0f470a5f81..4e31ffec82 100644 +--- a/modules/imgproc/perf/perf_resize.cpp ++++ b/modules/imgproc/perf/perf_resize.cpp +@@ -67,7 +67,18 @@ PERF_TEST_P(MatInfo_SizePair, resizeUpLinearNonExact, + testing::Combine + ( + testing::Values( MATTYPE_NE_VALUES ), +- testing::Values( Size_Size_t(szVGA, szqHD), Size_Size_t(szVGA, sz720p) ) ++ testing::Values ++ ( ++ // 2*2 ++ Size_Size_t(szqHD, sz1080p), ++ Size_Size_t(sz1080p, sz2160p), ++ // 4*4 ++ Size_Size_t(cv::Size(480, 270), sz1080p), ++ Size_Size_t(szqHD, sz2160p), ++ // 8*8 ++ Size_Size_t(cv::Size(240, 135), sz1080p), ++ Size_Size_t(cv::Size(480, 270), sz2160p) ++ ) + ) + ) + { +@@ -142,7 +153,9 @@ PERF_TEST_P(MatInfo_SizePair, resizeDownLinearNonExact, + Size_Size_t(szqHD, szVGA), + Size_Size_t(sz720p, Size(120 * sz720p.width / sz720p.height, 120)), + Size_Size_t(sz720p, szVGA), +- Size_Size_t(sz720p, szQVGA) ++ Size_Size_t(sz720p, szQVGA), ++ Size_Size_t(sz1080p, szqHD), ++ Size_Size_t(sz2160p, sz1080p) + ) + ) + ) +@@ -173,7 +186,7 @@ typedef TestBaseWithParam MatInfo_Size_Scale; + PERF_TEST_P(MatInfo_Size_Scale, ResizeAreaFast, + testing::Combine( + testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4), +- testing::Values(szVGA, szqHD, sz720p, sz1080p), ++ testing::Values(szVGA, szqHD, sz720p, sz1080p, sz2160p), + testing::Values(2) + ) + ) +diff --git a/modules/imgproc/perf/perf_sepfilters.cpp b/modules/imgproc/perf/perf_sepfilters.cpp +index 480aab9f20..d33a29d5ed 100644 +--- a/modules/imgproc/perf/perf_sepfilters.cpp ++++ b/modules/imgproc/perf/perf_sepfilters.cpp +@@ -5,7 +5,7 @@ + + namespace opencv_test { + +-#define FILTER_SRC_SIZES szODD, szQVGA, szVGA ++#define FILTER_SRC_SIZES szODD, szQVGA, szVGA, sz1080p, sz2160p + + CV_ENUM(BorderType3x3, BORDER_REPLICATE, BORDER_CONSTANT) + CV_ENUM(BorderType3x3ROI, BORDER_DEFAULT, BORDER_REPLICATE|BORDER_ISOLATED, BORDER_CONSTANT|BORDER_ISOLATED) +@@ -242,4 +242,32 @@ PERF_TEST_P(Size_MatType_dx_dy_Border3x3ROI, scharrViaSobelFilter, + SANITY_CHECK(dst); + } + ++CV_ENUM(BorderMode_KleidiCV, BORDER_REPLICATE, BORDER_REFLECT, BORDER_REFLECT_101) ++typedef TestBaseWithParam> SepFilter2D_KleidiCV; ++ ++PERF_TEST_P(SepFilter2D_KleidiCV, SepFilter2D, ++ testing::Combine( ++ testing::Values(sz1080p, sz2160p), ++ testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16UC4, CV_16SC1, CV_16SC4), ++ testing::Values(5), ++ BorderMode_KleidiCV::all() ++ ) ++ ) ++{ ++ const Size srcSize = get<0>(GetParam()); ++ const int type = get<1>(GetParam()), ksize = get<2>(GetParam()), borderMode = get<3>(GetParam()); ++ ++ Mat src(srcSize, type), dst(srcSize, type); ++ declare.in(src, WARMUP_RNG).out(dst); ++ ++ Mat kernelX(1, ksize, type); ++ randu(kernelX, -3.0, 3.0); ++ Mat kernelY(1, ksize, type); ++ randu(kernelY, -3.0, 3.0); ++ ++ TEST_CYCLE() cv::sepFilter2D(src, dst, -1, kernelX, kernelY, cv::Point(-1, -1), 0.0f, borderMode); ++ ++ SANITY_CHECK_NOTHING(); ++} ++ + } // namespace +diff --git a/modules/imgproc/perf/perf_warp.cpp b/modules/imgproc/perf/perf_warp.cpp +index cb4c32c905..5ecb425729 100644 +--- a/modules/imgproc/perf/perf_warp.cpp ++++ b/modules/imgproc/perf/perf_warp.cpp +@@ -79,7 +79,7 @@ PERF_TEST_P(TestWarpAffine, DISABLED_WarpAffine_ovx, + + PERF_TEST_P( TestWarpPerspective, WarpPerspective, + Combine( +- Values( szVGA, sz720p, sz1080p ), ++ Values( szVGA, sz720p, sz1080p, sz2160p ), + InterType::all(), + BorderMode::all(), + Values(1, 3, 4) +@@ -119,7 +119,7 @@ PERF_TEST_P(TestWarpPerspective, DISABLED_WarpPerspective_ovx, + Values(szVGA, sz720p, sz1080p), + InterType::all(), + BorderMode::all(), +- Values(1) ++ Values(1, 4) + ) + ) + { +@@ -152,7 +152,7 @@ PERF_TEST_P(TestWarpPerspective, DISABLED_WarpPerspective_ovx, + + PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear, + Combine( +- Values( Size(640,480), Size(1920,1080), Size(2592,1944) ), ++ Values( szVGA, sz720p, sz1080p, sz5MP, sz2160p ), + InterType::all(), + BorderMode::all(), + Values( CV_8UC1, CV_8UC4 ) +diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp +index c2926c9c28..1cee467251 100644 +--- a/modules/ts/include/opencv2/ts/ts_perf.hpp ++++ b/modules/ts/include/opencv2/ts/ts_perf.hpp +@@ -78,7 +78,7 @@ const static cv::Size szSmall128 = cv::Size(128, 128); + #define SZ_TYPICAL ::testing::Values(::perf::szVGA, ::perf::szqHD, ::perf::sz720p, ::perf::szODD) + + +-#define TYPICAL_MAT_SIZES ::perf::szVGA, ::perf::sz720p, ::perf::sz1080p, ::perf::szODD ++#define TYPICAL_MAT_SIZES ::perf::szVGA, ::perf::sz720p, ::perf::sz1080p, ::perf::szODD, ::perf::sz2160p + #define TYPICAL_MAT_TYPES CV_8UC1, CV_8UC4, CV_32FC1 + #define TYPICAL_MATS testing::Combine( testing::Values( TYPICAL_MAT_SIZES ), testing::Values( TYPICAL_MAT_TYPES ) ) + #define TYPICAL_MATS_C1 testing::Combine( testing::Values( TYPICAL_MAT_SIZES ), testing::Values( CV_8UC1, CV_32FC1 ) ) +diff --git a/modules/video/perf/perf_optflowpyrlk.cpp b/modules/video/perf/perf_optflowpyrlk.cpp +index aca8a1399b..6bae000b2d 100644 +--- a/modules/video/perf/perf_optflowpyrlk.cpp ++++ b/modules/video/perf/perf_optflowpyrlk.cpp +@@ -266,4 +266,26 @@ PERF_TEST_P(Path_Win_Deriv_Border_Reuse, OpticalFlowPyrLK_pyr, testing::Combine( + SANITY_CHECK_NOTHING(); + } + ++typedef perf::TestBaseWithParam calcScharrDerivParams; ++PERF_TEST_P(calcScharrDerivParams, calcScharrDeriv, testing::Values(sz1080p, sz2160p)) ++{ ++ cv::RNG rng(0); ++ ++ Size sz = GetParam(); ++ ++ Mat src(sz, CV_8UC1); ++ std::vector pyramid; ++ ++ // `winSize` is not take into account when `maxLevel` is set to 0. ++ buildOpticalFlowPyramid(src, pyramid, cv::Size(3, 3), 0, true); ++ ++ declare.in(src).out(pyramid); ++ ++ TEST_CYCLE() { ++ buildOpticalFlowPyramid(src, pyramid, cv::Size(3, 3), 0, true); ++ } ++ ++ SANITY_CHECK_NOTHING(); ++} ++ + }} // namespace diff --git a/adapters/opencv/opencv-4.11.patch b/adapters/opencv/opencv-4.11.patch new file mode 100644 index 000000000..563f3deec --- /dev/null +++ b/adapters/opencv/opencv-4.11.patch @@ -0,0 +1,230 @@ +// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates +// SPDX-FileCopyrightText: Copyright (C) 2000-2022, Intel Corporation, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2015-2023, OpenCV Foundation, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2008-2016, Itseez Inc., all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2019-2023, Xperience AI, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2019-2022, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved. +// SPDX-FileCopyrightText: Copyright (C) 2022-2023, Southern University of Science And Technology, all rights reserved. +// SPDX-FileCopyrightText: Third party copyrights are property of their respective owners. +// +// SPDX-License-Identifier: Apache-2.0 + +diff --git a/modules/core/src/convert.dispatch.cpp b/modules/core/src/convert.dispatch.cpp +index 2b4035285f..729cd1dd43 100644 +--- a/modules/core/src/convert.dispatch.cpp ++++ b/modules/core/src/convert.dispatch.cpp +@@ -281,6 +281,11 @@ void Mat::convertTo(OutputArray dst, int type_, double alpha, double beta) const + dst.create(dims, size, dtype); + Mat dstMat = dst.getMat(); + ++ if( dims <= 2 ) { ++ int width_in_elements = src.cols * cn; ++ CALL_HAL(convertTo, cv_hal_convertTo, src.data, src.step, src.depth(), dstMat.data, dstMat.step, dstMat.depth(), width_in_elements, src.rows, alpha, beta); ++ } ++ + BinaryFunc func = noScale ? getConvertFunc(sdepth, ddepth) : getConvertScaleFunc(sdepth, ddepth); + double scale[] = {alpha, beta}; + CV_Assert( func != 0 ); +diff --git a/modules/core/src/hal_replacement.hpp b/modules/core/src/hal_replacement.hpp +index 474fe17393..5d5289cc16 100644 +--- a/modules/core/src/hal_replacement.hpp ++++ b/modules/core/src/hal_replacement.hpp +@@ -1011,6 +1011,53 @@ inline int hal_ni_transpose2d(const uchar* src_data, size_t src_step, uchar* dst + #define cv_hal_transpose2d hal_ni_transpose2d + //! @endcond + ++/** ++ @brief sum ++ @param src_data,src_step,src_type Source image ++ @param width,height Source image dimensions ++ @param result Pointer to save the sum result to. ++*/ ++inline int hal_ni_sum(const uchar *src_data, size_t src_step, int src_type, size_t width, size_t height, double *result) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } ++ ++//! @cond IGNORED ++#define cv_hal_sum hal_ni_sum ++//! @endcond ++ ++/** ++ @brief convertTo ++ @param src_data,src_step,src_depth Source image ++ @param dst_data,dst_step,dst_depth Destination image ++ @param width,height Source image dimensions ++ @param scale,shift Dst values = src_value * scale + shift ++*/ ++inline int hal_ni_convertTo(const uchar *src_data, size_t src_step, int src_depth, ++ uchar *dst_data, size_t dst_step, int dst_depth, int width, ++ int height, double scale, double shift) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } ++ ++//! @cond IGNORED ++#define cv_hal_convertTo hal_ni_convertTo ++//! @endcond ++ ++/** ++ @brief inRange ++ @param src_data,src_step,src_depth Source image ++ @param dst_data,dst_step,dst_depth Destination image ++ @param width,height Source image dimensions ++ @param cn number of channels ++ @param lower_bound,upper_bound Dst values = (lower_bound <= src_value) && (src_value <= upper_bound) ? 255 : 0 ++*/ ++inline int hal_ni_inRange8u(const uchar *src_data, size_t src_step, ++ uchar *dst_data, size_t dst_step, int dst_depth, int width, ++ int height, int cn, uchar lower_bound, uchar upper_bound) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } ++inline int hal_ni_inRange32f(const uchar *src_data, size_t src_step, ++ uchar *dst_data, size_t dst_step, int dst_depth, int width, ++ int height, int cn, double lower_bound, double upper_bound) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } ++ ++//! @cond IGNORED ++#define cv_hal_inRange8u hal_ni_inRange8u ++#define cv_hal_inRange32f hal_ni_inRange32f ++//! @endcond ++ + //! @} + + +diff --git a/modules/core/src/sum.dispatch.cpp b/modules/core/src/sum.dispatch.cpp +index fade948336..17b40ca0e8 100644 +--- a/modules/core/src/sum.dispatch.cpp ++++ b/modules/core/src/sum.dispatch.cpp +@@ -199,6 +199,10 @@ Scalar sum(InputArray _src) + CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_sum(src, _res), _res); + + int k, cn = src.channels(), depth = src.depth(); ++ ++ double result = 0; ++ CALL_HAL_RET(sum, cv_hal_sum, result, src.data, src.step, src.type(), src.cols, src.rows); ++ + SumFunc func = getSumFunc(depth); + CV_Assert( cn <= 4 && func != 0 ); + +diff --git a/modules/imgproc/src/hal_replacement.hpp b/modules/imgproc/src/hal_replacement.hpp +index fe6019e3a7..b2d8c8b533 100644 +--- a/modules/imgproc/src/hal_replacement.hpp ++++ b/modules/imgproc/src/hal_replacement.hpp +@@ -378,6 +378,60 @@ inline int hal_ni_remap32f(int src_type, const uchar *src_data, size_t src_step, + #define cv_hal_remap32f hal_ni_remap32f + //! @endcond + ++/** ++ @brief hal_remap with a short integer map ++ @param src_type source and destination image type ++ @param src_data source image data ++ @param src_step source image step ++ @param src_width source image width ++ @param src_height source image height ++ @param dst_data destination image data ++ @param dst_step destination image step ++ @param dst_width destination image width ++ @param dst_height destination image height ++ @param mapxy map for interleaved x and y values ++ @param mapxy_step mapxy matrix step ++ @param border_type border processing mode (CV_HAL_BORDER_REFLECT, ...) ++ @param border_value values to use for CV_HAL_BORDER_CONSTANT mode ++ @sa cv::remap ++ */ ++inline int hal_ni_remap16s(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height, ++ uchar *dst_data, size_t dst_step, int dst_width, int dst_height, ++ const short* mapxy, size_t mapxy_step, int border_type, const double border_value[4]) ++{ return CV_HAL_ERROR_NOT_IMPLEMENTED; } ++ ++//! @cond IGNORED ++#define cv_hal_remap16s hal_ni_remap16s ++//! @endcond ++ ++/** ++ @brief hal_remap with short maps plus fractions ++ @param src_type source and destination image type ++ @param src_data source image data ++ @param src_step source image step ++ @param src_width source image width ++ @param src_height source image height ++ @param dst_data destination image data ++ @param dst_step destination image step ++ @param dst_width destination image width ++ @param dst_height destination image height ++ @param mapxy map for interleaved x and y values ++ @param mapxy_step mapxy matrix step ++ @param mapfrac map for fractional part x and y values (5+5 bits) ++ @param mapfrac_step mapfrac matrix step ++ @param border_type border processing mode (CV_HAL_BORDER_REFLECT, ...) ++ @param border_value values to use for CV_HAL_BORDER_CONSTANT mode ++ @sa cv::remap ++ */ ++inline int hal_ni_remap16s16u(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height, ++ uchar *dst_data, size_t dst_step, int dst_width, int dst_height, ++ const short* mapxy, size_t mapxy_step, const unsigned short* mapfrac, size_t mapfrac_step, int border_type, const double border_value[4]) ++{ return CV_HAL_ERROR_NOT_IMPLEMENTED; } ++ ++//! @cond IGNORED ++#define cv_hal_remap16s16u hal_ni_remap16s16u ++//! @endcond ++ + /** + @brief hal_cvtBGRtoBGR + @param src_data source image data +diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp +index dfc718bf87..c1f953f230 100644 +--- a/modules/imgproc/src/imgwarp.cpp ++++ b/modules/imgproc/src/imgwarp.cpp +@@ -1819,6 +1819,14 @@ void cv::remap( InputArray _src, OutputArray _dst, + { + CALL_HAL(remap32f, cv_hal_remap32f, src.type(), src.data, src.step, src.cols, src.rows, dst.data, dst.step, dst.cols, dst.rows, + map1.ptr(), map1.step, map2.ptr(), map2.step, interpolation, borderType, borderValue.val); ++ } else if ((map1.type() == CV_16SC2) && map2.empty() && interpolation == INTER_NEAREST) ++ { ++ CALL_HAL(remap16s, cv_hal_remap16s, src.type(), src.data, src.step, src.cols, src.rows, dst.data, dst.step, dst.cols, dst.rows, ++ map1.ptr(), map1.step, borderType, borderValue.val); ++ } else if ((map1.type() == CV_16SC2) && (map2.type() == CV_16UC1) && interpolation == INTER_LINEAR) ++ { ++ CALL_HAL(remap16s16u, cv_hal_remap16s16u, src.type(), src.data, src.step, src.cols, src.rows, dst.data, dst.step, dst.cols, dst.rows, ++ map1.ptr(), map1.step, map2.ptr(), map2.step, borderType, borderValue.val); + } + + interpolation &= ~WARP_RELATIVE_MAP; +diff --git a/modules/imgproc/src/smooth.dispatch.cpp b/modules/imgproc/src/smooth.dispatch.cpp +index f7dafbd956..13c1341716 100644 +--- a/modules/imgproc/src/smooth.dispatch.cpp ++++ b/modules/imgproc/src/smooth.dispatch.cpp +@@ -655,6 +655,25 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize, + ocl_GaussianBlur_8UC1(_src, _dst, ksize, CV_MAT_DEPTH(type), kx, ky, borderType) + ); + ++ { ++ Mat src = _src.getMat(); ++ Mat dst = _dst.getMat(); ++ ++ Point ofs; ++ Size wsz(src.cols, src.rows); ++ if(!(borderType & BORDER_ISOLATED)) ++ src.locateROI( wsz, ofs ); ++ ++ if (sigma1 == 0.0 && sigma2 == 0.0 && ksize.height == ksize.width) { ++ CALL_HAL(gaussianBlurBinomial, cv_hal_gaussianBlurBinomial, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, sdepth, cn, ++ ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y, ksize.width, borderType&~BORDER_ISOLATED); ++ } ++ ++ CALL_HAL(gaussianBlur, cv_hal_gaussianBlur, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, sdepth, cn, ++ ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y, ksize.width, ksize.height, ++ sigma1, sigma2, borderType&~BORDER_ISOLATED); ++ } ++ + if(sdepth == CV_8U && ((borderType & BORDER_ISOLATED) || !_src.isSubmatrix())) + { + std::vector fkx, fky; +diff --git a/modules/imgproc/test/test_imgwarp_strict.cpp b/modules/imgproc/test/test_imgwarp_strict.cpp +index 673c6f03e6..56d9e0b554 100644 +--- a/modules/imgproc/test/test_imgwarp_strict.cpp ++++ b/modules/imgproc/test/test_imgwarp_strict.cpp +@@ -239,7 +239,7 @@ float CV_ImageWarpBaseTest::get_success_error_level(int _interpolation, int) con + else if (_interpolation == INTER_AREA) + return 2.0f; + else +- return 1.0f; ++ return 4.0f; // Reference algorithm uses integer interpolation with 5 bits fractional part, and this greater tolerance allows better precision algorithms to pass the test + } + + void CV_ImageWarpBaseTest::validate_results() const diff --git a/conformity/opencv/CMakeLists.txt b/conformity/opencv/CMakeLists.txt index 347c6f1bb..69b911f3b 100644 --- a/conformity/opencv/CMakeLists.txt +++ b/conformity/opencv/CMakeLists.txt @@ -9,7 +9,7 @@ project("OpenCV Conformity" CXX) set(CMAKE_CXX_STANDARD 17) # Please update SECURITY.md if adding, removing or changing the version of third party content. -set(OPENCV_VERSION "4.10.0" CACHE STRING "Version of OpenCV") +set(OPENCV_VERSION "4.11.0" CACHE STRING "Version of OpenCV") set(OPENCV_URL "https://github.com/opencv/opencv/archive/refs/tags/${OPENCV_VERSION}.tar.gz" CACHE STRING "URL of OpenCV") # Remove the last part of the version number (e.g., 4.9.0 -> 4.9) diff --git a/doc/build.md b/doc/build.md index 14c01d83b..3dfcbbde2 100644 --- a/doc/build.md +++ b/doc/build.md @@ -29,20 +29,20 @@ For details of which OpenCV function are accelerated by KleidiCV see ### Get and patch OpenCV source -This version of KleidiCV is compatible with [OpenCV](https://opencv.org) version 4.10 and later. +This version of KleidiCV is compatible with [OpenCV](https://opencv.org) version 4.11 and later. Earlier versions of KleidiCV are compatible with earlier versions of OpenCV. OpenCV 5.x support is experimental. Integration consists of the following steps: 1. Download OpenCV sources: ``` -wget https://github.com/opencv/opencv/archive/refs/tags/4.10.0.tar.gz -tar xf 4.10.0.tar.gz -cd opencv-4.10.0 +wget https://github.com/opencv/opencv/archive/refs/tags/4.11.0.tar.gz +tar xf 4.11.0.tar.gz +cd opencv-4.11.0 ``` 2. Patch OpenCV: ``` -patch -p1