summaryrefslogtreecommitdiff
path: root/media-libs/opencv/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-06-29 11:38:31 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-06-29 11:38:31 +0100
commit90c88731bd036e5698b281fbc0a5f3aa4c9983ac (patch)
tree83fc5facb6b12be510a37bc3d241cc63e965b13a /media-libs/opencv/files
parentfeb0daf81d888e9160f9f94502de09b66f2a63fd (diff)
gentoo resync : 29.06.2020
Diffstat (limited to 'media-libs/opencv/files')
-rw-r--r--media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch10
-rw-r--r--media-libs/opencv/files/opencv-2.4.13-gcc-6.0.patch23
-rw-r--r--media-libs/opencv/files/opencv-2.4.13-imgcodecs-refactoring.patch580
-rw-r--r--media-libs/opencv/files/opencv-2.4.2-cflags.patch21
-rw-r--r--media-libs/opencv/files/opencv-2.4.3-gcc47.patch22
-rw-r--r--media-libs/opencv/files/opencv-2.4.8-javamagic.patch32
-rw-r--r--media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch12
-rw-r--r--media-libs/opencv/files/opencv-3.3.0-remove-tiny-dnn-autodownload.patch27
-rw-r--r--media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch56
-rw-r--r--media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch26
-rw-r--r--media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch27
-rw-r--r--media-libs/opencv/files/opencv-3.4.1-popcnt.patch30
-rw-r--r--media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch13
-rw-r--r--media-libs/opencv/files/opencv-3.4.1-python37.patch12
-rw-r--r--media-libs/opencv/files/opencv-3.4.1-remove-git-autodetect.patch42
15 files changed, 0 insertions, 933 deletions
diff --git a/media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch b/media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch
deleted file mode 100644
index 59090703d149..000000000000
--- a/media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- OpenCV-2.3.1.orig/modules/highgui/src/cap_ffmpeg_impl.hpp 2011-11-14 05:33:37.000000000 +0100
-+++ OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp 2011-11-14 05:33:18.000000000 +0100
-@@ -104,6 +104,7 @@
- #endif
- #if defined(HAVE_LIBAVCODEC_AVCODEC_H)
- #include <libavcodec/avcodec.h>
-+ #include <libavutil/mathematics.h>
- #endif
- #if defined(HAVE_LIBSWSCALE_SWSCALE_H)
- #include <libswscale/swscale.h>
diff --git a/media-libs/opencv/files/opencv-2.4.13-gcc-6.0.patch b/media-libs/opencv/files/opencv-2.4.13-gcc-6.0.patch
deleted file mode 100644
index b0a5084752ca..000000000000
--- a/media-libs/opencv/files/opencv-2.4.13-gcc-6.0.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From fb598bb76a0431aa3a880ecfa45054c996a070fb Mon Sep 17 00:00:00 2001
-From: Maksim Shabunin <maksim.shabunin@itseez.com>
-Date: Fri, 13 May 2016 13:28:09 +0300
-Subject: [PATCH] Disabled PCH support for gcc >= 6.0.0
-
-Command line generation routine uses "-isystem" to include headers outside of "<opencv>/modules" folder, but GCC 6 does not work when passed "-isystem /usr/include" option.
----
- cmake/OpenCVPCHSupport.cmake | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
-index 13619daf27e..e6585cae020 100644
---- a/cmake/OpenCVPCHSupport.cmake
-+++ b/cmake/OpenCVPCHSupport.cmake
-@@ -19,7 +19,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
- ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
- OUTPUT_VARIABLE gcc_compiler_version)
- #MESSAGE("GCC Version: ${gcc_compiler_version}")
-- IF(gcc_compiler_version VERSION_GREATER "4.2.-1")
-+ IF(gcc_compiler_version VERSION_GREATER "4.2.-1" AND gcc_compiler_version VERSION_LESS "6.0.0")
- SET(PCHSupport_FOUND TRUE)
- ENDIF()
-
diff --git a/media-libs/opencv/files/opencv-2.4.13-imgcodecs-refactoring.patch b/media-libs/opencv/files/opencv-2.4.13-imgcodecs-refactoring.patch
deleted file mode 100644
index d1bea36580fe..000000000000
--- a/media-libs/opencv/files/opencv-2.4.13-imgcodecs-refactoring.patch
+++ /dev/null
@@ -1,580 +0,0 @@
-From 72d29259ca741950527c8cca7fb649030c01f658 Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
-Date: Tue, 15 Aug 2017 22:04:55 +0000
-Subject: [PATCH] imgcodecs: refactoring, improve code quality
-
----
- modules/core/include/opencv2/core/core.hpp | 3 +
- modules/core/include/opencv2/core/operations.hpp | 3 +
- modules/highgui/src/bitstrm.cpp | 2 +
- modules/highgui/src/bitstrm.hpp | 19 ++--
- modules/highgui/src/grfmt_bmp.cpp | 13 ++-
- modules/highgui/src/grfmt_pxm.cpp | 119 +++++++++++++---------
- modules/highgui/src/loadsave.cpp | 120 +++++++++++++++++++----
- 7 files changed, 207 insertions(+), 72 deletions(-)
-
-diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp
-index 6bb295f5c73..86f4eb182b2 100644
---- a/modules/core/include/opencv2/core/core.hpp
-+++ b/modules/core/include/opencv2/core/core.hpp
-@@ -3248,6 +3248,9 @@ template<typename _Tp, size_t fixed_size=4096/sizeof(_Tp)+8> class AutoBuffer
- //! returns read-only pointer to the real buffer, stack-allocated or head-allocated
- operator const _Tp* () const;
-
-+ //! returns number of allocated elements
-+ size_t getSize() const;
-+
- protected:
- //! pointer to the real buffer, can point to buf if the buffer is small enough
- _Tp* ptr;
-diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp
-index 1b7484aded2..37fd3d97c7a 100644
---- a/modules/core/include/opencv2/core/operations.hpp
-+++ b/modules/core/include/opencv2/core/operations.hpp
-@@ -2581,6 +2581,9 @@ template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::op
- template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::operator const _Tp* () const
- { return ptr; }
-
-+template<typename _Tp, size_t fixed_size> inline size_t AutoBuffer<_Tp, fixed_size>::getSize() const
-+{ return size; }
-+
-
- /////////////////////////////////// Ptr ////////////////////////////////////////
-
-diff --git a/modules/highgui/src/bitstrm.cpp b/modules/highgui/src/bitstrm.cpp
-index dd8bec87cca..67792a27f28 100644
---- a/modules/highgui/src/bitstrm.cpp
-+++ b/modules/highgui/src/bitstrm.cpp
-@@ -208,6 +208,8 @@ int RLByteStream::getByte()
- current = m_current;
- }
-
-+ CV_Assert(current < m_end);
-+
- val = *((uchar*)current);
- m_current = current + 1;
- return val;
-diff --git a/modules/highgui/src/bitstrm.hpp b/modules/highgui/src/bitstrm.hpp
-index 57956beb539..b22987bc911 100644
---- a/modules/highgui/src/bitstrm.hpp
-+++ b/modules/highgui/src/bitstrm.hpp
-@@ -48,13 +48,20 @@
- namespace cv
- {
-
--enum
--{
-- RBS_THROW_EOS=-123, // <end of stream> exception code
-- RBS_THROW_FORB=-124, // <forrbidden huffman code> exception code
-- RBS_HUFF_FORB=2047, // forrbidden huffman code "value"
-- RBS_BAD_HEADER=-125 // invalid header
-+#define DECLARE_RBS_EXCEPTION(name) \
-+class RBS_ ## name ## _Exception : public cv::Exception \
-+{ \
-+public: \
-+ RBS_ ## name ## _Exception(int code_, const String& err_, const String& func_, const String& file_, int line_) : \
-+ cv::Exception(code_, err_, func_, file_, line_) \
-+ {} \
- };
-+DECLARE_RBS_EXCEPTION(THROW_EOS)
-+#define RBS_THROW_EOS RBS_THROW_EOS_Exception(CV_StsError, "Unexpected end of input stream", CV_Func, __FILE__, __LINE__)
-+DECLARE_RBS_EXCEPTION(THROW_FORB)
-+#define RBS_THROW_FORB RBS_THROW_FORB_Exception(CV_StsError, "Forrbidden huffman code", CV_Func, __FILE__, __LINE__)
-+DECLARE_RBS_EXCEPTION(BAD_HEADER)
-+#define RBS_BAD_HEADER RBS_BAD_HEADER_Exception(CV_StsError, "Invalid header", CV_Func, __FILE__, __LINE__)
-
- typedef unsigned long ulong;
-
-diff --git a/modules/highgui/src/grfmt_bmp.cpp b/modules/highgui/src/grfmt_bmp.cpp
-index c8f8218cd3b..026b317467d 100644
---- a/modules/highgui/src/grfmt_bmp.cpp
-+++ b/modules/highgui/src/grfmt_bmp.cpp
-@@ -115,8 +115,9 @@ bool BmpDecoder::readHeader()
-
- if( m_bpp <= 8 )
- {
-- memset( m_palette, 0, sizeof(m_palette));
-- m_strm.getBytes( m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
-+ CV_Assert(clrused < 256);
-+ memset(m_palette, 0, sizeof(m_palette));
-+ m_strm.getBytes(m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
- iscolor = IsColorPalette( m_palette, m_bpp );
- }
- else if( m_bpp == 16 && m_rle_code == BMP_BITFIELDS )
-@@ -282,7 +283,9 @@ bool BmpDecoder::readData( Mat& img )
- else if( code > 2 ) // absolute mode
- {
- if( data + code*nch > line_end ) goto decode_rle4_bad;
-- m_strm.getBytes( src, (((code + 1)>>1) + 1) & -2 );
-+ int sz = (((code + 1)>>1) + 1) & (~1);
-+ CV_Assert((size_t)sz < _src.getSize());
-+ m_strm.getBytes(src, sz);
- if( color )
- data = FillColorRow4( data, src, code, m_palette );
- else
-@@ -371,7 +374,9 @@ decode_rle4_bad: ;
-
- if( data + code3 > line_end )
- goto decode_rle8_bad;
-- m_strm.getBytes( src, (code + 1) & -2 );
-+ int sz = (code + 1) & (~1);
-+ CV_Assert((size_t)sz < _src.getSize());
-+ m_strm.getBytes(src, sz);
- if( color )
- data = FillColorRow8( data, src, code, m_palette );
- else
-diff --git a/modules/highgui/src/grfmt_pxm.cpp b/modules/highgui/src/grfmt_pxm.cpp
-index f73bbb1bf6b..e609d165966 100644
---- a/modules/highgui/src/grfmt_pxm.cpp
-+++ b/modules/highgui/src/grfmt_pxm.cpp
-@@ -43,50 +43,58 @@
- #include "precomp.hpp"
- #include "utils.hpp"
- #include "grfmt_pxm.hpp"
-+#include <iostream>
-
- namespace cv
- {
-
- ///////////////////////// P?M reader //////////////////////////////
-
--static int ReadNumber( RLByteStream& strm, int maxdigits )
-+static int ReadNumber(RLByteStream& strm, int maxdigits = 0)
- {
- int code;
-- int val = 0;
-+ int64 val = 0;
- int digits = 0;
-
- code = strm.getByte();
-
-- if( !isdigit(code))
-+ while (!isdigit(code))
- {
-- do
-+ if (code == '#' )
- {
-- if( code == '#' )
-+ do
- {
-- do
-- {
-- code = strm.getByte();
-- }
-- while( code != '\n' && code != '\r' );
-+ code = strm.getByte();
- }
--
-+ while (code != '\n' && code != '\r');
- code = strm.getByte();
--
-- while( isspace(code))
-+ }
-+ else if (isspace(code))
-+ {
-+ while (isspace(code))
- code = strm.getByte();
- }
-- while( !isdigit( code ));
-+ else
-+ {
-+#if 1
-+ CV_Error_(CV_StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code));
-+#else
-+ code = strm.getByte();
-+#endif
-+ }
- }
-
- do
- {
-- val = val*10 + code - '0';
-- if( ++digits >= maxdigits ) break;
-+ val = val*10 + (code - '0');
-+ CV_Assert(val <= INT_MAX && "PXM: ReadNumber(): result is too large");
-+ digits++;
-+ if (maxdigits != 0 && digits >= maxdigits) break;
- code = strm.getByte();
- }
-- while( isdigit(code));
-+ while (isdigit(code));
-
-- return val;
-+ return (int)val;
- }
-
-
-@@ -119,13 +127,13 @@ ImageDecoder PxMDecoder::newDecoder() const
- return new PxMDecoder;
- }
-
--void PxMDecoder::close()
-+void PxMDecoder::close()
- {
- m_strm.close();
- }
-
-
--bool PxMDecoder::readHeader()
-+bool PxMDecoder::readHeader()
- {
- bool result = false;
-
-@@ -155,10 +163,10 @@ bool PxMDecoder::readHeader()
- m_binary = code >= '4';
- m_type = m_bpp > 8 ? CV_8UC3 : CV_8UC1;
-
-- m_width = ReadNumber( m_strm, INT_MAX );
-- m_height = ReadNumber( m_strm, INT_MAX );
-+ m_width = ReadNumber(m_strm);
-+ m_height = ReadNumber(m_strm);
-
-- m_maxval = m_bpp == 1 ? 1 : ReadNumber( m_strm, INT_MAX );
-+ m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm);
- if( m_maxval > 65535 )
- throw RBS_BAD_HEADER;
-
-@@ -172,8 +180,14 @@ bool PxMDecoder::readHeader()
- result = true;
- }
- }
-- catch(...)
-+ catch (const cv::Exception&)
- {
-+ throw;
-+ }
-+ catch (...)
-+ {
-+ std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
-+ throw;
- }
-
- if( !result )
-@@ -193,27 +207,23 @@ bool PxMDecoder::readData( Mat& img )
- int step = (int)img.step;
- PaletteEntry palette[256];
- bool result = false;
-- int bit_depth = CV_ELEM_SIZE1(m_type)*8;
-- int src_pitch = (m_width*m_bpp*bit_depth/8 + 7)/8;
-+ const int bit_depth = CV_ELEM_SIZE1(m_type)*8;
-+ const int src_pitch = (m_width*m_bpp*(bit_depth/8) + 7) / 8;
-+
- int nch = CV_MAT_CN(m_type);
- int width3 = m_width*nch;
-- int i, x, y;
-
- if( m_offset < 0 || !m_strm.isOpened())
- return false;
-
-- AutoBuffer<uchar,1024> _src(src_pitch + 32);
-- uchar* src = _src;
-- AutoBuffer<uchar,1024> _gray_palette;
-- uchar* gray_palette = _gray_palette;
-+ uchar gray_palette[256] = {0};
-
- // create LUT for converting colors
- if( bit_depth == 8 )
- {
-- _gray_palette.allocate(m_maxval + 1);
-- gray_palette = _gray_palette;
-+ CV_Assert(m_maxval < 256);
-
-- for( i = 0; i <= m_maxval; i++ )
-+ for (int i = 0; i <= m_maxval; i++)
- gray_palette[i] = (uchar)((i*255/m_maxval)^(m_bpp == 1 ? 255 : 0));
-
- FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 );
-@@ -227,12 +237,16 @@ bool PxMDecoder::readData( Mat& img )
- {
- ////////////////////////// 1 BPP /////////////////////////
- case 1:
-+ CV_Assert(CV_MAT_DEPTH(m_type) == CV_8U);
- if( !m_binary )
- {
-- for( y = 0; y < m_height; y++, data += step )
-+ AutoBuffer<uchar> _src(m_width);
-+ uchar* src = _src;
-+
-+ for (int y = 0; y < m_height; y++, data += step)
- {
-- for( x = 0; x < m_width; x++ )
-- src[x] = ReadNumber( m_strm, 1 ) != 0;
-+ for (int x = 0; x < m_width; x++)
-+ src[x] = ReadNumber(m_strm, 1) != 0;
-
- if( color )
- FillColorRow8( data, src, m_width, palette );
-@@ -242,7 +256,10 @@ bool PxMDecoder::readData( Mat& img )
- }
- else
- {
-- for( y = 0; y < m_height; y++, data += step )
-+ AutoBuffer<uchar> _src(src_pitch);
-+ uchar* src = _src;
-+
-+ for (int y = 0; y < m_height; y++, data += step)
- {
- m_strm.getBytes( src, src_pitch );
-
-@@ -258,11 +275,15 @@ bool PxMDecoder::readData( Mat& img )
- ////////////////////////// 8 BPP /////////////////////////
- case 8:
- case 24:
-- for( y = 0; y < m_height; y++, data += step )
-+ {
-+ AutoBuffer<uchar> _src(std::max<size_t>(width3*2, src_pitch));
-+ uchar* src = _src;
-+
-+ for (int y = 0; y < m_height; y++, data += step)
- {
- if( !m_binary )
- {
-- for( x = 0; x < width3; x++ )
-+ for (int x = 0; x < width3; x++)
- {
- int code = ReadNumber( m_strm, INT_MAX );
- if( (unsigned)code > (unsigned)m_maxval ) code = m_maxval;
-@@ -277,7 +298,7 @@ bool PxMDecoder::readData( Mat& img )
- m_strm.getBytes( src, src_pitch );
- if( bit_depth == 16 && !isBigEndian() )
- {
-- for( x = 0; x < width3; x++ )
-+ for (int x = 0; x < width3; x++)
- {
- uchar v = src[x * 2];
- src[x * 2] = src[x * 2 + 1];
-@@ -288,7 +309,7 @@ bool PxMDecoder::readData( Mat& img )
-
- if( img.depth() == CV_8U && bit_depth == 16 )
- {
-- for( x = 0; x < width3; x++ )
-+ for (int x = 0; x < width3; x++)
- {
- int v = ((ushort *)src)[x];
- src[x] = (uchar)(v >> 8);
-@@ -329,12 +350,19 @@ bool PxMDecoder::readData( Mat& img )
- }
- result = true;
- break;
-+ }
- default:
-- assert(0);
-+ CV_Error(CV_StsError, "m_bpp is not supported");
- }
- }
-- catch(...)
-+ catch (const cv::Exception&)
-+ {
-+ throw;
-+ }
-+ catch (...)
- {
-+ std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
-+ throw;
- }
-
- return result;
-@@ -410,8 +438,9 @@ bool PxMEncoder::write( const Mat& img, const vector<int>& params )
- char* buffer = _buffer;
-
- // write header;
-- sprintf( buffer, "P%c\n%d %d\n%d\n",
-+ sprintf( buffer, "P%c\n# Generated by OpenCV %s\n%d %d\n%d\n",
- '2' + (channels > 1 ? 1 : 0) + (isBinary ? 3 : 0),
-+ CV_VERSION,
- width, height, (1 << depth) - 1 );
-
- strm.putBytes( buffer, (int)strlen(buffer) );
-diff --git a/modules/highgui/src/loadsave.cpp b/modules/highgui/src/loadsave.cpp
-index 81c708acdd4..9b270c900f7 100644
---- a/modules/highgui/src/loadsave.cpp
-+++ b/modules/highgui/src/loadsave.cpp
-@@ -48,12 +48,32 @@
- #undef min
- #undef max
-
-+#include <iostream>
-+
- /****************************************************************************************\
- * Image Codecs *
- \****************************************************************************************/
- namespace cv
- {
-
-+// TODO Add runtime configuration
-+#define CV_IO_MAX_IMAGE_PARAMS (50)
-+#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
-+#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
-+#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
-+
-+static Size validateInputImageSize(const Size& size)
-+{
-+ CV_Assert(size.width > 0);
-+ CV_Assert(size.width <= CV_IO_MAX_IMAGE_WIDTH);
-+ CV_Assert(size.height > 0);
-+ CV_Assert(size.height <= CV_IO_MAX_IMAGE_HEIGHT);
-+ uint64 pixels = (uint64)size.width * (uint64)size.height;
-+ CV_Assert(pixels <= CV_IO_MAX_IMAGE_PIXELS);
-+ return size;
-+}
-+
-+
- struct ImageCodecInitializer
- {
- ImageCodecInitializer()
-@@ -203,12 +223,26 @@ imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
- if( decoder.empty() )
- return 0;
- decoder->setSource(filename);
-- if( !decoder->readHeader() )
-+
-+ try
-+ {
-+ // read the header to make sure it succeeds
-+ if (!decoder->readHeader())
-+ return 0;
-+ }
-+ catch (const cv::Exception& e)
-+ {
-+ std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
- return 0;
-+ }
-+ catch (...)
-+ {
-+ std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
-+ return 0;
-+ }
-
-- CvSize size;
-- size.width = decoder->width();
-- size.height = decoder->height();
-+
-+ Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
-
- int type = decoder->type();
- if( flags != -1 )
-@@ -242,7 +276,21 @@ imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
- temp = cvarrToMat(image);
- }
-
-- if( !decoder->readData( *data ))
-+ bool success = false;
-+ try
-+ {
-+ if (decoder->readData(*data))
-+ success = true;
-+ }
-+ catch (const cv::Exception& e)
-+ {
-+ std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
-+ }
-+ catch (...)
-+ {
-+ std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
-+ }
-+ if (!success)
- {
- cvReleaseImage( &image );
- cvReleaseMat( &matrix );
-@@ -288,6 +336,7 @@ static bool imwrite_( const string& filename, const Mat& image,
- }
-
- encoder->setDestination( filename );
-+ CV_Assert(params.size() <= CV_IO_MAX_IMAGE_PARAMS*2);
- bool code = encoder->write( *pimage, params );
-
- // CV_Assert( code );
-@@ -326,16 +375,34 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
- decoder->setSource(filename);
- }
-
-- if( !decoder->readHeader() )
-+ bool success = false;
-+ try
- {
-- if( !filename.empty() )
-- remove(filename.c_str());
-+ if (decoder->readHeader())
-+ success = true;
-+ }
-+ catch (const cv::Exception& e)
-+ {
-+ std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
-+ }
-+ catch (...)
-+ {
-+ std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
-+ }
-+ if (!success)
-+ {
-+ if (!filename.empty())
-+ {
-+ if (0 != remove(filename.c_str()))
-+ {
-+ std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
-+ }
-+ }
- return 0;
- }
-
-- CvSize size;
-- size.width = decoder->width();
-- size.height = decoder->height();
-+ // established the required input image size
-+ Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
-
- int type = decoder->type();
- if( flags != -1 )
-@@ -369,11 +436,30 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
- temp = cvarrToMat(image);
- }
-
-- bool code = decoder->readData( *data );
-- if( !filename.empty() )
-- remove(filename.c_str());
-+ success = false;
-+ try
-+ {
-+ if (decoder->readData(*data))
-+ success = true;
-+ }
-+ catch (const cv::Exception& e)
-+ {
-+ std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
-+ }
-+ catch (...)
-+ {
-+ std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
-+ }
-
-- if( !code )
-+ if (!filename.empty())
-+ {
-+ if (0 != remove(filename.c_str()))
-+ {
-+ std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
-+ }
-+ }
-+
-+ if (!success)
- {
- cvReleaseImage( &image );
- cvReleaseMat( &matrix );
-@@ -490,7 +576,7 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
- if( _params )
- {
- for( ; _params[i] > 0; i += 2 )
-- ;
-+ CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
- }
- return cv::imwrite_(filename, cv::cvarrToMat(arr),
- i > 0 ? cv::vector<int>(_params, _params+i) : cv::vector<int>(),
-@@ -521,7 +607,7 @@ cvEncodeImage( const char* ext, const CvArr* arr, const int* _params )
- if( _params )
- {
- for( ; _params[i] > 0; i += 2 )
-- ;
-+ CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
- }
- cv::Mat img = cv::cvarrToMat(arr);
- if( CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL )
diff --git a/media-libs/opencv/files/opencv-2.4.2-cflags.patch b/media-libs/opencv/files/opencv-2.4.2-cflags.patch
deleted file mode 100644
index d52e6b6a39f4..000000000000
--- a/media-libs/opencv/files/opencv-2.4.2-cflags.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -ruN OpenCV-2.4.2.orig/cmake/OpenCVCompilerOptions.cmake OpenCV-2.4.2/cmake/OpenCVCompilerOptions.cmake
---- OpenCV-2.4.2.orig/cmake/OpenCVCompilerOptions.cmake 2012-06-29 00:55:15.000000000 +0200
-+++ OpenCV-2.4.2/cmake/OpenCVCompilerOptions.cmake 2012-07-16 23:51:24.244907235 +0200
-@@ -110,17 +110,6 @@
- endif()
-
- # Other optimizations
-- if(ENABLE_OMIT_FRAME_POINTER)
-- add_extra_compiler_option(-fomit-frame-pointer)
-- else()
-- add_extra_compiler_option(-fno-omit-frame-pointer)
-- endif()
-- if(ENABLE_FAST_MATH)
-- add_extra_compiler_option(-ffast-math)
-- endif()
-- if(ENABLE_POWERPC)
-- add_extra_compiler_option("-mcpu=G3 -mtune=G5")
-- endif()
- if(ENABLE_SSE)
- add_extra_compiler_option(-msse)
- endif()
diff --git a/media-libs/opencv/files/opencv-2.4.3-gcc47.patch b/media-libs/opencv/files/opencv-2.4.3-gcc47.patch
deleted file mode 100644
index 13ac8f8fb58f..000000000000
--- a/media-libs/opencv/files/opencv-2.4.3-gcc47.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff -ruN OpenCV-2.4.3.orig/modules/highgui/src/grfmt_tiff.cpp OpenCV-2.4.3/modules/highgui/src/grfmt_tiff.cpp
---- OpenCV-2.4.3.orig/modules/highgui/src/grfmt_tiff.cpp 2012-10-12 00:55:12.000000000 +0200
-+++ OpenCV-2.4.3/modules/highgui/src/grfmt_tiff.cpp 2012-11-05 21:37:40.000000000 +0100
-@@ -47,6 +47,7 @@
-
- #include "precomp.hpp"
- #include "grfmt_tiff.hpp"
-+#include "unistd.h"
-
- namespace cv
- {
-diff -ruN OpenCV-2.4.3.orig/modules/highgui/src/window_QT.h OpenCV-2.4.3/modules/highgui/src/window_QT.h
---- OpenCV-2.4.3.orig/modules/highgui/src/window_QT.h 2012-10-18 00:55:38.000000000 +0200
-+++ OpenCV-2.4.3/modules/highgui/src/window_QT.h 2012-11-05 21:38:41.000000000 +0100
-@@ -41,6 +41,7 @@
- #define __OPENCV_HIGHGUI_QT_H__
-
- #include "precomp.hpp"
-+#include "unistd.h"
-
- #if defined( HAVE_QT_OPENGL )
- #include <QtOpenGL>
diff --git a/media-libs/opencv/files/opencv-2.4.8-javamagic.patch b/media-libs/opencv/files/opencv-2.4.8-javamagic.patch
deleted file mode 100644
index 766abc1e0941..000000000000
--- a/media-libs/opencv/files/opencv-2.4.8-javamagic.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -ruN opencv-2.4.8.orig/CMakeLists.txt opencv-2.4.8/CMakeLists.txt
---- opencv-2.4.8.orig/CMakeLists.txt 2013-12-27 18:09:18.000000000 +0100
-+++ opencv-2.4.8/CMakeLists.txt 2014-01-24 22:06:12.000000000 +0100
-@@ -164,6 +164,7 @@
- OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) )
- OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) )
- OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF WIN32 )
-+OCV_OPTION(WITH_JAVA "Include Java support" ON)
-
- # OpenCV build components
- # ===================================================
-@@ -449,6 +450,8 @@
- include(cmake/OpenCVDetectPython.cmake)
-
- # --- Java Support ---
-+if(WITH_JAVA)
-+
- include(cmake/OpenCVDetectApacheAnt.cmake)
- if(ANDROID)
- include(cmake/OpenCVDetectAndroidSDK.cmake)
-@@ -466,6 +469,11 @@
- SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
- endif()
-
-+else()
-+ SET(ANT_EXECUTABLE "")
-+ SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
-+endif()
-+
- # --- OpenCL ---
- if(WITH_OPENCL)
- include(cmake/OpenCVDetectOpenCL.cmake)
diff --git a/media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch b/media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch
deleted file mode 100644
index d7ff3c7eaf67..000000000000
--- a/media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -528,6 +528,9 @@
- if(HAVE_CUFFT)
- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
- endif()
-+ foreach(p ${CUDA_LIBS_PATH})
-+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} -L${p})
-+ endforeach()
- endif()
-
- # ----------------------------------------------------------------------------
diff --git a/media-libs/opencv/files/opencv-3.3.0-remove-tiny-dnn-autodownload.patch b/media-libs/opencv/files/opencv-3.3.0-remove-tiny-dnn-autodownload.patch
deleted file mode 100644
index 6929a4c2ce4c..000000000000
--- a/media-libs/opencv/files/opencv-3.3.0-remove-tiny-dnn-autodownload.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-diff -purN a/modules/dnn_modern/CMakeLists.txt b/modules/dnn_modern/CMakeLists.txt
---- a/modules/dnn_modern/CMakeLists.txt 2017-07-31 15:58:38.000000000 +0100
-+++ b/modules/dnn_modern/CMakeLists.txt 2018-01-15 17:15:15.202454388 +0000
-@@ -15,23 +15,6 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CU
- # MODULE REQUIREMENTS
- # ----------------------------------------------------------------------------
-
--set(TINY_DNN_CPP_PATH "${OpenCV_BINARY_DIR}/3rdparty/tinydnn")
--set(TINY_DNN_CPP_ROOT "${TINY_DNN_CPP_PATH}/tiny-dnn-1.0.0a3")
--ocv_download(FILENAME "v1.0.0a3.tar.gz"
-- HASH "adb1c512e09ca2c7a6faef36f9c53e59"
-- URL
-- "${OPENCV_TINY_DNN_URL}"
-- "$ENV{OPENCV_TINY_DNN_URL}"
-- "https://github.com/tiny-dnn/tiny-dnn/archive/"
-- DESTINATION_DIR "${TINY_DNN_CPP_PATH}"
-- STATUS TINY_DNN_DOWNLOAD_SUCCESS
-- ID "tiny-dnn"
-- UNPACK RELATIVE_URL)
--
--if(NOT TINY_DNN_DOWNLOAD_SUCCESS)
-- message(STATUS "Failed to download tiny-dnn sources")
--endif()
--
- find_package(TinyDNN QUIET)
-
- include(CheckCXXCompilerFlag)
diff --git a/media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch b/media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch
deleted file mode 100644
index c94f206ed4f1..000000000000
--- a/media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 549b5df22520b60b91dd77096434d79425b31ac2 Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@intel.com>
-Date: Mon, 28 May 2018 18:07:23 +0300
-Subject: [PATCH] build: workaround issues with C compilation mode
-
-- cvdef.h + cvRound (double only)
-- highgui_c.h
----
- modules/core/include/opencv2/core/cvdef.h | 8 +++++++-
- modules/highgui/include/opencv2/highgui/highgui_c.h | 2 ++
- 2 files changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h
-index a87ced09d78..4ab72b34cc1 100644
---- a/modules/core/include/opencv2/core/cvdef.h
-+++ b/modules/core/include/opencv2/core/cvdef.h
-@@ -480,7 +480,7 @@ Cv64suf;
- // Integer types portatibility
- #ifdef OPENCV_STDINT_HEADER
- #include OPENCV_STDINT_HEADER
--#else
-+#elif defined(__cplusplus)
- #if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */
- namespace cv {
- typedef signed char int8_t;
-@@ -517,9 +517,15 @@ typedef ::int64_t int64_t;
- typedef ::uint64_t uint64_t;
- }
- #endif
-+#else // pure C
-+#include <stdint.h>
- #endif
-
-
- //! @}
-
-+#ifndef __cplusplus
-+#include "opencv2/core/fast_math.hpp" // define cvRound(double)
-+#endif
-+
- #endif // OPENCV_CORE_CVDEF_H
-diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h
-index 1eb414a76ca..35413139c79 100644
---- a/modules/highgui/include/opencv2/highgui/highgui_c.h
-+++ b/modules/highgui/include/opencv2/highgui/highgui_c.h
-@@ -135,8 +135,10 @@ CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOS
- CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
- CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
-
-+#ifdef __cplusplus // FIXIT remove in OpenCV 4.0
- /* Get window image rectangle coordinates, width and height */
- CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
-+#endif
-
- /* display image within window (highgui windows remember their content) */
- CVAPI(void) cvShowImage( const char* name, const CvArr* image );
diff --git a/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch b/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch
deleted file mode 100644
index 813eb7e4ae65..000000000000
--- a/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 20f5fa8e3e880bc8b2e5156e9f25f7fb756ed8e4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
-Date: Wed, 28 Feb 2018 19:21:31 +0000
-Subject: [PATCH] Fix build with VA
-
-This commit readd ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES}
-that was missed in commit 2200e13c7193e0fe9db4b9f7c4bee3a7ef043909
-
- diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
- - ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
- + ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
----
- samples/va_intel/CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
-index af51dd32061..04f2ea5fd40 100644
---- a/samples/va_intel/CMakeLists.txt
-+++ b/samples/va_intel/CMakeLists.txt
-@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
- file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
- foreach(sample_filename ${all_samples})
- ocv_define_sample(tgt ${sample_filename} va_intel)
-- ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
-+ ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
- endforeach()
diff --git a/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch b/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch
deleted file mode 100644
index f36d643cf731..000000000000
--- a/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 7dc162cb4252ccf461f1c63650abde3c8807b79c Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@intel.com>
-Date: Mon, 9 Apr 2018 18:25:51 +0300
-Subject: [PATCH] core: fix mm_pause() for non-SSE i386 builds
-
-replaced to safe binary compatible 'rep; nop' asm instruction
----
- modules/core/src/parallel_impl.cpp | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/modules/core/src/parallel_impl.cpp b/modules/core/src/parallel_impl.cpp
-index 78d9eb63694..bc64fce7a81 100644
---- a/modules/core/src/parallel_impl.cpp
-+++ b/modules/core/src/parallel_impl.cpp
-@@ -49,7 +49,11 @@ DECLARE_CV_YIELD
- DECLARE_CV_PAUSE
- #endif
- #ifndef CV_PAUSE
--#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
-+# if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
-+# if !defined(__SSE__)
-+ static inline void cv_non_sse_mm_pause() { __asm__ __volatile__ ("rep; nop"); }
-+# define _mm_pause cv_non_sse_mm_pause
-+# endif
- # define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { _mm_pause(); } } while (0)
- # elif defined __GNUC__ && defined __aarch64__
- # define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { asm volatile("yield" ::: "memory"); } } while (0)
diff --git a/media-libs/opencv/files/opencv-3.4.1-popcnt.patch b/media-libs/opencv/files/opencv-3.4.1-popcnt.patch
deleted file mode 100644
index 51a6d554a252..000000000000
--- a/media-libs/opencv/files/opencv-3.4.1-popcnt.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From a2d6fc7ac040c6ef94a36515f9ea24428f8f1ecc Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@intel.com>
-Date: Tue, 24 Apr 2018 12:40:25 +0300
-Subject: [PATCH] cmake: fix popcnt detection
-
-via GCC/Clang __POPCNT__ define
----
- cmake/checks/cpu_popcnt.cpp | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/cmake/checks/cpu_popcnt.cpp b/cmake/checks/cpu_popcnt.cpp
-index 16e5575108b..44c7deda053 100644
---- a/cmake/checks/cpu_popcnt.cpp
-+++ b/cmake/checks/cpu_popcnt.cpp
-@@ -4,12 +4,14 @@
- # define CV_POPCNT_U64 _mm_popcnt_u64
- # endif
- # define CV_POPCNT_U32 _mm_popcnt_u32
--#else
-+#elif defined(__POPCNT__)
- # include <popcntintrin.h>
- # if defined(__x86_64__)
- # define CV_POPCNT_U64 __builtin_popcountll
- # endif
- # define CV_POPCNT_U32 __builtin_popcount
-+#else
-+# error "__POPCNT__ is not defined by compiler"
- #endif
-
- int main()
diff --git a/media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch b/media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch
deleted file mode 100644
index 248e5034a218..000000000000
--- a/media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/cmake/OpenCVDetectPython.cmake 2018-05-31 09:14:42.998873104 +0200
-+++ b/cmake/OpenCVDetectPython.cmake 2018-05-31 09:26:08.444914001 +0200
-@@ -140,8 +140,8 @@
- else() #debian based assumed, install to the dist-packages.
- set(_packages_path "python${_version_major_minor}/dist-packages")
- endif()
-- if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${${packages_path}}")
-- set(_packages_path "lib${LIB_SUFFIX}/${_packages_path}")
-+ if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIBPY_SUFFIX}/${${packages_path}}")
-+ set(_packages_path "lib${LIBPY_SUFFIX}/${_packages_path}")
- else()
- set(_packages_path "lib/${_packages_path}")
- endif()
diff --git a/media-libs/opencv/files/opencv-3.4.1-python37.patch b/media-libs/opencv/files/opencv-3.4.1-python37.patch
deleted file mode 100644
index 94d307b748c4..000000000000
--- a/media-libs/opencv/files/opencv-3.4.1-python37.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -urN a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp
---- a/modules/python/src2/cv2.cpp 2018-02-23 11:38:33.000000000 +0300
-+++ b/modules/python/src2/cv2.cpp 2019-08-10 22:28:03.337071791 +0300
-@@ -886,7 +886,7 @@
- (void)name;
- if(!obj || obj == Py_None)
- return true;
-- char* str = PyString_AsString(obj);
-+ const char* str = PyString_AsString(obj);
- if(!str)
- return false;
- value = String(str);
diff --git a/media-libs/opencv/files/opencv-3.4.1-remove-git-autodetect.patch b/media-libs/opencv/files/opencv-3.4.1-remove-git-autodetect.patch
deleted file mode 100644
index 94b221ab9a8b..000000000000
--- a/media-libs/opencv/files/opencv-3.4.1-remove-git-autodetect.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/CMakeLists.txt 2019-01-10 19:29:06.831367707 +0100
-+++ b/CMakeLists.txt 2019-01-10 19:30:11.125364384 +0100
-@@ -522,23 +522,23 @@
- # ----------------------------------------------------------------------------
- # Autodetect if we are in a GIT repository
- # ----------------------------------------------------------------------------
--find_host_package(Git QUIET)
-+# find_host_package(Git QUIET)
-
--if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
-- execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
-- WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
-- OUTPUT_VARIABLE OPENCV_VCSVERSION
-- RESULT_VARIABLE GIT_RESULT
-- ERROR_QUIET
-- OUTPUT_STRIP_TRAILING_WHITESPACE
-- )
-- if(NOT GIT_RESULT EQUAL 0)
-- set(OPENCV_VCSVERSION "unknown")
-- endif()
--elseif(NOT DEFINED OPENCV_VCSVERSION)
-- # We don't have git:
-- set(OPENCV_VCSVERSION "unknown")
--endif()
-+# if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
-+# execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
-+# WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
-+# OUTPUT_VARIABLE OPENCV_VCSVERSION
-+# RESULT_VARIABLE GIT_RESULT
-+# ERROR_QUIET
-+# OUTPUT_STRIP_TRAILING_WHITESPACE
-+# )
-+# if(NOT GIT_RESULT EQUAL 0)
-+# set(OPENCV_VCSVERSION "unknown")
-+# endif()
-+# elseif(NOT DEFINED OPENCV_VCSVERSION)
-+# # We don't have git:
-+# set(OPENCV_VCSVERSION "unknown")
-+#endif()
-
-
- # ----------------------------------------------------------------------------