Compare commits

...

2 Commits

Author SHA1 Message Date
Guido Vollbeding
a560e4b423 The Independent JPEG Group's JPEG software v9b 2016-02-16 12:27:41 -06:00
Guido Vollbeding
fc11193e7a The Independent JPEG Group's JPEG software v9a 2016-02-16 12:26:00 -06:00
83 changed files with 10175 additions and 6072 deletions

View File

@@ -33,17 +33,17 @@ DOCS= README install.txt usage.txt wizard.txt example.c libjpeg.txt \
structure.txt coderules.txt filelist.txt change.log structure.txt coderules.txt filelist.txt change.log
# Makefiles for various systems # Makefiles for various systems
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
# Configuration files # Configuration files
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \

View File

@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.13.1 from Makefile.am. # Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc. # Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -23,23 +23,61 @@
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \ am__is_gnu_make = { \
{ \ if test -z '$(MAKELEVEL)'; then \
am__dry=no; \ false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \ case $$MAKEFLAGS in \
*\\[\ \ ]*) \ *\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ bs=\\; \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
*) \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \ esac; \
test $$am__dry = yes; \ fi; \
} skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@@ -63,14 +101,12 @@ target_triplet = @target@
bin_PROGRAMS = cjpeg$(EXEEXT) djpeg$(EXEEXT) jpegtran$(EXEEXT) \ bin_PROGRAMS = cjpeg$(EXEEXT) djpeg$(EXEEXT) jpegtran$(EXEEXT) \
rdjpgcom$(EXEEXT) wrjpgcom$(EXEEXT) rdjpgcom$(EXEEXT) wrjpgcom$(EXEEXT)
subdir = . subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/jconfig.cfg depcomp $(include_HEADERS) \
$(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(include_HEADERS) $(noinst_HEADERS)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d mkinstalldirs = $(install_sh) -d
@@ -256,6 +292,7 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@ LIPO = @LIPO@
LN_S = @LN_S@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@ MANIFEST_TOOL = @MANIFEST_TOOL@
@@ -369,17 +406,17 @@ DOCS = README install.txt usage.txt wizard.txt example.c libjpeg.txt \
# Makefiles for various systems # Makefiles for various systems
MKFILES = configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES = configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
# Configuration files # Configuration files
@@ -463,7 +500,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile $(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \
@@ -484,8 +520,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
jconfig.h: stamp-h1 jconfig.h: stamp-h1
@if test ! -f $@; then rm -f stamp-h1; else :; fi @test -f $@ || rm -f stamp-h1
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/jconfig.cfg $(top_builddir)/config.status stamp-h1: $(srcdir)/jconfig.cfg $(top_builddir)/config.status
@rm -f stamp-h1 @rm -f stamp-h1
@@ -532,6 +568,7 @@ clean-libLTLIBRARIES:
echo rm -f $${locs}; \ echo rm -f $${locs}; \
rm -f $${locs}; \ rm -f $${locs}; \
} }
libjpeg.la: $(libjpeg_la_OBJECTS) $(libjpeg_la_DEPENDENCIES) $(EXTRA_libjpeg_la_DEPENDENCIES) libjpeg.la: $(libjpeg_la_OBJECTS) $(libjpeg_la_DEPENDENCIES) $(EXTRA_libjpeg_la_DEPENDENCIES)
$(AM_V_CCLD)$(libjpeg_la_LINK) -rpath $(libdir) $(libjpeg_la_OBJECTS) $(libjpeg_la_LIBADD) $(LIBS) $(AM_V_CCLD)$(libjpeg_la_LINK) -rpath $(libdir) $(libjpeg_la_OBJECTS) $(libjpeg_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS) install-binPROGRAMS: $(bin_PROGRAMS)
@@ -583,18 +620,23 @@ clean-binPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \ echo " rm -f" $$list; \
rm -f $$list rm -f $$list
cjpeg$(EXEEXT): $(cjpeg_OBJECTS) $(cjpeg_DEPENDENCIES) $(EXTRA_cjpeg_DEPENDENCIES) cjpeg$(EXEEXT): $(cjpeg_OBJECTS) $(cjpeg_DEPENDENCIES) $(EXTRA_cjpeg_DEPENDENCIES)
@rm -f cjpeg$(EXEEXT) @rm -f cjpeg$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(cjpeg_OBJECTS) $(cjpeg_LDADD) $(LIBS) $(AM_V_CCLD)$(LINK) $(cjpeg_OBJECTS) $(cjpeg_LDADD) $(LIBS)
djpeg$(EXEEXT): $(djpeg_OBJECTS) $(djpeg_DEPENDENCIES) $(EXTRA_djpeg_DEPENDENCIES) djpeg$(EXEEXT): $(djpeg_OBJECTS) $(djpeg_DEPENDENCIES) $(EXTRA_djpeg_DEPENDENCIES)
@rm -f djpeg$(EXEEXT) @rm -f djpeg$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(djpeg_OBJECTS) $(djpeg_LDADD) $(LIBS) $(AM_V_CCLD)$(LINK) $(djpeg_OBJECTS) $(djpeg_LDADD) $(LIBS)
jpegtran$(EXEEXT): $(jpegtran_OBJECTS) $(jpegtran_DEPENDENCIES) $(EXTRA_jpegtran_DEPENDENCIES) jpegtran$(EXEEXT): $(jpegtran_OBJECTS) $(jpegtran_DEPENDENCIES) $(EXTRA_jpegtran_DEPENDENCIES)
@rm -f jpegtran$(EXEEXT) @rm -f jpegtran$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(jpegtran_OBJECTS) $(jpegtran_LDADD) $(LIBS) $(AM_V_CCLD)$(LINK) $(jpegtran_OBJECTS) $(jpegtran_LDADD) $(LIBS)
rdjpgcom$(EXEEXT): $(rdjpgcom_OBJECTS) $(rdjpgcom_DEPENDENCIES) $(EXTRA_rdjpgcom_DEPENDENCIES) rdjpgcom$(EXEEXT): $(rdjpgcom_OBJECTS) $(rdjpgcom_DEPENDENCIES) $(EXTRA_rdjpgcom_DEPENDENCIES)
@rm -f rdjpgcom$(EXEEXT) @rm -f rdjpgcom$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(rdjpgcom_OBJECTS) $(rdjpgcom_LDADD) $(LIBS) $(AM_V_CCLD)$(LINK) $(rdjpgcom_OBJECTS) $(rdjpgcom_LDADD) $(LIBS)
wrjpgcom$(EXEEXT): $(wrjpgcom_OBJECTS) $(wrjpgcom_DEPENDENCIES) $(EXTRA_wrjpgcom_DEPENDENCIES) wrjpgcom$(EXEEXT): $(wrjpgcom_OBJECTS) $(wrjpgcom_DEPENDENCIES) $(EXTRA_wrjpgcom_DEPENDENCIES)
@rm -f wrjpgcom$(EXEEXT) @rm -f wrjpgcom$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(wrjpgcom_OBJECTS) $(wrjpgcom_LDADD) $(LIBS) $(AM_V_CCLD)$(LINK) $(wrjpgcom_OBJECTS) $(wrjpgcom_LDADD) $(LIBS)
@@ -676,14 +718,14 @@ distclean-compile:
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj: .c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo: .c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -963,6 +1005,8 @@ uninstall-man: uninstall-man1
uninstall-libLTLIBRARIES uninstall-local uninstall-man \ uninstall-libLTLIBRARIES uninstall-local uninstall-man \
uninstall-man1 uninstall-man1
.PRECIOUS: Makefile
# Install jconfig.h # Install jconfig.h
install-data-local: install-data-local:

107
README
View File

@@ -1,8 +1,8 @@
The Independent JPEG Group's JPEG software The Independent JPEG Group's JPEG software
========================================== ==========================================
README for release 9 of 13-Jan-2013 README for release 9b of 17-Jan-2016
=================================== ====================================
This distribution contains the ninth public release of the Independent JPEG This distribution contains the ninth public release of the Independent JPEG
Group's free JPEG software. You are welcome to redistribute this software and Group's free JPEG software. You are welcome to redistribute this software and
@@ -14,7 +14,7 @@ Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers,
and other members of the Independent JPEG Group. and other members of the Independent JPEG Group.
IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee
(also known as JPEG, together with ITU-T SG16). (previously known as JPEG, together with ITU-T SG16).
DOCUMENTATION ROADMAP DOCUMENTATION ROADMAP
@@ -60,7 +60,7 @@ OVERVIEW
This package contains C software to implement JPEG image encoding, decoding, This package contains C software to implement JPEG image encoding, decoding,
and transcoding. JPEG (pronounced "jay-peg") is a standardized compression and transcoding. JPEG (pronounced "jay-peg") is a standardized compression
method for full-color and gray-scale images. method for full-color and grayscale images.
This software implements JPEG baseline, extended-sequential, and progressive This software implements JPEG baseline, extended-sequential, and progressive
compression processes. Provision is made for supporting all variants of these compression processes. Provision is made for supporting all variants of these
@@ -115,7 +115,7 @@ with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you, fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy. its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2013, Thomas G. Lane, Guido Vollbeding. This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below. All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this Permission is hereby granted to use, copy, modify, and distribute this
@@ -153,16 +153,11 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium
but is also freely distributable. but is also freely distributable.
The IJG distribution formerly included code to read and write GIF files. The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent, GIF reading support has To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
been removed altogether, and the GIF writer has been simplified to produce support has been removed altogether, and the GIF writer has been simplified
"uncompressed GIFs". This technique does not use the LZW algorithm; the to produce "uncompressed GIFs". This technique does not use the LZW
resulting GIF files are larger than usual, but are readable by all standard algorithm; the resulting GIF files are larger than usual, but are readable
GIF decoders. by all standard GIF decoders.
We are required to state that
"The Graphics Interchange Format(c) is the Copyright property of
CompuServe Incorporated. GIF(sm) is a Service Mark property of
CompuServe Incorporated."
REFERENCES REFERENCES
@@ -176,8 +171,8 @@ The best short technical introduction to the JPEG compression algorithm is
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
(Adjacent articles in that issue discuss MPEG motion picture compression, (Adjacent articles in that issue discuss MPEG motion picture compression,
applications of JPEG, and related topics.) If you don't have the CACM issue applications of JPEG, and related topics.) If you don't have the CACM issue
handy, a PostScript file containing a revised version of Wallace's article is handy, a PDF file containing a revised version of Wallace's article is
available at http://www.ijg.org/files/wallace.ps.gz. The file (actually available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually
a preprint for an article that appeared in IEEE Trans. Consumer Electronics) a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
omits the sample images that appeared in CACM, but it includes corrections omits the sample images that appeared in CACM, but it includes corrections
and some added material. Note: the Wallace article is copyright ACM and IEEE, and some added material. Note: the Wallace article is copyright ACM and IEEE,
@@ -225,14 +220,13 @@ WG1 N 6080 with title "JPEG 9 Lossless Coding", June/July 2012, Paris,
France. France.
The JPEG standard does not specify all details of an interchangeable file The JPEG standard does not specify all details of an interchangeable file
format. For the omitted details we follow the "JFIF" conventions, revision format. For the omitted details we follow the "JFIF" conventions, version 2.
1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report JFIF version 1 has been adopted as Recommendation ITU-T T.871 (05/2011) :
and thus received a formal publication status. It is available as a free Information technology - Digital compression and coding of continuous-tone
download in PDF format from still images: JPEG File Interchange Format (JFIF). It is available as a
http://www.ecma-international.org/publications/techreports/E-TR-098.htm. free download in PDF file format from http://www.itu.int/rec/T-REC-T.871.
A PostScript version of the JFIF document is available at A PDF file of the older JFIF document is available at
http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at http://www.w3.org/Graphics/JPEG/jfif3.pdf.
http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures.
The TIFF 6.0 file format specification can be obtained by FTP from The TIFF 6.0 file format specification can be obtained by FTP from
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
@@ -252,8 +246,8 @@ ARCHIVE LOCATIONS
The "official" archive site for this software is www.ijg.org. The "official" archive site for this software is www.ijg.org.
The most recent released version can always be found there in The most recent released version can always be found there in
directory "files". This particular version will be archived as directory "files". This particular version will be archived as
http://www.ijg.org/files/jpegsrc.v9.tar.gz, and in Windows-compatible http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible
"zip" archive format as http://www.ijg.org/files/jpegsr9.zip. "zip" archive format as http://www.ijg.org/files/jpegsr9b.zip.
The JPEG FAQ (Frequently Asked Questions) article is a source of some The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG. general information about JPEG.
@@ -280,7 +274,7 @@ Thank to Thomas Wiegand and Gary Sullivan for inviting me to the
Joint Video Team (MPEG & ITU) meeting in Geneva, Switzerland. Joint Video Team (MPEG & ITU) meeting in Geneva, Switzerland.
Thank to Thomas Richter and Daniel Lee for inviting me to the Thank to Thomas Richter and Daniel Lee for inviting me to the
ISO/IEC JTC1/SC29/WG1 (also known as JPEG, together with ITU-T SG16) ISO/IEC JTC1/SC29/WG1 (previously known as JPEG, together with ITU-T SG16)
meeting in Berlin, Germany. meeting in Berlin, Germany.
Thank to John Korejwa and Massimo Ballerini for inviting me to Thank to John Korejwa and Massimo Ballerini for inviting me to
@@ -306,10 +300,10 @@ design and development of this singular software package.
FILE FORMAT WARS FILE FORMAT WARS
================ ================
The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together The ISO/IEC JTC1/SC29/WG1 standards committee (previously known as JPEG,
with ITU-T SG16) currently promotes different formats containing the name together with ITU-T SG16) currently promotes different formats containing
"JPEG" which is misleading because these formats are incompatible with the name "JPEG" which is misleading because these formats are incompatible
original DCT-based JPEG and are based on faulty technologies. with original DCT-based JPEG and are based on faulty technologies.
IJG therefore does not and will not support such momentary mistakes IJG therefore does not and will not support such momentary mistakes
(see REFERENCES). (see REFERENCES).
There exist also distributions under the name "OpenJPEG" promoting such There exist also distributions under the name "OpenJPEG" promoting such
@@ -322,9 +316,13 @@ Don't use an incompatible file format!
(In any case, our decoder will remain capable of reading existing JPEG (In any case, our decoder will remain capable of reading existing JPEG
image files indefinitely.) image files indefinitely.)
Furthermore, the ISO committee pretends to be "responsible for the popular The ISO committee pretends to be "responsible for the popular JPEG" in their
JPEG" in their public reports which is not true because they don't respond to public reports which is not true because they don't respond to actual
actual requirements for the maintenance of the original JPEG specification. requirements for the maintenance of the original JPEG specification.
Furthermore, the ISO committee pretends to "ensure interoperability" with
their standards which is not true because their "standards" support only
application-specific and proprietary use cases and contain mathematically
incorrect code.
There are currently different distributions in circulation containing the There are currently different distributions in circulation containing the
name "libjpeg" which is misleading because they don't have the features and name "libjpeg" which is misleading because they don't have the features and
@@ -332,19 +330,46 @@ are incompatible with formats supported by actual IJG libjpeg distributions.
One of those fakes is released by members of the ISO committee and just uses One of those fakes is released by members of the ISO committee and just uses
the name of libjpeg for misdirection of people, similar to the abuse of the the name of libjpeg for misdirection of people, similar to the abuse of the
name JPEG as described above, while having nothing in common with actual IJG name JPEG as described above, while having nothing in common with actual IJG
libjpeg distributions. libjpeg distributions and containing mathematically incorrect code.
The other one claims to be a "derivative" or "fork" of the original libjpeg The other one claims to be a "derivative" or "fork" of the original libjpeg,
and violates the license conditions as described under LEGAL ISSUES above. but violates the license conditions as described under LEGAL ISSUES above
We have no sympathy for the release of misleading and illegal distributions and violates basic C programming properties.
derived from obsolete code bases. We have no sympathy for the release of misleading, incorrect and illegal
distributions derived from obsolete code bases.
Don't use an obsolete code base! Don't use an obsolete code base!
According to the UCC (Uniform Commercial Code) law, IJG has the lawful and
legal right to foreclose on certain standardization bodies and other
institutions or corporations that knowingly perform substantial and
systematic deceptive acts and practices, fraud, theft, and damaging of the
value of the people of this planet without their knowing, willing and
intentional consent.
The titles, ownership, and rights of these institutions and all their assets
are now duly secured and held in trust for the free people of this planet.
People of the planet, on every country, may have a financial interest in
the assets of these former principals, agents, and beneficiaries of the
foreclosed institutions and corporations.
IJG asserts what is: that each man, woman, and child has unalienable value
and rights granted and deposited in them by the Creator and not any one of
the people is subordinate to any artificial principality, corporate fiction
or the special interest of another without their appropriate knowing,
willing and intentional consent made by contract or accommodation agreement.
IJG expresses that which already was.
The people have already determined and demanded that public administration
entities, national governments, and their supporting judicial systems must
be fully transparent, accountable, and liable.
IJG has secured the value for all concerned free people of the planet.
A partial list of foreclosed institutions and corporations ("Hall of Shame")
is currently prepared and will be published later.
TO DO TO DO
===== =====
Version 9 is the second release of a new generation JPEG standard Version 9 is the second release of a new generation JPEG standard
to overcome the limitations of the original JPEG specification. to overcome the limitations of the original JPEG specification,
and is the first true source reference JPEG codec.
More features are being prepared for coming releases... More features are being prepared for coming releases...
Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org. Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org.

3056
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

2
ar-lib
View File

@@ -4,7 +4,7 @@
me=ar-lib me=ar-lib
scriptversion=2012-03-01.08; # UTC scriptversion=2012-03-01.08; # UTC
# Copyright (C) 2010-2013 Free Software Foundation, Inc. # Copyright (C) 2010-2014 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>. # Written by Peter Rosin <peda@lysator.liu.se>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

View File

@@ -1,6 +1,56 @@
CHANGE LOG for Independent JPEG Group's JPEG software CHANGE LOG for Independent JPEG Group's JPEG software
Version 9b 17-Jan-2016
-----------------------
Improvements and optimizations in DCT and color calculations.
Normalize range limit array composition and access pattern.
Thank to Sia Furler and Maddie Ziegler for inspiration.
Use merged upsample with scaled DCT sizes larger than 8.
Thank to Taylor Hatala for inspiration.
Check for excessive comment lengths in argument parsing in wrjpgcom.c.
Thank to Julian Cohen for hint.
Add makefile.b32 for use with Borland C++ 32-bit (bcc32).
Thank to Joe Slater for contribution.
Document 'f' specifier for jpegtran -crop specification.
Thank to Michele Martone for suggestion.
Use defined value from header instead of hardwired number in rdswitch.c.
Thank to Robert Sprowson for hint.
Version 9a 19-Jan-2014
-----------------------
Add support for wide gamut color spaces (JFIF version 2).
Improve clarity and accuracy in color conversion modules.
Note: Requires rebuild of test images.
Extend the bit depth support to all values from 8 to 12
(BITS_IN_JSAMPLE configuration option in jmorecfg.h).
jpegtran now supports N bits sample data precision with all N from 8 to 12
in a single instance. Thank to Roland Fassauer for inspiration.
Try to resolve issues with new boolean type definition.
Thank also to v4hn for suggestion.
Enable option to use default Huffman tables for lossless compression
(for hardware solution), and in this case improve lossless RGB compression
with reversible color transform. Thank to Benny Alexandar for hint.
Extend the entropy decoding structure, so that extraneous bytes between
compressed scan data and following marker can be reported correctly.
Thank to Nigel Tao for hint.
Add jpegtran -wipe option and extension for -crop.
Thank to Andrew Senior, David Clunie, and Josef Schmid for suggestion.
Version 9 13-Jan-2013 Version 9 13-Jan-2013
---------------------- ----------------------

27
cjpeg.1
View File

@@ -1,4 +1,4 @@
.TH CJPEG 1 "4 May 2012" .TH CJPEG 1 "26 July 2015"
.SH NAME .SH NAME
cjpeg \- compress an image file to a JPEG file cjpeg \- compress an image file to a JPEG file
.SH SYNOPSIS .SH SYNOPSIS
@@ -16,7 +16,7 @@ cjpeg \- compress an image file to a JPEG file
compresses the named image file, or the standard input if no file is compresses the named image file, or the standard input if no file is
named, and produces a JPEG/JFIF file on the standard output. named, and produces a JPEG/JFIF file on the standard output.
The currently supported input file formats are: PPM (PBMPLUS color The currently supported input file formats are: PPM (PBMPLUS color
format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster format), PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster
Toolkit format). (RLE is supported only if the URT library is available.) Toolkit format). (RLE is supported only if the URT library is available.)
.SH OPTIONS .SH OPTIONS
All switch names may be abbreviated; for example, All switch names may be abbreviated; for example,
@@ -199,6 +199,26 @@ this feature. Reversible color transform support is not yet
widely implemented, so many decoders will be unable to view widely implemented, so many decoders will be unable to view
a reversible color transformed JPEG file at all. a reversible color transformed JPEG file at all.
.TP .TP
.B \-bgycc
Create big gamut YCC JPEG file.
In this type of encoding the color difference components are quantized
further by a factor of 2 compared to the normal Cb/Cr values, thus creating
space to allow larger color values with higher saturation than the normal
gamut limits to be encoded. In order to compensate for the loss of color
fidelity compared to a normal YCC encoded file, the color quantization
tables can be adjusted accordingly. For example,
.B cjpeg \-bgycc \-quality
80,90 will give similar results as
.B cjpeg \-quality
80.
.B Caution:
For correct decompression a decoder with big gamut YCC support (JFIF
version 2) is required. An old decoder may or may not display a big
gamut YCC encoded JPEG file, depending on JFIF version check and
corresponding warning/error configuration. In case of a granted
decompression the old decoder will display the image with half
saturated colors.
.TP
.B \-dct int .B \-dct int
Use integer DCT method (default). Use integer DCT method (default).
.TP .TP
@@ -355,7 +375,8 @@ Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
.SH AUTHOR .SH AUTHOR
Independent JPEG Group Independent JPEG Group
.SH BUGS .SH BUGS
GIF input files are no longer supported, to avoid the Unisys LZW patent. GIF input files are no longer supported, to avoid the Unisys LZW patent
(now expired).
(Conversion of GIF files to JPEG is usually a bad idea anyway.) (Conversion of GIF files to JPEG is usually a bad idea anyway.)
.PP .PP
Not all variants of BMP and Targa file formats are supported. Not all variants of BMP and Targa file formats are supported.

12
cjpeg.c
View File

@@ -174,6 +174,7 @@ usage (void)
#endif #endif
#if JPEG_LIB_VERSION_MAJOR >= 9 #if JPEG_LIB_VERSION_MAJOR >= 9
fprintf(stderr, " -rgb1 Create RGB JPEG file with reversible color transform\n"); fprintf(stderr, " -rgb1 Create RGB JPEG file with reversible color transform\n");
fprintf(stderr, " -bgycc Create big gamut YCC JPEG file\n");
#endif #endif
#ifdef DCT_ISLOW_SUPPORTED #ifdef DCT_ISLOW_SUPPORTED
fprintf(stderr, " -dct int Use integer DCT method%s\n", fprintf(stderr, " -dct int Use integer DCT method%s\n",
@@ -323,6 +324,17 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
#endif #endif
jpeg_set_colorspace(cinfo, JCS_RGB); jpeg_set_colorspace(cinfo, JCS_RGB);
} else if (keymatch(arg, "bgycc", 5)) {
/* Force a big gamut YCC JPEG file to be generated. */
#if JPEG_LIB_VERSION_MAJOR >= 9 && \
(JPEG_LIB_VERSION_MAJOR > 9 || JPEG_LIB_VERSION_MINOR >= 1)
jpeg_set_colorspace(cinfo, JCS_BG_YCC);
#else
fprintf(stderr, "%s: sorry, BG_YCC colorspace not supported\n",
progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "maxmemory", 3)) { } else if (keymatch(arg, "maxmemory", 3)) {
/* Maximum memory in Kb (or Mb with 'm'). */ /* Maximum memory in Kb (or Mb with 'm'). */
long lval; long lval;

347
compile Executable file
View File

@@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

320
config.guess vendored
View File

@@ -1,10 +1,8 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright 1992-2014 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013 Free Software Foundation, Inc.
timestamp='2012-12-29' timestamp='2014-11-04'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -26,12 +24,12 @@ timestamp='2012-12-29'
# program. This Exception is an additional permission under section 7 # program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3"). # of the GNU General Public License, version 3 ("GPLv3").
# #
# Originally written by Per Bothner. # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
# #
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
# #
# Please send patches with a ChangeLog entry to config-patches@gnu.org. # Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
@@ -52,9 +50,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1992-2014 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -136,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
# Note: order is significant - the case branches are not exclusive. # Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -562,8 +579,9 @@ EOF
else else
IBM_ARCH=powerpc IBM_ARCH=powerpc
fi fi
if [ -x /usr/bin/oslevel ] ; then if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/oslevel` IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi fi
@@ -809,7 +827,7 @@ EOF
*:MINGW*:*) *:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32 echo ${UNAME_MACHINE}-pc-mingw32
exit ;; exit ;;
i*:MSYS*:*) *:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys echo ${UNAME_MACHINE}-pc-msys
exit ;; exit ;;
i*:windows32*:*) i*:windows32*:*)
@@ -857,21 +875,21 @@ EOF
exit ;; exit ;;
*:GNU:*:*) *:GNU:*:*)
# the GNU system # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;; exit ;;
*:GNU/*:*:*) *:GNU/*:*:*)
# other systems with GNU libc and userland # other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;; exit ;;
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
exit ;; exit ;;
aarch64:Linux:*:*) aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
aarch64_be:Linux:*:*) aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
alpha:Linux:*:*) alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -884,59 +902,54 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;; EV68*) UNAME_MACHINE=alphaev68 ;;
esac esac
objdump --private-headers /bin/sh | grep -q ld.so.1 objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
arm*:Linux:*:*) arm*:Linux:*:*)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__ | grep -q __ARM_EABI__
then then
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP | grep -q __ARM_PCS_VFP
then then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi fi
fi fi
exit ;; exit ;;
avr32*:Linux:*:*) avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
cris:Linux:*:*) cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;; exit ;;
crisv32:Linux:*:*) crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;; exit ;;
frv:Linux:*:*) frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
hexagon:Linux:*:*) hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
i*86:Linux:*:*) i*86:Linux:*:*)
LIBC=gnu echo ${UNAME_MACHINE}-pc-linux-${LIBC}
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;; exit ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
m32r*:Linux:*:*) m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
m68*:Linux:*:*) m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
mips:Linux:*:* | mips64:Linux:*:*) mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build eval $set_cc_for_build
@@ -955,54 +968,63 @@ EOF
#endif #endif
EOF EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;; ;;
or32:Linux:*:*) openrisc*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
padre:Linux:*:*) padre:Linux:*:*)
echo sparc-unknown-linux-gnu echo sparc-unknown-linux-${LIBC}
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*) parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu echo hppa64-unknown-linux-${LIBC}
exit ;; exit ;;
parisc:Linux:*:* | hppa:Linux:*:*) parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level # Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;; PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-gnu ;; *) echo hppa-unknown-linux-${LIBC} ;;
esac esac
exit ;; exit ;;
ppc64:Linux:*:*) ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu echo powerpc64-unknown-linux-${LIBC}
exit ;; exit ;;
ppc:Linux:*:*) ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;; exit ;;
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;; exit ;;
sh64*:Linux:*:*) sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
sh*:Linux:*:*) sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
tile*:Linux:*:*) tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
vax:Linux:*:*) vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;; exit ;;
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
xtensa*:Linux:*:*) xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
i*86:DYNIX/ptx:4*:*) i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1235,19 +1257,31 @@ EOF
exit ;; exit ;;
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in eval $set_cc_for_build
i386) if test "$UNAME_PROCESSOR" = unknown ; then
eval $set_cc_for_build UNAME_PROCESSOR=powerpc
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then fi
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
grep IS_64BIT_ARCH >/dev/null if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
then (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
UNAME_PROCESSOR="x86_64" grep IS_64BIT_ARCH >/dev/null
fi then
fi ;; case $UNAME_PROCESSOR in
unknown) UNAME_PROCESSOR=powerpc ;; i386) UNAME_PROCESSOR=x86_64 ;;
esac powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;; exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*) *:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1338,154 +1372,6 @@ EOF
exit ;; exit ;;
esac esac
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 <<EOF cat >&2 <<EOF
$0: unable to guess system type $0: unable to guess system type

67
config.sub vendored
View File

@@ -1,10 +1,8 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright 1992-2014 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013 Free Software Foundation, Inc.
timestamp='2012-12-29' timestamp='2014-12-03'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -27,7 +25,7 @@ timestamp='2012-12-29'
# of the GNU General Public License, version 3 ("GPLv3"). # of the GNU General Public License, version 3 ("GPLv3").
# Please send patches with a ChangeLog entry to config-patches@gnu.org. # Please send patches to <config-patches@gnu.org>.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
@@ -70,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1992-2014 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -256,12 +252,12 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc \ | arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \ | avr | avr32 \
| be32 | be64 \ | be32 | be64 \
| bfin \ | bfin \
| c4x | clipper \ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| epiphany \ | epiphany \
| fido | fr30 | frv \ | fido | fr30 | frv \
@@ -269,6 +265,7 @@ case $basic_machine in
| hexagon \ | hexagon \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| k1om \
| le32 | le64 \ | le32 | le64 \
| lm32 \ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
@@ -286,23 +283,26 @@ case $basic_machine in
| mips64vr5900 | mips64vr5900el \ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \ | mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \ | mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \ | mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| moxie \ | moxie \
| mt \ | mt \
| msp430 \ | msp430 \
| nds32 | nds32le | nds32be \ | nds32 | nds32le | nds32be \
| nios | nios2 \ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \ | ns16k | ns32k \
| open8 \ | open8 | or1k | or1knd | or32 \
| or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \ | pyramid \
| riscv32 | riscv64 \
| rl78 | rx \ | rl78 | rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
@@ -313,6 +313,7 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \ | ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \ | we32k \
| x86 | xc16x | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
@@ -327,7 +328,10 @@ case $basic_machine in
c6x) c6x)
basic_machine=tic6x-unknown basic_machine=tic6x-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
;; ;;
@@ -369,13 +373,13 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \ | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \ | avr-* | avr32-* \
| be32-* | be64-* \ | be32-* | be64-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
@@ -384,6 +388,7 @@ case $basic_machine in
| hexagon-* \ | hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \ | le32-* | le64-* \
| lm32-* \ | lm32-* \
| m32c-* | m32r-* | m32rle-* \ | m32c-* | m32r-* | m32rle-* \
@@ -403,18 +408,22 @@ case $basic_machine in
| mips64vr5900-* | mips64vr5900el-* \ | mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \ | mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \ | mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \ | mmix-* \
| mt-* \ | mt-* \
| msp430-* \ | msp430-* \
| nds32-* | nds32le-* | nds32be-* \ | nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \ | open8-* \
| or1k*-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
@@ -432,6 +441,7 @@ case $basic_machine in
| ubicom32-* \ | ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \ | vax-* \
| visium-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \ | xstormy16-* | xtensa*-* \
@@ -769,6 +779,9 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu) m68knommu)
basic_machine=m68k-unknown basic_machine=m68k-unknown
os=-linux os=-linux
@@ -796,7 +809,7 @@ case $basic_machine in
os=-mingw64 os=-mingw64
;; ;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i686-pc
os=-mingw32 os=-mingw32
;; ;;
mingw32ce) mingw32ce)
@@ -824,6 +837,10 @@ case $basic_machine in
basic_machine=powerpc-unknown basic_machine=powerpc-unknown
os=-morphos os=-morphos
;; ;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos) msdos)
basic_machine=i386-pc basic_machine=i386-pc
os=-msdos os=-msdos
@@ -832,7 +849,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;; ;;
msys) msys)
basic_machine=i386-pc basic_machine=i686-pc
os=-msys os=-msys
;; ;;
mvs) mvs)
@@ -1354,7 +1371,7 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1369,14 +1386,14 @@ case $os in
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@@ -1500,9 +1517,6 @@ case $os in
-aros*) -aros*)
os=-aros os=-aros
;; ;;
-kaos*)
os=-kaos
;;
-zvmoe) -zvmoe)
os=-zvmoe os=-zvmoe
;; ;;
@@ -1551,6 +1565,9 @@ case $basic_machine in
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;; ;;
c8051-*)
os=-elf
;;
hexagon-*) hexagon-*)
os=-elf os=-elf
;; ;;

2241
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
# Configure script for IJG libjpeg # Configure script for IJG libjpeg
# #
AC_INIT([libjpeg], [9.0.0]) AC_INIT([libjpeg], [9.2.0])
# Directory where autotools helper scripts lives. # Directory where autotools helper scripts lives.
AC_CONFIG_AUX_DIR([.]) AC_CONFIG_AUX_DIR([.])

View File

@@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
scriptversion=2012-10-18.11; # UTC scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc. # Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -552,6 +552,7 @@ $ {
G G
p p
}' >> "$depfile" }' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;

25
djpeg.1
View File

@@ -1,4 +1,4 @@
.TH DJPEG 1 "3 October 2009" .TH DJPEG 1 "26 July 2015"
.SH NAME .SH NAME
djpeg \- decompress a JPEG file to an image file djpeg \- decompress a JPEG file to an image file
.SH SYNOPSIS .SH SYNOPSIS
@@ -55,11 +55,16 @@ default options are chosen for highest quality output.) Currently, this is
equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR. equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR.
.TP .TP
.B \-grayscale .B \-grayscale
Force gray-scale output even if JPEG file is color. Useful for viewing on Force grayscale output even if JPEG file is color.
monochrome displays; also, Useful for viewing on monochrome displays; also,
.B djpeg .B djpeg
runs noticeably faster in this mode. runs noticeably faster in this mode.
.TP .TP
.B \-rgb
Force RGB output even if JPEG file is grayscale.
This is provided to support applications that don't
want to cope with grayscale as a separate case.
.TP
.BI \-scale " M/N" .BI \-scale " M/N"
Scale the output image by a factor M/N. Currently supported scale factors are Scale the output image by a factor M/N. Currently supported scale factors are
M/N with all M from 1 to 16, where N is the source DCT size, which is 8 for M/N with all M from 1 to 16, where N is the source DCT size, which is 8 for
@@ -76,7 +81,7 @@ emitted if
.B \-colors .B \-colors
or or
.B \-grayscale .B \-grayscale
is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color
format is emitted. format is emitted.
.TP .TP
.B \-gif .B \-gif
@@ -90,12 +95,12 @@ emitted if
.B \-colors .B \-colors
or or
.B \-grayscale .B \-grayscale
is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color
format is emitted. format is emitted.
.TP .TP
.B \-pnm .B \-pnm
Select PBMPLUS (PPM/PGM) output format (this is the default format). Select PBMPLUS (PPM/PGM) output format (this is the default format).
PGM is emitted if the JPEG file is gray-scale or if PGM is emitted if the JPEG file is grayscale or if
.B \-grayscale .B \-grayscale
is specified; otherwise PPM is emitted. is specified; otherwise PPM is emitted.
.TP .TP
@@ -103,8 +108,8 @@ is specified; otherwise PPM is emitted.
Select RLE output format. (Requires URT library.) Select RLE output format. (Requires URT library.)
.TP .TP
.B \-targa .B \-targa
Select Targa output format. Gray-scale format is emitted if the JPEG file is Select Targa output format. Grayscale format is emitted if the JPEG file is
gray-scale or if grayscale or if
.B \-grayscale .B \-grayscale
is specified; otherwise, colormapped format is emitted if is specified; otherwise, colormapped format is emitted if
.B \-colors .B \-colors
@@ -162,7 +167,7 @@ faster and needs less memory, but it produces a lower-quality image.
is ignored unless you also say is ignored unless you also say
.B \-colors .B \-colors
.IR N . .IR N .
Also, the one-pass method is always used for gray-scale output (the two-pass Also, the one-pass method is always used for grayscale output (the two-pass
method is no improvement then). method is no improvement then).
.TP .TP
.BI \-maxmemory " N" .BI \-maxmemory " N"
@@ -246,7 +251,7 @@ Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
.SH AUTHOR .SH AUTHOR
Independent JPEG Group Independent JPEG Group
.SH BUGS .SH BUGS
To avoid the Unisys LZW patent, To avoid the Unisys LZW patent (now expired),
.B djpeg .B djpeg
produces uncompressed GIF files. These are larger than they should be, but produces uncompressed GIF files. These are larger than they should be, but
are readable by standard GIF decoders. are readable by standard GIF decoders.

View File

@@ -2,7 +2,7 @@
* djpeg.c * djpeg.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2009-2013 by Guido Vollbeding. * Modified 2009-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -102,6 +102,7 @@ usage (void)
fprintf(stderr, " -colors N Reduce image to no more than N colors\n"); fprintf(stderr, " -colors N Reduce image to no more than N colors\n");
fprintf(stderr, " -fast Fast, low-quality processing\n"); fprintf(stderr, " -fast Fast, low-quality processing\n");
fprintf(stderr, " -grayscale Force grayscale output\n"); fprintf(stderr, " -grayscale Force grayscale output\n");
fprintf(stderr, " -rgb Force RGB output\n");
#ifdef IDCT_SCALING_SUPPORTED #ifdef IDCT_SCALING_SUPPORTED
fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n"); fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n");
#endif #endif
@@ -264,6 +265,10 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
/* Force monochrome output. */ /* Force monochrome output. */
cinfo->out_color_space = JCS_GRAYSCALE; cinfo->out_color_space = JCS_GRAYSCALE;
} else if (keymatch(arg, "rgb", 3)) {
/* Force RGB output. */
cinfo->out_color_space = JCS_RGB;
} else if (keymatch(arg, "map", 3)) { } else if (keymatch(arg, "map", 3)) {
/* Quantize to a color map taken from an input file. */ /* Quantize to a color map taken from an input file. */
if (++argn >= argc) /* advance to next argument */ if (++argn >= argc) /* advance to next argument */

View File

@@ -1,6 +1,6 @@
IJG JPEG LIBRARY: FILE LIST IJG JPEG LIBRARY: FILE LIST
Copyright (C) 1994-2012, Thomas G. Lane, Guido Vollbeding. Copyright (C) 1994-2013, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software. This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file. For conditions of distribution and use, see the accompanying README file.
@@ -198,6 +198,7 @@ config.sub
depcomp depcomp
missing missing
ar-lib ar-lib
compile
install-sh Install shell script for those Unix systems lacking one. install-sh Install shell script for those Unix systems lacking one.
Makefile.in Makefile input for configure. Makefile.in Makefile input for configure.
Makefile.am Source file for use with Automake to generate Makefile.in. Makefile.am Source file for use with Automake to generate Makefile.in.

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# install - install a program, script, or datafile # install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC scriptversion=2013-12-25.23; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was # This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the # later released in X11R6 (xc/config/util/install.sh) with the
@@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC
# This script is compatible with the BSD install script, but was written # This script is compatible with the BSD install script, but was written
# from scratch. # from scratch.
tab=' '
nl=' nl='
' '
IFS=" "" $nl" IFS=" $tab$nl"
# set DOITPROG to echo to test this script # Set DOITPROG to "echo" to test this script.
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-} doit=${DOITPROG-}
if test -z "$doit"; then doit_exec=${doit:-exec}
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path; # Put in absolute file names if you don't have them in your path;
# or use environment vars. # or use environment vars.
@@ -68,17 +64,6 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm} rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip} stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir= posix_mkdir=
# Desired mode of installed file. # Desired mode of installed file.
@@ -97,7 +82,7 @@ dir_arg=
dst_arg= dst_arg=
copy_on_change=false copy_on_change=false
no_target_directory= is_target_a_directory=possibly
usage="\ usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -137,46 +122,57 @@ while test $# -ne 0; do
-d) dir_arg=true;; -d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2" -g) chgrpcmd="$chgrpprog $2"
shift;; shift;;
--help) echo "$usage"; exit $?;; --help) echo "$usage"; exit $?;;
-m) mode=$2 -m) mode=$2
case $mode in case $mode in
*' '* | *' '* | *' *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
'* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2
echo "$0: invalid mode: $mode" >&2 exit 1;;
exit 1;; esac
esac shift;;
shift;;
-o) chowncmd="$chownprog $2" -o) chowncmd="$chownprog $2"
shift;; shift;;
-s) stripcmd=$stripprog;; -s) stripcmd=$stripprog;;
-t) dst_arg=$2 -t)
# Protect names problematic for 'test' and other utilities. is_target_a_directory=always
case $dst_arg in dst_arg=$2
-* | [=\(\)!]) dst_arg=./$dst_arg;; # Protect names problematic for 'test' and other utilities.
esac case $dst_arg in
shift;; -* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;; -T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;; --version) echo "$0 $scriptversion"; exit $?;;
--) shift --) shift
break;; break;;
-*) echo "$0: invalid option: $1" >&2 -*) echo "$0: invalid option: $1" >&2
exit 1;; exit 1;;
*) break;; *) break;;
esac esac
shift shift
done done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create. # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified. # When -t is used, the destination is already specified.
@@ -207,6 +203,15 @@ if test $# -eq 0; then
exit 0 exit 0
fi fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret' do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1 trap "ret=129; $do_exit" 1
@@ -223,16 +228,16 @@ if test -z "$dir_arg"; then
*[0-7]) *[0-7])
if test -z "$stripcmd"; then if test -z "$stripcmd"; then
u_plus_rw= u_plus_rw=
else else
u_plus_rw='% 200' u_plus_rw='% 200'
fi fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*) *)
if test -z "$stripcmd"; then if test -z "$stripcmd"; then
u_plus_rw= u_plus_rw=
else else
u_plus_rw=,u+rw u_plus_rw=,u+rw
fi fi
cp_umask=$mode$u_plus_rw;; cp_umask=$mode$u_plus_rw;;
esac esac
@@ -269,41 +274,15 @@ do
# If destination is a directory, append the input filename; won't work # If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored. # if double slashes aren't ignored.
if test -d "$dst"; then if test -d "$dst"; then
if test -n "$no_target_directory"; then if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2 echo "$0: $dst_arg: Is a directory" >&2
exit 1 exit 1
fi fi
dstdir=$dst dstdir=$dst
dst=$dstdir/`basename "$src"` dst=$dstdir/`basename "$src"`
dstdir_status=0 dstdir_status=0
else else
# Prefer dirname, but fall back on a substitute if dirname fails. dstdir=`dirname "$dst"`
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir" test -d "$dstdir"
dstdir_status=$? dstdir_status=$?
fi fi
@@ -314,74 +293,74 @@ do
if test $dstdir_status != 0; then if test $dstdir_status != 0; then
case $posix_mkdir in case $posix_mkdir in
'') '')
# Create intermediate dirs using mode 755 as modified by the umask. # Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28. # This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask` umask=`umask`
case $stripcmd.$umask in case $stripcmd.$umask in
# Optimize common cases. # Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;; *[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7]) *[0-7])
mkdir_umask=`expr $umask + 22 \ mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \ - $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2 - $umask % 10 % 4 + $umask % 2
`;; `;;
*) mkdir_umask=$umask,go-w;; *) mkdir_umask=$umask,go-w;;
esac esac
# With -d, create the new directory with the user-specified mode. # With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask. # Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then if test -n "$dir_arg"; then
mkdir_mode=-m$mode mkdir_mode=-m$mode
else else
mkdir_mode= mkdir_mode=
fi fi
posix_mkdir=false posix_mkdir=false
case $umask in case $umask in
*[123567][0-7][0-7]) *[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which # POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0. # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;; ;;
*) *)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask && if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then then
if test -z "$dir_arg" || { if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m. # Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't. # other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"` ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;; d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;; d????-?--*) different_mode=755;;
*) false;; *) false;;
esac && esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && { $mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"` ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
} }
} }
then posix_mkdir=: then posix_mkdir=:
fi fi
rmdir "$tmpdir/d" "$tmpdir" rmdir "$tmpdir/d" "$tmpdir"
else else
# Remove any dirs left behind by ancient mkdir implementations. # Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi fi
trap '' 0;; trap '' 0;;
esac;; esac;;
esac esac
if if
$posix_mkdir && ( $posix_mkdir && (
umask $mkdir_umask && umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
) )
then : then :
else else
@@ -391,53 +370,51 @@ do
# directory the slow way, step by step, checking for races as we go. # directory the slow way, step by step, checking for races as we go.
case $dstdir in case $dstdir in
/*) prefix='/';; /*) prefix='/';;
[-=\(\)!]*) prefix='./';; [-=\(\)!]*) prefix='./';;
*) prefix='';; *) prefix='';;
esac esac
eval "$initialize_posix_glob"
oIFS=$IFS oIFS=$IFS
IFS=/ IFS=/
$posix_glob set -f set -f
set fnord $dstdir set fnord $dstdir
shift shift
$posix_glob set +f set +f
IFS=$oIFS IFS=$oIFS
prefixes= prefixes=
for d for d
do do
test X"$d" = X && continue test X"$d" = X && continue
prefix=$prefix$d prefix=$prefix$d
if test -d "$prefix"; then if test -d "$prefix"; then
prefixes= prefixes=
else else
if $posix_mkdir; then if $posix_mkdir; then
(umask=$mkdir_umask && (umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently. # Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1 test -d "$prefix" || exit 1
else else
case $prefix in case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;; *) qprefix=$prefix;;
esac esac
prefixes="$prefixes '$qprefix'" prefixes="$prefixes '$qprefix'"
fi fi
fi fi
prefix=$prefix/ prefix=$prefix/
done done
if test -n "$prefixes"; then if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently. # Don't fail if two instances are running concurrently.
(umask $mkdir_umask && (umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") || eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1 test -d "$dstdir" || exit 1
obsolete_mkdir_used=true obsolete_mkdir_used=true
fi fi
fi fi
fi fi
@@ -472,15 +449,12 @@ do
# If -C, don't bother to copy if it wouldn't change the file. # If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change && if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 && set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f && set +f &&
test "$old" = "$new" && test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then then
@@ -493,24 +467,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not # to itself, or perhaps because mv is so ancient that it does not
# support -f. # support -f.
{ {
# Now remove or move aside any old file at destination location. # Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some # We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other # systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new # reasons. In this case, the final cleanup might fail but the new
# file should still install successfully. # file should still install successfully.
{ {
test ! -f "$dst" || test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null || $doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} || } ||
{ echo "$0: cannot unlink or rename $dst" >&2 { echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1 (exit 1); exit 1
} }
} && } &&
# Now rename the file to the real destination. # Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst" $doit $mvcmd "$dsttmp" "$dst"
} }
fi || exit 1 fi || exit 1

View File

@@ -1,6 +1,6 @@
INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software
Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. Copyright (C) 1991-2015, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software. This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file. For conditions of distribution and use, see the accompanying README file.
@@ -147,9 +147,10 @@ makefile.bcc jconfig.bcc MS-DOS or OS/2, Borland C
makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C) makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only) makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only)
makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
makefile.vc jconfig.vc Windows NT/95, MS Visual C++ makefile.vc jconfig.vc Windows NT/9x, MS Visual C++
make*.vc6 jconfig.vc Windows NT/95, MS Visual C++ 6 make*.vc6 jconfig.vc Windows NT/9x, MS Visual C++ 6
make*.v10 jconfig.vc Windows NT/95, MS Visual C++ 2010 (v10) make*.v10 jconfig.vc Windows NT/9x, MS Visual C++ 2010 (v10)
makefile.b32 jconfig.vc Windows NT/9x, Borland C++ 32-bit (bcc32)
makefile.mms jconfig.vms Digital VMS, with MMS software makefile.mms jconfig.vms Digital VMS, with MMS software
makefile.vms jconfig.vms Digital VMS, without MMS software makefile.vms jconfig.vms Digital VMS, without MMS software
@@ -418,54 +419,58 @@ support as follows:
the directory containing the URT "librle.a" file (typically the the directory containing the URT "librle.a" file (typically the
"lib" subdirectory of the URT distribution). "lib" subdirectory of the URT distribution).
Support for 12-bit-deep pixel data: Support for 9-bit to 12-bit deep pixel data:
The JPEG standard allows either 8-bit or 12-bit data precision. (For color, The IJG code currently allows 8, 9, 10, 11, or 12 bits sample data precision.
this means 8 or 12 bits per channel, of course.) If you need to work with (For color, this means 8 to 12 bits per channel, of course.) If you need to
deeper than 8-bit data, you can compile the IJG code for 12-bit operation. work with deeper than 8-bit data, you can compile the IJG code for 9-bit to
12-bit operation.
To do so: To do so:
1. In jmorecfg.h, define BITS_IN_JSAMPLE as 12 rather than 8. 1. In jmorecfg.h, define BITS_IN_JSAMPLE as 9, 10, 11, or 12 rather than 8.
2. In jconfig.h, undefine BMP_SUPPORTED, RLE_SUPPORTED, and TARGA_SUPPORTED, 2. In jconfig.h, undefine BMP_SUPPORTED, RLE_SUPPORTED, and TARGA_SUPPORTED,
because the code for those formats doesn't handle 12-bit data and won't because the code for those formats doesn't handle deeper than 8-bit data
even compile. (The PPM code does work, as explained below. The GIF and won't even compile. (The PPM code does work, as explained below.
code works too; it scales 8-bit GIF data to and from 12-bit depth The GIF code works too; it scales 8-bit GIF data to and from 12-bit
automatically.) depth automatically.)
3. Compile. Don't expect "make test" to pass, since the supplied test 3. Compile. Don't expect "make test" to pass, since the supplied test
files are for 8-bit data. files are for 8-bit data.
Currently, 12-bit support does not work on 16-bit-int machines. Currently, 9-bit to 12-bit support does not work on 16-bit-int machines.
Note that a 12-bit version will not read 8-bit JPEG files, nor vice versa; Run-time selection and conversion of data precision are currently not
so you'll want to keep around a regular 8-bit compilation as well. supported and may be added later.
(Run-time selection of data depth, to allow a single copy that does both, Exception: The transcoding part (jpegtran) supports all settings in a
is possible but would probably slow things down considerably; it's very low single instance, since it operates on the level of DCT coefficients and
on our to-do list.) not sample values.
The PPM reader (rdppm.c) can read 12-bit data from either text-format or The PPM reader (rdppm.c) can read deeper than 8-bit data from either
binary-format PPM and PGM files. Binary-format PPM/PGM files which have a text-format or binary-format PPM and PGM files. Binary-format PPM/PGM files
maxval greater than 255 are assumed to use 2 bytes per sample, MSB first which have a maxval greater than 255 are assumed to use 2 bytes per sample,
(big-endian order). As of early 1995, 2-byte binary format is not MSB first (big-endian order). As of early 1995, 2-byte binary format is not
officially supported by the PBMPLUS library, but it is expected that a officially supported by the PBMPLUS library, but it is expected that a
future release of PBMPLUS will support it. Note that the PPM reader will future release of PBMPLUS will support it. Note that the PPM reader will
read files of any maxval regardless of the BITS_IN_JSAMPLE setting; incoming read files of any maxval regardless of the BITS_IN_JSAMPLE setting; incoming
data is automatically rescaled to either maxval=255 or maxval=4095 as data is automatically rescaled to maxval=MAXJSAMPLE as appropriate for the
appropriate for the cjpeg bit depth. cjpeg bit depth.
The PPM writer (wrppm.c) will normally write 2-byte binary PPM or PGM The PPM writer (wrppm.c) will normally write 2-byte binary PPM or PGM
format, maxval 4095, when compiled with BITS_IN_JSAMPLE=12. Since this format, maxval=MAXJSAMPLE, when compiled with BITS_IN_JSAMPLE>8. Since this
format is not yet widely supported, you can disable it by compiling wrppm.c format is not yet widely supported, you can disable it by compiling wrppm.c
with PPM_NORAWWORD defined; then the data is scaled down to 8 bits to make a with PPM_NORAWWORD defined; then the data is scaled down to 8 bits to make a
standard 1-byte/sample PPM or PGM file. (Yes, this means still another copy standard 1-byte/sample PPM or PGM file. (Yes, this means still another copy
of djpeg to keep around. But hopefully you won't need it for very long. of djpeg to keep around. But hopefully you won't need it for very long.
Poskanzer's supposed to get that new PBMPLUS release out Real Soon Now.) Poskanzer's supposed to get that new PBMPLUS release out Real Soon Now.)
Of course, if you are working with 12-bit data, you probably have it stored Of course, if you are working with 9-bit to 12-bit data, you probably have
in some other, nonstandard format. In that case you'll probably want to it stored in some other, nonstandard format. In that case you'll probably
write your own I/O modules to read and write your format. want to write your own I/O modules to read and write your format.
Note that a 12-bit version of cjpeg always runs in "-optimize" mode, in Note:
order to generate valid Huffman tables. This is necessary because our The standard Huffman tables are only valid for 8-bit data precision. If
default Huffman tables only cover 8-bit data. you selected more than 8-bit data precision, cjpeg uses arithmetic coding
by default. The Huffman encoder normally uses entropy optimization to
compute usable tables for higher precision. Otherwise, you'll have to
supply different default Huffman tables.
Removing code: Removing code:
@@ -859,6 +864,12 @@ add something like this to your jconfig.h file:
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean; typedef unsigned char boolean;
#endif #endif
#ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
(This is already in jconfig.vc, by the way.) (This is already in jconfig.vc, by the way.)

View File

@@ -2,6 +2,7 @@
* jcapistd.c * jcapistd.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -145,7 +146,7 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
(*cinfo->master->pass_startup) (cinfo); (*cinfo->master->pass_startup) (cinfo);
/* Verify that at least one iMCU row has been passed. */ /* Verify that at least one iMCU row has been passed. */
lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE; lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_v_scaled_size;
if (num_lines < lines_per_iMCU_row) if (num_lines < lines_per_iMCU_row)
ERREXIT(cinfo, JERR_BUFFER_SIZE); ERREXIT(cinfo, JERR_BUFFER_SIZE);

View File

@@ -1,7 +1,7 @@
/* /*
* jcarith.c * jcarith.c
* *
* Developed 1997-2012 by Guido Vollbeding. * Developed 1997-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -362,7 +362,6 @@ METHODDEF(boolean)
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
JBLOCKROW block;
unsigned char *st; unsigned char *st;
int blkn, ci, tbl; int blkn, ci, tbl;
int v, v2, m; int v, v2, m;
@@ -381,14 +380,13 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Encode the MCU data blocks */ /* Encode the MCU data blocks */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
block = MCU_data[blkn];
ci = cinfo->MCU_membership[blkn]; ci = cinfo->MCU_membership[blkn];
tbl = cinfo->cur_comp_info[ci]->dc_tbl_no; tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
/* Compute the DC value after the required point transform by Al. /* Compute the DC value after the required point transform by Al.
* This is simply an arithmetic right shift. * This is simply an arithmetic right shift.
*/ */
m = IRIGHT_SHIFT((int) ((*block)[0]), cinfo->Al); m = IRIGHT_SHIFT((int) (MCU_data[blkn][0][0]), cinfo->Al);
/* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */ /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
@@ -453,11 +451,11 @@ METHODDEF(boolean)
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
const int * natural_order;
JBLOCKROW block; JBLOCKROW block;
unsigned char *st; unsigned char *st;
int tbl, k, ke; int tbl, k, ke;
int v, v2, m; int v, v2, m;
const int * natural_order;
/* Emit restart marker if needed */ /* Emit restart marker if needed */
if (cinfo->restart_interval) { if (cinfo->restart_interval) {
@@ -552,6 +550,8 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* /*
* MCU encoding for DC successive approximation refinement scan. * MCU encoding for DC successive approximation refinement scan.
* Note: we assume such scans can be multi-component,
* although the spec is not very clear on the point.
*/ */
METHODDEF(boolean) METHODDEF(boolean)
@@ -593,11 +593,11 @@ METHODDEF(boolean)
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
const int * natural_order;
JBLOCKROW block; JBLOCKROW block;
unsigned char *st; unsigned char *st;
int tbl, k, ke, kex; int tbl, k, ke, kex;
int v; int v;
const int * natural_order;
/* Emit restart marker if needed */ /* Emit restart marker if needed */
if (cinfo->restart_interval) { if (cinfo->restart_interval) {
@@ -692,12 +692,13 @@ METHODDEF(boolean)
encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
jpeg_component_info * compptr; const int * natural_order;
JBLOCKROW block; JBLOCKROW block;
unsigned char *st; unsigned char *st;
int blkn, ci, tbl, k, ke; int tbl, k, ke;
int v, v2, m; int v, v2, m;
const int * natural_order; int blkn, ci;
jpeg_component_info * compptr;
/* Emit restart marker if needed */ /* Emit restart marker if needed */
if (cinfo->restart_interval) { if (cinfo->restart_interval) {

133
jccolor.c
View File

@@ -2,7 +2,7 @@
* jccolor.c * jccolor.c
* *
* Copyright (C) 1991-1996, Thomas G. Lane. * Copyright (C) 1991-1996, Thomas G. Lane.
* Modified 2011-2012 by Guido Vollbeding. * Modified 2011-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -29,13 +29,25 @@ typedef my_color_converter * my_cconvert_ptr;
/**************** RGB -> YCbCr conversion: most common case **************/ /**************** RGB -> YCbCr conversion: most common case **************/
/* /*
* YCbCr is defined per CCIR 601-1, except that Cb and Cr are * YCbCr is defined per Recommendation ITU-R BT.601-7 (03/2011),
* normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * previously known as Recommendation CCIR 601-1, except that Cb and Cr
* The conversion equations to be implemented are therefore * are normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
* Y = 0.29900 * R + 0.58700 * G + 0.11400 * B * sRGB (standard RGB color space) is defined per IEC 61966-2-1:1999.
* Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE * sYCC (standard luma-chroma-chroma color space with extended gamut)
* Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE * is defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex F.
* (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) * bg-sRGB and bg-sYCC (big gamut standard color spaces)
* are defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex G.
* Note that the derived conversion coefficients given in some of these
* documents are imprecise. The general conversion equations are
* Y = Kr * R + (1 - Kr - Kb) * G + Kb * B
* Cb = 0.5 * (B - Y) / (1 - Kb)
* Cr = 0.5 * (R - Y) / (1 - Kr)
* With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993
* from the 1953 FCC NTSC primaries and CIE Illuminant C),
* the conversion equations to be implemented are therefore
* Y = 0.299 * R + 0.587 * G + 0.114 * B
* Cb = -0.168735892 * R - 0.331264108 * G + 0.5 * B + CENTERJSAMPLE
* Cr = 0.5 * R - 0.418687589 * G - 0.081312411 * B + CENTERJSAMPLE
* Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2, * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2,
* rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and
* negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0) * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0)
@@ -49,9 +61,9 @@ typedef my_color_converter * my_cconvert_ptr;
* For even more speed, we avoid doing any multiplications in the inner loop * For even more speed, we avoid doing any multiplications in the inner loop
* by precalculating the constants times R,G,B for all possible values. * by precalculating the constants times R,G,B for all possible values.
* For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
* for 12-bit samples it is still acceptable. It's not very reasonable for * for 9-bit to 12-bit samples it is still acceptable. It's not very
* 16-bit samples, but if you want lossless storage you shouldn't be changing * reasonable for 16-bit samples, but if you want lossless storage you
* colorspace anyway. * shouldn't be changing colorspace anyway.
* The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
* in the tables to save adding them separately in the inner loop. * in the tables to save adding them separately in the inner loop.
*/ */
@@ -96,21 +108,21 @@ rgb_ycc_start (j_compress_ptr cinfo)
(TABLE_SIZE * SIZEOF(INT32))); (TABLE_SIZE * SIZEOF(INT32)));
for (i = 0; i <= MAXJSAMPLE; i++) { for (i = 0; i <= MAXJSAMPLE; i++) {
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i; rgb_ycc_tab[i+R_Y_OFF] = FIX(0.299) * i;
rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i; rgb_ycc_tab[i+G_Y_OFF] = FIX(0.587) * i;
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF; rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i; rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.168735892)) * i;
rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i; rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.331264108)) * i;
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr. /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
* This ensures that the maximum output will round to MAXJSAMPLE * This ensures that the maximum output will round to MAXJSAMPLE
* not MAXJSAMPLE+1, and thus that we don't have to range-limit. * not MAXJSAMPLE+1, and thus that we don't have to range-limit.
*/ */
rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; rgb_ycc_tab[i+B_CB_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1;
/* B=>Cb and R=>Cr tables are the same /* B=>Cb and R=>Cr tables are the same
rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; rgb_ycc_tab[i+R_CR_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1;
*/ */
rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i; rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.418687589)) * i;
rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i; rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.081312411)) * i;
} }
} }
@@ -274,6 +286,9 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
* Convert some rows of samples to the JPEG colorspace. * Convert some rows of samples to the JPEG colorspace.
* [R,G,B] to [R-G,G,B-G] conversion with modulo calculation * [R,G,B] to [R-G,G,B-G] conversion with modulo calculation
* (forward reversible color transform). * (forward reversible color transform).
* This can be seen as an adaption of the general RGB->YCbCr
* conversion equation with Kr = Kb = 0, while replacing the
* normalization by modulo calculation.
*/ */
METHODDEF(void) METHODDEF(void)
@@ -312,7 +327,7 @@ rgb_rgb1_convert (j_compress_ptr cinfo,
/* /*
* Convert some rows of samples to the JPEG colorspace. * Convert some rows of samples to the JPEG colorspace.
* This version handles grayscale output with no conversion. * This version handles grayscale output with no conversion.
* The source can be either plain grayscale or YCbCr (since Y == gray). * The source can be either plain grayscale or YCC (since Y == gray).
*/ */
METHODDEF(void) METHODDEF(void)
@@ -439,11 +454,13 @@ jinit_color_converter (j_compress_ptr cinfo)
break; break;
case JCS_RGB: case JCS_RGB:
case JCS_BG_RGB:
if (cinfo->input_components != RGB_PIXELSIZE) if (cinfo->input_components != RGB_PIXELSIZE)
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
break; break;
case JCS_YCbCr: case JCS_YCbCr:
case JCS_BG_YCC:
if (cinfo->input_components != 3) if (cinfo->input_components != 3)
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
break; break;
@@ -460,8 +477,10 @@ jinit_color_converter (j_compress_ptr cinfo)
break; break;
} }
/* Support color transform only for RGB colorspace */ /* Support color transform only for RGB colorspaces */
if (cinfo->color_transform && cinfo->jpeg_color_space != JCS_RGB) if (cinfo->color_transform &&
cinfo->jpeg_color_space != JCS_RGB &&
cinfo->jpeg_color_space != JCS_BG_RGB)
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
/* Check num_components, set conversion method based on requested space */ /* Check num_components, set conversion method based on requested space */
@@ -469,20 +488,26 @@ jinit_color_converter (j_compress_ptr cinfo)
case JCS_GRAYSCALE: case JCS_GRAYSCALE:
if (cinfo->num_components != 1) if (cinfo->num_components != 1)
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
if (cinfo->in_color_space == JCS_GRAYSCALE || switch (cinfo->in_color_space) {
cinfo->in_color_space == JCS_YCbCr) case JCS_GRAYSCALE:
case JCS_YCbCr:
case JCS_BG_YCC:
cconvert->pub.color_convert = grayscale_convert; cconvert->pub.color_convert = grayscale_convert;
else if (cinfo->in_color_space == JCS_RGB) { break;
case JCS_RGB:
cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.start_pass = rgb_ycc_start;
cconvert->pub.color_convert = rgb_gray_convert; cconvert->pub.color_convert = rgb_gray_convert;
} else break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break; break;
case JCS_RGB: case JCS_RGB:
case JCS_BG_RGB:
if (cinfo->num_components != 3) if (cinfo->num_components != 3)
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
if (cinfo->in_color_space == JCS_RGB) { if (cinfo->in_color_space == cinfo->jpeg_color_space) {
switch (cinfo->color_transform) { switch (cinfo->color_transform) {
case JCT_NONE: case JCT_NONE:
cconvert->pub.color_convert = rgb_convert; cconvert->pub.color_convert = rgb_convert;
@@ -492,7 +517,6 @@ jinit_color_converter (j_compress_ptr cinfo)
break; break;
default: default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
break;
} }
} else } else
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
@@ -501,13 +525,48 @@ jinit_color_converter (j_compress_ptr cinfo)
case JCS_YCbCr: case JCS_YCbCr:
if (cinfo->num_components != 3) if (cinfo->num_components != 3)
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
if (cinfo->in_color_space == JCS_RGB) { switch (cinfo->in_color_space) {
case JCS_RGB:
cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.start_pass = rgb_ycc_start;
cconvert->pub.color_convert = rgb_ycc_convert; cconvert->pub.color_convert = rgb_ycc_convert;
} else if (cinfo->in_color_space == JCS_YCbCr) break;
case JCS_YCbCr:
cconvert->pub.color_convert = null_convert; cconvert->pub.color_convert = null_convert;
else break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break;
case JCS_BG_YCC:
if (cinfo->num_components != 3)
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
switch (cinfo->in_color_space) {
case JCS_RGB:
/* For conversion from normal RGB input to BG_YCC representation,
* the Cb/Cr values are first computed as usual, and then
* quantized further after DCT processing by a factor of
* 2 in reference to the nominal quantization factor.
*/
/* need quantization scale by factor of 2 after DCT */
cinfo->comp_info[1].component_needed = TRUE;
cinfo->comp_info[2].component_needed = TRUE;
/* compute normal YCC first */
cconvert->pub.start_pass = rgb_ycc_start;
cconvert->pub.color_convert = rgb_ycc_convert;
break;
case JCS_YCbCr:
/* need quantization scale by factor of 2 after DCT */
cinfo->comp_info[1].component_needed = TRUE;
cinfo->comp_info[2].component_needed = TRUE;
/*FALLTHROUGH*/
case JCS_BG_YCC:
/* Pass through for BG_YCC input */
cconvert->pub.color_convert = null_convert;
break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break; break;
case JCS_CMYK: case JCS_CMYK:
@@ -522,13 +581,17 @@ jinit_color_converter (j_compress_ptr cinfo)
case JCS_YCCK: case JCS_YCCK:
if (cinfo->num_components != 4) if (cinfo->num_components != 4)
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
if (cinfo->in_color_space == JCS_CMYK) { switch (cinfo->in_color_space) {
case JCS_CMYK:
cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.start_pass = rgb_ycc_start;
cconvert->pub.color_convert = cmyk_ycck_convert; cconvert->pub.color_convert = cmyk_ycck_convert;
} else if (cinfo->in_color_space == JCS_YCCK) break;
case JCS_YCCK:
cconvert->pub.color_convert = null_convert; cconvert->pub.color_convert = null_convert;
else break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break; break;
default: /* allow null conversion of JCS_UNKNOWN */ default: /* allow null conversion of JCS_UNKNOWN */

View File

@@ -2,6 +2,7 @@
* jcdctmgr.c * jcdctmgr.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -25,22 +26,30 @@ typedef struct {
/* Pointer to the DCT routine actually in use */ /* Pointer to the DCT routine actually in use */
forward_DCT_method_ptr do_dct[MAX_COMPONENTS]; forward_DCT_method_ptr do_dct[MAX_COMPONENTS];
/* The actual post-DCT divisors --- not identical to the quant table
* entries, because of scaling (especially for an unnormalized DCT).
* Each table is given in normal array order.
*/
DCTELEM * divisors[NUM_QUANT_TBLS];
#ifdef DCT_FLOAT_SUPPORTED #ifdef DCT_FLOAT_SUPPORTED
/* Same as above for the floating-point case. */ /* Same as above for the floating-point case. */
float_DCT_method_ptr do_float_dct[MAX_COMPONENTS]; float_DCT_method_ptr do_float_dct[MAX_COMPONENTS];
FAST_FLOAT * float_divisors[NUM_QUANT_TBLS];
#endif #endif
} my_fdct_controller; } my_fdct_controller;
typedef my_fdct_controller * my_fdct_ptr; typedef my_fdct_controller * my_fdct_ptr;
/* The allocated post-DCT divisor tables -- big enough for any
* supported variant and not identical to the quant table entries,
* because of scaling (especially for an unnormalized DCT) --
* are pointed to by dct_table in the per-component comp_info
* structures. Each table is given in normal array order.
*/
typedef union {
DCTELEM int_array[DCTSIZE2];
#ifdef DCT_FLOAT_SUPPORTED
FAST_FLOAT float_array[DCTSIZE2];
#endif
} divisor_table;
/* The current scaled-DCT routines require ISLOW-style divisor tables, /* The current scaled-DCT routines require ISLOW-style divisor tables,
* so be sure to compile that code if either ISLOW or SCALING is requested. * so be sure to compile that code if either ISLOW or SCALING is requested.
*/ */
@@ -71,7 +80,7 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
/* This routine is heavily used, so it's worth coding it tightly. */ /* This routine is heavily used, so it's worth coding it tightly. */
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
forward_DCT_method_ptr do_dct = fdct->do_dct[compptr->component_index]; forward_DCT_method_ptr do_dct = fdct->do_dct[compptr->component_index];
DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no]; DCTELEM * divisors = (DCTELEM *) compptr->dct_table;
DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */ DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */
JDIMENSION bi; JDIMENSION bi;
@@ -134,7 +143,7 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
/* This routine is heavily used, so it's worth coding it tightly. */ /* This routine is heavily used, so it's worth coding it tightly. */
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
float_DCT_method_ptr do_dct = fdct->do_float_dct[compptr->component_index]; float_DCT_method_ptr do_dct = fdct->do_float_dct[compptr->component_index];
FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no]; FAST_FLOAT * divisors = (FAST_FLOAT *) compptr->dct_table;
FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */ FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */
JDIMENSION bi; JDIMENSION bi;
@@ -352,22 +361,17 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
cinfo->quant_tbl_ptrs[qtblno] == NULL) cinfo->quant_tbl_ptrs[qtblno] == NULL)
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
qtbl = cinfo->quant_tbl_ptrs[qtblno]; qtbl = cinfo->quant_tbl_ptrs[qtblno];
/* Compute divisors for this quant table */ /* Create divisor table from quant table */
/* We may do this more than once for same table, but it's not a big deal */
switch (method) { switch (method) {
#ifdef PROVIDE_ISLOW_TABLES #ifdef PROVIDE_ISLOW_TABLES
case JDCT_ISLOW: case JDCT_ISLOW:
/* For LL&M IDCT method, divisors are equal to raw quantization /* For LL&M IDCT method, divisors are equal to raw quantization
* coefficients multiplied by 8 (to counteract scaling). * coefficients multiplied by 8 (to counteract scaling).
*/ */
if (fdct->divisors[qtblno] == NULL) { dtbl = (DCTELEM *) compptr->dct_table;
fdct->divisors[qtblno] = (DCTELEM *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
DCTSIZE2 * SIZEOF(DCTELEM));
}
dtbl = fdct->divisors[qtblno];
for (i = 0; i < DCTSIZE2; i++) { for (i = 0; i < DCTSIZE2; i++) {
dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; dtbl[i] =
((DCTELEM) qtbl->quantval[i]) << (compptr->component_needed ? 4 : 3);
} }
fdct->pub.forward_DCT[ci] = forward_DCT; fdct->pub.forward_DCT[ci] = forward_DCT;
break; break;
@@ -395,17 +399,12 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
}; };
SHIFT_TEMPS SHIFT_TEMPS
if (fdct->divisors[qtblno] == NULL) { dtbl = (DCTELEM *) compptr->dct_table;
fdct->divisors[qtblno] = (DCTELEM *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
DCTSIZE2 * SIZEOF(DCTELEM));
}
dtbl = fdct->divisors[qtblno];
for (i = 0; i < DCTSIZE2; i++) { for (i = 0; i < DCTSIZE2; i++) {
dtbl[i] = (DCTELEM) dtbl[i] = (DCTELEM)
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
(INT32) aanscales[i]), (INT32) aanscales[i]),
CONST_BITS-3); compptr->component_needed ? CONST_BITS-4 : CONST_BITS-3);
} }
} }
fdct->pub.forward_DCT[ci] = forward_DCT; fdct->pub.forward_DCT[ci] = forward_DCT;
@@ -422,25 +421,20 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
* What's actually stored is 1/divisor so that the inner loop can * What's actually stored is 1/divisor so that the inner loop can
* use a multiplication rather than a division. * use a multiplication rather than a division.
*/ */
FAST_FLOAT * fdtbl; FAST_FLOAT * fdtbl = (FAST_FLOAT *) compptr->dct_table;
int row, col; int row, col;
static const double aanscalefactor[DCTSIZE] = { static const double aanscalefactor[DCTSIZE] = {
1.0, 1.387039845, 1.306562965, 1.175875602, 1.0, 1.387039845, 1.306562965, 1.175875602,
1.0, 0.785694958, 0.541196100, 0.275899379 1.0, 0.785694958, 0.541196100, 0.275899379
}; };
if (fdct->float_divisors[qtblno] == NULL) {
fdct->float_divisors[qtblno] = (FAST_FLOAT *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
DCTSIZE2 * SIZEOF(FAST_FLOAT));
}
fdtbl = fdct->float_divisors[qtblno];
i = 0; i = 0;
for (row = 0; row < DCTSIZE; row++) { for (row = 0; row < DCTSIZE; row++) {
for (col = 0; col < DCTSIZE; col++) { for (col = 0; col < DCTSIZE; col++) {
fdtbl[i] = (FAST_FLOAT) fdtbl[i] = (FAST_FLOAT)
(1.0 / (((double) qtbl->quantval[i] * (1.0 / ((double) qtbl->quantval[i] *
aanscalefactor[row] * aanscalefactor[col] * 8.0))); aanscalefactor[row] * aanscalefactor[col] *
(compptr->component_needed ? 16.0 : 8.0)));
i++; i++;
} }
} }
@@ -464,19 +458,20 @@ GLOBAL(void)
jinit_forward_dct (j_compress_ptr cinfo) jinit_forward_dct (j_compress_ptr cinfo)
{ {
my_fdct_ptr fdct; my_fdct_ptr fdct;
int i; int ci;
jpeg_component_info *compptr;
fdct = (my_fdct_ptr) fdct = (my_fdct_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_fdct_controller)); SIZEOF(my_fdct_controller));
cinfo->fdct = (struct jpeg_forward_dct *) fdct; cinfo->fdct = &fdct->pub;
fdct->pub.start_pass = start_pass_fdctmgr; fdct->pub.start_pass = start_pass_fdctmgr;
/* Mark divisor tables unallocated */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
for (i = 0; i < NUM_QUANT_TBLS; i++) { ci++, compptr++) {
fdct->divisors[i] = NULL; /* Allocate a divisor table for each component */
#ifdef DCT_FLOAT_SUPPORTED compptr->dct_table =
fdct->float_divisors[i] = NULL; (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
#endif SIZEOF(divisor_table));
} }
} }

119
jchuff.c
View File

@@ -2,7 +2,7 @@
* jchuff.c * jchuff.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2006-2009 by Guido Vollbeding. * Modified 2006-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -308,24 +308,27 @@ emit_bits_s (working_state * state, unsigned int code, int size)
/* Emit some bits; return TRUE if successful, FALSE if must suspend */ /* Emit some bits; return TRUE if successful, FALSE if must suspend */
{ {
/* This routine is heavily used, so it's worth coding tightly. */ /* This routine is heavily used, so it's worth coding tightly. */
register INT32 put_buffer = (INT32) code; register INT32 put_buffer;
register int put_bits = state->cur.put_bits; register int put_bits;
/* if size is 0, caller used an invalid Huffman table entry */ /* if size is 0, caller used an invalid Huffman table entry */
if (size == 0) if (size == 0)
ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE);
put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ /* mask off any extra bits in code */
put_buffer = ((INT32) code) & ((((INT32) 1) << size) - 1);
put_bits += size; /* new number of bits in buffer */
/* new number of bits in buffer */
put_bits = size + state->cur.put_bits;
put_buffer <<= 24 - put_bits; /* align incoming bits */ put_buffer <<= 24 - put_bits; /* align incoming bits */
put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */ /* and merge with old buffer contents */
put_buffer |= state->cur.put_buffer;
while (put_bits >= 8) { while (put_bits >= 8) {
int c = (int) ((put_buffer >> 16) & 0xFF); int c = (int) ((put_buffer >> 16) & 0xFF);
emit_byte_s(state, c, return FALSE); emit_byte_s(state, c, return FALSE);
if (c == 0xFF) { /* need to stuff a zero byte? */ if (c == 0xFF) { /* need to stuff a zero byte? */
emit_byte_s(state, 0, return FALSE); emit_byte_s(state, 0, return FALSE);
@@ -347,8 +350,8 @@ emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size)
/* Emit some bits, unless we are in gather mode */ /* Emit some bits, unless we are in gather mode */
{ {
/* This routine is heavily used, so it's worth coding tightly. */ /* This routine is heavily used, so it's worth coding tightly. */
register INT32 put_buffer = (INT32) code; register INT32 put_buffer;
register int put_bits = entropy->saved.put_bits; register int put_bits;
/* if size is 0, caller used an invalid Huffman table entry */ /* if size is 0, caller used an invalid Huffman table entry */
if (size == 0) if (size == 0)
@@ -357,9 +360,11 @@ emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size)
if (entropy->gather_statistics) if (entropy->gather_statistics)
return; /* do nothing if we're only getting stats */ return; /* do nothing if we're only getting stats */
put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ /* mask off any extra bits in code */
put_buffer = ((INT32) code) & ((((INT32) 1) << size) - 1);
put_bits += size; /* new number of bits in buffer */
/* new number of bits in buffer */
put_bits = size + entropy->saved.put_bits;
put_buffer <<= 24 - put_bits; /* align incoming bits */ put_buffer <<= 24 - put_bits; /* align incoming bits */
@@ -543,10 +548,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
register int temp, temp2; register int temp, temp2;
register int nbits; register int nbits;
int blkn, ci; int blkn, ci, tbl;
int Al = cinfo->Al;
JBLOCKROW block;
jpeg_component_info * compptr;
ISHIFT_TEMPS ISHIFT_TEMPS
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;
@@ -559,28 +561,27 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Encode the MCU data blocks */ /* Encode the MCU data blocks */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
block = MCU_data[blkn];
ci = cinfo->MCU_membership[blkn]; ci = cinfo->MCU_membership[blkn];
compptr = cinfo->cur_comp_info[ci]; tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
/* Compute the DC value after the required point transform by Al. /* Compute the DC value after the required point transform by Al.
* This is simply an arithmetic right shift. * This is simply an arithmetic right shift.
*/ */
temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al); temp = IRIGHT_SHIFT((int) (MCU_data[blkn][0][0]), cinfo->Al);
/* DC differences are figured on the point-transformed values. */ /* DC differences are figured on the point-transformed values. */
temp = temp2 - entropy->saved.last_dc_val[ci]; temp2 = temp - entropy->saved.last_dc_val[ci];
entropy->saved.last_dc_val[ci] = temp2; entropy->saved.last_dc_val[ci] = temp;
/* Encode the DC coefficient difference per section G.1.2.1 */ /* Encode the DC coefficient difference per section G.1.2.1 */
temp2 = temp; temp = temp2;
if (temp < 0) { if (temp < 0) {
temp = -temp; /* temp is abs value of input */ temp = -temp; /* temp is abs value of input */
/* For a negative input, want temp2 = bitwise complement of abs(input) */ /* For a negative input, want temp2 = bitwise complement of abs(input) */
/* This code assumes we are on a two's complement machine */ /* This code assumes we are on a two's complement machine */
temp2--; temp2--;
} }
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = 0;
while (temp) { while (temp) {
@@ -592,10 +593,10 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/ */
if (nbits > MAX_COEF_BITS+1) if (nbits > MAX_COEF_BITS+1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF); ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit the Huffman-coded symbol for the number of bits */ /* Count/emit the Huffman-coded symbol for the number of bits */
emit_dc_symbol(entropy, compptr->dc_tbl_no, nbits); emit_dc_symbol(entropy, tbl, nbits);
/* Emit that number of bits of the value, if positive, */ /* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */ /* or the complement of its magnitude, if negative. */
if (nbits) /* emit_bits rejects calls with size 0 */ if (nbits) /* emit_bits rejects calls with size 0 */
@@ -628,12 +629,12 @@ METHODDEF(boolean)
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
const int * natural_order;
JBLOCKROW block;
register int temp, temp2; register int temp, temp2;
register int nbits; register int nbits;
register int r, k; register int r, k;
int Se, Al; int Se, Al;
const int * natural_order;
JBLOCKROW block;
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer; entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@@ -731,18 +732,15 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* /*
* MCU encoding for DC successive approximation refinement scan. * MCU encoding for DC successive approximation refinement scan.
* Note: we assume such scans can be multi-component, although the spec * Note: we assume such scans can be multi-component,
* is not very clear on the point. * although the spec is not very clear on the point.
*/ */
METHODDEF(boolean) METHODDEF(boolean)
encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
register int temp; int Al, blkn;
int blkn;
int Al = cinfo->Al;
JBLOCKROW block;
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer; entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@@ -752,13 +750,12 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
if (entropy->restarts_to_go == 0) if (entropy->restarts_to_go == 0)
emit_restart_e(entropy, entropy->next_restart_num); emit_restart_e(entropy, entropy->next_restart_num);
Al = cinfo->Al;
/* Encode the MCU data blocks */ /* Encode the MCU data blocks */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
block = MCU_data[blkn];
/* We simply emit the Al'th bit of the DC coefficient value. */ /* We simply emit the Al'th bit of the DC coefficient value. */
temp = (*block)[0]; emit_bits_e(entropy, (unsigned int) (MCU_data[blkn][0][0] >> Al), 1);
emit_bits_e(entropy, (unsigned int) (temp >> Al), 1);
} }
cinfo->dest->next_output_byte = entropy->next_output_byte; cinfo->dest->next_output_byte = entropy->next_output_byte;
@@ -786,14 +783,14 @@ METHODDEF(boolean)
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
const int * natural_order;
JBLOCKROW block;
register int temp; register int temp;
register int r, k; register int r, k;
int Se, Al;
int EOB; int EOB;
char *BR_buffer; char *BR_buffer;
unsigned int BR; unsigned int BR;
int Se, Al;
const int * natural_order;
JBLOCKROW block;
int absvalues[DCTSIZE2]; int absvalues[DCTSIZE2];
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;
@@ -918,7 +915,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
{ {
register int temp, temp2; register int temp, temp2;
register int nbits; register int nbits;
register int k, r, i; register int r, k;
int Se = state->cinfo->lim_Se; int Se = state->cinfo->lim_Se;
const int * natural_order = state->cinfo->natural_order; const int * natural_order = state->cinfo->natural_order;
@@ -960,7 +957,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
r = 0; /* r = run length of zeros */ r = 0; /* r = run length of zeros */
for (k = 1; k <= Se; k++) { for (k = 1; k <= Se; k++) {
if ((temp = block[natural_order[k]]) == 0) { if ((temp2 = block[natural_order[k]]) == 0) {
r++; r++;
} else { } else {
/* if run length > 15, must emit special run-length-16 codes (0xF0) */ /* if run length > 15, must emit special run-length-16 codes (0xF0) */
@@ -970,7 +967,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
r -= 16; r -= 16;
} }
temp2 = temp; temp = temp2;
if (temp < 0) { if (temp < 0) {
temp = -temp; /* temp is abs value of input */ temp = -temp; /* temp is abs value of input */
/* This code assumes we are on a two's complement machine */ /* This code assumes we are on a two's complement machine */
@@ -986,8 +983,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit Huffman symbol for run length / number of bits */ /* Emit Huffman symbol for run length / number of bits */
i = (r << 4) + nbits; temp = (r << 4) + nbits;
if (! emit_bits_s(state, actbl->ehufco[i], actbl->ehufsi[i])) if (! emit_bits_s(state, actbl->ehufco[temp], actbl->ehufsi[temp]))
return FALSE; return FALSE;
/* Emit that number of bits of the value, if positive, */ /* Emit that number of bits of the value, if positive, */
@@ -1124,16 +1121,16 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
{ {
register int temp; register int temp;
register int nbits; register int nbits;
register int k, r; register int r, k;
int Se = cinfo->lim_Se; int Se = cinfo->lim_Se;
const int * natural_order = cinfo->natural_order; const int * natural_order = cinfo->natural_order;
/* Encode the DC coefficient difference per section F.1.2.1 */ /* Encode the DC coefficient difference per section F.1.2.1 */
temp = block[0] - last_dc_val; temp = block[0] - last_dc_val;
if (temp < 0) if (temp < 0)
temp = -temp; temp = -temp;
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = 0;
while (temp) { while (temp) {
@@ -1148,11 +1145,11 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
/* Count the Huffman symbol for the number of bits */ /* Count the Huffman symbol for the number of bits */
dc_counts[nbits]++; dc_counts[nbits]++;
/* Encode the AC coefficients per section F.1.2.2 */ /* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */ r = 0; /* r = run length of zeros */
for (k = 1; k <= Se; k++) { for (k = 1; k <= Se; k++) {
if ((temp = block[natural_order[k]]) == 0) { if ((temp = block[natural_order[k]]) == 0) {
r++; r++;
@@ -1162,11 +1159,11 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
ac_counts[0xF0]++; ac_counts[0xF0]++;
r -= 16; r -= 16;
} }
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
if (temp < 0) if (temp < 0)
temp = -temp; temp = -temp;
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */ nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1)) while ((temp >>= 1))
@@ -1174,10 +1171,10 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
/* Check for out-of-range coefficient values */ /* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS) if (nbits > MAX_COEF_BITS)
ERREXIT(cinfo, JERR_BAD_DCT_COEF); ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count Huffman symbol for run length / number of bits */ /* Count Huffman symbol for run length / number of bits */
ac_counts[(r << 4) + nbits]++; ac_counts[(r << 4) + nbits]++;
r = 0; r = 0;
} }
} }
@@ -1562,7 +1559,7 @@ jinit_huff_encoder (j_compress_ptr cinfo)
entropy = (huff_entropy_ptr) entropy = (huff_entropy_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(huff_entropy_encoder)); SIZEOF(huff_entropy_encoder));
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; cinfo->entropy = &entropy->pub;
entropy->pub.start_pass = start_pass_huff; entropy->pub.start_pass = start_pass_huff;
/* Mark tables unallocated */ /* Mark tables unallocated */

View File

@@ -2,6 +2,7 @@
* jcinit.c * jcinit.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -29,6 +30,24 @@
GLOBAL(void) GLOBAL(void)
jinit_compress_master (j_compress_ptr cinfo) jinit_compress_master (j_compress_ptr cinfo)
{ {
long samplesperrow;
JDIMENSION jd_samplesperrow;
/* For now, precision must match compiled-in value... */
if (cinfo->data_precision != BITS_IN_JSAMPLE)
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
/* Sanity check on image dimensions */
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
cinfo->input_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
/* Width of an input scanline must be representable as JDIMENSION. */
samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;
jd_samplesperrow = (JDIMENSION) samplesperrow;
if ((long) jd_samplesperrow != samplesperrow)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
/* Initialize master control (includes parameter checking/processing) */ /* Initialize master control (includes parameter checking/processing) */
jinit_c_master_control(cinfo, FALSE /* full compression */); jinit_c_master_control(cinfo, FALSE /* full compression */);

View File

@@ -2,7 +2,7 @@
* jcmarker.c * jcmarker.c
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2012 by Guido Vollbeding. * Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -508,8 +508,8 @@ write_marker_byte (j_compress_ptr cinfo, int val)
* Write datastream header. * Write datastream header.
* This consists of an SOI and optional APPn markers. * This consists of an SOI and optional APPn markers.
* We recommend use of the JFIF marker, but not the Adobe marker, * We recommend use of the JFIF marker, but not the Adobe marker,
* when using YCbCr or grayscale data. The JFIF marker should NOT * when using YCbCr or grayscale data. The JFIF marker is also used
* be used for any other JPEG colorspace. The Adobe marker is helpful * for other standard JPEG colorspaces. The Adobe marker is helpful
* to distinguish RGB, CMYK, and YCCK colorspaces. * to distinguish RGB, CMYK, and YCCK colorspaces.
* Note that an application can write additional header markers after * Note that an application can write additional header markers after
* jpeg_start_compress returns. * jpeg_start_compress returns.

View File

@@ -2,7 +2,7 @@
* jcmaster.c * jcmaster.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2011 by Guido Vollbeding. * Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -222,8 +222,6 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
{ {
int ci, ssize; int ci, ssize;
jpeg_component_info *compptr; jpeg_component_info *compptr;
long samplesperrow;
JDIMENSION jd_samplesperrow;
if (transcode_only) if (transcode_only)
jpeg_calc_trans_dimensions(cinfo); jpeg_calc_trans_dimensions(cinfo);
@@ -251,7 +249,7 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
/* Sanity check on image dimensions */ /* Sanity check on image dimensions */
if (cinfo->jpeg_height <= 0 || cinfo->jpeg_width <= 0 || if (cinfo->jpeg_height <= 0 || cinfo->jpeg_width <= 0 ||
cinfo->num_components <= 0 || cinfo->input_components <= 0) cinfo->num_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE); ERREXIT(cinfo, JERR_EMPTY_IMAGE);
/* Make sure image isn't bigger than I can handle */ /* Make sure image isn't bigger than I can handle */
@@ -259,14 +257,8 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
(long) cinfo->jpeg_width > (long) JPEG_MAX_DIMENSION) (long) cinfo->jpeg_width > (long) JPEG_MAX_DIMENSION)
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
/* Width of an input scanline must be representable as JDIMENSION. */ /* Only 8 to 12 bits data precision are supported for DCT based JPEG */
samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; if (cinfo->data_precision < 8 || cinfo->data_precision > 12)
jd_samplesperrow = (JDIMENSION) samplesperrow;
if ((long) jd_samplesperrow != samplesperrow)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
/* For now, precision must match compiled-in value... */
if (cinfo->data_precision != BITS_IN_JSAMPLE)
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
/* Check that number of components won't exceed internal array sizes */ /* Check that number of components won't exceed internal array sizes */
@@ -339,8 +331,10 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
jdiv_round_up((long) cinfo->jpeg_height * jdiv_round_up((long) cinfo->jpeg_height *
(long) (compptr->v_samp_factor * compptr->DCT_v_scaled_size), (long) (compptr->v_samp_factor * compptr->DCT_v_scaled_size),
(long) (cinfo->max_v_samp_factor * cinfo->block_size)); (long) (cinfo->max_v_samp_factor * cinfo->block_size));
/* Mark component needed (this flag isn't actually used for compression) */ /* Don't need quantization scale after DCT,
compptr->component_needed = TRUE; * until color conversion says otherwise.
*/
compptr->component_needed = FALSE;
} }
/* Compute number of fully interleaved MCU rows (number of times that /* Compute number of fully interleaved MCU rows (number of times that
@@ -811,7 +805,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
master = (my_master_ptr) master = (my_master_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_comp_master)); SIZEOF(my_comp_master));
cinfo->master = (struct jpeg_comp_master *) master; cinfo->master = &master->pub;
master->pub.prepare_for_pass = prepare_for_pass; master->pub.prepare_for_pass = prepare_for_pass;
master->pub.pass_startup = pass_startup; master->pub.pass_startup = pass_startup;
master->pub.finish_pass = finish_pass_master; master->pub.finish_pass = finish_pass_master;
@@ -833,10 +827,14 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
cinfo->num_scans = 1; cinfo->num_scans = 1;
} }
if ((cinfo->progressive_mode || cinfo->block_size < DCTSIZE) && if (cinfo->optimize_coding)
!cinfo->arith_code) /* TEMPORARY HACK ??? */ cinfo->arith_code = FALSE; /* disable arithmetic coding */
/* assume default tables no good for progressive or downscale mode */ else if (! cinfo->arith_code &&
cinfo->optimize_coding = TRUE; (cinfo->progressive_mode ||
(cinfo->block_size > 1 && cinfo->block_size < DCTSIZE)))
/* TEMPORARY HACK ??? */
/* assume default tables no good for progressive or reduced AC mode */
cinfo->optimize_coding = TRUE; /* force Huffman optimization */
/* Initialize my private state */ /* Initialize my private state */
if (transcode_only) { if (transcode_only) {

View File

@@ -17,11 +17,17 @@
/* Define this if you get warnings about undefined structures. */ /* Define this if you get warnings about undefined structures. */
#undef INCOMPLETE_TYPES_BROKEN #undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, on Windows systems. */ /* Define "boolean" as unsigned char, not enum, on Windows systems. */
#ifdef _WIN32 #ifdef _WIN32
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean; typedef unsigned char boolean;
#endif #endif
#ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#endif #endif

View File

@@ -2,6 +2,7 @@
* jconfig.txt * jconfig.txt
* *
* Copyright (C) 1991-1994, Thomas G. Lane. * Copyright (C) 1991-1994, Thomas G. Lane.
* Modified 2009-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -91,12 +92,18 @@
*/ */
#undef INCOMPLETE_TYPES_BROKEN #undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, on Windows systems. /* Define "boolean" as unsigned char, not enum, on Windows systems.
*/ */
#ifdef _WIN32 #ifdef _WIN32
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean; typedef unsigned char boolean;
#endif #endif
#ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#endif #endif

View File

@@ -1,4 +1,5 @@
/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ /* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 9x or NT. */
/* This file also works for Borland C++ 32-bit (bcc32) on Windows 9x or NT. */
/* see jconfig.txt for explanations */ /* see jconfig.txt for explanations */
#define HAVE_PROTOTYPES #define HAVE_PROTOTYPES
@@ -19,6 +20,12 @@
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean; typedef unsigned char boolean;
#endif #endif
#ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */

110
jcparam.c
View File

@@ -2,7 +2,7 @@
* jcparam.c * jcparam.c
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2012 by Guido Vollbeding. * Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -323,18 +323,17 @@ jpeg_set_defaults (j_compress_ptr cinfo)
/* Expect normal source image, not raw downsampled data */ /* Expect normal source image, not raw downsampled data */
cinfo->raw_data_in = FALSE; cinfo->raw_data_in = FALSE;
/* Use Huffman coding, not arithmetic coding, by default */ /* The standard Huffman tables are only valid for 8-bit data precision.
cinfo->arith_code = FALSE; * If the precision is higher, use arithmetic coding.
* (Alternatively, using Huffman coding would be possible with forcing
* optimization on so that usable tables will be computed, or by
* supplying default tables that are valid for the desired precision.)
* Otherwise, use Huffman coding by default.
*/
cinfo->arith_code = cinfo->data_precision > 8 ? TRUE : FALSE;
/* By default, don't do extra passes to optimize entropy coding */ /* By default, don't do extra passes to optimize entropy coding */
cinfo->optimize_coding = FALSE; cinfo->optimize_coding = FALSE;
/* The standard Huffman tables are only valid for 8-bit data precision.
* If the precision is higher, force optimization on so that usable
* tables will be computed. This test can be removed if default tables
* are supplied that are valid for the desired precision.
*/
if (cinfo->data_precision > 8)
cinfo->optimize_coding = TRUE;
/* By default, use the simpler non-cosited sampling alignment */ /* By default, use the simpler non-cosited sampling alignment */
cinfo->CCIR601_sampling = FALSE; cinfo->CCIR601_sampling = FALSE;
@@ -360,6 +359,9 @@ jpeg_set_defaults (j_compress_ptr cinfo)
* JFIF_minor_version to 2. We could probably get away with just defaulting * JFIF_minor_version to 2. We could probably get away with just defaulting
* to 1.02, but there may still be some decoders in use that will complain * to 1.02, but there may still be some decoders in use that will complain
* about that; saying 1.01 should minimize compatibility problems. * about that; saying 1.01 should minimize compatibility problems.
*
* For wide gamut colorspaces (BG_RGB and BG_YCC), the major version will be
* overridden by jpeg_set_colorspace and set to 2.
*/ */
cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */ cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
cinfo->JFIF_minor_version = 1; cinfo->JFIF_minor_version = 1;
@@ -384,6 +386,9 @@ GLOBAL(void)
jpeg_default_colorspace (j_compress_ptr cinfo) jpeg_default_colorspace (j_compress_ptr cinfo)
{ {
switch (cinfo->in_color_space) { switch (cinfo->in_color_space) {
case JCS_UNKNOWN:
jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
break;
case JCS_GRAYSCALE: case JCS_GRAYSCALE:
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
break; break;
@@ -399,8 +404,12 @@ jpeg_default_colorspace (j_compress_ptr cinfo)
case JCS_YCCK: case JCS_YCCK:
jpeg_set_colorspace(cinfo, JCS_YCCK); jpeg_set_colorspace(cinfo, JCS_YCCK);
break; break;
case JCS_UNKNOWN: case JCS_BG_RGB:
jpeg_set_colorspace(cinfo, JCS_UNKNOWN); /* No translation for now -- conversion to BG_YCC not yet supportet */
jpeg_set_colorspace(cinfo, JCS_BG_RGB);
break;
case JCS_BG_YCC:
jpeg_set_colorspace(cinfo, JCS_BG_YCC);
break; break;
default: default:
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
@@ -441,29 +450,40 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */ cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
switch (colorspace) { switch (colorspace) {
case JCS_UNKNOWN:
cinfo->num_components = cinfo->input_components;
if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
MAX_COMPONENTS);
for (ci = 0; ci < cinfo->num_components; ci++) {
SET_COMP(ci, ci, 1,1, 0, 0,0);
}
break;
case JCS_GRAYSCALE: case JCS_GRAYSCALE:
cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
cinfo->num_components = 1; cinfo->num_components = 1;
/* JFIF specifies component ID 1 */ /* JFIF specifies component ID 1 */
SET_COMP(0, 1, 1,1, 0, 0,0); SET_COMP(0, 0x01, 1,1, 0, 0,0);
break; break;
case JCS_RGB: case JCS_RGB:
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */ cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
cinfo->num_components = 3; cinfo->num_components = 3;
SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0); SET_COMP(0, 0x52 /* 'R' */, 1,1, 0,
SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0,
cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0);
SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);
SET_COMP(2, 0x42 /* 'B' */, 1,1, 0,
cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0, cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0,
cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0); cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0);
SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);
break; break;
case JCS_YCbCr: case JCS_YCbCr:
cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
cinfo->num_components = 3; cinfo->num_components = 3;
/* JFIF specifies component IDs 1,2,3 */ /* JFIF specifies component IDs 1,2,3 */
/* We default to 2x2 subsamples of chrominance */ /* We default to 2x2 subsamples of chrominance */
SET_COMP(0, 1, 2,2, 0, 0,0); SET_COMP(0, 0x01, 2,2, 0, 0,0);
SET_COMP(1, 2, 1,1, 1, 1,1); SET_COMP(1, 0x02, 1,1, 1, 1,1);
SET_COMP(2, 3, 1,1, 1, 1,1); SET_COMP(2, 0x03, 1,1, 1, 1,1);
break; break;
case JCS_CMYK: case JCS_CMYK:
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */ cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
@@ -476,19 +496,33 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
case JCS_YCCK: case JCS_YCCK:
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */ cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
cinfo->num_components = 4; cinfo->num_components = 4;
SET_COMP(0, 1, 2,2, 0, 0,0); SET_COMP(0, 0x01, 2,2, 0, 0,0);
SET_COMP(1, 2, 1,1, 1, 1,1); SET_COMP(1, 0x02, 1,1, 1, 1,1);
SET_COMP(2, 3, 1,1, 1, 1,1); SET_COMP(2, 0x03, 1,1, 1, 1,1);
SET_COMP(3, 4, 2,2, 0, 0,0); SET_COMP(3, 0x04, 2,2, 0, 0,0);
break; break;
case JCS_UNKNOWN: case JCS_BG_RGB:
cinfo->num_components = cinfo->input_components; cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS) cinfo->JFIF_major_version = 2; /* Set JFIF major version = 2 */
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, cinfo->num_components = 3;
MAX_COMPONENTS); /* Add offset 0x20 to the normal R/G/B component IDs */
for (ci = 0; ci < cinfo->num_components; ci++) { SET_COMP(0, 0x72 /* 'r' */, 1,1, 0,
SET_COMP(ci, ci, 1,1, 0, 0,0); cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0,
} cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0);
SET_COMP(1, 0x67 /* 'g' */, 1,1, 0, 0,0);
SET_COMP(2, 0x62 /* 'b' */, 1,1, 0,
cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0,
cinfo->color_transform == JCT_SUBTRACT_GREEN ? 1 : 0);
break;
case JCS_BG_YCC:
cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
cinfo->JFIF_major_version = 2; /* Set JFIF major version = 2 */
cinfo->num_components = 3;
/* Add offset 0x20 to the normal Cb/Cr component IDs */
/* We default to 2x2 subsamples of chrominance */
SET_COMP(0, 0x01, 2,2, 0, 0,0);
SET_COMP(1, 0x22, 1,1, 1, 1,1);
SET_COMP(2, 0x23, 1,1, 1, 1,1);
break; break;
default: default:
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
@@ -572,8 +606,10 @@ jpeg_simple_progression (j_compress_ptr cinfo)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Figure space needed for script. Calculation must match code below! */ /* Figure space needed for script. Calculation must match code below! */
if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { if (ncomps == 3 &&
/* Custom script for YCbCr color images. */ (cinfo->jpeg_color_space == JCS_YCbCr ||
cinfo->jpeg_color_space == JCS_BG_YCC)) {
/* Custom script for YCC color images. */
nscans = 10; nscans = 10;
} else { } else {
/* All-purpose script for other color spaces. */ /* All-purpose script for other color spaces. */
@@ -588,7 +624,7 @@ jpeg_simple_progression (j_compress_ptr cinfo)
* multiple compressions without changing the settings. To avoid a memory * multiple compressions without changing the settings. To avoid a memory
* leak if jpeg_simple_progression is called repeatedly for the same JPEG * leak if jpeg_simple_progression is called repeatedly for the same JPEG
* object, we try to re-use previously allocated space, and we allocate * object, we try to re-use previously allocated space, and we allocate
* enough space to handle YCbCr even if initially asked for grayscale. * enough space to handle YCC even if initially asked for grayscale.
*/ */
if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) { if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) {
cinfo->script_space_size = MAX(nscans, 10); cinfo->script_space_size = MAX(nscans, 10);
@@ -600,8 +636,10 @@ jpeg_simple_progression (j_compress_ptr cinfo)
cinfo->scan_info = scanptr; cinfo->scan_info = scanptr;
cinfo->num_scans = nscans; cinfo->num_scans = nscans;
if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { if (ncomps == 3 &&
/* Custom script for YCbCr color images. */ (cinfo->jpeg_color_space == JCS_YCbCr ||
cinfo->jpeg_color_space == JCS_BG_YCC)) {
/* Custom script for YCC color images. */
/* Initial DC scan */ /* Initial DC scan */
scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
/* Initial AC scan: get some luma data out in a hurry */ /* Initial AC scan: get some luma data out in a hurry */

View File

@@ -2,7 +2,7 @@
* jctrans.c * jctrans.c
* *
* Copyright (C) 1995-1998, Thomas G. Lane. * Copyright (C) 1995-1998, Thomas G. Lane.
* Modified 2000-2012 by Guido Vollbeding. * Modified 2000-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -143,10 +143,10 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
* if the application chooses to copy JFIF 1.02 extension markers from * if the application chooses to copy JFIF 1.02 extension markers from
* the source file, we need to copy the version to make sure we don't * the source file, we need to copy the version to make sure we don't
* emit a file that has 1.02 extensions but a claimed version of 1.01. * emit a file that has 1.02 extensions but a claimed version of 1.01.
* We will *not*, however, copy version info from mislabeled "2.01" files.
*/ */
if (srcinfo->saw_JFIF_marker) { if (srcinfo->saw_JFIF_marker) {
if (srcinfo->JFIF_major_version == 1) { if (srcinfo->JFIF_major_version == 1 ||
srcinfo->JFIF_major_version == 2) {
dstinfo->JFIF_major_version = srcinfo->JFIF_major_version; dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;
dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version; dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
} }

View File

@@ -2,7 +2,7 @@
* jdapimin.c * jdapimin.c
* *
* Copyright (C) 1994-1998, Thomas G. Lane. * Copyright (C) 1994-1998, Thomas G. Lane.
* Modified 2009 by Guido Vollbeding. * Modified 2009-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -114,8 +114,9 @@ jpeg_abort_decompress (j_decompress_ptr cinfo)
LOCAL(void) LOCAL(void)
default_decompress_parms (j_decompress_ptr cinfo) default_decompress_parms (j_decompress_ptr cinfo)
{ {
int cid0, cid1, cid2;
/* Guess the input colorspace, and set output colorspace accordingly. */ /* Guess the input colorspace, and set output colorspace accordingly. */
/* (Wish JPEG committee had provided a real way to specify this...) */
/* Note application may override our guesses. */ /* Note application may override our guesses. */
switch (cinfo->num_components) { switch (cinfo->num_components) {
case 1: case 1:
@@ -124,9 +125,22 @@ default_decompress_parms (j_decompress_ptr cinfo)
break; break;
case 3: case 3:
if (cinfo->saw_JFIF_marker) { cid0 = cinfo->comp_info[0].component_id;
cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ cid1 = cinfo->comp_info[1].component_id;
} else if (cinfo->saw_Adobe_marker) { cid2 = cinfo->comp_info[2].component_id;
/* First try to guess from the component IDs */
if (cid0 == 0x01 && cid1 == 0x02 && cid2 == 0x03)
cinfo->jpeg_color_space = JCS_YCbCr;
else if (cid0 == 0x01 && cid1 == 0x22 && cid2 == 0x23)
cinfo->jpeg_color_space = JCS_BG_YCC;
else if (cid0 == 0x52 && cid1 == 0x47 && cid2 == 0x42)
cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
else if (cid0 == 0x72 && cid1 == 0x67 && cid2 == 0x62)
cinfo->jpeg_color_space = JCS_BG_RGB; /* ASCII 'r', 'g', 'b' */
else if (cinfo->saw_JFIF_marker)
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
else if (cinfo->saw_Adobe_marker) {
switch (cinfo->Adobe_transform) { switch (cinfo->Adobe_transform) {
case 0: case 0:
cinfo->jpeg_color_space = JCS_RGB; cinfo->jpeg_color_space = JCS_RGB;
@@ -136,23 +150,12 @@ default_decompress_parms (j_decompress_ptr cinfo)
break; break;
default: default:
WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
break; break;
} }
} else { } else {
/* Saw no special markers, try to guess from the component IDs */ TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
int cid0 = cinfo->comp_info[0].component_id; cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
int cid1 = cinfo->comp_info[1].component_id;
int cid2 = cinfo->comp_info[2].component_id;
if (cid0 == 1 && cid1 == 2 && cid2 == 3)
cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
else {
TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
}
} }
/* Always guess RGB is proper output colorspace. */ /* Always guess RGB is proper output colorspace. */
cinfo->out_color_space = JCS_RGB; cinfo->out_color_space = JCS_RGB;
@@ -169,7 +172,7 @@ default_decompress_parms (j_decompress_ptr cinfo)
break; break;
default: default:
WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */ cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
break; break;
} }
} else { } else {

View File

@@ -2,6 +2,7 @@
* jdapistd.c * jdapistd.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *

View File

@@ -1,7 +1,7 @@
/* /*
* jdarith.c * jdarith.c
* *
* Developed 1997-2012 by Guido Vollbeding. * Developed 1997-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -94,7 +94,7 @@ get_byte (j_decompress_ptr cinfo)
* (instead of fixed) with the bit shift counter CT. * (instead of fixed) with the bit shift counter CT.
* Thus, we also need only one (variable instead of * Thus, we also need only one (variable instead of
* fixed size) shift for the LPS/MPS decision, and * fixed size) shift for the LPS/MPS decision, and
* we can get away with any renormalization update * we can do away with any renormalization update
* of C (except for new data insertion, of course). * of C (except for new data insertion, of course).
* *
* I've also introduced a new scheme for accessing * I've also introduced a new scheme for accessing
@@ -395,6 +395,8 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* /*
* MCU decoding for DC successive approximation refinement scan. * MCU decoding for DC successive approximation refinement scan.
* Note: we assume such scans can be multi-component,
* although the spec is not very clear on the point.
*/ */
METHODDEF(boolean) METHODDEF(boolean)
@@ -743,6 +745,17 @@ start_pass (j_decompress_ptr cinfo)
} }
/*
* Finish up at the end of an arithmetic-compressed scan.
*/
METHODDEF(void)
finish_pass (j_decompress_ptr cinfo)
{
/* no work necessary here */
}
/* /*
* Module initialization routine for arithmetic entropy decoding. * Module initialization routine for arithmetic entropy decoding.
*/ */
@@ -758,6 +771,7 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
SIZEOF(arith_entropy_decoder)); SIZEOF(arith_entropy_decoder));
cinfo->entropy = &entropy->pub; cinfo->entropy = &entropy->pub;
entropy->pub.start_pass = start_pass; entropy->pub.start_pass = start_pass;
entropy->pub.finish_pass = finish_pass;
/* Mark tables unallocated */ /* Mark tables unallocated */
for (i = 0; i < NUM_ARITH_TBLS; i++) { for (i = 0; i < NUM_ARITH_TBLS; i++) {

View File

@@ -2,7 +2,7 @@
* jdatasrc.c * jdatasrc.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2009-2011 by Guido Vollbeding. * Modified 2009-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -247,7 +247,7 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
GLOBAL(void) GLOBAL(void)
jpeg_mem_src (j_decompress_ptr cinfo, jpeg_mem_src (j_decompress_ptr cinfo,
unsigned char * inbuffer, unsigned long insize) const unsigned char * inbuffer, unsigned long insize)
{ {
struct jpeg_source_mgr * src; struct jpeg_source_mgr * src;
@@ -271,5 +271,5 @@ jpeg_mem_src (j_decompress_ptr cinfo,
src->resync_to_restart = jpeg_resync_to_restart; /* use default method */ src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
src->term_source = term_source; src->term_source = term_source;
src->bytes_in_buffer = (size_t) insize; src->bytes_in_buffer = (size_t) insize;
src->next_input_byte = (JOCTET *) inbuffer; src->next_input_byte = (const JOCTET *) inbuffer;
} }

201
jdcolor.c
View File

@@ -2,7 +2,7 @@
* jdcolor.c * jdcolor.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2011-2012 by Guido Vollbeding. * Modified 2011-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -19,7 +19,7 @@
typedef struct { typedef struct {
struct jpeg_color_deconverter pub; /* public fields */ struct jpeg_color_deconverter pub; /* public fields */
/* Private state for YCC->RGB conversion */ /* Private state for YCbCr->RGB and BG_YCC->RGB conversion */
int * Cr_r_tab; /* => table for Cr to R conversion */ int * Cr_r_tab; /* => table for Cr to R conversion */
int * Cb_b_tab; /* => table for Cb to B conversion */ int * Cb_b_tab; /* => table for Cb to B conversion */
INT32 * Cr_g_tab; /* => table for Cr to G conversion */ INT32 * Cr_g_tab; /* => table for Cr to G conversion */
@@ -32,22 +32,44 @@ typedef struct {
typedef my_color_deconverter * my_cconvert_ptr; typedef my_color_deconverter * my_cconvert_ptr;
/**************** YCbCr -> RGB conversion: most common case **************/ /*************** YCbCr -> RGB conversion: most common case **************/
/**************** RGB -> Y conversion: less common case **************/ /*************** BG_YCC -> RGB conversion: less common case **************/
/*************** RGB -> Y conversion: less common case **************/
/* /*
* YCbCr is defined per CCIR 601-1, except that Cb and Cr are * YCbCr is defined per Recommendation ITU-R BT.601-7 (03/2011),
* normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * previously known as Recommendation CCIR 601-1, except that Cb and Cr
* The conversion equations to be implemented are therefore * are normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
* sRGB (standard RGB color space) is defined per IEC 61966-2-1:1999.
* sYCC (standard luma-chroma-chroma color space with extended gamut)
* is defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex F.
* bg-sRGB and bg-sYCC (big gamut standard color spaces)
* are defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex G.
* Note that the derived conversion coefficients given in some of these
* documents are imprecise. The general conversion equations are
* *
* R = Y + 1.40200 * Cr * R = Y + K * (1 - Kr) * Cr
* G = Y - 0.34414 * Cb - 0.71414 * Cr * G = Y - K * (Kb * (1 - Kb) * Cb + Kr * (1 - Kr) * Cr) / (1 - Kr - Kb)
* B = Y + 1.77200 * Cb * B = Y + K * (1 - Kb) * Cb
* *
* Y = 0.29900 * R + 0.58700 * G + 0.11400 * B * Y = Kr * R + (1 - Kr - Kb) * G + Kb * B
*
* With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993
* from the 1953 FCC NTSC primaries and CIE Illuminant C), K = 2 for sYCC,
* the conversion equations to be implemented are therefore
*
* R = Y + 1.402 * Cr
* G = Y - 0.344136286 * Cb - 0.714136286 * Cr
* B = Y + 1.772 * Cb
*
* Y = 0.299 * R + 0.587 * G + 0.114 * B
* *
* where Cb and Cr represent the incoming values less CENTERJSAMPLE. * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
* (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) * For bg-sYCC, with K = 4, the equations are
*
* R = Y + 2.804 * Cr
* G = Y - 0.688272572 * Cb - 1.428272572 * Cr
* B = Y + 3.544 * Cb
* *
* To avoid floating-point arithmetic, we represent the fractional constants * To avoid floating-point arithmetic, we represent the fractional constants
* as integers scaled up by 2^16 (about 4 digits precision); we have to divide * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
@@ -58,9 +80,9 @@ typedef my_color_deconverter * my_cconvert_ptr;
* For even more speed, we avoid doing any multiplications in the inner loop * For even more speed, we avoid doing any multiplications in the inner loop
* by precalculating the constants times Cb and Cr for all possible values. * by precalculating the constants times Cb and Cr for all possible values.
* For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
* for 12-bit samples it is still acceptable. It's not very reasonable for * for 9-bit to 12-bit samples it is still acceptable. It's not very
* 16-bit samples, but if you want lossless storage you shouldn't be changing * reasonable for 16-bit samples, but if you want lossless storage you
* colorspace anyway. * shouldn't be changing colorspace anyway.
* The Cr=>R and Cb=>B values can be rounded to integers in advance; the * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
* values for the G calculation are left scaled up, since we must add them * values for the G calculation are left scaled up, since we must add them
* together before rounding. * together before rounding.
@@ -84,11 +106,12 @@ typedef my_color_deconverter * my_cconvert_ptr;
/* /*
* Initialize tables for YCC->RGB colorspace conversion. * Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion.
*/ */
LOCAL(void) LOCAL(void)
build_ycc_rgb_table (j_decompress_ptr cinfo) build_ycc_rgb_table (j_decompress_ptr cinfo)
/* Normal case, sYCC */
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
int i; int i;
@@ -111,17 +134,57 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
/* Cr=>R value is nearest int to 1.40200 * x */ /* Cr=>R value is nearest int to 1.402 * x */
cconvert->Cr_r_tab[i] = (int) cconvert->Cr_r_tab[i] = (int)
RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); RIGHT_SHIFT(FIX(1.402) * x + ONE_HALF, SCALEBITS);
/* Cb=>B value is nearest int to 1.77200 * x */ /* Cb=>B value is nearest int to 1.772 * x */
cconvert->Cb_b_tab[i] = (int) cconvert->Cb_b_tab[i] = (int)
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); RIGHT_SHIFT(FIX(1.772) * x + ONE_HALF, SCALEBITS);
/* Cr=>G value is scaled-up -0.71414 * x */ /* Cr=>G value is scaled-up -0.714136286 * x */
cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x; cconvert->Cr_g_tab[i] = (- FIX(0.714136286)) * x;
/* Cb=>G value is scaled-up -0.34414 * x */ /* Cb=>G value is scaled-up -0.344136286 * x */
/* We also add in ONE_HALF so that need not do it in inner loop */ /* We also add in ONE_HALF so that need not do it in inner loop */
cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; cconvert->Cb_g_tab[i] = (- FIX(0.344136286)) * x + ONE_HALF;
}
}
LOCAL(void)
build_bg_ycc_rgb_table (j_decompress_ptr cinfo)
/* Wide gamut case, bg-sYCC */
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
int i;
INT32 x;
SHIFT_TEMPS
cconvert->Cr_r_tab = (int *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(int));
cconvert->Cb_b_tab = (int *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(int));
cconvert->Cr_g_tab = (INT32 *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(INT32));
cconvert->Cb_g_tab = (INT32 *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(INT32));
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
/* Cr=>R value is nearest int to 2.804 * x */
cconvert->Cr_r_tab[i] = (int)
RIGHT_SHIFT(FIX(2.804) * x + ONE_HALF, SCALEBITS);
/* Cb=>B value is nearest int to 3.544 * x */
cconvert->Cb_b_tab[i] = (int)
RIGHT_SHIFT(FIX(3.544) * x + ONE_HALF, SCALEBITS);
/* Cr=>G value is scaled-up -1.428272572 * x */
cconvert->Cr_g_tab[i] = (- FIX(1.428272572)) * x;
/* Cb=>G value is scaled-up -0.688272572 * x */
/* We also add in ONE_HALF so that need not do it in inner loop */
cconvert->Cb_g_tab[i] = (- FIX(0.688272572)) * x + ONE_HALF;
} }
} }
@@ -166,19 +229,21 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
y = GETJSAMPLE(inptr0[col]); y = GETJSAMPLE(inptr0[col]);
cb = GETJSAMPLE(inptr1[col]); cb = GETJSAMPLE(inptr1[col]);
cr = GETJSAMPLE(inptr2[col]); cr = GETJSAMPLE(inptr2[col]);
/* Range-limiting is essential due to noise introduced by DCT losses. */ /* Range-limiting is essential due to noise introduced by DCT losses,
outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; * for extended gamut (sYCC) and wide gamut (bg-sYCC) encodings.
*/
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
outptr[RGB_GREEN] = range_limit[y + outptr[RGB_GREEN] = range_limit[y +
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS))]; SCALEBITS))];
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
} }
} }
} }
/**************** Cases other than YCbCr -> RGB **************/ /**************** Cases other than YCC -> RGB ****************/
/* /*
@@ -198,9 +263,9 @@ build_rgb_y_table (j_decompress_ptr cinfo)
(TABLE_SIZE * SIZEOF(INT32))); (TABLE_SIZE * SIZEOF(INT32)));
for (i = 0; i <= MAXJSAMPLE; i++) { for (i = 0; i <= MAXJSAMPLE; i++) {
rgb_y_tab[i+R_Y_OFF] = FIX(0.29900) * i; rgb_y_tab[i+R_Y_OFF] = FIX(0.299) * i;
rgb_y_tab[i+G_Y_OFF] = FIX(0.58700) * i; rgb_y_tab[i+G_Y_OFF] = FIX(0.587) * i;
rgb_y_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF; rgb_y_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
} }
} }
@@ -244,6 +309,9 @@ rgb_gray_convert (j_decompress_ptr cinfo,
/* /*
* [R-G,G,B-G] to [R,G,B] conversion with modulo calculation * [R-G,G,B-G] to [R,G,B] conversion with modulo calculation
* (inverse color transform). * (inverse color transform).
* This can be seen as an adaption of the general YCbCr->RGB
* conversion equation with Kr = Kb = 0, while replacing the
* normalization by modulo calculation.
*/ */
METHODDEF(void) METHODDEF(void)
@@ -387,7 +455,7 @@ null_convert (j_decompress_ptr cinfo,
/* /*
* Color conversion for grayscale: just copy the data. * Color conversion for grayscale: just copy the data.
* This also works for YCbCr -> grayscale conversion, in which * This also works for YCC -> grayscale conversion, in which
* we just copy the Y (luminance) component and ignore chrominance. * we just copy the Y (luminance) component and ignore chrominance.
*/ */
@@ -466,7 +534,9 @@ ycck_cmyk_convert (j_decompress_ptr cinfo,
y = GETJSAMPLE(inptr0[col]); y = GETJSAMPLE(inptr0[col]);
cb = GETJSAMPLE(inptr1[col]); cb = GETJSAMPLE(inptr1[col]);
cr = GETJSAMPLE(inptr2[col]); cr = GETJSAMPLE(inptr2[col]);
/* Range-limiting is essential due to noise introduced by DCT losses. */ /* Range-limiting is essential due to noise introduced by DCT losses,
* and for extended gamut encodings (sYCC).
*/
outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */ outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */ outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
@@ -516,6 +586,8 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
case JCS_RGB: case JCS_RGB:
case JCS_YCbCr: case JCS_YCbCr:
case JCS_BG_RGB:
case JCS_BG_YCC:
if (cinfo->num_components != 3) if (cinfo->num_components != 3)
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
break; break;
@@ -532,8 +604,10 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
break; break;
} }
/* Support color transform only for RGB colorspace */ /* Support color transform only for RGB colorspaces */
if (cinfo->color_transform && cinfo->jpeg_color_space != JCS_RGB) if (cinfo->color_transform &&
cinfo->jpeg_color_space != JCS_RGB &&
cinfo->jpeg_color_space != JCS_BG_RGB)
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
/* Set out_color_components and conversion method based on requested space. /* Set out_color_components and conversion method based on requested space.
@@ -544,13 +618,16 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_GRAYSCALE: case JCS_GRAYSCALE:
cinfo->out_color_components = 1; cinfo->out_color_components = 1;
if (cinfo->jpeg_color_space == JCS_GRAYSCALE || switch (cinfo->jpeg_color_space) {
cinfo->jpeg_color_space == JCS_YCbCr) { case JCS_GRAYSCALE:
case JCS_YCbCr:
case JCS_BG_YCC:
cconvert->pub.color_convert = grayscale_convert; cconvert->pub.color_convert = grayscale_convert;
/* For color->grayscale conversion, only the Y (0) component is needed */ /* For color->grayscale conversion, only the Y (0) component is needed */
for (ci = 1; ci < cinfo->num_components; ci++) for (ci = 1; ci < cinfo->num_components; ci++)
cinfo->comp_info[ci].component_needed = FALSE; cinfo->comp_info[ci].component_needed = FALSE;
} else if (cinfo->jpeg_color_space == JCS_RGB) { break;
case JCS_RGB:
switch (cinfo->color_transform) { switch (cinfo->color_transform) {
case JCT_NONE: case JCT_NONE:
cconvert->pub.color_convert = rgb_gray_convert; cconvert->pub.color_convert = rgb_gray_convert;
@@ -560,21 +637,29 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
break; break;
default: default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
break;
} }
build_rgb_y_table(cinfo); build_rgb_y_table(cinfo);
} else break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break; break;
case JCS_RGB: case JCS_RGB:
cinfo->out_color_components = RGB_PIXELSIZE; cinfo->out_color_components = RGB_PIXELSIZE;
if (cinfo->jpeg_color_space == JCS_YCbCr) { switch (cinfo->jpeg_color_space) {
case JCS_GRAYSCALE:
cconvert->pub.color_convert = gray_rgb_convert;
break;
case JCS_YCbCr:
cconvert->pub.color_convert = ycc_rgb_convert; cconvert->pub.color_convert = ycc_rgb_convert;
build_ycc_rgb_table(cinfo); build_ycc_rgb_table(cinfo);
} else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { break;
cconvert->pub.color_convert = gray_rgb_convert; case JCS_BG_YCC:
} else if (cinfo->jpeg_color_space == JCS_RGB) { cconvert->pub.color_convert = ycc_rgb_convert;
build_bg_ycc_rgb_table(cinfo);
break;
case JCS_RGB:
switch (cinfo->color_transform) { switch (cinfo->color_transform) {
case JCT_NONE: case JCT_NONE:
cconvert->pub.color_convert = rgb_convert; cconvert->pub.color_convert = rgb_convert;
@@ -584,7 +669,25 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
break; break;
default: default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break;
case JCS_BG_RGB:
cinfo->out_color_components = RGB_PIXELSIZE;
if (cinfo->jpeg_color_space == JCS_BG_RGB) {
switch (cinfo->color_transform) {
case JCT_NONE:
cconvert->pub.color_convert = rgb_convert;
break; break;
case JCT_SUBTRACT_GREEN:
cconvert->pub.color_convert = rgb1_rgb_convert;
break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
} }
} else } else
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
@@ -592,13 +695,17 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
case JCS_CMYK: case JCS_CMYK:
cinfo->out_color_components = 4; cinfo->out_color_components = 4;
if (cinfo->jpeg_color_space == JCS_YCCK) { switch (cinfo->jpeg_color_space) {
case JCS_YCCK:
cconvert->pub.color_convert = ycck_cmyk_convert; cconvert->pub.color_convert = ycck_cmyk_convert;
build_ycc_rgb_table(cinfo); build_ycc_rgb_table(cinfo);
} else if (cinfo->jpeg_color_space == JCS_CMYK) { break;
case JCS_CMYK:
cconvert->pub.color_convert = null_convert; cconvert->pub.color_convert = null_convert;
} else break;
default:
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
}
break; break;
default: default:

32
jdct.h
View File

@@ -2,6 +2,7 @@
* jdct.h * jdct.h
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -78,13 +79,16 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
* be quite far out of range if the input data is corrupt, so a bulletproof * be quite far out of range if the input data is corrupt, so a bulletproof
* range-limiting step is required. We use a mask-and-table-lookup method * range-limiting step is required. We use a mask-and-table-lookup method
* to do the combined operations quickly. See the comments with * to do the combined operations quickly, assuming that MAXJSAMPLE+1
* prepare_range_limit_table (in jdmaster.c) for more info. * is a power of 2. See the comments with prepare_range_limit_table
* (in jdmaster.c) for more info.
*/ */
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE)
#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ #define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
#define RANGE_CENTER (MAXJSAMPLE * 2 + 2)
#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
/* Short forms of external names for systems with brain-damaged linkers. */ /* Short forms of external names for systems with brain-damaged linkers. */
@@ -391,3 +395,23 @@ EXTERN(void) jpeg_idct_1x2
#ifndef MULTIPLY16V16 /* default definition */ #ifndef MULTIPLY16V16 /* default definition */
#define MULTIPLY16V16(var1,var2) ((var1) * (var2)) #define MULTIPLY16V16(var1,var2) ((var1) * (var2))
#endif #endif
/* Like RIGHT_SHIFT, but applies to a DCTELEM.
* We assume that int right shift is unsigned if INT32 right shift is.
*/
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define ISHIFT_TEMPS DCTELEM ishift_temp;
#if BITS_IN_JSAMPLE == 8
#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */
#else
#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */
#endif
#define IRIGHT_SHIFT(x,shft) \
((ishift_temp = (x)) < 0 ? \
(ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
(ishift_temp >> (shft)))
#else
#define ISHIFT_TEMPS
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
#endif

View File

@@ -2,7 +2,7 @@
* jddctmgr.c * jddctmgr.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2010 by Guido Vollbeding. * Modified 2002-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -368,7 +368,7 @@ jinit_inverse_dct (j_decompress_ptr cinfo)
idct = (my_idct_ptr) idct = (my_idct_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_idct_controller)); SIZEOF(my_idct_controller));
cinfo->idct = (struct jpeg_inverse_dct *) idct; cinfo->idct = &idct->pub;
idct->pub.start_pass = start_pass; idct->pub.start_pass = start_pass;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;

View File

@@ -2,7 +2,7 @@
* jdhuff.c * jdhuff.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2006-2012 by Guido Vollbeding. * Modified 2006-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -627,6 +627,22 @@ jpeg_huff_decode (bitread_working_state * state,
} }
/*
* Finish up at the end of a Huffman-compressed scan.
*/
METHODDEF(void)
finish_pass_huff (j_decompress_ptr cinfo)
{
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
/* Throw away any unused bits remaining in bit buffer; */
/* include any full bytes in next_marker's count of discarded bytes */
cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
entropy->bitstate.bits_left = 0;
}
/* /*
* Check for a restart marker & resynchronize decoder. * Check for a restart marker & resynchronize decoder.
* Returns FALSE if must suspend. * Returns FALSE if must suspend.
@@ -638,10 +654,7 @@ process_restart (j_decompress_ptr cinfo)
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
int ci; int ci;
/* Throw away any unused bits remaining in bit buffer; */ finish_pass_huff(cinfo);
/* include any full bytes in next_marker's count of discarded bytes */
cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
entropy->bitstate.bits_left = 0;
/* Advance past the RSTn marker */ /* Advance past the RSTn marker */
if (! (*cinfo->marker->read_restart_marker) (cinfo)) if (! (*cinfo->marker->read_restart_marker) (cinfo))
@@ -846,17 +859,15 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* /*
* MCU decoding for DC successive approximation refinement scan. * MCU decoding for DC successive approximation refinement scan.
* Note: we assume such scans can be multi-component, although the spec * Note: we assume such scans can be multi-component,
* is not very clear on the point. * although the spec is not very clear on the point.
*/ */
METHODDEF(boolean) METHODDEF(boolean)
decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ int p1, blkn;
int blkn;
JBLOCKROW block;
BITREAD_STATE_VARS; BITREAD_STATE_VARS;
/* Process restart marker if needed; may have to suspend */ /* Process restart marker if needed; may have to suspend */
@@ -873,15 +884,15 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Load up working state */ /* Load up working state */
BITREAD_LOAD_STATE(cinfo,entropy->bitstate); BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
/* Outer loop handles each block in the MCU */ /* Outer loop handles each block in the MCU */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
block = MCU_data[blkn];
/* Encoded data is simply the next bit of the two's-complement DC value */ /* Encoded data is simply the next bit of the two's-complement DC value */
CHECK_BIT_BUFFER(br_state, 1, return FALSE); CHECK_BIT_BUFFER(br_state, 1, return FALSE);
if (GET_BITS(1)) if (GET_BITS(1))
(*block)[0] |= p1; MCU_data[blkn][0][0] |= p1;
/* Note: since we use |=, repeating the assignment later is safe */ /* Note: since we use |=, repeating the assignment later is safe */
} }
@@ -1517,6 +1528,7 @@ jinit_huff_decoder (j_decompress_ptr cinfo)
SIZEOF(huff_entropy_decoder)); SIZEOF(huff_entropy_decoder));
cinfo->entropy = &entropy->pub; cinfo->entropy = &entropy->pub;
entropy->pub.start_pass = start_pass_huff_decoder; entropy->pub.start_pass = start_pass_huff_decoder;
entropy->pub.finish_pass = finish_pass_huff;
if (cinfo->progressive_mode) { if (cinfo->progressive_mode) {
/* Create progression status table */ /* Create progression status table */

View File

@@ -2,7 +2,7 @@
* jdinput.c * jdinput.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2002-2009 by Guido Vollbeding. * Modified 2002-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -196,7 +196,7 @@ jpeg_core_output_dimensions (j_decompress_ptr cinfo)
/* Hardwire it to "no scaling" */ /* Hardwire it to "no scaling" */
cinfo->output_width = cinfo->image_width; cinfo->output_width = cinfo->image_width;
cinfo->output_height = cinfo->image_height; cinfo->output_height = cinfo->image_height;
/* jdinput.c has already initialized DCT_scaled_size, /* initial_setup has already initialized DCT_scaled_size,
* and has computed unscaled downsampled_width and downsampled_height. * and has computed unscaled downsampled_width and downsampled_height.
*/ */
@@ -216,8 +216,8 @@ initial_setup (j_decompress_ptr cinfo)
(long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
/* For now, precision must match compiled-in value... */ /* Only 8 to 12 bits data precision are supported for DCT based JPEG */
if (cinfo->data_precision != BITS_IN_JSAMPLE) if (cinfo->data_precision < 8 || cinfo->data_precision > 12)
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
/* Check that number of components won't exceed internal array sizes */ /* Check that number of components won't exceed internal array sizes */
@@ -537,6 +537,7 @@ start_input_pass (j_decompress_ptr cinfo)
METHODDEF(void) METHODDEF(void)
finish_input_pass (j_decompress_ptr cinfo) finish_input_pass (j_decompress_ptr cinfo)
{ {
(*cinfo->entropy->finish_pass) (cinfo);
cinfo->inputctl->consume_input = consume_markers; cinfo->inputctl->consume_input = consume_markers;
} }
@@ -646,7 +647,7 @@ jinit_input_controller (j_decompress_ptr cinfo)
inputctl = (my_inputctl_ptr) inputctl = (my_inputctl_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
SIZEOF(my_input_controller)); SIZEOF(my_input_controller));
cinfo->inputctl = (struct jpeg_input_controller *) inputctl; cinfo->inputctl = &inputctl->pub;
/* Initialize method pointers */ /* Initialize method pointers */
inputctl->pub.consume_input = consume_markers; inputctl->pub.consume_input = consume_markers;
inputctl->pub.reset_input_controller = reset_input_controller; inputctl->pub.reset_input_controller = reset_input_controller;

View File

@@ -2,7 +2,7 @@
* jdmarker.c * jdmarker.c
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2009-2012 by Guido Vollbeding. * Modified 2009-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -269,8 +269,8 @@ get_sof (j_decompress_ptr cinfo, boolean is_baseline, boolean is_prog,
/* We don't support files in which the image height is initially specified */ /* We don't support files in which the image height is initially specified */
/* as 0 and is later redefined by DNL. As long as we have to check that, */ /* as 0 and is later redefined by DNL. As long as we have to check that, */
/* might as well have a general sanity check. */ /* might as well have a general sanity check. */
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|| cinfo->num_components <= 0) cinfo->num_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE); ERREXIT(cinfo, JERR_EMPTY_IMAGE);
if (length != (cinfo->num_components * 3)) if (length != (cinfo->num_components * 3))
@@ -350,6 +350,9 @@ get_sos (j_decompress_ptr cinfo)
/* Detect the case where component id's are not unique, and, if so, */ /* Detect the case where component id's are not unique, and, if so, */
/* create a fake component id using the same logic as in get_sof. */ /* create a fake component id using the same logic as in get_sof. */
/* Note: This also ensures that all of the SOF components are */
/* referenced in the single scan case, which prevents access to */
/* uninitialized memory in later decoding stages. */
for (ci = 0; ci < i; ci++) { for (ci = 0; ci < i; ci++) {
if (c == cinfo->cur_comp_info[ci]->component_id) { if (c == cinfo->cur_comp_info[ci]->component_id) {
c = cinfo->cur_comp_info[0]->component_id; c = cinfo->cur_comp_info[0]->component_id;
@@ -493,6 +496,8 @@ get_dht (j_decompress_ptr cinfo)
if (count > 256 || ((INT32) count) > length) if (count > 256 || ((INT32) count) > length)
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
MEMZERO(huffval, SIZEOF(huffval)); /* pre-zero array for later copy */
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
INPUT_BYTE(cinfo, huffval[i], return FALSE); INPUT_BYTE(cinfo, huffval[i], return FALSE);
@@ -735,12 +740,13 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]); cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]);
cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]); cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]);
/* Check version. /* Check version.
* Major version must be 1, anything else signals an incompatible change. * Major version must be 1 or 2, anything else signals an incompatible
* change.
* (We used to treat this as an error, but now it's a nonfatal warning, * (We used to treat this as an error, but now it's a nonfatal warning,
* because some bozo at Hijaak couldn't read the spec.) * because some bozo at Hijaak couldn't read the spec.)
* Minor version should be 0..2, but process anyway if newer. * Minor version should be 0..2, but process anyway if newer.
*/ */
if (cinfo->JFIF_major_version != 1) if (cinfo->JFIF_major_version != 1 && cinfo->JFIF_major_version != 2)
WARNMS2(cinfo, JWRN_JFIF_MAJOR, WARNMS2(cinfo, JWRN_JFIF_MAJOR,
cinfo->JFIF_major_version, cinfo->JFIF_minor_version); cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
/* Generate trace messages */ /* Generate trace messages */

View File

@@ -2,7 +2,7 @@
* jdmaster.c * jdmaster.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2002-2011 by Guido Vollbeding. * Modified 2002-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -45,13 +45,26 @@ LOCAL(boolean)
use_merged_upsample (j_decompress_ptr cinfo) use_merged_upsample (j_decompress_ptr cinfo)
{ {
#ifdef UPSAMPLE_MERGING_SUPPORTED #ifdef UPSAMPLE_MERGING_SUPPORTED
/* Merging is the equivalent of plain box-filter upsampling */ /* Merging is the equivalent of plain box-filter upsampling. */
if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) /* The following condition is only needed if fancy shall select
* a different upsampling method. In our current implementation
* fancy only affects the DCT scaling, thus we can use fancy
* upsampling and merged upsample simultaneously, in particular
* with scaled DCT sizes larger than the default DCTSIZE.
*/
#if 0
if (cinfo->do_fancy_upsampling)
return FALSE;
#endif
if (cinfo->CCIR601_sampling)
return FALSE; return FALSE;
/* jdmerge.c only supports YCC=>RGB color conversion */ /* jdmerge.c only supports YCC=>RGB color conversion */
if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || if ((cinfo->jpeg_color_space != JCS_YCbCr &&
cinfo->jpeg_color_space != JCS_BG_YCC) ||
cinfo->num_components != 3 ||
cinfo->out_color_space != JCS_RGB || cinfo->out_color_space != JCS_RGB ||
cinfo->out_color_components != RGB_PIXELSIZE) cinfo->out_color_components != RGB_PIXELSIZE ||
cinfo->color_transform)
return FALSE; return FALSE;
/* and it only handles 2h1v or 2h2v sampling ratios */ /* and it only handles 2h1v or 2h2v sampling ratios */
if (cinfo->comp_info[0].h_samp_factor != 2 || if (cinfo->comp_info[0].h_samp_factor != 2 ||
@@ -158,9 +171,11 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
cinfo->out_color_components = 1; cinfo->out_color_components = 1;
break; break;
case JCS_RGB: case JCS_RGB:
case JCS_BG_RGB:
cinfo->out_color_components = RGB_PIXELSIZE; cinfo->out_color_components = RGB_PIXELSIZE;
break; break;
case JCS_YCbCr: case JCS_YCbCr:
case JCS_BG_YCC:
cinfo->out_color_components = 3; cinfo->out_color_components = 3;
break; break;
case JCS_CMYK: case JCS_CMYK:
@@ -196,30 +211,20 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
* These processes all use a common table prepared by the routine below. * These processes all use a common table prepared by the routine below.
* *
* For most steps we can mathematically guarantee that the initial value * For most steps we can mathematically guarantee that the initial value
* of x is within MAXJSAMPLE+1 of the legal range, so a table running from * of x is within 2*(MAXJSAMPLE+1) of the legal range, so a table running
* -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial * from -2*(MAXJSAMPLE+1) to 3*MAXJSAMPLE+2 is sufficient. But for the
* limiting step (just after the IDCT), a wildly out-of-range value is * initial limiting step (just after the IDCT), a wildly out-of-range value
* possible if the input data is corrupt. To avoid any chance of indexing * is possible if the input data is corrupt. To avoid any chance of indexing
* off the end of memory and getting a bad-pointer trap, we perform the * off the end of memory and getting a bad-pointer trap, we perform the
* post-IDCT limiting thus: * post-IDCT limiting thus:
* x = range_limit[x & MASK]; * x = (sample_range_limit - SUBSET)[(x + CENTER) & MASK];
* where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit
* samples. Under normal circumstances this is more than enough range and * samples. Under normal circumstances this is more than enough range and
* a correct output will be generated; with bogus input data the mask will * a correct output will be generated; with bogus input data the mask will
* cause wraparound, and we will safely generate a bogus-but-in-range output. * cause wraparound, and we will safely generate a bogus-but-in-range output.
* For the post-IDCT step, we want to convert the data from signed to unsigned * For the post-IDCT step, we want to convert the data from signed to unsigned
* representation by adding CENTERJSAMPLE at the same time that we limit it. * representation by adding CENTERJSAMPLE at the same time that we limit it.
* So the post-IDCT limiting table ends up looking like this: * This is accomplished with SUBSET = CENTER - CENTERJSAMPLE.
* CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE,
* MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
* 0 (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
* 0,1,...,CENTERJSAMPLE-1
* Negative inputs select values from the upper half of the table after
* masking.
*
* We can save some space by overlapping the start of the post-IDCT table
* with the simpler range limiting table. The post-IDCT table begins at
* sample_range_limit + CENTERJSAMPLE.
* *
* Note that the table is allocated in near data space on PCs; it's small * Note that the table is allocated in near data space on PCs; it's small
* enough and used often enough to justify this. * enough and used often enough to justify this.
@@ -234,23 +239,17 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
table = (JSAMPLE *) table = (JSAMPLE *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); 5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ /* First segment of range limit table: limit[x] = 0 for x < 0 */
MEMZERO(table, 2 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
table += 2 * (MAXJSAMPLE+1); /* allow negative subscripts of table */
cinfo->sample_range_limit = table; cinfo->sample_range_limit = table;
/* First segment of "simple" table: limit[x] = 0 for x < 0 */ /* Main part of range limit table: limit[x] = x */
MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
/* Main part of "simple" table: limit[x] = x */
for (i = 0; i <= MAXJSAMPLE; i++) for (i = 0; i <= MAXJSAMPLE; i++)
table[i] = (JSAMPLE) i; table[i] = (JSAMPLE) i;
table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ /* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
/* End of simple table, rest of first half of post-IDCT table */ for (; i < 3 * (MAXJSAMPLE+1); i++)
for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
table[i] = MAXJSAMPLE; table[i] = MAXJSAMPLE;
/* Second half of post-IDCT table */
MEMZERO(table + (2 * (MAXJSAMPLE+1)),
(2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE));
MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE));
} }
@@ -273,10 +272,19 @@ master_selection (j_decompress_ptr cinfo)
long samplesperrow; long samplesperrow;
JDIMENSION jd_samplesperrow; JDIMENSION jd_samplesperrow;
/* For now, precision must match compiled-in value... */
if (cinfo->data_precision != BITS_IN_JSAMPLE)
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
/* Initialize dimensions and other stuff */ /* Initialize dimensions and other stuff */
jpeg_calc_output_dimensions(cinfo); jpeg_calc_output_dimensions(cinfo);
prepare_range_limit_table(cinfo); prepare_range_limit_table(cinfo);
/* Sanity check on image dimensions */
if (cinfo->output_height <= 0 || cinfo->output_width <= 0 ||
cinfo->out_color_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
/* Width of an output scanline must be representable as JDIMENSION. */ /* Width of an output scanline must be representable as JDIMENSION. */
samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components;
jd_samplesperrow = (JDIMENSION) samplesperrow; jd_samplesperrow = (JDIMENSION) samplesperrow;
@@ -521,7 +529,7 @@ jinit_master_decompress (j_decompress_ptr cinfo)
master = (my_master_ptr) master = (my_master_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_decomp_master)); SIZEOF(my_decomp_master));
cinfo->master = (struct jpeg_decomp_master *) master; cinfo->master = &master->pub;
master->pub.prepare_for_output_pass = prepare_for_output_pass; master->pub.prepare_for_output_pass = prepare_for_output_pass;
master->pub.finish_output_pass = finish_output_pass; master->pub.finish_output_pass = finish_output_pass;

121
jdmerge.c
View File

@@ -2,6 +2,7 @@
* jdmerge.c * jdmerge.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2013-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -23,7 +24,7 @@
* multiplications needed for color conversion. * multiplications needed for color conversion.
* *
* This file currently provides implementations for the following cases: * This file currently provides implementations for the following cases:
* YCbCr => RGB color conversion only. * YCC => RGB color conversion only (YCbCr or BG_YCC).
* Sampling ratios of 2h1v or 2h2v. * Sampling ratios of 2h1v or 2h2v.
* No scaling needed at upsample time. * No scaling needed at upsample time.
* Corner-aligned (non-CCIR601) sampling alignment. * Corner-aligned (non-CCIR601) sampling alignment.
@@ -75,12 +76,13 @@ typedef my_upsampler * my_upsample_ptr;
/* /*
* Initialize tables for YCC->RGB colorspace conversion. * Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion.
* This is taken directly from jdcolor.c; see that file for more info. * This is taken directly from jdcolor.c; see that file for more info.
*/ */
LOCAL(void) LOCAL(void)
build_ycc_rgb_table (j_decompress_ptr cinfo) build_ycc_rgb_table (j_decompress_ptr cinfo)
/* Normal case, sYCC */
{ {
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int i; int i;
@@ -103,17 +105,57 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
/* Cr=>R value is nearest int to 1.40200 * x */ /* Cr=>R value is nearest int to 1.402 * x */
upsample->Cr_r_tab[i] = (int) upsample->Cr_r_tab[i] = (int)
RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); RIGHT_SHIFT(FIX(1.402) * x + ONE_HALF, SCALEBITS);
/* Cb=>B value is nearest int to 1.77200 * x */ /* Cb=>B value is nearest int to 1.772 * x */
upsample->Cb_b_tab[i] = (int) upsample->Cb_b_tab[i] = (int)
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); RIGHT_SHIFT(FIX(1.772) * x + ONE_HALF, SCALEBITS);
/* Cr=>G value is scaled-up -0.71414 * x */ /* Cr=>G value is scaled-up -0.714136286 * x */
upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x; upsample->Cr_g_tab[i] = (- FIX(0.714136286)) * x;
/* Cb=>G value is scaled-up -0.34414 * x */ /* Cb=>G value is scaled-up -0.344136286 * x */
/* We also add in ONE_HALF so that need not do it in inner loop */ /* We also add in ONE_HALF so that need not do it in inner loop */
upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; upsample->Cb_g_tab[i] = (- FIX(0.344136286)) * x + ONE_HALF;
}
}
LOCAL(void)
build_bg_ycc_rgb_table (j_decompress_ptr cinfo)
/* Wide gamut case, bg-sYCC */
{
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int i;
INT32 x;
SHIFT_TEMPS
upsample->Cr_r_tab = (int *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(int));
upsample->Cb_b_tab = (int *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(int));
upsample->Cr_g_tab = (INT32 *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(INT32));
upsample->Cb_g_tab = (INT32 *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(INT32));
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
/* Cr=>R value is nearest int to 2.804 * x */
upsample->Cr_r_tab[i] = (int)
RIGHT_SHIFT(FIX(2.804) * x + ONE_HALF, SCALEBITS);
/* Cb=>B value is nearest int to 3.544 * x */
upsample->Cb_b_tab[i] = (int)
RIGHT_SHIFT(FIX(3.544) * x + ONE_HALF, SCALEBITS);
/* Cr=>G value is scaled-up -1.428272572 * x */
upsample->Cr_g_tab[i] = (- FIX(1.428272572)) * x;
/* Cb=>G value is scaled-up -0.688272572 * x */
/* We also add in ONE_HALF so that need not do it in inner loop */
upsample->Cb_g_tab[i] = (- FIX(0.688272572)) * x + ONE_HALF;
} }
} }
@@ -250,32 +292,32 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
/* Do the chroma part of the calculation */ /* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++); cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++); cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr]; cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb]; cblue = Cbbtab[cb];
/* Fetch 2 Y values and emit 2 pixels */ /* Fetch 2 Y values and emit 2 pixels */
y = GETJSAMPLE(*inptr0++); y = GETJSAMPLE(*inptr0++);
outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_RED] = range_limit[y + cred];
outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue]; outptr[RGB_BLUE] = range_limit[y + cblue];
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr0++); y = GETJSAMPLE(*inptr0++);
outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_RED] = range_limit[y + cred];
outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue]; outptr[RGB_BLUE] = range_limit[y + cblue];
outptr += RGB_PIXELSIZE; outptr += RGB_PIXELSIZE;
} }
/* If image width is odd, do the last output column separately */ /* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) { if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1); cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2); cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr]; cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb]; cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0); y = GETJSAMPLE(*inptr0);
outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_RED] = range_limit[y + cred];
outptr[RGB_GREEN] = range_limit[y + cgreen]; outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue]; outptr[RGB_BLUE] = range_limit[y + cblue];
} }
} }
@@ -314,46 +356,46 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
/* Do the chroma part of the calculation */ /* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++); cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++); cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr]; cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb]; cblue = Cbbtab[cb];
/* Fetch 4 Y values and emit 4 pixels */ /* Fetch 4 Y values and emit 4 pixels */
y = GETJSAMPLE(*inptr00++); y = GETJSAMPLE(*inptr00++);
outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0[RGB_BLUE] = range_limit[y + cblue];
outptr0 += RGB_PIXELSIZE; outptr0 += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr00++); y = GETJSAMPLE(*inptr00++);
outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0[RGB_BLUE] = range_limit[y + cblue];
outptr0 += RGB_PIXELSIZE; outptr0 += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr01++); y = GETJSAMPLE(*inptr01++);
outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
outptr1 += RGB_PIXELSIZE; outptr1 += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr01++); y = GETJSAMPLE(*inptr01++);
outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
outptr1 += RGB_PIXELSIZE; outptr1 += RGB_PIXELSIZE;
} }
/* If image width is odd, do the last output column separately */ /* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) { if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1); cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2); cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr]; cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb]; cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr00); y = GETJSAMPLE(*inptr00);
outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0[RGB_BLUE] = range_limit[y + cblue];
y = GETJSAMPLE(*inptr01); y = GETJSAMPLE(*inptr01);
outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
} }
} }
@@ -374,7 +416,7 @@ jinit_merged_upsampler (j_decompress_ptr cinfo)
upsample = (my_upsample_ptr) upsample = (my_upsample_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_upsampler)); SIZEOF(my_upsampler));
cinfo->upsample = (struct jpeg_upsampler *) upsample; cinfo->upsample = &upsample->pub;
upsample->pub.start_pass = start_pass_merged_upsample; upsample->pub.start_pass = start_pass_merged_upsample;
upsample->pub.need_context_rows = FALSE; upsample->pub.need_context_rows = FALSE;
@@ -394,7 +436,10 @@ jinit_merged_upsampler (j_decompress_ptr cinfo)
upsample->spare_row = NULL; upsample->spare_row = NULL;
} }
build_ycc_rgb_table(cinfo); if (cinfo->jpeg_color_space == JCS_BG_YCC)
build_bg_ycc_rgb_table(cinfo);
else
build_ycc_rgb_table(cinfo);
} }
#endif /* UPSAMPLE_MERGING_SUPPORTED */ #endif /* UPSAMPLE_MERGING_SUPPORTED */

View File

@@ -2,7 +2,7 @@
* jdsample.c * jdsample.c
* *
* Copyright (C) 1991-1996, Thomas G. Lane. * Copyright (C) 1991-1996, Thomas G. Lane.
* Modified 2002-2008 by Guido Vollbeding. * Modified 2002-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -296,13 +296,12 @@ jinit_upsampler (j_decompress_ptr cinfo)
my_upsample_ptr upsample; my_upsample_ptr upsample;
int ci; int ci;
jpeg_component_info * compptr; jpeg_component_info * compptr;
boolean need_buffer;
int h_in_group, v_in_group, h_out_group, v_out_group; int h_in_group, v_in_group, h_out_group, v_out_group;
upsample = (my_upsample_ptr) upsample = (my_upsample_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_upsampler)); SIZEOF(my_upsampler));
cinfo->upsample = (struct jpeg_upsampler *) upsample; cinfo->upsample = &upsample->pub;
upsample->pub.start_pass = start_pass_upsample; upsample->pub.start_pass = start_pass_upsample;
upsample->pub.upsample = sep_upsample; upsample->pub.upsample = sep_upsample;
upsample->pub.need_context_rows = FALSE; /* until we find out differently */ upsample->pub.need_context_rows = FALSE; /* until we find out differently */
@@ -325,17 +324,17 @@ jinit_upsampler (j_decompress_ptr cinfo)
h_out_group = cinfo->max_h_samp_factor; h_out_group = cinfo->max_h_samp_factor;
v_out_group = cinfo->max_v_samp_factor; v_out_group = cinfo->max_v_samp_factor;
upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
need_buffer = TRUE;
if (! compptr->component_needed) { if (! compptr->component_needed) {
/* Don't bother to upsample an uninteresting component. */ /* Don't bother to upsample an uninteresting component. */
upsample->methods[ci] = noop_upsample; upsample->methods[ci] = noop_upsample;
need_buffer = FALSE; continue; /* don't need to allocate buffer */
} else if (h_in_group == h_out_group && v_in_group == v_out_group) { }
if (h_in_group == h_out_group && v_in_group == v_out_group) {
/* Fullsize components can be processed without any work. */ /* Fullsize components can be processed without any work. */
upsample->methods[ci] = fullsize_upsample; upsample->methods[ci] = fullsize_upsample;
need_buffer = FALSE; continue; /* don't need to allocate buffer */
} else if (h_in_group * 2 == h_out_group && }
v_in_group == v_out_group) { if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
/* Special case for 2h1v upsampling */ /* Special case for 2h1v upsampling */
upsample->methods[ci] = h2v1_upsample; upsample->methods[ci] = h2v1_upsample;
} else if (h_in_group * 2 == h_out_group && } else if (h_in_group * 2 == h_out_group &&
@@ -350,12 +349,10 @@ jinit_upsampler (j_decompress_ptr cinfo)
upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group);
} else } else
ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
if (need_buffer) { upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE,
((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) jround_up((long) cinfo->output_width,
(JDIMENSION) jround_up((long) cinfo->output_width, (long) cinfo->max_h_samp_factor),
(long) cinfo->max_h_samp_factor), (JDIMENSION) cinfo->max_v_samp_factor);
(JDIMENSION) cinfo->max_v_samp_factor);
}
} }
} }

View File

@@ -2,7 +2,7 @@
* jerror.c * jerror.c
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2012 by Guido Vollbeding. * Modified 2012-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -19,16 +19,16 @@
* These routines are used by both the compression and decompression code. * These routines are used by both the compression and decompression code.
*/ */
#ifdef USE_WINDOWS_MESSAGEBOX
#include <windows.h>
#endif
/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jversion.h" #include "jversion.h"
#include "jerror.h" #include "jerror.h"
#ifdef USE_WINDOWS_MESSAGEBOX
#include <windows.h>
#endif
#ifndef EXIT_FAILURE /* define exit() codes if not provided */ #ifndef EXIT_FAILURE /* define exit() codes if not provided */
#define EXIT_FAILURE 1 #define EXIT_FAILURE 1
#endif #endif

View File

@@ -2,7 +2,7 @@
* jfdctflt.c * jfdctflt.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2003-2009 by Guido Vollbeding. * Modified 2003-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -54,6 +54,8 @@
/* /*
* Perform the forward DCT on one block of samples. * Perform the forward DCT on one block of samples.
*
* cK represents cos(K*pi/16).
*/ */
GLOBAL(void) GLOBAL(void)
@@ -89,7 +91,7 @@ jpeg_fdct_float (FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
/* Apply unsigned->signed conversion */ /* Apply unsigned->signed conversion. */
dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */ dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */
dataptr[4] = tmp10 - tmp11; dataptr[4] = tmp10 - tmp11;

View File

@@ -2,7 +2,7 @@
* jfdctfst.c * jfdctfst.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2003-2009 by Guido Vollbeding. * Modified 2003-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -109,6 +109,8 @@
/* /*
* Perform the forward DCT on one block of samples. * Perform the forward DCT on one block of samples.
*
* cK represents cos(K*pi/16).
*/ */
GLOBAL(void) GLOBAL(void)
@@ -145,7 +147,7 @@ jpeg_fdct_ifast (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
/* Apply unsigned->signed conversion */ /* Apply unsigned->signed conversion. */
dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */ dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */
dataptr[4] = tmp10 - tmp11; dataptr[4] = tmp10 - tmp11;

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* jidctflt.c * jidctflt.c
* *
* Copyright (C) 1994-1998, Thomas G. Lane. * Copyright (C) 1994-1998, Thomas G. Lane.
* Modified 2010 by Guido Vollbeding. * Modified 2010-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -63,6 +63,8 @@
/* /*
* Perform dequantization and inverse DCT on one block of coefficients. * Perform dequantization and inverse DCT on one block of coefficients.
*
* cK represents cos(K*pi/16).
*/ */
GLOBAL(void) GLOBAL(void)
@@ -77,7 +79,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
FLOAT_MULT_TYPE * quantptr; FLOAT_MULT_TYPE * quantptr;
FAST_FLOAT * wsptr; FAST_FLOAT * wsptr;
JSAMPROW outptr; JSAMPROW outptr;
JSAMPLE *range_limit = cinfo->sample_range_limit; JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr; int ctr;
FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */ FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */
@@ -95,14 +97,14 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* With typical images and quantization tables, half or more of the * With typical images and quantization tables, half or more of the
* column DCT calculations can be simplified this way. * column DCT calculations can be simplified this way.
*/ */
if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
inptr[DCTSIZE*7] == 0) { inptr[DCTSIZE*7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*1] = dcval;
wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*2] = dcval;
@@ -111,13 +113,13 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*5] = dcval;
wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*6] = dcval;
wsptr[DCTSIZE*7] = dcval; wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */ inptr++; /* advance pointers to next column */
quantptr++; quantptr++;
wsptr++; wsptr++;
continue; continue;
} }
/* Even part */ /* Even part */
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
@@ -135,7 +137,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12; tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12; tmp2 = tmp11 - tmp12;
/* Odd part */ /* Odd part */
tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
@@ -172,7 +174,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
quantptr++; quantptr++;
wsptr++; wsptr++;
} }
/* Pass 2: process rows from work array, store into output array. */ /* Pass 2: process rows from work array, store into output array. */
wsptr = workspace; wsptr = workspace;
@@ -183,16 +185,17 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* the simplification applies less often (typically 5% to 10% of the time). * the simplification applies less often (typically 5% to 10% of the time).
* And testing floats for zero is relatively expensive, so we don't bother. * And testing floats for zero is relatively expensive, so we don't bother.
*/ */
/* Even part */ /* Even part */
/* Apply signed->unsigned and prepare float->int conversion */ /* Prepare range-limit and float->int conversion */
z5 = wsptr[0] + ((FAST_FLOAT) CENTERJSAMPLE + (FAST_FLOAT) 0.5); z5 = wsptr[0] + (((FAST_FLOAT) RANGE_CENTER) + ((FAST_FLOAT) 0.5));
tmp10 = z5 + wsptr[4]; tmp10 = z5 + wsptr[4];
tmp11 = z5 - wsptr[4]; tmp11 = z5 - wsptr[4];
tmp13 = wsptr[2] + wsptr[6]; tmp13 = wsptr[2] + wsptr[6];
tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13; tmp12 = (wsptr[2] - wsptr[6]) *
((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */
tmp0 = tmp10 + tmp13; tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
@@ -206,28 +209,28 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
z11 = wsptr[1] + wsptr[7]; z11 = wsptr[1] + wsptr[7];
z12 = wsptr[1] - wsptr[7]; z12 = wsptr[1] - wsptr[7];
tmp7 = z11 + z13; tmp7 = z11 + z13; /* phase 5 */
tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */
z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */ tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */
tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */ tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */
tmp6 = tmp12 - tmp7; tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6; tmp5 = tmp11 - tmp6;
tmp4 = tmp10 - tmp5; tmp4 = tmp10 - tmp5;
/* Final output stage: float->int conversion and range-limit */ /* Final output stage: float->int conversion and range-limit */
outptr[0] = range_limit[((int) (tmp0 + tmp7)) & RANGE_MASK]; outptr[0] = range_limit[(int) (tmp0 + tmp7) & RANGE_MASK];
outptr[7] = range_limit[((int) (tmp0 - tmp7)) & RANGE_MASK]; outptr[7] = range_limit[(int) (tmp0 - tmp7) & RANGE_MASK];
outptr[1] = range_limit[((int) (tmp1 + tmp6)) & RANGE_MASK]; outptr[1] = range_limit[(int) (tmp1 + tmp6) & RANGE_MASK];
outptr[6] = range_limit[((int) (tmp1 - tmp6)) & RANGE_MASK]; outptr[6] = range_limit[(int) (tmp1 - tmp6) & RANGE_MASK];
outptr[2] = range_limit[((int) (tmp2 + tmp5)) & RANGE_MASK]; outptr[2] = range_limit[(int) (tmp2 + tmp5) & RANGE_MASK];
outptr[5] = range_limit[((int) (tmp2 - tmp5)) & RANGE_MASK]; outptr[5] = range_limit[(int) (tmp2 - tmp5) & RANGE_MASK];
outptr[3] = range_limit[((int) (tmp3 + tmp4)) & RANGE_MASK]; outptr[3] = range_limit[(int) (tmp3 + tmp4) & RANGE_MASK];
outptr[4] = range_limit[((int) (tmp3 - tmp4)) & RANGE_MASK]; outptr[4] = range_limit[(int) (tmp3 - tmp4) & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
} }

View File

@@ -2,6 +2,7 @@
* jidctfst.c * jidctfst.c
* *
* Copyright (C) 1994-1998, Thomas G. Lane. * Copyright (C) 1994-1998, Thomas G. Lane.
* Modified 2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -133,35 +134,10 @@
#endif #endif
/* Like DESCALE, but applies to a DCTELEM and produces an int.
* We assume that int right shift is unsigned if INT32 right shift is.
*/
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define ISHIFT_TEMPS DCTELEM ishift_temp;
#if BITS_IN_JSAMPLE == 8
#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */
#else
#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */
#endif
#define IRIGHT_SHIFT(x,shft) \
((ishift_temp = (x)) < 0 ? \
(ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
(ishift_temp >> (shft)))
#else
#define ISHIFT_TEMPS
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
#endif
#ifdef USE_ACCURATE_ROUNDING
#define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n))
#else
#define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n))
#endif
/* /*
* Perform dequantization and inverse DCT on one block of coefficients. * Perform dequantization and inverse DCT on one block of coefficients.
*
* cK represents cos(K*pi/16).
*/ */
GLOBAL(void) GLOBAL(void)
@@ -180,7 +156,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
int ctr; int ctr;
int workspace[DCTSIZE2]; /* buffers data between passes */ int workspace[DCTSIZE2]; /* buffers data between passes */
SHIFT_TEMPS /* for DESCALE */ SHIFT_TEMPS /* for DESCALE */
ISHIFT_TEMPS /* for IDESCALE */ ISHIFT_TEMPS /* for IRIGHT_SHIFT */
/* Pass 1: process columns from input, store into work array. */ /* Pass 1: process columns from input, store into work array. */
@@ -253,12 +229,12 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ tmp10 = z5 - MULTIPLY(z12, FIX_1_082392200); /* 2*(c2-c6) */
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ tmp12 = z5 - MULTIPLY(z10, FIX_2_613125930); /* 2*(c2+c6) */
tmp6 = tmp12 - tmp7; /* phase 2 */ tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6; tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5; tmp4 = tmp10 - tmp5;
wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
@@ -266,21 +242,28 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6);
wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5); wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5);
wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5);
wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); wsptr[DCTSIZE*3] = (int) (tmp3 + tmp4);
wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); wsptr[DCTSIZE*4] = (int) (tmp3 - tmp4);
inptr++; /* advance pointers to next column */ inptr++; /* advance pointers to next column */
quantptr++; quantptr++;
wsptr++; wsptr++;
} }
/* Pass 2: process rows from work array, store into output array. */ /* Pass 2: process rows from work array, store into output array.
/* Note that we must descale the results by a factor of 8 == 2**3, */ * Note that we must descale the results by a factor of 8 == 2**3,
/* and also undo the PASS1_BITS scaling. */ * and also undo the PASS1_BITS scaling.
*/
wsptr = workspace; wsptr = workspace;
for (ctr = 0; ctr < DCTSIZE; ctr++) { for (ctr = 0; ctr < DCTSIZE; ctr++) {
outptr = output_buf[ctr] + output_col; outptr = output_buf[ctr] + output_col;
/* Add range center and fudge factor for final descale and range-limit. */
z5 = (DCTELEM) wsptr[0] +
((((DCTELEM) RANGE_CENTER) << (PASS1_BITS+3)) +
(1 << (PASS1_BITS+2)));
/* Rows of zeroes can be exploited in the same way as we did with columns. /* Rows of zeroes can be exploited in the same way as we did with columns.
* However, the column calculation has created many nonzero AC terms, so * However, the column calculation has created many nonzero AC terms, so
* the simplification applies less often (typically 5% to 10% of the time). * the simplification applies less often (typically 5% to 10% of the time).
@@ -293,7 +276,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int) IRIGHT_SHIFT(z5, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
@@ -312,12 +295,12 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* Even part */ /* Even part */
tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); tmp10 = z5 + (DCTELEM) wsptr[4];
tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); tmp11 = z5 - (DCTELEM) wsptr[4];
tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); tmp13 = (DCTELEM) wsptr[2] + (DCTELEM) wsptr[6];
tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6],
- tmp13; FIX_1_414213562) - tmp13; /* 2*c4 */
tmp0 = tmp10 + tmp13; tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
@@ -335,30 +318,30 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ tmp10 = z5 - MULTIPLY(z12, FIX_1_082392200); /* 2*(c2-c6) */
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ tmp12 = z5 - MULTIPLY(z10, FIX_2_613125930); /* 2*(c2+c6) */
tmp6 = tmp12 - tmp7; /* phase 2 */ tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6; tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5; tmp4 = tmp10 - tmp5;
/* Final output stage: scale down by a factor of 8 and range-limit */ /* Final output stage: scale down by a factor of 8 and range-limit */
outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) outptr[0] = range_limit[(int) IRIGHT_SHIFT(tmp0 + tmp7, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) outptr[7] = range_limit[(int) IRIGHT_SHIFT(tmp0 - tmp7, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) outptr[1] = range_limit[(int) IRIGHT_SHIFT(tmp1 + tmp6, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) outptr[6] = range_limit[(int) IRIGHT_SHIFT(tmp1 - tmp6, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) outptr[2] = range_limit[(int) IRIGHT_SHIFT(tmp2 + tmp5, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) outptr[5] = range_limit[(int) IRIGHT_SHIFT(tmp2 - tmp5, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) outptr[3] = range_limit[(int) IRIGHT_SHIFT(tmp3 + tmp4, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) outptr[4] = range_limit[(int) IRIGHT_SHIFT(tmp3 - tmp4, PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* jmorecfg.h * jmorecfg.h
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2012 by Guido Vollbeding. * Modified 1997-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -15,13 +15,22 @@
/* /*
* Define BITS_IN_JSAMPLE as either * Define BITS_IN_JSAMPLE as either
* 8 for 8-bit sample values (the usual setting) * 8 for 8-bit sample values (the usual setting)
* 9 for 9-bit sample values
* 10 for 10-bit sample values
* 11 for 11-bit sample values
* 12 for 12-bit sample values * 12 for 12-bit sample values
* Only 8 and 12 are legal data precisions for lossy JPEG according to the * Only 8, 9, 10, 11, and 12 bits sample data precision are supported for
* JPEG standard, and the IJG code does not support anything else! * full-feature DCT processing. Further depths up to 16-bit may be added
* We do not support run-time selection of data precision, sorry. * later for the lossless modes of operation.
* Run-time selection and conversion of data precision will be added later
* and are currently not supported, sorry.
* Exception: The transcoding part (jpegtran) supports all settings in a
* single instance, since it operates on the level of DCT coefficients and
* not sample values. The DCT coefficients are of the same type (16 bits)
* in all cases (see below).
*/ */
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ #define BITS_IN_JSAMPLE 8 /* use 8, 9, 10, 11, or 12 */
/* /*
@@ -77,6 +86,48 @@ typedef char JSAMPLE;
#endif /* BITS_IN_JSAMPLE == 8 */ #endif /* BITS_IN_JSAMPLE == 8 */
#if BITS_IN_JSAMPLE == 9
/* JSAMPLE should be the smallest type that will hold the values 0..511.
* On nearly all machines "short" will do nicely.
*/
typedef short JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#define MAXJSAMPLE 511
#define CENTERJSAMPLE 256
#endif /* BITS_IN_JSAMPLE == 9 */
#if BITS_IN_JSAMPLE == 10
/* JSAMPLE should be the smallest type that will hold the values 0..1023.
* On nearly all machines "short" will do nicely.
*/
typedef short JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#define MAXJSAMPLE 1023
#define CENTERJSAMPLE 512
#endif /* BITS_IN_JSAMPLE == 10 */
#if BITS_IN_JSAMPLE == 11
/* JSAMPLE should be the smallest type that will hold the values 0..2047.
* On nearly all machines "short" will do nicely.
*/
typedef short JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#define MAXJSAMPLE 2047
#define CENTERJSAMPLE 1024
#endif /* BITS_IN_JSAMPLE == 11 */
#if BITS_IN_JSAMPLE == 12 #if BITS_IN_JSAMPLE == 12
/* JSAMPLE should be the smallest type that will hold the values 0..4095. /* JSAMPLE should be the smallest type that will hold the values 0..4095.
* On nearly all machines "short" will do nicely. * On nearly all machines "short" will do nicely.
@@ -252,7 +303,10 @@ typedef void noreturn_t;
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work. * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
*/ */
#ifdef HAVE_BOOLEAN #ifndef HAVE_BOOLEAN
#if defined FALSE || defined TRUE || defined QGLOBAL_H
/* Qt3 defines FALSE and TRUE as "const" variables in qglobal.h */
typedef int boolean;
#ifndef FALSE /* in case these macros already exist */ #ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */ #define FALSE 0 /* values of boolean */
#endif #endif
@@ -262,6 +316,7 @@ typedef void noreturn_t;
#else #else
typedef enum { FALSE = 0, TRUE = 1 } boolean; typedef enum { FALSE = 0, TRUE = 1 } boolean;
#endif #endif
#endif
/* /*
@@ -299,11 +354,12 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean;
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/ #define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
/* Note: if you selected 12-bit data precision, it is dangerous to turn off /* Note: if you selected more than 8-bit data precision, it is dangerous to
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit * turn off ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only
* precision, so jchuff.c normally uses entropy optimization to compute * good for 8-bit precision, so arithmetic coding is recommended for higher
* usable tables for higher precision. If you don't want to do optimization, * precision. The Huffman encoder normally uses entropy optimization to
* you'll have to supply different default Huffman tables. * compute usable tables for higher precision. Otherwise, you'll have to
* supply different default Huffman tables.
* The exact same statements apply for progressive JPEG: the default tables * The exact same statements apply for progressive JPEG: the default tables
* don't work for progressive mode. (This may get fixed, however.) * don't work for progressive mode. (This may get fixed, however.)
*/ */
@@ -314,7 +370,7 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean;
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? (Requires DCT_ISLOW)*/
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */

View File

@@ -2,7 +2,7 @@
* jpegint.h * jpegint.h
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2011 by Guido Vollbeding. * Modified 1997-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -211,8 +211,8 @@ struct jpeg_marker_reader {
/* Entropy decoding */ /* Entropy decoding */
struct jpeg_entropy_decoder { struct jpeg_entropy_decoder {
JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW *MCU_data));
JBLOCKROW *MCU_data)); JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
}; };
/* Inverse DCT (also performs dequantization) */ /* Inverse DCT (also performs dequantization) */

View File

@@ -2,7 +2,7 @@
* jpeglib.h * jpeglib.h
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2012 by Guido Vollbeding. * Modified 2002-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -39,12 +39,12 @@ extern "C" {
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */ #define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
#define JPEG_LIB_VERSION_MAJOR 9 #define JPEG_LIB_VERSION_MAJOR 9
#define JPEG_LIB_VERSION_MINOR 0 #define JPEG_LIB_VERSION_MINOR 2
/* Various constants determining the sizes of things. /* Various constants determining the sizes of things.
* All of these are specified by the JPEG standard, so don't change them * All of these are specified by the JPEG standard,
* if you want to be compatible. * so don't change them if you want to be compatible.
*/ */
#define DCTSIZE 8 /* The basic DCT block is 8x8 coefficients */ #define DCTSIZE 8 /* The basic DCT block is 8x8 coefficients */
@@ -157,16 +157,21 @@ typedef struct {
/* The downsampled dimensions are the component's actual, unpadded number /* The downsampled dimensions are the component's actual, unpadded number
* of samples at the main buffer (preprocessing/compression interface); * of samples at the main buffer (preprocessing/compression interface);
* DCT scaling is included, so * DCT scaling is included, so
* downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCTSIZE) * downsampled_width =
* ceil(image_width * Hi/Hmax * DCT_h_scaled_size/block_size)
* and similarly for height. * and similarly for height.
*/ */
JDIMENSION downsampled_width; /* actual width in samples */ JDIMENSION downsampled_width; /* actual width in samples */
JDIMENSION downsampled_height; /* actual height in samples */ JDIMENSION downsampled_height; /* actual height in samples */
/* This flag is used only for decompression. In cases where some of the /* For decompression, in cases where some of the components will be
* components will be ignored (eg grayscale output from YCbCr image), * ignored (eg grayscale output from YCbCr image), we can skip most
* we can skip most computations for the unused components. * computations for the unused components.
* For compression, some of the components will need further quantization
* scale by factor of 2 after DCT (eg BG_YCC output from normal RGB input).
* The field is first set TRUE for decompression, FALSE for compression
* in initial_setup, and then adapted in color conversion setup.
*/ */
boolean component_needed; /* do we need the value of this component? */ boolean component_needed;
/* These values are computed before starting a scan of the component. */ /* These values are computed before starting a scan of the component. */
/* The decompressor output side may not use these variables. */ /* The decompressor output side may not use these variables. */
@@ -215,10 +220,12 @@ struct jpeg_marker_struct {
typedef enum { typedef enum {
JCS_UNKNOWN, /* error/unspecified */ JCS_UNKNOWN, /* error/unspecified */
JCS_GRAYSCALE, /* monochrome */ JCS_GRAYSCALE, /* monochrome */
JCS_RGB, /* red/green/blue */ JCS_RGB, /* red/green/blue, standard RGB (sRGB) */
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ JCS_YCbCr, /* Y/Cb/Cr (also known as YUV), standard YCC */
JCS_CMYK, /* C/M/Y/K */ JCS_CMYK, /* C/M/Y/K */
JCS_YCCK /* Y/Cb/Cr/K */ JCS_YCCK, /* Y/Cb/Cr/K */
JCS_BG_RGB, /* big gamut red/green/blue, bg-sRGB */
JCS_BG_YCC /* big gamut Y/Cb/Cr, bg-sYCC */
} J_COLOR_SPACE; } J_COLOR_SPACE;
/* Supported color transforms. */ /* Supported color transforms. */
@@ -972,7 +979,7 @@ EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
unsigned char ** outbuffer, unsigned char ** outbuffer,
unsigned long * outsize)); unsigned long * outsize));
EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
unsigned char * inbuffer, const unsigned char * inbuffer,
unsigned long insize)); unsigned long insize));
/* Default parameter setup for compression */ /* Default parameter setup for compression */

View File

@@ -1,4 +1,4 @@
.TH JPEGTRAN 1 "28 December 2009" .TH JPEGTRAN 1 "20 September 2015"
.SH NAME .SH NAME
jpegtran \- lossless transformation of JPEG files jpegtran \- lossless transformation of JPEG files
.SH SYNOPSIS .SH SYNOPSIS
@@ -19,6 +19,10 @@ for example from baseline JPEG to progressive JPEG or vice versa. It can also
perform some rearrangements of the image data, for example turning an image perform some rearrangements of the image data, for example turning an image
from landscape to portrait format by rotation. from landscape to portrait format by rotation.
.PP .PP
For EXIF files and JPEG files containing Exif data, you may prefer to use
.B exiftran
instead.
.PP
.B jpegtran .B jpegtran
works by rearranging the compressed data (DCT coefficients), without works by rearranging the compressed data (DCT coefficients), without
ever fully decoding the image. Therefore, its transformations are lossless: ever fully decoding the image. Therefore, its transformations are lossless:
@@ -28,7 +32,11 @@ followed by
.B cjpeg .B cjpeg
to accomplish the same conversion. But by the same token, to accomplish the same conversion. But by the same token,
.B jpegtran .B jpegtran
cannot perform lossy operations such as changing the image quality. cannot perform lossy operations such as changing the image quality. However,
while the image data is losslessly transformed, metadata can be removed. See
the
.B \-copy
option for specifics.
.PP .PP
.B jpegtran .B jpegtran
reads the named JPEG/JFIF file, or the standard input if no file is reads the named JPEG/JFIF file, or the standard input if no file is
@@ -156,15 +164,24 @@ image region but losslessly preserves what is inside. Like the rotate and
flip transforms, lossless crop is restricted by the current JPEG format: the flip transforms, lossless crop is restricted by the current JPEG format: the
upper left corner of the selected region must fall on an iMCU boundary. If upper left corner of the selected region must fall on an iMCU boundary. If
this does not hold for the given crop parameters, we silently move the upper this does not hold for the given crop parameters, we silently move the upper
left corner up and/or left to make it so, simultaneously increasing the region left corner up and/or left to make it so, simultaneously increasing the
dimensions to keep the lower right crop corner unchanged. (Thus, the output region dimensions to keep the lower right crop corner unchanged. (Thus, the
image covers at least the requested region, but may cover more.) output image covers at least the requested region, but may cover more.)
The adjustment of the region dimensions may be optionally disabled by
attaching an 'f' character ("force") to the width or height number.
The image can be losslessly cropped by giving the switch: The image can be losslessly cropped by giving the switch:
.TP .TP
.B \-crop WxH+X+Y .B \-crop WxH+X+Y
Crop to a rectangular subarea of width W, height H starting at point X,Y. Crop to a rectangular subarea of width W, height H starting at point X,Y.
.PP .PP
A complementary lossless-wipe option is provided to discard (gray out) data
inside a given image region while losslessly preserving what is outside:
.TP
.B \-wipe WxH+X+Y
Wipe (gray out) a rectangular subarea of width W, height H starting at point
X,Y.
.PP
Other not-strictly-lossless transformation switches are: Other not-strictly-lossless transformation switches are:
.TP .TP
.B \-grayscale .B \-grayscale
@@ -198,16 +215,17 @@ such as comment blocks:
.TP .TP
.B \-copy none .B \-copy none
Copy no extra markers from source file. This setting suppresses all Copy no extra markers from source file. This setting suppresses all
comments and other excess baggage present in the source file. comments and other metadata in the source file.
.TP .TP
.B \-copy comments .B \-copy comments
Copy only comment markers. This setting copies comments from the source file, Copy only comment markers. This setting copies comments from the source file,
but discards any other inessential (for image display) data. but discards any other metadata.
.TP .TP
.B \-copy all .B \-copy all
Copy all extra markers. This setting preserves miscellaneous markers Copy all extra markers. This setting preserves metadata
found in the source file, such as JFIF thumbnails, Exif data, and Photoshop found in the source file, such as JFIF thumbnails, Exif data, and Photoshop
settings. In some files these extra markers can be sizable. settings. In some files these extra markers can be sizable. Note that this
option will copy thumbnails as-is; they will not be transformed.
.IP .IP
The default behavior is The default behavior is
.BR "\-copy comments" . .BR "\-copy comments" .

View File

@@ -1,7 +1,7 @@
/* /*
* jpegtran.c * jpegtran.c
* *
* Copyright (C) 1995-2012, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1995-2013, Thomas G. Lane, Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -66,8 +66,8 @@ usage (void)
fprintf(stderr, "Switches for modifying the image:\n"); fprintf(stderr, "Switches for modifying the image:\n");
#if TRANSFORMS_SUPPORTED #if TRANSFORMS_SUPPORTED
fprintf(stderr, " -crop WxH+X+Y Crop to a rectangular subarea\n"); fprintf(stderr, " -crop WxH+X+Y Crop to a rectangular subarea\n");
fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n");
fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n"); fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n");
fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n");
fprintf(stderr, " -perfect Fail if there is non-transformable edge blocks\n"); fprintf(stderr, " -perfect Fail if there is non-transformable edge blocks\n");
fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n"); fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n");
#endif #endif
@@ -76,6 +76,7 @@ usage (void)
fprintf(stderr, " -transpose Transpose image\n"); fprintf(stderr, " -transpose Transpose image\n");
fprintf(stderr, " -transverse Transverse transpose image\n"); fprintf(stderr, " -transverse Transverse transpose image\n");
fprintf(stderr, " -trim Drop non-transformable edge blocks\n"); fprintf(stderr, " -trim Drop non-transformable edge blocks\n");
fprintf(stderr, " -wipe WxH+X+Y Wipe (gray out) a rectangular subarea\n");
#endif #endif
fprintf(stderr, "Switches for advanced users:\n"); fprintf(stderr, "Switches for advanced users:\n");
#ifdef C_ARITH_CODING_SUPPORTED #ifdef C_ARITH_CODING_SUPPORTED
@@ -187,7 +188,8 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
#if TRANSFORMS_SUPPORTED #if TRANSFORMS_SUPPORTED
if (++argn >= argc) /* advance to next argument */ if (++argn >= argc) /* advance to next argument */
usage(); usage();
if (! jtransform_parse_crop_spec(&transformoption, argv[argn])) { if (transformoption.crop /* reject multiple crop/wipe requests */ ||
! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
fprintf(stderr, "%s: bogus -crop argument '%s'\n", fprintf(stderr, "%s: bogus -crop argument '%s'\n",
progname, argv[argn]); progname, argv[argn]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@@ -336,6 +338,21 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
/* Trim off any partial edge MCUs that the transform can't handle. */ /* Trim off any partial edge MCUs that the transform can't handle. */
transformoption.trim = TRUE; transformoption.trim = TRUE;
} else if (keymatch(arg, "wipe", 1)) {
#if TRANSFORMS_SUPPORTED
if (++argn >= argc) /* advance to next argument */
usage();
if (transformoption.crop /* reject multiple crop/wipe requests */ ||
! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
fprintf(stderr, "%s: bogus -wipe argument '%s'\n",
progname, argv[argn]);
exit(EXIT_FAILURE);
}
select_transform(JXFORM_WIPE);
#else
select_transform(JXFORM_NONE); /* force an error */
#endif
} else { } else {
usage(); /* bogus switch */ usage(); /* bogus switch */
} }

View File

@@ -1,7 +1,7 @@
/* /*
* jversion.h * jversion.h
* *
* Copyright (C) 1991-2013, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -9,6 +9,6 @@
*/ */
#define JVERSION "9 13-Jan-2013" #define JVERSION "9b 17-Jan-2016"
#define JCOPYRIGHT "Copyright (C) 2013, Thomas G. Lane, Guido Vollbeding" #define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding"

View File

@@ -95,8 +95,8 @@ use.) Unsupported ISO options include:
* Lossless JPEG * Lossless JPEG
* DNL marker * DNL marker
* Nonintegral subsampling ratios * Nonintegral subsampling ratios
We support both 8- and 12-bit data precision, but this is a compile-time We support 8-bit to 12-bit data precision, but this is a compile-time choice
choice rather than a run-time choice; hence it is difficult to use both rather than a run-time choice; hence it is difficult to use different
precisions in a single application. precisions in a single application.
By itself, the library handles only interchange JPEG datastreams --- in By itself, the library handles only interchange JPEG datastreams --- in
@@ -225,7 +225,7 @@ For best results, source data values should have the precision specified by
BITS_IN_JSAMPLE (normally 8 bits). For instance, if you choose to compress BITS_IN_JSAMPLE (normally 8 bits). For instance, if you choose to compress
data that's only 6 bits/channel, you should left-justify each value in a data that's only 6 bits/channel, you should left-justify each value in a
byte before passing it to the compressor. If you need to compress data byte before passing it to the compressor. If you need to compress data
that has more than 8 bits/channel, compile with BITS_IN_JSAMPLE = 12. that has more than 8 bits/channel, compile with BITS_IN_JSAMPLE = 9 to 12.
(See "Library compile-time options", later.) (See "Library compile-time options", later.)
@@ -1273,9 +1273,10 @@ Special color spaces
The JPEG standard itself is "color blind" and doesn't specify any particular The JPEG standard itself is "color blind" and doesn't specify any particular
color space. It is customary to convert color data to a luminance/chrominance color space. It is customary to convert color data to a luminance/chrominance
color space before compressing, since this permits greater compression. The color space before compressing, since this permits greater compression. The
existing de-facto JPEG file format standards specify YCbCr or grayscale data existing JPEG file interchange format standards specify YCbCr or GRAYSCALE
(JFIF), or grayscale, RGB, YCbCr, CMYK, or YCCK (Adobe). For special data (JFIF version 1), GRAYSCALE, RGB, YCbCr, CMYK, or YCCK (Adobe), or BG_RGB
applications such as multispectral images, other color spaces can be used, or BG_YCC (big gamut color spaces, JFIF version 2). For special applications
such as multispectral images, other color spaces can be used,
but it must be understood that such files will be unportable. but it must be understood that such files will be unportable.
The JPEG library can handle the most common colorspace conversions (namely The JPEG library can handle the most common colorspace conversions (namely
@@ -1292,22 +1293,25 @@ jpeg_set_colorspace(). Of course you must select a supported transformation.
jccolor.c currently supports the following transformations: jccolor.c currently supports the following transformations:
RGB => YCbCr RGB => YCbCr
RGB => GRAYSCALE RGB => GRAYSCALE
RGB => BG_YCC
YCbCr => GRAYSCALE YCbCr => GRAYSCALE
YCbCr => BG_YCC
CMYK => YCCK CMYK => YCCK
plus the null transforms: GRAYSCALE => GRAYSCALE, RGB => RGB, plus the null transforms: GRAYSCALE => GRAYSCALE, RGB => RGB,
YCbCr => YCbCr, CMYK => CMYK, YCCK => YCCK, and UNKNOWN => UNKNOWN. BG_RGB => BG_RGB, YCbCr => YCbCr, BG_YCC => BG_YCC, CMYK => CMYK,
YCCK => YCCK, and UNKNOWN => UNKNOWN.
The de-facto file format standards (JFIF and Adobe) specify APPn markers that The file interchange format standards (JFIF and Adobe) specify APPn markers
indicate the color space of the JPEG file. It is important to ensure that that indicate the color space of the JPEG file. It is important to ensure
these are written correctly, or omitted if the JPEG file's color space is not that these are written correctly, or omitted if the JPEG file's color space
one of the ones supported by the de-facto standards. jpeg_set_colorspace() is not one of the ones supported by the interchange standards.
will set the compression parameters to include or omit the APPn markers jpeg_set_colorspace() will set the compression parameters to include or omit
properly, so long as it is told the truth about the JPEG color space. the APPn markers properly, so long as it is told the truth about the JPEG
For example, if you are writing some random 3-component color space without color space. For example, if you are writing some random 3-component color
conversion, don't try to fake out the library by setting in_color_space and space without conversion, don't try to fake out the library by setting
jpeg_color_space to JCS_YCbCr; use JCS_UNKNOWN. You may want to write an in_color_space and jpeg_color_space to JCS_YCbCr; use JCS_UNKNOWN.
APPn marker of your own devising to identify the colorspace --- see "Special You may want to write an APPn marker of your own devising to identify
markers", below. the colorspace --- see "Special markers", below.
When told that the color space is UNKNOWN, the library will default to using When told that the color space is UNKNOWN, the library will default to using
luminance-quality compression parameters for all color components. You may luminance-quality compression parameters for all color components. You may
@@ -1325,6 +1329,8 @@ set out_color_space to override this. Again, you must select a supported
transformation. jdcolor.c currently supports transformation. jdcolor.c currently supports
YCbCr => RGB YCbCr => RGB
YCbCr => GRAYSCALE YCbCr => GRAYSCALE
BG_YCC => RGB
BG_YCC => GRAYSCALE
RGB => GRAYSCALE RGB => GRAYSCALE
GRAYSCALE => RGB GRAYSCALE => RGB
YCCK => CMYK YCCK => CMYK
@@ -2585,10 +2591,10 @@ different sizes. If the image dimensions are not a multiple of the MCU size,
you must also pad the data correctly (usually, this is done by replicating you must also pad the data correctly (usually, this is done by replicating
the last column and/or row). The data must be padded to a multiple of a DCT the last column and/or row). The data must be padded to a multiple of a DCT
block in each component: that is, each downsampled row must contain a block in each component: that is, each downsampled row must contain a
multiple of 8 valid samples, and there must be a multiple of 8 sample rows multiple of block_size valid samples, and there must be a multiple of
for each component. (For applications such as conversion of digital TV block_size sample rows for each component. (For applications such as
images, the standard image size is usually a multiple of the DCT block size, conversion of digital TV images, the standard image size is usually a
so that no padding need actually be done.) multiple of the DCT block size, so that no padding need actually be done.)
The procedure for compression of raw data is basically the same as normal The procedure for compression of raw data is basically the same as normal
compression, except that you call jpeg_write_raw_data() in place of compression, except that you call jpeg_write_raw_data() in place of
@@ -2614,22 +2620,22 @@ The scanlines count passed to and returned from jpeg_write_raw_data is
measured in terms of the component with the largest v_samp_factor. measured in terms of the component with the largest v_samp_factor.
jpeg_write_raw_data() processes one MCU row per call, which is to say jpeg_write_raw_data() processes one MCU row per call, which is to say
v_samp_factor*DCTSIZE sample rows of each component. The passed num_lines v_samp_factor*block_size sample rows of each component. The passed num_lines
value must be at least max_v_samp_factor*DCTSIZE, and the return value will value must be at least max_v_samp_factor*block_size, and the return value
be exactly that amount (or possibly some multiple of that amount, in future will be exactly that amount (or possibly some multiple of that amount, in
library versions). This is true even on the last call at the bottom of the future library versions). This is true even on the last call at the bottom
image; don't forget to pad your data as necessary. of the image; don't forget to pad your data as necessary.
The required dimensions of the supplied data can be computed for each The required dimensions of the supplied data can be computed for each
component as component as
cinfo->comp_info[i].width_in_blocks*DCTSIZE samples per row cinfo->comp_info[i].width_in_blocks*block_size samples per row
cinfo->comp_info[i].height_in_blocks*DCTSIZE rows in image cinfo->comp_info[i].height_in_blocks*block_size rows in image
after jpeg_start_compress() has initialized those fields. If the valid data after jpeg_start_compress() has initialized those fields. If the valid data
is smaller than this, it must be padded appropriately. For some sampling is smaller than this, it must be padded appropriately. For some sampling
factors and image sizes, additional dummy DCT blocks are inserted to make factors and image sizes, additional dummy DCT blocks are inserted to make
the image a multiple of the MCU dimensions. The library creates such dummy the image a multiple of the MCU dimensions. The library creates such dummy
blocks itself; it does not read them from your supplied data. Therefore you blocks itself; it does not read them from your supplied data. Therefore you
need never pad by more than DCTSIZE samples. An example may help here. need never pad by more than block_size samples. An example may help here.
Assume 2h2v downsampling of YCbCr data, that is Assume 2h2v downsampling of YCbCr data, that is
cinfo->comp_info[0].h_samp_factor = 2 for Y cinfo->comp_info[0].h_samp_factor = 2 for Y
cinfo->comp_info[0].v_samp_factor = 2 cinfo->comp_info[0].v_samp_factor = 2
@@ -2671,8 +2677,8 @@ Then call jpeg_read_raw_data() in place of jpeg_read_scanlines(). The
decompression process is otherwise the same as usual. decompression process is otherwise the same as usual.
jpeg_read_raw_data() returns one MCU row per call, and thus you must pass a jpeg_read_raw_data() returns one MCU row per call, and thus you must pass a
buffer of at least max_v_samp_factor*DCTSIZE scanlines (scanline counting is buffer of at least max_v_samp_factor*block_size scanlines (scanline counting
the same as for raw-data compression). The buffer you pass must be large is the same as for raw-data compression). The buffer you pass must be large
enough to hold the actual data plus padding to DCT-block boundaries. As with enough to hold the actual data plus padding to DCT-block boundaries. As with
compression, any entirely dummy DCT blocks are not processed so you need not compression, any entirely dummy DCT blocks are not processed so you need not
allocate space for them, but the total scanline count includes them. The allocate space for them, but the total scanline count includes them. The
@@ -2928,10 +2934,10 @@ This does not count any memory allocated by the application, such as a
buffer to hold the final output image. buffer to hold the final output image.
The above figures are valid for 8-bit JPEG data precision and a machine with The above figures are valid for 8-bit JPEG data precision and a machine with
32-bit ints. For 12-bit JPEG data, double the size of the strip buffers and 32-bit ints. For 9-bit to 12-bit JPEG data, double the size of the strip
quantization pixel buffer. The "fixed-size" data will be somewhat smaller buffers and quantization pixel buffer. The "fixed-size" data will be
with 16-bit ints, larger with 64-bit ints. Also, CMYK or other unusual somewhat smaller with 16-bit ints, larger with 64-bit ints. Also, CMYK
color spaces will require different amounts of space. or other unusual color spaces will require different amounts of space.
The full-image coefficient and pixel buffers, if needed at all, do not The full-image coefficient and pixel buffers, if needed at all, do not
have to be fully RAM resident; you can have the library use temporary have to be fully RAM resident; you can have the library use temporary
@@ -2953,27 +2959,34 @@ Library compile-time options
A number of compile-time options are available by modifying jmorecfg.h. A number of compile-time options are available by modifying jmorecfg.h.
The JPEG standard provides for both the baseline 8-bit DCT process and The IJG code currently supports 8-bit to 12-bit sample data precision by
a 12-bit DCT process. The IJG code supports 12-bit JPEG if you define defining BITS_IN_JSAMPLE as 8, 9, 10, 11, or 12.
BITS_IN_JSAMPLE as 12 rather than 8. Note that this causes JSAMPLE to be Note that a value larger than 8 causes JSAMPLE to be larger than a char,
larger than a char, so it affects the surrounding application's image data. so it affects the surrounding application's image data.
The sample applications cjpeg and djpeg can support 12-bit mode only for PPM The sample applications cjpeg and djpeg can support deeper than 8-bit data
and GIF file formats; you must disable the other file formats to compile a only for PPM and GIF file formats; you must disable the other file formats
12-bit cjpeg or djpeg. (install.txt has more information about that.) to compile a 9-bit to 12-bit cjpeg or djpeg. (install.txt has more
At present, a 12-bit library can handle *only* 12-bit images, not both information about that.)
precisions. (If you need to include both 8- and 12-bit libraries in a single Run-time selection and conversion of data precision are currently not
application, you could probably do it by defining NEED_SHORT_EXTERNAL_NAMES supported and may be added later.
for just one of the copies. You'd have to access the 8-bit and 12-bit copies Exception: The transcoding part (jpegtran) supports all settings in a
from separate application source files. This is untested ... if you try it, single instance, since it operates on the level of DCT coefficients and
we'd like to hear whether it works!) not sample values.
(If you need to include an 8-bit library and a 9-bit to 12-bit library for
compression or decompression in a single application, you could probably do
it by defining NEED_SHORT_EXTERNAL_NAMES for just one of the copies. You'd
have to access the 8-bit and the 9-bit to 12-bit copies from separate
application source files. This is untested ... if you try it, we'd like to
hear whether it works!)
Note that a 12-bit library always compresses in Huffman optimization mode, Note that the standard Huffman tables are only valid for 8-bit data precision.
in order to generate valid Huffman tables. This is necessary because our If you selected more than 8-bit data precision, cjpeg uses arithmetic coding
default Huffman tables only cover 8-bit data. If you need to output 12-bit by default. The Huffman encoder normally uses entropy optimization to
files in one pass, you'll have to supply suitable default Huffman tables. compute usable tables for higher precision. Otherwise, you'll have to
You may also want to supply your own DCT quantization tables; the existing supply different default Huffman tables. You may also want to supply your
quality-scaling code has been developed for 8-bit use, and probably doesn't own DCT quantization tables; the existing quality-scaling code has been
generate especially good tables for 12-bit. developed for 8-bit use, and probably doesn't generate especially good tables
for 9-bit to 12-bit.
The maximum number of components (color channels) in the image is determined The maximum number of components (color channels) in the image is determined
by MAX_COMPONENTS. The JPEG standard allows up to 255 components, but we by MAX_COMPONENTS. The JPEG standard allows up to 255 components, but we

5580
ltmain.sh

File diff suppressed because it is too large Load Diff

View File

@@ -60,17 +60,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

243
makefile.b32 Normal file
View File

@@ -0,0 +1,243 @@
# Makefile for Independent JPEG Group's software
# This makefile is suitable for Borland C on MS-DOS.
# It works with Borland C++ 32-bit for DOS, revision 5.0 or later.
# Thanks to Tom Wright and Ge' Weijers (original DOS) and
# Joe Slater for adding 32-bit additions (needed for Borland
# revision 5.5).
# Read installation instructions before saying "make" !!
# The name of your C compiler:
CC= bcc32
# You may need to adjust these cc options:
CFLAGS= -O2 -w-par -w-stu -w-ccc -w-rch -w-aus
# -w-par suppresses warnings about unused function parameters
# -w-stu suppresses warnings about incomplete structures
# -w-ccc suppresses warnings about compile-time-constant conditions
# -w-rch suppresses warnings about unreachable code
# Generally, we recommend defining any configuration symbols in jconfig.h,
# NOT via -D switches here.
# Link-time cc options:
LDFLAGS=
# -lc case-significant link
# Put here the object file name for the correct system-dependent memory
# manager file.
# SYSDEPMEMLIB must list the same files with "+" signs for the librarian.
SYSDEPMEM= jmemnobs.obj
SYSDEPMEMLIB= +jmemnobs.obj
# End of configurable options.
# source files: JPEG library proper
LIBSOURCES= 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 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 jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \
jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \
jquant2.c jutils.c jmemmgr.c
# memmgr back ends: compile only one of these into a working library
SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
# files included by source files
INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
# documentation, test, and support files
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms
CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp \
missing ar-lib
OTHERFILES= jconfig.txt ckconfig.c jmemdosa.asm libjpeg.map
TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
testimgp.jpg
DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
$(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
# library object files common to compression and decompression
COMOBJECTS= jaricom.obj jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)
# compression library object files
CLIBOBJECTS= jcapimin.obj jcapistd.obj jcarith.obj jctrans.obj jcparam.obj \
jdatadst.obj jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj \
jcprepct.obj jccoefct.obj jccolor.obj jcsample.obj jchuff.obj \
jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
# decompression library object files
DLIBOBJECTS= jdapimin.obj jdapistd.obj jdarith.obj jdtrans.obj jdatasrc.obj \
jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdmainct.obj \
jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj jidctflt.obj \
jidctint.obj jdsample.obj jdcolor.obj jquant1.obj jquant2.obj \
jdmerge.obj
# These objectfiles are included in libjpeg.lib
LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
# object files for sample applications (excluding library files)
COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \
rdswitch.obj cdjpeg.obj
DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \
rdcolmap.obj cdjpeg.obj
TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj
all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
libjpeg.lib: $(LIBOBJECTS)
- del libjpeg.lib
tlib libjpeg.lib /E /C @&&|
+jcapimin.obj +jcapistd.obj +jcarith.obj +jctrans.obj +jcparam.obj &
+jdatadst.obj +jcinit.obj +jcmaster.obj +jcmarker.obj +jcmainct.obj &
+jcprepct.obj +jccoefct.obj +jccolor.obj +jcsample.obj +jchuff.obj &
+jcdctmgr.obj +jfdctfst.obj +jfdctflt.obj +jfdctint.obj +jdapimin.obj &
+jdapistd.obj +jdarith.obj +jdtrans.obj +jdatasrc.obj +jdmaster.obj &
+jdinput.obj +jdmarker.obj +jdhuff.obj +jdmainct.obj +jdcoefct.obj &
+jdpostct.obj +jddctmgr.obj +jidctfst.obj +jidctflt.obj +jidctint.obj &
+jdsample.obj +jdcolor.obj +jquant1.obj +jquant2.obj +jdmerge.obj &
+jaricom.obj +jcomapi.obj +jutils.obj +jerror.obj +jmemmgr.obj &
$(SYSDEPMEMLIB)
|
cjpeg.exe: $(COBJECTS) libjpeg.lib
$(CC) $(LDFLAGS) -ecjpeg.exe $(COBJECTS) libjpeg.lib
djpeg.exe: $(DOBJECTS) libjpeg.lib
$(CC) $(LDFLAGS) -edjpeg.exe $(DOBJECTS) libjpeg.lib
jpegtran.exe: $(TROBJECTS) libjpeg.lib
$(CC) $(LDFLAGS) -ejpegtran.exe $(TROBJECTS) libjpeg.lib
rdjpgcom.exe: rdjpgcom.c
$(CC) $(CFLAGS) rdjpgcom.c
wrjpgcom.exe: wrjpgcom.c
$(CC) $(CFLAGS) wrjpgcom.c
# This "{}" syntax allows Borland Make to "batch" source files.
# In this way, each run of the compiler can build many modules.
.c.obj:
$(CC) $(CFLAGS) -c{ $<}
jconfig.h: jconfig.txt
echo You must prepare a system-dependent jconfig.h file.
echo Please read the installation directions in install.txt.
exit 1
clean:
- del *.obj
- del libjpeg.lib
- del cjpeg.exe
- del djpeg.exe
- del jpegtran.exe
- del rdjpgcom.exe
- del wrjpgcom.exe
- del testout*.*
test: cjpeg.exe djpeg.exe jpegtran.exe
- del testout*.*
djpeg -dct int -ppm -outfile testout.ppm testorig.jpg
djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg
cjpeg -dct int -outfile testout.jpg testimg.ppm
djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
jpegtran -outfile testoutt.jpg testprog.jpg
echo n > n.tmp
comp testimg.ppm testout.ppm < n.tmp
comp testimg.bmp testout.bmp < n.tmp
comp testimg.jpg testout.jpg < n.tmp
comp testimg.ppm testoutp.ppm < n.tmp
comp testimgp.jpg testoutp.jpg < n.tmp
comp testorig.jpg testoutt.jpg < n.tmp
del n.tmp
jaricom.obj: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcarith.obj: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdarith.obj: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h
wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h
cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
jmemdosa.obj: jmemdosa.asm
tasm /mx jmemdosa.asm

View File

@@ -87,17 +87,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -60,17 +60,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -61,17 +61,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -58,17 +58,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -47,17 +47,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -69,17 +69,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -64,17 +64,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -57,17 +57,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 \
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc \
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 \
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 \
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 \
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \ makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 \
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \ makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 \
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \ makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 \
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \ makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac \
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \ makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx \
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms jconfig.vms

View File

@@ -59,17 +59,17 @@ INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h &
DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 & DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 &
wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt & wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt &
coderules.txt filelist.txt change.log coderules.txt filelist.txt change.log
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc & MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.b32 &
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 & makefile.bcc makefile.mc6 makefile.dj makefile.wat makefile.vc &
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 & makejdsw.vc6 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 &
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 & makecdep.vc6 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 &
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 & makedmak.vc6 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 &
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 & makerdsp.vc6 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 &
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 & makejsln.v10 makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 &
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 & makecfil.v10 makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 &
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st & makervcx.v10 makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac &
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas & makcjpeg.st makdjpeg.st makljpeg.st maktjpeg.st makefile.manx &
makefile.mms makefile.vms makvms.opt makefile.sas makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat & CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat &
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas & jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas &
jconfig.vms jconfig.vms

View File

@@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Common wrapper for a few potentially missing GNU programs. # Common wrapper for a few potentially missing GNU programs.
scriptversion=2012-06-26.16; # UTC scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc. # Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@@ -160,7 +160,7 @@ give_advice ()
;; ;;
autom4te*) autom4te*)
echo "You might have modified some maintainer files that require" echo "You might have modified some maintainer files that require"
echo "the 'automa4te' program to be rebuilt." echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te' program_details 'autom4te'
;; ;;
bison*|yacc*) bison*|yacc*)

View File

@@ -1,4 +1,4 @@
.TH RDJPGCOM 1 "02 April 2009" .TH RDJPGCOM 1 "13 September 2013"
.SH NAME .SH NAME
rdjpgcom \- display text comments from a JPEG file rdjpgcom \- display text comments from a JPEG file
.SH SYNOPSIS .SH SYNOPSIS

View File

@@ -2,6 +2,7 @@
* rdswitch.c * rdswitch.c
* *
* Copyright (C) 1991-1996, Thomas G. Lane. * Copyright (C) 1991-1996, Thomas G. Lane.
* Modified 2003-2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -347,8 +348,9 @@ set_sample_factors (j_compress_ptr cinfo, char *arg)
return FALSE; return FALSE;
if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */ if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */
return FALSE; return FALSE;
if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) { if (val1 <= 0 || val1 > MAX_SAMP_FACTOR ||
fprintf(stderr, "JPEG sampling factors must be 1..4\n"); val2 <= 0 || val2 > MAX_SAMP_FACTOR) {
fprintf(stderr, "JPEG sampling factors must be 1..%d\n", MAX_SAMP_FACTOR);
return FALSE; return FALSE;
} }
cinfo->comp_info[ci].h_samp_factor = val1; cinfo->comp_info[ci].h_samp_factor = val1;

View File

@@ -1,6 +1,6 @@
IJG JPEG LIBRARY: SYSTEM ARCHITECTURE IJG JPEG LIBRARY: SYSTEM ARCHITECTURE
Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. Copyright (C) 1991-2013, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software. This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file. For conditions of distribution and use, see the accompanying README file.
@@ -170,16 +170,16 @@ can be simplified a little if they work on padded data: it's not necessary to
have special cases at the right and bottom edges. Therefore the interface have special cases at the right and bottom edges. Therefore the interface
buffer is always an integral number of blocks wide and high, and we expect buffer is always an integral number of blocks wide and high, and we expect
compression preprocessing to pad the source data properly. Padding will occur compression preprocessing to pad the source data properly. Padding will occur
only to the next block (N-sample) boundary. In an interleaved-scan situation, only to the next block (block_size-sample) boundary. In an interleaved-scan
additional dummy blocks may be used to fill out MCUs, but the MCU assembly and situation, additional dummy blocks may be used to fill out MCUs, but the MCU
disassembly logic will create or discard these blocks internally. (This is assembly and disassembly logic will create or discard these blocks internally.
advantageous for speed reasons, since we avoid DCTing the dummy blocks. (This is advantageous for speed reasons, since we avoid DCTing the dummy
It also permits a small reduction in file size, because the compressor can blocks. It also permits a small reduction in file size, because the
choose dummy block contents so as to minimize their size in compressed form. compressor can choose dummy block contents so as to minimize their size
Finally, it makes the interface buffer specification independent of whether in compressed form. Finally, it makes the interface buffer specification
the file is actually interleaved or not.) Applications that wish to deal independent of whether the file is actually interleaved or not.)
directly with the downsampled data must provide similar buffering and padding Applications that wish to deal directly with the downsampled data must
for odd-sized images. provide similar buffering and padding for odd-sized images.
*** Poor man's object-oriented programming *** *** Poor man's object-oriented programming ***
@@ -345,9 +345,10 @@ The objects shown above are:
require context rows above and below the current row group; the require context rows above and below the current row group; the
preprocessing controller is responsible for supplying these rows via proper preprocessing controller is responsible for supplying these rows via proper
buffering. The downsampler is responsible for edge expansion at the right buffering. The downsampler is responsible for edge expansion at the right
edge (i.e., extending each sample row to a multiple of N samples); but the edge (i.e., extending each sample row to a multiple of block_size samples);
preprocessing controller is responsible for vertical edge expansion (i.e., but the preprocessing controller is responsible for vertical edge expansion
duplicating the bottom sample row as needed to make a multiple of N rows). (i.e., duplicating the bottom sample row as needed to make a multiple of
block_size rows).
* Coefficient controller: buffer controller for the DCT-coefficient data. * Coefficient controller: buffer controller for the DCT-coefficient data.
This controller handles MCU assembly, including insertion of dummy DCT This controller handles MCU assembly, including insertion of dummy DCT
@@ -651,8 +652,8 @@ contain quantized coefficients everywhere outside the DCT/IDCT subsystems.
quantization a la JPEG Part 3.) quantization a la JPEG Part 3.)
Notice that the allocation unit is now a row of 8x8 coefficient blocks, Notice that the allocation unit is now a row of 8x8 coefficient blocks,
corresponding to N rows of samples. Otherwise the structure is much the same corresponding to block_size rows of samples. Otherwise the structure
as for samples, and for the same reasons. is much the same as for samples, and for the same reasons.
On machines where malloc() can't handle a request bigger than 64Kb, this data On machines where malloc() can't handle a request bigger than 64Kb, this data
structure limits us to rows of less than 512 JBLOCKs, or a picture width of structure limits us to rows of less than 512 JBLOCKs, or a picture width of

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
/* /*
* transupp.c * transupp.c
* *
* Copyright (C) 1997-2012, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1997-2013, Thomas G. Lane, Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -113,6 +113,116 @@ do_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
} }
LOCAL(void)
do_crop_ext (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
jvirt_barray_ptr *src_coef_arrays,
jvirt_barray_ptr *dst_coef_arrays)
/* Crop. This is only used when no rotate/flip is requested with the crop.
* Extension: If the destination size is larger than the source, we fill in
* the extra area with zero (neutral gray). Note we also have to zero partial
* iMCUs at the right and bottom edge of the source image area in this case.
*/
{
JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height;
JDIMENSION dst_blk_y, x_crop_blocks, y_crop_blocks;
int ci, offset_y;
JBLOCKARRAY src_buffer, dst_buffer;
jpeg_component_info *compptr;
MCU_cols = srcinfo->output_width /
(dstinfo->max_h_samp_factor * dstinfo->min_DCT_h_scaled_size);
MCU_rows = srcinfo->output_height /
(dstinfo->max_v_samp_factor * dstinfo->min_DCT_v_scaled_size);
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
comp_width = MCU_cols * compptr->h_samp_factor;
comp_height = MCU_rows * compptr->v_samp_factor;
x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
dst_blk_y += compptr->v_samp_factor) {
dst_buffer = (*srcinfo->mem->access_virt_barray)
((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
(JDIMENSION) compptr->v_samp_factor, TRUE);
if (dstinfo->jpeg_height > srcinfo->output_height) {
if (dst_blk_y < y_crop_blocks ||
dst_blk_y >= comp_height + y_crop_blocks) {
for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
FMEMZERO(dst_buffer[offset_y],
compptr->width_in_blocks * SIZEOF(JBLOCK));
}
continue;
}
src_buffer = (*srcinfo->mem->access_virt_barray)
((j_common_ptr) srcinfo, src_coef_arrays[ci],
dst_blk_y - y_crop_blocks,
(JDIMENSION) compptr->v_samp_factor, FALSE);
} else {
src_buffer = (*srcinfo->mem->access_virt_barray)
((j_common_ptr) srcinfo, src_coef_arrays[ci],
dst_blk_y + y_crop_blocks,
(JDIMENSION) compptr->v_samp_factor, FALSE);
}
for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
if (dstinfo->jpeg_width > srcinfo->output_width) {
if (x_crop_blocks > 0) {
FMEMZERO(dst_buffer[offset_y],
x_crop_blocks * SIZEOF(JBLOCK));
}
jcopy_block_row(src_buffer[offset_y],
dst_buffer[offset_y] + x_crop_blocks,
comp_width);
if (compptr->width_in_blocks > comp_width + x_crop_blocks) {
FMEMZERO(dst_buffer[offset_y] +
comp_width + x_crop_blocks,
(compptr->width_in_blocks -
comp_width - x_crop_blocks) * SIZEOF(JBLOCK));
}
} else {
jcopy_block_row(src_buffer[offset_y] + x_crop_blocks,
dst_buffer[offset_y],
compptr->width_in_blocks);
}
}
}
}
}
LOCAL(void)
do_wipe (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
jvirt_barray_ptr *src_coef_arrays,
JDIMENSION drop_width, JDIMENSION drop_height)
/* Wipe - drop content of specified area, fill with zero (neutral gray) */
{
JDIMENSION comp_width, comp_height;
JDIMENSION blk_y, x_wipe_blocks, y_wipe_blocks;
int ci, offset_y;
JBLOCKARRAY buffer;
jpeg_component_info *compptr;
for (ci = 0; ci < dstinfo->num_components; ci++) {
compptr = dstinfo->comp_info + ci;
comp_width = drop_width * compptr->h_samp_factor;
comp_height = drop_height * compptr->v_samp_factor;
x_wipe_blocks = x_crop_offset * compptr->h_samp_factor;
y_wipe_blocks = y_crop_offset * compptr->v_samp_factor;
for (blk_y = 0; blk_y < comp_height; blk_y += compptr->v_samp_factor) {
buffer = (*srcinfo->mem->access_virt_barray)
((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y + y_wipe_blocks,
(JDIMENSION) compptr->v_samp_factor, TRUE);
for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
FMEMZERO(buffer[offset_y] + x_wipe_blocks,
comp_width * SIZEOF(JBLOCK));
}
}
}
}
LOCAL(void) LOCAL(void)
do_flip_h_no_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, do_flip_h_no_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
JDIMENSION x_crop_offset, JDIMENSION x_crop_offset,
@@ -888,7 +998,8 @@ jtransform_request_workspace (j_decompress_ptr srcinfo,
/* Determine number of components in output image */ /* Determine number of components in output image */
if (info->force_grayscale && if (info->force_grayscale &&
srcinfo->jpeg_color_space == JCS_YCbCr && (srcinfo->jpeg_color_space == JCS_YCbCr ||
srcinfo->jpeg_color_space == JCS_BG_YCC) &&
srcinfo->num_components == 3) srcinfo->num_components == 3)
/* We'll only process the first component */ /* We'll only process the first component */
info->num_components = 1; info->num_components = 1;
@@ -965,39 +1076,81 @@ jtransform_request_workspace (j_decompress_ptr srcinfo,
info->crop_xoffset = 0; /* default to +0 */ info->crop_xoffset = 0; /* default to +0 */
if (info->crop_yoffset_set == JCROP_UNSET) if (info->crop_yoffset_set == JCROP_UNSET)
info->crop_yoffset = 0; /* default to +0 */ info->crop_yoffset = 0; /* default to +0 */
if (info->crop_xoffset >= info->output_width || if (info->crop_width_set == JCROP_UNSET) {
info->crop_yoffset >= info->output_height) if (info->crop_xoffset >= info->output_width)
ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
if (info->crop_width_set == JCROP_UNSET)
info->crop_width = info->output_width - info->crop_xoffset; info->crop_width = info->output_width - info->crop_xoffset;
if (info->crop_height_set == JCROP_UNSET) } else {
/* Check for crop extension */
if (info->crop_width > info->output_width) {
/* Crop extension does not work when transforming! */
if (info->transform != JXFORM_NONE ||
info->crop_xoffset >= info->crop_width ||
info->crop_xoffset > info->crop_width - info->output_width)
ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
} else {
if (info->crop_xoffset >= info->output_width ||
info->crop_width <= 0 ||
info->crop_xoffset > info->output_width - info->crop_width)
ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
}
}
if (info->crop_height_set == JCROP_UNSET) {
if (info->crop_yoffset >= info->output_height)
ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
info->crop_height = info->output_height - info->crop_yoffset; info->crop_height = info->output_height - info->crop_yoffset;
/* Ensure parameters are valid */ } else {
if (info->crop_width <= 0 || info->crop_width > info->output_width || /* Check for crop extension */
info->crop_height <= 0 || info->crop_height > info->output_height || if (info->crop_height > info->output_height) {
info->crop_xoffset > info->output_width - info->crop_width || /* Crop extension does not work when transforming! */
info->crop_yoffset > info->output_height - info->crop_height) if (info->transform != JXFORM_NONE ||
ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); info->crop_yoffset >= info->crop_height ||
info->crop_yoffset > info->crop_height - info->output_height)
ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
} else {
if (info->crop_yoffset >= info->output_height ||
info->crop_height <= 0 ||
info->crop_yoffset > info->output_height - info->crop_height)
ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
}
}
/* Convert negative crop offsets into regular offsets */ /* Convert negative crop offsets into regular offsets */
if (info->crop_xoffset_set == JCROP_NEG) if (info->crop_xoffset_set != JCROP_NEG)
xoffset = info->output_width - info->crop_width - info->crop_xoffset;
else
xoffset = info->crop_xoffset; xoffset = info->crop_xoffset;
if (info->crop_yoffset_set == JCROP_NEG) else if (info->crop_width > info->output_width) /* crop extension */
yoffset = info->output_height - info->crop_height - info->crop_yoffset; xoffset = info->crop_width - info->output_width - info->crop_xoffset;
else else
xoffset = info->output_width - info->crop_width - info->crop_xoffset;
if (info->crop_yoffset_set != JCROP_NEG)
yoffset = info->crop_yoffset; yoffset = info->crop_yoffset;
else if (info->crop_height > info->output_height) /* crop extension */
yoffset = info->crop_height - info->output_height - info->crop_yoffset;
else
yoffset = info->output_height - info->crop_height - info->crop_yoffset;
/* Now adjust so that upper left corner falls at an iMCU boundary */ /* Now adjust so that upper left corner falls at an iMCU boundary */
if (info->crop_width_set == JCROP_FORCE) if (info->transform == JXFORM_WIPE) {
info->output_width = info->crop_width; /* Ensure the effective wipe region will cover the requested */
else info->drop_width = (JDIMENSION) jdiv_round_up
info->output_width = ((long) (info->crop_width + (xoffset % info->iMCU_sample_width)),
info->crop_width + (xoffset % info->iMCU_sample_width); (long) info->iMCU_sample_width);
if (info->crop_height_set == JCROP_FORCE) info->drop_height = (JDIMENSION) jdiv_round_up
info->output_height = info->crop_height; ((long) (info->crop_height + (yoffset % info->iMCU_sample_height)),
else (long) info->iMCU_sample_height);
info->output_height = } else {
info->crop_height + (yoffset % info->iMCU_sample_height); /* Ensure the effective crop region will cover the requested */
if (info->crop_width_set == JCROP_FORCE ||
info->crop_width > info->output_width)
info->output_width = info->crop_width;
else
info->output_width =
info->crop_width + (xoffset % info->iMCU_sample_width);
if (info->crop_height_set == JCROP_FORCE ||
info->crop_height > info->output_height)
info->output_height = info->crop_height;
else
info->output_height =
info->crop_height + (yoffset % info->iMCU_sample_height);
}
/* Save x/y offsets measured in iMCUs */ /* Save x/y offsets measured in iMCUs */
info->x_crop_offset = xoffset / info->iMCU_sample_width; info->x_crop_offset = xoffset / info->iMCU_sample_width;
info->y_crop_offset = yoffset / info->iMCU_sample_height; info->y_crop_offset = yoffset / info->iMCU_sample_height;
@@ -1013,7 +1166,9 @@ jtransform_request_workspace (j_decompress_ptr srcinfo,
transpose_it = FALSE; transpose_it = FALSE;
switch (info->transform) { switch (info->transform) {
case JXFORM_NONE: case JXFORM_NONE:
if (info->x_crop_offset != 0 || info->y_crop_offset != 0) if (info->x_crop_offset != 0 || info->y_crop_offset != 0 ||
info->output_width > srcinfo->output_width ||
info->output_height > srcinfo->output_height)
need_workspace = TRUE; need_workspace = TRUE;
/* No workspace needed if neither cropping nor transforming */ /* No workspace needed if neither cropping nor transforming */
break; break;
@@ -1067,6 +1222,8 @@ jtransform_request_workspace (j_decompress_ptr srcinfo,
need_workspace = TRUE; need_workspace = TRUE;
transpose_it = TRUE; transpose_it = TRUE;
break; break;
case JXFORM_WIPE:
break;
} }
/* Allocate workspace if needed. /* Allocate workspace if needed.
@@ -1327,12 +1484,13 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo,
{ {
/* If force-to-grayscale is requested, adjust destination parameters */ /* If force-to-grayscale is requested, adjust destination parameters */
if (info->force_grayscale) { if (info->force_grayscale) {
/* First, ensure we have YCbCr or grayscale data, and that the source's /* First, ensure we have YCC or grayscale data, and that the source's
* Y channel is full resolution. (No reasonable person would make Y * Y channel is full resolution. (No reasonable person would make Y
* be less than full resolution, so actually coping with that case * be less than full resolution, so actually coping with that case
* isn't worth extra code space. But we check it to avoid crashing.) * isn't worth extra code space. But we check it to avoid crashing.)
*/ */
if (((dstinfo->jpeg_color_space == JCS_YCbCr && if ((((dstinfo->jpeg_color_space == JCS_YCbCr ||
dstinfo->jpeg_color_space == JCS_BG_YCC) &&
dstinfo->num_components == 3) || dstinfo->num_components == 3) ||
(dstinfo->jpeg_color_space == JCS_GRAYSCALE && (dstinfo->jpeg_color_space == JCS_GRAYSCALE &&
dstinfo->num_components == 1)) && dstinfo->num_components == 1)) &&
@@ -1427,7 +1585,11 @@ jtransform_execute_transform (j_decompress_ptr srcinfo,
*/ */
switch (info->transform) { switch (info->transform) {
case JXFORM_NONE: case JXFORM_NONE:
if (info->x_crop_offset != 0 || info->y_crop_offset != 0) if (info->output_width > srcinfo->output_width ||
info->output_height > srcinfo->output_height)
do_crop_ext(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
src_coef_arrays, dst_coef_arrays);
else if (info->x_crop_offset != 0 || info->y_crop_offset != 0)
do_crop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, do_crop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
src_coef_arrays, dst_coef_arrays); src_coef_arrays, dst_coef_arrays);
break; break;
@@ -1463,6 +1625,10 @@ jtransform_execute_transform (j_decompress_ptr srcinfo,
do_rot_270(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, do_rot_270(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
src_coef_arrays, dst_coef_arrays); src_coef_arrays, dst_coef_arrays);
break; break;
case JXFORM_WIPE:
do_wipe(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
src_coef_arrays, info->drop_width, info->drop_height);
break;
} }
} }

View File

@@ -1,7 +1,7 @@
/* /*
* transupp.h * transupp.h
* *
* Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1997-2013, Thomas G. Lane, Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -51,14 +51,17 @@
* *
* We also offer a lossless-crop option, which discards data outside a given * We also offer a lossless-crop option, which discards data outside a given
* image region but losslessly preserves what is inside. Like the rotate and * image region but losslessly preserves what is inside. Like the rotate and
* flip transforms, lossless crop is restricted by the JPEG format: the upper * flip transforms, lossless crop is restricted by the current JPEG format: the
* left corner of the selected region must fall on an iMCU boundary. If this * upper left corner of the selected region must fall on an iMCU boundary. If
* does not hold for the given crop parameters, we silently move the upper left * this does not hold for the given crop parameters, we silently move the upper
* corner up and/or left to make it so, simultaneously increasing the region * left corner up and/or left to make it so, simultaneously increasing the
* dimensions to keep the lower right crop corner unchanged. (Thus, the * region dimensions to keep the lower right crop corner unchanged. (Thus, the
* output image covers at least the requested region, but may cover more.) * output image covers at least the requested region, but may cover more.)
* The adjustment of the region dimensions may be optionally disabled. * The adjustment of the region dimensions may be optionally disabled.
* *
* A complementary lossless-wipe option is provided to discard (gray out) data
* inside a given image region while losslessly preserving what is outside.
*
* We also provide a lossless-resize option, which is kind of a lossless-crop * We also provide a lossless-resize option, which is kind of a lossless-crop
* operation in the DCT coefficient block domain - it discards higher-order * operation in the DCT coefficient block domain - it discards higher-order
* coefficients and losslessly preserves lower-order coefficients of a * coefficients and losslessly preserves lower-order coefficients of a
@@ -102,7 +105,8 @@ typedef enum {
JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */
JXFORM_ROT_90, /* 90-degree clockwise rotation */ JXFORM_ROT_90, /* 90-degree clockwise rotation */
JXFORM_ROT_180, /* 180-degree rotation */ JXFORM_ROT_180, /* 180-degree rotation */
JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ JXFORM_ROT_270, /* 270-degree clockwise (or 90 ccw) */
JXFORM_WIPE /* wipe */
} JXFORM_CODE; } JXFORM_CODE;
/* /*
@@ -130,7 +134,7 @@ typedef struct {
boolean perfect; /* if TRUE, fail if partial MCUs are requested */ boolean perfect; /* if TRUE, fail if partial MCUs are requested */
boolean trim; /* if TRUE, trim partial MCUs as needed */ boolean trim; /* if TRUE, trim partial MCUs as needed */
boolean force_grayscale; /* if TRUE, convert color image to grayscale */ boolean force_grayscale; /* if TRUE, convert color image to grayscale */
boolean crop; /* if TRUE, crop source image */ boolean crop; /* if TRUE, crop or wipe source image */
/* Crop parameters: application need not set these unless crop is TRUE. /* Crop parameters: application need not set these unless crop is TRUE.
* These can be filled in by jtransform_parse_crop_spec(). * These can be filled in by jtransform_parse_crop_spec().
@@ -151,6 +155,8 @@ typedef struct {
JDIMENSION output_height; JDIMENSION output_height;
JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */ JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */
JDIMENSION y_crop_offset; JDIMENSION y_crop_offset;
JDIMENSION drop_width; /* drop/wipe dimensions measured in iMCUs */
JDIMENSION drop_height;
int iMCU_sample_width; /* destination iMCU size */ int iMCU_sample_width; /* destination iMCU size */
int iMCU_sample_height; int iMCU_sample_height;
} jpeg_transform_info; } jpeg_transform_info;

103
usage.txt
View File

@@ -14,7 +14,7 @@ INTRODUCTION
These programs implement JPEG image encoding, decoding, and transcoding. These programs implement JPEG image encoding, decoding, and transcoding.
JPEG (pronounced "jay-peg") is a standardized compression method for JPEG (pronounced "jay-peg") is a standardized compression method for
full-color and gray-scale images. full-color and grayscale images.
GENERAL USAGE GENERAL USAGE
@@ -47,12 +47,13 @@ or
This syntax works on all systems, so it is useful for scripts. This syntax works on all systems, so it is useful for scripts.
The currently supported image file formats are: PPM (PBMPLUS color format), The currently supported image file formats are: PPM (PBMPLUS color format),
PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster Toolkit
format). (RLE is supported only if the URT library is available.) format). (RLE is supported only if the URT library is available, which it
cjpeg recognizes the input image format automatically, with the exception isn't on most non-Unix systems.) cjpeg recognizes the input image format
of some Targa-format files. You have to tell djpeg which format to generate. automatically, with the exception of some Targa-format files. You have to
tell djpeg which format to generate.
JPEG files are in the defacto standard JFIF file format. There are other, JPEG files are in the standard JFIF file format. There are other,
less widely used JPEG-based file formats, but we don't support them. less widely used JPEG-based file formats, but we don't support them.
All switch names may be abbreviated; for example, -grayscale may be written All switch names may be abbreviated; for example, -grayscale may be written
@@ -158,10 +159,10 @@ file size is about the same --- often a little smaller.
Switches for advanced users: Switches for advanced users:
-arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG -arithmetic Use arithmetic coding.
is not yet widely implemented, so many decoders will CAUTION: arithmetic coded JPEG is not yet widely
be unable to view an arithmetic coded JPEG file at implemented, so many decoders will be unable to
all. view an arithmetic coded JPEG file at all.
-block N Set DCT block size. All N from 1 to 16 are possible. -block N Set DCT block size. All N from 1 to 16 are possible.
Default is 8 (baseline format). Default is 8 (baseline format).
@@ -188,6 +189,25 @@ Switches for advanced users:
so many decoders will be unable to view a reversible so many decoders will be unable to view a reversible
color transformed JPEG file at all. color transformed JPEG file at all.
-bgycc Create big gamut YCC JPEG file.
In this type of encoding the color difference
components are quantized further by a factor of 2
compared to the normal Cb/Cr values, thus creating
space to allow larger color values with higher
saturation than the normal gamut limits to be encoded.
In order to compensate for the loss of color fidelity
compared to a normal YCC encoded file, the color
quantization tables can be adjusted accordingly.
For example, cjpeg -bgycc -quality 80,90 will give
similar results as cjpeg -quality 80.
CAUTION: For correct decompression a decoder with big
gamut YCC support (JFIF version 2) is required.
An old decoder may or may not display a big gamut YCC
encoded JPEG file, depending on JFIF version check
and corresponding warning/error configuration.
In case of a granted decompression the old decoder
will display the image with half saturated colors.
-dct int Use integer DCT method (default). -dct int Use integer DCT method (default).
-dct fast Use fast integer DCT (less accurate). -dct fast Use fast integer DCT (less accurate).
-dct float Use floating-point DCT method. -dct float Use floating-point DCT method.
@@ -273,10 +293,14 @@ The basic command line switches for djpeg are:
highest quality output.) Currently, this is equivalent highest quality output.) Currently, this is equivalent
to "-dct fast -nosmooth -onepass -dither ordered". to "-dct fast -nosmooth -onepass -dither ordered".
-grayscale Force gray-scale output even if JPEG file is color. -grayscale Force grayscale output even if JPEG file is color.
Useful for viewing on monochrome displays; also, Useful for viewing on monochrome displays; also,
djpeg runs noticeably faster in this mode. djpeg runs noticeably faster in this mode.
-rgb Force RGB output even if JPEG file is grayscale.
This is provided to support applications that don't
want to cope with grayscale as a separate case.
-scale M/N Scale the output image by a factor M/N. Currently -scale M/N Scale the output image by a factor M/N. Currently
supported scale factors are M/N with all M from 1 to supported scale factors are M/N with all M from 1 to
16, where N is the source DCT size, which is 8 for 16, where N is the source DCT size, which is 8 for
@@ -290,7 +314,7 @@ The basic command line switches for djpeg are:
-bmp Select BMP output format (Windows flavor). 8-bit -bmp Select BMP output format (Windows flavor). 8-bit
colormapped format is emitted if -colors or -grayscale colormapped format is emitted if -colors or -grayscale
is specified, or if the JPEG file is gray-scale; is specified, or if the JPEG file is grayscale;
otherwise, 24-bit full-color format is emitted. otherwise, 24-bit full-color format is emitted.
-gif Select GIF output format. Since GIF does not support -gif Select GIF output format. Since GIF does not support
@@ -300,18 +324,18 @@ The basic command line switches for djpeg are:
-os2 Select BMP output format (OS/2 1.x flavor). 8-bit -os2 Select BMP output format (OS/2 1.x flavor). 8-bit
colormapped format is emitted if -colors or -grayscale colormapped format is emitted if -colors or -grayscale
is specified, or if the JPEG file is gray-scale; is specified, or if the JPEG file is grayscale;
otherwise, 24-bit full-color format is emitted. otherwise, 24-bit full-color format is emitted.
-pnm Select PBMPLUS (PPM/PGM) output format (this is the -pnm Select PBMPLUS (PPM/PGM) output format (this is the
default format). PGM is emitted if the JPEG file is default format). PGM is emitted if the JPEG file is
gray-scale or if -grayscale is specified; otherwise grayscale or if -grayscale is specified; otherwise
PPM is emitted. PPM is emitted.
-rle Select RLE output format. (Requires URT library.) -rle Select RLE output format. (Requires URT library.)
-targa Select Targa output format. Gray-scale format is -targa Select Targa output format. Grayscale format is
emitted if the JPEG file is gray-scale or if emitted if the JPEG file is grayscale or if
-grayscale is specified; otherwise, colormapped format -grayscale is specified; otherwise, colormapped format
is emitted if -colors is specified; otherwise, 24-bit is emitted if -colors is specified; otherwise, 24-bit
full-color format is emitted. full-color format is emitted.
@@ -353,7 +377,7 @@ Switches for advanced users:
The one-pass method is faster and needs less memory, The one-pass method is faster and needs less memory,
but it produces a lower-quality image. -onepass is but it produces a lower-quality image. -onepass is
ignored unless you also say -colors N. Also, ignored unless you also say -colors N. Also,
the one-pass method is always used for gray-scale the one-pass method is always used for grayscale
output (the two-pass method is no improvement then). output (the two-pass method is no improvement then).
-maxmemory N Set limit for amount of memory to use in processing -maxmemory N Set limit for amount of memory to use in processing
@@ -387,7 +411,8 @@ quality settings to make very small JPEG files; the percentage improvement
is often a lot more than it is on larger files. (At present, -optimize is often a lot more than it is on larger files. (At present, -optimize
mode is always selected when generating progressive JPEG files.) mode is always selected when generating progressive JPEG files.)
GIF input files are no longer supported, to avoid the Unisys LZW patent. GIF input files are no longer supported, to avoid the Unisys LZW patent
(now expired).
(Conversion of GIF files to JPEG is usually a bad idea anyway.) (Conversion of GIF files to JPEG is usually a bad idea anyway.)
@@ -415,8 +440,9 @@ it may run out of memory even with -maxmemory 0. In that case you can still
decompress, with some loss of image quality, by specifying -onepass for decompress, with some loss of image quality, by specifying -onepass for
one-pass quantization. one-pass quantization.
To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files. These To avoid the Unisys LZW patent (now expired), djpeg produces uncompressed GIF
are larger than they should be, but are readable by standard GIF decoders. files. These are larger than they should be, but are readable by standard GIF
decoders.
HINTS FOR BOTH PROGRAMS HINTS FOR BOTH PROGRAMS
@@ -458,14 +484,16 @@ jpegtran performs various useful transformations of JPEG files.
It can translate the coded representation from one variant of JPEG to another, It can translate the coded representation from one variant of JPEG to another,
for example from baseline JPEG to progressive JPEG or vice versa. It can also for example from baseline JPEG to progressive JPEG or vice versa. It can also
perform some rearrangements of the image data, for example turning an image perform some rearrangements of the image data, for example turning an image
from landscape to portrait format by rotation. from landscape to portrait format by rotation. For EXIF files and JPEG files
containing Exif data, you may prefer to use exiftran instead.
jpegtran works by rearranging the compressed data (DCT coefficients), without jpegtran works by rearranging the compressed data (DCT coefficients), without
ever fully decoding the image. Therefore, its transformations are lossless: ever fully decoding the image. Therefore, its transformations are lossless:
there is no image degradation at all, which would not be true if you used there is no image degradation at all, which would not be true if you used
djpeg followed by cjpeg to accomplish the same conversion. But by the same djpeg followed by cjpeg to accomplish the same conversion. But by the same
token, jpegtran cannot perform lossy operations such as changing the image token, jpegtran cannot perform lossy operations such as changing the image
quality. quality. However, while the image data is losslessly transformed, metadata
can be removed. See the -copy option for specifics.
jpegtran uses a command line syntax similar to cjpeg or djpeg. jpegtran uses a command line syntax similar to cjpeg or djpeg.
On Unix-like systems, you say: On Unix-like systems, you say:
@@ -533,14 +561,21 @@ image region but losslessly preserves what is inside. Like the rotate and
flip transforms, lossless crop is restricted by the current JPEG format: the flip transforms, lossless crop is restricted by the current JPEG format: the
upper left corner of the selected region must fall on an iMCU boundary. If upper left corner of the selected region must fall on an iMCU boundary. If
this does not hold for the given crop parameters, we silently move the upper this does not hold for the given crop parameters, we silently move the upper
left corner up and/or left to make it so, simultaneously increasing the region left corner up and/or left to make it so, simultaneously increasing the
dimensions to keep the lower right crop corner unchanged. (Thus, the output region dimensions to keep the lower right crop corner unchanged. (Thus, the
image covers at least the requested region, but may cover more.) output image covers at least the requested region, but may cover more.)
The adjustment of the region dimensions may be optionally disabled by
attaching an 'f' character ("force") to the width or height number.
The image can be losslessly cropped by giving the switch: The image can be losslessly cropped by giving the switch:
-crop WxH+X+Y Crop to a rectangular subarea of width W, height H -crop WxH+X+Y Crop to a rectangular subarea of width W, height H
starting at point X,Y. starting at point X,Y.
A complementary lossless-wipe option is provided to discard (gray out) data
inside a given image region while losslessly preserving what is outside:
-wipe WxH+X+Y Wipe (gray out) a rectangular subarea of
width W, height H starting at point X,Y.
Other not-strictly-lossless transformation switches are: Other not-strictly-lossless transformation switches are:
-grayscale Force grayscale output. -grayscale Force grayscale output.
@@ -565,16 +600,18 @@ extended JPEG file at all.
jpegtran also recognizes these switches that control what to do with "extra" jpegtran also recognizes these switches that control what to do with "extra"
markers, such as comment blocks: markers, such as comment blocks:
-copy none Copy no extra markers from source file. This setting -copy none Copy no extra markers from source file.
suppresses all comments and other excess baggage This setting suppresses all comments
present in the source file. and other metadata in the source file.
-copy comments Copy only comment markers. This setting copies -copy comments Copy only comment markers.
comments from the source file, but discards This setting copies comments from the source file,
any other inessential (for image display) data. but discards any other metadata.
-copy all Copy all extra markers. This setting preserves -copy all Copy all extra markers. This setting preserves
miscellaneous markers found in the source file, such metadata found in the source file, such as JFIF
as JFIF thumbnails, Exif data, and Photoshop settings. thumbnails, Exif data, and Photoshop settings.
In some files these extra markers can be sizable. In some files these extra markers can be sizable.
Note that this option will copy thumbnails as-is;
they will not be transformed.
The default behavior is -copy comments. (Note: in IJG releases v6 and v6a, The default behavior is -copy comments. (Note: in IJG releases v6 and v6a,
jpegtran always did the equivalent of -copy none.) jpegtran always did the equivalent of -copy none.)

View File

@@ -2,6 +2,7 @@
* wrgif.c * wrgif.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -218,7 +219,7 @@ put_3bytes (gif_dest_ptr dinfo, int val)
LOCAL(void) LOCAL(void)
emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap)
/* Output the GIF file header, including color map */ /* Output the GIF file header, including color map */
/* If colormap==NULL, synthesize a gray-scale colormap */ /* If colormap==NULL, synthesize a grayscale colormap */
{ {
int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte; int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte;
int cshift = dinfo->cinfo->data_precision - 8; int cshift = dinfo->cinfo->data_precision - 8;
@@ -270,7 +271,7 @@ emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap)
put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift);
} }
} else { } else {
/* Create a gray-scale map of num_colors values, range 0..255 */ /* Create a grayscale map of num_colors values, range 0..255 */
put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1));
} }
} else { } else {
@@ -393,7 +394,7 @@ jinit_write_gif (j_decompress_ptr cinfo)
((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->output_width, (JDIMENSION) 1); ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->output_width, (JDIMENSION) 1);
dest->pub.buffer_height = 1; dest->pub.buffer_height = 1;
return (djpeg_dest_ptr) dest; return &dest->pub;
} }
#endif /* GIF_SUPPORTED */ #endif /* GIF_SUPPORTED */

View File

@@ -2,6 +2,7 @@
* wrjpgcom.c * wrjpgcom.c
* *
* Copyright (C) 1994-1997, Thomas G. Lane. * Copyright (C) 1994-1997, Thomas G. Lane.
* Modified 2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -453,6 +454,11 @@ main (int argc, char **argv)
comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH);
if (comment_arg == NULL) if (comment_arg == NULL)
ERREXIT("Insufficient memory"); ERREXIT("Insufficient memory");
if (strlen(argv[argn]+1) >= (size_t) MAX_COM_LENGTH) {
fprintf(stderr, "Comment text may not exceed %u bytes\n",
(unsigned int) MAX_COM_LENGTH);
exit(EXIT_FAILURE);
}
strcpy(comment_arg, argv[argn]+1); strcpy(comment_arg, argv[argn]+1);
for (;;) { for (;;) {
comment_length = (unsigned int) strlen(comment_arg); comment_length = (unsigned int) strlen(comment_arg);
@@ -462,9 +468,19 @@ main (int argc, char **argv)
} }
if (++argn >= argc) if (++argn >= argc)
ERREXIT("Missing ending quote mark"); ERREXIT("Missing ending quote mark");
if (strlen(comment_arg) + 1 + strlen(argv[argn]) >=
(size_t) MAX_COM_LENGTH) {
fprintf(stderr, "Comment text may not exceed %u bytes\n",
(unsigned int) MAX_COM_LENGTH);
exit(EXIT_FAILURE);
}
strcat(comment_arg, " "); strcat(comment_arg, " ");
strcat(comment_arg, argv[argn]); strcat(comment_arg, argv[argn]);
} }
} else if (strlen(comment_arg) >= (size_t) MAX_COM_LENGTH) {
fprintf(stderr, "Comment text may not exceed %u bytes\n",
(unsigned int) MAX_COM_LENGTH);
exit(EXIT_FAILURE);
} }
comment_length = (unsigned int) strlen(comment_arg); comment_length = (unsigned int) strlen(comment_arg);
} else } else

View File

@@ -2,6 +2,7 @@
* wrtarga.c * wrtarga.c
* *
* Copyright (C) 1991-1996, Thomas G. Lane. * Copyright (C) 1991-1996, Thomas G. Lane.
* Modified 2015 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -73,7 +74,7 @@ write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors)
targaheader[17] = 0x20; /* Top-down, non-interlaced */ targaheader[17] = 0x20; /* Top-down, non-interlaced */
if (cinfo->out_color_space == JCS_GRAYSCALE) { if (cinfo->out_color_space == JCS_GRAYSCALE) {
targaheader[2] = 3; /* image type = uncompressed gray-scale */ targaheader[2] = 3; /* image type = uncompressed grayscale */
targaheader[16] = 8; /* bits per pixel */ targaheader[16] = 8; /* bits per pixel */
} else { /* must be RGB */ } else { /* must be RGB */
if (num_colors > 0) { if (num_colors > 0) {
@@ -247,7 +248,7 @@ jinit_write_targa (j_decompress_ptr cinfo)
((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width, (JDIMENSION) 1); ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width, (JDIMENSION) 1);
dest->pub.buffer_height = 1; dest->pub.buffer_height = 1;
return (djpeg_dest_ptr) dest; return &dest->pub;
} }
#endif /* TARGA_SUPPORTED */ #endif /* TARGA_SUPPORTED */