[opencv] 01/08: Add (rebased) patch from unstable

Gianfranco Costamagna locutusofborg at moszumanska.debian.org
Fri Jul 8 16:10:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

locutusofborg pushed a commit to branch experimental/master
in repository opencv.

commit caf13751483fa00309ac66d2c71ee4d8b560e575
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date:   Fri Jul 8 17:38:13 2016 +0200

    Add (rebased) patch from unstable
---
 debian/patches/ffmpeg_2.9.patch | 226 ++++++++++++++++++++++++++++++++++++++++
 debian/patches/series           |   2 +
 debian/patches/support_x32      |  40 +++++++
 debian/rules                    |   1 +
 4 files changed, 269 insertions(+)

diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 0000000..63362b8
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,226 @@
+## Description: add some description
+## Origin/Author: add some origin or author
+## Bug: bug URL
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
+Last-Update: <2015-11-02>
+
+Index: opencv-3.0.0+dfsg/modules/videoio/src/cap_ffmpeg_impl.hpp
+===================================================================
+--- opencv-3.0.0+dfsg.orig/modules/videoio/src/cap_ffmpeg_impl.hpp
++++ opencv-3.0.0+dfsg/modules/videoio/src/cap_ffmpeg_impl.hpp
+@@ -127,9 +127,9 @@
+ #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
+ 
+ 
+@@ -318,7 +318,7 @@
+         // FFmpeg and Libav added avcodec_free_frame in different versions.
+ #if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \
+     ? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0))
+-        avcodec_free_frame(&picture);
++        av_frame_free(&picture);
+ #else
+         av_free(picture);
+ #endif
+@@ -633,13 +633,13 @@
+ 
+             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;
+@@ -739,7 +739,7 @@
+     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 ||
+@@ -757,7 +757,7 @@
+                 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
+                 );
+@@ -1111,10 +1111,10 @@
+     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)
+@@ -1123,7 +1123,7 @@
+             return NULL;
+         }
+         avpicture_fill((AVPicture *)picture, picture_buf,
+-                       (PixelFormat) pix_fmt, width, height);
++                       (AVPixelFormat) pix_fmt, width, height);
+     }
+     else {
+     }
+@@ -1231,7 +1231,7 @@
+ #endif
+ 
+     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;
+@@ -1406,12 +1406,12 @@
+ #endif
+ 
+     // 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;
+         }
+@@ -1424,13 +1424,13 @@
+         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,
+@@ -1448,7 +1448,7 @@
+     }
+     else{
+         avpicture_fill((AVPicture *)picture, (uint8_t *) data,
+-                       (PixelFormat)input_pix_fmt, width, height);
++                       (AVPixelFormat)input_pix_fmt, width, height);
+     }
+ 
+     picture->pts = frame_idx;
+@@ -1605,10 +1605,10 @@
+ 
+     /* 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 */
+@@ -1684,21 +1684,21 @@
+         break;
+ #endif
+     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;
+     }
+ 
+@@ -1923,7 +1923,7 @@
+     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_;
+@@ -1970,7 +1970,7 @@
+     }
+ }
+ 
+-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)
+ {
+     #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0)
+         AVStream* st = avformat_new_stream(oc, 0);
+@@ -2108,7 +2108,7 @@
+     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?
+@@ -2317,15 +2317,15 @@
+ 
+             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/debian/patches/series b/debian/patches/series
index 0a34a69..54ee2f3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,5 @@ support_multiarch
 #fix_path_of_opencl_headers
 #libav10.patch
 optimize_i586.patch
+support_x32
+ffmpeg_2.9.patch
diff --git a/debian/patches/support_x32 b/debian/patches/support_x32
new file mode 100644
index 0000000..5dd3dad
--- /dev/null
+++ b/debian/patches/support_x32
@@ -0,0 +1,40 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -499,8 +499,11 @@
+   else()
+     set(HAVE_LIBPTHREAD YES)
+   endif()
++
++  CHECK_INCLUDE_FILE(sys/sysctl.h HAVE_SYS_SYSCTL_H)
+ endif()
+ 
++
+ include(cmake/OpenCVPCHSupport.cmake)
+ include(cmake/OpenCVModule.cmake)
+ 
+--- a/modules/core/src/parallel.cpp
++++ b/modules/core/src/parallel.cpp
+@@ -58,6 +58,10 @@
+         #include <sys/sysconf.h>
+     #elif defined __APPLE__
+         #include <sys/sysctl.h>
++    #elif !defined __GNU__
++      #ifdef HAVE_SYS_SYSCTL_H
++         #include <sys/sysctl.h>
++      #endif
+     #endif
+ #endif
+ 
+--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
++++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
+@@ -141,6 +141,10 @@
+     #include <sys/types.h>
+ #if defined __APPLE__
+     #include <sys/sysctl.h>
++#elif !defined __GNU__
++    #ifdef HAVE_SYS_SYSCTL_H
++        #include <sys/sysctl.h>
++    #endif
+ #endif
+ #endif
+ 
diff --git a/debian/rules b/debian/rules
index ebe9b0c..bd948c1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -65,6 +65,7 @@ CMAKE_FLAGS = \
 	-DBUILD_TESTS=OFF \
 	-DCMAKE_SKIP_RPATH=ON \
 	-DWITH_CUDA=OFF \
+	-DENABLE_PRECOMPILED_HEADERS=OFF \
 	-DWITH_IPP=OFF \
 	-DOPENCL_INCLUDE_DIR:PATH="/usr/include/CL/" \
 	$(CMAKE_ARCH_FLAGS) 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list