From patchwork Tue Jun 13 22:28:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reino Wijnsma X-Patchwork-Id: 3969 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp38534vsw; Tue, 13 Jun 2017 15:29:12 -0700 (PDT) X-Received: by 10.28.169.87 with SMTP id s84mr13054951wme.62.1497392951967; Tue, 13 Jun 2017 15:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497392951; cv=none; d=google.com; s=arc-20160816; b=cZHiaXuaptATbIOzo8b74tSPyJtF5CyC9VOXAlHd+7GLjrp1CSQPuVgZiQ6CvkuQ0V FmnKQQCuXX2UNdSFHKVYENH0wMLsZ5fgyiTzaS41cDX7Q3Lf3VQ0vlxvlzTrPFnk4oBh 8DTq78x1l8naQWZCBGo2/77FOQl/g0b9NzL3+zLKDRma+EZJLqpDfeyNRWuURl/qCCa3 w1DMj4Gnjcz20nQ1C4NP3ux64ttLg4vN1k5iUlUPBNPvfvWQe4QQ3J5SpORGkQpS34Lw 1Blw9tmdl4ySTrAlRH3MdbG6ldD+TirxB3EllpnGMjhXkClbjllx33LqyVkeL2INWIa3 K0vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:delivered-to:arc-authentication-results; bh=iKJcHD1ew+xpfkXvESbtn0MRwNGXAuSDbVUPo8hY0PM=; b=GzlqbvGO5qVx4wTfflA9EKcnO7rDdWpXBT0Tp+pCwA0GQakb82Q623a+/olw68CDvh /yf+Xb+/qh5dpe3xdAy0VeU3qdQe8o44ySMCaRuIhEg59nANrvvwpkmJRqgT7EYBANeJ pfRvskJ2vNBYR3uMX/0GMCh2YaFXdcuZ5uM3It59HFQO76tFyfKFYq/MW5gLyRWrDkjB Kw72tA4RV2rs67rw6ytzSYP0FhMRRsr/xiK5NHkhKhMZuu26XsB1k0djZxgah7DXO2vN Cz2AHlS+IbhMwCUQXS8OX1ASPF0vNA361fJSFbSvAyQ4xU9ASwJB91uE0jvYBHUQCplM vAsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l193si12344394wmg.30.2017.06.13.15.29.09; Tue, 13 Jun 2017 15:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 630EA68A214; Wed, 14 Jun 2017 01:29:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from lb1-smtp-cloud2.xs4all.net (lb1-smtp-cloud2.xs4all.net [194.109.24.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 89B2F68A0CA for ; Wed, 14 Jun 2017 01:28:58 +0300 (EEST) Received: from [IPv6:2001:980:2408:1:8ab:c1c3:beda:cd07] ([IPv6:2001:980:2408:1:8ab:c1c3:beda:cd07]) by smtp-cloud2.xs4all.net with ESMTP id YNUz1v00C1oL9mP01NV0nW; Wed, 14 Jun 2017 00:29:00 +0200 To: FFmpeg development discussions and patches References: <20170612224041.6750-1-sw@jkqxz.net> <141fdd03-c2c9-172f-44d7-2f2e7d07d970@gmail.com> From: Reino Wijnsma Message-ID: <5940672B.3050307@xs4all.nl> Date: Wed, 14 Jun 2017 00:28:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <141fdd03-c2c9-172f-44d7-2f2e7d07d970@gmail.com> X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] configure/libopenjpegdec.c/libopenjpegenc.c: Add support for LibOpenJPEG v2.2/git X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 13-6-2017 05:58, Michael Bradshaw wrote: > Are you sure you built ffmpeg using OpenJPEG v2.2? Because your patch is > missing the openjpeg_2_2_openjpeg_h entry in HEADERS_LIST in configure, so > you shouldn't be able to successfully build with OpenJPEG v2.2. Whoops! In my script I'm patching 'configure' with sed . While turning these changes into a patch I seem to have forgotten the HEADERS_LIST entry indeed. New patch attached. From 70b53c1ea5a56a03cfef24d5b551b983ba2473b2 Mon Sep 17 00:00:00 2001 From: Reino17 Date: Wed, 14 Jun 2017 00:19:12 +0200 Subject: [PATCH] Add support for LibOpenJPEG v2.2/git --- configure | 4 +++- libavcodec/libopenjpegdec.c | 10 +++++++--- libavcodec/libopenjpegenc.c | 12 ++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/configure b/configure index e3941f9..0190966 100755 --- a/configure +++ b/configure @@ -1868,6 +1868,7 @@ HEADERS_LIST=" machine_ioctl_meteor_h malloc_h opencv2_core_core_c_h + openjpeg_2_2_openjpeg_h openjpeg_2_1_openjpeg_h openjpeg_2_0_openjpeg_h openjpeg_1_5_openjpeg_h @@ -5831,7 +5832,8 @@ enabled libopencv && { check_header opencv2/core/core_c.h && require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; } enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion -enabled libopenjpeg && { { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || +enabled libopenjpeg && { { check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 || { check_lib libopenjpeg openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || { check_lib libopenjpeg openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index ce4e2b0..5ed9ce1 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -34,7 +34,9 @@ #include "internal.h" #include "thread.h" -#if HAVE_OPENJPEG_2_1_OPENJPEG_H +#if HAVE_OPENJPEG_2_2_OPENJPEG_H +# include +#elif HAVE_OPENJPEG_2_1_OPENJPEG_H # include #elif HAVE_OPENJPEG_2_0_OPENJPEG_H # include @@ -44,7 +46,7 @@ # include #endif -#if HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H +#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H # define OPENJPEG_MAJOR_VERSION 2 # define OPJ(x) OPJ_##x #else @@ -429,7 +431,9 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, opj_stream_set_read_function(stream, stream_read); opj_stream_set_skip_function(stream, stream_skip); opj_stream_set_seek_function(stream, stream_seek); -#if HAVE_OPENJPEG_2_1_OPENJPEG_H +#if HAVE_OPENJPEG_2_2_OPENJPEG_H + opj_stream_set_user_data(stream, &reader, NULL); +#elif HAVE_OPENJPEG_2_1_OPENJPEG_H opj_stream_set_user_data(stream, &reader, NULL); #elif HAVE_OPENJPEG_2_0_OPENJPEG_H opj_stream_set_user_data(stream, &reader); diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 4a12729..d3b9161 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -32,7 +32,9 @@ #include "avcodec.h" #include "internal.h" -#if HAVE_OPENJPEG_2_1_OPENJPEG_H +#if HAVE_OPENJPEG_2_2_OPENJPEG_H +# include +#elif HAVE_OPENJPEG_2_1_OPENJPEG_H # include #elif HAVE_OPENJPEG_2_0_OPENJPEG_H # include @@ -42,7 +44,7 @@ # include #endif -#if HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H +#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H # define OPENJPEG_MAJOR_VERSION 2 # define OPJ(x) OPJ_##x #else @@ -305,7 +307,7 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx) opj_set_default_encoder_parameters(&ctx->enc_params); -#if HAVE_OPENJPEG_2_1_OPENJPEG_H +#if HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H switch (ctx->cinema_mode) { case OPJ_CINEMA2K_24: ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_2K; @@ -769,7 +771,9 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, opj_stream_set_write_function(stream, stream_write); opj_stream_set_skip_function(stream, stream_skip); opj_stream_set_seek_function(stream, stream_seek); -#if HAVE_OPENJPEG_2_1_OPENJPEG_H +#if HAVE_OPENJPEG_2_2_OPENJPEG_H + opj_stream_set_user_data(stream, &writer, NULL); +#elif HAVE_OPENJPEG_2_1_OPENJPEG_H opj_stream_set_user_data(stream, &writer, NULL); #elif HAVE_OPENJPEG_2_0_OPENJPEG_H opj_stream_set_user_data(stream, &writer);