]> granicus.if.org Git - libjpeg-turbo/commitdiff
Added configure options to disable arithmetic encoding/decoding
authorDRC <dcommander@users.sourceforge.net>
Tue, 23 Nov 2010 06:50:14 +0000 (06:50 +0000)
committerDRC <dcommander@users.sourceforge.net>
Tue, 23 Nov 2010 06:50:14 +0000 (06:50 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@300 632fc199-4ca6-4c93-a231-07263d6284db

ChangeLog.txt
Makefile.am
README-turbo.txt
configure.ac
jconfig.h.in
jerror.h
jmorecfg.h

index 068fafd2f09364dcd0703314fa7cb83a3cf2fc3c..bb1aabf96623103447b5725c363d754f5b7d16bb 100644 (file)
@@ -18,7 +18,8 @@ packages.
 [6] All symbols in the libjpeg-turbo dynamic library are now versioned, even
 when the library is built with libjpeg v6b emulation.
 
-[7] Added arithmetic encoding and decoding support.
+[7] Added arithmetic encoding and decoding support (can be disabled via
+configure options)
 
 
 Significant changes since 1.0.0
index 245093041bdbb3032609bcc934bb0134eef1ca05..c17c912a7a8845a5310d73efd14640d5b23332df 100644 (file)
@@ -7,15 +7,32 @@ nodist_include_HEADERS = jconfig.h
 HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
        jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h
 
-libjpeg_la_SOURCES = $(HDRS) jaricom.c jcapimin.c jcapistd.c jcarith.c \
-       jccoefct.c jccolor.c jcdctmgr.c jchuff.c jcinit.c jcmainct.c \
-       jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c jcprepct.c \
-       jcsample.c jctrans.c jdapimin.c jdapistd.c jdarith.c \
-       jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
-       jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
-       jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
-       jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c \
-       jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c
+libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \
+       jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \
+       jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \
+       jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \
+       jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \
+       jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c \
+       jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \
+       jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c
+
+if WITH_ARITH
+
+libjpeg_la_SOURCES += jaricom.c
+
+endif
+
+if WITH_ARITH_ENC
+
+libjpeg_la_SOURCES += jcarith.c
+
+endif
+
+if WITH_ARITH_DEC
+
+libjpeg_la_SOURCES += jdarith.c
+
+endif
 
 libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h \
        turbojpeg-mapfile
@@ -128,14 +145,18 @@ else
 endif
        ./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  $(srcdir)/testorig.jpg
        cmp $(srcdir)/testimg.bmp testout.bmp
+if WITH_ARITH_ENC
        ./cjpeg -dct int -arithmetic -outfile testoutari.jpg $(srcdir)/testorig.ppm
        cmp $(srcdir)/testimgari.jpg testoutari.jpg
+       ./jpegtran -arithmetic -outfile testouta.jpg $(srcdir)/testimgint.jpg
+       cmp $(srcdir)/testimgari.jpg testouta.jpg
+endif
+if WITH_ARITH_DEC
        ./djpeg -dct int -fast -ppm -outfile testoutari.ppm $(srcdir)/testimgari.jpg
        cmp $(srcdir)/testimgari.ppm testoutari.ppm
-       ./jpegtran -arithmetic -outfile testouta.jpg testoutint.jpg
-       cmp $(srcdir)/testimgari.jpg testouta.jpg
-       ./jpegtran -outfile testouta.jpg testoutari.jpg
+       ./jpegtran -outfile testouta.jpg $(srcdir)/testimgari.jpg
        cmp $(srcdir)/testimgint.jpg testouta.jpg
+endif
        ./cjpeg -dct int -progressive -outfile testoutp.jpg $(srcdir)/testorig.ppm
        cmp $(srcdir)/testimgp.jpg testoutp.jpg
        ./jpegtran -outfile testoutt.jpg testoutp.jpg
index b6789f37a1f941e2452d85b138d258f899a3f747..9aa44abcae7429dcc2f9cb961a3ccdc250ea4fc9 100755 (executable)
@@ -270,8 +270,5 @@ Not supported:
 -- libjpeg: Fancy downsampling in compressor
    cinfo.do_fancy_downsampling is silently ignored.
 
--- libjpeg: Arithmetic coding/decoding
-   Not supported due to patent concerns.
-
 -- jpegtran: Scaling
    Seems to depend on the DCT scaling feature, which isn't supported.
index fb022f2b7521989d37eddd5e9510091d3100503d..7faf146fc9a5786c363c101ef14444b9610c987f 100644 (file)
@@ -207,6 +207,30 @@ AM_CONDITIONAL(ANON_VERSION_SCRIPT, test "x$ANON_VERSION_SCRIPT" = "xyes")
 AC_SUBST(VERSION_SCRIPT_FLAG)
 AC_SUBST(ANON_VERSION_SCRIPT_FLAG)
 
+AC_MSG_CHECKING([whether to use arithmetic encoding])
+AC_ARG_WITH([arith-enc],
+    AC_HELP_STRING([--without-arith-enc], [Omit arithmetic encoding support]))
+if test "x$with_arith_enc" = "xno"; then
+    AC_MSG_RESULT(no)
+else
+    AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
+    AC_MSG_RESULT(yes)
+fi
+AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
+
+AC_MSG_CHECKING([whether to use arithmetic decoding])
+AC_ARG_WITH([arith-dec],
+    AC_HELP_STRING([--without-arith-dec], [Omit arithmetic decoding support]))
+if test "x$with_arith_dec" = "xno"; then
+    AC_MSG_RESULT(no)
+else
+    AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
+    AC_MSG_RESULT(yes)
+fi
+AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
+
+AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
+
 # SIMD is optional
 AC_ARG_WITH([simd],
     AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.]))
index c8d0dd78e439749ac3279cd2484015145f0cdbfd..670afab53e43bdb2b7b7c26d92e3c7aa6584802b 100644 (file)
@@ -3,6 +3,12 @@
  */
 #define JPEG_LIB_VERSION  62   /* Version 6b */
 
+/* Support arithmetic encoding */
+#undef C_ARITH_CODING_SUPPORTED
+
+/* Support arithmetic decoding */
+#undef D_ARITH_CODING_SUPPORTED
+
 /* Define if your compiler supports prototypes */
 #undef HAVE_PROTOTYPES
 
index 0eb034107b605f6d3d11aaf643302ccb7ab53db1..88f019e8f945f3c731ccdcae72b860c7d83a9936 100644 (file)
--- a/jerror.h
+++ b/jerror.h
@@ -41,7 +41,7 @@ JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
 
 /* For maintenance convenience, list is alphabetical by message code name */
 JMESSAGE(JERR_ARITH_NOTIMPL,
-        "Sorry, there are legal restrictions on arithmetic coding")
+        "Sorry, arithmetic coding is not implemented")
 JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
 JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
 JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
index 9ab2a9019adcd8788cd28ba6df9e2e88ab2d3a83..c14a5f308e3f86e1eb2963711290d1ba0846214d 100644 (file)
@@ -265,7 +265,6 @@ typedef int boolean;
 
 /* Encoder capability options: */
 
-#define C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
 #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
 #define C_PROGRESSIVE_SUPPORTED            /* Progressive JPEG? (Requires MULTISCAN)*/
 #define ENTROPY_OPT_SUPPORTED      /* Optimization of entropy coding parms? */
@@ -281,7 +280,6 @@ typedef int boolean;
 
 /* Decoder capability options: */
 
-#define D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
 #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
 #define D_PROGRESSIVE_SUPPORTED            /* Progressive JPEG? (Requires MULTISCAN)*/
 #define SAVE_MARKERS_SUPPORTED     /* jpeg_save_markers() needed? */