diff options
| author | CoprDistGit <infra@openeuler.org> | 2026-03-30 06:27:20 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2026-03-30 06:27:20 +0000 |
| commit | de0ae6784abfd457306070c6a071f88eb3e3debd (patch) | |
| tree | e173b883cbeecfb7f7e63f2a6f1a106d1fbd89a8 | |
| parent | 7b7652e716157e0054871c904f060749b76853cd (diff) | |
automatic import of opencv
| -rw-r--r-- | .gitignore | 7 | ||||
| -rw-r--r-- | CVE-2022-0561_and_CVE-2022-0562.patch | 25 | ||||
| -rw-r--r-- | CVE-2022-0908.patch | 15 | ||||
| -rw-r--r-- | Fix-OpenCV-build-with-OpenEXR-before-2.2.0.patch | 55 | ||||
| -rw-r--r-- | Fix_compilation_of_copy_assignment_operators_with_GCC.patch | 109 | ||||
| -rw-r--r-- | Merge-pull-request-21114-from-dwardor-patch-1.patch | 165 | ||||
| -rw-r--r-- | Repair_clang_abi.patch | 39 | ||||
| -rw-r--r-- | calib3d-use-OCV_LAPACK_FUNC.patch | 39 | ||||
| -rw-r--r-- | opencv.spec | 52 | ||||
| -rw-r--r-- | sources | 8 |
10 files changed, 490 insertions, 24 deletions
@@ -1 +1,8 @@ /4.13.0.tar.gz +/opencv-4.5.2.tar.gz +/opencv_extra-4.5.2.tar.gz +/opencv_extra-4.5.2.tar.gz.aa +/opencv_extra-4.5.2.tar.gz.ab +/opencv_extra-4.5.2.tar.gz.ac +/opencv_extra-4.5.2.tar.gz.ad +/opencv_extra-4.5.2.tar.gz.ae diff --git a/CVE-2022-0561_and_CVE-2022-0562.patch b/CVE-2022-0561_and_CVE-2022-0562.patch new file mode 100644 index 0000000..948b057 --- /dev/null +++ b/CVE-2022-0561_and_CVE-2022-0562.patch @@ -0,0 +1,25 @@ +diff -Npur opencv-4.5.2/3rdparty/libtiff/tif_dirread.c opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c +--- opencv-4.5.2/3rdparty/libtiff/tif_dirread.c 2021-04-02 19:23:54.000000000 +0800 ++++ opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c 2022-05-21 14:44:25.639756094 +0800 +@@ -4173,7 +4173,8 @@ TIFFReadDirectory(TIFF* tif) + goto bad; + } + +- memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16)); ++ if (old_extrasamples > 0) ++ memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16)); + _TIFFsetShortArray(&tif->tif_dir.td_sampleinfo, new_sampleinfo, tif->tif_dir.td_extrasamples); + _TIFFfree(new_sampleinfo); + } +@@ -5765,8 +5766,9 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEn + _TIFFfree(data); + return(0); + } +- _TIFFmemcpy(resizeddata,data,(uint32)dir->tdir_count*sizeof(uint64)); +- _TIFFmemset(resizeddata+(uint32)dir->tdir_count,0,(nstrips-(uint32)dir->tdir_count)*sizeof(uint64)); ++ if( dir->tdir_count ) ++ _TIFFmemcpy(resizeddata,data, (uint32)dir->tdir_count * sizeof(uint64)); ++ _TIFFmemset(resizeddata+(uint32)dir->tdir_count, 0, (nstrips - (uint32)dir->tdir_count) * sizeof(uint64)); + _TIFFfree(data); + data=resizeddata; + } diff --git a/CVE-2022-0908.patch b/CVE-2022-0908.patch new file mode 100644 index 0000000..53f2974 --- /dev/null +++ b/CVE-2022-0908.patch @@ -0,0 +1,15 @@ +diff -Npur opencv-4.5.2/3rdparty/libtiff/tif_dirread.c opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c +--- opencv-4.5.2/3rdparty/libtiff/tif_dirread.c 2021-04-02 19:23:54.000000000 +0800 ++++ opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c 2022-05-21 14:36:31.761285562 +0800 +@@ -5079,7 +5079,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEnt + _TIFFfree(data); + return(0); + } +- _TIFFmemcpy(o,data,(uint32)dp->tdir_count); ++ if (dp->tdir_count > 0 ) ++ { ++ _TIFFmemcpy(o,data,(uint32)dp->tdir_count); ++ } + o[(uint32)dp->tdir_count]=0; + if (data!=0) + _TIFFfree(data); diff --git a/Fix-OpenCV-build-with-OpenEXR-before-2.2.0.patch b/Fix-OpenCV-build-with-OpenEXR-before-2.2.0.patch new file mode 100644 index 0000000..3e8126a --- /dev/null +++ b/Fix-OpenCV-build-with-OpenEXR-before-2.2.0.patch @@ -0,0 +1,55 @@ +From 083a7c8f0a71076d4f2f5130d70abaedb2f8c8a5 Mon Sep 17 00:00:00 2001 +From: Alexander Smorkalov <alexander.smorkalov@xperience.ai> +Date: Wed, 28 Apr 2021 10:41:59 +0300 +Subject: [PATCH] Fix OpenCV build with OpenEXR before 2.2.0. + +--- + modules/imgcodecs/include/opencv2/imgcodecs.hpp | 4 ++-- + modules/imgcodecs/src/grfmt_exr.cpp | 3 +++ + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/modules/imgcodecs/include/opencv2/imgcodecs.hpp b/modules/imgcodecs/include/opencv2/imgcodecs.hpp +index 42227f3788..101a944146 100644 +--- a/modules/imgcodecs/include/opencv2/imgcodecs.hpp ++++ b/modules/imgcodecs/include/opencv2/imgcodecs.hpp +@@ -120,8 +120,8 @@ enum ImwriteEXRCompressionFlags { + IMWRITE_EXR_COMPRESSION_PXR24 = 5, //!< lossy 24-bit float compression + IMWRITE_EXR_COMPRESSION_B44 = 6, //!< lossy 4-by-4 pixel block compression, fixed compression rate + IMWRITE_EXR_COMPRESSION_B44A = 7, //!< lossy 4-by-4 pixel block compression, flat fields are compressed more +- IMWRITE_EXR_COMPRESSION_DWAA = 8, //!< lossy DCT based compression, in blocks of 32 scanlines. More efficient for partial buffer access. +- IMWRITE_EXR_COMPRESSION_DWAB = 9, //!< lossy DCT based compression, in blocks of 256 scanlines. More efficient space wise and faster to decode full frames than DWAA_COMPRESSION. ++ IMWRITE_EXR_COMPRESSION_DWAA = 8, //!< lossy DCT based compression, in blocks of 32 scanlines. More efficient for partial buffer access. Supported since OpenEXR 2.2.0. ++ IMWRITE_EXR_COMPRESSION_DWAB = 9, //!< lossy DCT based compression, in blocks of 256 scanlines. More efficient space wise and faster to decode full frames than DWAA_COMPRESSION. Supported since OpenEXR 2.2.0. + }; + + //! Imwrite PNG specific flags used to tune the compression algorithm. +diff --git a/modules/imgcodecs/src/grfmt_exr.cpp b/modules/imgcodecs/src/grfmt_exr.cpp +index aaf28eead6..7acaf434c6 100644 +--- a/modules/imgcodecs/src/grfmt_exr.cpp ++++ b/modules/imgcodecs/src/grfmt_exr.cpp +@@ -64,6 +64,7 @@ + #include <ImfStandardAttributes.h> + #include <half.h> + #include "grfmt_exr.hpp" ++#include "OpenEXRConfig.h" + + #if defined _WIN32 + +@@ -649,12 +650,14 @@ bool ExrEncoder::write( const Mat& img, const std::vector<int>& params ) + case IMWRITE_EXR_COMPRESSION_B44A: + header.compression() = B44A_COMPRESSION; + break; ++#if ((OPENEXR_VERSION_MAJOR * 1000 + OPENEXR_VERSION_MINOR) >= (2 * 1000 + 2)) // available since version 2.2.0 + case IMWRITE_EXR_COMPRESSION_DWAA: + header.compression() = DWAA_COMPRESSION; + break; + case IMWRITE_EXR_COMPRESSION_DWAB: + header.compression() = DWAB_COMPRESSION; + break; ++#endif + default: + CV_Error(Error::StsBadArg, "IMWRITE_EXR_COMPRESSION is invalid or not supported"); + } +-- +2.29.2.windows.2 + diff --git a/Fix_compilation_of_copy_assignment_operators_with_GCC.patch b/Fix_compilation_of_copy_assignment_operators_with_GCC.patch new file mode 100644 index 0000000..ca13ff6 --- /dev/null +++ b/Fix_compilation_of_copy_assignment_operators_with_GCC.patch @@ -0,0 +1,109 @@ +diff -Npur opencv-4.5.2/modules/core/include/opencv2/core/types.hpp opencv-4.5.2-new/modules/core/include/opencv2/core/types.hpp +--- opencv-4.5.2/modules/core/include/opencv2/core/types.hpp 2021-04-02 19:23:54.000000000 +0800 ++++ opencv-4.5.2-new/modules/core/include/opencv2/core/types.hpp 2021-11-13 16:24:25.592720089 +0800 +@@ -162,13 +162,23 @@ public: + //! default constructor + Point_(); + Point_(_Tp _x, _Tp _y); ++#if (defined(__GNUC__) && __GNUC__ < 5) ++ Point_(const Point_& pt); ++ Point_(Point_&& pt) CV_NOEXCEPT = default; ++#elif OPENCV_ABI_COMPATIBILITY < 500 + Point_(const Point_& pt); + Point_(Point_&& pt) CV_NOEXCEPT; ++#endif + Point_(const Size_<_Tp>& sz); + Point_(const Vec<_Tp, 2>& v); + ++#if (defined(__GNUC__) && __GNUC__ < 5) ++ Point_& operator = (const Point_& pt); ++ Point_& operator = (Point_&& pt) CV_NOEXCEPT = default; ++#elif OPENCV_ABI_COMPATIBILITY < 500 + Point_& operator = (const Point_& pt); + Point_& operator = (Point_&& pt) CV_NOEXCEPT; ++#endif + //! conversion to another data type + template<typename _Tp2> operator Point_<_Tp2>() const; + +@@ -244,13 +254,17 @@ public: + //! default constructor + Point3_(); + Point3_(_Tp _x, _Tp _y, _Tp _z); ++#if OPENCV_ABI_COMPATIBILITY < 500 + Point3_(const Point3_& pt); + Point3_(Point3_&& pt) CV_NOEXCEPT; ++#endif + explicit Point3_(const Point_<_Tp>& pt); + Point3_(const Vec<_Tp, 3>& v); + ++#if OPENCV_ABI_COMPATIBILITY < 500 + Point3_& operator = (const Point3_& pt); + Point3_& operator = (Point3_&& pt) CV_NOEXCEPT; ++#endif + //! conversion to another data type + template<typename _Tp2> operator Point3_<_Tp2>() const; + //! conversion to cv::Vec<> +@@ -320,12 +334,16 @@ public: + //! default constructor + Size_(); + Size_(_Tp _width, _Tp _height); ++#if OPENCV_ABI_COMPATIBILITY < 500 + Size_(const Size_& sz); + Size_(Size_&& sz) CV_NOEXCEPT; ++#endif + Size_(const Point_<_Tp>& pt); + ++#if OPENCV_ABI_COMPATIBILITY < 500 + Size_& operator = (const Size_& sz); + Size_& operator = (Size_&& sz) CV_NOEXCEPT; ++#endif + //! the area (width*height) + _Tp area() const; + //! aspect ratio (width/height) +@@ -425,13 +443,17 @@ public: + //! default constructor + Rect_(); + Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height); ++#if OPENCV_ABI_COMPATIBILITY < 500 + Rect_(const Rect_& r); + Rect_(Rect_&& r) CV_NOEXCEPT; ++#endif + Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz); + Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2); + ++#if OPENCV_ABI_COMPATIBILITY < 500 + Rect_& operator = ( const Rect_& r ); + Rect_& operator = ( Rect_&& r ) CV_NOEXCEPT; ++#endif + //! the top-left corner + Point_<_Tp> tl() const; + //! the bottom-right corner +@@ -1164,6 +1186,12 @@ template<typename _Tp> inline + Point_<_Tp>::Point_(_Tp _x, _Tp _y) + : x(_x), y(_y) {} + ++#if (defined(__GNUC__) && __GNUC__ < 5) ++template<typename _Tp> inline ++Point_<_Tp>::Point_(const Point_& pt) ++ : x(pt.x), y(pt.y) {} ++#endif ++ + template<typename _Tp> inline + Point_<_Tp>::Point_(const Point_& pt) + : x(pt.x), y(pt.y) {} +@@ -1180,6 +1208,15 @@ template<typename _Tp> inline + Point_<_Tp>::Point_(const Vec<_Tp,2>& v) + : x(v[0]), y(v[1]) {} + ++#if (defined(__GNUC__) && __GNUC__ < 5) ++template<typename _Tp> inline ++Point_<_Tp>& Point_<_Tp>::operator = (const Point_& pt) ++{ ++ x = pt.x; y = pt.y; ++ return *this; ++} ++#endif ++ + template<typename _Tp> inline + Point_<_Tp>& Point_<_Tp>::operator = (const Point_& pt) + { diff --git a/Merge-pull-request-21114-from-dwardor-patch-1.patch b/Merge-pull-request-21114-from-dwardor-patch-1.patch new file mode 100644 index 0000000..af1ef49 --- /dev/null +++ b/Merge-pull-request-21114-from-dwardor-patch-1.patch @@ -0,0 +1,165 @@ +From 54c180092d2ca02e0460eac7176cab23890fc11e Mon Sep 17 00:00:00 2001 +From: dwardor <50771662+dwardor@users.noreply.github.com> +Date: Wed, 22 Dec 2021 13:00:00 +0100 +Subject: [PATCH] Merge pull request #21114 from dwardor:patch-1 + +* Fix compile against lapack-3.10.0 + +Fix compilation against lapack >= 3.9.1 and 3.10.0 while not breaking older versions + +OpenCVFindLAPACK.cmake & CMakeLists.txt: determine OPENCV_USE_LAPACK_PREFIX from LAPACK_VERSION + +hal_internal.cpp : Only apply LAPACK_FUNC to functions whose number of inputs depends on LAPACK_FORTRAN_STR_LEN in lapack >= 3.9.1 + +lapack_check.cpp : remove LAPACK_FUNC which is not OK as function are not used with input parameters (so lapack.h preprocessing of "LAPACK_xxxx(...)" is not applicable with lapack >= 3.9.1 +If not removed lapack_check fails so LAPACK is deactivated in build (not want we want) + +use OCV_ prefix and don't use Global, instead generate OCV_LAPACK_FUNC depending on CMake Conditions + +Remove CONFIG from find_package(LAPACK) and use LAPACK_GLOBAL and LAPACK_NAME to figure out if using netlib's reference LAPACK implementation and how to #define OCV_LAPACK_FUNC(f) + +* Fix typos and grammar in comments +--- + cmake/OpenCVFindLAPACK.cmake | 17 +++++++++++++++ + modules/core/src/hal_internal.cpp | 36 +++++++++++++++---------------- + 2 files changed, 35 insertions(+), 18 deletions(-) + +diff --git a/cmake/OpenCVFindLAPACK.cmake b/cmake/OpenCVFindLAPACK.cmake +index 342bebc723..3f17b7b289 100644 +--- a/cmake/OpenCVFindLAPACK.cmake ++++ b/cmake/OpenCVFindLAPACK.cmake +@@ -51,6 +51,23 @@ macro(ocv_lapack_check) + if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}") + list(APPEND _lapack_content "#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"") + endif() ++ list(APPEND _lapack_content " ++#if defined(LAPACK_GLOBAL) || defined(LAPACK_NAME) ++/* ++ * Using netlib's reference LAPACK implementation version >= 3.4.0 (first with C interface). ++ * Use LAPACK_xxxx to transparently (via predefined lapack macros) deal with pre and post 3.9.1 versions. ++ * LAPACK 3.9.1 introduces LAPACK_FORTRAN_STRLEN_END and modifies (through preprocessing) the declarations of the following functions used in opencv ++ * sposv_, dposv_, spotrf_, dpotrf_, sgesdd_, dgesdd_, sgels_, dgels_ ++ * which end up with an extra parameter. ++ * So we also need to preprocess the function calls in opencv coding by prefixing them with LAPACK_. ++ * The good news is the preprocessing works fine whatever netlib's LAPACK version. ++ */ ++#define OCV_LAPACK_FUNC(f) LAPACK_##f ++#else ++/* Using other LAPACK implementations so fall back to opencv's assumption until now */ ++#define OCV_LAPACK_FUNC(f) f##_ ++#endif ++") + if(${_lapack_add_extern_c}) + list(APPEND _lapack_content "}") + endif() +diff --git a/modules/core/src/hal_internal.cpp b/modules/core/src/hal_internal.cpp +index 483281d1f7..cbe02780d2 100644 +--- a/modules/core/src/hal_internal.cpp ++++ b/modules/core/src/hal_internal.cpp +@@ -163,9 +163,9 @@ lapack_Cholesky(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n + if(n == 1 && b_step == sizeof(fptype)) + { + if(typeid(fptype) == typeid(float)) +- sposv_(L, &m, &n, (float*)a, &lda, (float*)b, &m, &lapackStatus); ++ OCV_LAPACK_FUNC(sposv)(L, &m, &n, (float*)a, &lda, (float*)b, &m, &lapackStatus); + else if(typeid(fptype) == typeid(double)) +- dposv_(L, &m, &n, (double*)a, &lda, (double*)b, &m, &lapackStatus); ++ OCV_LAPACK_FUNC(dposv)(L, &m, &n, (double*)a, &lda, (double*)b, &m, &lapackStatus); + } + else + { +@@ -174,9 +174,9 @@ lapack_Cholesky(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n + transpose(b, ldb, tmpB, m, m, n); + + if(typeid(fptype) == typeid(float)) +- sposv_(L, &m, &n, (float*)a, &lda, (float*)tmpB, &m, &lapackStatus); ++ OCV_LAPACK_FUNC(sposv)(L, &m, &n, (float*)a, &lda, (float*)tmpB, &m, &lapackStatus); + else if(typeid(fptype) == typeid(double)) +- dposv_(L, &m, &n, (double*)a, &lda, (double*)tmpB, &m, &lapackStatus); ++ OCV_LAPACK_FUNC(dposv)(L, &m, &n, (double*)a, &lda, (double*)tmpB, &m, &lapackStatus); + + transpose(tmpB, m, b, ldb, n, m); + delete[] tmpB; +@@ -185,9 +185,9 @@ lapack_Cholesky(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n + else + { + if(typeid(fptype) == typeid(float)) +- spotrf_(L, &m, (float*)a, &lda, &lapackStatus); ++ OCV_LAPACK_FUNC(spotrf)(L, &m, (float*)a, &lda, &lapackStatus); + else if(typeid(fptype) == typeid(double)) +- dpotrf_(L, &m, (double*)a, &lda, &lapackStatus); ++ OCV_LAPACK_FUNC(dpotrf)(L, &m, (double*)a, &lda, &lapackStatus); + } + + if(lapackStatus == 0) *info = true; +@@ -227,17 +227,17 @@ lapack_SVD(fptype* a, size_t a_step, fptype *w, fptype* u, size_t u_step, fptype + } + + if(typeid(fptype) == typeid(float)) +- sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)&work1, &lwork, iworkBuf, info); ++ OCV_LAPACK_FUNC(sgesdd)(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)&work1, &lwork, iworkBuf, info); + else if(typeid(fptype) == typeid(double)) +- dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)&work1, &lwork, iworkBuf, info); ++ OCV_LAPACK_FUNC(dgesdd)(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)&work1, &lwork, iworkBuf, info); + + lwork = (int)round(work1); //optimal buffer size + fptype* buffer = new fptype[lwork + 1]; + + if(typeid(fptype) == typeid(float)) +- sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)buffer, &lwork, iworkBuf, info); ++ OCV_LAPACK_FUNC(sgesdd)(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)buffer, &lwork, iworkBuf, info); + else if(typeid(fptype) == typeid(double)) +- dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)buffer, &lwork, iworkBuf, info); ++ OCV_LAPACK_FUNC(dgesdd)(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)buffer, &lwork, iworkBuf, info); + + if(!(flags & CV_HAL_SVD_NO_UV)) + transpose_square_inplace(vt, ldv, n); +@@ -288,18 +288,18 @@ lapack_QR(fptype* a, size_t a_step, int m, int n, int k, fptype* b, size_t b_ste + if (k == 1 && b_step == sizeof(fptype)) + { + if (typeid(fptype) == typeid(float)) +- sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)&work1, &lwork, info); ++ OCV_LAPACK_FUNC(sgels)(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)&work1, &lwork, info); + else if (typeid(fptype) == typeid(double)) +- dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)&work1, &lwork, info); ++ OCV_LAPACK_FUNC(dgels)(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)&work1, &lwork, info); + + lwork = cvRound(work1); //optimal buffer size + std::vector<fptype> workBufMemHolder(lwork + 1); + fptype* buffer = &workBufMemHolder.front(); + + if (typeid(fptype) == typeid(float)) +- sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)buffer, &lwork, info); ++ OCV_LAPACK_FUNC(sgels)(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)buffer, &lwork, info); + else if (typeid(fptype) == typeid(double)) +- dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)buffer, &lwork, info); ++ OCV_LAPACK_FUNC(dgels)(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)buffer, &lwork, info); + } + else + { +@@ -309,18 +309,18 @@ lapack_QR(fptype* a, size_t a_step, int m, int n, int k, fptype* b, size_t b_ste + transpose(b, ldb, tmpB, m, m, k); + + if (typeid(fptype) == typeid(float)) +- sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)&work1, &lwork, info); ++ OCV_LAPACK_FUNC(sgels)(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)&work1, &lwork, info); + else if (typeid(fptype) == typeid(double)) +- dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)&work1, &lwork, info); ++ OCV_LAPACK_FUNC(dgels)(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)&work1, &lwork, info); + + lwork = cvRound(work1); //optimal buffer size + std::vector<fptype> workBufMemHolder(lwork + 1); + fptype* buffer = &workBufMemHolder.front(); + + if (typeid(fptype) == typeid(float)) +- sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)buffer, &lwork, info); ++ OCV_LAPACK_FUNC(sgels)(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)buffer, &lwork, info); + else if (typeid(fptype) == typeid(double)) +- dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)buffer, &lwork, info); ++ OCV_LAPACK_FUNC(dgels)(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)buffer, &lwork, info); + + transpose(tmpB, m, b, ldb, k, m); + } +-- +2.20.1 + diff --git a/Repair_clang_abi.patch b/Repair_clang_abi.patch new file mode 100644 index 0000000..e05dd08 --- /dev/null +++ b/Repair_clang_abi.patch @@ -0,0 +1,39 @@ +diff -Npur opencv-4.5.2/modules/core/include/opencv2/core/types.hpp opencv-4.5.2-new/modules/core/include/opencv2/core/types.hpp +--- opencv-4.5.2/modules/core/include/opencv2/core/types.hpp 2021-11-17 10:30:22.631203192 +0800 ++++ opencv-4.5.2-new/modules/core/include/opencv2/core/types.hpp 2021-11-17 10:34:53.117761924 +0800 +@@ -162,7 +162,7 @@ public: + //! default constructor + Point_(); + Point_(_Tp _x, _Tp _y); +-#if (defined(__GNUC__) && __GNUC__ < 5) ++#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) + Point_(const Point_& pt); + Point_(Point_&& pt) CV_NOEXCEPT = default; + #elif OPENCV_ABI_COMPATIBILITY < 500 +@@ -172,7 +172,7 @@ public: + Point_(const Size_<_Tp>& sz); + Point_(const Vec<_Tp, 2>& v); + +-#if (defined(__GNUC__) && __GNUC__ < 5) ++#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) + Point_& operator = (const Point_& pt); + Point_& operator = (Point_&& pt) CV_NOEXCEPT = default; + #elif OPENCV_ABI_COMPATIBILITY < 500 +@@ -1186,7 +1186,7 @@ template<typename _Tp> inline + Point_<_Tp>::Point_(_Tp _x, _Tp _y) + : x(_x), y(_y) {} + +-#if (defined(__GNUC__) && __GNUC__ < 5) ++#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) + template<typename _Tp> inline + Point_<_Tp>::Point_(const Point_& pt) + : x(pt.x), y(pt.y) {} +@@ -1208,7 +1208,7 @@ template<typename _Tp> inline + Point_<_Tp>::Point_(const Vec<_Tp,2>& v) + : x(v[0]), y(v[1]) {} + +-#if (defined(__GNUC__) && __GNUC__ < 5) ++#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) + template<typename _Tp> inline + Point_<_Tp>& Point_<_Tp>::operator = (const Point_& pt) + { diff --git a/calib3d-use-OCV_LAPACK_FUNC.patch b/calib3d-use-OCV_LAPACK_FUNC.patch new file mode 100644 index 0000000..52f6083 --- /dev/null +++ b/calib3d-use-OCV_LAPACK_FUNC.patch @@ -0,0 +1,39 @@ +From 70779d4e66946dca4e0da602f10ec37573b9ac88 Mon Sep 17 00:00:00 2001 +From: Pavel Rojtberg <rojtberg@gmail.com> +Date: Sat, 17 Sep 2022 13:04:42 +0200 +Subject: [PATCH] calib3d: use OCV_LAPACK_FUNC + +--- + modules/calib3d/src/usac/dls_solver.cpp | 2 +- + modules/calib3d/src/usac/essential_solver.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules/calib3d/src/usac/dls_solver.cpp b/modules/calib3d/src/usac/dls_solver.cpp +index 0abb26cecc..8f109d51bf 100644 +--- a/modules/calib3d/src/usac/dls_solver.cpp ++++ b/modules/calib3d/src/usac/dls_solver.cpp +@@ -160,7 +160,7 @@ public: + double wr[27], wi[27] = {0}; // 27 = mat_order + std::vector<double> work(lwork), eig_vecs(729); + char jobvl = 'N', jobvr = 'V'; // only left eigen vectors are computed +- dgeev_(&jobvl, &jobvr, &mat_order, (double*)solution_polynomial.data, &lda, wr, wi, nullptr, &ldvl, ++ OCV_LAPACK_FUNC(dgeev)(&jobvl, &jobvr, &mat_order, (double*)solution_polynomial.data, &lda, wr, wi, nullptr, &ldvl, + &eig_vecs[0], &ldvr, &work[0], &lwork, &info); + if (info != 0) return 0; + #endif +diff --git a/modules/calib3d/src/usac/essential_solver.cpp b/modules/calib3d/src/usac/essential_solver.cpp +index 0adca0966f..014cd36f40 100644 +--- a/modules/calib3d/src/usac/essential_solver.cpp ++++ b/modules/calib3d/src/usac/essential_solver.cpp +@@ -161,7 +161,7 @@ public: + int mat_order = 10, info, lda = 10, ldvl = 10, ldvr = 1, lwork = 100; + double wr[10], wi[10] = {0}, eig_vecs[100], work[100]; // 10 = mat_order, 100 = lwork + char jobvl = 'V', jobvr = 'N'; // only left eigen vectors are computed +- dgeev_(&jobvl, &jobvr, &mat_order, action_mat_data, &lda, wr, wi, eig_vecs, &ldvl, ++ OCV_LAPACK_FUNC(dgeev)(&jobvl, &jobvr, &mat_order, action_mat_data, &lda, wr, wi, eig_vecs, &ldvl, + nullptr, &ldvr, work, &lwork, &info); + if (info != 0) return 0; + #endif +-- +2.20.1 + diff --git a/opencv.spec b/opencv.spec index 87491e4..c2544dd 100644 --- a/opencv.spec +++ b/opencv.spec @@ -1,10 +1,23 @@ Name: opencv -Version: 4.13.0 -Release: 1 +Version: 4.5.2 +Release: 9 Summary: OpenCV means IntelĀ® Open Source Computer Vision Library. License: Apache-2.0 URL: https://github.com/opencv/opencv -Source0: https://github.com/opencv/opencv/archive/refs/tags/%{version}.tar.gz +Source0: %{name}-%{version}.tar.gz +Source1: %{name}_extra-%{version}.tar.gz +Source2: opencv_extra-4.5.2.tar.gz.aa +Source3: opencv_extra-4.5.2.tar.gz.ab +Source4: opencv_extra-4.5.2.tar.gz.ac +Source5: opencv_extra-4.5.2.tar.gz.ad +Source6: opencv_extra-4.5.2.tar.gz.ae +Patch1: Fix-OpenCV-build-with-OpenEXR-before-2.2.0.patch +Patch2: Fix_compilation_of_copy_assignment_operators_with_GCC.patch +Patch3: Repair_clang_abi.patch +Patch4: CVE-2022-0561_and_CVE-2022-0562.patch +Patch5: CVE-2022-0908.patch +Patch6: Merge-pull-request-21114-from-dwardor-patch-1.patch +Patch7: calib3d-use-OCV_LAPACK_FUNC.patch BuildRequires: qt5-qtbase-devel BuildRequires: gcc-c++ gcc autoconf pkgconfig protobuf-compiler protobuf @@ -22,7 +35,10 @@ and Computer Vision algorithms. %global debug_package %{nil} %prep -%autosetup -n %{name}-%{version} +cat %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} > %{SOURCE1} +%autosetup -p1 -n %{name}-%{version} +tar -xvf %{SOURCE1} -C . +pwd %build mkdir -p cmake/build @@ -36,12 +52,13 @@ cmake ../../ -DCMAKE_BUILD_TYPE=Release\ -DBUILD_JPEG=ON\ -DBUILD_PNG=ON\ -DBUILD_OPENEXR=ON\ - -DBUILD_TESTS=OFF\ + -DBUILD_TESTS=ON\ -DBUILD_PERF_TESTS=OFF\ -DBUILD_opencv_apps=OFF\ -DWITH_CUDA=OFF\ -DBUILD_JAVA=ON\ -DBUILD_opencv_dnn=ON\ + -DBUILD_opencv_dnn_modern=ON\ -DBUILD_opencv_face=ON\ -DBUILD_opencv_python3=ON\ -DBUILD_opencv_python2=OFF\ @@ -55,8 +72,9 @@ cmake ../../ -DCMAKE_BUILD_TYPE=Release\ -DWITH_JASPER=OFF\ -DBUILD_JASPER=OFF\ -DBUILD_SHARED_LIBS=ON\ - -DBUILD_EXAMPLES=OFF\ - -DINSTALL_TESTS=OFF\ + -DBUILD_EXAMPLES=ON\ + -DOPENCV_TEST_DATA_PATH=%_builddir/%{name}-%{version}/opencv_extra-%{version}/testdata\ + -DINSTALL_TESTS=ON\ -DPYTHON3_EXECUTABLE=$(which python3)\ -DPYTHON_EXECUTABLE=$(which python3)\ -DPYTHON_DEFAULT_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")\ @@ -70,7 +88,9 @@ cmake ../../ -DCMAKE_BUILD_TYPE=Release\ -DCMAKE_INSTALL_PREFIX=/usr \ -DOPENCV_CONFIG_INSTALL_PATH=%{_lib}/cmake/OpenCV \ -DOPENCV_GENERATE_PKGCONFIG=ON -make -j$(nproc) V=1 +make -j24 V=1 +ctest -E "opencv_test_objdetect|opencv_test_photo|opencv_test_highgui" + %install cd cmake/build @@ -86,20 +106,6 @@ make install DESTDIR=%{buildroot} %{python3_sitelib}/cv2/* %changelog -* Tue Mar 25 2025 Claude Code <noreply@anthropic.com> - 4.13.0-1 -- Upgrade to 4.13.0 -- Remove all patches (fixed upstream): - - CVE-2022-0561_and_CVE-2022-0562.patch (libtiff CVE fixed) - - CVE-2022-0908.patch (libtiff CVE fixed) - - Fix-OpenCV-build-with-OpenEXR-before-2.2.0.patch (merged) - - Fix_compilation_of_copy_assignment_operators_with_GCC.patch (code improved) - - Repair_clang_abi.patch (code restructured) - - Merge-pull-request-21114-from-dwardor-patch-1.patch (OCV_LAPACK_FUNC merged) - - calib3d-use-OCV_LAPACK_FUNC.patch (merged) -- Remove opencv_extra (not needed for BUILD_TESTS=OFF) -- Remove deprecated BUILD_opencv_dnn_modern option -- Use make -j$(nproc) for parallel build - * Wed Nov 22 2023 konglidong <konglidong@uniontech.com> - 4.5.2-9 - backport upstraem patch to fix build failed @@ -114,7 +120,7 @@ make install DESTDIR=%{buildroot} - add pkgconfig file * Thu Jan 27 2022 douyan <douyan@kylinos.cn> - 4.5.2-5 -- use %%{python3_sitelib} instead of /usr/lib/python3.8/site-packages +- use %{python3_sitelib} instead of /usr/lib/python3.8/site-packages * Wed Nov 17 2021 shenwei <shenwei41@huawei.com> - 4.5.2-4 - repair Clang ABI @@ -1 +1,7 @@ -f33c0ace3add57aba7b9d3fe3c41feb4 4.13.0.tar.gz +d3141f649ab2d76595fdd8991ee15c55 opencv-4.5.2.tar.gz +51b871f0d93f49b5c650a13825a10739 opencv_extra-4.5.2.tar.gz +ce41f1402b0de9dd24fd1faf578cb527 opencv_extra-4.5.2.tar.gz.aa +d9560b4ebbaf65c7224ffef4be6c84da opencv_extra-4.5.2.tar.gz.ab +df178d73aac22b03d5a57f89c290d660 opencv_extra-4.5.2.tar.gz.ac +0395fb0414fc52b1c7116763ec59387d opencv_extra-4.5.2.tar.gz.ad +c5eee07125d32e751ea09ae5bde92253 opencv_extra-4.5.2.tar.gz.ae |
