From f95346d4b5a952de0accee502aa18645f8a6fd3c Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Wed, 15 Jul 2026 09:55:44 +0200 Subject: opencv: imx: update the i.mx fork to 4.13.0 Copy from meta-imx tag rel_imx_6.18.20_2.0.0 with style adjustments from opencv_4.6.0.imx.bb. Signed-off-by: Alexander Stein --- ...01-3rdparty-ippicv-Use-pre-downloaded-ipp.patch | 37 -- ...missing-header-for-LIBAVCODEC_VERSION_INT.patch | 26 -- ...Add-smaller-version-of-download_models.py.patch | 1 + .../opencv/0001-Make-ts-module-external.patch | 2 +- ...plated-BlocksCompensator-feed-method-to-e.patch | 55 +++ ...-work-around-deprecated-ffmpeg-RAW-functi.patch | 3 +- ...ne-argument-version-of-SetTotalBytesLimit.patch | 41 --- .../opencv/0001-sfm-link-with-Glog_LIBS.patch | 44 --- .../opencv/0003-To-fix-errors-as-following.patch | 3 +- ...-Do-not-embed-build-directory-in-binaries.patch | 138 ++++++++ ...cc-Modify-host-ptr-alignment-size-in-UMAT.patch | 29 ++ ...c-Add-configuration-parameter-to-force-en.patch | 32 ++ ...c-Change-configuration-to-enable-hostptr-.patch | 28 ++ ...c-Fix-the-problem-of-syntax-error-at-doub.patch | 43 +++ ...c-Fix-error-implicit-declaration-of-funct.patch | 34 ++ ...-fix-inplace-transpose-race-by-enforcing-.patch | 152 ++++++++ ...f-HoughLines-Fix-test-tolerance-and-compa.patch | 47 +++ ...f-HoughLines-Fix-lower-bound-for-line-cou.patch | 31 ++ ...x-incorrect-results-for-in-place-flip-on-.patch | 352 +++++++++++++++++++ .../recipes-support/opencv/opencv/27691.patch | 44 +++ .../opencv/opencv/OpenCV_DNN_examples.patch | 14 +- .../opencv/fix-build-with-protobuf-v22.patch | 387 +++++---------------- .../recipes-support/opencv/opencv_4.13.0.imx.bb | 325 +++++++++++++++++ .../recipes-support/opencv/opencv_4.6.0.imx.bb | 318 ----------------- 24 files changed, 1415 insertions(+), 771 deletions(-) delete mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-missing-header-for-LIBAVCODEC_VERSION_INT.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Renamed-templated-BlocksCompensator-feed-method-to-e.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0008-Do-not-embed-build-directory-in-binaries.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0101-MGS-6470-ccc-Modify-host-ptr-alignment-size-in-UMAT.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0102-MGS-6470-ccc-Add-configuration-parameter-to-force-en.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0103-MGS-6470-ccc-Change-configuration-to-enable-hostptr-.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0104-MGS-8011-ccc-Fix-the-problem-of-syntax-error-at-doub.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0105-MGS-8318-ccc-Fix-error-implicit-declaration-of-funct.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0106-core-opencl-fix-inplace-transpose-race-by-enforcing-.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0107-imgproc-perf-HoughLines-Fix-test-tolerance-and-compa.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0108-imgproc-perf-HoughLines-Fix-lower-bound-for-line-cou.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0109-core-ocl-fix-incorrect-results-for-in-place-flip-on-.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/27691.patch create mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.13.0.imx.bb delete mode 100644 dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.6.0.imx.bb diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch deleted file mode 100644 index b1b00623d..000000000 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 9b4959b97d2e95d4b49cf6ca2a3fce3cdb484f2d Mon Sep 17 00:00:00 2001 -From: Ricardo Ribalda Delgado -Date: Thu, 31 Mar 2016 00:20:15 +0200 -Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp - -Upstream-Status: Pending -Signed-off-by: Ricardo Ribalda Delgado -Signed-off-by: Ismo Puustinen - ---- - 3rdparty/ippicv/ippicv.cmake | 15 +-------------- - 1 file changed, 1 insertion(+), 14 deletions(-) - -diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake -index 257af6fcc6..f88460450f 100644 ---- a/3rdparty/ippicv/ippicv.cmake -+++ b/3rdparty/ippicv/ippicv.cmake -@@ -34,18 +34,5 @@ function(download_ippicv root_var) - endif() - - set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/ippicv") -- ocv_download(FILENAME ${OPENCV_ICV_NAME} -- HASH ${OPENCV_ICV_HASH} -- URL -- "${OPENCV_IPPICV_URL}" -- "$ENV{OPENCV_IPPICV_URL}" -- "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/" -- DESTINATION_DIR "${THE_ROOT}" -- ID IPPICV -- STATUS res -- UNPACK RELATIVE_URL) -- -- if(res) -- set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE) -- endif() -+ set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE) - endfunction() diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-missing-header-for-LIBAVCODEC_VERSION_INT.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-missing-header-for-LIBAVCODEC_VERSION_INT.patch deleted file mode 100644 index 59da6ab32..000000000 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-missing-header-for-LIBAVCODEC_VERSION_INT.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d6bdd0a91eb0ed57688c0af5ba5088cf0afdc0a0 Mon Sep 17 00:00:00 2001 -From: Jochen Sprickerhof -Date: Mon, 8 Aug 2022 21:10:13 +0200 -Subject: [PATCH] Add missing header for LIBAVCODEC_VERSION_INT - -Upstream-Status: Backport [https://github.com/opencv/opencv/pull/22357] -Signed-off-by: Khem Raj ---- - modules/videoio/src/ffmpeg_codecs.hpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/modules/videoio/src/ffmpeg_codecs.hpp b/modules/videoio/src/ffmpeg_codecs.hpp -index 61788e0345..faad2596ed 100644 ---- a/modules/videoio/src/ffmpeg_codecs.hpp -+++ b/modules/videoio/src/ffmpeg_codecs.hpp -@@ -60,6 +60,7 @@ extern "C" { - #include - #endif - -+#include - #include - - #ifdef __cplusplus --- -2.38.1 - diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch index 46232ec5c..29e0d5f95 100644 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch @@ -4,6 +4,7 @@ Date: Tue, 1 Sep 2020 14:57:07 -0500 Subject: [PATCH] Add smaller version of download_models.py Upstream-Status: Pending + Signed-off-by: Tom Hochstein --- testdata/dnn/download_models_basic.py | 159 ++++++++++++++++++++++++++ diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Make-ts-module-external.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Make-ts-module-external.patch index d56b8ae67..9e72fe2f5 100644 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Make-ts-module-external.patch +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Make-ts-module-external.patch @@ -7,7 +7,7 @@ Make ts module external Reference: https://github.com/qbonnard/opencv/commit/6b229c5834cb9a0930425e762a6c7b03244d7abb -Upstream-Status: Submitted [https://github.com/opencv/opencv/issues/8408] +Upstream-Status: Denied [https://github.com/opencv/opencv/issues/8408] Signed-off-by: Mingli Yu --- diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Renamed-templated-BlocksCompensator-feed-method-to-e.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Renamed-templated-BlocksCompensator-feed-method-to-e.patch new file mode 100644 index 000000000..ec2bb2d10 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Renamed-templated-BlocksCompensator-feed-method-to-e.patch @@ -0,0 +1,55 @@ +From b28d9bef1d96d10e9a47d55a63d9f1443e6e3d2b Mon Sep 17 00:00:00 2001 +From: Alexander Smorkalov +Date: Mon, 8 Sep 2025 14:52:58 +0300 +Subject: [PATCH] Renamed templated BlocksCompensator::feed method to exclude + claches with base class pure virtual method. + +Upstream-Status: Backport [https://github.com/opencv/opencv/commit/b28d9bef1d96d10e9a47d55a63d9f1443e6e3d2b] +Signed-off-by: Peter Kjellerstedt +--- + .../opencv2/stitching/detail/exposure_compensate.hpp | 2 +- + modules/stitching/src/exposure_compensate.cpp | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/modules/stitching/include/opencv2/stitching/detail/exposure_compensate.hpp b/modules/stitching/include/opencv2/stitching/detail/exposure_compensate.hpp +index dea76c957b..2954f32ca3 100644 +--- a/modules/stitching/include/opencv2/stitching/detail/exposure_compensate.hpp ++++ b/modules/stitching/include/opencv2/stitching/detail/exposure_compensate.hpp +@@ -187,7 +187,7 @@ public: + + protected: + template +- void feed(const std::vector &corners, const std::vector &images, ++ void feedWithStrategy(const std::vector &corners, const std::vector &images, + const std::vector > &masks); + + private: +diff --git a/modules/stitching/src/exposure_compensate.cpp b/modules/stitching/src/exposure_compensate.cpp +index 59542d95ba..f7c33fa4ef 100644 +--- a/modules/stitching/src/exposure_compensate.cpp ++++ b/modules/stitching/src/exposure_compensate.cpp +@@ -460,7 +460,7 @@ void ChannelsCompensator::setMatGains(std::vector& umv) + + + template +-void BlocksCompensator::feed(const std::vector &corners, const std::vector &images, ++void BlocksCompensator::feedWithStrategy(const std::vector &corners, const std::vector &images, + const std::vector > &masks) + { + CV_Assert(corners.size() == images.size() && images.size() == masks.size()); +@@ -605,13 +605,13 @@ void BlocksCompensator::setMatGains(std::vector& umv) + void BlocksGainCompensator::feed(const std::vector &corners, const std::vector &images, + const std::vector > &masks) + { +- BlocksCompensator::feed(corners, images, masks); ++ BlocksCompensator::feedWithStrategy(corners, images, masks); + } + + void BlocksChannelsCompensator::feed(const std::vector &corners, const std::vector &images, + const std::vector > &masks) + { +- BlocksCompensator::feed(corners, images, masks); ++ BlocksCompensator::feedWithStrategy(corners, images, masks); + } + + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch index aa7d335ea..a3bbefaab 100644 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch @@ -4,10 +4,11 @@ Date: Wed, 9 May 2018 13:33:59 -0700 Subject: [PATCH] Temporarliy work around deprecated ffmpeg RAW function compile failure until next uprev -Upstream-Status: Inappropriate [platform specific] Signed-off-by: Jason Wessel --- +Upstream-Status: Pending + modules/videoio/src/cap_ffmpeg_impl.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch deleted file mode 100644 index 5d88d1a6a..000000000 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 9cfa84313c5833d7295fcf57be93d5d2aaadfd88 Mon Sep 17 00:00:00 2001 -From: Vincent Rabaud -Date: Sat, 10 Jul 2021 00:21:52 +0200 -Subject: [PATCH] Use the one argument version of SetTotalBytesLimit. - -The two argument versions has been deprecated, cf -https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.coded_stream - -Upstream-Status: Backport [9cfa84313c5833d7295fcf57be93d5d2aaadfd88 - from master after 4.5.3 tag] -Signed-off-by: Martin Jansa ---- - modules/dnn/src/caffe/caffe_io.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp -index 2fc4d84f46..ebecf95eea 100644 ---- a/modules/dnn/src/caffe/caffe_io.cpp -+++ b/modules/dnn/src/caffe/caffe_io.cpp -@@ -92,6 +92,7 @@ - #ifdef HAVE_PROTOBUF - #include - #include -+#include - #include - - #include -@@ -1111,7 +1112,11 @@ static const int kProtoReadBytesLimit = INT_MAX; // Max size of 2 GB minus 1 by - - bool ReadProtoFromBinary(ZeroCopyInputStream* input, Message *proto) { - CodedInputStream coded_input(input); -+#if GOOGLE_PROTOBUF_VERSION >= 3006000 -+ coded_input.SetTotalBytesLimit(kProtoReadBytesLimit); -+#else - coded_input.SetTotalBytesLimit(kProtoReadBytesLimit, 536870912); -+#endif - - return proto->ParseFromCodedStream(&coded_input); - } --- -2.32.0 - diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch deleted file mode 100644 index 7b2c4100a..000000000 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch +++ /dev/null @@ -1,44 +0,0 @@ -From ffe20fc4ec46c6b491eff29a38f90686d4d035f6 Mon Sep 17 00:00:00 2001 -From: Martin Jansa -Date: Mon, 12 Apr 2021 20:37:40 +0000 -Subject: [PATCH] sfm: link with Glog_LIBS - -* in 4.5.0 there was explicit linkage with GLOG_LIBRARY, but since 4.5.1 with: - https://github.com/opencv/opencv_contrib/commit/23ee62a19b7a3e50d6dbf295359d8b1aff2e03fd - - it's gone, probably because Glog_FOUND is already set from Ceres, - but then GLOG_LIBRARIES is empty in LIBMV_LIGHT_LIBS and build with gold fails: - -FAILED: bin/example_tutorial_perspective_correction -: && TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/x86_64-oe-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot-native= -fvisibility-inlines-hidden -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -DNDEBUG -DNDEBUG -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot-native= -fvisibility-inlines-hidden -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--gc-sections -Wl,--as-needed samples/cpp/CMakeFiles/example_tutorial_perspective_correction.dir/tutorial_code/features2D/Homography/perspective_correction.cpp.o -o bin/example_tutorial_perspective_correction -ldl -lm -lpthread -lrt lib/libopencv_gapi.so.4.5.2 lib/libopencv_stitching.so.4.5.2 lib/libopencv_ts.so.4.5.2 lib/libopencv_alphamat.so.4.5.2 lib/libopencv_aruco.so.4.5.2 lib/libopencv_bgsegm.so.4.5.2 lib/libopencv_bioinspired.so.4.5.2 lib/libopencv_ccalib.so.4.5.2 lib/libopencv_dnn_objdetect.so.4.5.2 lib/libopencv_dnn_superres.so.4.5.2 lib/libopencv_dpm.so.4.5.2 lib/libopencv_face.so.4.5.2 lib/libopencv_fuzzy.so.4.5.2 lib/libopencv_hfs.so.4.5.2 lib/libopencv_img_hash.so.4.5.2 lib/libopencv_intensity_transform.so.4.5.2 lib/libopencv_line_descriptor.so.4.5.2 lib/libopencv_mcc.so.4.5.2 lib/libopencv_quality.so.4.5.2 lib/libopencv_rapid.so.4.5.2 lib/libopencv_reg.so.4.5.2 lib/libopencv_rgbd.so.4.5.2 lib/libopencv_saliency.so.4.5.2 lib/libopencv_sfm.so.4.5.2 lib/libopencv_stereo.so.4.5.2 lib/libopencv_structured_light.so.4.5.2 lib/libopencv_superres.so.4.5.2 lib/libopencv_surface_matching.so.4.5.2 lib/libopencv_tracking.so.4.5.2 lib/libopencv_videostab.so.4.5.2 lib/libopencv_wechat_qrcode.so.4.5.2 lib/libopencv_xfeatures2d.so.4.5.2 lib/libopencv_xobjdetect.so.4.5.2 lib/libopencv_xphoto.so.4.5.2 lib/libopencv_shape.so.4.5.2 lib/libopencv_highgui.so.4.5.2 lib/libopencv_datasets.so.4.5.2 lib/libopencv_ml.so.4.5.2 lib/libopencv_plot.so.4.5.2 lib/libopencv_phase_unwrapping.so.4.5.2 lib/libopencv_optflow.so.4.5.2 lib/libopencv_ximgproc.so.4.5.2 lib/libopencv_videoio.so.4.5.2 lib/libopencv_video.so.4.5.2 lib/libopencv_dnn.so.4.5.2 lib/libopencv_imgcodecs.so.4.5.2 lib/libopencv_objdetect.so.4.5.2 lib/libopencv_calib3d.so.4.5.2 lib/libopencv_features2d.so.4.5.2 lib/libopencv_flann.so.4.5.2 lib/libopencv_photo.so.4.5.2 lib/libopencv_imgproc.so.4.5.2 lib/libopencv_core.so.4.5.2 -Wl,-rpath-link,TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/build/lib && : -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessage::LogMessage(char const*, int)' -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessage::stream()' -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessage::~LogMessage()' -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::kLogSiteUninitialized' -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'fLI::FLAGS_v' -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::InitVLOG3__(int**, int*, char const*, int)' -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessageFatal::LogMessageFatal(char const*, int)' -lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessageFatal::~LogMessageFatal()' -collect2: error: ld returned 1 exit status - - Add Glog_LIBS which is set to the same value as GLOG_LIBRARIES used to be. - -Upstream-Status: Submitted [https://github.com/opencv/opencv_contrib/pull/2923] - -Signed-off-by: Martin Jansa ---- - modules/sfm/CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/modules/sfm/CMakeLists.txt b/modules/sfm/CMakeLists.txt -index 045a1fe6e..ee7cecdac 100644 ---- a/modules/sfm/CMakeLists.txt -+++ b/modules/sfm/CMakeLists.txt -@@ -84,6 +84,7 @@ set(LIBMV_LIGHT_LIBS - multiview - numeric - ${GLOG_LIBRARIES} -+ ${Glog_LIBS} - ${GFLAGS_LIBRARIES} - ) - diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch index d39c05822..9df419d0b 100644 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch @@ -7,7 +7,6 @@ Subject: [PATCH] To fix errors as following: "perf_abs.cpp:13: undefined reference to `cvtest::param_seed'" "test_superres.cpp:270: undefined reference to `checkIppStatus()'" -Upstream-Status: Pending Signed-off-by: Huang Qiyu Also add the visibility changes for certain OpenCL-related functions in @@ -16,6 +15,8 @@ ts module. Signed-off-by: Ismo Puustinen --- +Upstream-Status: Pending + modules/ts/include/opencv2/ts.hpp | 4 ++-- modules/ts/include/opencv2/ts/ocl_test.hpp | 2 +- modules/ts/include/opencv2/ts/ts_ext.hpp | 2 +- diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0008-Do-not-embed-build-directory-in-binaries.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0008-Do-not-embed-build-directory-in-binaries.patch new file mode 100644 index 000000000..8fda85708 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0008-Do-not-embed-build-directory-in-binaries.patch @@ -0,0 +1,138 @@ +From: Victor Westerhuis +Date: Sat, 19 Nov 2022 21:45:39 +0100 +Subject: Do not embed build directory in binaries + +This makes the opencv core module build reproducibly. + +https://salsa.debian.org/science-team/opencv/-/raw/master/debian/patches/0008-Do-not-embed-build-directory-in-binaries.patch +Upstream-Status: Backport +Signed-off-by: Chee Yang Lee +--- + modules/core/CMakeLists.txt | 10 ------ + modules/core/include/opencv2/core/private.hpp | 4 +-- + modules/core/include/opencv2/core/utility.hpp | 4 +-- + modules/core/src/utils/datafile.cpp | 48 +-------------------------- + 4 files changed, 5 insertions(+), 61 deletions(-) + +diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt +index b78bb98..d96b669 100644 +--- a/modules/core/CMakeLists.txt ++++ b/modules/core/CMakeLists.txt +@@ -188,16 +188,6 @@ if(OPENCV_OTHER_INSTALL_PATH) + ") + endif() + +-set(OPENCV_DATA_CONFIG_STR "${OPENCV_DATA_CONFIG_STR} +-#define OPENCV_BUILD_DIR \"${CMAKE_BINARY_DIR}\" +-") +- +-file(RELATIVE_PATH SOURCE_DIR_RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) +-set(OPENCV_DATA_CONFIG_STR "${OPENCV_DATA_CONFIG_STR} +-#define OPENCV_DATA_BUILD_DIR_SEARCH_PATHS \\ +- \"${SOURCE_DIR_RELATIVE}/\" +-") +- + if(WIN32) + file(RELATIVE_PATH INSTALL_DATA_DIR_RELATIVE "${CMAKE_INSTALL_PREFIX}/${OPENCV_BIN_INSTALL_PATH}" "${CMAKE_INSTALL_PREFIX}/${OPENCV_OTHER_INSTALL_PATH}") + else() +diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp +index 146d37f..dd675bc 100644 +--- a/modules/core/include/opencv2/core/private.hpp ++++ b/modules/core/include/opencv2/core/private.hpp +@@ -818,10 +818,10 @@ Search directories: + 2. Check path specified by configuration parameter with "_HINT" suffix (name of environment variable). + 3. Check path specified by configuration parameter (name of environment variable). + If parameter value is not empty and nothing is found then stop searching. +-4. Detects build/install path based on: ++4. Detects install path based on: + a. current working directory (CWD) + b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage) +-5. Scan `/{,data}` directories if build directory is detected or the current directory is in source tree. ++5. Scan `/{,data}` directories if the current directory is in source tree. + 6. Scan `/share/OpenCV` directory if install directory is detected. + + @param relative_path Relative path to data file +diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp +index 108c0d9..f15d9ea 100644 +--- a/modules/core/include/opencv2/core/utility.hpp ++++ b/modules/core/include/opencv2/core/utility.hpp +@@ -1163,10 +1163,10 @@ Search directories: + 2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable + 3. OPENCV_SAMPLES_DATA_PATH environment variable + If parameter value is not empty and nothing is found then stop searching. +-4. Detects build/install path based on: ++4. Detects install path based on: + a. current working directory (CWD) + b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage) +-5. Scan `/{,data,samples/data}` directories if build directory is detected or the current directory is in source tree. ++5. Scan `/{,data,samples/data}` directories if the current directory is in source tree. + 6. Scan `/share/OpenCV` directory if install directory is detected. + + @see cv::utils::findDataFile +diff --git a/modules/core/src/utils/datafile.cpp b/modules/core/src/utils/datafile.cpp +index 3af83a5..6bda857 100644 +--- a/modules/core/src/utils/datafile.cpp ++++ b/modules/core/src/utils/datafile.cpp +@@ -280,32 +280,8 @@ cv::String findDataFile(const cv::String& relative_path, + + + // Steps: 4, 5, 6 +- cv::String cwd = utils::fs::getcwd(); +- cv::String build_dir(OPENCV_BUILD_DIR); +- bool has_tested_build_directory = false; +- if (isSubDirectory(build_dir, cwd) || isSubDirectory(utils::fs::canonical(build_dir), utils::fs::canonical(cwd))) +- { +- CV_LOG_DEBUG(NULL, "utils::findDataFile(): the current directory is build sub-directory: " << cwd); +- const char* build_subdirs[] = { OPENCV_DATA_BUILD_DIR_SEARCH_PATHS }; +- for (size_t k = 0; k < sizeof(build_subdirs)/sizeof(build_subdirs[0]); k++) +- { +- CV_LOG_DEBUG(NULL, "utils::findDataFile(): /" << build_subdirs[k]); +- cv::String datapath = utils::fs::join(build_dir, build_subdirs[k]); +- if (utils::fs::isDirectory(datapath)) +- { +- for(size_t i = search_subdir.size(); i > 0; i--) +- { +- const cv::String& subdir = search_subdir[i - 1]; +- cv::String prefix = utils::fs::join(datapath, subdir); +- TRY_FILE_WITH_PREFIX(prefix); +- } +- } +- } +- has_tested_build_directory = true; +- } +- + cv::String source_dir; +- cv::String try_source_dir = cwd; ++ cv::String try_source_dir = utils::fs::getcwd(); + for (int levels = 0; levels < 3; ++levels) + { + if (utils::fs::exists(utils::fs::join(try_source_dir, "modules/core/include/opencv2/core/version.hpp"))) +@@ -341,28 +317,6 @@ cv::String findDataFile(const cv::String& relative_path, + CV_LOG_INFO(NULL, "Can't detect module binaries location"); + } + +- if (!has_tested_build_directory && +- (isSubDirectory(build_dir, module_path) || isSubDirectory(utils::fs::canonical(build_dir), utils::fs::canonical(module_path))) +- ) +- { +- CV_LOG_DEBUG(NULL, "utils::findDataFile(): the binary module directory is build sub-directory: " << module_path); +- const char* build_subdirs[] = { OPENCV_DATA_BUILD_DIR_SEARCH_PATHS }; +- for (size_t k = 0; k < sizeof(build_subdirs)/sizeof(build_subdirs[0]); k++) +- { +- CV_LOG_DEBUG(NULL, "utils::findDataFile(): /" << build_subdirs[k]); +- cv::String datapath = utils::fs::join(build_dir, build_subdirs[k]); +- if (utils::fs::isDirectory(datapath)) +- { +- for(size_t i = search_subdir.size(); i > 0; i--) +- { +- const cv::String& subdir = search_subdir[i - 1]; +- cv::String prefix = utils::fs::join(datapath, subdir); +- TRY_FILE_WITH_PREFIX(prefix); +- } +- } +- } +- } +- + #if defined OPENCV_INSTALL_DATA_DIR_RELATIVE + if (!module_path.empty()) // require module path + { diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0101-MGS-6470-ccc-Modify-host-ptr-alignment-size-in-UMAT.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0101-MGS-6470-ccc-Modify-host-ptr-alignment-size-in-UMAT.patch new file mode 100644 index 000000000..82afd5c72 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0101-MGS-6470-ccc-Modify-host-ptr-alignment-size-in-UMAT.patch @@ -0,0 +1,29 @@ +From 0a1c77e4c810999632d648f63775b7ea265bc25c Mon Sep 17 00:00:00 2001 +From: Eric Guo +Date: Tue, 9 Nov 2021 14:38:00 +0800 +Subject: [PATCH 1/4] MGS-6470 [#ccc] Modify host ptr alignment size in UMAT + +change CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR from 4 to 64 + +Upstream-Status: Inappropriate [i.MX specific] +Signed-off-by: Eric Guo +--- + modules/core/src/ocl.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp +index 8479667fd7..6eb7b5e425 100644 +--- a/modules/core/src/ocl.cpp ++++ b/modules/core/src/ocl.cpp +@@ -245,7 +245,7 @@ static String getBuildExtraOptions() + } + + static const bool CV_OPENCL_ENABLE_MEM_USE_HOST_PTR = utils::getConfigurationParameterBool("OPENCV_OPENCL_ENABLE_MEM_USE_HOST_PTR", true); +-static const size_t CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR", 4); ++static const size_t CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR", 64); + + + struct UMat2D +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0102-MGS-6470-ccc-Add-configuration-parameter-to-force-en.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0102-MGS-6470-ccc-Add-configuration-parameter-to-force-en.patch new file mode 100644 index 000000000..50240093c --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0102-MGS-6470-ccc-Add-configuration-parameter-to-force-en.patch @@ -0,0 +1,32 @@ +From 965365fff0815b8afc9833102d8e4e6c4ee1dda3 Mon Sep 17 00:00:00 2001 +From: Eric Guo +Date: Wed, 17 Nov 2021 15:04:23 +0800 +Subject: [PATCH 2/4] MGS-6470 [#ccc] Add configuration parameter to force + enable hostptr in OpenCL + +USAGE: `set OPENCV_OPENCL_ALIGNMENT_MEM_ALLOC_HOST_PTR=true` + +Upstream-Status: Inappropriate [i.MX specific] +Signed-off-by: Eric Guo +--- + modules/core/src/ocl.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp +index 6eb7b5e425..5c50b06865 100644 +--- a/modules/core/src/ocl.cpp ++++ b/modules/core/src/ocl.cpp +@@ -5416,7 +5416,9 @@ public: + { + const Device& dev = ctx.device(0); + createFlags = 0; +- if ((usageFlags & USAGE_ALLOCATE_HOST_MEMORY) != 0) ++ bool allocHostPtr = utils::getConfigurationParameterBool("OPENCV_OPENCL_ALIGNMENT_MEM_ALLOC_HOST_PTR", false); ++ ++ if ((usageFlags & USAGE_ALLOCATE_HOST_MEMORY) != 0 || allocHostPtr) + createFlags |= CL_MEM_ALLOC_HOST_PTR; + + if (!isOpenCLCopyingForced() && +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0103-MGS-6470-ccc-Change-configuration-to-enable-hostptr-.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0103-MGS-6470-ccc-Change-configuration-to-enable-hostptr-.patch new file mode 100644 index 000000000..3b429b383 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0103-MGS-6470-ccc-Change-configuration-to-enable-hostptr-.patch @@ -0,0 +1,28 @@ +From 352b992c7daeeede261cf52e06b5beac485df897 Mon Sep 17 00:00:00 2001 +From: Eric Guo +Date: Thu, 9 Dec 2021 15:25:42 +0800 +Subject: [PATCH 3/4] MGS-6470 [#ccc] Change configuration to enable hostptr in + OpenCL by default. + +Upstream-Status: Inappropriate [i.MX specific] +Signed-off-by: Eric Guo +--- + modules/core/src/ocl.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp +index 5c50b06865..db75190f13 100644 +--- a/modules/core/src/ocl.cpp ++++ b/modules/core/src/ocl.cpp +@@ -5416,7 +5416,7 @@ public: + { + const Device& dev = ctx.device(0); + createFlags = 0; +- bool allocHostPtr = utils::getConfigurationParameterBool("OPENCV_OPENCL_ALIGNMENT_MEM_ALLOC_HOST_PTR", false); ++ bool allocHostPtr = utils::getConfigurationParameterBool("OPENCV_OPENCL_ALIGNMENT_MEM_ALLOC_HOST_PTR", true); + + if ((usageFlags & USAGE_ALLOCATE_HOST_MEMORY) != 0 || allocHostPtr) + createFlags |= CL_MEM_ALLOC_HOST_PTR; +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0104-MGS-8011-ccc-Fix-the-problem-of-syntax-error-at-doub.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0104-MGS-8011-ccc-Fix-the-problem-of-syntax-error-at-doub.patch new file mode 100644 index 000000000..ebca4ce35 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0104-MGS-8011-ccc-Fix-the-problem-of-syntax-error-at-doub.patch @@ -0,0 +1,43 @@ +From 2766330540d5106e1cc5c44ab14f021e306859cb Mon Sep 17 00:00:00 2001 +From: jiajia Qian +Date: Tue, 7 Jan 2025 16:42:34 +0800 +Subject: [PATCH 4/4] MGS-8011 [#ccc] Fix the problem of syntax error at + 'double4' in opencv_test_imgproc. + +Since our driver does not support cl_khr_fp64 format data, + +disabled the related ocl function in opencv_test_imgproc to avoid the following error log: + +error: syntax error at 'double4' + +Upstream-Status: Inappropriate [i.MX specific] +Signed-off-by: jiajia Qian +--- + modules/imgproc/src/imgwarp.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp +index dfc718bf87..0e8b9ce142 100644 +--- a/modules/imgproc/src/imgwarp.cpp ++++ b/modules/imgproc/src/imgwarp.cpp +@@ -1349,6 +1349,7 @@ static bool ocl_remap(InputArray _src, OutputArray _dst, InputArray _map1, Input + interpolation &= ~WARP_RELATIVE_MAP; + + const ocl::Device & dev = ocl::Device::getDefault(); ++ bool doubleSupport = dev.doubleFPConfig() > 0; + int cn = _src.channels(), type = _src.type(), depth = _src.depth(), + rowsPerWI = dev.isIntel() ? 4 : 1; + +@@ -1356,6 +1357,9 @@ static bool ocl_remap(InputArray _src, OutputArray _dst, InputArray _map1, Input + || _map1.type() == CV_16SC1 || _map2.type() == CV_16SC1) + return false; + ++ if (!doubleSupport && depth == CV_64F ) ++ return false; ++ + UMat src = _src.getUMat(), map1 = _map1.getUMat(), map2 = _map2.getUMat(); + + if( (map1.type() == CV_16SC2 && (map2.type() == CV_16UC1 || map2.empty())) || +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0105-MGS-8318-ccc-Fix-error-implicit-declaration-of-funct.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0105-MGS-8318-ccc-Fix-error-implicit-declaration-of-funct.patch new file mode 100644 index 000000000..d742b9123 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0105-MGS-8318-ccc-Fix-error-implicit-declaration-of-funct.patch @@ -0,0 +1,34 @@ +From e5d7ecd9acd3805e90f5d491044813c034d3b014 Mon Sep 17 00:00:00 2001 +From: jiajia Qian +Date: Fri, 8 Aug 2025 14:19:57 +0800 +Subject: [PATCH] MGS-8318 [#ccc] Fix error:implicit declaration of function + 'sub_group_reduce_add' is invalid in OpenCL. + +The OpenCL extension cl_khr_subgroups is not supported in OpenCL 1.2. + +This feature requires at least OpenCL 2.0 or higher. By default, the C++ C language standard used + +is C++ C 1.2. Therefore, specify OpenCL version to 3.0 in the build-options. + +Upstream-Status: Inappropriate [i.MX specific] +Signed-off-by: jiajia Qian +--- + modules/video/src/dis_flow.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/video/src/dis_flow.cpp b/modules/video/src/dis_flow.cpp +index 75090d093d..9954645ca7 100644 +--- a/modules/video/src/dis_flow.cpp ++++ b/modules/video/src/dis_flow.cpp +@@ -1101,7 +1101,7 @@ bool DISOpticalFlowImpl::ocl_PatchInverseSearch(UMat &src_U, + subgroups_build_options = " -DCV_USE_SUBGROUPS=1"; + + String build_options = cv::format( +- "-DDIS_BORDER_SIZE=%d -DDIS_PATCH_SIZE=%d -DDIS_PATCH_STRIDE=%d", ++ "-cl-std=CL3.0 -DDIS_BORDER_SIZE=%d -DDIS_PATCH_SIZE=%d -DDIS_PATCH_STRIDE=%d", + border_size, patch_size, patch_stride + ) + subgroups_build_options; + +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0106-core-opencl-fix-inplace-transpose-race-by-enforcing-.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0106-core-opencl-fix-inplace-transpose-race-by-enforcing-.patch new file mode 100644 index 000000000..c061342ef --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0106-core-opencl-fix-inplace-transpose-race-by-enforcing-.patch @@ -0,0 +1,152 @@ +From 504144ee0a126e7a11a5b1751b7dc0a80ed1cd0f Mon Sep 17 00:00:00 2001 +From: jiajia Qian +Date: Tue, 17 Mar 2026 14:19:35 +0800 +Subject: [PATCH] core(opencl): fix inplace transpose race by enforcing LLSS + ordering via local barrier +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The former inplace transpose implementation allowed a reordering of +global-memory operations across work-items. Specifically, the intended +LLSS (Load–Load–Store–Store) access pattern could be reordered by the +GPU into LSLS (Load–Store–Load–Store), causing partially written tiles +to be observed by other work-items and producing incorrect output. + +This patch introduces a tiled LDS-based algorithm and adds an explicit: + + barrier(CLK_LOCAL_MEM_FENCE); + +between the load and store phases. + +Upstream-Status: Backport +[commit a3e129aad85abcd2b61f071796ff80f9ca215619] + +Signed-off-by: jiajia Qian +--- + modules/core/src/matrix_transform.cpp | 10 +++- + modules/core/src/opencl/transpose.cl | 69 ++++++++++++++++++++++++++- + 2 files changed, 75 insertions(+), 4 deletions(-) + +diff --git a/modules/core/src/matrix_transform.cpp b/modules/core/src/matrix_transform.cpp +index c52fcc1e4f..84aa5ca778 100644 +--- a/modules/core/src/matrix_transform.cpp ++++ b/modules/core/src/matrix_transform.cpp +@@ -146,10 +146,16 @@ static bool ocl_transpose( InputArray _src, OutputArray _dst ) + return false; + } + ++ String deviceMacro; ++ if (dev.isIntel()) ++ deviceMacro = " -D INTEL_GPU"; ++ else ++ deviceMacro = ""; ++ + ocl::Kernel k(kernelName.c_str(), ocl::core::transpose_oclsrc, +- format("-D T=%s -D T1=%s -D cn=%d -D TILE_DIM=%d -D BLOCK_ROWS=%d -D rowsPerWI=%d%s", ++ format("-D T=%s -D T1=%s -D cn=%d -D TILE_DIM=%d -D BLOCK_ROWS=%d -D rowsPerWI=%d%s%s", + ocl::memopTypeToStr(type), ocl::memopTypeToStr(depth), +- cn, TILE_DIM, BLOCK_ROWS, rowsPerWI, inplace ? " -D INPLACE" : "")); ++ cn, TILE_DIM, BLOCK_ROWS, rowsPerWI, inplace ? " -D INPLACE" : "", deviceMacro.c_str())); + if (k.empty()) + return false; + +diff --git a/modules/core/src/opencl/transpose.cl b/modules/core/src/opencl/transpose.cl +index 01ea7dd9d5..ae4d7f08d3 100644 +--- a/modules/core/src/opencl/transpose.cl ++++ b/modules/core/src/opencl/transpose.cl +@@ -53,10 +53,10 @@ + #define TSIZE ((int)sizeof(T1)*3) + #endif + +-#ifndef INPLACE +- + #define LDS_STEP (TILE_DIM + 1) + ++#ifndef INPLACE ++ + __kernel void transpose(__global const uchar * srcptr, int src_step, int src_offset, int src_rows, int src_cols, + __global uchar * dstptr, int dst_step, int dst_offset) + { +@@ -120,6 +120,7 @@ __kernel void transpose(__global const uchar * srcptr, int src_step, int src_off + + __kernel void transpose_inplace(__global uchar * srcptr, int src_step, int src_offset, int src_rows) + { ++#ifdef INTEL_GPU + int x = get_global_id(0); + int y = get_global_id(1) * rowsPerWI; + +@@ -141,6 +142,70 @@ __kernel void transpose_inplace(__global uchar * srcptr, int src_step, int src_o + storepix(tmp, src); + } + } ++#else ++ int gp_x = get_group_id(0); ++ int gp_y = get_group_id(1); ++ int lx = get_local_id(0); ++ int ly = get_local_id(1); ++ ++ __local T tile_a[TILE_DIM * LDS_STEP]; ++ __local T tile_b[TILE_DIM * LDS_STEP]; ++ ++ if (gp_x > gp_y) ++ { ++ int x_a = gp_x * TILE_DIM + lx; ++ int y_a = gp_y * TILE_DIM + ly; ++ int x_b = gp_y * TILE_DIM + lx; ++ int y_b = gp_x * TILE_DIM + ly; ++ ++ // Load ++ #pragma unroll ++ for (int i = 0; i < TILE_DIM; i += BLOCK_ROWS) ++ { ++ if (y_a + i < src_rows && x_a < src_rows) ++ tile_a[mad24(ly + i, LDS_STEP, lx)] = ++ loadpix(srcptr + mad24(y_a + i, src_step, mad24(x_a, TSIZE, src_offset))); ++ ++ if (y_b + i < src_rows && x_b < src_rows) ++ tile_b[mad24(ly + i, LDS_STEP, lx)] = ++ loadpix(srcptr + mad24(y_b + i, src_step, mad24(x_b, TSIZE, src_offset))); ++ } ++ ++ barrier(CLK_LOCAL_MEM_FENCE); ++ ++ // Store (transposed) ++ #pragma unroll ++ for (int i = 0; i < TILE_DIM; i += BLOCK_ROWS) ++ { ++ if (y_b + i < src_rows && x_b < src_rows) ++ storepix(tile_a[mad24(lx, LDS_STEP, ly + i)], ++ srcptr + mad24(y_b + i, src_step, mad24(x_b, TSIZE, src_offset))); ++ ++ if (y_a + i < src_rows && x_a < src_rows) ++ storepix(tile_b[mad24(lx, LDS_STEP, ly + i)], ++ srcptr + mad24(y_a + i, src_step, mad24(x_a, TSIZE, src_offset))); ++ } ++ } ++ else if (gp_x == gp_y) ++ { ++ int x = gp_x * TILE_DIM + lx; ++ int y = gp_y * TILE_DIM + ly; ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_DIM; i += BLOCK_ROWS) ++ if (y + i < src_rows && x < src_rows) ++ tile_a[mad24(ly + i, LDS_STEP, lx)] = ++ loadpix(srcptr + mad24(y + i, src_step, mad24(x, TSIZE, src_offset))); ++ ++ barrier(CLK_LOCAL_MEM_FENCE); ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_DIM; i += BLOCK_ROWS) ++ if (y + i < src_rows && x < src_rows) ++ storepix(tile_a[mad24(lx, LDS_STEP, ly + i)], ++ srcptr + mad24(y + i, src_step, mad24(x, TSIZE, src_offset))); ++ } ++#endif + } + + #endif // INPLACE +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0107-imgproc-perf-HoughLines-Fix-test-tolerance-and-compa.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0107-imgproc-perf-HoughLines-Fix-test-tolerance-and-compa.patch new file mode 100644 index 000000000..de128954a --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0107-imgproc-perf-HoughLines-Fix-test-tolerance-and-compa.patch @@ -0,0 +1,47 @@ +From fa4b11750cfb19ccbe21a2f8d1801ba014e8b401 Mon Sep 17 00:00:00 2001 +From: Samaresh Kumar Singh +Date: Wed, 4 Mar 2026 13:13:52 -0600 +Subject: [PATCH 1/2] [imgproc][perf][HoughLines] Fix test tolerance and + comparator for cross-backend stability + +Upstream-Status: Submitted [under review] + +--- + modules/imgproc/perf/opencl/perf_houghlines.cpp | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/modules/imgproc/perf/opencl/perf_houghlines.cpp b/modules/imgproc/perf/opencl/perf_houghlines.cpp +index 0a5f3ae561..bffd895f2b 100644 +--- a/modules/imgproc/perf/opencl/perf_houghlines.cpp ++++ b/modules/imgproc/perf/opencl/perf_houghlines.cpp +@@ -19,7 +19,7 @@ struct Vec2fComparator + { + bool operator()(const Vec2f& a, const Vec2f b) const + { +- if(a[0] != b[0]) return a[0] < b[0]; ++ if(std::abs(a[0] - b[0]) > 1e-3f) return a[0] < b[0]; + else return a[1] < b[1]; + } + }; +@@ -55,7 +55,10 @@ OCL_PERF_TEST_P(HoughLinesFixture, HoughLines, Combine(OCL_TEST_SIZES, + lines.copyTo(result); + std::sort(result.begin(), result.end(), Vec2fComparator()); + +- SANITY_CHECK(result, 1e-6); ++ EXPECT_GE((size_t)result.total(), 6u); ++ EXPECT_LT((size_t)result.total(), 50u); ++ ++ SANITY_CHECK_NOTHING(); + } + + ///////////// HoughLinesP ///////////////////// +@@ -88,4 +91,4 @@ OCL_PERF_TEST_P(HoughLinesPFixture, HoughLinesP, Combine(Values("cv/shared/pic5. + + } } // namespace opencv_test::ocl + +-#endif // HAVE_OPENCL +\ No newline at end of file ++#endif // HAVE_OPENCL +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0108-imgproc-perf-HoughLines-Fix-lower-bound-for-line-cou.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0108-imgproc-perf-HoughLines-Fix-lower-bound-for-line-cou.patch new file mode 100644 index 000000000..bc7013481 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0108-imgproc-perf-HoughLines-Fix-lower-bound-for-line-cou.patch @@ -0,0 +1,31 @@ +From 2751419022d65b7d9260c87c7806db0f32a1c359 Mon Sep 17 00:00:00 2001 +From: Samaresh Kumar Singh +Date: Thu, 5 Mar 2026 19:21:36 -0600 +Subject: [PATCH 2/2] [imgproc][perf][HoughLines] Fix lower bound for line + count check + +With thetaStep=0.1 rad, theta=PI/2 is not a sampled accumulator bin, so horizontal lines fall below the vote threshold and are not detected. +Only the 3 vertical lines (at theta=0, always an exact bin) are reliably found in that case. Lower the EXPECT_GE bound from 6 to 3 to reflect the worst-case guarantee across all thetaStep values and backends. + +Fixes regression introduced in fa4b117. +Upstream-Status: Submitted [under review] +--- + modules/imgproc/perf/opencl/perf_houghlines.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/imgproc/perf/opencl/perf_houghlines.cpp b/modules/imgproc/perf/opencl/perf_houghlines.cpp +index bffd895f2b..95c61667fc 100644 +--- a/modules/imgproc/perf/opencl/perf_houghlines.cpp ++++ b/modules/imgproc/perf/opencl/perf_houghlines.cpp +@@ -55,7 +55,7 @@ OCL_PERF_TEST_P(HoughLinesFixture, HoughLines, Combine(OCL_TEST_SIZES, + lines.copyTo(result); + std::sort(result.begin(), result.end(), Vec2fComparator()); + +- EXPECT_GE((size_t)result.total(), 6u); ++ EXPECT_GE((size_t)result.total(), 3u); + EXPECT_LT((size_t)result.total(), 50u); + + SANITY_CHECK_NOTHING(); +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0109-core-ocl-fix-incorrect-results-for-in-place-flip-on-.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0109-core-ocl-fix-incorrect-results-for-in-place-flip-on-.patch new file mode 100644 index 000000000..5a6d8891f --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/0109-core-ocl-fix-incorrect-results-for-in-place-flip-on-.patch @@ -0,0 +1,352 @@ +From ba879cd60f505c3239a6bc5c4b8eb6ca87d143c2 Mon Sep 17 00:00:00 2001 +From: jiajia Qian +Date: Thu, 16 Apr 2026 10:14:05 +0800 +Subject: [PATCH] core/ocl: fix incorrect results for in-place flip on strict + OpenCL implementations +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Previously, OpenCL in-place flip kernels (rows/cols/both) could produce +incorrect results compared to the CPU implementation on strict OpenCL +drivers such as Mesa. The kernels relied on implicit load–load–store–store +(LLSS) ordering when src and dst alias, which is not guaranteed by the +OpenCL memory model and may be reordered. + +Some vendor drivers happened to preserve the expected ordering, masking +the issue, but Mesa correctly exposes the undefined behavior. + +This change introduces dedicated in-place flip kernels that: +- Explicitly detect in-place execution (src == dst) +- Stage data through local memory tiles +- Enforce correct ordering with work-group barriers +- Avoid global memory read/write aliasing hazards + +The non in-place path is unchanged. + +With this fix, OpenCL in-place flip produces correct and consistent results +across drivers, matches CPU behavior, and complies with the OpenCL memory +model. + +Upstream-Status: Backport [ba879cd60f505c3239a6bc5c4b8eb6ca87d143c2] +Signed-off-by: jiajia Qian +--- + modules/core/src/matrix_transform.cpp | 71 +++++++--- + modules/core/src/opencl/flip.cl | 196 ++++++++++++++++++++++++++ + 2 files changed, 250 insertions(+), 17 deletions(-) + +diff --git a/modules/core/src/matrix_transform.cpp b/modules/core/src/matrix_transform.cpp +index ce859e8eb8..245cd89843 100644 +--- a/modules/core/src/matrix_transform.cpp ++++ b/modules/core/src/matrix_transform.cpp +@@ -973,7 +973,12 @@ static bool ocl_flip(InputArray _src, OutputArray _dst, int flipCode ) + if (cn > 4) + return false; + +- const char * kernelName; ++ Size size = _src.size(); ++ _dst.create(size, type); ++ UMat src = _src.getUMat(), dst = _dst.getUMat(); ++ bool inplace = (dst.u == src.u); ++ ++ String kernelName; + if (flipCode == 0) + kernelName = "arithm_flip_rows", flipType = FLIP_ROWS; + else if (flipCode > 0) +@@ -981,33 +986,65 @@ static bool ocl_flip(InputArray _src, OutputArray _dst, int flipCode ) + else + kernelName = "arithm_flip_rows_cols", flipType = FLIP_BOTH; + ++ if(inplace) ++ kernelName += "_inplace"; ++ + int pxPerWIy = (dev.isIntel() && (dev.type() & ocl::Device::TYPE_GPU)) ? 4 : 1; + kercn = (cn!=3 || flipType == FLIP_ROWS) ? std::max(kercn, cn) : cn; ++ const int TILE_SIZE = 32, BLOCK_ROWS = 8; + +- ocl::Kernel k(kernelName, ocl::core::flip_oclsrc, +- format( "-D T=%s -D T1=%s -D DEPTH=%d -D cn=%d -D PIX_PER_WI_Y=%d -D kercn=%d", ++ ocl::Kernel k(kernelName.c_str(), ocl::core::flip_oclsrc, ++ format( "-D T=%s -D T1=%s -D DEPTH=%d -D cn=%d -D PIX_PER_WI_Y=%d -D kercn=%d -D TILE_SIZE=%d -D BLOCK_ROWS=%d%s", + kercn != cn ? ocl::typeToStr(CV_MAKE_TYPE(depth, kercn)) : ocl::vecopTypeToStr(CV_MAKE_TYPE(depth, kercn)), +- kercn != cn ? ocl::typeToStr(depth) : ocl::vecopTypeToStr(depth), depth, cn, pxPerWIy, kercn)); ++ kercn != cn ? ocl::typeToStr(depth) : ocl::vecopTypeToStr(depth), depth, cn, pxPerWIy, kercn, TILE_SIZE, BLOCK_ROWS, ++ inplace ? " -D INPLACE" : "")); + if (k.empty()) + return false; + +- Size size = _src.size(); +- _dst.create(size, type); +- UMat src = _src.getUMat(), dst = _dst.getUMat(); +- + int cols = size.width * cn / kercn, rows = size.height; +- cols = flipType == FLIP_COLS ? (cols + 1) >> 1 : cols; +- rows = flipType & FLIP_ROWS ? (rows + 1) >> 1 : rows; ++ int work_cols = flipType == FLIP_COLS ? (cols + 1) >> 1 : cols; ++ int work_rows = flipType & FLIP_ROWS ? (rows + 1) >> 1 : rows; ++ ++ if (inplace) ++ { ++ k.args(ocl::KernelArg::ReadWriteNoSize(dst), rows, cols); ++ ++ int gs_cols, gs_rows; ++ if (flipType == FLIP_COLS) ++ { ++ gs_cols = work_cols; ++ gs_rows = rows; ++ } ++ else if (flipType == FLIP_ROWS) ++ { ++ gs_cols = cols; ++ gs_rows = work_rows; ++ } ++ else // FLIP_BOTH ++ { ++ gs_cols = cols; ++ gs_rows = rows; ++ } + +- k.args(ocl::KernelArg::ReadOnlyNoSize(src), +- ocl::KernelArg::WriteOnly(dst, cn, kercn), rows, cols); ++ size_t globalsize[2] = { ++ (size_t)divUp(gs_cols, TILE_SIZE) * TILE_SIZE, ++ (size_t)divUp(gs_rows, TILE_SIZE) * BLOCK_ROWS ++ }; ++ size_t localsize[2] = { TILE_SIZE, BLOCK_ROWS }; ++ return k.run(2, globalsize, localsize, false); ++ } ++ else ++ { ++ k.args(ocl::KernelArg::ReadOnlyNoSize(src), ++ ocl::KernelArg::WriteOnly(dst, cn, kercn), work_rows, work_cols); + +- size_t maxWorkGroupSize = dev.maxWorkGroupSize(); +- CV_Assert(maxWorkGroupSize % 4 == 0); ++ size_t maxWorkGroupSize = dev.maxWorkGroupSize(); ++ CV_Assert(maxWorkGroupSize % 4 == 0); + +- size_t globalsize[2] = { (size_t)cols, ((size_t)rows + pxPerWIy - 1) / pxPerWIy }, +- localsize[2] = { maxWorkGroupSize / 4, 4 }; +- return k.run(2, globalsize, (flipType == FLIP_COLS) && !dev.isIntel() ? localsize : NULL, false); ++ size_t globalsize[2] = { (size_t)work_cols, ((size_t)work_rows + pxPerWIy - 1) / pxPerWIy }; ++ size_t localsize[2] = { maxWorkGroupSize / 4, 4 }; ++ return k.run(2, globalsize, (flipType == FLIP_COLS) && !dev.isIntel() ? localsize : NULL, false); ++ } + } + + #endif +diff --git a/modules/core/src/opencl/flip.cl b/modules/core/src/opencl/flip.cl +index afd14e4e1f..dbe23c73a4 100644 +--- a/modules/core/src/opencl/flip.cl ++++ b/modules/core/src/opencl/flip.cl +@@ -63,6 +63,9 @@ + #endif + #define TSIZE ((int)sizeof(T1)*3) + #endif ++#define LDS_STEP (TILE_SIZE + 1) ++ ++#ifndef INPLACE + + __kernel void arithm_flip_rows(__global const uchar * srcptr, int src_step, int src_offset, + __global uchar * dstptr, int dst_step, int dst_offset, +@@ -183,3 +186,196 @@ __kernel void arithm_flip_cols(__global const uchar * srcptr, int src_step, int + } + } + } ++ ++#else ++ ++__kernel void arithm_flip_rows_inplace(__global uchar * srcptr, int src_step, int src_offset, ++ int rows, int cols) ++{ ++ int gp_x = get_group_id(0); ++ int gp_y = get_group_id(1); ++ int lx = get_local_id(0); ++ int ly = get_local_id(1); ++ ++ __local T tile_top[TILE_SIZE * LDS_STEP]; ++ __local T tile_bottom[TILE_SIZE * LDS_STEP]; ++ ++ int half_rows = (rows + 1) / 2; ++ ++ int x = gp_x * TILE_SIZE + lx; ++ int y_top = gp_y * TILE_SIZE + ly; ++ int y_bottom = rows - 1 - y_top; ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_SIZE; i += BLOCK_ROWS) ++ { ++ if (x < cols && y_top + i < half_rows) ++ { ++ int curr_y_top = y_top + i; ++ int curr_y_bottom = rows - 1 - curr_y_top; ++ ++ T val_top = loadpix(srcptr + mad24(curr_y_top, src_step, mad24(x, TSIZE, src_offset))); ++ T val_bottom = loadpix(srcptr + mad24(curr_y_bottom, src_step, mad24(x, TSIZE, src_offset))); ++ ++ tile_top[mad24(ly + i, LDS_STEP, lx)] = val_top; ++ tile_bottom[mad24(ly + i, LDS_STEP, lx)] = val_bottom; ++ } ++ } ++ barrier(CLK_LOCAL_MEM_FENCE); ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_SIZE; i += BLOCK_ROWS) ++ { ++ if (x < cols && y_top + i < half_rows) ++ { ++ int curr_y_top = y_top + i; ++ int curr_y_bottom = rows - 1 - curr_y_top; ++ ++ storepix(tile_bottom[mad24(ly + i, LDS_STEP, lx)], ++ srcptr + mad24(curr_y_top, src_step, mad24(x, TSIZE, src_offset))); ++ ++ if (curr_y_top != curr_y_bottom) ++ { ++ storepix(tile_top[mad24(ly + i, LDS_STEP, lx)], ++ srcptr + mad24(curr_y_bottom, src_step, mad24(x, TSIZE, src_offset))); ++ } ++ } ++ } ++} ++ ++__kernel void arithm_flip_rows_cols_inplace(__global uchar * srcptr, int src_step, int src_offset, ++ int rows, int cols) ++{ ++ int gp_x = get_group_id(0); ++ int gp_y = get_group_id(1); ++ int lx = get_local_id(0); ++ int ly = get_local_id(1); ++ ++ __local T tile_first[TILE_SIZE * LDS_STEP]; ++ __local T tile_second[TILE_SIZE * LDS_STEP]; ++ ++ int total_pixels = rows * cols; ++ int half_pixels = (total_pixels + 1) / 2; ++ ++ int x_first = gp_x * TILE_SIZE + lx; ++ int y_first = gp_y * TILE_SIZE + ly; ++ ++ int x_second = cols - 1 - x_first; ++ int y_second = rows - 1 - y_first; ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_SIZE; i += BLOCK_ROWS) ++ { ++ int curr_y_first = y_first + i; ++ int curr_y_second = rows - 1 - curr_y_first; ++ int linear_idx = curr_y_first * cols + x_first; ++ ++ if (x_first < cols && curr_y_first < rows && linear_idx < half_pixels) ++ { ++ T val_first = loadpix(srcptr + mad24(curr_y_first, src_step, mad24(x_first, TSIZE, src_offset))); ++ T val_second = loadpix(srcptr + mad24(curr_y_second, src_step, mad24(x_second, TSIZE, src_offset))); ++ ++#if kercn == 2 ++#if cn == 1 ++ val_first = val_first.s10; ++ val_second = val_second.s10; ++#endif ++#elif kercn == 4 ++#if cn == 1 ++ val_first = val_first.s3210; ++ val_second = val_second.s3210; ++#elif cn == 2 ++ val_first = val_first.s2301; ++ val_second = val_second.s2301; ++#endif ++#endif ++ tile_first[mad24(ly + i, LDS_STEP, lx)] = val_first; ++ tile_second[mad24(ly + i, LDS_STEP, lx)] = val_second; ++ } ++ } ++ barrier(CLK_LOCAL_MEM_FENCE); ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_SIZE; i += BLOCK_ROWS) ++ { ++ int curr_y_first = y_first + i; ++ int curr_y_second = rows - 1 - curr_y_first; ++ int linear_idx = curr_y_first * cols + x_first; ++ ++ if (x_first < cols && curr_y_first < rows && linear_idx < half_pixels) ++ { ++ storepix(tile_second[mad24(ly + i, LDS_STEP, lx)], ++ srcptr + mad24(curr_y_first, src_step, mad24(x_first, TSIZE, src_offset))); ++ ++ if (linear_idx != total_pixels - 1 - linear_idx) ++ { ++ storepix(tile_first[mad24(ly + i, LDS_STEP, lx)], ++ srcptr + mad24(curr_y_second, src_step, mad24(x_second, TSIZE, src_offset))); ++ } ++ } ++ } ++} ++ ++__kernel void arithm_flip_cols_inplace(__global uchar * srcptr, int src_step, int src_offset, ++ int rows, int cols) ++{ ++ int gp_x = get_group_id(0); ++ int gp_y = get_group_id(1); ++ int lx = get_local_id(0); ++ int ly = get_local_id(1); ++ ++ __local T tile_left[TILE_SIZE * LDS_STEP]; ++ __local T tile_right[TILE_SIZE * LDS_STEP]; ++ ++ int half_cols = (cols + 1) / 2; ++ ++ int x_left = gp_x * TILE_SIZE + lx; ++ int y = gp_y * TILE_SIZE + ly; ++ int x_right = cols - 1 - x_left; ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_SIZE; i += BLOCK_ROWS) ++ { ++ if (y + i < rows && x_left < half_cols) ++ { ++ T val_left = loadpix(srcptr + mad24(y + i, src_step, mad24(x_left, TSIZE, src_offset))); ++ T val_right = loadpix(srcptr + mad24(y + i, src_step, mad24(x_right, TSIZE, src_offset))); ++ ++#if kercn == 2 ++#if cn == 1 ++ val_left = val_left.s10; ++ val_right = val_right.s10; ++#endif ++#elif kercn == 4 ++#if cn == 1 ++ val_left = val_left.s3210; ++ val_right = val_right.s3210; ++#elif cn == 2 ++ val_left = val_left.s2301; ++ val_right = val_right.s2301; ++#endif ++#endif ++ tile_left[mad24(ly + i, LDS_STEP, lx)] = val_left; ++ tile_right[mad24(ly + i, LDS_STEP, lx)] = val_right; ++ } ++ } ++ barrier(CLK_LOCAL_MEM_FENCE); ++ ++ #pragma unroll ++ for (int i = 0; i < TILE_SIZE; i += BLOCK_ROWS) ++ { ++ if (y + i < rows && x_left < half_cols) ++ { ++ storepix(tile_right[mad24(ly + i, LDS_STEP, lx)], ++ srcptr + mad24(y + i, src_step, mad24(x_left, TSIZE, src_offset))); ++ ++ if (x_left != x_right) ++ { ++ storepix(tile_left[mad24(ly + i, LDS_STEP, lx)], ++ srcptr + mad24(y + i, src_step, mad24(x_right, TSIZE, src_offset))); ++ } ++ } ++ } ++} ++ ++#endif // INPLACE +\ No newline at end of file +-- +2.34.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/27691.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/27691.patch new file mode 100644 index 000000000..c8c23c93a --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/27691.patch @@ -0,0 +1,44 @@ +From 90c444abd387ffa70b2e72a34922903a2f0f4f5a Mon Sep 17 00:00:00 2001 +From: Alexander Smorkalov +Date: Wed, 20 Aug 2025 10:53:51 +0300 +Subject: [PATCH] FFmpeg 8.0 support. + +Upstream-Status: Backport [https://github.com/opencv/opencv/commit/86df53155411b3ade57d0213bf8dd63006bf248f] +--- + modules/videoio/src/cap_ffmpeg_impl.hpp | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp +index 489dbe565d3d..5780b4c11361 100644 +--- a/modules/videoio/src/cap_ffmpeg_impl.hpp ++++ b/modules/videoio/src/cap_ffmpeg_impl.hpp +@@ -685,7 +685,10 @@ void CvCapture_FFMPEG::close() + if( video_st ) + { + #ifdef CV_FFMPEG_CODECPAR ++// avcodec_close removed in FFmpeg release 8.0 ++# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100)) + avcodec_close( context ); ++# endif + #endif + video_st = NULL; + } +@@ -2005,7 +2008,18 @@ void CvCapture_FFMPEG::get_rotation_angle() + rotation_angle = 0; + #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(57, 68, 100) + const uint8_t *data = 0; ++ // av_stream_get_side_data removed in FFmpeg release 8.0 ++# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100)) + data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); ++# else ++ AVPacketSideData* sd = video_st->codecpar->coded_side_data; ++ int nb_sd = video_st->codecpar->nb_coded_side_data; ++ if (sd && nb_sd > 0) ++ { ++ const AVPacketSideData* mtx = av_packet_side_data_get(sd, nb_sd, AV_PKT_DATA_DISPLAYMATRIX); ++ data = mtx->data; ++ } ++# endif + if (data) + { + rotation_angle = -cvRound(av_display_rotation_get((const int32_t*)data)); diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/OpenCV_DNN_examples.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/OpenCV_DNN_examples.patch index ef7831a5f..9aee21c4d 100644 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/OpenCV_DNN_examples.patch +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/OpenCV_DNN_examples.patch @@ -1,17 +1,19 @@ -From 3c4daafb54f961e376104a461ca7ec114ff0331a Mon Sep 17 00:00:00 2001 +From c0e12bef26b4e4f10eb541c26f7fd7400addb67e Mon Sep 17 00:00:00 2001 From: Ludek Slosarcik Date: Fri, 14 Feb 2020 15:46:50 +0100 -Subject: [PATCH] opencv_dnn: added video device for 2 examples, and change text labels +Subject: [PATCH] opencv_dnn: added video device for 2 examples, and change + text labels Signed-off-by: Ludek Slosarcik Upstream-Status: Pending + --- samples/cpp/logistic_regression.cpp | 2 +- - samples/dnn/classification.cpp | 7 ++++--- + samples/dnn/classification.cpp | 9 +++++---- samples/dnn/object_detection.cpp | 10 +++++----- samples/dnn/segmentation.cpp | 2 +- - samples/dnn/text_detection.cpp | 5 +++-- + samples/dnn/text_detection.cpp | 3 ++- 5 files changed, 14 insertions(+), 12 deletions(-) Index: git/samples/cpp/logistic_regression.cpp @@ -128,8 +130,8 @@ Index: git/samples/dnn/text_detection.cpp "{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera.}" + "{ device | 0 | camera device number. }" "{ detModel dmp | | Path to a binary .pb file contains trained detector network.}" - "{ width | 320 | Preprocess input image by resizing to a specific width. It should be multiple by 32. }" - "{ height | 320 | Preprocess input image by resizing to a specific height. It should be multiple by 32. }" + "{ width | 320 | Preprocess input image by resizing to a specific width. It should be a multiple of 32. }" + "{ height | 320 | Preprocess input image by resizing to a specific height. It should be a multiple of 32. }" @@ -106,7 +107,7 @@ int main(int argc, char** argv) // Open a video file or an image file or a camera stream. diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch index 3538f24b3..265d723c6 100644 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch @@ -1,19 +1,60 @@ -From 5e4150826fea6f37276f348c65d94ce4847d1211 Mon Sep 17 00:00:00 2001 +From 75f7475fcfb35cbe4d8f5ccf5c4ac8bc78f2dc30 Mon Sep 17 00:00:00 2001 From: Kumataro -Date: Sat, 7 Oct 2023 10:11:25 +0900 -Subject: [PATCH] 3rdparty: supporting protobuf v22 and later +Date: Thu, 19 Oct 2023 14:45:08 +0900 +Subject: [PATCH] Merge pull request #24372 from Kumataro:fix24369 -Upstream-Status: Submitted [https://github.com/opencv/opencv/pull/24372] +Supporting protobuf v22 and later(with abseil-cpp/C++17) #24372 + +fix https://github.com/opencv/opencv/issues/24369 +related https://github.com/opencv/opencv/issues/23791 + +1. This patch supports external protobuf v22 and later, it required abseil-cpp and c++17. + Even if the built-in protobuf is upgraded to v22 or later, + the dependency on abseil-cpp and the requirement for C++17 will continue. +2. Some test for caffe required patched protobuf, so this patch disable them. + +This patch is tested by following libraries. +- Protobuf: /usr/local/lib/libprotobuf.so (4.24.4) +- abseil-cpp: YES (20230125) + +See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request + +- [x] I agree to contribute to the project under Apache 2 License. +- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV +- [x] The PR is proposed to the proper branch +- [x] There is a reference to the original bug report and related work +- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable + Patch to opencv_extra has the same branch name. +- [x] The feature is well documented and sample code can be built with the project CMake + +Upstream-Status: Backport [https://github.com/opencv/opencv/commit/6e4280ea81b59c6dca45bb9801b758377beead55] --- - cmake/OpenCVFindProtobuf.cmake | 37 ++++++++++++++++++++++++++++++++++ - modules/dnn/CMakeLists.txt | 9 +++++++++ - 2 files changed, 46 insertions(+) + cmake/OpenCVFindProtobuf.cmake | 35 +++++++++++++++++++++++++++----- + modules/dnn/CMakeLists.txt | 6 ++++++ + modules/dnn/test/test_layers.cpp | 24 ++++++++++++++++++---- + 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake -index 8835347d1d..9bd5c28db8 100644 +index 8835347d1d..5b1e17529f 100644 --- a/cmake/OpenCVFindProtobuf.cmake +++ b/cmake/OpenCVFindProtobuf.cmake -@@ -67,6 +67,38 @@ else() +@@ -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) ++ if(NOT Protobuf_FOUND) ++ find_package(Protobuf QUIET) ++ endif() + + # Backwards compatibility + # Define camel case versions of input variables +@@ -67,6 +73,20 @@ else() endif() endif() @@ -21,82 +62,49 @@ index 8835347d1d..9bd5c28db8 100644 +# In Protocol Buffers v22.0 and later drops C++11 support and depends abseil-cpp. +# Details: https://protobuf.dev/news/2022-08-03/ +# And if std::text_view is in abseil-cpp requests C++17 and later. -+if(HAVE_PROTOBUF) -+ if("${Protobuf_VERSION}" MATCHES [[[0-9]+.([0-9]+).[0-9]+]]) -+ string(COMPARE GREATER_EQUAL "${CMAKE_MATCH_1}" "22" REQUEST_ABSL) -+ -+ if(REQUEST_ABSL) -+ string(COMPARE GREATER_EQUAL "${CMAKE_CXX_STANDARD}" "17" USED_AFTER_CXX17) -+ if(NOT USED_AFTER_CXX17) -+ message("CMAKE_CXX_STANDARD : ${CMAKE_CXX_STANDARD}") -+ message("protobuf : ${Protobuf_VERSION}") -+ message(FATAL_ERROR "protobuf(v22 and later) and abseil-cpp request CMAKE_CXX_STANDARD=17 and later.") -+ endif() -+ -+ ocv_check_modules(ABSL_STRINGS absl_strings) -+ if(NOT ABSL_STRINGS_FOUND) -+ message(FATAL_ERROR "protobuf(v22 and later) requests abseil-cpp(strings), but missing.") -+ endif() + -+ ocv_check_modules(ABSL_LOG absl_log) -+ if(NOT ABSL_LOG_FOUND) -+ message(FATAL_ERROR "protobuf(v22 and later) requests abseil-cpp(log), but missing.") -+ endif() -+ -+ endif() -+ else() -+ message(FATAL_ERROR "Protobuf version(${Protobuf_VERSION}) is unexpected to split.") ++if(HAVE_PROTOBUF) ++ if(NOT (Protobuf_VERSION VERSION_LESS 22)) ++ if((CMAKE_CXX_STANDARD EQUAL 98) OR (CMAKE_CXX_STANDARD LESS 17)) ++ message(STATUS "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is too old to support protobuf(${Protobuf_VERSION}) and/or abseil-cpp. Use C++17 or later. Turning HAVE_PROTOBUF off") ++ set(HAVE_PROTOBUF FALSE) + endif() ++ endif() +endif() + if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP) message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})") endif() -@@ -89,3 +121,8 @@ if(HAVE_PROTOBUF) - BUILD_PROTOBUF THEN "build (${Protobuf_VERSION})" - ELSE "${__location} (${Protobuf_VERSION})") - endif() -+ -+if(HAVE_ABSL_STRINGS AND HAVE_ABSL_LOG) -+ list(APPEND CUSTOM_STATUS absl) -+ list(APPEND CUSTOM_STATUS_absl " abseil-cpp:" "YES (${ABSL_STRINGS_VERSION})" ) -+endif() -diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt -index 804b78ead2..d32007b37e 100644 ---- a/modules/dnn/CMakeLists.txt -+++ b/modules/dnn/CMakeLists.txt -@@ -149,6 +149,15 @@ if(NOT BUILD_PROTOBUF) - list(APPEND include_dirs ${Protobuf_INCLUDE_DIRS}) - endif() - -+if(HAVE_ABSL_STRINGS) -+ list(APPEND libs ${ABSL_STRINGS_LIBRARIES}) -+ list(APPEND include_dirs ${ABSL_STRTRINGS_INCLUDE_DIRS}) -+endif() -+if(HAVE_ABSL_LOG) -+ list(APPEND libs ${ABSL_LOG_LIBRARIES}) -+ list(APPEND include_dirs ${ABSL_LOG_INCLUDE_DIRS}) -+endif() +@@ -74,15 +94,20 @@ endif() + if(HAVE_PROTOBUF) + list(APPEND CUSTOM_STATUS protobuf) + if(NOT BUILD_PROTOBUF) ++ unset( __location) + if(TARGET "${Protobuf_LIBRARIES}") + get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_RELEASE) + if(NOT __location) + get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION) + endif() +- elseif(Protobuf_LIBRARY) +- set(__location "${Protobuf_LIBRARY}") +- else() +- set(__location "${Protobuf_LIBRARIES}") ++ endif() + - set(sources_options "") - - list(APPEND libs ${LAPACK_LIBRARIES}) -From 06a7669521d205f647d3e718322ccd153cdbbb77 Mon Sep 17 00:00:00 2001 -From: Kumataro -Date: Sun, 8 Oct 2023 09:39:35 +0900 -Subject: [PATCH] dnn: disable some tests for external protobuf - ---- - modules/dnn/CMakeLists.txt | 5 +++++ - modules/dnn/src/caffe/caffe_io.cpp | 24 ++++++++++++++++++++++-- - modules/dnn/test/test_layers.cpp | 16 ++++++++++++++++ - 3 files changed, 43 insertions(+), 2 deletions(-) - ++ if(NOT __location) ++ if(Protobuf_LIBRARY) ++ set(__location "${Protobuf_LIBRARY}") ++ else() ++ set(__location "${Protobuf_LIBRARIES}") ++ endif() + endif() + endif() + list(APPEND CUSTOM_STATUS_protobuf " Protobuf:" diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt -index d32007b37e..face38465f 100644 +index 804b78ead2..9fcc460909 100644 --- a/modules/dnn/CMakeLists.txt +++ b/modules/dnn/CMakeLists.txt -@@ -254,6 +254,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs}) +@@ -245,6 +245,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs}) ocv_add_samples() ocv_add_accuracy_tests(${dnn_runtime_libs}) @@ -109,211 +117,13 @@ index d32007b37e..face38465f 100644 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") - -diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp -index ebecf95eea..ebceca84cf 100644 ---- a/modules/dnn/src/caffe/caffe_io.cpp -+++ b/modules/dnn/src/caffe/caffe_io.cpp -@@ -1130,7 +1130,17 @@ bool ReadProtoFromTextFile(const char* filename, Message* proto) { - parser.AllowUnknownField(true); - parser.SetRecursionLimit(1000); - #endif -- return parser.Parse(&input, proto); -+ const bool ret = parser.Parse(&input, proto); -+ -+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF -+ if(!ret) -+ { -+ LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only)."; -+ CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only).")); -+ } -+#endif -+ -+ return ret; - } - - bool ReadProtoFromBinaryFile(const char* filename, Message* proto) { -@@ -1148,7 +1158,17 @@ bool ReadProtoFromTextBuffer(const char* data, size_t len, Message* proto) { - parser.AllowUnknownField(true); - parser.SetRecursionLimit(1000); - #endif -- return parser.Parse(&input, proto); -+ const bool ret = parser.Parse(&input, proto); -+ -+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF -+ if(!ret) -+ { -+ LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only)."; -+ CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only).")); -+ } -+#endif -+ -+ return ret; - } - - diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp -index 763d94b99c..a07d442d76 100644 +index 763d94b99c..6cb6d54b3f 100644 --- a/modules/dnn/test/test_layers.cpp +++ b/modules/dnn/test/test_layers.cpp -@@ -754,7 +754,11 @@ TEST_F(Layer_RNN_Test, get_set_test) - EXPECT_EQ(shape(outputs[1]), shape(nT, nS, nH)); - } +@@ -756,11 +756,15 @@ TEST_F(Layer_RNN_Test, get_set_test) -+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF TEST_P(Test_Caffe_layers, Accum) -+#else -+TEST_P(Test_Caffe_layers, DISABLED_Accum) // requires patched protobuf (available in OpenCV source tree only) -+#endif - { - if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16); -@@ -778,7 +782,11 @@ TEST_P(Test_Caffe_layers, ChannelNorm) - testLayerUsingCaffeModels("channel_norm", false, false); - } - -+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF - TEST_P(Test_Caffe_layers, DataAugmentation) -+#else -+TEST_P(Test_Caffe_layers, DISABLED_DataAugmentation) // requires patched protobuf (available in OpenCV source tree only) -+#endif - { - if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16) - applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16); -@@ -787,7 +795,11 @@ TEST_P(Test_Caffe_layers, DataAugmentation) - testLayerUsingCaffeModels("data_augmentation_8x6", true, false); - } - -+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF - TEST_P(Test_Caffe_layers, Resample) -+#else -+TEST_P(Test_Caffe_layers, DISABLED_Resample) // requires patched protobuf (available in OpenCV source tree only) -+#endif - { - if (backend != DNN_BACKEND_OPENCV) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); -@@ -795,7 +807,11 @@ TEST_P(Test_Caffe_layers, Resample) - testLayerUsingCaffeModels("nearest", false, false); - } - -+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF - TEST_P(Test_Caffe_layers, Correlation) -+#else -+TEST_P(Test_Caffe_layers, DISABLED_Correlation) // requires patched protobuf (available in OpenCV source tree only) -+#endif - { - if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, -From 2c33798f41942aefc203183d673ce4846f32dba4 Mon Sep 17 00:00:00 2001 -From: Kumataro -Date: Sun, 8 Oct 2023 13:28:40 +0900 -Subject: [PATCH] use GREATER instead of GREATER_EQUAL and remove new blank - line at EOF - ---- - cmake/OpenCVFindProtobuf.cmake | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake -index 9bd5c28db8..ba147526d6 100644 ---- a/cmake/OpenCVFindProtobuf.cmake -+++ b/cmake/OpenCVFindProtobuf.cmake -@@ -71,12 +71,14 @@ endif() - # In Protocol Buffers v22.0 and later drops C++11 support and depends abseil-cpp. - # Details: https://protobuf.dev/news/2022-08-03/ - # And if std::text_view is in abseil-cpp requests C++17 and later. -+ - if(HAVE_PROTOBUF) - if("${Protobuf_VERSION}" MATCHES [[[0-9]+.([0-9]+).[0-9]+]]) -- string(COMPARE GREATER_EQUAL "${CMAKE_MATCH_1}" "22" REQUEST_ABSL) -+ string(COMPARE GREATER "${CMAKE_MATCH_1}" "21" REQUEST_ABSL) # >=22 - - if(REQUEST_ABSL) -- string(COMPARE GREATER_EQUAL "${CMAKE_CXX_STANDARD}" "17" USED_AFTER_CXX17) -+ string(COMPARE GREATER "${CMAKE_CXX_STANDARD}" "16" USED_AFTER_CXX17) # >=17 -+ - if(NOT USED_AFTER_CXX17) - message("CMAKE_CXX_STANDARD : ${CMAKE_CXX_STANDARD}") - message("protobuf : ${Protobuf_VERSION}") -From cd709eefbeedd116bf3495b42280323b932791ff Mon Sep 17 00:00:00 2001 -From: Kumataro -Date: Mon, 9 Oct 2023 21:51:04 +0900 -Subject: [PATCH] fix for review - ---- - cmake/OpenCVFindProtobuf.cmake | 5 ---- - modules/dnn/src/caffe/caffe_io.cpp | 24 ++---------------- - modules/dnn/test/test_layers.cpp | 40 +++++++++++++++--------------- - 3 files changed, 22 insertions(+), 47 deletions(-) - -diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake -index ba147526d6..2faf1010bf 100644 ---- a/cmake/OpenCVFindProtobuf.cmake -+++ b/cmake/OpenCVFindProtobuf.cmake -@@ -123,8 +123,3 @@ if(HAVE_PROTOBUF) - BUILD_PROTOBUF THEN "build (${Protobuf_VERSION})" - ELSE "${__location} (${Protobuf_VERSION})") - endif() -- --if(HAVE_ABSL_STRINGS AND HAVE_ABSL_LOG) -- list(APPEND CUSTOM_STATUS absl) -- list(APPEND CUSTOM_STATUS_absl " abseil-cpp:" "YES (${ABSL_STRINGS_VERSION})" ) --endif() -diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp -index ebceca84cf..ebecf95eea 100644 ---- a/modules/dnn/src/caffe/caffe_io.cpp -+++ b/modules/dnn/src/caffe/caffe_io.cpp -@@ -1130,17 +1130,7 @@ bool ReadProtoFromTextFile(const char* filename, Message* proto) { - parser.AllowUnknownField(true); - parser.SetRecursionLimit(1000); - #endif -- const bool ret = parser.Parse(&input, proto); -- --#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF -- if(!ret) -- { -- LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only)."; -- CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only).")); -- } --#endif -- -- return ret; -+ return parser.Parse(&input, proto); - } - - bool ReadProtoFromBinaryFile(const char* filename, Message* proto) { -@@ -1158,17 +1148,7 @@ bool ReadProtoFromTextBuffer(const char* data, size_t len, Message* proto) { - parser.AllowUnknownField(true); - parser.SetRecursionLimit(1000); - #endif -- const bool ret = parser.Parse(&input, proto); -- --#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF -- if(!ret) -- { -- LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only)."; -- CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only).")); -- } --#endif -- -- return ret; -+ return parser.Parse(&input, proto); - } - - -diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp -index a07d442d76..5c6fc541d7 100644 ---- a/modules/dnn/test/test_layers.cpp -+++ b/modules/dnn/test/test_layers.cpp -@@ -754,17 +754,17 @@ TEST_F(Layer_RNN_Test, get_set_test) - EXPECT_EQ(shape(outputs[1]), shape(nT, nS, nH)); - } - --#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF - TEST_P(Test_Caffe_layers, Accum) --#else --TEST_P(Test_Caffe_layers, DISABLED_Accum) // requires patched protobuf (available in OpenCV source tree only) --#endif { +#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF + throw SkipTestException("Requires patched protobuf"); @@ -327,15 +137,9 @@ index a07d442d76..5c6fc541d7 100644 } TEST_P(Test_Caffe_layers, FlowWarp) -@@ -782,42 +782,42 @@ TEST_P(Test_Caffe_layers, ChannelNorm) - testLayerUsingCaffeModels("channel_norm", false, false); - } +@@ -780,27 +784,39 @@ TEST_P(Test_Caffe_layers, ChannelNorm) --#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF TEST_P(Test_Caffe_layers, DataAugmentation) --#else --TEST_P(Test_Caffe_layers, DISABLED_DataAugmentation) // requires patched protobuf (available in OpenCV source tree only) --#endif { +#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF + throw SkipTestException("Requires patched protobuf"); @@ -348,11 +152,7 @@ index a07d442d76..5c6fc541d7 100644 +#endif } --#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF TEST_P(Test_Caffe_layers, Resample) --#else --TEST_P(Test_Caffe_layers, DISABLED_Resample) // requires patched protobuf (available in OpenCV source tree only) --#endif { +#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF + throw SkipTestException("Requires patched protobuf"); @@ -364,11 +164,7 @@ index a07d442d76..5c6fc541d7 100644 +#endif } --#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF TEST_P(Test_Caffe_layers, Correlation) --#else --TEST_P(Test_Caffe_layers, DISABLED_Correlation) // requires patched protobuf (available in OpenCV source tree only) --#endif { +#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF + throw SkipTestException("Requires patched protobuf"); @@ -377,12 +173,11 @@ index a07d442d76..5c6fc541d7 100644 applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16); testLayerUsingCaffeModels("correlation", false, false, 0.0, 0.0, 2); - } +#endif + } TEST_P(Test_Caffe_layers, Convolution2Inputs) - { -@@ -1644,12 +1644,11 @@ private: +@@ -1641,12 +1657,11 @@ private: int outWidth, outHeight, zoomFactor; }; @@ -395,10 +190,10 @@ index a07d442d76..5c6fc541d7 100644 +#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF + throw SkipTestException("Requires patched protobuf"); +#else - #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) -@@ -1686,6 +1685,7 @@ TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (availa + #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception +@@ -1670,6 +1685,7 @@ TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (availa // Test an implemented layer. testLayerUsingCaffeModels("layer_interp", false, false); diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.13.0.imx.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.13.0.imx.bb new file mode 100644 index 000000000..ff6982d2f --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.13.0.imx.bb @@ -0,0 +1,325 @@ +# This recipe is modified for i.MX. +# For ease of maintenance, the top section is a verbatim copy +# of an OE-core recipe, and the second section customizes the +# recipe for i.MX. + +########## meta-openembedded copy ########### +# Upstream hash: 9b77eae6988e98adbec5323d2491afc6b327c91a + +SUMMARY = "Opencv : The Open Computer Vision Library" +HOMEPAGE = "http://opencv.org/" +SECTION = "libs" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" + +DEPENDS = "bzip2 glib-2.0 libtool libwebp swig-native zlib" + +SRCREV_opencv = "fe38fc608f6acb8b68953438a62305d8318f4fcd" +SRCREV_contrib = "d99ad2a188210cc35067c2e60076eed7c2442bc3" +SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26" +SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d" +SRCREV_face = "8afa57abc8229d611c4937165d20e2a2d9fc5a12" +SRCREV_wechat-qrcode = "a8b69ccc738421293254aec5ddb38bd523503252" +SRCREV_fastcv = "9e8d42b6d7e769548d70b2e5674e263b056de8b4" +# kleidicv must match version of OpenCV +SRCREV_kleidicv = "1e8fe7008c2292657b9689d70ea5d30db0e57767" + +SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg_fastcv_kleidicv" +SRC_URI = "git://github.com/opencv/opencv.git;name=opencv;branch=4.x;protocol=https;tag=${PV} \ + git://github.com/opencv/opencv_contrib.git;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/contrib;name=contrib;branch=4.x;protocol=https;tag=${PV} \ + git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/boostdesc;name=boostdesc;protocol=https \ + git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/vgg;name=vgg;protocol=https \ + git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/face;name=face;protocol=https \ + git://github.com/WeChatCV/opencv_3rdparty.git;branch=wechat_qrcode;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/wechat_qrcode;name=wechat-qrcode;protocol=https \ + git://github.com/opencv/opencv_3rdparty.git;branch=fastcv/4.x_20250715;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/fastcv;name=fastcv;protocol=https \ + file://0003-To-fix-errors-as-following.patch \ + file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \ + file://0001-Dont-use-isystem.patch \ + file://download.patch \ + file://0001-Make-ts-module-external.patch \ + file://0008-Do-not-embed-build-directory-in-binaries.patch \ + " +SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=contrib" +SRC_URI:append:aarch64 = " git://gitlab.arm.com/kleidi/kleidicv;branch=main;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/3rdparty/kleidicv;name=kleidicv;protocol=https" + +# OpenCV wants to download more files during configure. We download these in +# do_fetch and construct a source cache in the format it expects +OPENCV_DLDIR = "${WORKDIR}/downloads" + +do_unpack_extra() { + + md5() { + # Return the MD5 of $1 + echo $(md5sum $1 | cut -d' ' -f1) + } + cache() { + TAG=$1 + shift + mkdir --parents ${OPENCV_DLDIR}/$TAG + for F in $*; do + DEST=${OPENCV_DLDIR}/$TAG/$(md5 $F)-$(basename $F) + test -e $DEST || ln -s $F $DEST + done + } + cache xfeatures2d/boostdesc ${S}/boostdesc/*.i + cache xfeatures2d/vgg ${S}/vgg/*.i + cache data ${S}/face/*.dat + cache wechat_qrcode ${S}/wechat_qrcode/*.caffemodel + cache wechat_qrcode ${S}/wechat_qrcode/*.prototxt + cache fastcv ${S}/fastcv/fastcv/*.tgz +} +addtask unpack_extra after do_unpack before do_patch + +CMAKE_VERBOSE = "VERBOSE=1" + +EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${S}/contrib/modules \ + -DWITH_1394=OFF \ + -DENABLE_PRECOMPILED_HEADERS=OFF \ + -DCMAKE_SKIP_RPATH=ON \ + -DWITH_IPP=OFF \ + -DOPENCV_GENERATE_PKGCONFIG=ON \ + -DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \ + -DOPENCV_ALLOW_DOWNLOADS=OFF \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \ +" + +LDFLAGS:append:mips = " -Wl,--no-as-needed -latomic -Wl,--as-needed" +LDFLAGS:append:riscv32 = " -Wl,--no-as-needed -latomic -Wl,--as-needed" + +EXTRA_OECMAKE:append:x86 = " -DX86=ON" +# disable sse4.1 and sse4.2 to fix 32bit build failure +# https://github.com/opencv/opencv/issues/21597 +EXTRA_OECMAKE:remove:x86 = "-DENABLE_SSE41=1 -DENABLE_SSE42=1" + +PACKAGECONFIG ??= "python3 eigen jpeg png tiff v4l libv4l samples tbb \ + ${@bb.utils.contains_any('DISTRO_FEATURES', '${GTK3DISTROFEATURES}', 'gtk', '', d)}" +PACKAGECONFIG:append:class-target = " gapi gstreamer gphoto2 \ + ${@bb.utils.contains_any("LICENSE_FLAGS_ACCEPTED", "commercial_ffmpeg commercial", "libav", "", d)}" + +# TBB does not build for powerpc so disable that package config +PACKAGECONFIG:remove:powerpc = "tbb" +# tbb now needs getcontect/setcontext which is not there for all arches on musl +PACKAGECONFIG:remove:libc-musl:riscv64 = "tbb" +PACKAGECONFIG:remove:libc-musl:riscv32 = "tbb" + +PACKAGECONFIG[gapi] = "-DWITH_ADE=ON -Dade_DIR=${STAGING_LIBDIR},-DWITH_ADE=OFF,ade" +PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas," +PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft," +PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF -DCMAKE_CXX_STANDARD=17,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native," +PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog," +PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype," +PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2," +PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base," +PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3," +PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper," +PACKAGECONFIG[java] = "-DJAVA_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native fastjar-native openjdk-8-native," +PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg," +PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,ffmpeg," +PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils," +PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/libopencl1," +PACKAGECONFIG[openvino] = "-DWITH_OPENVINO=ON,-DWITH_OPENVINO=OFF,openvino-inference-engine,openvino-inference-engine" +PACKAGECONFIG[oracle-java] = "-DJAVA_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${ORACLE_JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native," +PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng," +PACKAGECONFIG[python3] = "-DPYTHON3_INCLUDE_PATH=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} -DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/_core/include,,python3-numpy," +PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_BIN_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,," +PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb," +PACKAGECONFIG[tests] = "-DBUILD_TESTS=ON -DINSTALL_TESTS=ON,-DBUILD_TESTS=OFF,," +PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract," +PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff," +PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils," +PACKAGECONFIG[fastcv] = "-DWITH_FASTCV=ON ,-DWITH_FASTCV=OFF,qcom-fastcv-binaries," + +inherit pkgconfig cmake setuptools3-base python3native + +export PYTHON_CSPEC = "-I${STAGING_INCDIR}/${PYTHON_DIR}" +export ORACLE_JAVA_HOME = "${STAGING_DIR_NATIVE}/usr/bin/java" +export JAVA_HOME = "${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native" +export ANT_DIR = "${STAGING_DIR_NATIVE}/usr/share/ant/" + +TARGET_CC_ARCH += "-I${S}/include " + +PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'samples', '${PN}-samples', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'oracle-java', '${PN}-java', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'java', '${PN}-java', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-${BPN}', '', d)} \ + ${PN}-apps" + +python populate_packages:prepend () { + cv_libdir = d.expand('${libdir}') + do_split_packages(d, cv_libdir, r'^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True) + do_split_packages(d, cv_libdir, r'^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') + do_split_packages(d, cv_libdir, r'^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') + do_split_packages(d, cv_libdir, r'^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True) + + pn = d.getVar('PN') + metapkg = pn + '-dev' + d.setVar('ALLOW_EMPTY:' + metapkg, "1") + blacklist = [ metapkg ] + metapkg_rdepends = [ ] + packages = d.getVar('PACKAGES').split() + for pkg in packages[1:]: + if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'): + metapkg_rdepends.append(pkg) + d.setVar('RRECOMMENDS:' + metapkg, ' '.join(metapkg_rdepends)) + + metapkg = pn + d.setVar('ALLOW_EMPTY:' + metapkg, "1") + blacklist = [ metapkg ] + metapkg_rdepends = [ ] + for pkg in packages[1:]: + if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') and not pkg.endswith('-locale') and not pkg.endswith('-staticdev'): + metapkg_rdepends.append(pkg) + d.setVar('RDEPENDS:' + metapkg, ' '.join(metapkg_rdepends)) + + fastcv_pkgs = ["libopencv-core", "libopencv-fastcv", "libopencv-imgproc"] + if bb.utils.contains('PACKAGECONFIG', 'fastcv', True, False, d): + for pkg in fastcv_pkgs: + d.appendVar('RDEPENDS:' + pkg, " qcom-fastcv-binaries") +} + +PACKAGES_DYNAMIC += "^libopencv-.*" + +FILES:${PN} = "" +FILES:${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*" +FILES:${PN}-dev = "${includedir} ${libdir}/pkgconfig ${libdir}/cmake/opencv4/*.cmake" +FILES:${PN}-staticdev += "${libdir}/opencv4/3rdparty/*.a" +FILES:${PN}-apps = "${bindir}/* ${datadir}/opencv4 ${datadir}/licenses" +FILES:${PN}-java = "${datadir}/OpenCV/java" +FILES:${PN}-samples = "${datadir}/opencv4/samples/" + +INSANE_SKIP:${PN}-java = "libdir" +INSANE_SKIP:${PN}-dbg = "libdir" + +ALLOW_EMPTY:${PN} = "1" + +SUMMARY:python3-opencv = "Python bindings to opencv" +FILES:python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" +RDEPENDS:python3-opencv = "python3-core python3-numpy" + +RDEPENDS:${PN}-apps = "bash" + +do_compile:prepend() { + # remove the build host info to improve reproducibility + if [ -f ${WORKDIR}/build/modules/core/version_string.inc ]; then + sed -i "s#${WORKDIR}#/workdir#g" ${WORKDIR}/build/modules/core/version_string.inc + fi +} + +do_install:append() { + # Move Python files into correct library folder (for multilib build) + if [ "$libdir" != "/usr/lib" -a -d ${D}/usr/lib ]; then + mv ${D}/usr/lib/* ${D}/${libdir}/ + rm -rf ${D}/usr/lib + fi + # remove setup_vars_opencv4.sh as its content is confusing and useless + if [ -f ${D}${bindir}/setup_vars_opencv4.sh ]; then + rm -rf ${D}${bindir}/setup_vars_opencv4.sh + fi + + for fn in arithm.vsx3.cpp convert.vsx3.cpp; do + if [ -f ${B}/modules/core/$fn ]; then + sed -i -e 's,${S},/usr/src/debug/${PN}/${PV},g' ${B}/modules/core/$fn + fi + done + + if [ -d ${D}/${bindir}/shape ]; then + # rename shape dir to avoid rootfs conflict with + # mesa-demos /usr/bin/shape file. + mv ${D}/${bindir}/shape ${D}/${bindir}/opencv_shape + fi +} + +do_install:append:class-target() { + # remove build host path to improve reproducibility + if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then + sed -e 's@${STAGING_DIR_HOST}@@g' \ + -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake + fi +} + +BBCLASSEXTEND = "native" + +########## End of meta-openembedded copy ########## + +########## i.MX overrides ########## + +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +# Need to override opencv and contrib URL because they include PV +IMX_BASE_VERSION = "${@'.'.join((d.getVar('PV') or '').split('.')[:3])}" +SRC_URI:remove = " \ + git://github.com/opencv/opencv.git;name=opencv;branch=4.x;protocol=https;tag=${PV} \ + git://github.com/opencv/opencv_contrib.git;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/contrib;name=contrib;branch=4.x;protocol=https;tag=${PV}" +SRC_URI:prepend = " \ + git://github.com/opencv/opencv.git;name=opencv;branch=4.x;protocol=https;tag=${IMX_BASE_VERSION} \ + git://github.com/opencv/opencv_contrib.git;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/contrib;name=contrib;branch=4.x;protocol=https;tag=${IMX_BASE_VERSION} " + +# i.MX patches +SRC_URI += " \ + file://0101-MGS-6470-ccc-Modify-host-ptr-alignment-size-in-UMAT.patch \ + file://0102-MGS-6470-ccc-Add-configuration-parameter-to-force-en.patch \ + file://0103-MGS-6470-ccc-Change-configuration-to-enable-hostptr-.patch \ + file://0104-MGS-8011-ccc-Fix-the-problem-of-syntax-error-at-doub.patch \ + file://0105-MGS-8318-ccc-Fix-error-implicit-declaration-of-funct.patch \ + file://0106-core-opencl-fix-inplace-transpose-race-by-enforcing-.patch \ + file://0107-imgproc-perf-HoughLines-Fix-test-tolerance-and-compa.patch \ + file://0108-imgproc-perf-HoughLines-Fix-lower-bound-for-line-cou.patch \ + file://0109-core-ocl-fix-incorrect-results-for-in-place-flip-on-.patch \ +" + +# Add opencv_extra +SRC_URI += "\ + git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra;branch=4.x;protocol=https \ + file://0001-Add-smaller-version-of-download_models.py.patch;patchdir=${UNPACKDIR}/extra \ +" +SRCREV_FORMAT:append = "_extra" +SRCREV_extra = "b6db059e9b80072d80d009d2ab344f8606a8e964" + +# Patch DNN example +SRC_URI += "\ + file://OpenCV_DNN_examples.patch \ +" + +PACKAGECONFIG:remove = "eigen" + +PACKAGECONFIG:append = " \ + dnn \ + text \ + ${@bb.utils.contains('BBFILE_COLLECTIONS', 'qt6-layer', 'qt6', '', d)} \ + ${PACKAGECONFIG_OPENCL} \ +" + +PACKAGECONFIG_OPENCL = "" +PACKAGECONFIG_OPENCL:imxgpu = "opencl" +PACKAGECONFIG_OPENCL:mx8mm-nxp-bsp = "" + +PACKAGECONFIG[openvx] = "-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU',-DWITH_OPENVX=OFF,virtual/libopenvx," +PACKAGECONFIG[qt5] = "-DWITH_QT=ON -DOE_QMAKE_PATH_EXTERNAL_HOST_BINS=${STAGING_BINDIR_NATIVE} -DCMAKE_PREFIX_PATH=${STAGING_BINDIR_NATIVE}/cmake,-DWITH_QT=OFF,qtbase qtbase-native," +PACKAGECONFIG[qt6] = "-DWITH_QT=ON -DQT_HOST_PATH=${RECIPE_SYSROOT_NATIVE}${prefix_native},-DWITH_QT=OFF,qtbase qtbase-native qt5compat," +PACKAGECONFIG[tests-imx] = "-DINSTALL_TESTS=ON -DOPENCV_TEST_DATA_PATH=${UNPACKDIR}/extra/testdata, -DINSTALL_TESTS=OFF," +PACKAGECONFIG[tim-vx] = "-DWITH_TIMVX=ON -DTIMVX_INSTALL_DIR=${STAGING_DIR_HOST}${libdir},-DWITH_TIMVX=OFF,tim-vx" + +do_install:append() { + ln -sf opencv4/opencv2 ${D}${includedir}/opencv2 + install -d ${D}${datadir}/opencv4/samples/data + cp -r ${S}/samples/data/* ${D}${datadir}/opencv4/samples/data + install -d ${D}${datadir}/opencv4/samples/bin/ + cp -f bin/example_* ${D}${datadir}/opencv4/samples/bin/ + if ${@bb.utils.contains('PACKAGECONFIG', 'tests-imx', 'true', 'false', d)}; then + cp -r share/opencv4/testdata/cv/face/* ${D}${datadir}/opencv4/testdata/cv/face/ + fi + # Rename cpp folder to avoid collision with GCC /usr/bin/cpp. + mv ${D}${bindir}/cpp ${D}${bindir}/opencv_cpp +} + +PACKAGE_ARCH = "${MACHINE_SOCARCH}" + +COMPATIBLE_MACHINE = "(mx8-nxp-bsp|mx9-nxp-bsp)" + +########## End of i.MX overrides ########## diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.6.0.imx.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.6.0.imx.bb deleted file mode 100644 index 4b5786309..000000000 --- a/dynamic-layers/openembedded-layer/recipes-support/opencv/opencv_4.6.0.imx.bb +++ /dev/null @@ -1,318 +0,0 @@ -# This recipe is for the i.MX fork of opencv. For ease of -# maintenance, the top section is a verbatim copy of an OE-core -# recipe. The second section customizes the recipe for i.MX. - -########## meta-openembedded copy ########### -# Upstream hash: 72dc42966be7da07f9553f75b825123b81704f0b -# Commit https://github.com/openembedded/meta-openembedded/commit/225ce6a14a8110ab6b573b4dc9f5297a03d17e0f added - -SUMMARY = "Opencv : The Open Computer Vision Library" -HOMEPAGE = "http://opencv.org/" -SECTION = "libs" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" - -ARM_INSTRUCTION_SET:armv4 = "arm" -ARM_INSTRUCTION_SET:armv5 = "arm" - -DEPENDS = "bzip2 glib-2.0 libtool libwebp swig-native zlib" - -SRCREV_opencv = "b0dc474160e389b9c9045da5db49d03ae17c6a6b" -SRCREV_contrib = "7b77c355a8fdc97667b3fa1e7a0d37e4973fc868" -SRCREV_ipp = "a56b6ac6f030c312b2dce17430eef13aed9af274" -SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26" -SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d" -SRCREV_face = "8afa57abc8229d611c4937165d20e2a2d9fc5a12" -SRCREV_wechat-qrcode = "a8b69ccc738421293254aec5ddb38bd523503252" - -def ipp_filename(d): - import re - arch = d.getVar('TARGET_ARCH') - if re.match("i.86$", arch): - return "ippicv_2020_lnx_ia32_20191018_general.tgz" - else: - return "ippicv_2020_lnx_intel64_20191018_general.tgz" - -def ipp_md5sum(d): - import re - arch = d.getVar('TARGET_ARCH') - if re.match("i.86$", arch): - return "ad189a940fb60eb71f291321322fe3e8" - else: - return "7421de0095c7a39162ae13a6098782f9" - -IPP_FILENAME = "${@ipp_filename(d)}" -IPP_MD5 = "${@ipp_md5sum(d)}" - -SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg" -SRC_URI = "git://github.com/opencv/opencv.git;name=opencv;branch=master;protocol=https \ - git://github.com/opencv/opencv_contrib.git;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/contrib;name=contrib;branch=master;protocol=https \ - git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/ipp;name=ipp;protocol=https \ - git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/boostdesc;name=boostdesc;protocol=https \ - git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/vgg;name=vgg;protocol=https \ - git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/face;name=face;protocol=https \ - git://github.com/WeChatCV/opencv_3rdparty.git;branch=wechat_qrcode;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/wechat_qrcode;name=wechat-qrcode;protocol=https \ - file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \ - file://0003-To-fix-errors-as-following.patch \ - file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \ - file://0001-Dont-use-isystem.patch \ - file://download.patch \ - file://0001-Make-ts-module-external.patch \ - file://0001-Add-missing-header-for-LIBAVCODEC_VERSION_INT.patch \ - file://fix-build-with-protobuf-v22.patch \ - " -SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=contrib" - -# OpenCV wants to download more files during configure. We download these in -# do_fetch and construct a source cache in the format it expects -OPENCV_DLDIR = "${UNPACKDIR}/downloads" - -do_unpack_extra() { - tar xzf ${S}/ipp/ippicv/${IPP_FILENAME} -C ${S} - - md5() { - # Return the MD5 of $1 - echo $(md5sum $1 | cut -d' ' -f1) - } - cache() { - TAG=$1 - shift - mkdir --parents ${OPENCV_DLDIR}/$TAG - for F in $*; do - DEST=${OPENCV_DLDIR}/$TAG/$(md5 $F)-$(basename $F) - test -e $DEST || ln -s $F $DEST - done - } - cache xfeatures2d/boostdesc ${S}/boostdesc/*.i - cache xfeatures2d/vgg ${S}/vgg/*.i - cache data ${S}/face/*.dat - cache wechat_qrcode ${S}/wechat_qrcode/*.caffemodel - cache wechat_qrcode ${S}/wechat_qrcode/*.prototxt -} -addtask unpack_extra after do_unpack before do_patch - -CMAKE_VERBOSE = "VERBOSE=1" - -EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${S}/contrib/modules \ - -DWITH_1394=OFF \ - -DENABLE_PRECOMPILED_HEADERS=OFF \ - -DCMAKE_SKIP_RPATH=ON \ - -DOPENCV_ICV_HASH=${IPP_MD5} \ - -DIPPROOT=${S}/ippicv_lnx \ - -DOPENCV_GENERATE_PKGCONFIG=ON \ - -DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \ - -DOPENCV_ALLOW_DOWNLOADS=OFF \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \ -" -LDFLAGS:append:mips = " -Wl,--no-as-needed -latomic -Wl,--as-needed" -LDFLAGS:append:riscv32 = " -Wl,--no-as-needed -latomic -Wl,--as-needed" - -EXTRA_OECMAKE:append:x86 = " -DX86=ON" -# disable sse4.1 and sse4.2 to fix 32bit build failure -# https://github.com/opencv/opencv/issues/21597 -EXTRA_OECMAKE:remove:x86 = "-DENABLE_SSE41=1 -DENABLE_SSE42=1" - -PACKAGECONFIG ??= "gapi python3 eigen jpeg png tiff v4l libv4l gstreamer samples tbb gphoto2 \ - ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \ - ${@bb.utils.contains_any("LICENSE_FLAGS_ACCEPTED", "commercial_ffmpeg commercial", "libav", "", d)}" - -# TBB does not build for powerpc so disable that package config -PACKAGECONFIG:remove:powerpc = "tbb" -# tbb now needs getcontect/setcontext which is not there for all arches on musl -PACKAGECONFIG:remove:libc-musl:riscv64 = "tbb" -PACKAGECONFIG:remove:libc-musl:riscv32 = "tbb" - -PACKAGECONFIG[gapi] = "-DWITH_ADE=ON -Dade_DIR=${STAGING_LIBDIR},-DWITH_ADE=OFF,ade" -PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas," -PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft," -PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF -DCMAKE_CXX_STANDARD=17,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native," -PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog," -PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype," -PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2," -PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base," -PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3," -PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper," -PACKAGECONFIG[java] = "-DJAVA_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native fastjar-native openjdk-8-native," -PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg," -PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav," -PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils," -PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/libopencl1," -PACKAGECONFIG[oracle-java] = "-DJAVA_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${ORACLE_JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native," -PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng," -PACKAGECONFIG[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy," -PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/_core/include,,python3-numpy," -PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,," -PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb," -PACKAGECONFIG[tests] = "-DBUILD_TESTS=ON,-DBUILD_TESTS=OFF,," -PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract," -PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff," -PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils," - -inherit pkgconfig cmake - -inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'setuptools3-base', '', d)} -inherit ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'distutils-base', '', d)} - -export PYTHON_CSPEC = "-I${STAGING_INCDIR}/${PYTHON_DIR}" -export PYTHON = "${STAGING_BINDIR_NATIVE}/${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3', 'python', d)}" -export ORACLE_JAVA_HOME = "${STAGING_DIR_NATIVE}/usr/bin/java" -export JAVA_HOME = "${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native" -export ANT_DIR = "${STAGING_DIR_NATIVE}/usr/share/ant/" - -TARGET_CC_ARCH += "-I${S}/include " - -PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'samples', '${PN}-samples', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'oracle-java', '${PN}-java', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'java', '${PN}-java', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'python-${BPN}', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-${BPN}', '', d)} \ - ${PN}-apps" - -python populate_packages:prepend () { - cv_libdir = d.expand('${libdir}') - do_split_packages(d, cv_libdir, r'^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True) - do_split_packages(d, cv_libdir, r'^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') - do_split_packages(d, cv_libdir, r'^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') - do_split_packages(d, cv_libdir, r'^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True) - - pn = d.getVar('PN') - metapkg = pn + '-dev' - d.setVar('ALLOW_EMPTY:' + metapkg, "1") - blacklist = [ metapkg ] - metapkg_rdepends = [ ] - packages = d.getVar('PACKAGES').split() - for pkg in packages[1:]: - if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'): - metapkg_rdepends.append(pkg) - d.setVar('RRECOMMENDS:' + metapkg, ' '.join(metapkg_rdepends)) - - metapkg = pn - d.setVar('ALLOW_EMPTY:' + metapkg, "1") - blacklist = [ metapkg, "libopencv-ts" ] - metapkg_rdepends = [ ] - for pkg in packages[1:]: - if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') and not pkg.endswith('-locale') and not pkg.endswith('-staticdev'): - metapkg_rdepends.append(pkg) - d.setVar('RDEPENDS:' + metapkg, ' '.join(metapkg_rdepends)) -} - -PACKAGES_DYNAMIC += "^libopencv-.*" - -FILES:${PN} = "" -FILES:${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*" -FILES:${PN}-dev = "${includedir} ${libdir}/pkgconfig ${libdir}/cmake/opencv4/*.cmake" -FILES:${PN}-staticdev += "${libdir}/opencv4/3rdparty/*.a" -FILES:${PN}-apps = "${bindir}/* ${datadir}/opencv4 ${datadir}/licenses" -FILES:${PN}-java = "${datadir}/OpenCV/java" -FILES:${PN}-samples = "${datadir}/opencv4/samples/" - -INSANE_SKIP:${PN}-java = "libdir" -INSANE_SKIP:${PN}-dbg = "libdir" - -ALLOW_EMPTY:${PN} = "1" - -SUMMARY:python-opencv = "Python bindings to opencv" -FILES:python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" -RDEPENDS:python-opencv = "python-core python-numpy" - -SUMMARY:python3-opencv = "Python bindings to opencv" -FILES:python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" -RDEPENDS:python3-opencv = "python3-core python3-numpy" - -RDEPENDS:${PN}-apps = "bash" - -do_compile:prepend() { - # remove the build host info to improve reproducibility - if [ -f ${WORKDIR}/build/modules/core/version_string.inc ]; then - sed -i "s#${WORKDIR}#/workdir#g" ${WORKDIR}/build/modules/core/version_string.inc - fi -} - -do_install:append() { - # Move Python files into correct library folder (for multilib build) - if [ "$libdir" != "/usr/lib" -a -d ${D}/usr/lib ]; then - mv ${D}/usr/lib/* ${D}/${libdir}/ - rm -rf ${D}/usr/lib - fi - # remove build host path to improve reproducibility - if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then - sed -e 's@${STAGING_DIR_HOST}@@g' \ - -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake - fi - # remove setup_vars_opencv4.sh as its content is confusing and useless - if [ -f ${D}${bindir}/setup_vars_opencv4.sh ]; then - rm -rf ${D}${bindir}/setup_vars_opencv4.sh - fi -} - -########## End of meta-openembedded copy ########## - -########## i.MX overrides ########## - -SUMMARY = "Opencv : The Open Computer Vision Library, i.MX Fork" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" - -# Replace the opencv URL with the fork -SRC_URI:remove = "git://github.com/opencv/opencv.git;name=opencv;branch=master;protocol=https" -SRC_URI =+ "${OPENCV_SRC};branch=${SRCBRANCH};name=opencv" -OPENCV_SRC ?= "git://github.com/nxp-imx/opencv-imx.git;protocol=https;branch=master" -SRCBRANCH = "4.6.0_imx" -SRCREV_opencv = "d3440df40a6e90cd1d2a1b729bcbc16aa4d42f5d" - -# Add opencv_extra -SRC_URI += "\ - git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra;branch=master;protocol=https \ - file://0001-Add-smaller-version-of-download_models.py.patch;patchdir=${UNPACKDIR}/extra \ -" -SRCREV_FORMAT:append = "_extra" -SRCREV_extra = "936854e2b666853d6d0732a8eabc2d699f4fa3d8" - -# Patch DNN example -SRC_URI += "\ - file://OpenCV_DNN_examples.patch \ -" - -PACKAGECONFIG:remove = "eigen" - -PACKAGECONFIG:append:mx8-nxp-bsp = " dnn text" -PACKAGECONFIG:append:mx9-nxp-bsp = " dnn text" - -PACKAGECONFIG:append = " ${PACKAGECONFIG_OPENCL}" -PACKAGECONFIG_OPENCL = "" -PACKAGECONFIG_OPENCL:mx8-nxp-bsp = "opencl" -PACKAGECONFIG_OPENCL:mx8dxl-nxp-bsp = "" -PACKAGECONFIG_OPENCL:mx8mm-nxp-bsp = "" -PACKAGECONFIG_OPENCL:mx8mnul-nxp-bsp = "" - -PACKAGECONFIG[openvx] = "-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU',-DWITH_OPENVX=OFF,virtual/libopenvx," -PACKAGECONFIG[qt5] = "-DWITH_QT=ON -DOE_QMAKE_PATH_EXTERNAL_HOST_BINS=${STAGING_BINDIR_NATIVE} -DCMAKE_PREFIX_PATH=${STAGING_BINDIR_NATIVE}/cmake,-DWITH_QT=OFF,qtbase qtbase-native," -PACKAGECONFIG[qt6] = "-DWITH_QT=ON -DQT_HOST_PATH=${RECIPE_SYSROOT_NATIVE}${prefix_native},-DWITH_QT=OFF,qtbase qtbase-native," -PACKAGECONFIG[tests-imx] = "-DINSTALL_TESTS=ON -DOPENCV_TEST_DATA_PATH=${UNPACKDIR}/extra/testdata, -DINSTALL_TESTS=OFF," -PACKAGECONFIG[tim-vx] = "-DWITH_TIMVX=ON -DTIMVX_INSTALL_DIR=${STAGING_DIR_HOST}${libdir},-DWITH_TIMVX=OFF,tim-vx" - -# Disable cvv module in opencv_contrib as it is not yet suppported for Qt6 -# (opencv debug framework) -EXTRA_OECMAKE:append = " -DBUILD_opencv_cvv=OFF" - -do_install:append() { - ln -sf opencv4/opencv2 ${D}${includedir}/opencv2 - if ${@bb.utils.contains('PACKAGECONFIG', 'samples', 'true', 'false', d)}; then - install -d ${D}${datadir}/OpenCV/samples/data - cp -r ${S}/samples/data/* ${D}${datadir}/OpenCV/samples/data - install -d ${D}${datadir}/OpenCV/samples/bin/ - cp -f bin/example_* ${D}${datadir}/OpenCV/samples/bin/ - fi - if ${@bb.utils.contains('PACKAGECONFIG', 'tests-imx', 'true', 'false', d)}; then - cp -r share/opencv4/testdata/cv/face/* ${D}${datadir}/opencv4/testdata/cv/face/ - fi -} - -FILES:${PN}-samples += "${datadir}/OpenCV/samples" - -COMPATIBLE_MACHINE = "(mx8-nxp-bsp|mx9-nxp-bsp)" - -########## End of i.MX overrides ########## -- cgit v1.2.3-54-g00ecf