woops, forgot to attach the patch.

On Sun, Apr 3, 2016 at 5:31 PM, Aaron Boxer <boxe...@gmail.com> wrote:

> Hi Folks,
>
> Here is a small patch to get FFmpeg working with both OpenJPEG master and
> Grok master, for J2K support.  The comment on the commit has all of the
> details; the main change is to remove the OPJ_STATIC flag from configure,
> so that FFmpeg can be configured with a dynamic build of both codecs.
>
> I also want to reiterate that because FFmpeg can be distributed under GPL
> v3, and Grok is licensed under the AGPL, there are no licensing issues
> regarding distributing FFmpeg together with Grok.
>
> Quoting from Wikipedia:
>
> "By contrast, GPLv3 and AGPLv3 each include clauses (in section 13 of each
> license) that together achieve a form of mutual compatibility for the two
> licenses. These clauses explicitly allow the "conveying
> <https://en.wiktionary.org/wiki/convey#Verb>" of a work formed by linking
> code licensed under the one license against code licensed under the other
> license,[3]
> <https://en.wikipedia.org/wiki/Affero_General_Public_License#cite_note-3>
> despite the licenses otherwise not allowing relicensing under the terms of
> each other.[4]
> <https://en.wikipedia.org/wiki/Affero_General_Public_License#cite_note-fsf2-4>
> In this way, the copyleft of each license is relaxed to allow distributing
> such combinations.[4] "
> <https://en.wikipedia.org/wiki/Affero_General_Public_License#cite_note-fsf2-4>
>
> So, this patch will expand the choice of J2K codecs for all users who use
> FFmpeg under the GPLv3 license.
>
> Kind Regards,
> Aaron
>
>
>
> Cheers,
> Aaron
>
>
From d12c685578f21b403f6c03505edd84db367306c5 Mon Sep 17 00:00:00 2001
From: Aaron Boxer <boxe...@gmail.com>
Date: Sun, 27 Mar 2016 00:15:20 -0400
Subject: [PATCH] Support the following jpeg 2000 codecs:

a) latest release of openjpeg (2.1)
b) master branch of openjpeg
c) grok (https://github.com/GrokImageCompression/grok)

The following changes were made:

1. Removed bpp (redundant as this information is already stored in precision)
2. Removed OPJ_STATIC flag in configure: in master branch of openjpeg and in grok, this flag indicates a static build, so codec API functions are marked as hidden. This prevents FFmpeg from using a dynamic build of these codecs.
3. link to libdl. This is needed by grok, as it supports a plugin architecture that allows plugins to be dynamically loaded at runtime.

I have tested these changes with openjpeg 2.1, openjpeg master, and grok master.Test was to make sure ./configure and make showed no errors, and then to decompress a J2K file.  Everything worked for all three configurations, with no errors.
---
 configure                   | 2 +-
 libavcodec/libopenjpegdec.c | 2 +-
 libavcodec/libopenjpegenc.c | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 94a66d8..4e81385 100755
--- a/configure
+++ b/configure
@@ -5561,7 +5561,7 @@ 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 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC ||
+enabled libopenjpeg       && { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -ldl ||
                                check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC ||
                                check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
                                check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 65167e6..f116c8b 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -24,7 +24,7 @@
  * JPEG 2000 decoder using libopenjpeg
  */
 
-#define  OPJ_STATIC
+
 
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 56c8219..720eda0 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -24,7 +24,7 @@
  * JPEG 2000 encoder using libopenjpeg
  */
 
-#define  OPJ_STATIC
+
 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
@@ -276,7 +276,6 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
 
     for (i = 0; i < numcomps; i++) {
         cmptparm[i].prec = desc->comp[i].depth;
-        cmptparm[i].bpp  = desc->comp[i].depth;
         cmptparm[i].sgnd = 0;
         cmptparm[i].dx = sub_dx[i];
         cmptparm[i].dy = sub_dy[i];
-- 
2.5.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to