changeset 30132:e6373560edd1

Add support for JPEG2000 via FFmpeg/OpenJPEG
author reimar
date Sun, 03 Jan 2010 00:58:56 +0000
parents 154c026fcac6
children 16308dac4e7f
files Changelog configure etc/codecs.conf libmpdemux/demux_mf.c
diffstat 4 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Changelog	Sun Jan 03 00:50:15 2010 +0000
+++ b/Changelog	Sun Jan 03 00:58:56 2010 +0000
@@ -14,6 +14,7 @@
     * h264 decoder (CoreAVC) on Windows only via binary DLL
     * Kega Game video codec (KGV1) via binary DLL
     * SoftLab-NSK Forward MPEG2 I-frames (SLIF) via binary DLL
+    * JPEG2000 support via OpenJPEG
 
     Demuxers:
     * support for TrueHD in BluRay streams in libmpdemux
--- a/configure	Sun Jan 03 00:50:15 2010 +0000
+++ b/configure	Sun Jan 03 00:58:56 2010 +0000
@@ -343,6 +343,7 @@
   --disable-musepack        disable musepack support [autodetect]
   --disable-libopencore_amrnb disable libopencore_amr narrowband [autodetect]
   --disable-libopencore_amrwb disable libopencore_amr wideband [autodetect]
+  --disable-libopenjpeg	    disable OpenJPEG (JPEG2000) input/output support [autodetect]
   --disable-decoder=DECODER disable specified FFmpeg decoder
   --enable-decoder=DECODER  enable specified FFmpeg decoder
   --disable-encoder=ENCODER disable specified FFmpeg encoder
@@ -541,6 +542,7 @@
 _libavcodec_a=auto
 _libopencore_amrnb=auto
 _libopencore_amrwb=auto
+libopenjpeg=auto
 _libavdecoders_all=$(sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]')
 _libavdecoders=$(echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER//)
 _libavencoders_all=$(sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]')
@@ -937,6 +939,8 @@
   --disable-mng)	_mng=no		;;
   --enable-jpeg)	_jpeg=yes	;;
   --disable-jpeg)	_jpeg=no		;;
+  --enable-libopenjpeg)	libopenjpeg=yes	;;
+  --disable-libopenjpeg)libopenjpeg=no	;;
   --enable-pnm)		_pnm=yes	;;
   --disable-pnm)	_pnm=no		;;
   --enable-md5sum)	_md5sum=yes	;;
@@ -5040,6 +5044,28 @@
 fi
 
 
+echocheck "OpenJPEG (JPEG2000) support"
+if test "$libopenjpeg" = auto ; then
+  libopenjpeg=no
+cat > $TMPC << EOF
+#define  OPJ_STATIC
+#include <openjpeg.h>
+int main(void) { opj_dparameters_t dec_params; opj_set_default_decoder_parameters(&dec_params); return 0; }
+EOF
+  cc_check -lopenjpeg $_ld_lm && libopenjpeg=yes
+fi
+echores "$libopenjpeg"
+if test "$libopenjpeg" = yes ; then
+  def_libopenjpeg='#define CONFIG_LIBOPENJPEG 1'
+  extra_ldflags="$extra_ldflags -lopenjpeg"
+  _libavdecoders="$_libavdecoders LIBOPENJPEG_DECODER"
+  _libavencoders="$_libavencoders LIBOPENJPEG_ENCODER"
+  _codecmodules="OpenJPEG $_codecmodules"
+else
+  def_libopenjpeg='#define CONFIG_LIBOPENJPEG 0'
+  _nocodecmodules="OpenJPEG $_nocodecmodules"
+fi
+
 
 echocheck "PNM support"
 if test "$_pnm" = yes; then
@@ -8466,6 +8492,8 @@
 CONFIG_LIBOPENCORE_AMRNB_DECODER=$_libopencore_amrnb
 CONFIG_LIBOPENCORE_AMRNB_ENCODER=$_libopencore_amrnb
 CONFIG_LIBOPENCORE_AMRWB_DECODER=$_libopencore_amrwb
+OCNFIG_LIBOPENJPEG_DECODER = $libopenjpeg
+OCNFIG_LIBOPENJPEG_ENCODER = $libopenjpeg
 CONFIG_LIBSCHROEDINGER_DECODER=$_libschroedinger_lavc
 CONFIG_LIBSCHROEDINGER_ENCODER=$_libschroedinger_lavc
 CONFIG_LIBVORBIS_ENCODER=$_libvorbis
@@ -8962,6 +8990,7 @@
 $def_libdirac_lavc
 $def_libopencore_amrnb
 $def_libopencore_amrwb
+$def_libopenjpeg
 $def_libschroedinger_lavc
 $def_mp3lame_lavc
 $def_x264_lavc
--- a/etc/codecs.conf	Sun Jan 03 00:50:15 2010 +0000
+++ b/etc/codecs.conf	Sun Jan 03 00:58:56 2010 +0000
@@ -1399,6 +1399,16 @@
   dll "jp2avi.dll"
   out BGR32,BGR24,BGR15
 
+videocodec fflibopenjpeg
+  info "OpenJPEG MJPEG2000"
+  status working
+  fourcc MJ2C
+  fourcc MJP2
+  fourcc mjp2
+  driver ffmpeg
+  dll "libopenjpeg"
+  out RGB24,RGB32,BGR32,Y8,Y800
+
 videocodec m3jpeg2k
   info "Morgan MJPEG2000"
   status working
--- a/libmpdemux/demux_mf.c	Sun Jan 03 00:50:15 2010 +0000
+++ b/libmpdemux/demux_mf.c	Sun Jan 03 00:58:56 2010 +0000
@@ -83,6 +83,8 @@
 } type2format[] = {
   { "bmp",  mmioFOURCC('b', 'm', 'p', ' ') },
   { "dpx",  mmioFOURCC('d', 'p', 'x', ' ') },
+  { "j2k",  mmioFOURCC('M', 'J', '2', 'C') },
+  { "jp2",  mmioFOURCC('M', 'J', '2', 'C') },
   { "jpeg", mmioFOURCC('I', 'J', 'P', 'G') },
   { "jpg",  mmioFOURCC('I', 'J', 'P', 'G') },
   { "jls",  mmioFOURCC('I', 'J', 'P', 'G') },