mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-21 22:47:14 -08:00
media-libs/opencv: remove unused patches
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net> Signed-off-by: Florian Schmaus <flow@gentoo.org>
This commit is contained in:
@@ -1,272 +0,0 @@
|
||||
https://github.com/opencv/opencv/pull/24203
|
||||
|
||||
From 689fa6f372975d58e9f50fd17a0abd105b1815f1 Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Mon, 28 Aug 2023 04:20:58 +0100
|
||||
Subject: [PATCH] Fix compilation on arm64 with FP16 when disabled
|
||||
|
||||
If building with -mcpu=native or any other setting which implies the current
|
||||
CPU has FP16 but with intrinsics disabled, we mistakenly try to use it even
|
||||
though convolution.hpp conditionally defines it correctly based on whether
|
||||
we should *use it*. convolution.cpp on the other hand was mismatched and
|
||||
trying to use it if the CPU supported it, even if not enabled in the build
|
||||
system.
|
||||
|
||||
Make the guards match.
|
||||
|
||||
Bug: https://bugs.gentoo.org/913031
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
--- a/modules/dnn/src/layers/cpu_kernels/convolution.cpp
|
||||
+++ b/modules/dnn/src/layers/cpu_kernels/convolution.cpp
|
||||
@@ -118,7 +118,7 @@ Ptr<FastConv> initFastConv(
|
||||
const size_t wstep = weightsMat.step1();
|
||||
|
||||
conv->useFP16 = false;
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
// TODO: add FP16 support for Winograd.
|
||||
if (_useFP16 && (conv->conv_type == CONV_TYPE_GENERIC || conv->conv_type == CONV_TYPE_DEPTHWISE_REMAIN))
|
||||
conv->useFP16 = true;
|
||||
@@ -137,7 +137,7 @@ Ptr<FastConv> initFastConv(
|
||||
int padded_ksize = ((ksize + VEC_ALIGN-1) / VEC_ALIGN) * VEC_ALIGN;
|
||||
int nweights = C * padded_ksize;
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (conv->useFP16)
|
||||
{
|
||||
conv->weightsBuf_FP16.resize(nweights + VEC_ALIGN);
|
||||
@@ -190,7 +190,7 @@ Ptr<FastConv> initFastConv(
|
||||
#endif
|
||||
const int CONV_WINO_NATOMS_F32 = CONV_WINO_AREA / CONV_WINO_ATOM_F32; // for AVX2, it is 8, otherwise, it's 16.
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
// FP 16
|
||||
const int CONV_WINO_ATOM_F16 = CONV_WINO_ATOM_F32 * 2;
|
||||
const int CONV_WINO_NATOMS_F16 = CONV_WINO_AREA / CONV_WINO_ATOM_F16;
|
||||
@@ -208,7 +208,7 @@ Ptr<FastConv> initFastConv(
|
||||
size_t nweights = ngroups*Kg_nblocks*Cg*CONV_WINO_KBLOCK*CONV_WINO_AREA;
|
||||
|
||||
float* wptrWino = nullptr;
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
float16_t* wptrWino_FP16 = nullptr;
|
||||
if (conv->useFP16)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ Ptr<FastConv> initFastConv(
|
||||
}
|
||||
|
||||
// repack the data.
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (conv->useFP16)
|
||||
{
|
||||
float16_t* wptr = wptrWino_FP16 + (g*Kg_nblocks + ki) * Cg *CONV_WINO_KBLOCK*CONV_WINO_AREA +
|
||||
@@ -308,7 +308,7 @@ Ptr<FastConv> initFastConv(
|
||||
|
||||
float* weightsBufPtr = nullptr;
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
int numStripsMR_FP16 = (Kg + CONV_MR_FP16 - 1) / CONV_MR_FP16;
|
||||
int Kg_aligned_FP16 = numStripsMR_FP16 * CONV_MR_FP16;
|
||||
size_t nweights_FP16 = ngroups * Kg_aligned_FP16 * DkHkWkCg;
|
||||
@@ -331,7 +331,7 @@ Ptr<FastConv> initFastConv(
|
||||
}
|
||||
|
||||
// Pack the weight.
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (conv->useFP16)
|
||||
{
|
||||
parallel_for_(Range(0, ngroups * numStripsMR_FP16), [&](const Range& r0){
|
||||
@@ -415,7 +415,7 @@ static inline void packData8(char*& inpbuf, float*& inptrIn, int& in_w, int& x0,
|
||||
char * inpbufC = inpbuf + s0 * esz;
|
||||
float* inptrInC = (float* )inptrIn;
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
float16_t* inpbufC_FP16 = (float16_t *)inpbufC;
|
||||
if (esz == sizeof(float16_t))
|
||||
{
|
||||
@@ -521,7 +521,7 @@ static inline void packData2(char *& inpbuf, float*& inptrIn, int& in_w, int& x0
|
||||
char* inpbufC = inpbuf + s0 * esz;
|
||||
float* inptrInC = inptrIn;
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
float16_t* inpbufC_FP16 = (float16_t *)inpbufC;
|
||||
if (esz == sizeof(float16_t))
|
||||
{
|
||||
@@ -553,7 +553,7 @@ static inline void packData2(char *& inpbuf, float*& inptrIn, int& in_w, int& x0
|
||||
in_w += stride_w;
|
||||
}
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
// Fast convert float 32 to float16
|
||||
static inline void _cvt32f16f( const float* src, float16_t* dst, int len)
|
||||
{
|
||||
@@ -623,7 +623,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
{
|
||||
// Make special branch where memcpy() is called with a constant buffer size.
|
||||
// Compilers will likely unroll this loop properly.
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inptr += inp_planesize, inpbuf += CONV_NR_esz)
|
||||
@@ -636,7 +636,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
}
|
||||
else
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inptr += inp_planesize, inpbuf += CONV_NR_esz)
|
||||
@@ -700,7 +700,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
int w0 = std::max(0, (-in_w + dilation_w-1)/dilation_w);
|
||||
int w1 = std::min(Wk, (Wi - in_w + dilation_w-1)/dilation_w);
|
||||
const float* inptrInC = inptrIn;
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
float16_t* inpbufC = (float16_t *)inpbuf + s0;
|
||||
@@ -761,7 +761,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
int w1 = std::min(Wk, (Wi - in_w + dilation_w-1)/dilation_w);
|
||||
|
||||
const float* inptrInC = inptrIn;
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
float16_t* inpbufC = (float16_t *)inpbuf + s0;
|
||||
@@ -834,7 +834,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
int w0 = std::max(0, (-in_w + dilation_w-1)/dilation_w);
|
||||
int w1 = std::min(Wk, (Wi - in_w + dilation_w-1)/dilation_w);
|
||||
const float* inptrInC = inptrIn;
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
float16_t* inpbufC = (float16_t* )inpbuf + s0;
|
||||
@@ -887,7 +887,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
for (; i < CONV_NR;)
|
||||
{
|
||||
float* inpbuf_ki = (float* )inpbuf + k * CONV_NR * Cg + i;
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
float16_t * inpbuf_ki_FP16 = (float16_t *)inpbuf + k * CONV_NR * Cg + i;
|
||||
#endif
|
||||
|
||||
@@ -903,7 +903,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
{
|
||||
if (stride_w == 1)
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
|
||||
@@ -934,7 +934,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
}
|
||||
else if (stride_w == 2)
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
|
||||
@@ -967,7 +967,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
}
|
||||
else
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
|
||||
@@ -1006,7 +1006,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
{
|
||||
if (stride_w == 1)
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
|
||||
@@ -1029,7 +1029,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
}
|
||||
else
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
|
||||
@@ -1057,7 +1057,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
}
|
||||
else
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
|
||||
@@ -1073,7 +1073,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
|
||||
}
|
||||
else
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR)
|
||||
@@ -1260,7 +1260,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
|
||||
int CONV_MR = CONV_MR_FP32;
|
||||
int esz = sizeof(float );
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
// works at FP 16.
|
||||
@@ -1433,7 +1433,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
|
||||
}
|
||||
|
||||
char *weights = nullptr;
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
CV_Assert(!conv->weightsBuf_FP16.empty());
|
||||
@@ -1474,7 +1474,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
|
||||
#if CV_NEON && CV_NEON_AARCH64
|
||||
if (conv->useNEON)
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
opt_NEON::convBlockMR1_FP16(DkHkWkCg, weights, inptr, cptr, biasVal, fusedAdd, minval, maxval, ifMinMaxAct, outLen, CONV_NR);
|
||||
@@ -1537,7 +1537,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
|
||||
#if CV_NEON
|
||||
if (conv->useNEON)
|
||||
{
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
opt_NEON::convBlock_FP16(c1 - c0, wptr, inptr, (char *)cptr_f16, ldc, c0 == 0, outLen, CONV_MR, CONV_NR);
|
||||
@@ -1567,7 +1567,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
|
||||
float biasval = biasptr[k];
|
||||
int j = 0;
|
||||
|
||||
-#ifdef CONV_ARM_FP16
|
||||
+#if defined(CONV_ARM_FP16) && CV_FP16
|
||||
if (useFP16)
|
||||
{
|
||||
float32x4_t vbias = vdupq_n_f32(biasval);
|
||||
@@ -1,40 +0,0 @@
|
||||
https://github.com/opencv/opencv/pull/24104
|
||||
https://github.com/opencv/opencv/commit/5466fd2606ca6df57bbe43f064d2ae73fe4329eb
|
||||
https://bugs.gentoo.org/915775
|
||||
|
||||
From ab8cb6f8a9034da2a289b84685c6d959266029be Mon Sep 17 00:00:00 2001
|
||||
From: cudawarped <12133430+cudawarped@users.noreply.github.com>
|
||||
Date: Tue, 1 Aug 2023 13:02:42 +0300
|
||||
Subject: [PATCH] cuda: fix for compatibility with CUDA Toolkit >= 12.2.0
|
||||
|
||||
---
|
||||
modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp | 2 +-
|
||||
modules/dnn/src/cuda4dnn/primitives/region.hpp | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp b/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp
|
||||
index f067dddaa701..91ff33f81718 100644
|
||||
--- a/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp
|
||||
+++ b/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp
|
||||
@@ -111,7 +111,7 @@ namespace cv { namespace dnn { namespace cuda4dnn {
|
||||
* or there might be several weights
|
||||
* or we don't have to scale
|
||||
*/
|
||||
- if (weight != 1.0)
|
||||
+ if (weight != static_cast<T>(1.0f))
|
||||
{
|
||||
kernels::scale1_with_bias1<T>(stream, output, input, weight, 1.0);
|
||||
}
|
||||
diff --git a/modules/dnn/src/cuda4dnn/primitives/region.hpp b/modules/dnn/src/cuda4dnn/primitives/region.hpp
|
||||
index d22d44214e7b..3af05155feea 100644
|
||||
--- a/modules/dnn/src/cuda4dnn/primitives/region.hpp
|
||||
+++ b/modules/dnn/src/cuda4dnn/primitives/region.hpp
|
||||
@@ -121,7 +121,7 @@ namespace cv { namespace dnn { namespace cuda4dnn {
|
||||
new_coords
|
||||
);
|
||||
|
||||
- if (nms_iou_threshold > 0) {
|
||||
+ if (nms_iou_threshold > static_cast<T>(0.0f)) {
|
||||
auto output_mat = output_wrapper->getMutableHostMat();
|
||||
CV_Assert(output_mat.type() == CV_32F);
|
||||
for (int i = 0; i < input.get_axis_size(0); i++) {
|
||||
@@ -1,18 +0,0 @@
|
||||
From: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
|
||||
Use tar.gz instead of zip to make CI happy.
|
||||
|
||||
diff --git a/modules/gapi/cmake/DownloadADE.cmake b/modules/gapi/cmake/DownloadADE.cmake
|
||||
index e22c4f1..fb0c10a 100644
|
||||
--- a/modules/gapi/cmake/DownloadADE.cmake
|
||||
+++ b/modules/gapi/cmake/DownloadADE.cmake
|
||||
@@ -1,7 +1,7 @@
|
||||
set(ade_src_dir "${OpenCV_BINARY_DIR}/3rdparty/ade")
|
||||
-set(ade_filename "v0.1.2a.zip")
|
||||
+set(ade_filename "v0.1.2a.tar.gz")
|
||||
set(ade_subdir "ade-0.1.2a")
|
||||
-set(ade_md5 "fa4b3e25167319cb0fa9432ef8281945")
|
||||
+set(ade_md5 "89fd5f32c2796d3fecf62273c4aa7c4d")
|
||||
ocv_download(FILENAME ${ade_filename}
|
||||
HASH ${ade_md5}
|
||||
URL
|
||||
@@ -1,23 +0,0 @@
|
||||
From: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
|
||||
Python2 is long gone. So don't try finding it.
|
||||
|
||||
diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
|
||||
index 599b2eb..345e3ef 100644
|
||||
--- a/cmake/OpenCVDetectPython.cmake
|
||||
+++ b/cmake/OpenCVDetectPython.cmake
|
||||
@@ -268,14 +268,6 @@ if(OPENCV_PYTHON_SKIP_DETECTION)
|
||||
return()
|
||||
endif()
|
||||
|
||||
-find_python("" "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
|
||||
- PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
|
||||
- PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
|
||||
- PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
|
||||
- PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
|
||||
- PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
|
||||
- PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)
|
||||
-
|
||||
option(OPENCV_PYTHON3_VERSION "Python3 version" "")
|
||||
find_python("${OPENCV_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
|
||||
PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING
|
||||
@@ -1,36 +0,0 @@
|
||||
https://github.com/opencv/opencv/pull/23991
|
||||
|
||||
From 4ee0f212cc19f7e77483d34d4cf8378945e3da31 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E4=B8=8D=E9=B1=BC=E5=84=BF?=
|
||||
<36976072+buyuer@users.noreply.github.com>
|
||||
Date: Fri, 14 Jul 2023 08:45:14 +0000
|
||||
Subject: [PATCH] Eliminating compilation warnings when using lto in gcc12 and
|
||||
later versions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
use -flto=auto when use gcc12 or later
|
||||
|
||||
Signed-off-by: 不鱼儿 <36976072+buyuer@users.noreply.github.com>
|
||||
---
|
||||
cmake/OpenCVCompilerOptions.cmake | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake
|
||||
index d4600943fb0d..8bd86681303e 100644
|
||||
--- a/cmake/OpenCVCompilerOptions.cmake
|
||||
+++ b/cmake/OpenCVCompilerOptions.cmake
|
||||
@@ -261,7 +261,11 @@ if(CV_GCC OR CV_CLANG)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LTO)
|
||||
- add_extra_compiler_option(-flto)
|
||||
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
|
||||
+ add_extra_compiler_option(-flto=auto)
|
||||
+ else()
|
||||
+ add_extra_compiler_option(-flto)
|
||||
+ endif()
|
||||
endif()
|
||||
if(ENABLE_THIN_LTO)
|
||||
add_extra_compiler_option(-flto=thin)
|
||||
@@ -1,58 +0,0 @@
|
||||
From: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
|
||||
Gentoo installs libpng as libpng16, so adjust the detection.
|
||||
|
||||
diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
|
||||
index 46b5108..0ff88ea 100644
|
||||
--- a/cmake/OpenCVFindLibsGrfmt.cmake
|
||||
+++ b/cmake/OpenCVFindLibsGrfmt.cmake
|
||||
@@ -245,9 +245,9 @@ if(NOT HAVE_SPNG AND WITH_PNG)
|
||||
include(FindPNG)
|
||||
if(PNG_FOUND)
|
||||
include(CheckIncludeFile)
|
||||
- check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
|
||||
- if(HAVE_LIBPNG_PNG_H)
|
||||
- ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
+ check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng16/png.h" HAVE_LIBPNG16_PNG_H)
|
||||
+ if(HAVE_LIBPNG16_PNG_H)
|
||||
+ ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/libpng16/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
else()
|
||||
ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
endif()
|
||||
@@ -255,7 +255,7 @@ if(NOT HAVE_SPNG AND WITH_PNG)
|
||||
endif()
|
||||
|
||||
if(NOT PNG_FOUND)
|
||||
- ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG_PNG_H PNG_DEFINITIONS)
|
||||
+ ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG16_PNG_H PNG_DEFINITIONS)
|
||||
|
||||
set(PNG_LIBRARY libpng CACHE INTERNAL "")
|
||||
set(PNG_LIBRARIES ${PNG_LIBRARY})
|
||||
diff --git a/cmake/templates/cvconfig.h.in b/cmake/templates/cvconfig.h.in
|
||||
index d6c7875..005e9b3 100644
|
||||
--- a/cmake/templates/cvconfig.h.in
|
||||
+++ b/cmake/templates/cvconfig.h.in
|
||||
@@ -79,7 +79,7 @@
|
||||
#cmakedefine HAVE_JPEG
|
||||
|
||||
/* libpng/png.h needs to be included */
|
||||
-#cmakedefine HAVE_LIBPNG_PNG_H
|
||||
+#cmakedefine HAVE_LIBPNG16_PNG_H
|
||||
|
||||
/* GDCM DICOM codec */
|
||||
#cmakedefine HAVE_GDCM
|
||||
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
|
||||
index 388a3fc..4dde181 100644
|
||||
--- a/modules/imgcodecs/src/grfmt_png.cpp
|
||||
+++ b/modules/imgcodecs/src/grfmt_png.cpp
|
||||
@@ -58,8 +58,8 @@
|
||||
# define _FILE_OFFSET_BITS 0
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_LIBPNG_PNG_H
|
||||
-#include <libpng/png.h>
|
||||
+#ifdef HAVE_LIBPNG16_PNG_H
|
||||
+#include <libpng16/png.h>
|
||||
#else
|
||||
#include <png.h>
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
From: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
|
||||
We don't package quirc, so the misplaced #ifdef breaks compilation.
|
||||
|
||||
diff --git a/modules/objdetect/test/test_qrcode.cpp b/modules/objdetect/test/test_qrcode.cpp
|
||||
index 5e6ec6f..6dc14cc 100644
|
||||
--- a/modules/objdetect/test/test_qrcode.cpp
|
||||
+++ b/modules/objdetect/test/test_qrcode.cpp
|
||||
@@ -374,8 +374,8 @@ TEST_P(Objdetect_QRCode_Multi, regression)
|
||||
qrcode = QRCodeDetectorAruco();
|
||||
}
|
||||
std::vector<Point> corners;
|
||||
-#ifdef HAVE_QUIRC
|
||||
std::vector<cv::String> decoded_info;
|
||||
+#ifdef HAVE_QUIRC
|
||||
std::vector<Mat> straight_barcode;
|
||||
EXPECT_TRUE(qrcode.detectAndDecodeMulti(src, decoded_info, corners, straight_barcode));
|
||||
ASSERT_FALSE(corners.empty());
|
||||
@@ -1,190 +0,0 @@
|
||||
From 6f3dde396f6eed53afcd5cc882402e18ff7c1ca8 Mon Sep 17 00:00:00 2001
|
||||
From: Kumataro <Kumataro@users.noreply.github.com>
|
||||
Date: Sat, 7 Oct 2023 10:11:25 +0900
|
||||
Subject: [PATCH] 3rdparty: supporting protobuf v22 and later
|
||||
|
||||
subsumes:
|
||||
|
||||
- dnn: disable some tests for external protobuf
|
||||
- use GREATER instead of GREATER_EQUAL and remove new blank line at EOF
|
||||
- fix for BUILD_TESTS=OFF
|
||||
- Use Config mode in CMake.
|
||||
|
||||
(cleaning up review noise)
|
||||
|
||||
---
|
||||
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 8835347..5b1e175 100644
|
||||
--- a/cmake/OpenCVFindProtobuf.cmake
|
||||
+++ b/cmake/OpenCVFindProtobuf.cmake
|
||||
@@ -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()
|
||||
|
||||
+# See https://github.com/opencv/opencv/issues/24369
|
||||
+# 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(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()
|
||||
@@ -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()
|
||||
+
|
||||
+ 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 804b78e..9fcc460 100644
|
||||
--- a/modules/dnn/CMakeLists.txt
|
||||
+++ b/modules/dnn/CMakeLists.txt
|
||||
@@ -245,6 +245,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs})
|
||||
ocv_add_samples()
|
||||
ocv_add_accuracy_tests(${dnn_runtime_libs})
|
||||
|
||||
+if(NOT BUILD_PROTOBUF)
|
||||
+ if(TARGET opencv_test_dnn)
|
||||
+ ocv_target_compile_definitions(opencv_test_dnn PRIVATE "OPENCV_DNN_EXTERNAL_PROTOBUF=1")
|
||||
+ endif()
|
||||
+endif()
|
||||
+
|
||||
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/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp
|
||||
index 763d94b..6cb6d54 100644
|
||||
--- a/modules/dnn/test/test_layers.cpp
|
||||
+++ b/modules/dnn/test/test_layers.cpp
|
||||
@@ -756,11 +756,15 @@ TEST_F(Layer_RNN_Test, get_set_test)
|
||||
|
||||
TEST_P(Test_Caffe_layers, Accum)
|
||||
{
|
||||
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
|
||||
+ throw SkipTestException("Requires patched protobuf");
|
||||
+#else
|
||||
if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
|
||||
|
||||
testLayerUsingCaffeModels("accum", false, false, 0.0, 0.0, 2);
|
||||
testLayerUsingCaffeModels("accum_ref", false, false, 0.0, 0.0, 2);
|
||||
+#endif
|
||||
}
|
||||
|
||||
TEST_P(Test_Caffe_layers, FlowWarp)
|
||||
@@ -780,27 +784,39 @@ TEST_P(Test_Caffe_layers, ChannelNorm)
|
||||
|
||||
TEST_P(Test_Caffe_layers, DataAugmentation)
|
||||
{
|
||||
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
|
||||
+ throw SkipTestException("Requires patched protobuf");
|
||||
+#else
|
||||
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
|
||||
testLayerUsingCaffeModels("data_augmentation", true, false);
|
||||
testLayerUsingCaffeModels("data_augmentation_2x1", true, false);
|
||||
testLayerUsingCaffeModels("data_augmentation_8x6", true, false);
|
||||
+#endif
|
||||
}
|
||||
|
||||
TEST_P(Test_Caffe_layers, Resample)
|
||||
{
|
||||
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
|
||||
+ throw SkipTestException("Requires patched protobuf");
|
||||
+#else
|
||||
if (backend != DNN_BACKEND_OPENCV)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
|
||||
testLayerUsingCaffeModels("nearest_2inps", false, false, 0.0, 0.0, 2);
|
||||
testLayerUsingCaffeModels("nearest", false, false);
|
||||
+#endif
|
||||
}
|
||||
|
||||
TEST_P(Test_Caffe_layers, Correlation)
|
||||
{
|
||||
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
|
||||
+ throw SkipTestException("Requires patched protobuf");
|
||||
+#else
|
||||
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,
|
||||
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)
|
||||
@@ -1641,12 +1657,11 @@ private:
|
||||
int outWidth, outHeight, zoomFactor;
|
||||
};
|
||||
|
||||
-#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
|
||||
TEST_P(Test_Caffe_layers, Interp)
|
||||
-#else
|
||||
-TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (available in OpenCV source tree only)
|
||||
-#endif
|
||||
{
|
||||
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
|
||||
+ throw SkipTestException("Requires patched protobuf");
|
||||
+#else
|
||||
#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);
|
||||
+#endif
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_Caffe_layers, dnnBackendsAndTargets());
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
https://github.com/opencv/opencv/pull/23991
|
||||
|
||||
From 00ca8f455e6a5588d905e3a0b268f18ee3fda5dd Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
|
||||
Date: Sun, 1 Oct 2023 16:12:25 +0100
|
||||
Subject: [PATCH] `numpy.distutils` is removed in numpy 1.26 on Python 3.12.
|
||||
|
||||
so we don't use numpy.distutils to get includes dirs of python-numpy
|
||||
---
|
||||
cmake/OpenCVDetectPython.cmake | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
|
||||
index 88a434185622..d4098ce8e60d 100644
|
||||
--- a/cmake/OpenCVDetectPython.cmake
|
||||
+++ b/cmake/OpenCVDetectPython.cmake
|
||||
@@ -216,7 +216,7 @@ if(NOT ${found})
|
||||
message(STATUS " PYTHON3_NUMPY_INCLUDE_DIRS")
|
||||
else()
|
||||
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
|
||||
- execute_process(COMMAND "${_executable}" -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print(os.pathsep.join(numpy.distutils.misc_util.get_numpy_include_dirs()))"
|
||||
+ execute_process(COMMAND "${_executable}" -c "import numpy; print(numpy.get_include())"
|
||||
RESULT_VARIABLE _numpy_process
|
||||
OUTPUT_VARIABLE _numpy_include_dirs
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
Reference in New Issue
Block a user