summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2020-06-25 09:53:25 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2020-06-25 19:07:43 +0200
commitb9d85c6578126c3592dbae8a8fc6ff6b27995e34 (patch)
tree3992b54a0977cfb871f00e18d25ed97f78653765 /media-libs/opencv
parentsci-libs/volk: add some cmake flags (diff)
downloadgentoo-b9d85c6578126c3592dbae8a8fc6ff6b27995e34.tar.gz
gentoo-b9d85c6578126c3592dbae8a8fc6ff6b27995e34.tar.bz2
gentoo-b9d85c6578126c3592dbae8a8fc6ff6b27995e34.zip
media-libs/opencv: Drop vulnerable 2.4.13-r4
Bug: https://bugs.gentoo.org/647802 Bug: https://bugs.gentoo.org/729504 Package-Manager: Portage-2.3.103, Repoman-2.3.23 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'media-libs/opencv')
-rw-r--r--media-libs/opencv/Manifest1
-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/opencv-2.4.13-r4.ebuild230
9 files changed, 0 insertions, 931 deletions
diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index f7ec8ef1be8b..079529c915c9 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,4 +1,3 @@
-DIST opencv-2.4.13.tar.gz 91669572 BLAKE2B 7f6be39e29c0db5d005cb14215fdf5955fa69c34d72c4f1e1fa8bf8de1e748a0d2fe5febb43296ef529c57e4dec8d1b6739c0c4df9e64657b9550ed382fbc4b9 SHA512 efdc4340fdf557dae44ac604c8c20f61ced89f99274264b61c2640f28741504462c6b57076e207040ca2513e3921275bdfbe6c22fc123bd50df78745e6b7bcd6
DIST opencv-3.4.0-face_landmark_model.tar.gz 63299830 BLAKE2B 58f08cd8c030ee1c8b66e76a561fd625e112face427d001185f8d7c0eaace55adbd8474663021841a1382bfe393a210e64c51223441713cdb9156fac866a845c SHA512 2cd29ce42c08b2966db3ef4a2bc217ab3d07051819757ec6de8f3deea29e28f60abab39f101dba03f766f17018598e411bd687a7eaab0c681c113e10a2de2b23
DIST opencv-3.4.0-res10_300x300-caffeemodel.tar.gz 10036604 BLAKE2B 2a2de48fc420f13e7be146ac88f311901c5b4e409c30e466152e33cae1f8afd87dcb6d758af447c268d90bd67989c8798cd80cab172b10499a6ad5224509dbdf SHA512 96fee9f447d5739bc01a5cab37c453cf7237457dfb5d2bf93ac37f8e5aa557ac222316f449cd58e37e856abe4d8e9d4a7820daaba32f0b22cbcde8e340287d4b
DIST opencv-3.4.1.tar.gz 87051748 BLAKE2B 87c83ab9b3d7fb048263f047aa5d6e95b153e1a28f3e34cc885eff7eb080a2258cfa1aa494cd56b32f1098ab158c17c23fc8464fcbe70642a3a1842f2fd1b4ac SHA512 e1fc14285090c6fe9e26e721f2d67d7096650c523147e925567426ef76aa7f4c6f12035d6f6ce3ec7991a75a6828a810fd4f9b75f78ed5fcccecefbadd79944b
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/opencv-2.4.13-r4.ebuild b/media-libs/opencv/opencv-2.4.13-r4.ebuild
deleted file mode 100644
index 1e5584759aa4..000000000000
--- a/media-libs/opencv/opencv-2.4.13-r4.ebuild
+++ /dev/null
@@ -1,230 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-PYTHON_COMPAT=( python2_7 )
-
-inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
-
-DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
-HOMEPAGE="https://opencv.org"
-
-SRC_URI="https://github.com/Itseez/opencv/archive/${PV}.tar.gz -> ${P}.tar.gz"
-
-LICENSE="BSD"
-SLOT="0/2.4"
-KEYWORDS="amd64 ~arm ~ppc ~ppc64 x86 ~amd64-linux"
-IUSE="cuda +eigen examples ffmpeg gstreamer gtk ieee1394 jpeg opencl openexr opengl openmp pch png +python qt5 testprograms threads tiff v4l vtk xine"
-
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
-
-# The following logic is intrinsic in the build system, but we do not enforce
-# it on the useflags since this just blocks emerging pointlessly:
-# gtk? ( !qt4 )
-# opengl? ( || ( gtk qt4 ) )
-# openmp? ( !threads )
-
-RDEPEND="
- app-arch/bzip2
- sys-libs/zlib
- cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
- ffmpeg? ( media-video/ffmpeg:0= )
- gstreamer? (
- media-libs/gstreamer:1.0
- media-libs/gst-plugins-base:1.0
- )
- gtk? (
- dev-libs/glib:2
- x11-libs/gtk+:2
- opengl? ( x11-libs/gtkglext )
- )
- java? ( >=virtual/jre-1.6:* )
- jpeg? ( virtual/jpeg:0 )
- ieee1394? (
- media-libs/libdc1394
- sys-libs/libraw1394
- )
- opencl? ( virtual/opencl )
- openexr? ( media-libs/openexr )
- opengl? ( virtual/opengl virtual/glu )
- png? ( media-libs/libpng:0= )
- python? (
- ${PYTHON_DEPS}
- $(python_gen_cond_dep '
- || (
- dev-python/numpy-python2[${PYTHON_MULTI_USEDEP}]
- dev-python/numpy[${PYTHON_MULTI_USEDEP}]
- )
- ')
- )
- qt5? (
- dev-qt/qtconcurrent:5
- dev-qt/qtcore:5
- dev-qt/qtgui:5
- dev-qt/qttest:5
- opengl? ( dev-qt/qtopengl:5 )
- )
- threads? ( dev-cpp/tbb )
- tiff? ( media-libs/tiff:0 )
- v4l? ( >=media-libs/libv4l-0.8.3 )
- vtk? ( sci-libs/vtk[rendering] )
- xine? ( media-libs/xine-lib )
-"
-DEPEND="${RDEPEND}
- virtual/pkgconfig
- eigen? ( dev-cpp/eigen:3 )
- java? ( >=virtual/jdk-1.6 )
-"
-
-PATCHES=(
- "${FILESDIR}/${PN}-2.3.1a-libav-0.7.patch"
- "${FILESDIR}/${PN}-2.4.3-gcc47.patch"
- "${FILESDIR}/${PN}-2.4.2-cflags.patch"
- "${FILESDIR}/${PN}-2.4.8-javamagic.patch"
- "${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch"
- "${FILESDIR}/${PN}-3.0.0-gles.patch"
- "${FILESDIR}/${P}-gcc-6.0.patch"
- "${FILESDIR}/${P}-imgcodecs-refactoring.patch" #bug 627958
-)
-
-pkg_setup() {
- [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
- use python && python-single-r1_pkg_setup
- java-pkg-opt-2_pkg_setup
-}
-
-src_prepare() {
- cmake-utils_src_prepare
-
- # remove bundled stuff
- rm -rf 3rdparty || die "Removing 3rd party components failed"
- sed -i \
- -e '/add_subdirectory(3rdparty)/ d' \
- CMakeLists.txt || die
-
- java-pkg-opt-2_src_prepare
-}
-
-src_configure() {
-
- JAVA_ANT_ENCODING="iso-8859-1"
- # set encoding so even this cmake build will pick it up.
- export ANT_OPTS+=" -Dfile.encoding=iso-8859-1"
- java-ant-2_src_configure
-
- # please dont sort here, order is the same as in CMakeLists.txt
- local mycmakeargs=(
- # the optinal dependency libraries
- -DWITH_1394=$(usex ieee1394)
- -DWITH_AVFOUNDATION=OFF
- -DWITH_VTK=$(usex vtk)
- -DWITH_EIGEN=$(usex eigen)
- -DWITH_VFW=OFF
- -DWITH_FFMPEG=$(usex ffmpeg)
- -DWITH_GSTREAMER=$(usex gstreamer)
- -DWITH_GSTREAMER_0_10=OFF
- -DWITH_GTK=$(usex gtk)
- -DWITH_IMAGEIO=OFF
- -DWITH_IPP=OFF
- -DWITH_JASPER=OFF
- -DWITH_JPEG=$(usex jpeg)
- -DWITH_OPENEXR=$(usex openexr)
- -DWITH_OPENGL=$(usex opengl)
- -DWITH_OPENCL=$(usex opencl)
- -DWITH_OPENNI=OFF
- -DWITH_PNG=$(usex png)
- -DWITH_PVAPI=OFF
- -DWITH_QT=$(usex qt5 5 OFF)
- -DWITH_GIGEAPI=OFF
- -DWITH_WIN32UI=OFF
- -DWITH_QUICKTIME=OFF
- -DWITH_TBB=$(usex threads)
- -DWITH_OPENMP=$(usex openmp)
- -DWITH_CSTRIPES=OFF
- -DWITH_TIFF=$(usex tiff)
- -DWITH_UNICAP=OFF
- -DWITH_V4L=$(usex v4l)
- -DWITH_LIBV4L=$(usex v4l)
- -DWITH_DSHOW=ON
- -DWITH_MSMF=OFF
- -DWITH_XIMEA=OFF
- -DWITH_XINE=$(usex xine)
- -DWITH_OPENCL=$(usex opencl)
- -DWITH_OPENCLAMDFFT=$(usex opencl)
- -DWITH_OPENCLAMDBLAS=$(usex opencl)
- -DWITH_INTELPERC=OFF
- -DWITH_JAVA=$(usex java)
-
- # the build components
- -DBUILD_SHARED_LIBS=ON
- -DBUILD_ANDROID_EXAMPLES=OFF
- -DBUILD_DOCS=OFF #too much dark magic in cmakelists
- -DBUILD_EXAMPLES=$(usex examples)
- -DBUILD_PERF_TESTS=OFF
- -DBUILD_TESTS=$(usex testprograms)
-
- # install examples
- -DINSTALL_C_EXAMPLES=$(usex examples)
- -DINSTALL_TESTS=$(usex testprograms)
-
- # build options
- -DENABLE_PRECOMPILED_HEADERS=$(usex pch)
- -DENABLE_SOLUTION_FOLDERS=OFF
- -DENABLE_PROFILING=OFF
- -DENABLE_COVERAGE=OFF
- -DENABLE_OMIT_FRAME_POINTER=OFF
- -DENABLE_FAST_MATH=OFF #
- -DENABLE_SSE=OFF # these options do nothing but
- -DENABLE_SSE2=OFF # add params to CFLAGS
- -DENABLE_SSE3=OFF
- -DENABLE_SSSE3=OFF
- -DENABLE_SSE41=OFF
- -DENABLE_SSE42=OFF
-
- -DOPENCV_EXTRA_FLAGS_RELEASE="" # black magic
- )
-
- if use cuda; then
- if [[ "$(gcc-version)" > "4.8" ]]; then
- # bug 577410
- # #error -- unsupported GNU version! gcc 4.9 and up are not supported!
- ewarn "CUDA and >=sys-devel/gcc-4.9 do not play well together. Disabling CUDA support."
- mycmakeargs+=( -DWITH_CUDA=OFF )
- mycmakeargs+=( -DWITH_CUBLAS=OFF )
- mycmakeargs+=( -DWITH_CUFFT=OFF )
-
- else
- mycmakeargs+=( -DWITH_CUDA=ON )
- mycmakeargs+=( -DWITH_CUBLAS=ON )
- mycmakeargs+=( -DWITH_CUFFT=ON )
- mycmakeargs+=( -DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda )
- fi
- else
- mycmakeargs+=( -DWITH_CUDA=OFF )
- mycmakeargs+=( -DWITH_CUBLAS=OFF )
- mycmakeargs+=( -DWITH_CUFFT=OFF )
- fi
-
- if use examples && use python; then
- mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=ON )
- else
- mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=OFF )
- fi
-
- # things we want to be hard off or not yet figured out
- mycmakeargs+=(
- -DOPENCV_BUILD_3RDPARTY_LIBS=OFF
- -DBUILD_PACKAGE=OFF
- )
-
- # things we want to be hard enabled not worth useflag
- mycmakeargs+=(
- -DCMAKE_SKIP_RPATH=ON
- -DOPENCV_DOC_INSTALL_PATH=
- )
-
- # workaround for bug 413429
- tc-export CC CXX
-
- cmake-utils_src_configure
-}