summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2016-10-03 17:46:28 +0000
committerJan Beich <jbeich@FreeBSD.org>2016-10-03 17:46:28 +0000
commit2765ae7dd310dab626a72b59023dd6b24da0f225 (patch)
treef254ea470312eeddf29188e8ee6f9ec0cc147283
parent4035d20097ea8c5014d248264fb13b5ccf17103d (diff)
downloadfreebsd-ports-2765ae7dd310dab626a72b59023dd6b24da0f225.zip
graphics/opencv: update to 2.4.13.1
Changes: https://github.com/opencv/opencv/compare/2.4.9...2.4.13.1 ABI: https://abi-laboratory.pro/tracker/timeline/opencv/ MFH: 2016Q4
-rw-r--r--graphics/opencv-core/Makefile2
-rw-r--r--graphics/opencv-core/pkg-plist2
-rw-r--r--graphics/opencv-java/Makefile4
-rw-r--r--graphics/opencv/Makefile22
-rw-r--r--graphics/opencv/distinfo6
-rw-r--r--graphics/opencv/files/patch-apps__traincascade__imagestorage.h10
-rw-r--r--graphics/opencv/files/patch-ffmpeg29221
-rw-r--r--graphics/opencv/files/patch-libav10748
-rw-r--r--graphics/opencv/files/patch-modules__core__src__system.cpp24
-rw-r--r--graphics/opencv/files/patch-modules_legacy_src_calibfilter.cpp123
-rw-r--r--graphics/opencv/files/patch-pkg-config50
-rw-r--r--graphics/opencv/pkg-plist21
-rw-r--r--graphics/py-opencv/Makefile2
13 files changed, 55 insertions, 1180 deletions
diff --git a/graphics/opencv-core/Makefile b/graphics/opencv-core/Makefile
index fa0de009e639..f3931332ccb6 100644
--- a/graphics/opencv-core/Makefile
+++ b/graphics/opencv-core/Makefile
@@ -1,7 +1,7 @@
# Created by: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$
-PORTREVISION= 3
+PORTREVISION= 0
PKGNAMESUFFIX= -${OCV_SLAVE}
COMMENT= OpenCV core libraries
diff --git a/graphics/opencv-core/pkg-plist b/graphics/opencv-core/pkg-plist
index 732116206b44..71ea81e139b3 100644
--- a/graphics/opencv-core/pkg-plist
+++ b/graphics/opencv-core/pkg-plist
@@ -1,3 +1,4 @@
+include/opencv2/core.hpp
include/opencv2/core/affine.hpp
include/opencv2/core/core.hpp
include/opencv2/core/core_c.h
@@ -13,6 +14,7 @@ include/opencv2/core/operations.hpp
include/opencv2/core/types_c.h
include/opencv2/core/version.hpp
include/opencv2/core/wimage.hpp
+include/opencv2/imgproc.hpp
include/opencv2/imgproc/imgproc.hpp
include/opencv2/imgproc/imgproc_c.h
include/opencv2/imgproc/types_c.h
diff --git a/graphics/opencv-java/Makefile b/graphics/opencv-java/Makefile
index 45e6ba8c78c0..452492510c7a 100644
--- a/graphics/opencv-java/Makefile
+++ b/graphics/opencv-java/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PORTREVISION= 2
+PORTREVISION= 0
CATEGORIES= graphics java
PKGNAMESUFFIX= -${OCV_SLAVE}
@@ -11,6 +11,6 @@ OCV_JAVA= yes
MASTERDIR= ${.CURDIR:H}/opencv
PLIST= ${.CURDIR}/pkg-plist
-PLIST_SUB+= OCV_VER=${PORTVERSION:S|.||g}
+PLIST_SUB+= OCV_VER=${DISTVERSION:R:S|.||g}
.include "${MASTERDIR}/Makefile"
diff --git a/graphics/opencv/Makefile b/graphics/opencv/Makefile
index 985152cef177..0955be8f7ab1 100644
--- a/graphics/opencv/Makefile
+++ b/graphics/opencv/Makefile
@@ -2,8 +2,8 @@
# $FreeBSD$
PORTNAME?= opencv
-PORTVERSION= 2.4.9
-PORTREVISION?= 8
+PORTVERSION= 2.4.13.1
+PORTREVISION?= 0
CATEGORIES= graphics
MAINTAINER= ports@FreeBSD.org
@@ -21,18 +21,18 @@ NOT_FOR_ARCHS= sparc64
NOT_FOR_ARCHS_REASON_sparc64= does not compile on sparc64
DATADIR= ${PREFIX}/share/OpenCV
-PLIST_SUB+= VERSION=${DISTVERSION}
+PLIST_SUB+= VERSION=${DISTVERSION:R}
CMAKE_ARGS+= -DWITH_CUDA:BOOL=Off \
-DWITH_PVAPI:BOOL=Off \
-DWITH_UNICAP:BOOL=Off \
- -DENABLE_PRECOMPILED_HEADERS:BOOL=Off \
-DBUILD_TESTS:BOOL=Off \
-DBUILD_DOCS:BOOL=Off \
+ -DENABLE_PRECOMPILED_HEADERS:BOOL=Off \
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_CMD}
SUB_FILES= FindOpenCVCore.cmake
-SUB_LIST= OCV_VERSION=${PORTVERSION}
+SUB_LIST= OCV_VERSION=${DISTVERSION:R}
OCV_CORE_MODS= core imgproc
OCV_MODS= calib3d contrib features2d flann gpu \
@@ -49,15 +49,15 @@ OPTIONS_GROUP_PERFORMANCE= EIGEN3 TBB
OPTIONS_GROUP_SIMD= ${OPTIONS_GROUP_SIMD_${MACHINE_ARCH}}
OPTIONS_GROUP_SIMD_amd64= ${OPTIONS_GROUP_SIMD_i386}
OPTIONS_GROUP_SIMD_armv6= NEON VFPV3
-OPTIONS_GROUP_SIMD_i386= SSE SSE2 SSE3 SSSE3 SSE41 SSE42 AVX
-OPTIONS_GROUP_VIDEO= FFMPEG GSTREAMER V4L XINE
+OPTIONS_GROUP_SIMD_i386= SSE SSE2 SSE3 SSSE3 SSE41 SSE42 AVX AVX2
+OPTIONS_GROUP_VIDEO= FFMPEG GSTREAMER GSTREAMER0 V4L XINE
OPTIONS_RADIO= GUI
OPTIONS_RADIO_GUI= GTK2 QT4
OPTIONS_DEFAULT= EIGEN3 JASPER JPEG PNG TIFF V4L ${MACHINE_CPU:tu}
OPTIONS_SUB= yes
.if defined(OCV_CORE)
OPTIONS_EXCLUDE= DC1394 EXAMPLES GTK2 QT4 JASPER JPEG NONFREE OPENEXR \
- OPENGL PNG TIFF FFMPEG GSTREAMER V4L XINE
+ OPENGL PNG TIFF FFMPEG GSTREAMER GSTREAMER0 V4L XINE
.endif
DC1394_DESC= IEEE 1394 camera support
@@ -76,7 +76,11 @@ EXAMPLES_PORTEXAMPLES= *
FFMPEG_LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg
FFMPEG_CMAKE_BOOL= WITH_FFMPEG
-GSTREAMER_USE= GSTREAMER=yes
+GSTREAMER0_DESC= ${GSTREAMER_DESC} 0.10
+GSTREAMER0_USE= GSTREAMER=yes
+GSTREAMER0_CMAKE_BOOL= WITH_GSTREAMER_0_10
+
+GSTREAMER_USE= GSTREAMER1=yes
GSTREAMER_CMAKE_BOOL= WITH_GSTREAMER
GTK2_USE= GNOME=gtk20
diff --git a/graphics/opencv/distinfo b/graphics/opencv/distinfo
index aefcba222390..bdc98110c8db 100644
--- a/graphics/opencv/distinfo
+++ b/graphics/opencv/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1475284055
-SHA256 (opencv-opencv-2.4.9_GH0.tar.gz) = b5b88a64bf80ba953ffe8c33f3e00046edb773ada8aaaab7538c0059a45d1259
-SIZE (opencv-opencv-2.4.9_GH0.tar.gz) = 89071769
+TIMESTAMP = 1475482010
+SHA256 (opencv-opencv-2.4.13.1_GH0.tar.gz) = 0d5ce5e0973e3a745f927d1ee097aaf909aae59f787be6d27a03d639e2d96bd7
+SIZE (opencv-opencv-2.4.13.1_GH0.tar.gz) = 91773677
diff --git a/graphics/opencv/files/patch-apps__traincascade__imagestorage.h b/graphics/opencv/files/patch-apps__traincascade__imagestorage.h
deleted file mode 100644
index 61dcf175de25..000000000000
--- a/graphics/opencv/files/patch-apps__traincascade__imagestorage.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- ./apps/traincascade/imagestorage.h.orig 2013-07-10 07:49:00.000000000 -0400
-+++ ./apps/traincascade/imagestorage.h 2013-10-23 23:52:32.000000000 -0400
-@@ -1,6 +1,7 @@
- #ifndef _OPENCV_IMAGESTORAGE_H_
- #define _OPENCV_IMAGESTORAGE_H_
-
-+#include <cstdio>
- #include "highgui.h"
-
- using namespace cv;
diff --git a/graphics/opencv/files/patch-ffmpeg29 b/graphics/opencv/files/patch-ffmpeg29
deleted file mode 100644
index f7245cd44a6d..000000000000
--- a/graphics/opencv/files/patch-ffmpeg29
+++ /dev/null
@@ -1,221 +0,0 @@
-Description: Replace deprecated FFmpeg API
-Author: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-Last-Update: <2015-11-02>
-
---- modules/highgui/src/cap_ffmpeg_impl.hpp.orig
-+++ modules/highgui/src/cap_ffmpeg_impl.hpp
-@@ -136,9 +136,9 @@ extern "C" {
- #define CV_WARN(message) fprintf(stderr, "warning: %s (%s:%d)\n", message, __FILE__, __LINE__)
- #endif
-
--/* PIX_FMT_RGBA32 macro changed in newer ffmpeg versions */
--#ifndef PIX_FMT_RGBA32
--#define PIX_FMT_RGBA32 PIX_FMT_RGB32
-+/* AV_PIX_FMT_RGBA32 macro changed in newer ffmpeg versions */
-+#ifndef AV_PIX_FMT_RGBA32
-+#define AV_PIX_FMT_RGBA32 AV_PIX_FMT_RGB32
- #endif
-
- #define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
-@@ -304,7 +304,7 @@ void CvCapture_FFMPEG::close()
- }
-
- if( picture )
-- av_free(picture);
-+ av_frame_free(&picture);
-
- if( video_st )
- {
-@@ -572,13 +572,13 @@ bool CvCapture_FFMPEG::open( const char*
-
- video_stream = i;
- video_st = ic->streams[i];
-- picture = avcodec_alloc_frame();
-+ picture = av_frame_alloc();
-
- rgb_picture.data[0] = (uint8_t*)malloc(
-- avpicture_get_size( PIX_FMT_BGR24,
-+ avpicture_get_size( AV_PIX_FMT_BGR24,
- enc->width, enc->height ));
- avpicture_fill( (AVPicture*)&rgb_picture, rgb_picture.data[0],
-- PIX_FMT_BGR24, enc->width, enc->height );
-+ AV_PIX_FMT_BGR24, enc->width, enc->height );
-
- frame.width = enc->width;
- frame.height = enc->height;
-@@ -670,7 +670,7 @@ bool CvCapture_FFMPEG::retrieveFrame(int
- if( !video_st || !picture->data[0] )
- return false;
-
-- avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], PIX_FMT_RGB24,
-+ avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], AV_PIX_FMT_RGB24,
- video_st->codec->width, video_st->codec->height);
-
- if( img_convert_ctx == NULL ||
-@@ -688,7 +688,7 @@ bool CvCapture_FFMPEG::retrieveFrame(int
- video_st->codec->width, video_st->codec->height,
- video_st->codec->pix_fmt,
- video_st->codec->width, video_st->codec->height,
-- PIX_FMT_BGR24,
-+ AV_PIX_FMT_BGR24,
- SWS_BICUBIC,
- NULL, NULL, NULL
- );
-@@ -1001,10 +1001,10 @@ static AVFrame * icv_alloc_picture_FFMPE
- uint8_t * picture_buf;
- int size;
-
-- picture = avcodec_alloc_frame();
-+ picture = av_frame_alloc();
- if (!picture)
- return NULL;
-- size = avpicture_get_size( (PixelFormat) pix_fmt, width, height);
-+ size = avpicture_get_size( (AVPixelFormat) pix_fmt, width, height);
- if(alloc){
- picture_buf = (uint8_t *) malloc(size);
- if (!picture_buf)
-@@ -1013,7 +1013,7 @@ static AVFrame * icv_alloc_picture_FFMPE
- return NULL;
- }
- avpicture_fill((AVPicture *)picture, picture_buf,
-- (PixelFormat) pix_fmt, width, height);
-+ (AVPixelFormat) pix_fmt, width, height);
- }
- else {
- }
-@@ -1096,7 +1096,7 @@ static AVStream *icv_add_video_stream_FF
- }
-
- c->gop_size = 12; /* emit one intra frame every twelve frames at most */
-- c->pix_fmt = (PixelFormat) pixel_format;
-+ c->pix_fmt = (AVPixelFormat) pixel_format;
-
- if (c->codec_id == CV_CODEC(CODEC_ID_MPEG2VIDEO)) {
- c->max_b_frames = 2;
-@@ -1220,12 +1220,12 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
- }
-
- // check parameters
-- if (input_pix_fmt == PIX_FMT_BGR24) {
-+ if (input_pix_fmt == AV_PIX_FMT_BGR24) {
- if (cn != 3) {
- return false;
- }
- }
-- else if (input_pix_fmt == PIX_FMT_GRAY8) {
-+ else if (input_pix_fmt == AV_PIX_FMT_GRAY8) {
- if (cn != 1) {
- return false;
- }
-@@ -1238,13 +1238,13 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
- assert( input_picture );
- // let input_picture point to the raw data buffer of 'image'
- avpicture_fill((AVPicture *)input_picture, (uint8_t *) data,
-- (PixelFormat)input_pix_fmt, width, height);
-+ (AVPixelFormat)input_pix_fmt, width, height);
-
- if( !img_convert_ctx )
- {
- img_convert_ctx = sws_getContext(width,
- height,
-- (PixelFormat)input_pix_fmt,
-+ (AVPixelFormat)input_pix_fmt,
- c->width,
- c->height,
- c->pix_fmt,
-@@ -1262,7 +1262,7 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
- }
- else{
- avpicture_fill((AVPicture *)picture, (uint8_t *) data,
-- (PixelFormat)input_pix_fmt, width, height);
-+ (AVPixelFormat)input_pix_fmt, width, height);
- }
-
- ret = icv_av_write_frame_FFMPEG( oc, video_st, outbuf, outbuf_size, picture) >= 0;
-@@ -1373,10 +1373,10 @@ bool CvVideoWriter_FFMPEG::open( const c
-
- /* determine optimal pixel format */
- if (is_color) {
-- input_pix_fmt = PIX_FMT_BGR24;
-+ input_pix_fmt = AV_PIX_FMT_BGR24;
- }
- else {
-- input_pix_fmt = PIX_FMT_GRAY8;
-+ input_pix_fmt = AV_PIX_FMT_GRAY8;
- }
-
- /* Lookup codec_id for given fourcc */
-@@ -1402,21 +1402,21 @@ bool CvVideoWriter_FFMPEG::open( const c
- codec_pix_fmt = input_pix_fmt;
- break;
- case CV_CODEC(CODEC_ID_HUFFYUV):
-- codec_pix_fmt = PIX_FMT_YUV422P;
-+ codec_pix_fmt = AV_PIX_FMT_YUV422P;
- break;
- case CV_CODEC(CODEC_ID_MJPEG):
- case CV_CODEC(CODEC_ID_LJPEG):
-- codec_pix_fmt = PIX_FMT_YUVJ420P;
-+ codec_pix_fmt = AV_PIX_FMT_YUVJ420P;
- bitrate_scale = 3;
- break;
- case CV_CODEC(CODEC_ID_RAWVIDEO):
-- codec_pix_fmt = input_pix_fmt == PIX_FMT_GRAY8 ||
-- input_pix_fmt == PIX_FMT_GRAY16LE ||
-- input_pix_fmt == PIX_FMT_GRAY16BE ? input_pix_fmt : PIX_FMT_YUV420P;
-+ codec_pix_fmt = input_pix_fmt == AV_PIX_FMT_GRAY8 ||
-+ input_pix_fmt == AV_PIX_FMT_GRAY16LE ||
-+ input_pix_fmt == AV_PIX_FMT_GRAY16BE ? input_pix_fmt : AV_PIX_FMT_YUV420P;
- break;
- default:
- // good for lossy formats, MPEG, etc.
-- codec_pix_fmt = PIX_FMT_YUV420P;
-+ codec_pix_fmt = AV_PIX_FMT_YUV420P;
- break;
- }
-
-@@ -1609,7 +1609,7 @@ struct OutputMediaStream_FFMPEG
- void write(unsigned char* data, int size, int keyFrame);
-
- // add a video output stream to the container
-- static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format);
-+ static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format);
-
- AVOutputFormat* fmt_;
- AVFormatContext* oc_;
-@@ -1648,7 +1648,7 @@ void OutputMediaStream_FFMPEG::close()
- }
- }
-
--AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format)
-+AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, AVPixelFormat pixel_format)
- {
- AVStream* st = avformat_new_stream(oc, 0);
- if (!st)
-@@ -1766,7 +1766,7 @@ bool OutputMediaStream_FFMPEG::open(cons
- oc_->max_delay = (int)(0.7 * AV_TIME_BASE); // This reduces buffer underrun warnings with MPEG
-
- // set a few optimal pixel formats for lossless codecs of interest..
-- PixelFormat codec_pix_fmt = PIX_FMT_YUV420P;
-+ AVPixelFormat codec_pix_fmt = AV_PIX_FMT_YUV420P;
- int bitrate_scale = 64;
-
- // TODO -- safe to ignore output audio stream?
-@@ -1943,15 +1943,15 @@ bool InputMediaStream_FFMPEG::open(const
-
- switch (enc->pix_fmt)
- {
-- case PIX_FMT_YUV420P:
-+ case AV_PIX_FMT_YUV420P:
- *chroma_format = ::VideoChromaFormat_YUV420;
- break;
-
-- case PIX_FMT_YUV422P:
-+ case AV_PIX_FMT_YUV422P:
- *chroma_format = ::VideoChromaFormat_YUV422;
- break;
-
-- case PIX_FMT_YUV444P:
-+ case AV_PIX_FMT_YUV444P:
- *chroma_format = ::VideoChromaFormat_YUV444;
- break;
-
diff --git a/graphics/opencv/files/patch-libav10 b/graphics/opencv/files/patch-libav10
deleted file mode 100644
index 4e9255974989..000000000000
--- a/graphics/opencv/files/patch-libav10
+++ /dev/null
@@ -1,748 +0,0 @@
-From: anton@khirnov.net
-Description: Support building with the upcoming Libav 10 release
-Origin: upstream, https://github.com/Itseez/opencv/pull/2293
-
---- modules/highgui/src/cap_ffmpeg_impl.hpp.orig
-+++ modules/highgui/src/cap_ffmpeg_impl.hpp
-@@ -57,10 +57,28 @@
- extern "C" {
- #endif
-
--#include "ffmpeg_codecs.hpp"
-+#if !defined(WIN32) || defined(__MINGW32__)
-
-+#include <stdint.h>
-+
-+// some versions of FFMPEG assume a C99 compiler, and don't define INT64_C
-+#ifndef INT64_C
-+#define INT64_C(c) (c##LL)
-+#endif
-+
-+#ifndef UINT64_C
-+#define UINT64_C(c) (c##ULL)
-+#endif
-+
-+#include <errno.h>
-+
-+#endif
-+
-+#include <libavformat/avformat.h>
- #include <libavutil/mathematics.h>
-
-+#include <libavutil/opt.h>
-+
- #ifdef WIN32
- #define HAVE_FFMPEG_SWSCALE 1
- #include <libavcodec/avcodec.h>
-@@ -144,10 +162,6 @@ extern "C" {
- #define AV_NOPTS_VALUE_ ((int64_t)AV_NOPTS_VALUE)
- #endif
-
--#ifndef AVERROR_EOF
--#define AVERROR_EOF (-MKTAG( 'E','O','F',' '))
--#endif
--
- #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0)
- # define CV_CODEC_ID AVCodecID
- # define CV_CODEC(name) AV_##name
-@@ -158,9 +172,7 @@ extern "C" {
-
- static int get_number_of_cpus(void)
- {
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(52, 111, 0)
-- return 1;
--#elif defined WIN32 || defined _WIN32
-+#if defined WIN32 || defined _WIN32
- SYSTEM_INFO sysinfo;
- GetSystemInfo( &sysinfo );
-
-@@ -296,25 +308,13 @@ void CvCapture_FFMPEG::close()
-
- if( video_st )
- {
--#if LIBAVFORMAT_BUILD > 4628
- avcodec_close( video_st->codec );
--
--#else
-- avcodec_close( &(video_st->codec) );
--
--#endif
- video_st = NULL;
- }
-
- if( ic )
- {
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 24, 2)
-- av_close_input_file(ic);
--#else
- avformat_close_input(&ic);
--#endif
--
-- ic = NULL;
- }
-
- if( rgb_picture.data[0] )
-@@ -501,9 +501,7 @@ public:
- _mutex.lock();
- if (!_initialized)
- {
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
- avformat_network_init();
-- #endif
-
- /* register all codecs, demux and protocols */
- av_register_all();
-@@ -534,11 +532,7 @@ bool CvCapture_FFMPEG::open( const char*
-
- close();
-
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
- int err = avformat_open_input(&ic, _filename, NULL, NULL);
--#else
-- int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
--#endif
-
- if (err < 0)
- {
-@@ -546,11 +540,7 @@ bool CvCapture_FFMPEG::open( const char*
- goto exit_func;
- }
- err =
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
- avformat_find_stream_info(ic, NULL);
--#else
-- av_find_stream_info(ic);
--#endif
- if (err < 0)
- {
- CV_WARN("Could not find codec parameters");
-@@ -558,11 +548,7 @@ bool CvCapture_FFMPEG::open( const char*
- }
- for(i = 0; i < ic->nb_streams; i++)
- {
--#if LIBAVFORMAT_BUILD > 4628
- AVCodecContext *enc = ic->streams[i]->codec;
--#else
-- AVCodecContext *enc = &ic->streams[i]->codec;
--#endif
-
- //#ifdef FF_API_THREAD_INIT
- // avcodec_thread_init(enc, get_number_of_cpus());
-@@ -570,10 +556,6 @@ bool CvCapture_FFMPEG::open( const char*
- enc->thread_count = get_number_of_cpus();
- //#endif
-
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
--#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
--#endif
--
- if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0)
- {
- // backup encoder' width/height
-@@ -581,13 +563,7 @@ bool CvCapture_FFMPEG::open( const char*
- int enc_height = enc->height;
-
- AVCodec *codec = avcodec_find_decoder(enc->codec_id);
-- if (!codec ||
--#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
-- avcodec_open2(enc, codec, NULL)
--#else
-- avcodec_open(enc, codec)
--#endif
-- < 0)
-+ if (!codec || avcodec_open2(enc, codec, NULL) < 0)
- goto exit_func;
-
- // checking width/height (since decoder can sometimes alter it, eg. vp6f)
-@@ -660,17 +636,7 @@ bool CvCapture_FFMPEG::grabFrame()
- }
-
- // Decode video frame
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
- avcodec_decode_video2(video_st->codec, picture, &got_picture, &packet);
-- #elif LIBAVFORMAT_BUILD > 4628
-- avcodec_decode_video(video_st->codec,
-- picture, &got_picture,
-- packet.data, packet.size);
-- #else
-- avcodec_decode_video(&video_st->codec,
-- picture, &got_picture,
-- packet.data, packet.size);
-- #endif
-
- // Did we get a video frame?
- if(got_picture)
-@@ -769,18 +735,9 @@ double CvCapture_FFMPEG::getProperty( in
- case CV_FFMPEG_CAP_PROP_FRAME_HEIGHT:
- return (double)frame.height;
- case CV_FFMPEG_CAP_PROP_FPS:
--#if LIBAVCODEC_BUILD > 4753
-- return av_q2d(video_st->r_frame_rate);
--#else
-- return (double)video_st->codec.frame_rate
-- / (double)video_st->codec.frame_rate_base;
--#endif
-+ return av_q2d(video_st->avg_frame_rate);
- case CV_FFMPEG_CAP_PROP_FOURCC:
--#if LIBAVFORMAT_BUILD > 4628
- return (double)video_st->codec->codec_tag;
--#else
-- return (double)video_st->codec.codec_tag;
--#endif
- default:
- break;
- }
-@@ -817,14 +774,7 @@ int CvCapture_FFMPEG::get_bitrate()
-
- double CvCapture_FFMPEG::get_fps()
- {
-- double fps = r2d(ic->streams[video_stream]->r_frame_rate);
--
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
-- if (fps < eps_zero)
-- {
-- fps = r2d(ic->streams[video_stream]->avg_frame_rate);
-- }
--#endif
-+ double fps = r2d(ic->streams[video_stream]->avg_frame_rate);
-
- if (fps < eps_zero)
- {
-@@ -984,7 +934,6 @@ struct CvVideoWriter_FFMPEG
-
- static const char * icvFFMPEGErrStr(int err)
- {
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
- switch(err) {
- case AVERROR_BSF_NOT_FOUND:
- return "Bitstream filter not found";
-@@ -1015,22 +964,6 @@ static const char * icvFFMPEGErrStr(int
- default:
- break;
- }
--#else
-- switch(err) {
-- case AVERROR_NUMEXPECTED:
-- return "Incorrect filename syntax";
-- case AVERROR_INVALIDDATA:
-- return "Invalid data in header";
-- case AVERROR_NOFMT:
-- return "Unknown format";
-- case AVERROR_IO:
-- return "I/O error occurred";
-- case AVERROR_NOMEM:
-- return "Memory allocation error";
-- default:
-- break;
-- }
--#endif
-
- return "Unspecified error";
- }
-@@ -1098,28 +1031,16 @@ static AVStream *icv_add_video_stream_FF
- int frame_rate, frame_rate_base;
- AVCodec *codec;
-
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0)
- st = avformat_new_stream(oc, 0);
--#else
-- st = av_new_stream(oc, 0);
--#endif
-
- if (!st) {
- CV_WARN("Could not allocate stream");
- return NULL;
- }
-
--#if LIBAVFORMAT_BUILD > 4628
- c = st->codec;
--#else
-- c = &(st->codec);
--#endif
-
--#if LIBAVFORMAT_BUILD > 4621
- c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
--#else
-- c->codec_id = oc->oformat->video_codec;
--#endif
-
- if(codec_id != CV_CODEC(CODEC_ID_NONE)){
- c->codec_id = codec_id;
-@@ -1154,7 +1075,6 @@ static AVStream *icv_add_video_stream_FF
- frame_rate_base*=10;
- frame_rate=(int)(fps*frame_rate_base + 0.5);
- }
--#if LIBAVFORMAT_BUILD > 4752
- c->time_base.den = frame_rate;
- c->time_base.num = frame_rate_base;
- /* adjust time base for supported framerates */
-@@ -1174,10 +1094,6 @@ static AVStream *icv_add_video_stream_FF
- c->time_base.den= best->num;
- c->time_base.num= best->den;
- }
--#else
-- c->frame_rate = frame_rate;
-- c->frame_rate_base = frame_rate_base;
--#endif
-
- c->gop_size = 12; /* emit one intra frame every twelve frames at most */
- c->pix_fmt = (PixelFormat) pixel_format;
-@@ -1207,12 +1123,7 @@ static const int OPENCV_NO_FRAMES_WRITTE
-
- static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, uint8_t * outbuf, uint32_t outbuf_size, AVFrame * picture )
- {
--#if LIBAVFORMAT_BUILD > 4628
- AVCodecContext * c = video_st->codec;
--#else
-- AVCodecContext * c = &(video_st->codec);
--#endif
-- int out_size;
- int ret = 0;
-
- if (oc->oformat->flags & AVFMT_RAWPICTURE) {
-@@ -1232,24 +1143,39 @@ static int icv_av_write_frame_FFMPEG( AV
-
- ret = av_write_frame(oc, &pkt);
- } else {
-+ AVPacket pkt;
-+ int got_output;
-+
-+ av_init_packet(&pkt);
-+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 1, 0)
- /* encode the image */
-- out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
-- /* if zero size, it means the image was buffered */
-- if (out_size > 0) {
-- AVPacket pkt;
-- av_init_packet(&pkt);
--
--#if LIBAVFORMAT_BUILD > 4752
-- if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE)
-- pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_st->time_base);
--#else
-+ int out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
-+ got_output = out_size > 0;
-+ pkt.data = outbuf;
-+ pkt.size = out_size;
-+ if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE)
- pkt.pts = c->coded_frame->pts;
-+ pkt.dts = AV_NOPTS_VALUE;
-+ if(c->coded_frame->key_frame)
-+ pkt.flags |= PKT_FLAG_KEY;
-+#else
-+ pkt.data = NULL;
-+ pkt.size = 0;
-+
-+ ret = avcodec_encode_video2(c, &pkt, picture, &got_output);
-+ if (ret < 0)
-+ got_output = 0;
- #endif
-- if(c->coded_frame->key_frame)
-- pkt.flags |= PKT_FLAG_KEY;
-+
-+ if (got_output) {
-+ if (pkt.pts != (int64_t)AV_NOPTS_VALUE)
-+ pkt.pts = av_rescale_q(pkt.pts, c->time_base, video_st->time_base);
-+ if (pkt.dts != (int64_t)AV_NOPTS_VALUE)
-+ pkt.dts = av_rescale_q(pkt.dts, c->time_base, video_st->time_base);
-+ if (pkt.duration)
-+ pkt.duration = av_rescale_q(pkt.duration, c->time_base, video_st->time_base);
-+
- pkt.stream_index= video_st->index;
-- pkt.data= outbuf;
-- pkt.size= out_size;
-
- /* write the compressed frame in the media file */
- ret = av_write_frame(oc, &pkt);
-@@ -1271,30 +1197,8 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
- height = frame_height;
-
- // typecast from opaque data type to implemented struct
--#if LIBAVFORMAT_BUILD > 4628
- AVCodecContext *c = video_st->codec;
--#else
-- AVCodecContext *c = &(video_st->codec);
--#endif
-
--#if LIBAVFORMAT_BUILD < 5231
-- // It is not needed in the latest versions of the ffmpeg
-- if( c->codec_id == CV_CODEC(CODEC_ID_RAWVIDEO) && origin != 1 )
-- {
-- if( !temp_image.data )
-- {
-- temp_image.step = (width*cn + 3) & -4;
-- temp_image.width = width;
-- temp_image.height = height;
-- temp_image.cn = cn;
-- temp_image.data = (unsigned char*)malloc(temp_image.step*temp_image.height);
-- }
-- for( int y = 0; y < height; y++ )
-- memcpy(temp_image.data + y*temp_image.step, data + (height-1-y)*step, width*cn);
-- data = temp_image.data;
-- step = temp_image.step;
-- }
--#else
- if( width*cn != step )
- {
- if( !temp_image.data )
-@@ -1314,7 +1218,6 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
- data = temp_image.data;
- step = temp_image.step;
- }
--#endif
-
- // check parameters
- if (input_pix_fmt == PIX_FMT_BGR24) {
-@@ -1401,11 +1304,7 @@ void CvVideoWriter_FFMPEG::close()
- }
-
- // free pictures
--#if LIBAVFORMAT_BUILD > 4628
- if( video_st->codec->pix_fmt != input_pix_fmt)
--#else
-- if( video_st->codec.pix_fmt != input_pix_fmt)
--#endif
- {
- if(picture->data[0])
- free(picture->data[0]);
-@@ -1417,11 +1316,7 @@ void CvVideoWriter_FFMPEG::close()
- av_free(input_picture);
-
- /* close codec */
--#if LIBAVFORMAT_BUILD > 4628
- avcodec_close(video_st->codec);
--#else
-- avcodec_close(&(video_st->codec));
--#endif
-
- av_free(outbuf);
-
-@@ -1429,15 +1324,7 @@ void CvVideoWriter_FFMPEG::close()
- {
- /* close the output file */
-
--#if LIBAVCODEC_VERSION_INT < ((52<<16)+(123<<8)+0)
--#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(49<<8)+0)
-- url_fclose(oc->pb);
--#else
-- url_fclose(&oc->pb);
--#endif
--#else
- avio_close(oc->pb);
--#endif
-
- }
-
-@@ -1479,11 +1366,7 @@ bool CvVideoWriter_FFMPEG::open( const c
-
- /* auto detect the output format from the name and fourcc code. */
-
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
- fmt = av_guess_format(NULL, filename, NULL);
--#else
-- fmt = guess_format(NULL, filename, NULL);
--#endif
-
- if (!fmt)
- return false;
-@@ -1497,21 +1380,12 @@ bool CvVideoWriter_FFMPEG::open( const c
- }
-
- /* Lookup codec_id for given fourcc */
--#if LIBAVCODEC_VERSION_INT<((51<<16)+(49<<8)+0)
-- if( (codec_id = codec_get_bmp_id( fourcc )) == CV_CODEC(CODEC_ID_NONE) )
-- return false;
--#else
-- const struct AVCodecTag * tags[] = { codec_bmp_tags, NULL};
-+ const struct AVCodecTag * tags[] = { avformat_get_riff_video_tags(), NULL};
- if( (codec_id = av_codec_get_id(tags, fourcc)) == CV_CODEC(CODEC_ID_NONE) )
- return false;
--#endif
-
- // alloc memory for context
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
- oc = avformat_alloc_context();
--#else
-- oc = av_alloc_format_context();
--#endif
- assert (oc);
-
- /* set file name */
-@@ -1523,12 +1397,10 @@ bool CvVideoWriter_FFMPEG::open( const c
-
- // set a few optimal pixel formats for lossless codecs of interest..
- switch (codec_id) {
--#if LIBAVCODEC_VERSION_INT>((50<<16)+(1<<8)+0)
- case CV_CODEC(CODEC_ID_JPEGLS):
- // BGR24 or GRAY8 depending on is_color...
- codec_pix_fmt = input_pix_fmt;
- break;
--#endif
- case CV_CODEC(CODEC_ID_HUFFYUV):
- codec_pix_fmt = PIX_FMT_YUV422P;
- break;
-@@ -1555,14 +1427,6 @@ bool CvVideoWriter_FFMPEG::open( const c
- width, height, (int)(bitrate + 0.5),
- fps, codec_pix_fmt);
-
-- /* set the output parameters (must be done even if no
-- parameters). */
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
-- if (av_set_parameters(oc, NULL) < 0) {
-- return false;
-- }
--#endif
--
- #if 0
- #if FF_API_DUMP_FORMAT
- dump_format(oc, 0, filename, 1);
-@@ -1580,23 +1444,14 @@ bool CvVideoWriter_FFMPEG::open( const c
- AVCodec *codec;
- AVCodecContext *c;
-
--#if LIBAVFORMAT_BUILD > 4628
- c = (video_st->codec);
--#else
-- c = &(video_st->codec);
--#endif
-
- c->codec_tag = fourcc;
- /* find the video encoder */
- codec = avcodec_find_encoder(c->codec_id);
- if (!codec) {
- fprintf(stderr, "Could not find encoder for codec id %d: %s", c->codec_id, icvFFMPEGErrStr(
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
-- AVERROR_ENCODER_NOT_FOUND
-- #else
-- -1
-- #endif
-- ));
-+ AVERROR_ENCODER_NOT_FOUND));
- return false;
- }
-
-@@ -1607,13 +1462,7 @@ bool CvVideoWriter_FFMPEG::open( const c
- c->bit_rate = (int)lbit_rate;
-
- /* open the codec */
-- if ((err=
--#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
-- avcodec_open2(c, codec, NULL)
--#else
-- avcodec_open(c, codec)
--#endif
-- ) < 0) {
-+ if ((err = avcodec_open2(c, codec, NULL)) < 0) {
- fprintf(stderr, "Could not open codec '%s': %s", codec->name, icvFFMPEGErrStr(err));
- return false;
- }
-@@ -1649,22 +1498,14 @@ bool CvVideoWriter_FFMPEG::open( const c
-
- /* open the output file, if needed */
- if (!(fmt->flags & AVFMT_NOFILE)) {
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
-- if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0)
--#else
- if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0)
--#endif
- {
- return false;
- }
- }
-
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
- /* write the stream header, if any */
- err=avformat_write_header(oc, NULL);
--#else
-- err=av_write_header( oc );
--#endif
-
- if(err < 0)
- {
-@@ -1799,15 +1640,7 @@ void OutputMediaStream_FFMPEG::close()
- {
- // close the output file
-
-- #if LIBAVCODEC_VERSION_INT < ((52<<16)+(123<<8)+0)
-- #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(49<<8)+0)
-- url_fclose(oc_->pb);
-- #else
-- url_fclose(&oc_->pb);
-- #endif
-- #else
-- avio_close(oc_->pb);
-- #endif
-+ avio_close(oc_->pb);
- }
-
- // free the stream
-@@ -1817,19 +1650,11 @@ void OutputMediaStream_FFMPEG::close()
-
- AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format)
- {
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0)
- AVStream* st = avformat_new_stream(oc, 0);
-- #else
-- AVStream* st = av_new_stream(oc, 0);
-- #endif
- if (!st)
- return 0;
-
-- #if LIBAVFORMAT_BUILD > 4628
- AVCodecContext* c = st->codec;
-- #else
-- AVCodecContext* c = &(st->codec);
-- #endif
-
- c->codec_id = codec_id;
- c->codec_type = AVMEDIA_TYPE_VIDEO;
-@@ -1865,7 +1690,6 @@ AVStream* OutputMediaStream_FFMPEG::addV
- c->time_base.den = frame_rate;
- c->time_base.num = frame_rate_base;
-
-- #if LIBAVFORMAT_BUILD > 4752
- // adjust time base for supported framerates
- if (codec && codec->supported_framerates)
- {
-@@ -1890,7 +1714,6 @@ AVStream* OutputMediaStream_FFMPEG::addV
- c->time_base.den= best->num;
- c->time_base.num= best->den;
- }
-- #endif
-
- c->gop_size = 12; // emit one intra frame every twelve frames at most
- c->pix_fmt = pixel_format;
-@@ -1909,13 +1732,11 @@ AVStream* OutputMediaStream_FFMPEG::addV
- c->mb_decision = 2;
- }
-
-- #if LIBAVCODEC_VERSION_INT > 0x000409
- // some formats want stream headers to be seperate
- if (oc->oformat->flags & AVFMT_GLOBALHEADER)
- {
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
- }
-- #endif
-
- return st;
- }
-@@ -1927,22 +1748,14 @@ bool OutputMediaStream_FFMPEG::open(cons
- video_st_ = 0;
-
- // auto detect the output format from the name and fourcc code
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
- fmt_ = av_guess_format(NULL, fileName, NULL);
-- #else
-- fmt_ = guess_format(NULL, fileName, NULL);
-- #endif
- if (!fmt_)
- return false;
-
- CV_CODEC_ID codec_id = CV_CODEC(CODEC_ID_H264);
-
- // alloc memory for context
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
- oc_ = avformat_alloc_context();
-- #else
-- oc_ = av_alloc_format_context();
-- #endif
- if (!oc_)
- return false;
-
-@@ -1961,20 +1774,10 @@ bool OutputMediaStream_FFMPEG::open(cons
- if (!video_st_)
- return false;
-
-- // set the output parameters (must be done even if no parameters)
-- #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
-- if (av_set_parameters(oc_, NULL) < 0)
-- return false;
-- #endif
--
- // now that all the parameters are set, we can open the audio and
- // video codecs and allocate the necessary encode buffers
-
-- #if LIBAVFORMAT_BUILD > 4628
- AVCodecContext* c = (video_st_->codec);
-- #else
-- AVCodecContext* c = &(video_st_->codec);
-- #endif
-
- c->codec_tag = MKTAG('H', '2', '6', '4');
- c->bit_rate_tolerance = c->bit_rate;
-@@ -1982,22 +1785,14 @@ bool OutputMediaStream_FFMPEG::open(cons
- // open the output file, if needed
- if (!(fmt_->flags & AVFMT_NOFILE))
- {
-- #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
-- int err = url_fopen(&oc_->pb, fileName, URL_WRONLY);
-- #else
-- int err = avio_open(&oc_->pb, fileName, AVIO_FLAG_WRITE);
-- #endif
-+ int err = avio_open(&oc_->pb, fileName, AVIO_FLAG_WRITE);
-
- if (err != 0)
- return false;
- }
-
- // write the stream header, if any
-- #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
-- av_write_header(oc_);
-- #else
-- avformat_write_header(oc_, NULL);
-- #endif
-+ avformat_write_header(oc_, NULL);
-
- return true;
- }
-@@ -2102,33 +1897,19 @@ bool InputMediaStream_FFMPEG::open(const
- video_stream_id_ = -1;
- memset(&pkt_, 0, sizeof(AVPacket));
-
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
-- avformat_network_init();
-- #endif
--
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
-- err = avformat_open_input(&ctx_, fileName, 0, 0);
-- #else
-- err = av_open_input_file(&ctx_, fileName, 0, 0, 0);
-- #endif
-+ avformat_network_init();
-+
-+ err = avformat_open_input(&ctx_, fileName, 0, 0);
- if (err < 0)
- return false;
-
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
-- err = avformat_find_stream_info(ctx_, 0);
-- #else
-- err = av_find_stream_info(ctx_);
-- #endif
-+ err = avformat_find_stream_info(ctx_, 0);
- if (err < 0)
- return false;
-
- for (unsigned int i = 0; i < ctx_->nb_streams; ++i)
- {
-- #if LIBAVFORMAT_BUILD > 4628
- AVCodecContext *enc = ctx_->streams[i]->codec;
-- #else
-- AVCodecContext *enc = &ctx_->streams[i]->codec;
-- #endif
-
- if (enc->codec_type == AVMEDIA_TYPE_VIDEO)
- {
-@@ -2197,11 +1978,7 @@ void InputMediaStream_FFMPEG::close()
- {
- if (ctx_)
- {
-- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 24, 2)
-- avformat_close_input(&ctx_);
-- #else
-- av_close_input_file(ctx_);
-- #endif
-+ avformat_close_input(&ctx_);
- }
-
- // free last packet if exist
diff --git a/graphics/opencv/files/patch-modules__core__src__system.cpp b/graphics/opencv/files/patch-modules__core__src__system.cpp
index 88d9f7e75463..81eff621346d 100644
--- a/graphics/opencv/files/patch-modules__core__src__system.cpp
+++ b/graphics/opencv/files/patch-modules__core__src__system.cpp
@@ -1,15 +1,15 @@
---- ./modules/core/src/system.cpp.orig 2013-11-25 05:42:32.000000000 -0500
-+++ ./modules/core/src/system.cpp 2013-11-25 05:42:42.000000000 -0500
-@@ -126,7 +126,7 @@
+--- modules/core/src/system.cpp.orig 2016-09-16 15:55:58 UTC
++++ modules/core/src/system.cpp
+@@ -157,7 +157,7 @@ std::wstring GetTempFileNameWinRT(std::w
#include <stdarg.h>
--#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__
-+#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __FreeBSD__
+-#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __QNX__
++#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __QNX__ || defined __FreeBSD__
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
-@@ -897,14 +897,23 @@
+@@ -942,14 +942,23 @@ struct Mutex::Impl
struct Mutex::Impl
{
@@ -22,19 +22,19 @@
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&mt, &attr);
+ pthread_mutexattr_destroy(&attr);
-
-- void lock() { pthread_mutex_lock(&sl); }
-- bool trylock() { return pthread_mutex_trylock(&sl) == 0; }
-- void unlock() { pthread_mutex_unlock(&sl); }
++
+ refcount = 1;
+ }
+ ~Impl() { pthread_mutex_destroy(&mt); }
-- pthread_mutex_t sl;
+- void lock() { pthread_mutex_lock(&sl); }
+- bool trylock() { return pthread_mutex_trylock(&sl) == 0; }
+- void unlock() { pthread_mutex_unlock(&sl); }
+ void lock() { pthread_mutex_lock(&mt); }
+ bool trylock() { return pthread_mutex_trylock(&mt) == 0; }
+ void unlock() { pthread_mutex_unlock(&mt); }
-+
+
+- pthread_mutex_t sl;
+ pthread_mutex_t mt;
int refcount;
};
diff --git a/graphics/opencv/files/patch-modules_legacy_src_calibfilter.cpp b/graphics/opencv/files/patch-modules_legacy_src_calibfilter.cpp
deleted file mode 100644
index cc2e61b81941..000000000000
--- a/graphics/opencv/files/patch-modules_legacy_src_calibfilter.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
---- modules/legacy/src/calibfilter.cpp.orig 2014-04-11 10:15:26 UTC
-+++ modules/legacy/src/calibfilter.cpp
-@@ -95,11 +95,8 @@ bool CvCalibFilter::SetEtalon( CvCalibEt
-
- Stop();
-
-- if (latestPoints != NULL)
-- {
-- for( i = 0; i < MAX_CAMERAS; i++ )
-- cvFree( latestPoints + i );
-- }
-+ for( i = 0; i < MAX_CAMERAS; i++ )
-+ cvFree( latestPoints + i );
-
- if( type == CV_CALIB_ETALON_USER || type != etalonType )
- {
-@@ -529,64 +526,61 @@ void CvCalibFilter::DrawPoints( CvMat**
- return;
- }
-
-- if( latestCounts )
-+ for( i = 0; i < cameraCount; i++ )
- {
-- for( i = 0; i < cameraCount; i++ )
-+ if( dstarr[i] && latestCounts[i] )
- {
-- if( dstarr[i] && latestCounts[i] )
-- {
-- CvMat dst_stub, *dst;
-- int count = 0;
-- bool found = false;
-- CvPoint2D32f* pts = 0;
-+ CvMat dst_stub, *dst;
-+ int count = 0;
-+ bool found = false;
-+ CvPoint2D32f* pts = 0;
-
-- GetLatestPoints( i, &pts, &count, &found );
-+ GetLatestPoints( i, &pts, &count, &found );
-
-- dst = cvGetMat( dstarr[i], &dst_stub );
-+ dst = cvGetMat( dstarr[i], &dst_stub );
-
-- static const CvScalar line_colors[] =
-- {
-- {{0,0,255}},
-- {{0,128,255}},
-- {{0,200,200}},
-- {{0,255,0}},
-- {{200,200,0}},
-- {{255,0,0}},
-- {{255,0,255}}
-- };
-+ static const CvScalar line_colors[] =
-+ {
-+ {{0,0,255}},
-+ {{0,128,255}},
-+ {{0,200,200}},
-+ {{0,255,0}},
-+ {{200,200,0}},
-+ {{255,0,0}},
-+ {{255,0,255}}
-+ };
-
-- const int colorCount = sizeof(line_colors)/sizeof(line_colors[0]);
-- const int r = 4;
-- CvScalar color = line_colors[0];
-- CvPoint prev_pt = { 0, 0};
-+ const int colorCount = sizeof(line_colors)/sizeof(line_colors[0]);
-+ const int r = 4;
-+ CvScalar color = line_colors[0];
-+ CvPoint prev_pt = { 0, 0};
-
-- for( j = 0; j < count; j++ )
-- {
-- CvPoint pt;
-- pt.x = cvRound(pts[j].x);
-- pt.y = cvRound(pts[j].y);
-+ for( j = 0; j < count; j++ )
-+ {
-+ CvPoint pt;
-+ pt.x = cvRound(pts[j].x);
-+ pt.y = cvRound(pts[j].y);
-
-- if( found )
-- {
-- if( etalonType == CV_CALIB_ETALON_CHESSBOARD )
-- color = line_colors[(j/cvRound(etalonParams[0]))%colorCount];
-- else
-- color = CV_RGB(0,255,0);
-+ if( found )
-+ {
-+ if( etalonType == CV_CALIB_ETALON_CHESSBOARD )
-+ color = line_colors[(j/cvRound(etalonParams[0]))%colorCount];
-+ else
-+ color = CV_RGB(0,255,0);
-
-- if( j != 0 )
-- cvLine( dst, prev_pt, pt, color, 1, CV_AA );
-- }
-+ if( j != 0 )
-+ cvLine( dst, prev_pt, pt, color, 1, CV_AA );
-+ }
-
-- cvLine( dst, cvPoint( pt.x - r, pt.y - r ),
-- cvPoint( pt.x + r, pt.y + r ), color, 1, CV_AA );
-+ cvLine( dst, cvPoint( pt.x - r, pt.y - r ),
-+ cvPoint( pt.x + r, pt.y + r ), color, 1, CV_AA );
-
-- cvLine( dst, cvPoint( pt.x - r, pt.y + r),
-- cvPoint( pt.x + r, pt.y - r), color, 1, CV_AA );
-+ cvLine( dst, cvPoint( pt.x - r, pt.y + r),
-+ cvPoint( pt.x + r, pt.y - r), color, 1, CV_AA );
-
-- cvCircle( dst, pt, r+1, color, 1, CV_AA );
-+ cvCircle( dst, pt, r+1, color, 1, CV_AA );
-
-- prev_pt = pt;
-- }
-+ prev_pt = pt;
- }
- }
- }
diff --git a/graphics/opencv/files/patch-pkg-config b/graphics/opencv/files/patch-pkg-config
deleted file mode 100644
index d2b85d0bec40..000000000000
--- a/graphics/opencv/files/patch-pkg-config
+++ /dev/null
@@ -1,50 +0,0 @@
-Description: pkg-config is broken in OpenCV-2.4.x
-Bug: http://code.opencv.org/issues/1925
-Bug-Debian: http://bugs.debian.org/721894, http://bugs.debian.org/678222
-Author: Ray Rashif
-Last-Update: 2013-11-23
-
-diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake
-index a36b70e..a3733bc 100644
---- cmake/OpenCVGenPkgconfig.cmake
-+++ cmake/OpenCVGenPkgconfig.cmake
-@@ -10,7 +10,7 @@
- # -------------------------------------------------------------------------------------------
- set(prefix "${CMAKE_INSTALL_PREFIX}")
- set(exec_prefix "\${prefix}")
--set(libdir "") #TODO: need link paths for OpenCV_EXTRA_COMPONENTS
-+set(libdir "\${prefix}/${OPENCV_LIB_INSTALL_PATH}")
- set(includedir "\${prefix}/${OPENCV_INCLUDE_INSTALL_PATH}")
-
- if(CMAKE_BUILD_TYPE MATCHES "Release")
-@@ -35,10 +35,11 @@ ocv_list_reverse(OpenCV_LIB_COMPONENTS)
- ocv_list_reverse(OpenCV_EXTRA_COMPONENTS)
-
- #build the list of components
--set(OpenCV_LIB_COMPONENTS_ "")
-+set(OpenCV_LIB_COMPONENTS_ "-L\${libdir}")
- foreach(CVLib ${OpenCV_LIB_COMPONENTS})
- get_target_property(libpath ${CVLib} LOCATION_${CMAKE_BUILD_TYPE})
- get_filename_component(libname "${libpath}" NAME)
-+ get_filename_component(lname "${libpath}" NAME_WE)
-
- if(INSTALL_TO_MANGLED_PATHS)
- set(libname "${libname}.${OPENCV_VERSION}")
-@@ -52,6 +53,8 @@ foreach(CVLib ${OpenCV_LIB_COMPONENTS})
- endif()
-
- set(OpenCV_LIB_COMPONENTS_ "${OpenCV_LIB_COMPONENTS_} \${exec_prefix}/${installDir}/${libname}")
-+ string(REPLACE "libopencv" "-lopencv" lname "${lname}")
-+ set(OpenCV_LIB_COMPONENTS_ "${OpenCV_LIB_COMPONENTS_} ${lname}")
- endforeach()
-
- # add extra dependencies required for OpenCV
-@@ -67,6 +70,8 @@ if(OpenCV_EXTRA_COMPONENTS)
-
- set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${maybe_l_prefix}${extra_component}")
-
-+
-+
- endforeach()
- endif()
-
diff --git a/graphics/opencv/pkg-plist b/graphics/opencv/pkg-plist
index d0811cd7847c..2a7e0841340d 100644
--- a/graphics/opencv/pkg-plist
+++ b/graphics/opencv/pkg-plist
@@ -1,7 +1,9 @@
+bin/opencv_annotation
bin/opencv_createsamples
bin/opencv_haartraining
bin/opencv_performance
bin/opencv_traincascade
+bin/opencv_visualisation
include/opencv/cv.h
include/opencv/cv.hpp
include/opencv/cvaux.h
@@ -13,13 +15,17 @@ include/opencv/cxeigen.hpp
include/opencv/cxmisc.h
include/opencv/highgui.h
include/opencv/ml.h
+include/opencv2/calib3d.hpp
include/opencv2/calib3d/calib3d.hpp
include/opencv2/contrib/contrib.hpp
include/opencv2/contrib/detection_based_tracker.hpp
include/opencv2/contrib/hybridtracker.hpp
include/opencv2/contrib/openfabmap.hpp
include/opencv2/contrib/retina.hpp
+@comment include/opencv2/core.hpp
+include/opencv2/features2d.hpp
include/opencv2/features2d/features2d.hpp
+include/opencv2/flann.hpp
include/opencv2/flann/all_indices.h
include/opencv2/flann/allocator.h
include/opencv2/flann/any.h
@@ -91,26 +97,32 @@ include/opencv2/gpu/devmem2d.hpp
include/opencv2/gpu/gpu.hpp
include/opencv2/gpu/gpumat.hpp
include/opencv2/gpu/stream_accessor.hpp
+include/opencv2/highgui.hpp
include/opencv2/highgui/cap_ios.h
include/opencv2/highgui/highgui.hpp
include/opencv2/highgui/highgui_c.h
include/opencv2/highgui/ios.h
+@comment include/opencv2/imgproc.hpp
include/opencv2/legacy/blobtrack.hpp
include/opencv2/legacy/compat.hpp
include/opencv2/legacy/legacy.hpp
include/opencv2/legacy/streams.hpp
+include/opencv2/ml.hpp
include/opencv2/ml/ml.hpp
%%NONFREE%%include/opencv2/nonfree/features2d.hpp
%%NONFREE%%include/opencv2/nonfree/gpu.hpp
%%NONFREE%%include/opencv2/nonfree/nonfree.hpp
%%NONFREE%%include/opencv2/nonfree/ocl.hpp
+include/opencv2/objdetect.hpp
include/opencv2/objdetect/objdetect.hpp
include/opencv2/ocl/matrix_operations.hpp
include/opencv2/ocl/ocl.hpp
include/opencv2/opencv.hpp
include/opencv2/opencv_modules.hpp
+include/opencv2/photo.hpp
include/opencv2/photo/photo.hpp
include/opencv2/photo/photo_c.h
+include/opencv2/stitching.hpp
include/opencv2/stitching/detail/autocalib.hpp
include/opencv2/stitching/detail/blenders.hpp
include/opencv2/stitching/detail/camera.hpp
@@ -124,16 +136,20 @@ include/opencv2/stitching/detail/warpers.hpp
include/opencv2/stitching/detail/warpers_inl.hpp
include/opencv2/stitching/stitcher.hpp
include/opencv2/stitching/warpers.hpp
+include/opencv2/superres.hpp
include/opencv2/superres/optical_flow.hpp
include/opencv2/superres/superres.hpp
+include/opencv2/ts.hpp
include/opencv2/ts/gpu_perf.hpp
include/opencv2/ts/gpu_test.hpp
include/opencv2/ts/ts.hpp
include/opencv2/ts/ts_gtest.h
include/opencv2/ts/ts_perf.hpp
+include/opencv2/video.hpp
include/opencv2/video/background_segm.hpp
include/opencv2/video/tracking.hpp
include/opencv2/video/video.hpp
+include/opencv2/videostab.hpp
include/opencv2/videostab/deblurring.hpp
include/opencv2/videostab/fast_marching.hpp
include/opencv2/videostab/fast_marching_inl.hpp
@@ -201,12 +217,15 @@ libdata/pkgconfig/opencv.pc
%%DATADIR%%/OpenCVModules.cmake
%%DATADIR%%/haarcascades/haarcascade_eye.xml
%%DATADIR%%/haarcascades/haarcascade_eye_tree_eyeglasses.xml
+%%DATADIR%%/haarcascades/haarcascade_frontalcatface.xml
+%%DATADIR%%/haarcascades/haarcascade_frontalcatface_extended.xml
%%DATADIR%%/haarcascades/haarcascade_frontalface_alt.xml
%%DATADIR%%/haarcascades/haarcascade_frontalface_alt2.xml
%%DATADIR%%/haarcascades/haarcascade_frontalface_alt_tree.xml
%%DATADIR%%/haarcascades/haarcascade_frontalface_default.xml
%%DATADIR%%/haarcascades/haarcascade_fullbody.xml
%%DATADIR%%/haarcascades/haarcascade_lefteye_2splits.xml
+%%DATADIR%%/haarcascades/haarcascade_licence_plate_rus_16stages.xml
%%DATADIR%%/haarcascades/haarcascade_lowerbody.xml
%%DATADIR%%/haarcascades/haarcascade_mcs_eyepair_big.xml
%%DATADIR%%/haarcascades/haarcascade_mcs_eyepair_small.xml
@@ -219,8 +238,10 @@ libdata/pkgconfig/opencv.pc
%%DATADIR%%/haarcascades/haarcascade_mcs_upperbody.xml
%%DATADIR%%/haarcascades/haarcascade_profileface.xml
%%DATADIR%%/haarcascades/haarcascade_righteye_2splits.xml
+%%DATADIR%%/haarcascades/haarcascade_russian_plate_number.xml
%%DATADIR%%/haarcascades/haarcascade_smile.xml
%%DATADIR%%/haarcascades/haarcascade_upperbody.xml
+%%DATADIR%%/lbpcascades/lbpcascade_frontalcatface.xml
%%DATADIR%%/lbpcascades/lbpcascade_frontalface.xml
%%DATADIR%%/lbpcascades/lbpcascade_profileface.xml
%%DATADIR%%/lbpcascades/lbpcascade_silverware.xml
diff --git a/graphics/py-opencv/Makefile b/graphics/py-opencv/Makefile
index c4b156385c22..e7bdf3c8ecaf 100644
--- a/graphics/py-opencv/Makefile
+++ b/graphics/py-opencv/Makefile
@@ -1,7 +1,7 @@
# Created by: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$
-PORTREVISION= 3
+PORTREVISION= 0
CATEGORIES= graphics python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}