Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a560e4b423 | ||
|
|
fc11193e7a | ||
|
|
e7f88aec23 | ||
|
|
5829cb2398 | ||
|
|
c39ec149e8 | ||
|
|
a4ecaacde6 | ||
|
|
f18f81b7e2 | ||
|
|
989630f70c |
29
Makefile.am
29
Makefile.am
@@ -33,16 +33,17 @@ DOCS= README install.txt usage.txt wizard.txt example.c libjpeg.txt \
|
||||
structure.txt coderules.txt filelist.txt change.log
|
||||
|
||||
# Makefiles for various systems
|
||||
MKFILES= configure Makefile.in makefile.ansi makefile.unix 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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
|
||||
# Configuration files
|
||||
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
|
||||
@@ -50,11 +51,11 @@ CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
|
||||
jconfig.vms
|
||||
|
||||
# Support scripts for configure
|
||||
CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing
|
||||
CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp \
|
||||
missing ar-lib
|
||||
|
||||
# Miscellaneous support files
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
OTHERFILES= jconfig.txt ckconfig.c jmemdosa.asm libjpeg.map
|
||||
|
||||
# Test support files
|
||||
TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
|
||||
@@ -118,7 +119,7 @@ uninstall-local:
|
||||
# Run tests
|
||||
test: check-local
|
||||
check-local:
|
||||
$(RM) testout*
|
||||
rm -f testout*
|
||||
./djpeg -dct int -ppm -outfile testout.ppm $(srcdir)/testorig.jpg
|
||||
./djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(srcdir)/testorig.jpg
|
||||
./cjpeg -dct int -outfile testout.jpg $(srcdir)/testimg.ppm
|
||||
|
||||
732
Makefile.in
732
Makefile.in
File diff suppressed because it is too large
Load Diff
161
README
161
README
@@ -1,10 +1,10 @@
|
||||
The Independent JPEG Group's JPEG software
|
||||
==========================================
|
||||
|
||||
README for release 7 of 27-Jun-2009
|
||||
===================================
|
||||
README for release 9b of 17-Jan-2016
|
||||
====================================
|
||||
|
||||
This distribution contains the seventh 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
|
||||
to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
|
||||
|
||||
@@ -13,7 +13,8 @@ Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson,
|
||||
Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers,
|
||||
and other members of the Independent JPEG Group.
|
||||
|
||||
IJG is not affiliated with the official ISO JPEG standards committee.
|
||||
IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee
|
||||
(previously known as JPEG, together with ITU-T SG16).
|
||||
|
||||
|
||||
DOCUMENTATION ROADMAP
|
||||
@@ -59,7 +60,7 @@ OVERVIEW
|
||||
|
||||
This package contains C software to implement JPEG image encoding, decoding,
|
||||
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
|
||||
compression processes. Provision is made for supporting all variants of these
|
||||
@@ -114,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,
|
||||
its user, assume the entire risk as to its quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991-2009, Thomas G. Lane, Guido Vollbeding.
|
||||
This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
@@ -145,15 +146,6 @@ commercial products, provided that all warranty or liability claims are
|
||||
assumed by the product vendor.
|
||||
|
||||
|
||||
ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
|
||||
sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
|
||||
ansi2knr.c is NOT covered by the above copyright and conditions, but instead
|
||||
by the usual distribution terms of the Free Software Foundation; principally,
|
||||
that you must include source code if you redistribute it. (See the file
|
||||
ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
|
||||
of any program generated from the IJG code, this does not limit you more than
|
||||
the foregoing paragraphs do.
|
||||
|
||||
The Unix configuration script "configure" was produced with GNU Autoconf.
|
||||
It is copyright by the Free Software Foundation but is freely distributable.
|
||||
The same holds for its supporting scripts (config.guess, config.sub,
|
||||
@@ -161,16 +153,11 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium
|
||||
but is also freely distributable.
|
||||
|
||||
The IJG distribution formerly included code to read and write GIF files.
|
||||
To avoid entanglement with the Unisys LZW patent, GIF reading support has
|
||||
been removed altogether, and the GIF writer has been simplified to produce
|
||||
"uncompressed GIFs". This technique does not use the LZW algorithm; the
|
||||
resulting GIF files are larger than usual, but are readable 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."
|
||||
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
|
||||
support has been removed altogether, and the GIF writer has been simplified
|
||||
to produce "uncompressed GIFs". This technique does not use the LZW
|
||||
algorithm; the resulting GIF files are larger than usual, but are readable
|
||||
by all standard GIF decoders.
|
||||
|
||||
|
||||
REFERENCES
|
||||
@@ -184,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.
|
||||
(Adjacent articles in that issue discuss MPEG motion picture compression,
|
||||
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
|
||||
available at http://www.ijg.org/files/wallace.ps.gz. The file (actually
|
||||
handy, a PDF file containing a revised version of Wallace's article is
|
||||
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)
|
||||
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,
|
||||
@@ -221,18 +208,25 @@ Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS
|
||||
10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of
|
||||
Continuous-tone Still Images, Part 2: Compliance testing" and has document
|
||||
numbers ISO/IEC IS 10918-2, ITU-T T.83.
|
||||
IJG JPEG 8 introduced an implementation of the JPEG SmartScale extension
|
||||
which is specified in two documents: A contributed document at ITU and ISO
|
||||
with title "ITU-T JPEG-Plus Proposal for Extending ITU-T T.81 for Advanced
|
||||
Image Coding", April 2006, Geneva, Switzerland. The latest version of this
|
||||
document is Revision 3. And a contributed document ISO/IEC JTC1/SC29/WG1 N
|
||||
5799 with title "Evolution of JPEG", June/July 2011, Berlin, Germany.
|
||||
IJG JPEG 9 introduces a reversible color transform for improved lossless
|
||||
compression which is described in a contributed document ISO/IEC JTC1/SC29/
|
||||
WG1 N 6080 with title "JPEG 9 Lossless Coding", June/July 2012, Paris,
|
||||
France.
|
||||
|
||||
The JPEG standard does not specify all details of an interchangeable file
|
||||
format. For the omitted details we follow the "JFIF" conventions, revision
|
||||
1.02. A copy of the JFIF spec is available from:
|
||||
Literature Department
|
||||
C-Cube Microsystems, Inc.
|
||||
1778 McCarthy Blvd.
|
||||
Milpitas, CA 95035
|
||||
phone (408) 944-6300, fax (408) 944-6314
|
||||
A PostScript version of this document is available at
|
||||
http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at
|
||||
http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures.
|
||||
format. For the omitted details we follow the "JFIF" conventions, version 2.
|
||||
JFIF version 1 has been adopted as Recommendation ITU-T T.871 (05/2011) :
|
||||
Information technology - Digital compression and coding of continuous-tone
|
||||
still images: JPEG File Interchange Format (JFIF). It is available as a
|
||||
free download in PDF file format from http://www.itu.int/rec/T-REC-T.871.
|
||||
A PDF file of the older JFIF document is available at
|
||||
http://www.w3.org/Graphics/JPEG/jfif3.pdf.
|
||||
|
||||
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
|
||||
@@ -252,8 +246,8 @@ ARCHIVE LOCATIONS
|
||||
The "official" archive site for this software is www.ijg.org.
|
||||
The most recent released version can always be found there in
|
||||
directory "files". This particular version will be archived as
|
||||
http://www.ijg.org/files/jpegsrc.v7.tar.gz, and in Windows-compatible
|
||||
"zip" archive format as http://www.ijg.org/files/jpegsr7.zip.
|
||||
http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible
|
||||
"zip" archive format as http://www.ijg.org/files/jpegsr9b.zip.
|
||||
|
||||
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
||||
general information about JPEG.
|
||||
@@ -269,9 +263,8 @@ with body
|
||||
ACKNOWLEDGMENTS
|
||||
===============
|
||||
|
||||
Thank to Juergen Bruder of the Georg-Cantor-Organization at the
|
||||
Martin-Luther-University Halle for providing me with a copy of the common
|
||||
DCT algorithm article, only to find out that I had come to the same result
|
||||
Thank to Juergen Bruder for providing me with a copy of the common DCT
|
||||
algorithm article, only to find out that I had come to the same result
|
||||
in a more direct and comprehensible way with a more generative approach.
|
||||
|
||||
Thank to Istvan Sebestyen and Joan L. Mitchell for inviting me to the
|
||||
@@ -280,11 +273,16 @@ ITU JPEG (Study Group 16) meeting in Geneva, Switzerland.
|
||||
Thank to Thomas Wiegand and Gary Sullivan for inviting me to the
|
||||
Joint Video Team (MPEG & ITU) meeting in Geneva, Switzerland.
|
||||
|
||||
Thank to Thomas Richter and Daniel Lee for inviting me to the
|
||||
ISO/IEC JTC1/SC29/WG1 (previously known as JPEG, together with ITU-T SG16)
|
||||
meeting in Berlin, Germany.
|
||||
|
||||
Thank to John Korejwa and Massimo Ballerini for inviting me to
|
||||
fruitful consultations in Boston, MA and Milan, Italy.
|
||||
|
||||
Thank to Hendrik Elstner, Roland Fassauer, and Simone Zuck for
|
||||
corresponding business development.
|
||||
Thank to Hendrik Elstner, Roland Fassauer, Simone Zuck, Guenther
|
||||
Maier-Gerber, Walter Stoeber, Fred Schmitz, and Norbert Braunagel
|
||||
for corresponding business development.
|
||||
|
||||
Thank to Nico Zschach and Dirk Stelling of the technical support team
|
||||
at the Digital Images company in Halle for providing me with extra
|
||||
@@ -293,6 +291,8 @@ equipment for configuration tests.
|
||||
Thank to Richard F. Lyon (then of Foveon Inc.) for fruitful
|
||||
communication about JPEG configuration in Sigma Photo Pro software.
|
||||
|
||||
Thank to Andrew Finkenstadt for hosting the ijg.org site.
|
||||
|
||||
Last but not least special thank to Thomas G. Lane for the original
|
||||
design and development of this singular software package.
|
||||
|
||||
@@ -300,23 +300,76 @@ design and development of this singular software package.
|
||||
FILE FORMAT WARS
|
||||
================
|
||||
|
||||
The ISO JPEG standards committee actually promotes different formats like
|
||||
JPEG-2000 or JPEG-XR which are incompatible with original DCT-based JPEG
|
||||
and which are based on faulty technologies. IJG therefore does not and
|
||||
will not support such momentary mistakes (see REFERENCES).
|
||||
We have little or no sympathy for the promotion of these formats. Indeed,
|
||||
one of the original reasons for developing this free software was to help
|
||||
force convergence on common, interoperable format standards for JPEG files.
|
||||
The ISO/IEC JTC1/SC29/WG1 standards committee (previously known as JPEG,
|
||||
together with ITU-T SG16) currently promotes different formats containing
|
||||
the name "JPEG" which is misleading because these formats are incompatible
|
||||
with original DCT-based JPEG and are based on faulty technologies.
|
||||
IJG therefore does not and will not support such momentary mistakes
|
||||
(see REFERENCES).
|
||||
There exist also distributions under the name "OpenJPEG" promoting such
|
||||
kind of formats which is misleading because they don't support original
|
||||
JPEG images.
|
||||
We have no sympathy for the promotion of inferior formats. Indeed, one of
|
||||
the original reasons for developing this free software was to help force
|
||||
convergence on common, interoperable format standards for JPEG files.
|
||||
Don't use an incompatible file format!
|
||||
(In any case, our decoder will remain capable of reading existing JPEG
|
||||
image files indefinitely.)
|
||||
|
||||
The ISO committee pretends to be "responsible for the popular JPEG" in their
|
||||
public reports which is not true because they don't respond to actual
|
||||
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
|
||||
name "libjpeg" which is misleading because they don't have the features and
|
||||
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
|
||||
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
|
||||
libjpeg distributions and containing mathematically incorrect code.
|
||||
The other one claims to be a "derivative" or "fork" of the original libjpeg,
|
||||
but violates the license conditions as described under LEGAL ISSUES above
|
||||
and violates basic C programming properties.
|
||||
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!
|
||||
|
||||
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
|
||||
=====
|
||||
|
||||
v7 is basically just a necessary interim release, paving the way for a
|
||||
major breakthrough in image coding technology with the next v8 package
|
||||
which is scheduled for release in the year 2010.
|
||||
Version 9 is the second release of a new generation JPEG standard
|
||||
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...
|
||||
|
||||
Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org.
|
||||
|
||||
4825
aclocal.m4
vendored
4825
aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
36
ansi2knr.1
36
ansi2knr.1
@@ -1,36 +0,0 @@
|
||||
.TH ANSI2KNR 1 "19 Jan 1996"
|
||||
.SH NAME
|
||||
ansi2knr \- convert ANSI C to Kernighan & Ritchie C
|
||||
.SH SYNOPSIS
|
||||
.I ansi2knr
|
||||
[--varargs] input_file [output_file]
|
||||
.SH DESCRIPTION
|
||||
If no output_file is supplied, output goes to stdout.
|
||||
.br
|
||||
There are no error messages.
|
||||
.sp
|
||||
.I ansi2knr
|
||||
recognizes function definitions by seeing a non-keyword identifier at the left
|
||||
margin, followed by a left parenthesis, with a right parenthesis as the last
|
||||
character on the line, and with a left brace as the first token on the
|
||||
following line (ignoring possible intervening comments). It will recognize a
|
||||
multi-line header provided that no intervening line ends with a left or right
|
||||
brace or a semicolon. These algorithms ignore whitespace and comments, except
|
||||
that the function name must be the first thing on the line.
|
||||
.sp
|
||||
The following constructs will confuse it:
|
||||
.br
|
||||
- Any other construct that starts at the left margin and follows the
|
||||
above syntax (such as a macro or function call).
|
||||
.br
|
||||
- Some macros that tinker with the syntax of the function header.
|
||||
.sp
|
||||
The --varargs switch is obsolete, and is recognized only for
|
||||
backwards compatibility. The present version of
|
||||
.I ansi2knr
|
||||
will always attempt to convert a ... argument to va_alist and va_dcl.
|
||||
.SH AUTHOR
|
||||
L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
|
||||
continues to maintain the current version; most of the code in the current
|
||||
version is his work. ansi2knr also includes contributions by Francois
|
||||
Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
|
||||
739
ansi2knr.c
739
ansi2knr.c
@@ -1,739 +0,0 @@
|
||||
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */
|
||||
|
||||
/*$Id: ansi2knr.c,v 1.14 2003/09/06 05:36:56 eggert Exp $*/
|
||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
||||
|
||||
/*
|
||||
ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY. No author or distributor accepts responsibility to anyone for the
|
||||
consequences of using it or for whether it serves any particular purpose or
|
||||
works at all, unless he says so in writing. Refer to the GNU General Public
|
||||
License (the "GPL") for full details.
|
||||
|
||||
Everyone is granted permission to copy, modify and redistribute ansi2knr,
|
||||
but only under the conditions described in the GPL. A copy of this license
|
||||
is supposed to have been given to you along with ansi2knr so you can know
|
||||
your rights and responsibilities. It should be in a file named COPYLEFT,
|
||||
or, if there is no file named COPYLEFT, a file named COPYING. Among other
|
||||
things, the copyright notice and this notice must be preserved on all
|
||||
copies.
|
||||
|
||||
We explicitly state here what we believe is already implied by the GPL: if
|
||||
the ansi2knr program is distributed as a separate set of sources and a
|
||||
separate executable file which are aggregated on a storage medium together
|
||||
with another program, this in itself does not bring the other program under
|
||||
the GPL, nor does the mere fact that such a program or the procedures for
|
||||
constructing it invoke the ansi2knr executable bring any other part of the
|
||||
program under the GPL.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
|
||||
* --filename provides the file name for the #line directive in the output,
|
||||
* overriding input_file (if present).
|
||||
* If no input_file is supplied, input is read from stdin.
|
||||
* If no output_file is supplied, output goes to stdout.
|
||||
* There are no error messages.
|
||||
*
|
||||
* ansi2knr recognizes function definitions by seeing a non-keyword
|
||||
* identifier at the left margin, followed by a left parenthesis, with a
|
||||
* right parenthesis as the last character on the line, and with a left
|
||||
* brace as the first token on the following line (ignoring possible
|
||||
* intervening comments and/or preprocessor directives), except that a line
|
||||
* consisting of only
|
||||
* identifier1(identifier2)
|
||||
* will not be considered a function definition unless identifier2 is
|
||||
* the word "void", and a line consisting of
|
||||
* identifier1(identifier2, <<arbitrary>>)
|
||||
* will not be considered a function definition.
|
||||
* ansi2knr will recognize a multi-line header provided that no intervening
|
||||
* line ends with a left or right brace or a semicolon. These algorithms
|
||||
* ignore whitespace, comments, and preprocessor directives, except that
|
||||
* the function name must be the first thing on the line. The following
|
||||
* constructs will confuse it:
|
||||
* - Any other construct that starts at the left margin and
|
||||
* follows the above syntax (such as a macro or function call).
|
||||
* - Some macros that tinker with the syntax of function headers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The original and principal author of ansi2knr is L. Peter Deutsch
|
||||
* <ghost@aladdin.com>. Other authors are noted in the change history
|
||||
* that follows (in reverse chronological order):
|
||||
|
||||
lpd 2000-04-12 backs out Eggert's changes because of bugs:
|
||||
- concatlits didn't declare the type of its bufend argument;
|
||||
- concatlits didn't recognize when it was inside a comment;
|
||||
- scanstring could scan backward past the beginning of the string; when
|
||||
- the check for \ + newline in scanstring was unnecessary.
|
||||
|
||||
2000-03-05 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Add support for concatenated string literals.
|
||||
* ansi2knr.c (concatlits): New decl.
|
||||
(main): Invoke concatlits to concatenate string literals.
|
||||
(scanstring): Handle backslash-newline correctly. Work with
|
||||
character constants. Fix bug when scanning backwards through
|
||||
backslash-quote. Check for unterminated strings.
|
||||
(convert1): Parse character constants, too.
|
||||
(appendline, concatlits): New functions.
|
||||
* ansi2knr.1: Document this.
|
||||
|
||||
lpd 1999-08-17 added code to allow preprocessor directives
|
||||
wherever comments are allowed
|
||||
lpd 1999-04-12 added minor fixes from Pavel Roskin
|
||||
<pavel_roskin@geocities.com> for clean compilation with
|
||||
gcc -W -Wall
|
||||
lpd 1999-03-22 added hack to recognize lines consisting of
|
||||
identifier1(identifier2, xxx) as *not* being procedures
|
||||
lpd 1999-02-03 made indentation of preprocessor commands consistent
|
||||
lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
|
||||
endless loop; quoted strings within an argument list
|
||||
confused the parser
|
||||
lpd 1999-01-24 added a check for write errors on the output,
|
||||
suggested by Jim Meyering <meyering@ascend.com>
|
||||
lpd 1998-11-09 added further hack to recognize identifier(void)
|
||||
as being a procedure
|
||||
lpd 1998-10-23 added hack to recognize lines consisting of
|
||||
identifier1(identifier2) as *not* being procedures
|
||||
lpd 1997-12-08 made input_file optional; only closes input and/or
|
||||
output file if not stdin or stdout respectively; prints
|
||||
usage message on stderr rather than stdout; adds
|
||||
--filename switch (changes suggested by
|
||||
<ceder@lysator.liu.se>)
|
||||
lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
|
||||
compilers that don't understand void, as suggested by
|
||||
Tom Lane
|
||||
lpd 1996-01-15 changed to require that the first non-comment token
|
||||
on the line following a function header be a left brace,
|
||||
to reduce sensitivity to macros, as suggested by Tom Lane
|
||||
<tgl@sss.pgh.pa.us>
|
||||
lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
|
||||
undefined preprocessor symbols as 0; changed all #ifdefs
|
||||
for configuration symbols to #ifs
|
||||
lpd 1995-04-05 changed copyright notice to make it clear that
|
||||
including ansi2knr in a program does not bring the entire
|
||||
program under the GPL
|
||||
lpd 1994-12-18 added conditionals for systems where ctype macros
|
||||
don't handle 8-bit characters properly, suggested by
|
||||
Francois Pinard <pinard@iro.umontreal.ca>;
|
||||
removed --varargs switch (this is now the default)
|
||||
lpd 1994-10-10 removed CONFIG_BROKETS conditional
|
||||
lpd 1994-07-16 added some conditionals to help GNU `configure',
|
||||
suggested by Francois Pinard <pinard@iro.umontreal.ca>;
|
||||
properly erase prototype args in function parameters,
|
||||
contributed by Jim Avera <jima@netcom.com>;
|
||||
correct error in writeblanks (it shouldn't erase EOLs)
|
||||
lpd 1989-xx-xx original version
|
||||
*/
|
||||
|
||||
/* Most of the conditionals here are to make ansi2knr work with */
|
||||
/* or without the GNU configure machinery. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
|
||||
/*
|
||||
For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
|
||||
This will define HAVE_CONFIG_H and so, activate the following lines.
|
||||
*/
|
||||
|
||||
# if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# else
|
||||
# include <strings.h>
|
||||
# endif
|
||||
|
||||
#else /* not HAVE_CONFIG_H */
|
||||
|
||||
/* Otherwise do it the hard way */
|
||||
|
||||
# ifdef BSD
|
||||
# include <strings.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern int strlen(), strncmp();
|
||||
# else
|
||||
# include <string.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* not HAVE_CONFIG_H */
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
/*
|
||||
malloc and free should be declared in stdlib.h,
|
||||
but if you've got a K&R compiler, they probably aren't.
|
||||
*/
|
||||
# ifdef MSDOS
|
||||
# include <malloc.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern char *malloc();
|
||||
extern void free();
|
||||
# else
|
||||
extern char *malloc();
|
||||
extern int free();
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Define NULL (for *very* old compilers). */
|
||||
#ifndef NULL
|
||||
# define NULL (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The ctype macros don't always handle 8-bit characters correctly.
|
||||
* Compensate for this here.
|
||||
*/
|
||||
#ifdef isascii
|
||||
# undef HAVE_ISASCII /* just in case */
|
||||
# define HAVE_ISASCII 1
|
||||
#else
|
||||
#endif
|
||||
#if STDC_HEADERS || !HAVE_ISASCII
|
||||
# define is_ascii(c) 1
|
||||
#else
|
||||
# define is_ascii(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define is_space(c) (is_ascii(c) && isspace(c))
|
||||
#define is_alpha(c) (is_ascii(c) && isalpha(c))
|
||||
#define is_alnum(c) (is_ascii(c) && isalnum(c))
|
||||
|
||||
/* Scanning macros */
|
||||
#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
|
||||
#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
|
||||
|
||||
/* Forward references */
|
||||
char *ppdirforward();
|
||||
char *ppdirbackward();
|
||||
char *skipspace();
|
||||
char *scanstring();
|
||||
int writeblanks();
|
||||
int test1();
|
||||
int convert1();
|
||||
|
||||
/* The main program */
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{ FILE *in = stdin;
|
||||
FILE *out = stdout;
|
||||
char *filename = 0;
|
||||
char *program_name = argv[0];
|
||||
char *output_name = 0;
|
||||
#define bufsize 5000 /* arbitrary size */
|
||||
char *buf;
|
||||
char *line;
|
||||
char *more;
|
||||
char *usage =
|
||||
"Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
|
||||
/*
|
||||
* In previous versions, ansi2knr recognized a --varargs switch.
|
||||
* If this switch was supplied, ansi2knr would attempt to convert
|
||||
* a ... argument to va_alist and va_dcl; if this switch was not
|
||||
* supplied, ansi2knr would simply drop any such arguments.
|
||||
* Now, ansi2knr always does this conversion, and we only
|
||||
* check for this switch for backward compatibility.
|
||||
*/
|
||||
int convert_varargs = 1;
|
||||
int output_error;
|
||||
|
||||
while ( argc > 1 && argv[1][0] == '-' ) {
|
||||
if ( !strcmp(argv[1], "--varargs") ) {
|
||||
convert_varargs = 1;
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
|
||||
filename = argv[2];
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name,
|
||||
argv[1]);
|
||||
fprintf(stderr, usage);
|
||||
exit(1);
|
||||
}
|
||||
switch ( argc )
|
||||
{
|
||||
default:
|
||||
fprintf(stderr, usage);
|
||||
exit(0);
|
||||
case 3:
|
||||
output_name = argv[2];
|
||||
out = fopen(output_name, "w");
|
||||
if ( out == NULL ) {
|
||||
fprintf(stderr, "%s: Cannot open output file %s\n",
|
||||
program_name, output_name);
|
||||
exit(1);
|
||||
}
|
||||
/* falls through */
|
||||
case 2:
|
||||
in = fopen(argv[1], "r");
|
||||
if ( in == NULL ) {
|
||||
fprintf(stderr, "%s: Cannot open input file %s\n",
|
||||
program_name, argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
if ( filename == 0 )
|
||||
filename = argv[1];
|
||||
/* falls through */
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
if ( filename )
|
||||
fprintf(out, "#line 1 \"%s\"\n", filename);
|
||||
buf = malloc(bufsize);
|
||||
if ( buf == NULL )
|
||||
{
|
||||
fprintf(stderr, "Unable to allocate read buffer!\n");
|
||||
exit(1);
|
||||
}
|
||||
line = buf;
|
||||
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
|
||||
{
|
||||
test: line += strlen(line);
|
||||
switch ( test1(buf) )
|
||||
{
|
||||
case 2: /* a function header */
|
||||
convert1(buf, out, 1, convert_varargs);
|
||||
break;
|
||||
case 1: /* a function */
|
||||
/* Check for a { at the start of the next line. */
|
||||
more = ++line;
|
||||
f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
|
||||
goto wl;
|
||||
if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
|
||||
goto wl;
|
||||
switch ( *skipspace(ppdirforward(more), 1) )
|
||||
{
|
||||
case '{':
|
||||
/* Definitely a function header. */
|
||||
convert1(buf, out, 0, convert_varargs);
|
||||
fputs(more, out);
|
||||
break;
|
||||
case 0:
|
||||
/* The next line was blank or a comment: */
|
||||
/* keep scanning for a non-comment. */
|
||||
line += strlen(line);
|
||||
goto f;
|
||||
default:
|
||||
/* buf isn't a function header, but */
|
||||
/* more might be. */
|
||||
fputs(buf, out);
|
||||
strcpy(buf, more);
|
||||
line = buf;
|
||||
goto test;
|
||||
}
|
||||
break;
|
||||
case -1: /* maybe the start of a function */
|
||||
if ( line != buf + (bufsize - 1) ) /* overflow check */
|
||||
continue;
|
||||
/* falls through */
|
||||
default: /* not a function */
|
||||
wl: fputs(buf, out);
|
||||
break;
|
||||
}
|
||||
line = buf;
|
||||
}
|
||||
if ( line != buf )
|
||||
fputs(buf, out);
|
||||
free(buf);
|
||||
if ( output_name ) {
|
||||
output_error = ferror(out);
|
||||
output_error |= fclose(out);
|
||||
} else { /* out == stdout */
|
||||
fflush(out);
|
||||
output_error = ferror(out);
|
||||
}
|
||||
if ( output_error ) {
|
||||
fprintf(stderr, "%s: error writing to %s\n", program_name,
|
||||
(output_name ? output_name : "stdout"));
|
||||
exit(1);
|
||||
}
|
||||
if ( in != stdin )
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip forward or backward over one or more preprocessor directives.
|
||||
*/
|
||||
char *
|
||||
ppdirforward(p)
|
||||
char *p;
|
||||
{
|
||||
for (; *p == '#'; ++p) {
|
||||
for (; *p != '\r' && *p != '\n'; ++p)
|
||||
if (*p == 0)
|
||||
return p;
|
||||
if (*p == '\r' && p[1] == '\n')
|
||||
++p;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
char *
|
||||
ppdirbackward(p, limit)
|
||||
char *p;
|
||||
char *limit;
|
||||
{
|
||||
char *np = p;
|
||||
|
||||
for (;; p = --np) {
|
||||
if (*np == '\n' && np[-1] == '\r')
|
||||
--np;
|
||||
for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np)
|
||||
if (np[-1] == 0)
|
||||
return np;
|
||||
if (*np != '#')
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip over whitespace, comments, and preprocessor directives,
|
||||
* in either direction.
|
||||
*/
|
||||
char *
|
||||
skipspace(p, dir)
|
||||
char *p;
|
||||
int dir; /* 1 for forward, -1 for backward */
|
||||
{
|
||||
for ( ; ; ) {
|
||||
while ( is_space(*p) )
|
||||
p += dir;
|
||||
if ( !(*p == '/' && p[dir] == '*') )
|
||||
break;
|
||||
p += dir; p += dir;
|
||||
while ( !(*p == '*' && p[dir] == '/') ) {
|
||||
if ( *p == 0 )
|
||||
return p; /* multi-line comment?? */
|
||||
p += dir;
|
||||
}
|
||||
p += dir; p += dir;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Scan over a quoted string, in either direction. */
|
||||
char *
|
||||
scanstring(p, dir)
|
||||
char *p;
|
||||
int dir;
|
||||
{
|
||||
for (p += dir; ; p += dir)
|
||||
if (*p == '"' && p[-dir] != '\\')
|
||||
return p + dir;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write blanks over part of a string.
|
||||
* Don't overwrite end-of-line characters.
|
||||
*/
|
||||
int
|
||||
writeblanks(start, end)
|
||||
char *start;
|
||||
char *end;
|
||||
{ char *p;
|
||||
for ( p = start; p < end; p++ )
|
||||
if ( *p != '\r' && *p != '\n' )
|
||||
*p = ' ';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test whether the string in buf is a function definition.
|
||||
* The string may contain and/or end with a newline.
|
||||
* Return as follows:
|
||||
* 0 - definitely not a function definition;
|
||||
* 1 - definitely a function definition;
|
||||
* 2 - definitely a function prototype (NOT USED);
|
||||
* -1 - may be the beginning of a function definition,
|
||||
* append another line and look again.
|
||||
* The reason we don't attempt to convert function prototypes is that
|
||||
* Ghostscript's declaration-generating macros look too much like
|
||||
* prototypes, and confuse the algorithms.
|
||||
*/
|
||||
int
|
||||
test1(buf)
|
||||
char *buf;
|
||||
{ char *p = buf;
|
||||
char *bend;
|
||||
char *endfn;
|
||||
int contin;
|
||||
|
||||
if ( !isidfirstchar(*p) )
|
||||
return 0; /* no name at left margin */
|
||||
bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1);
|
||||
switch ( *bend )
|
||||
{
|
||||
case ';': contin = 0 /*2*/; break;
|
||||
case ')': contin = 1; break;
|
||||
case '{': return 0; /* not a function */
|
||||
case '}': return 0; /* not a function */
|
||||
default: contin = -1;
|
||||
}
|
||||
while ( isidchar(*p) )
|
||||
p++;
|
||||
endfn = p;
|
||||
p = skipspace(p, 1);
|
||||
if ( *p++ != '(' )
|
||||
return 0; /* not a function */
|
||||
p = skipspace(p, 1);
|
||||
if ( *p == ')' )
|
||||
return 0; /* no parameters */
|
||||
/* Check that the apparent function name isn't a keyword. */
|
||||
/* We only need to check for keywords that could be followed */
|
||||
/* by a left parenthesis (which, unfortunately, is most of them). */
|
||||
{ static char *words[] =
|
||||
{ "asm", "auto", "case", "char", "const", "double",
|
||||
"extern", "float", "for", "if", "int", "long",
|
||||
"register", "return", "short", "signed", "sizeof",
|
||||
"static", "switch", "typedef", "unsigned",
|
||||
"void", "volatile", "while", 0
|
||||
};
|
||||
char **key = words;
|
||||
char *kp;
|
||||
unsigned len = endfn - buf;
|
||||
|
||||
while ( (kp = *key) != 0 )
|
||||
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) )
|
||||
return 0; /* name is a keyword */
|
||||
key++;
|
||||
}
|
||||
}
|
||||
{
|
||||
char *id = p;
|
||||
int len;
|
||||
/*
|
||||
* Check for identifier1(identifier2) and not
|
||||
* identifier1(void), or identifier1(identifier2, xxxx).
|
||||
*/
|
||||
|
||||
while ( isidchar(*p) )
|
||||
p++;
|
||||
len = p - id;
|
||||
p = skipspace(p, 1);
|
||||
if (*p == ',' ||
|
||||
(*p == ')' && (len != 4 || strncmp(id, "void", 4)))
|
||||
)
|
||||
return 0; /* not a function */
|
||||
}
|
||||
/*
|
||||
* If the last significant character was a ), we need to count
|
||||
* parentheses, because it might be part of a formal parameter
|
||||
* that is a procedure.
|
||||
*/
|
||||
if (contin > 0) {
|
||||
int level = 0;
|
||||
|
||||
for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
|
||||
level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
|
||||
if (level > 0)
|
||||
contin = -1;
|
||||
}
|
||||
return contin;
|
||||
}
|
||||
|
||||
/* Convert a recognized function definition or header to K&R syntax. */
|
||||
int
|
||||
convert1(buf, out, header, convert_varargs)
|
||||
char *buf;
|
||||
FILE *out;
|
||||
int header; /* Boolean */
|
||||
int convert_varargs; /* Boolean */
|
||||
{ char *endfn;
|
||||
char *p;
|
||||
/*
|
||||
* The breaks table contains pointers to the beginning and end
|
||||
* of each argument.
|
||||
*/
|
||||
char **breaks;
|
||||
unsigned num_breaks = 2; /* for testing */
|
||||
char **btop;
|
||||
char **bp;
|
||||
char **ap;
|
||||
char *vararg = 0;
|
||||
|
||||
/* Pre-ANSI implementations don't agree on whether strchr */
|
||||
/* is called strchr or index, so we open-code it here. */
|
||||
for ( endfn = buf; *(endfn++) != '('; )
|
||||
;
|
||||
top: p = endfn;
|
||||
breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
|
||||
if ( breaks == NULL )
|
||||
{ /* Couldn't allocate break table, give up */
|
||||
fprintf(stderr, "Unable to allocate break table!\n");
|
||||
fputs(buf, out);
|
||||
return -1;
|
||||
}
|
||||
btop = breaks + num_breaks * 2 - 2;
|
||||
bp = breaks;
|
||||
/* Parse the argument list */
|
||||
do
|
||||
{ int level = 0;
|
||||
char *lp = NULL;
|
||||
char *rp = NULL;
|
||||
char *end = NULL;
|
||||
|
||||
if ( bp >= btop )
|
||||
{ /* Filled up break table. */
|
||||
/* Allocate a bigger one and start over. */
|
||||
free((char *)breaks);
|
||||
num_breaks <<= 1;
|
||||
goto top;
|
||||
}
|
||||
*bp++ = p;
|
||||
/* Find the end of the argument */
|
||||
for ( ; end == NULL; p++ )
|
||||
{ switch(*p)
|
||||
{
|
||||
case ',':
|
||||
if ( !level ) end = p;
|
||||
break;
|
||||
case '(':
|
||||
if ( !level ) lp = p;
|
||||
level++;
|
||||
break;
|
||||
case ')':
|
||||
if ( --level < 0 ) end = p;
|
||||
else rp = p;
|
||||
break;
|
||||
case '/':
|
||||
if (p[1] == '*')
|
||||
p = skipspace(p, 1) - 1;
|
||||
break;
|
||||
case '"':
|
||||
p = scanstring(p, 1) - 1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
/* Erase any embedded prototype parameters. */
|
||||
if ( lp && rp )
|
||||
writeblanks(lp + 1, rp);
|
||||
p--; /* back up over terminator */
|
||||
/* Find the name being declared. */
|
||||
/* This is complicated because of procedure and */
|
||||
/* array modifiers. */
|
||||
for ( ; ; )
|
||||
{ p = skipspace(p - 1, -1);
|
||||
switch ( *p )
|
||||
{
|
||||
case ']': /* skip array dimension(s) */
|
||||
case ')': /* skip procedure args OR name */
|
||||
{ int level = 1;
|
||||
while ( level )
|
||||
switch ( *--p )
|
||||
{
|
||||
case ']': case ')':
|
||||
level++;
|
||||
break;
|
||||
case '[': case '(':
|
||||
level--;
|
||||
break;
|
||||
case '/':
|
||||
if (p > buf && p[-1] == '*')
|
||||
p = skipspace(p, -1) + 1;
|
||||
break;
|
||||
case '"':
|
||||
p = scanstring(p, -1) + 1;
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
|
||||
{ /* We found the name being declared */
|
||||
while ( !isidfirstchar(*p) )
|
||||
p = skipspace(p, 1) + 1;
|
||||
goto found;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
|
||||
{ if ( convert_varargs )
|
||||
{ *bp++ = "va_alist";
|
||||
vararg = p-2;
|
||||
}
|
||||
else
|
||||
{ p++;
|
||||
if ( bp == breaks + 1 ) /* sole argument */
|
||||
writeblanks(breaks[0], p);
|
||||
else
|
||||
writeblanks(bp[-1] - 1, p);
|
||||
bp--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ while ( isidchar(*p) ) p--;
|
||||
*bp++ = p+1;
|
||||
}
|
||||
p = end;
|
||||
}
|
||||
while ( *p++ == ',' );
|
||||
*bp = p;
|
||||
/* Make a special check for 'void' arglist */
|
||||
if ( bp == breaks+2 )
|
||||
{ p = skipspace(breaks[0], 1);
|
||||
if ( !strncmp(p, "void", 4) )
|
||||
{ p = skipspace(p+4, 1);
|
||||
if ( p == breaks[2] - 1 )
|
||||
{ bp = breaks; /* yup, pretend arglist is empty */
|
||||
writeblanks(breaks[0], p + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Put out the function name and left parenthesis. */
|
||||
p = buf;
|
||||
while ( p != endfn ) putc(*p, out), p++;
|
||||
/* Put out the declaration. */
|
||||
if ( header )
|
||||
{ fputs(");", out);
|
||||
for ( p = breaks[0]; *p; p++ )
|
||||
if ( *p == '\r' || *p == '\n' )
|
||||
putc(*p, out);
|
||||
}
|
||||
else
|
||||
{ for ( ap = breaks+1; ap < bp; ap += 2 )
|
||||
{ p = *ap;
|
||||
while ( isidchar(*p) )
|
||||
putc(*p, out), p++;
|
||||
if ( ap < bp - 1 )
|
||||
fputs(", ", out);
|
||||
}
|
||||
fputs(") ", out);
|
||||
/* Put out the argument declarations */
|
||||
for ( ap = breaks+2; ap <= bp; ap += 2 )
|
||||
(*ap)[-1] = ';';
|
||||
if ( vararg != 0 )
|
||||
{ *vararg = 0;
|
||||
fputs(breaks[0], out); /* any prior args */
|
||||
fputs("va_dcl", out); /* the final arg */
|
||||
fputs(bp[0], out);
|
||||
}
|
||||
else
|
||||
fputs(breaks[0], out);
|
||||
}
|
||||
free((char *)breaks);
|
||||
return 0;
|
||||
}
|
||||
270
ar-lib
Executable file
270
ar-lib
Executable file
@@ -0,0 +1,270 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for Microsoft lib.exe
|
||||
|
||||
me=ar-lib
|
||||
scriptversion=2012-03-01.08; # UTC
|
||||
|
||||
# Copyright (C) 2010-2014 Free Software Foundation, Inc.
|
||||
# Written by Peter Rosin <peda@lysator.liu.se>.
|
||||
#
|
||||
# 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>.
|
||||
|
||||
|
||||
# func_error message
|
||||
func_error ()
|
||||
{
|
||||
echo "$me: $1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts.
|
||||
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 in
|
||||
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_at_file at_file operation archive
|
||||
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
|
||||
# for each of them.
|
||||
# When interpreting the content of the @FILE, do NOT use func_file_conv,
|
||||
# since the user would need to supply preconverted file names to
|
||||
# binutils ar, at least for MinGW.
|
||||
func_at_file ()
|
||||
{
|
||||
operation=$2
|
||||
archive=$3
|
||||
at_file_contents=`cat "$1"`
|
||||
eval set x "$at_file_contents"
|
||||
shift
|
||||
|
||||
for member
|
||||
do
|
||||
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
|
||||
done
|
||||
}
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
func_error "no command. Try '$0 --help' for more information."
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<EOF
|
||||
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
|
||||
|
||||
Members may be specified in a file named with @FILE.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "$me, version $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $# -lt 3; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
|
||||
AR=$1
|
||||
shift
|
||||
while :
|
||||
do
|
||||
if test $# -lt 2; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
case $1 in
|
||||
-lib | -LIB \
|
||||
| -ltcg | -LTCG \
|
||||
| -machine* | -MACHINE* \
|
||||
| -subsystem* | -SUBSYSTEM* \
|
||||
| -verbose | -VERBOSE \
|
||||
| -wx* | -WX* )
|
||||
AR="$AR $1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
action=$1
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
orig_archive=$1
|
||||
shift
|
||||
func_file_conv "$orig_archive"
|
||||
archive=$file
|
||||
|
||||
# strip leading dash in $action
|
||||
action=${action#-}
|
||||
|
||||
delete=
|
||||
extract=
|
||||
list=
|
||||
quick=
|
||||
replace=
|
||||
index=
|
||||
create=
|
||||
|
||||
while test -n "$action"
|
||||
do
|
||||
case $action in
|
||||
d*) delete=yes ;;
|
||||
x*) extract=yes ;;
|
||||
t*) list=yes ;;
|
||||
q*) quick=yes ;;
|
||||
r*) replace=yes ;;
|
||||
s*) index=yes ;;
|
||||
S*) ;; # the index is always updated implicitly
|
||||
c*) create=yes ;;
|
||||
u*) ;; # TODO: don't ignore the update modifier
|
||||
v*) ;; # TODO: don't ignore the verbose modifier
|
||||
*)
|
||||
func_error "unknown action specified"
|
||||
;;
|
||||
esac
|
||||
action=${action#?}
|
||||
done
|
||||
|
||||
case $delete$extract$list$quick$replace,$index in
|
||||
yes,* | ,yes)
|
||||
;;
|
||||
yesyes*)
|
||||
func_error "more than one action specified"
|
||||
;;
|
||||
*)
|
||||
func_error "no action specified"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$delete"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -REMOVE "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
elif test -n "$extract"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
if test $# -gt 0; then
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -EXTRACT "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
|
||||
do
|
||||
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
elif test -n "$quick$replace"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
if test -z "$create"; then
|
||||
echo "$me: creating $orig_archive"
|
||||
fi
|
||||
orig_archive=
|
||||
else
|
||||
orig_archive=$archive
|
||||
fi
|
||||
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_file_conv "${1#@}"
|
||||
set x "$@" "@$file"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
set x "$@" "$file"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
if test -n "$orig_archive"; then
|
||||
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
|
||||
else
|
||||
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
|
||||
fi
|
||||
|
||||
elif test -n "$list"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
$AR -NOLOGO -LIST "$archive" || exit $?
|
||||
fi
|
||||
@@ -2,6 +2,7 @@
|
||||
* cderror.h
|
||||
*
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2009 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -45,6 +46,7 @@ JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
|
||||
JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
|
||||
JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
|
||||
JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
|
||||
JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
|
||||
JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
|
||||
JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
|
||||
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
|
||||
|
||||
162
change.log
162
change.log
@@ -1,6 +1,168 @@
|
||||
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
|
||||
----------------------
|
||||
|
||||
Add cjpeg -rgb1 option to create an RGB JPEG file, and insert
|
||||
a simple reversible color transform into the processing which
|
||||
significantly improves the compression.
|
||||
The recommended command for lossless coding of RGB images is now
|
||||
cjpeg -rgb1 -block 1 -arithmetic.
|
||||
As said, this option improves the compression significantly, but
|
||||
the files are not compatible with JPEG decoders prior to IJG v9
|
||||
due to the included color transform.
|
||||
The used color transform and marker signaling is compatible with
|
||||
other JPEG standards (e.g., JPEG-LS part 2).
|
||||
|
||||
Remove the automatic de-ANSI-fication support (Automake 1.12).
|
||||
Thank also to Nitin A Kamble for suggestion.
|
||||
|
||||
Add remark for jpeg_mem_dest() in jdatadst.c.
|
||||
Thank to Elie-Gregoire Khoury for the hint.
|
||||
|
||||
Support files with invalid component identifiers (created
|
||||
by Adobe PDF). Thank to Robin Watts for the suggestion.
|
||||
|
||||
Adapt full buffer case in jcmainct.c for use with scaled DCT.
|
||||
Thank to Sergii Biloshytskyi for the suggestion.
|
||||
|
||||
Add type identifier for declaration of noreturn functions.
|
||||
Thank to Brett L. Moore for the suggestion.
|
||||
|
||||
Correct argument type in format string, avoid compiler warnings.
|
||||
Thank to Vincent Torri for hint.
|
||||
|
||||
Add missing #include directives in configuration checks, avoid
|
||||
configuration errors. Thank to John Spencer for the hint.
|
||||
|
||||
|
||||
Version 8d 15-Jan-2012
|
||||
-----------------------
|
||||
|
||||
Add cjpeg -rgb option to create RGB JPEG files.
|
||||
Using this switch suppresses the conversion from RGB
|
||||
colorspace input to the default YCbCr JPEG colorspace.
|
||||
This feature allows true lossless JPEG coding of RGB color images.
|
||||
The recommended command for this purpose is currently
|
||||
cjpeg -rgb -block 1 -arithmetic.
|
||||
SmartScale capable decoder (introduced with IJG JPEG 8) required.
|
||||
Thank to Michael Koch for the initial suggestion.
|
||||
|
||||
Add option to disable the region adjustment in the transupp crop code.
|
||||
Thank to Jeffrey Friedl for the suggestion.
|
||||
|
||||
Thank to Richard Jones and Edd Dawson for various minor corrections.
|
||||
|
||||
Thank to Akim Demaille for configure.ac cleanup.
|
||||
|
||||
|
||||
Version 8c 16-Jan-2011
|
||||
-----------------------
|
||||
|
||||
Add option to compression library and cjpeg (-block N) to use
|
||||
different DCT block size.
|
||||
All N from 1 to 16 are possible. Default is 8 (baseline format).
|
||||
Larger values produce higher compression,
|
||||
smaller values produce higher quality.
|
||||
SmartScale capable decoder (introduced with IJG JPEG 8) required.
|
||||
|
||||
|
||||
Version 8b 16-May-2010
|
||||
-----------------------
|
||||
|
||||
Repair problem in new memory source manager with corrupt JPEG data.
|
||||
Thank to Ted Campbell and Samuel Chun for the report.
|
||||
|
||||
Repair problem in Makefile.am test target.
|
||||
Thank to anonymous user for the report.
|
||||
|
||||
Support MinGW installation with automatic configure.
|
||||
Thank to Volker Grabsch for the suggestion.
|
||||
|
||||
|
||||
Version 8a 28-Feb-2010
|
||||
-----------------------
|
||||
|
||||
Writing tables-only datastreams via jpeg_write_tables works again.
|
||||
|
||||
Support 32-bit BMPs (RGB image with Alpha channel) for read in cjpeg.
|
||||
Thank to Brett Blackham for the suggestion.
|
||||
|
||||
Improve accuracy in floating point IDCT calculation.
|
||||
Thank to Robert Hooke for the hint.
|
||||
|
||||
|
||||
Version 8 10-Jan-2010
|
||||
----------------------
|
||||
|
||||
jpegtran now supports the same -scale option as djpeg for "lossless" resize.
|
||||
An implementation of the JPEG SmartScale extension is required for this
|
||||
feature. A (draft) specification of the JPEG SmartScale extension is
|
||||
available as a contributed document at ITU and ISO. Revision 2 or later
|
||||
of the document is required (latest document version is Revision 3).
|
||||
The SmartScale extension will enable more features beside lossless resize
|
||||
in future implementations, as described in the document (new compression
|
||||
options).
|
||||
|
||||
Add sanity check in BMP reader module to avoid cjpeg crash for empty input
|
||||
image (thank to Isaev Ildar of ISP RAS, Moscow, RU for reporting this error).
|
||||
|
||||
Add data source and destination managers for read from and write to
|
||||
memory buffers. New API functions jpeg_mem_src and jpeg_mem_dest.
|
||||
Thank to Roberto Boni from Italy for the suggestion.
|
||||
|
||||
|
||||
Version 7 27-Jun-2009
|
||||
----------------------
|
||||
|
||||
|
||||
84
cjpeg.1
84
cjpeg.1
@@ -1,4 +1,4 @@
|
||||
.TH CJPEG 1 "10 June 2009"
|
||||
.TH CJPEG 1 "26 July 2015"
|
||||
.SH NAME
|
||||
cjpeg \- compress an image file to a JPEG file
|
||||
.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
|
||||
named, and produces a JPEG/JFIF file on the standard output.
|
||||
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.)
|
||||
.SH OPTIONS
|
||||
All switch names may be abbreviated; for example,
|
||||
@@ -49,6 +49,17 @@ By saying
|
||||
.BR \-grayscale ,
|
||||
you'll get a smaller JPEG file that takes less time to process.
|
||||
.TP
|
||||
.B \-rgb
|
||||
Create RGB JPEG file.
|
||||
Using this switch suppresses the conversion from RGB
|
||||
colorspace input to the default YCbCr JPEG colorspace.
|
||||
You can use this switch in combination with the
|
||||
.BI \-block " N"
|
||||
switch (see below) for lossless JPEG coding.
|
||||
See also the
|
||||
.B \-rgb1
|
||||
switch below.
|
||||
.TP
|
||||
.B \-optimize
|
||||
Perform optimization of entropy encoding parameters. Without this, default
|
||||
encoding parameters are used.
|
||||
@@ -64,7 +75,10 @@ Create progressive JPEG file (see below).
|
||||
.TP
|
||||
.BI \-scale " M/N"
|
||||
Scale the output image by a factor M/N. Currently supported scale factors are
|
||||
8/N with all N from 1 to 16.
|
||||
M/N with all N from 1 to 16, where M is the destination DCT size, which is 8
|
||||
by default (see
|
||||
.BI \-block " N"
|
||||
switch below).
|
||||
.TP
|
||||
.B \-targa
|
||||
Input file is Targa format. Targa files that contain an "identification"
|
||||
@@ -135,7 +149,7 @@ and assigned to components with
|
||||
.B \-qslots
|
||||
parameter (see the "wizard" switches below).
|
||||
.B Caution:
|
||||
You must explicitely add
|
||||
You must explicitly add
|
||||
.BI \-sample " 1x1"
|
||||
for efficient separate color
|
||||
quality selection, since the default value used by library is 2x2!
|
||||
@@ -152,6 +166,59 @@ about the same --- often a little smaller.
|
||||
.PP
|
||||
Switches for advanced users:
|
||||
.TP
|
||||
.B \-arithmetic
|
||||
Use arithmetic coding.
|
||||
.B Caution:
|
||||
arithmetic coded JPEG is not yet widely implemented, so many decoders will
|
||||
be unable to view an arithmetic coded JPEG file at all.
|
||||
.TP
|
||||
.BI \-block " N"
|
||||
Set DCT block size. All N from 1 to 16 are possible.
|
||||
Default is 8 (baseline format).
|
||||
Larger values produce higher compression,
|
||||
smaller values produce higher quality
|
||||
(exact DCT stage possible with 1 or 2; with the default quality of 75 and
|
||||
default Luminance qtable the DCT+Quantization stage is lossless for N=1).
|
||||
.B Caution:
|
||||
An implementation of the JPEG SmartScale extension is required for this
|
||||
feature. SmartScale enabled JPEG is not yet widely implemented, so many
|
||||
decoders will be unable to view a SmartScale extended JPEG file at all.
|
||||
.TP
|
||||
.B \-rgb1
|
||||
Create RGB JPEG file with reversible color transform.
|
||||
Works like the
|
||||
.B \-rgb
|
||||
switch (see above) and inserts a simple reversible color transform
|
||||
into the processing which significantly improves the compression.
|
||||
Use this switch in combination with the
|
||||
.BI \-block " N"
|
||||
switch (see above) for lossless JPEG coding.
|
||||
.B Caution:
|
||||
A decoder with inverse color transform support is required for
|
||||
this feature. Reversible color transform support is not yet
|
||||
widely implemented, so many decoders will be unable to view
|
||||
a reversible color transformed JPEG file at all.
|
||||
.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
|
||||
Use integer DCT method (default).
|
||||
.TP
|
||||
@@ -219,12 +286,6 @@ visibly blur the image, however.
|
||||
.PP
|
||||
Switches for wizards:
|
||||
.TP
|
||||
.B \-arithmetic
|
||||
Use arithmetic coding.
|
||||
.B Caution:
|
||||
arithmetic coded JPEG is not yet widely implemented, so many decoders will be
|
||||
unable to view an arithmetic coded JPEG file at all.
|
||||
.TP
|
||||
.B \-baseline
|
||||
Force baseline-compatible quantization tables to be generated. This clamps
|
||||
quantization values to 8 bits even at low quality settings. (This switch is
|
||||
@@ -314,7 +375,8 @@ Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
|
||||
.SH AUTHOR
|
||||
Independent JPEG Group
|
||||
.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.)
|
||||
.PP
|
||||
Not all variants of BMP and Targa file formats are supported.
|
||||
|
||||
62
cjpeg.c
62
cjpeg.c
@@ -2,7 +2,7 @@
|
||||
* cjpeg.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2008 by Guido Vollbeding.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -152,6 +152,7 @@ usage (void)
|
||||
fprintf(stderr, "Switches (names may be abbreviated):\n");
|
||||
fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is useful range)\n");
|
||||
fprintf(stderr, " -grayscale Create monochrome JPEG file\n");
|
||||
fprintf(stderr, " -rgb Create RGB JPEG file\n");
|
||||
#ifdef ENTROPY_OPT_SUPPORTED
|
||||
fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
|
||||
#endif
|
||||
@@ -165,6 +166,16 @@ usage (void)
|
||||
fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n");
|
||||
#endif
|
||||
fprintf(stderr, "Switches for advanced users:\n");
|
||||
#ifdef C_ARITH_CODING_SUPPORTED
|
||||
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
|
||||
#endif
|
||||
#ifdef DCT_SCALING_SUPPORTED
|
||||
fprintf(stderr, " -block N DCT block size (1..16; default is 8)\n");
|
||||
#endif
|
||||
#if JPEG_LIB_VERSION_MAJOR >= 9
|
||||
fprintf(stderr, " -rgb1 Create RGB JPEG file with reversible color transform\n");
|
||||
fprintf(stderr, " -bgycc Create big gamut YCC JPEG file\n");
|
||||
#endif
|
||||
#ifdef DCT_ISLOW_SUPPORTED
|
||||
fprintf(stderr, " -dct int Use integer DCT method%s\n",
|
||||
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
|
||||
@@ -186,9 +197,6 @@ usage (void)
|
||||
fprintf(stderr, " -outfile name Specify name for output file\n");
|
||||
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
||||
fprintf(stderr, "Switches for wizards:\n");
|
||||
#ifdef C_ARITH_CODING_SUPPORTED
|
||||
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
|
||||
#endif
|
||||
fprintf(stderr, " -baseline Force baseline quantization tables\n");
|
||||
fprintf(stderr, " -qtables file Use quantization tables given in file\n");
|
||||
fprintf(stderr, " -qslots N[,...] Set component quantization tables\n");
|
||||
@@ -254,10 +262,29 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
exit(EXIT_FAILURE);
|
||||
#endif
|
||||
|
||||
} else if (keymatch(arg, "baseline", 1)) {
|
||||
} else if (keymatch(arg, "baseline", 2)) {
|
||||
/* Force baseline-compatible output (8-bit quantizer values). */
|
||||
force_baseline = TRUE;
|
||||
|
||||
} else if (keymatch(arg, "block", 2)) {
|
||||
/* Set DCT block size. */
|
||||
#if defined DCT_SCALING_SUPPORTED && JPEG_LIB_VERSION_MAJOR >= 8 && \
|
||||
(JPEG_LIB_VERSION_MAJOR > 8 || JPEG_LIB_VERSION_MINOR >= 3)
|
||||
int val;
|
||||
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
usage();
|
||||
if (sscanf(argv[argn], "%d", &val) != 1)
|
||||
usage();
|
||||
if (val < 1 || val > 16)
|
||||
usage();
|
||||
cinfo->block_size = val;
|
||||
#else
|
||||
fprintf(stderr, "%s: sorry, block size setting not supported\n",
|
||||
progname);
|
||||
exit(EXIT_FAILURE);
|
||||
#endif
|
||||
|
||||
} else if (keymatch(arg, "dct", 2)) {
|
||||
/* Select DCT algorithm. */
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
@@ -287,6 +314,27 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
/* Force a monochrome JPEG file to be generated. */
|
||||
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
|
||||
|
||||
} else if (keymatch(arg, "rgb", 3) || keymatch(arg, "rgb1", 4)) {
|
||||
/* Force an RGB JPEG file to be generated. */
|
||||
#if JPEG_LIB_VERSION_MAJOR >= 9
|
||||
/* Note: Entropy table assignment in jpeg_set_colorspace depends
|
||||
* on color_transform.
|
||||
*/
|
||||
cinfo->color_transform = arg[3] ? JCT_SUBTRACT_GREEN : JCT_NONE;
|
||||
#endif
|
||||
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)) {
|
||||
/* Maximum memory in Kb (or Mb with 'm'). */
|
||||
long lval;
|
||||
@@ -301,7 +349,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
cinfo->mem->max_memory_to_use = lval * 1000L;
|
||||
|
||||
} else if (keymatch(arg, "nosmooth", 3)) {
|
||||
/* Suppress fancy downsampling */
|
||||
/* Suppress fancy downsampling. */
|
||||
cinfo->do_fancy_downsampling = FALSE;
|
||||
|
||||
} else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
|
||||
@@ -387,7 +435,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
/* Scale the image by a fraction M/N. */
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
usage();
|
||||
if (sscanf(argv[argn], "%d/%d",
|
||||
if (sscanf(argv[argn], "%u/%u",
|
||||
&cinfo->scale_num, &cinfo->scale_denom) != 2)
|
||||
usage();
|
||||
|
||||
|
||||
347
compile
Executable file
347
compile
Executable 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:
|
||||
564
config.guess
vendored
564
config.guess
vendored
@@ -1,14 +1,12 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-04-27'
|
||||
timestamp='2014-11-04'
|
||||
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
@@ -17,26 +15,22 @@ timestamp='2009-04-27'
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
# 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.
|
||||
|
||||
|
||||
# Originally written by Per Bothner <per@bothner.com>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# the same distribution terms that you use for the rest of that
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit build system type.
|
||||
# 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
|
||||
#
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
@@ -56,8 +50,7 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@@ -139,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=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.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:NetBSD:*:*)
|
||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||
# switched to ELF, *-*-netbsd* would select the old
|
||||
# object file format. This provides both forward
|
||||
@@ -170,7 +184,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep __ELF__ >/dev/null
|
||||
| grep -q __ELF__
|
||||
then
|
||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||
# Return netbsd for either. FIX?
|
||||
@@ -201,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit ;;
|
||||
*:Bitrig:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:OpenBSD:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
||||
@@ -269,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
exit ;;
|
||||
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||
exitcode=$?
|
||||
trap '' 0
|
||||
exit $exitcode ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||
@@ -300,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
arm:riscos:*:*|arm:RISCOS:*:*)
|
||||
arm*:riscos:*:*|arm*:RISCOS:*:*)
|
||||
echo arm-unknown-riscos
|
||||
exit ;;
|
||||
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
|
||||
@@ -333,6 +354,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
||||
echo i386-pc-auroraux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||
eval $set_cc_for_build
|
||||
SUN_ARCH="i386"
|
||||
@@ -548,15 +572,16 @@ EOF
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit ;;
|
||||
*:AIX:*:[456])
|
||||
*:AIX:*:[4567])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
if [ -x /usr/bin/lslpp ] ; then
|
||||
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
|
||||
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
|
||||
else
|
||||
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
|
||||
fi
|
||||
@@ -656,7 +681,7 @@ EOF
|
||||
# => hppa64-hp-hpux11.23
|
||||
|
||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
grep __LP64__ >/dev/null
|
||||
grep -q __LP64__
|
||||
then
|
||||
HP_ARCH="hppa2.0w"
|
||||
else
|
||||
@@ -785,21 +810,26 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:FreeBSD:*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
pc98)
|
||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
case ${UNAME_PROCESSOR} in
|
||||
amd64)
|
||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
esac
|
||||
exit ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
*:MINGW64*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw64
|
||||
exit ;;
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
*:MSYS*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msys
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
@@ -807,12 +837,12 @@ EOF
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit ;;
|
||||
*:Interix*:[3456]*)
|
||||
*:Interix*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
x86)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
EM64T | authenticamd | genuineintel)
|
||||
authenticamd | genuineintel | EM64T)
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
IA64)
|
||||
@@ -822,6 +852,9 @@ EOF
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
exit ;;
|
||||
8664:Windows_NT:*)
|
||||
echo x86_64-pc-mks
|
||||
exit ;;
|
||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||
@@ -842,100 +875,21 @@ EOF
|
||||
exit ;;
|
||||
*:GNU:*:*)
|
||||
# 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 ;;
|
||||
*:GNU/*:*:*)
|
||||
# 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 ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
fi
|
||||
aarch64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo cris-axis-linux-gnu
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo crisv32-axis-linux-gnu
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo frv-unknown-linux-gnu
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
mips:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips
|
||||
#undef mipsel
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mipsel
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips64
|
||||
#undef mips64el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mips64el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips64
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
or32:Linux:*:*)
|
||||
echo or32-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
aarch64_be:Linux:*:*)
|
||||
UNAME_MACHINE=aarch64_be
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
@@ -947,105 +901,131 @@ EOF
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arc:Linux:*:* | arceb:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
else
|
||||
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_PCS_VFP
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
|
||||
fi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
hexagon:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
mips:Linux:*:* | mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef ${UNAME_MACHINE}
|
||||
#undef ${UNAME_MACHINE}el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=${UNAME_MACHINE}el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=${UNAME_MACHINE}
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||
;;
|
||||
openrisc*:Linux:*:*)
|
||||
echo or1k-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
or32:Linux:*:* | or1k*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-gnu
|
||||
echo sparc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
# Look for CPU level
|
||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||
PA7*) echo hppa1.1-unknown-linux-gnu ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-gnu ;;
|
||||
*) echo hppa-unknown-linux-gnu ;;
|
||||
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
|
||||
*) echo hppa-unknown-linux-${LIBC} ;;
|
||||
esac
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-gnu
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc64le:Linux:*:*)
|
||||
echo powerpc64le-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppcle:Linux:*:*)
|
||||
echo powerpcle-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
||||
exit ;;
|
||||
sh64*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
sh*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
tile*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
vax:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
# problems with other programs or directories called `ld' in the path.
|
||||
# Set LC_ALL=C to ensure ld outputs messages in English.
|
||||
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
||||
| sed -ne '/supported targets:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported targets: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_targets" in
|
||||
elf32-i386)
|
||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
||||
;;
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit ;;
|
||||
"")
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||
# one that does not give us useful --help.
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
||||
exit ;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <features.h>
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
LIBC=gnu
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
#else
|
||||
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
LIBC=gnu
|
||||
#else
|
||||
LIBC=gnuaout
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^LIBC/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${LIBC}" != x && {
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
exit
|
||||
}
|
||||
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
|
||||
;;
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
# earlier versions are messed up and put the nodename in both
|
||||
@@ -1074,7 +1054,7 @@ EOF
|
||||
i*86:syllable:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-syllable
|
||||
exit ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
i*86:*DOS:*:*)
|
||||
@@ -1182,7 +1162,7 @@ EOF
|
||||
rs6000:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
@@ -1248,6 +1228,9 @@ EOF
|
||||
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||
echo i586-pc-haiku
|
||||
exit ;;
|
||||
x86_64:Haiku:*:*)
|
||||
echo x86_64-unknown-haiku
|
||||
exit ;;
|
||||
SX-4:SUPER-UX:*:*)
|
||||
echo sx4-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@@ -1274,9 +1257,31 @@ EOF
|
||||
exit ;;
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
eval $set_cc_for_build
|
||||
if test "$UNAME_PROCESSOR" = unknown ; then
|
||||
UNAME_PROCESSOR=powerpc
|
||||
fi
|
||||
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||
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}
|
||||
exit ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
@@ -1290,7 +1295,10 @@ EOF
|
||||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit ;;
|
||||
NSE-?:NONSTOP_KERNEL:*:*)
|
||||
NEO-?:NONSTOP_KERNEL:*:*)
|
||||
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSE-*:NONSTOP_KERNEL:*:*)
|
||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
@@ -1359,159 +1367,11 @@ EOF
|
||||
i*86:AROS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-aros
|
||||
exit ;;
|
||||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
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
|
||||
$0: unable to guess system type
|
||||
|
||||
|
||||
287
config.sub
vendored
287
config.sub
vendored
@@ -1,44 +1,40 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-04-17'
|
||||
timestamp='2014-12-03'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# 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
|
||||
# the Free Software Foundation; either version 3 of the License, 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.
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
# 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.
|
||||
# the same distribution terms that you use for the rest of that
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
@@ -72,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@@ -120,13 +115,18 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
android-linux)
|
||||
os=-linux-android
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
@@ -149,10 +149,13 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray)
|
||||
-apple | -axis | -knuth | -cray | -microblaze*)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
@@ -215,6 +218,12 @@ case $os in
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*178)
|
||||
os=-lynxos178
|
||||
;;
|
||||
-lynx*5)
|
||||
os=-lynxos5
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
@@ -239,20 +248,28 @@ case $basic_machine in
|
||||
# Some are omitted here because they have special meanings below.
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64_be \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| arc | arceb \
|
||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||
| avr | avr32 \
|
||||
| be32 | be64 \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| c4x | c8051 | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| epiphany \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | mcore | mep | metag \
|
||||
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@@ -266,36 +283,55 @@ case $basic_machine in
|
||||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa32r6 | mipsisa32r6el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64r6 | mipsisa64r6el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nios | nios2 \
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
| ns16k | ns32k \
|
||||
| or32 \
|
||||
| open8 | or1k | or1knd | or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| pyramid \
|
||||
| riscv32 | riscv64 \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| spu \
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| visium \
|
||||
| we32k \
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
c54x)
|
||||
basic_machine=tic54x-unknown
|
||||
;;
|
||||
c55x)
|
||||
basic_machine=tic55x-unknown
|
||||
;;
|
||||
c6x)
|
||||
basic_machine=tic6x-unknown
|
||||
;;
|
||||
leon|leon[3-9])
|
||||
basic_machine=sparc-$basic_machine
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
@@ -305,6 +341,21 @@ case $basic_machine in
|
||||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
strongarm | thumb | xscale)
|
||||
basic_machine=arm-unknown
|
||||
;;
|
||||
xgate)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
xscaleeb)
|
||||
basic_machine=armeb-unknown
|
||||
;;
|
||||
|
||||
xscaleel)
|
||||
basic_machine=armel-unknown
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
@@ -319,25 +370,31 @@ case $basic_machine in
|
||||
# Recognize the basic CPU types with company name.
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| aarch64-* | aarch64_be-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| k1om-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||
| microblaze-* | microblazeel-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
@@ -351,32 +408,42 @@ case $basic_machine in
|
||||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa32r6-* | mipsisa32r6el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64r6-* | mipsisa64r6el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipsr5900-* | mipsr5900el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| nios-* | nios2-* \
|
||||
| nds32-* | nds32le-* | nds32be-* \
|
||||
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| or1k*-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
| tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| visium-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-* | z80-*)
|
||||
@@ -467,6 +534,19 @@ case $basic_machine in
|
||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
bluegene*)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-cnk
|
||||
;;
|
||||
c54x-*)
|
||||
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c55x-*)
|
||||
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c6x-*)
|
||||
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
@@ -503,7 +583,7 @@ case $basic_machine in
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16)
|
||||
cr16 | cr16-*)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
@@ -661,7 +741,6 @@ case $basic_machine in
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
@@ -700,6 +779,9 @@ case $basic_machine in
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
leon-*|leon[3-9]-*)
|
||||
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
@@ -719,8 +801,15 @@ case $basic_machine in
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze*)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-mingw64
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
basic_machine=i686-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
@@ -748,6 +837,10 @@ case $basic_machine in
|
||||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
moxiebox)
|
||||
basic_machine=moxie-unknown
|
||||
os=-moxiebox
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
@@ -755,10 +848,18 @@ case $basic_machine in
|
||||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
msys)
|
||||
basic_machine=i686-pc
|
||||
os=-msys
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
nacl)
|
||||
basic_machine=le32-unknown
|
||||
os=-nacl
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
@@ -823,6 +924,12 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
neo-tandem)
|
||||
basic_machine=neo-tandem
|
||||
;;
|
||||
nse-tandem)
|
||||
basic_machine=nse-tandem
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@@ -905,9 +1012,10 @@ case $basic_machine in
|
||||
;;
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
@@ -932,7 +1040,11 @@ case $basic_machine in
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rdos)
|
||||
rdos | rdos64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-rdos
|
||||
;;
|
||||
rdos32)
|
||||
basic_machine=i386-pc
|
||||
os=-rdos
|
||||
;;
|
||||
@@ -1001,6 +1113,9 @@ case $basic_machine in
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
strongarm-* | thumb-*)
|
||||
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@@ -1057,20 +1172,8 @@ case $basic_machine in
|
||||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic55x | c55x*)
|
||||
basic_machine=tic55x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic6x | c6x*)
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=tile-unknown
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
@@ -1140,6 +1243,9 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
xscale-* | xscalee[bl]-*)
|
||||
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
@@ -1240,6 +1346,9 @@ case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
;;
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
@@ -1260,30 +1369,31 @@ case $os in
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -kopensolaris* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1407,15 +1517,14 @@ case $os in
|
||||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-dicos*)
|
||||
os=-dicos
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@@ -1456,6 +1565,21 @@ case $basic_machine in
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=-elf
|
||||
;;
|
||||
hexagon-*)
|
||||
os=-elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic55x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic6x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
@@ -1474,9 +1598,6 @@ case $basic_machine in
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
@@ -1613,7 +1734,7 @@ case $basic_machine in
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
-cnk*|-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
|
||||
234
configure.ac
234
configure.ac
@@ -5,7 +5,7 @@
|
||||
# Configure script for IJG libjpeg
|
||||
#
|
||||
|
||||
AC_INIT([libjpeg], [7.0])
|
||||
AC_INIT([libjpeg], [9.2.0])
|
||||
|
||||
# Directory where autotools helper scripts lives.
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
@@ -21,16 +21,13 @@ AC_CANONICAL_TARGET
|
||||
|
||||
# Initialize Automake
|
||||
# Don't require all the GNU mandated files
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror ansi2knr no-dist foreign])
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror no-dist foreign])
|
||||
|
||||
# Make --enable-silent-rules the default.
|
||||
# To get verbose build output you may configure
|
||||
# with --disable-silent-rules or use "make V=1".
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
# This is required when using the de-ANSI-fication feature.
|
||||
AM_C_PROTOTYPES
|
||||
|
||||
# Add configure option --enable-maintainer-mode which enables
|
||||
# dependency checking and generation useful to package maintainers.
|
||||
# This is made an option to avoid confusing end users.
|
||||
@@ -43,6 +40,7 @@ AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_LN_S
|
||||
AM_PROG_AR
|
||||
|
||||
# Check if LD supports linker scripts,
|
||||
# and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
|
||||
@@ -63,7 +61,7 @@ VERS_2 {
|
||||
global: sym;
|
||||
} VERS_1;
|
||||
EOF
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[have_ld_version_script=yes], [have_ld_version_script=no])
|
||||
rm -f conftest.map
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
@@ -72,9 +70,9 @@ fi
|
||||
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
||||
|
||||
# See if compiler supports prototypes.
|
||||
AC_MSG_CHECKING(for function prototypes)
|
||||
AC_CACHE_VAL(ijg_cv_have_prototypes,
|
||||
[AC_TRY_COMPILE([
|
||||
AC_MSG_CHECKING([for function prototypes])
|
||||
AC_CACHE_VAL([ijg_cv_have_prototypes],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
int testfunction (int arg1, int * arg2); /* check prototypes */
|
||||
struct methods_struct { /* check method-pointer declarations */
|
||||
int (*error_exit) (char *msgtext);
|
||||
@@ -85,25 +83,29 @@ int testfunction (int arg1, int * arg2) /* check definitions */
|
||||
{ return arg2[arg1]; }
|
||||
int test2function (void) /* check void arg list */
|
||||
{ return 0; }
|
||||
], [ ], ijg_cv_have_prototypes=yes, ijg_cv_have_prototypes=no)])
|
||||
AC_MSG_RESULT($ijg_cv_have_prototypes)
|
||||
]])],
|
||||
[ijg_cv_have_prototypes=yes],
|
||||
[ijg_cv_have_prototypes=no])])
|
||||
AC_MSG_RESULT([$ijg_cv_have_prototypes])
|
||||
if test $ijg_cv_have_prototypes = yes; then
|
||||
AC_DEFINE([HAVE_PROTOTYPES],[1],[Compiler supports function prototypes.])
|
||||
else
|
||||
echo Your compiler does not seem to know about function prototypes.
|
||||
echo Perhaps it needs a special switch to enable ANSI C mode.
|
||||
echo If so, we recommend running configure like this:
|
||||
echo " ./configure CC='cc -switch'"
|
||||
echo where -switch is the proper switch.
|
||||
AC_MSG_WARN([Your compiler does not seem to know about function prototypes.
|
||||
Perhaps it needs a special switch to enable ANSI C mode.
|
||||
If so, we recommend running configure like this:
|
||||
./configure CC='cc -switch'
|
||||
where -switch is the proper switch.])
|
||||
fi
|
||||
|
||||
# Check header files
|
||||
AC_CHECK_HEADERS(stddef.h stdlib.h locale.h)
|
||||
AC_CHECK_HEADER(string.h, , AC_DEFINE([NEED_BSD_STRINGS],[1],[Compiler has <strings.h> rather than standard <string.h>.]))
|
||||
AC_CHECK_HEADERS([stddef.h stdlib.h locale.h])
|
||||
AC_CHECK_HEADER([string.h], [],
|
||||
[AC_DEFINE([NEED_BSD_STRINGS], [1],
|
||||
[Compiler has <strings.h> rather than standard <string.h>.])])
|
||||
|
||||
# See whether type size_t is defined in any ANSI-standard places;
|
||||
# if not, perhaps it is defined in <sys/types.h>.
|
||||
AC_MSG_CHECKING(for size_t)
|
||||
AC_MSG_CHECKING([for size_t])
|
||||
AC_TRY_COMPILE([
|
||||
#ifdef HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
@@ -118,33 +120,42 @@ AC_TRY_COMPILE([
|
||||
#include <string.h>
|
||||
#endif
|
||||
typedef size_t my_size_t;
|
||||
], [ my_size_t foovar; ], ijg_size_t_ok=yes,
|
||||
[ijg_size_t_ok="not ANSI, perhaps it is in sys/types.h"])
|
||||
AC_MSG_RESULT($ijg_size_t_ok)
|
||||
],
|
||||
[ my_size_t foovar; ],
|
||||
[ijg_size_t_ok=yes],
|
||||
[ijg_size_t_ok="not ANSI, perhaps it is in sys/types.h"])
|
||||
AC_MSG_RESULT([$ijg_size_t_ok])
|
||||
if test "$ijg_size_t_ok" != yes; then
|
||||
AC_CHECK_HEADER(sys/types.h, [AC_DEFINE([NEED_SYS_TYPES_H],[1],[Need to include <sys/types.h> in order to obtain size_t.])
|
||||
AC_EGREP_CPP(size_t, [#include <sys/types.h>],
|
||||
[ijg_size_t_ok="size_t is in sys/types.h"], ijg_size_t_ok=no)],
|
||||
ijg_size_t_ok=no)
|
||||
AC_MSG_RESULT($ijg_size_t_ok)
|
||||
if test "$ijg_size_t_ok" = no; then
|
||||
echo Type size_t is not defined in any of the usual places.
|
||||
echo Try putting '"typedef unsigned int size_t;"' in jconfig.h.
|
||||
fi
|
||||
AC_CHECK_HEADER([sys/types.h],
|
||||
[AC_DEFINE([NEED_SYS_TYPES_H], [1],
|
||||
[Need to include <sys/types.h> in order to obtain size_t.])
|
||||
AC_EGREP_CPP([size_t], [#include <sys/types.h>],
|
||||
[ijg_size_t_ok="size_t is in sys/types.h"],
|
||||
[ijg_size_t_ok=no])],
|
||||
[ijg_size_t_ok=no])
|
||||
AC_MSG_RESULT([$ijg_size_t_ok])
|
||||
if test "$ijg_size_t_ok" = no; then
|
||||
AC_MSG_WARN([Type size_t is not defined in any of the usual places.
|
||||
Try putting '"typedef unsigned int size_t;"' in jconfig.h.])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check compiler characteristics
|
||||
AC_MSG_CHECKING(for type unsigned char)
|
||||
AC_TRY_COMPILE(, [ unsigned char un_char; ],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_UNSIGNED_CHAR],[1],[Compiler supports 'unsigned char'.])], AC_MSG_RESULT(no))
|
||||
dnl
|
||||
AC_MSG_CHECKING(for type unsigned short)
|
||||
AC_TRY_COMPILE(, [ unsigned short un_short; ],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_UNSIGNED_SHORT],[1],[Compiler supports 'unsigned short'.])], AC_MSG_RESULT(no))
|
||||
dnl
|
||||
AC_MSG_CHECKING(for type void)
|
||||
AC_MSG_CHECKING([for type unsigned char])
|
||||
AC_TRY_COMPILE([], [ unsigned char un_char; ],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_UNSIGNED_CHAR], [1],
|
||||
[Compiler supports 'unsigned char'.])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING([for type unsigned short])
|
||||
AC_TRY_COMPILE([], [ unsigned short un_short; ],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_UNSIGNED_SHORT], [1],
|
||||
[Compiler supports 'unsigned short'.])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING([for type void])
|
||||
AC_TRY_COMPILE([
|
||||
/* Caution: a C++ compiler will insist on valid prototypes */
|
||||
typedef void * void_ptr; /* check void * */
|
||||
@@ -166,40 +177,56 @@ void test3function (arg1, arg2)
|
||||
arg1 = (void *) locptr;
|
||||
(*arg2) (1, 2); /* check call of fcn returning void */
|
||||
}
|
||||
], [ ], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no)
|
||||
AC_DEFINE([void],[char],[Define 'void' as 'char' for archaic compilers that don't understand it.])])
|
||||
], [ ],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE([void], [char],
|
||||
[Define 'void' as 'char' for archaic compilers
|
||||
that don't understand it.])])
|
||||
AC_C_CONST
|
||||
|
||||
# Check for non-broken inline under various spellings
|
||||
AC_MSG_CHECKING(for inline)
|
||||
AC_MSG_CHECKING([for inline])
|
||||
ijg_cv_inline=""
|
||||
AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
|
||||
AC_TRY_COMPILE([], [} __inline__ int foo() { return 0; }
|
||||
int bar() { return foo();], ijg_cv_inline="__inline__",
|
||||
AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
|
||||
[AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
|
||||
int bar() { return foo();], ijg_cv_inline="__inline",
|
||||
AC_TRY_COMPILE(, [} inline int foo() { return 0; }
|
||||
int bar() { return foo();], ijg_cv_inline="inline")))
|
||||
[AC_TRY_COMPILE(, [} inline int foo() { return 0; }
|
||||
int bar() { return foo();], ijg_cv_inline="inline")])])
|
||||
AC_MSG_RESULT($ijg_cv_inline)
|
||||
AC_DEFINE_UNQUOTED([INLINE],[$ijg_cv_inline],[How to obtain function inlining.])
|
||||
AC_DEFINE_UNQUOTED([INLINE], [$ijg_cv_inline],
|
||||
[How to obtain function inlining.])
|
||||
|
||||
# We cannot check for bogus warnings, but at least we can check for errors
|
||||
AC_MSG_CHECKING(for broken incomplete types)
|
||||
AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], ,
|
||||
AC_MSG_RESULT(ok),
|
||||
[AC_MSG_RESULT(broken)
|
||||
AC_DEFINE([INCOMPLETE_TYPES_BROKEN],[1],[Compiler does not support pointers to unspecified structures.])])
|
||||
AC_MSG_CHECKING([for broken incomplete types])
|
||||
AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ],
|
||||
[],
|
||||
[AC_MSG_RESULT(ok)],
|
||||
[AC_MSG_RESULT(broken)
|
||||
AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
|
||||
[Compiler does not support pointers to unspecified
|
||||
structures.])])
|
||||
|
||||
# Test whether global names are unique to at least 15 chars
|
||||
AC_MSG_CHECKING(for short external names)
|
||||
AC_MSG_CHECKING([for short external names])
|
||||
AC_TRY_LINK([
|
||||
int possibly_duplicate_function () { return 0; }
|
||||
int possibly_dupli_function () { return 1; }
|
||||
], [ ], AC_MSG_RESULT(ok), [AC_MSG_RESULT(short)
|
||||
AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES],[1],[Linker requires that global names be unique in first 15 characters.])])
|
||||
], [],
|
||||
[AC_MSG_RESULT(ok)],
|
||||
[AC_MSG_RESULT(short)
|
||||
AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], [1],
|
||||
[Linker requires that global names be unique in
|
||||
first 15 characters.])])
|
||||
|
||||
# Run-time checks
|
||||
AC_MSG_CHECKING(to see if char is signed)
|
||||
AC_MSG_CHECKING([to see if char is signed])
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
int is_char_signed (int arg)
|
||||
#else
|
||||
@@ -220,13 +247,19 @@ char signed_char_check = (char) (-67);
|
||||
int main() {
|
||||
exit(is_char_signed((int) signed_char_check));
|
||||
}], [AC_MSG_RESULT(no)
|
||||
AC_DEFINE([CHAR_IS_UNSIGNED],[1],[Characters are unsigned])], AC_MSG_RESULT(yes),
|
||||
[echo Assuming that char is signed on target machine.
|
||||
echo If it is unsigned, this will be a little bit inefficient.
|
||||
AC_DEFINE([CHAR_IS_UNSIGNED], [1],
|
||||
[Characters are unsigned])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_WARN([Assuming that char is signed on target machine.
|
||||
If it is unsigned, this will be a little bit inefficient.])
|
||||
])
|
||||
dnl
|
||||
AC_MSG_CHECKING(to see if right shift is signed)
|
||||
|
||||
AC_MSG_CHECKING([to see if right shift is signed])
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
int is_shifting_signed (long arg)
|
||||
#else
|
||||
@@ -252,20 +285,29 @@ int is_shifting_signed (arg)
|
||||
}
|
||||
int main() {
|
||||
exit(is_shifting_signed(-0x7F7E80B1L));
|
||||
}], [AC_MSG_RESULT(no)
|
||||
AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED],[1],[Broken compiler shifts signed values as an unsigned shift.])], AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(Assuming that right shift is signed on target machine.))
|
||||
dnl
|
||||
AC_MSG_CHECKING(to see if fopen accepts b spec)
|
||||
}],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], [1],
|
||||
[Broken compiler shifts signed values as an unsigned shift.])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
|
||||
|
||||
AC_MSG_CHECKING([to see if fopen accepts b spec])
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
if (fopen("conftestdata", "wb") != NULL)
|
||||
exit(0);
|
||||
exit(1);
|
||||
}], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no)
|
||||
AC_DEFINE([DONT_USE_B_MODE],[1],[Don't open files in binary mode.])],
|
||||
AC_MSG_RESULT(Assuming that it does.))
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE([DONT_USE_B_MODE], [1],
|
||||
[Don't open files in binary mode.])],
|
||||
[AC_MSG_RESULT(Assuming that it does.)])
|
||||
|
||||
# Configure libtool
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
@@ -275,9 +317,9 @@ AC_PROG_LIBTOOL
|
||||
# If no "-enable-maxmem", use jmemnobs
|
||||
MEMORYMGR='jmemnobs'
|
||||
MAXMEM="no"
|
||||
AC_ARG_ENABLE(maxmem,
|
||||
AC_ARG_ENABLE([maxmem],
|
||||
[ --enable-maxmem[=N] enable use of temp files, set max mem usage to N MB],
|
||||
MAXMEM="$enableval")
|
||||
[MAXMEM="$enableval"])
|
||||
dnl [# support --with-maxmem for backwards compatibility with IJG V5.]
|
||||
dnl AC_ARG_WITH(maxmem, , MAXMEM="$withval")
|
||||
if test "x$MAXMEM" = xyes; then
|
||||
@@ -288,30 +330,36 @@ if test "x$MAXMEM" != xno; then
|
||||
AC_MSG_ERROR(non-numeric argument to --enable-maxmem)
|
||||
fi
|
||||
DEFAULTMAXMEM=`expr $MAXMEM \* 1048576`
|
||||
AC_DEFINE_UNQUOTED([DEFAULT_MAX_MEM], [${DEFAULTMAXMEM}], [Maximum data space library will allocate.])
|
||||
AC_MSG_CHECKING([for 'tmpfile()'])
|
||||
AC_TRY_LINK([#include <stdio.h>], [ FILE * tfile = tmpfile(); ],
|
||||
[AC_MSG_RESULT(yes)
|
||||
MEMORYMGR='jmemansi'],
|
||||
[AC_MSG_RESULT(no)
|
||||
dnl if tmpfile is not present, must use jmemname.
|
||||
MEMORYMGR='jmemname'
|
||||
AC_DEFINE_UNQUOTED([DEFAULT_MAX_MEM], [${DEFAULTMAXMEM}],
|
||||
[Maximum data space library will allocate.])
|
||||
AC_MSG_CHECKING([for 'tmpfile()'])
|
||||
AC_TRY_LINK([#include <stdio.h>], [ FILE * tfile = tmpfile(); ],
|
||||
[AC_MSG_RESULT(yes)
|
||||
MEMORYMGR='jmemansi'],
|
||||
[AC_MSG_RESULT(no)
|
||||
dnl if tmpfile is not present, must use jmemname.
|
||||
MEMORYMGR='jmemname'
|
||||
|
||||
# Test for the need to remove temporary files using a signal handler (for cjpeg/djpeg)
|
||||
AC_DEFINE([NEED_SIGNAL_CATCHER],[1],[Need signal handler to clean up temporary files.])
|
||||
AC_MSG_CHECKING([for 'mktemp()'])
|
||||
AC_TRY_LINK(, [ char fname[80]; mktemp(fname); ], AC_MSG_RESULT(yes),
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE([NO_MKTEMP],[1],[The mktemp() function is not available.])])])
|
||||
# Test for the need to remove temporary files using a signal handler
|
||||
# (for cjpeg/djpeg)
|
||||
AC_DEFINE([NEED_SIGNAL_CATCHER], [1],
|
||||
[Need signal handler to clean up temporary files.])
|
||||
AC_MSG_CHECKING([for 'mktemp()'])
|
||||
AC_TRY_LINK([], [ char fname[80]; mktemp(fname); ],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE([NO_MKTEMP], [1],
|
||||
[The mktemp() function is not available.])])])
|
||||
fi
|
||||
AC_SUBST(MEMORYMGR)
|
||||
AC_SUBST([MEMORYMGR])
|
||||
|
||||
# Extract the library version ID from jpeglib.h.
|
||||
# Extract the library version IDs from jpeglib.h.
|
||||
AC_MSG_CHECKING([libjpeg version number])
|
||||
[JPEG_LIB_VERSION=`sed -e '/^#define JPEG_LIB_VERSION/!d' -e 's/^[^0-9]*\([0-9][0-9]*\).*$/\1/' $srcdir/jpeglib.h`]
|
||||
[JPEG_LIB_VERSION="`expr $JPEG_LIB_VERSION / 10`:`expr $JPEG_LIB_VERSION % 10`"]
|
||||
[major=`sed -ne 's/^#define JPEG_LIB_VERSION_MAJOR *\([0-9][0-9]*\).*$/\1/p' $srcdir/jpeglib.h`
|
||||
minor=`sed -ne 's/^#define JPEG_LIB_VERSION_MINOR *\([0-9][0-9]*\).*$/\1/p' $srcdir/jpeglib.h`]
|
||||
AC_SUBST([JPEG_LIB_VERSION],
|
||||
[`expr $major + $minor`:0:$minor])
|
||||
AC_MSG_RESULT([$JPEG_LIB_VERSION])
|
||||
AC_SUBST([JPEG_LIB_VERSION])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
423
depcomp
423
depcomp
@@ -1,10 +1,9 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
|
||||
# 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
|
||||
@@ -28,7 +27,7 @@ scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
@@ -40,11 +39,11 @@ as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
@@ -57,6 +56,66 @@ EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
@@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
@@ -90,10 +152,24 @@ if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
@@ -114,8 +190,7 @@ gcc3)
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
@@ -123,13 +198,17 @@ gcc3)
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
@@ -137,31 +216,31 @@ gcc)
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
@@ -179,8 +258,7 @@ sgi)
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
@@ -188,43 +266,41 @@ sgi)
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
@@ -237,9 +313,7 @@ aix)
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
@@ -248,44 +322,100 @@ aix)
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
@@ -297,8 +427,8 @@ icc)
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
@@ -309,9 +439,8 @@ hp2)
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
@@ -322,8 +451,7 @@ hp2)
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
@@ -333,8 +461,8 @@ hp2)
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
@@ -342,67 +470,97 @@ hp2)
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
@@ -422,7 +580,7 @@ dashmstdout)
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
@@ -442,18 +600,18 @@ dashmstdout)
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
@@ -503,12 +661,15 @@ makedepend)
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
@@ -525,7 +686,7 @@ cpp)
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
@@ -544,10 +705,10 @@ cpp)
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
@@ -594,8 +755,8 @@ msvisualcpp)
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
32
djpeg.1
32
djpeg.1
@@ -1,4 +1,4 @@
|
||||
.TH DJPEG 1 "28 March 2009"
|
||||
.TH DJPEG 1 "26 July 2015"
|
||||
.SH NAME
|
||||
djpeg \- decompress a JPEG file to an image file
|
||||
.SH SYNOPSIS
|
||||
@@ -55,16 +55,22 @@ default options are chosen for highest quality output.) Currently, this is
|
||||
equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR.
|
||||
.TP
|
||||
.B \-grayscale
|
||||
Force gray-scale output even if JPEG file is color. Useful for viewing on
|
||||
monochrome displays; also,
|
||||
Force grayscale output even if JPEG file is color.
|
||||
Useful for viewing on monochrome displays; also,
|
||||
.B djpeg
|
||||
runs noticeably faster in this mode.
|
||||
.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"
|
||||
Scale the output image by a factor M/N. Currently supported scale factors are
|
||||
M/8 with all M from 1 to 16. If the /N part is omitted, then M specifies the
|
||||
DCT scaled size to be applied on the given input, which is currently
|
||||
equivalent to M/8 scaling, since the source DCT size is currently always 8.
|
||||
M/N with all M from 1 to 16, where N is the source DCT size, which is 8 for
|
||||
baseline JPEG. If the /N part is omitted, then M specifies the DCT scaled
|
||||
size to be applied on the given input. For baseline JPEG this is equivalent
|
||||
to M/8 scaling, since the source DCT size for baseline JPEG is 8.
|
||||
Scaling is handy if the image is larger than your screen; also,
|
||||
.B djpeg
|
||||
runs much faster when scaling down the output.
|
||||
@@ -75,7 +81,7 @@ emitted if
|
||||
.B \-colors
|
||||
or
|
||||
.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.
|
||||
.TP
|
||||
.B \-gif
|
||||
@@ -89,12 +95,12 @@ emitted if
|
||||
.B \-colors
|
||||
or
|
||||
.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.
|
||||
.TP
|
||||
.B \-pnm
|
||||
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
|
||||
is specified; otherwise PPM is emitted.
|
||||
.TP
|
||||
@@ -102,8 +108,8 @@ is specified; otherwise PPM is emitted.
|
||||
Select RLE output format. (Requires URT library.)
|
||||
.TP
|
||||
.B \-targa
|
||||
Select Targa output format. Gray-scale format is emitted if the JPEG file is
|
||||
gray-scale or if
|
||||
Select Targa output format. Grayscale format is emitted if the JPEG file is
|
||||
grayscale or if
|
||||
.B \-grayscale
|
||||
is specified; otherwise, colormapped format is emitted if
|
||||
.B \-colors
|
||||
@@ -161,7 +167,7 @@ faster and needs less memory, but it produces a lower-quality image.
|
||||
is ignored unless you also say
|
||||
.B \-colors
|
||||
.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).
|
||||
.TP
|
||||
.BI \-maxmemory " N"
|
||||
@@ -245,7 +251,7 @@ Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
|
||||
.SH AUTHOR
|
||||
Independent JPEG Group
|
||||
.SH BUGS
|
||||
To avoid the Unisys LZW patent,
|
||||
To avoid the Unisys LZW patent (now expired),
|
||||
.B djpeg
|
||||
produces uncompressed GIF files. These are larger than they should be, but
|
||||
are readable by standard GIF decoders.
|
||||
|
||||
11
djpeg.c
11
djpeg.c
@@ -2,7 +2,7 @@
|
||||
* djpeg.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2009 by Guido Vollbeding.
|
||||
* Modified 2009-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* 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, " -fast Fast, low-quality processing\n");
|
||||
fprintf(stderr, " -grayscale Force grayscale output\n");
|
||||
fprintf(stderr, " -rgb Force RGB output\n");
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n");
|
||||
#endif
|
||||
@@ -264,6 +265,10 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
||||
/* Force monochrome output. */
|
||||
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)) {
|
||||
/* Quantize to a color map taken from an input file. */
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
@@ -298,7 +303,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
||||
cinfo->mem->max_memory_to_use = lval * 1000L;
|
||||
|
||||
} else if (keymatch(arg, "nosmooth", 3)) {
|
||||
/* Suppress fancy upsampling */
|
||||
/* Suppress fancy upsampling. */
|
||||
cinfo->do_fancy_upsampling = FALSE;
|
||||
|
||||
} else if (keymatch(arg, "onepass", 3)) {
|
||||
@@ -327,7 +332,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv,
|
||||
/* Scale the output image by a fraction M/N. */
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
usage();
|
||||
if (sscanf(argv[argn], "%d/%d",
|
||||
if (sscanf(argv[argn], "%u/%u",
|
||||
&cinfo->scale_num, &cinfo->scale_denom) < 1)
|
||||
usage();
|
||||
|
||||
|
||||
10
filelist.txt
10
filelist.txt
@@ -1,6 +1,6 @@
|
||||
IJG JPEG LIBRARY: FILE LIST
|
||||
|
||||
Copyright (C) 1994-2009, 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.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
@@ -73,7 +73,7 @@ jfdctflt.c Forward DCT using floating-point arithmetic.
|
||||
jchuff.c Huffman entropy coding.
|
||||
jcarith.c Arithmetic entropy coding.
|
||||
jcmarker.c JPEG marker writing.
|
||||
jdatadst.c Data destination manager for stdio output.
|
||||
jdatadst.c Data destination managers for memory and stdio output.
|
||||
|
||||
Decompression side of the library:
|
||||
|
||||
@@ -95,7 +95,7 @@ jdmerge.c Merged upsampling/color conversion (faster, lower quality).
|
||||
jquant1.c One-pass color quantization using a fixed-spacing colormap.
|
||||
jquant2.c Two-pass color quantization using a custom-generated colormap.
|
||||
Also handles one-pass quantization to an externally given map.
|
||||
jdatasrc.c Data source manager for stdio input.
|
||||
jdatasrc.c Data source managers for memory and stdio input.
|
||||
|
||||
Support files for both compression and decompression:
|
||||
|
||||
@@ -197,6 +197,8 @@ config.guess
|
||||
config.sub
|
||||
depcomp
|
||||
missing
|
||||
ar-lib
|
||||
compile
|
||||
install-sh Install shell script for those Unix systems lacking one.
|
||||
Makefile.in Makefile input for configure.
|
||||
Makefile.am Source file for use with Automake to generate Makefile.in.
|
||||
@@ -206,8 +208,6 @@ mak*.* Sample makefiles for particular systems.
|
||||
jconfig.* Sample jconfig.h for particular systems.
|
||||
libjpeg.map Script to generate shared library with versioned symbols.
|
||||
aclocal.m4 M4 macro definitions for use with Autoconf.
|
||||
ansi2knr.c De-ANSIfier for pre-ANSI C compilers (courtesy of
|
||||
L. Peter Deutsch and Aladdin Enterprises).
|
||||
|
||||
Test files (see install.txt for test procedure):
|
||||
|
||||
|
||||
131
install-sh
131
install-sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
scriptversion=2013-12-25.23; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
@@ -35,25 +35,21 @@ scriptversion=2009-04-28.21; # UTC
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
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-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
@@ -68,17 +64,6 @@ mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
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=
|
||||
|
||||
# Desired mode of installed file.
|
||||
@@ -97,7 +82,7 @@ dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
@@ -143,8 +128,7 @@ while test $# -ne 0; do
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
@@ -155,10 +139,16 @@ while test $# -ne 0; do
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
@@ -173,6 +163,16 @@ while test $# -ne 0; do
|
||||
shift
|
||||
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
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
@@ -186,6 +186,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -194,13 +198,26 @@ if test $# -eq 0; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
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
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
@@ -228,9 +245,9 @@ fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
@@ -252,17 +269,12 @@ do
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
@@ -270,33 +282,7 @@ do
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
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'
|
||||
`
|
||||
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
@@ -347,7 +333,7 @@ do
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable 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.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
@@ -385,25 +371,23 @@ do
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
@@ -467,13 +451,10 @@ do
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
|
||||
150
install.txt
150
install.txt
@@ -1,6 +1,6 @@
|
||||
INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software
|
||||
|
||||
Copyright (C) 1991-2009, 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.
|
||||
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.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only)
|
||||
makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
|
||||
makefile.vc jconfig.vc Windows NT/95, MS Visual C++
|
||||
make*.vc6 jconfig.vc Windows NT/95, MS Visual C++ 6
|
||||
make*.vc9 jconfig.vc Windows NT/95, MS Visual C++ 2008 (v9)
|
||||
makefile.vc jconfig.vc Windows NT/9x, MS Visual C++
|
||||
make*.vc6 jconfig.vc Windows NT/9x, MS Visual C++ 6
|
||||
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.vms jconfig.vms Digital VMS, without MMS software
|
||||
|
||||
@@ -321,9 +322,9 @@ several forms:
|
||||
testimg.jpg The output of cjpeg testimg.ppm
|
||||
testprog.jpg Progressive-mode equivalent of testorig.jpg.
|
||||
testimgp.jpg The output of cjpeg -progressive -optimize testimg.ppm
|
||||
(The first- and second-generation .jpg files aren't identical since JPEG is
|
||||
lossy.) If you can generate duplicates of the testimg* files then you
|
||||
probably have working programs.
|
||||
(The first- and second-generation .jpg files aren't identical since the
|
||||
default compression parameters are lossy.) If you can generate duplicates
|
||||
of the testimg* files then you probably have working programs.
|
||||
|
||||
With most of the makefiles, "make test" will perform the necessary
|
||||
comparisons.
|
||||
@@ -418,54 +419,58 @@ support as follows:
|
||||
the directory containing the URT "librle.a" file (typically the
|
||||
"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,
|
||||
this means 8 or 12 bits per channel, of course.) If you need to work with
|
||||
deeper than 8-bit data, you can compile the IJG code for 12-bit operation.
|
||||
The IJG code currently allows 8, 9, 10, 11, or 12 bits sample data precision.
|
||||
(For color, this means 8 to 12 bits per channel, of course.) If you need to
|
||||
work with deeper than 8-bit data, you can compile the IJG code for 9-bit to
|
||||
12-bit operation.
|
||||
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,
|
||||
because the code for those formats doesn't handle 12-bit data and won't
|
||||
even compile. (The PPM code does work, as explained below. The GIF
|
||||
code works too; it scales 8-bit GIF data to and from 12-bit depth
|
||||
automatically.)
|
||||
because the code for those formats doesn't handle deeper than 8-bit data
|
||||
and won't even compile. (The PPM code does work, as explained below.
|
||||
The GIF code works too; it scales 8-bit GIF data to and from 12-bit
|
||||
depth automatically.)
|
||||
3. Compile. Don't expect "make test" to pass, since the supplied test
|
||||
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;
|
||||
so you'll want to keep around a regular 8-bit compilation as well.
|
||||
(Run-time selection of data depth, to allow a single copy that does both,
|
||||
is possible but would probably slow things down considerably; it's very low
|
||||
on our to-do list.)
|
||||
Run-time selection and conversion of data precision are currently not
|
||||
supported and may be added later.
|
||||
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 PPM reader (rdppm.c) can read 12-bit data from either text-format or
|
||||
binary-format PPM and PGM files. Binary-format PPM/PGM files which have a
|
||||
maxval greater than 255 are assumed to use 2 bytes per sample, MSB first
|
||||
(big-endian order). As of early 1995, 2-byte binary format is not
|
||||
The PPM reader (rdppm.c) can read deeper than 8-bit data from either
|
||||
text-format or binary-format PPM and PGM files. Binary-format PPM/PGM files
|
||||
which have a maxval greater than 255 are assumed to use 2 bytes per sample,
|
||||
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
|
||||
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
|
||||
data is automatically rescaled to either maxval=255 or maxval=4095 as
|
||||
appropriate for the cjpeg bit depth.
|
||||
data is automatically rescaled to maxval=MAXJSAMPLE as appropriate for the
|
||||
cjpeg bit depth.
|
||||
|
||||
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
|
||||
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
|
||||
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.)
|
||||
|
||||
Of course, if you are working with 12-bit data, you probably have it stored
|
||||
in some other, nonstandard format. In that case you'll probably want to
|
||||
write your own I/O modules to read and write your format.
|
||||
Of course, if you are working with 9-bit to 12-bit data, you probably have
|
||||
it stored in some other, nonstandard format. In that case you'll probably
|
||||
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
|
||||
order to generate valid Huffman tables. This is necessary because our
|
||||
default Huffman tables only cover 8-bit data.
|
||||
Note:
|
||||
The standard Huffman tables are only valid for 8-bit data precision. If
|
||||
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:
|
||||
|
||||
@@ -848,17 +853,23 @@ with /Oo-.
|
||||
Microsoft Windows (all versions), generic comments:
|
||||
|
||||
Some Windows system include files define typedef boolean as "unsigned char".
|
||||
The IJG code also defines typedef boolean, but we make it "int" by default.
|
||||
The IJG code also defines typedef boolean, but we make it an "enum" by default.
|
||||
This doesn't affect the IJG programs because we don't import those Windows
|
||||
include files. But if you use the JPEG library in your own program, and some
|
||||
of your program's files import one definition of boolean while some import the
|
||||
other, you can get all sorts of mysterious problems. A good preventive step
|
||||
is to make the IJG library use "unsigned char" for boolean. To do that,
|
||||
add something like this to your jconfig.h file:
|
||||
/* Define "boolean" as unsigned char, not int, per Windows custom */
|
||||
/* Define "boolean" as unsigned char, not enum, per Windows custom */
|
||||
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
typedef unsigned char boolean;
|
||||
#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 */
|
||||
(This is already in jconfig.vc, by the way.)
|
||||
|
||||
@@ -998,8 +1009,8 @@ model. makefile.vc is intended for command-line use. (If you are using
|
||||
the Developer Studio environment, you may prefer the DevStudio project
|
||||
files; see below.)
|
||||
|
||||
v7 adds extern "C" to jpeglib.h. This avoids the need to put extern "C"
|
||||
{ ... } around #include "jpeglib.h" in your C++ application.
|
||||
IJG JPEG 7 adds extern "C" to jpeglib.h. This avoids the need to put
|
||||
extern "C" { ... } around #include "jpeglib.h" in your C++ application.
|
||||
You can also force VC++ to treat the library as C++ code by renaming
|
||||
all the *.c files to *.cpp (and adjusting the makefile to match).
|
||||
In this case you also need to define the symbol DONT_USE_EXTERN_C in
|
||||
@@ -1015,51 +1026,50 @@ as Win32 console applications. (Even if you only want the library, we
|
||||
recommend building the applications so that you can run the self-test.)
|
||||
|
||||
To use:
|
||||
1. Copy jconfig.vc to jconfig.h, makejdsw.vc6 to jpeg.dsw,
|
||||
makeadsw.vc6 to apps.dsw, makejmak.vc6 to jpeg.mak,
|
||||
makejdep.vc6 to jpeg.dep, makejdsp.vc6 to jpeg.dsp,
|
||||
makecmak.vc6 to cjpeg.mak, makecdep.vc6 to cjpeg.dep,
|
||||
makecdsp.vc6 to cjpeg.dsp, makedmak.vc6 to djpeg.mak,
|
||||
makeddep.vc6 to djpeg.dep, makeddsp.vc6 to djpeg.dsp,
|
||||
maketmak.vc6 to jpegtran.mak, maketdep.vc6 to jpegtran.dep,
|
||||
maketdsp.vc6 to jpegtran.dsp, makermak.vc6 to rdjpgcom.mak,
|
||||
makerdep.vc6 to rdjpgcom.dep, makerdsp.vc6 to rdjpgcom.dsp,
|
||||
makewmak.vc6 to wrjpgcom.mak, makewdep.vc6 to wrjpgcom.dep, and
|
||||
makewdsp.vc6 to wrjpgcom.dsp. (Note that the renaming is critical!)
|
||||
2. Click on jpeg.dsw and apps.dsw to load the project workspaces.
|
||||
1. Open the command prompt, change to the main directory and execute the
|
||||
command line
|
||||
NMAKE /f makefile.vc setup-vc6
|
||||
This will move jconfig.vc to jconfig.h and makefiles to project files.
|
||||
(Note that the renaming is critical!)
|
||||
2. Open the workspace file jpeg.dsw, build the library project.
|
||||
(If you are using DevStudio more recent than 6.0, you'll probably
|
||||
get a message saying that the project files are being updated.)
|
||||
3. Build the library project, then the applications project.
|
||||
4. Move the application .exe files from `app`\Release to an
|
||||
3. Open the workspace file apps.dsw, build the application projects.
|
||||
4. To perform the self-test, execute the command line
|
||||
NMAKE /f makefile.vc test-build
|
||||
5. Move the application .exe files from `app`\Release to an
|
||||
appropriate location on your path.
|
||||
5. To perform the self-test, execute the command line
|
||||
NMAKE /f makefile.vc test
|
||||
|
||||
|
||||
Microsoft Windows, Microsoft Visual C++ 2008 Developer Studio (v9):
|
||||
Microsoft Windows, Microsoft Visual C++ 2010 Developer Studio (v10):
|
||||
|
||||
We include makefiles that should work as project files in Visual Studio
|
||||
2008 or later. There is a library makefile that builds the IJG library
|
||||
2010 or later. There is a library makefile that builds the IJG library
|
||||
as a static Win32 library, and application makefiles that build the sample
|
||||
applications as Win32 console applications. (Even if you only want the
|
||||
library, we recommend building the applications so that you can run the
|
||||
self-test.)
|
||||
|
||||
To use:
|
||||
1. Copy jconfig.vc to jconfig.h, makejsln.vc9 to jpeg.sln,
|
||||
makeasln.vc9 to apps.sln, makejvcp.vc9 to jpeg.vcproj,
|
||||
makecvcp.vc9 to cjpeg.vcproj, makedvcp.vc9 to djpeg.vcproj,
|
||||
maketvcp.vc9 to jpegtran.vcproj, makervcp.vc9 to rdjpgcom.vcproj, and
|
||||
makewvcp.vc9 to wrjpgcom.vcproj. (Note that the renaming is critical!)
|
||||
2. Click on jpeg.sln and apps.sln to load the project solutions.
|
||||
(If you are using Visual Studio more recent than 2008 (v9), you'll
|
||||
probably get a message saying that the project files are being
|
||||
updated.)
|
||||
3. Build the library project, then the applications project.
|
||||
4. Move the application .exe files from `app`\Release to an
|
||||
1. Open the command prompt, change to the main directory and execute the
|
||||
command line
|
||||
NMAKE /f makefile.vc setup-v10
|
||||
This will move jconfig.vc to jconfig.h and makefiles to project files.
|
||||
(Note that the renaming is critical!)
|
||||
2. Open the solution file jpeg.sln, build the library project.
|
||||
(If you are using Visual Studio more recent than 2010 (v10), you'll
|
||||
probably get a message saying that the project files are being updated.)
|
||||
3. Open the solution file apps.sln, build the application projects.
|
||||
4. To perform the self-test, execute the command line
|
||||
NMAKE /f makefile.vc test-build
|
||||
5. Move the application .exe files from `app`\Release to an
|
||||
appropriate location on your path.
|
||||
5. To perform the self-test, execute the command line
|
||||
NMAKE /f makefile.vc test
|
||||
|
||||
Note:
|
||||
There seems to be an optimization bug in the compiler which causes the
|
||||
self-test to fail with the color quantization option.
|
||||
We have disabled optimization for the file jquant2.c in the library
|
||||
project file which causes the self-test to pass properly.
|
||||
|
||||
|
||||
OS/2, Borland C++:
|
||||
|
||||
243
jaricom.c
243
jaricom.c
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* jaricom.c
|
||||
*
|
||||
* Developed 1997 by Guido Vollbeding.
|
||||
* Developed 1997-2011 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains probability estimation tables for common use in
|
||||
* arithmetic entropy encoding and decoding routines.
|
||||
*
|
||||
* This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1
|
||||
* and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec
|
||||
* (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82).
|
||||
* This data represents Table D.3 in the JPEG spec (D.2 in the draft),
|
||||
* ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81, and Table 24
|
||||
* in the JBIG spec, ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82.
|
||||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
@@ -26,123 +26,128 @@
|
||||
* implementation (jbig_tab.c).
|
||||
*/
|
||||
|
||||
#define V(a,b,c,d) (((INT32)a << 16) | ((INT32)c << 8) | ((INT32)d << 7) | b)
|
||||
#define V(i,a,b,c,d) (((INT32)a << 16) | ((INT32)c << 8) | ((INT32)d << 7) | b)
|
||||
|
||||
const INT32 jaritab[113] = {
|
||||
const INT32 jpeg_aritab[113+1] = {
|
||||
/*
|
||||
* Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS
|
||||
*/
|
||||
/* 0 */ V( 0x5a1d, 1, 1, 1 ),
|
||||
/* 1 */ V( 0x2586, 14, 2, 0 ),
|
||||
/* 2 */ V( 0x1114, 16, 3, 0 ),
|
||||
/* 3 */ V( 0x080b, 18, 4, 0 ),
|
||||
/* 4 */ V( 0x03d8, 20, 5, 0 ),
|
||||
/* 5 */ V( 0x01da, 23, 6, 0 ),
|
||||
/* 6 */ V( 0x00e5, 25, 7, 0 ),
|
||||
/* 7 */ V( 0x006f, 28, 8, 0 ),
|
||||
/* 8 */ V( 0x0036, 30, 9, 0 ),
|
||||
/* 9 */ V( 0x001a, 33, 10, 0 ),
|
||||
/* 10 */ V( 0x000d, 35, 11, 0 ),
|
||||
/* 11 */ V( 0x0006, 9, 12, 0 ),
|
||||
/* 12 */ V( 0x0003, 10, 13, 0 ),
|
||||
/* 13 */ V( 0x0001, 12, 13, 0 ),
|
||||
/* 14 */ V( 0x5a7f, 15, 15, 1 ),
|
||||
/* 15 */ V( 0x3f25, 36, 16, 0 ),
|
||||
/* 16 */ V( 0x2cf2, 38, 17, 0 ),
|
||||
/* 17 */ V( 0x207c, 39, 18, 0 ),
|
||||
/* 18 */ V( 0x17b9, 40, 19, 0 ),
|
||||
/* 19 */ V( 0x1182, 42, 20, 0 ),
|
||||
/* 20 */ V( 0x0cef, 43, 21, 0 ),
|
||||
/* 21 */ V( 0x09a1, 45, 22, 0 ),
|
||||
/* 22 */ V( 0x072f, 46, 23, 0 ),
|
||||
/* 23 */ V( 0x055c, 48, 24, 0 ),
|
||||
/* 24 */ V( 0x0406, 49, 25, 0 ),
|
||||
/* 25 */ V( 0x0303, 51, 26, 0 ),
|
||||
/* 26 */ V( 0x0240, 52, 27, 0 ),
|
||||
/* 27 */ V( 0x01b1, 54, 28, 0 ),
|
||||
/* 28 */ V( 0x0144, 56, 29, 0 ),
|
||||
/* 29 */ V( 0x00f5, 57, 30, 0 ),
|
||||
/* 30 */ V( 0x00b7, 59, 31, 0 ),
|
||||
/* 31 */ V( 0x008a, 60, 32, 0 ),
|
||||
/* 32 */ V( 0x0068, 62, 33, 0 ),
|
||||
/* 33 */ V( 0x004e, 63, 34, 0 ),
|
||||
/* 34 */ V( 0x003b, 32, 35, 0 ),
|
||||
/* 35 */ V( 0x002c, 33, 9, 0 ),
|
||||
/* 36 */ V( 0x5ae1, 37, 37, 1 ),
|
||||
/* 37 */ V( 0x484c, 64, 38, 0 ),
|
||||
/* 38 */ V( 0x3a0d, 65, 39, 0 ),
|
||||
/* 39 */ V( 0x2ef1, 67, 40, 0 ),
|
||||
/* 40 */ V( 0x261f, 68, 41, 0 ),
|
||||
/* 41 */ V( 0x1f33, 69, 42, 0 ),
|
||||
/* 42 */ V( 0x19a8, 70, 43, 0 ),
|
||||
/* 43 */ V( 0x1518, 72, 44, 0 ),
|
||||
/* 44 */ V( 0x1177, 73, 45, 0 ),
|
||||
/* 45 */ V( 0x0e74, 74, 46, 0 ),
|
||||
/* 46 */ V( 0x0bfb, 75, 47, 0 ),
|
||||
/* 47 */ V( 0x09f8, 77, 48, 0 ),
|
||||
/* 48 */ V( 0x0861, 78, 49, 0 ),
|
||||
/* 49 */ V( 0x0706, 79, 50, 0 ),
|
||||
/* 50 */ V( 0x05cd, 48, 51, 0 ),
|
||||
/* 51 */ V( 0x04de, 50, 52, 0 ),
|
||||
/* 52 */ V( 0x040f, 50, 53, 0 ),
|
||||
/* 53 */ V( 0x0363, 51, 54, 0 ),
|
||||
/* 54 */ V( 0x02d4, 52, 55, 0 ),
|
||||
/* 55 */ V( 0x025c, 53, 56, 0 ),
|
||||
/* 56 */ V( 0x01f8, 54, 57, 0 ),
|
||||
/* 57 */ V( 0x01a4, 55, 58, 0 ),
|
||||
/* 58 */ V( 0x0160, 56, 59, 0 ),
|
||||
/* 59 */ V( 0x0125, 57, 60, 0 ),
|
||||
/* 60 */ V( 0x00f6, 58, 61, 0 ),
|
||||
/* 61 */ V( 0x00cb, 59, 62, 0 ),
|
||||
/* 62 */ V( 0x00ab, 61, 63, 0 ),
|
||||
/* 63 */ V( 0x008f, 61, 32, 0 ),
|
||||
/* 64 */ V( 0x5b12, 65, 65, 1 ),
|
||||
/* 65 */ V( 0x4d04, 80, 66, 0 ),
|
||||
/* 66 */ V( 0x412c, 81, 67, 0 ),
|
||||
/* 67 */ V( 0x37d8, 82, 68, 0 ),
|
||||
/* 68 */ V( 0x2fe8, 83, 69, 0 ),
|
||||
/* 69 */ V( 0x293c, 84, 70, 0 ),
|
||||
/* 70 */ V( 0x2379, 86, 71, 0 ),
|
||||
/* 71 */ V( 0x1edf, 87, 72, 0 ),
|
||||
/* 72 */ V( 0x1aa9, 87, 73, 0 ),
|
||||
/* 73 */ V( 0x174e, 72, 74, 0 ),
|
||||
/* 74 */ V( 0x1424, 72, 75, 0 ),
|
||||
/* 75 */ V( 0x119c, 74, 76, 0 ),
|
||||
/* 76 */ V( 0x0f6b, 74, 77, 0 ),
|
||||
/* 77 */ V( 0x0d51, 75, 78, 0 ),
|
||||
/* 78 */ V( 0x0bb6, 77, 79, 0 ),
|
||||
/* 79 */ V( 0x0a40, 77, 48, 0 ),
|
||||
/* 80 */ V( 0x5832, 80, 81, 1 ),
|
||||
/* 81 */ V( 0x4d1c, 88, 82, 0 ),
|
||||
/* 82 */ V( 0x438e, 89, 83, 0 ),
|
||||
/* 83 */ V( 0x3bdd, 90, 84, 0 ),
|
||||
/* 84 */ V( 0x34ee, 91, 85, 0 ),
|
||||
/* 85 */ V( 0x2eae, 92, 86, 0 ),
|
||||
/* 86 */ V( 0x299a, 93, 87, 0 ),
|
||||
/* 87 */ V( 0x2516, 86, 71, 0 ),
|
||||
/* 88 */ V( 0x5570, 88, 89, 1 ),
|
||||
/* 89 */ V( 0x4ca9, 95, 90, 0 ),
|
||||
/* 90 */ V( 0x44d9, 96, 91, 0 ),
|
||||
/* 91 */ V( 0x3e22, 97, 92, 0 ),
|
||||
/* 92 */ V( 0x3824, 99, 93, 0 ),
|
||||
/* 93 */ V( 0x32b4, 99, 94, 0 ),
|
||||
/* 94 */ V( 0x2e17, 93, 86, 0 ),
|
||||
/* 95 */ V( 0x56a8, 95, 96, 1 ),
|
||||
/* 96 */ V( 0x4f46, 101, 97, 0 ),
|
||||
/* 97 */ V( 0x47e5, 102, 98, 0 ),
|
||||
/* 98 */ V( 0x41cf, 103, 99, 0 ),
|
||||
/* 99 */ V( 0x3c3d, 104, 100, 0 ),
|
||||
/* 100 */ V( 0x375e, 99, 93, 0 ),
|
||||
/* 101 */ V( 0x5231, 105, 102, 0 ),
|
||||
/* 102 */ V( 0x4c0f, 106, 103, 0 ),
|
||||
/* 103 */ V( 0x4639, 107, 104, 0 ),
|
||||
/* 104 */ V( 0x415e, 103, 99, 0 ),
|
||||
/* 105 */ V( 0x5627, 105, 106, 1 ),
|
||||
/* 106 */ V( 0x50e7, 108, 107, 0 ),
|
||||
/* 107 */ V( 0x4b85, 109, 103, 0 ),
|
||||
/* 108 */ V( 0x5597, 110, 109, 0 ),
|
||||
/* 109 */ V( 0x504f, 111, 107, 0 ),
|
||||
/* 110 */ V( 0x5a10, 110, 111, 1 ),
|
||||
/* 111 */ V( 0x5522, 112, 109, 0 ),
|
||||
/* 112 */ V( 0x59eb, 112, 111, 1 )
|
||||
V( 0, 0x5a1d, 1, 1, 1 ),
|
||||
V( 1, 0x2586, 14, 2, 0 ),
|
||||
V( 2, 0x1114, 16, 3, 0 ),
|
||||
V( 3, 0x080b, 18, 4, 0 ),
|
||||
V( 4, 0x03d8, 20, 5, 0 ),
|
||||
V( 5, 0x01da, 23, 6, 0 ),
|
||||
V( 6, 0x00e5, 25, 7, 0 ),
|
||||
V( 7, 0x006f, 28, 8, 0 ),
|
||||
V( 8, 0x0036, 30, 9, 0 ),
|
||||
V( 9, 0x001a, 33, 10, 0 ),
|
||||
V( 10, 0x000d, 35, 11, 0 ),
|
||||
V( 11, 0x0006, 9, 12, 0 ),
|
||||
V( 12, 0x0003, 10, 13, 0 ),
|
||||
V( 13, 0x0001, 12, 13, 0 ),
|
||||
V( 14, 0x5a7f, 15, 15, 1 ),
|
||||
V( 15, 0x3f25, 36, 16, 0 ),
|
||||
V( 16, 0x2cf2, 38, 17, 0 ),
|
||||
V( 17, 0x207c, 39, 18, 0 ),
|
||||
V( 18, 0x17b9, 40, 19, 0 ),
|
||||
V( 19, 0x1182, 42, 20, 0 ),
|
||||
V( 20, 0x0cef, 43, 21, 0 ),
|
||||
V( 21, 0x09a1, 45, 22, 0 ),
|
||||
V( 22, 0x072f, 46, 23, 0 ),
|
||||
V( 23, 0x055c, 48, 24, 0 ),
|
||||
V( 24, 0x0406, 49, 25, 0 ),
|
||||
V( 25, 0x0303, 51, 26, 0 ),
|
||||
V( 26, 0x0240, 52, 27, 0 ),
|
||||
V( 27, 0x01b1, 54, 28, 0 ),
|
||||
V( 28, 0x0144, 56, 29, 0 ),
|
||||
V( 29, 0x00f5, 57, 30, 0 ),
|
||||
V( 30, 0x00b7, 59, 31, 0 ),
|
||||
V( 31, 0x008a, 60, 32, 0 ),
|
||||
V( 32, 0x0068, 62, 33, 0 ),
|
||||
V( 33, 0x004e, 63, 34, 0 ),
|
||||
V( 34, 0x003b, 32, 35, 0 ),
|
||||
V( 35, 0x002c, 33, 9, 0 ),
|
||||
V( 36, 0x5ae1, 37, 37, 1 ),
|
||||
V( 37, 0x484c, 64, 38, 0 ),
|
||||
V( 38, 0x3a0d, 65, 39, 0 ),
|
||||
V( 39, 0x2ef1, 67, 40, 0 ),
|
||||
V( 40, 0x261f, 68, 41, 0 ),
|
||||
V( 41, 0x1f33, 69, 42, 0 ),
|
||||
V( 42, 0x19a8, 70, 43, 0 ),
|
||||
V( 43, 0x1518, 72, 44, 0 ),
|
||||
V( 44, 0x1177, 73, 45, 0 ),
|
||||
V( 45, 0x0e74, 74, 46, 0 ),
|
||||
V( 46, 0x0bfb, 75, 47, 0 ),
|
||||
V( 47, 0x09f8, 77, 48, 0 ),
|
||||
V( 48, 0x0861, 78, 49, 0 ),
|
||||
V( 49, 0x0706, 79, 50, 0 ),
|
||||
V( 50, 0x05cd, 48, 51, 0 ),
|
||||
V( 51, 0x04de, 50, 52, 0 ),
|
||||
V( 52, 0x040f, 50, 53, 0 ),
|
||||
V( 53, 0x0363, 51, 54, 0 ),
|
||||
V( 54, 0x02d4, 52, 55, 0 ),
|
||||
V( 55, 0x025c, 53, 56, 0 ),
|
||||
V( 56, 0x01f8, 54, 57, 0 ),
|
||||
V( 57, 0x01a4, 55, 58, 0 ),
|
||||
V( 58, 0x0160, 56, 59, 0 ),
|
||||
V( 59, 0x0125, 57, 60, 0 ),
|
||||
V( 60, 0x00f6, 58, 61, 0 ),
|
||||
V( 61, 0x00cb, 59, 62, 0 ),
|
||||
V( 62, 0x00ab, 61, 63, 0 ),
|
||||
V( 63, 0x008f, 61, 32, 0 ),
|
||||
V( 64, 0x5b12, 65, 65, 1 ),
|
||||
V( 65, 0x4d04, 80, 66, 0 ),
|
||||
V( 66, 0x412c, 81, 67, 0 ),
|
||||
V( 67, 0x37d8, 82, 68, 0 ),
|
||||
V( 68, 0x2fe8, 83, 69, 0 ),
|
||||
V( 69, 0x293c, 84, 70, 0 ),
|
||||
V( 70, 0x2379, 86, 71, 0 ),
|
||||
V( 71, 0x1edf, 87, 72, 0 ),
|
||||
V( 72, 0x1aa9, 87, 73, 0 ),
|
||||
V( 73, 0x174e, 72, 74, 0 ),
|
||||
V( 74, 0x1424, 72, 75, 0 ),
|
||||
V( 75, 0x119c, 74, 76, 0 ),
|
||||
V( 76, 0x0f6b, 74, 77, 0 ),
|
||||
V( 77, 0x0d51, 75, 78, 0 ),
|
||||
V( 78, 0x0bb6, 77, 79, 0 ),
|
||||
V( 79, 0x0a40, 77, 48, 0 ),
|
||||
V( 80, 0x5832, 80, 81, 1 ),
|
||||
V( 81, 0x4d1c, 88, 82, 0 ),
|
||||
V( 82, 0x438e, 89, 83, 0 ),
|
||||
V( 83, 0x3bdd, 90, 84, 0 ),
|
||||
V( 84, 0x34ee, 91, 85, 0 ),
|
||||
V( 85, 0x2eae, 92, 86, 0 ),
|
||||
V( 86, 0x299a, 93, 87, 0 ),
|
||||
V( 87, 0x2516, 86, 71, 0 ),
|
||||
V( 88, 0x5570, 88, 89, 1 ),
|
||||
V( 89, 0x4ca9, 95, 90, 0 ),
|
||||
V( 90, 0x44d9, 96, 91, 0 ),
|
||||
V( 91, 0x3e22, 97, 92, 0 ),
|
||||
V( 92, 0x3824, 99, 93, 0 ),
|
||||
V( 93, 0x32b4, 99, 94, 0 ),
|
||||
V( 94, 0x2e17, 93, 86, 0 ),
|
||||
V( 95, 0x56a8, 95, 96, 1 ),
|
||||
V( 96, 0x4f46, 101, 97, 0 ),
|
||||
V( 97, 0x47e5, 102, 98, 0 ),
|
||||
V( 98, 0x41cf, 103, 99, 0 ),
|
||||
V( 99, 0x3c3d, 104, 100, 0 ),
|
||||
V( 100, 0x375e, 99, 93, 0 ),
|
||||
V( 101, 0x5231, 105, 102, 0 ),
|
||||
V( 102, 0x4c0f, 106, 103, 0 ),
|
||||
V( 103, 0x4639, 107, 104, 0 ),
|
||||
V( 104, 0x415e, 103, 99, 0 ),
|
||||
V( 105, 0x5627, 105, 106, 1 ),
|
||||
V( 106, 0x50e7, 108, 107, 0 ),
|
||||
V( 107, 0x4b85, 109, 103, 0 ),
|
||||
V( 108, 0x5597, 110, 109, 0 ),
|
||||
V( 109, 0x504f, 111, 107, 0 ),
|
||||
V( 110, 0x5a10, 110, 111, 1 ),
|
||||
V( 111, 0x5522, 112, 109, 0 ),
|
||||
V( 112, 0x59eb, 112, 111, 1 ),
|
||||
/*
|
||||
* This last entry is used for fixed probability estimate of 0.5
|
||||
* as suggested in Section 10.3 Table 5 of ITU-T Rec. T.851.
|
||||
*/
|
||||
V( 113, 0x5a1d, 113, 113, 0 )
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jcapimin.c
|
||||
*
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Modified 2003-2010 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -73,6 +74,11 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
||||
cinfo->ac_huff_tbl_ptrs[i] = NULL;
|
||||
}
|
||||
|
||||
/* Must do it here for emit_dqt in case jpeg_write_tables is used */
|
||||
cinfo->block_size = DCTSIZE;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
|
||||
cinfo->script_space = NULL;
|
||||
|
||||
cinfo->input_gamma = 1.0; /* in case application forgets */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jcapistd.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* 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);
|
||||
|
||||
/* 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)
|
||||
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
||||
|
||||
|
||||
147
jcarith.c
147
jcarith.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jcarith.c
|
||||
*
|
||||
* Developed 1997 by Guido Vollbeding.
|
||||
* Developed 1997-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -40,6 +40,9 @@ typedef struct {
|
||||
/* Pointers to statistics areas (these workspaces have image lifespan) */
|
||||
unsigned char * dc_stats[NUM_ARITH_TBLS];
|
||||
unsigned char * ac_stats[NUM_ARITH_TBLS];
|
||||
|
||||
/* Statistics bin for coding with fixed probability 0.5 */
|
||||
unsigned char fixed_bin[4];
|
||||
} arith_entropy_encoder;
|
||||
|
||||
typedef arith_entropy_encoder * arith_entropy_ptr;
|
||||
@@ -48,8 +51,6 @@ typedef arith_entropy_encoder * arith_entropy_ptr;
|
||||
* for the statistics area.
|
||||
* According to sections F.1.4.4.1.3 and F.1.4.4.2, we need at least
|
||||
* 49 statistics bins for DC, and 245 statistics bins for AC coding.
|
||||
* Note that we use one additional AC bin for codings with fixed
|
||||
* probability (0.5), thus the minimum number for AC is 246.
|
||||
*
|
||||
* We use a compact representation with 1 byte per statistics bin,
|
||||
* thus the numbers directly represent byte sizes.
|
||||
@@ -217,17 +218,16 @@ finish_pass (j_compress_ptr cinfo)
|
||||
LOCAL(void)
|
||||
arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
|
||||
{
|
||||
extern const INT32 jaritab[];
|
||||
register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
|
||||
register unsigned char nl, nm;
|
||||
register INT32 qe, temp;
|
||||
register int sv;
|
||||
|
||||
/* Fetch values from our compact representation of Table D.2:
|
||||
/* Fetch values from our compact representation of Table D.3(D.2):
|
||||
* Qe values and probability estimation state machine
|
||||
*/
|
||||
sv = *st;
|
||||
qe = jaritab[sv & 0x7F]; /* => Qe_Value */
|
||||
qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */
|
||||
nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */
|
||||
nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */
|
||||
|
||||
@@ -327,16 +327,18 @@ emit_restart (j_compress_ptr cinfo, int restart_num)
|
||||
emit_byte(0xFF, cinfo);
|
||||
emit_byte(JPEG_RST0 + restart_num, cinfo);
|
||||
|
||||
/* Re-initialize statistics areas */
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
/* Re-initialize statistics areas */
|
||||
if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
|
||||
/* DC needs no table for refinement scan */
|
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0) {
|
||||
MEMZERO(entropy->dc_stats[compptr->dc_tbl_no], DC_STAT_BINS);
|
||||
/* Reset DC predictions to 0 */
|
||||
entropy->last_dc_val[ci] = 0;
|
||||
entropy->dc_context[ci] = 0;
|
||||
}
|
||||
if (cinfo->progressive_mode == 0 || cinfo->Ss) {
|
||||
/* AC needs no table when not present */
|
||||
if (cinfo->Se) {
|
||||
MEMZERO(entropy->ac_stats[compptr->ac_tbl_no], AC_STAT_BINS);
|
||||
}
|
||||
}
|
||||
@@ -360,7 +362,6 @@ METHODDEF(boolean)
|
||||
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
||||
JBLOCKROW block;
|
||||
unsigned char *st;
|
||||
int blkn, ci, tbl;
|
||||
int v, v2, m;
|
||||
@@ -379,14 +380,13 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/* Encode the MCU data blocks */
|
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||
block = MCU_data[blkn];
|
||||
ci = cinfo->MCU_membership[blkn];
|
||||
tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
|
||||
|
||||
/* Compute the DC value after the required point transform by Al.
|
||||
* 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 */
|
||||
|
||||
@@ -427,9 +427,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
arith_encode(cinfo, st, 0);
|
||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
||||
if (m < (int) (((INT32) 1 << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
entropy->dc_context[ci] = 0; /* zero diff category */
|
||||
else if (m > (int) (((INT32) 1 << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
entropy->dc_context[ci] += 8; /* large diff category */
|
||||
/* Figure F.9: Encoding the magnitude bit pattern of v */
|
||||
st += 14;
|
||||
@@ -451,6 +451,7 @@ METHODDEF(boolean)
|
||||
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
unsigned char *st;
|
||||
int tbl, k, ke;
|
||||
@@ -467,6 +468,8 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
entropy->restarts_to_go--;
|
||||
}
|
||||
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Encode the MCU data block */
|
||||
block = MCU_data[0];
|
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
|
||||
@@ -474,39 +477,41 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */
|
||||
|
||||
/* Establish EOB (end-of-block) index */
|
||||
for (ke = cinfo->Se + 1; ke > 1; ke--)
|
||||
ke = cinfo->Se;
|
||||
do {
|
||||
/* We must apply the point transform by Al. For AC coefficients this
|
||||
* is an integer division with rounding towards 0. To do this portably
|
||||
* in C, we shift after obtaining the absolute value.
|
||||
*/
|
||||
if ((v = (*block)[jpeg_natural_order[ke - 1]]) >= 0) {
|
||||
if ((v = (*block)[natural_order[ke]]) >= 0) {
|
||||
if (v >>= cinfo->Al) break;
|
||||
} else {
|
||||
v = -v;
|
||||
if (v >>= cinfo->Al) break;
|
||||
}
|
||||
} while (--ke);
|
||||
|
||||
/* Figure F.5: Encode_AC_Coefficients */
|
||||
for (k = cinfo->Ss; k < ke; k++) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
for (k = cinfo->Ss - 1; k < ke;) {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
arith_encode(cinfo, st, 0); /* EOB decision */
|
||||
entropy->ac_stats[tbl][245] = 0;
|
||||
for (;;) {
|
||||
if ((v = (*block)[jpeg_natural_order[k]]) >= 0) {
|
||||
if ((v = (*block)[natural_order[++k]]) >= 0) {
|
||||
if (v >>= cinfo->Al) {
|
||||
arith_encode(cinfo, st + 1, 1);
|
||||
arith_encode(cinfo, entropy->ac_stats[tbl] + 245, 0);
|
||||
arith_encode(cinfo, entropy->fixed_bin, 0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
v = -v;
|
||||
if (v >>= cinfo->Al) {
|
||||
arith_encode(cinfo, st + 1, 1);
|
||||
arith_encode(cinfo, entropy->ac_stats[tbl] + 245, 1);
|
||||
arith_encode(cinfo, entropy->fixed_bin, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
arith_encode(cinfo, st + 1, 0); st += 3; k++;
|
||||
arith_encode(cinfo, st + 1, 0);
|
||||
st += 3;
|
||||
}
|
||||
st += 2;
|
||||
/* Figure F.8: Encoding the magnitude category of v */
|
||||
@@ -533,9 +538,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
while (m >>= 1)
|
||||
arith_encode(cinfo, st, (m & v) ? 1 : 0);
|
||||
}
|
||||
/* Encode EOB decision only if k <= cinfo->Se */
|
||||
if (k <= cinfo->Se) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
/* Encode EOB decision only if k < cinfo->Se */
|
||||
if (k < cinfo->Se) {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
arith_encode(cinfo, st, 1);
|
||||
}
|
||||
|
||||
@@ -545,13 +550,15 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/*
|
||||
* 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)
|
||||
encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
||||
unsigned char st[4];
|
||||
unsigned char *st;
|
||||
int Al, blkn;
|
||||
|
||||
/* Emit restart marker if needed */
|
||||
@@ -565,11 +572,11 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
entropy->restarts_to_go--;
|
||||
}
|
||||
|
||||
st = entropy->fixed_bin; /* use fixed probability estimation */
|
||||
Al = cinfo->Al;
|
||||
|
||||
/* Encode the MCU data blocks */
|
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||
st[0] = 0; /* use fixed probability estimation */
|
||||
/* We simply emit the Al'th bit of the DC coefficient value. */
|
||||
arith_encode(cinfo, st, (MCU_data[blkn][0][0] >> Al) & 1);
|
||||
}
|
||||
@@ -586,6 +593,7 @@ METHODDEF(boolean)
|
||||
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
unsigned char *st;
|
||||
int tbl, k, ke, kex;
|
||||
@@ -602,6 +610,8 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
entropy->restarts_to_go--;
|
||||
}
|
||||
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Encode the MCU data block */
|
||||
block = MCU_data[0];
|
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
|
||||
@@ -609,21 +619,23 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* Section G.1.3.3: Encoding of AC coefficients */
|
||||
|
||||
/* Establish EOB (end-of-block) index */
|
||||
for (ke = cinfo->Se + 1; ke > 1; ke--)
|
||||
ke = cinfo->Se;
|
||||
do {
|
||||
/* We must apply the point transform by Al. For AC coefficients this
|
||||
* is an integer division with rounding towards 0. To do this portably
|
||||
* in C, we shift after obtaining the absolute value.
|
||||
*/
|
||||
if ((v = (*block)[jpeg_natural_order[ke - 1]]) >= 0) {
|
||||
if ((v = (*block)[natural_order[ke]]) >= 0) {
|
||||
if (v >>= cinfo->Al) break;
|
||||
} else {
|
||||
v = -v;
|
||||
if (v >>= cinfo->Al) break;
|
||||
}
|
||||
} while (--ke);
|
||||
|
||||
/* Establish EOBx (previous stage end-of-block) index */
|
||||
for (kex = ke; kex > 1; kex--)
|
||||
if ((v = (*block)[jpeg_natural_order[kex - 1]]) >= 0) {
|
||||
for (kex = ke; kex > 0; kex--)
|
||||
if ((v = (*block)[natural_order[kex]]) >= 0) {
|
||||
if (v >>= cinfo->Ah) break;
|
||||
} else {
|
||||
v = -v;
|
||||
@@ -631,19 +643,18 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
|
||||
/* Figure G.10: Encode_AC_Coefficients_SA */
|
||||
for (k = cinfo->Ss; k < ke; k++) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
for (k = cinfo->Ss - 1; k < ke;) {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
if (k >= kex)
|
||||
arith_encode(cinfo, st, 0); /* EOB decision */
|
||||
entropy->ac_stats[tbl][245] = 0;
|
||||
for (;;) {
|
||||
if ((v = (*block)[jpeg_natural_order[k]]) >= 0) {
|
||||
if ((v = (*block)[natural_order[++k]]) >= 0) {
|
||||
if (v >>= cinfo->Al) {
|
||||
if (v >> 1) /* previously nonzero coef */
|
||||
arith_encode(cinfo, st + 2, (v & 1));
|
||||
else { /* newly nonzero coef */
|
||||
arith_encode(cinfo, st + 1, 1);
|
||||
arith_encode(cinfo, entropy->ac_stats[tbl] + 245, 0);
|
||||
arith_encode(cinfo, entropy->fixed_bin, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -654,17 +665,18 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
arith_encode(cinfo, st + 2, (v & 1));
|
||||
else { /* newly nonzero coef */
|
||||
arith_encode(cinfo, st + 1, 1);
|
||||
arith_encode(cinfo, entropy->ac_stats[tbl] + 245, 1);
|
||||
arith_encode(cinfo, entropy->fixed_bin, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
arith_encode(cinfo, st + 1, 0); st += 3; k++;
|
||||
arith_encode(cinfo, st + 1, 0);
|
||||
st += 3;
|
||||
}
|
||||
}
|
||||
/* Encode EOB decision only if k <= cinfo->Se */
|
||||
if (k <= cinfo->Se) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
/* Encode EOB decision only if k < cinfo->Se */
|
||||
if (k < cinfo->Se) {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
arith_encode(cinfo, st, 1);
|
||||
}
|
||||
|
||||
@@ -680,11 +692,13 @@ METHODDEF(boolean)
|
||||
encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
||||
jpeg_component_info * compptr;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
unsigned char *st;
|
||||
int blkn, ci, tbl, k, ke;
|
||||
int tbl, k, ke;
|
||||
int v, v2, m;
|
||||
int blkn, ci;
|
||||
jpeg_component_info * compptr;
|
||||
|
||||
/* Emit restart marker if needed */
|
||||
if (cinfo->restart_interval) {
|
||||
@@ -697,6 +711,8 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
entropy->restarts_to_go--;
|
||||
}
|
||||
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Encode the MCU data blocks */
|
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||
block = MCU_data[blkn];
|
||||
@@ -744,9 +760,9 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
arith_encode(cinfo, st, 0);
|
||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
||||
if (m < (int) (((INT32) 1 << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
entropy->dc_context[ci] = 0; /* zero diff category */
|
||||
else if (m > (int) (((INT32) 1 << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
entropy->dc_context[ci] += 8; /* large diff category */
|
||||
/* Figure F.9: Encoding the magnitude bit pattern of v */
|
||||
st += 14;
|
||||
@@ -756,28 +772,30 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */
|
||||
|
||||
if ((ke = cinfo->lim_Se) == 0) continue;
|
||||
tbl = compptr->ac_tbl_no;
|
||||
|
||||
/* Establish EOB (end-of-block) index */
|
||||
for (ke = DCTSIZE2; ke > 1; ke--)
|
||||
if ((*block)[jpeg_natural_order[ke - 1]]) break;
|
||||
do {
|
||||
if ((*block)[natural_order[ke]]) break;
|
||||
} while (--ke);
|
||||
|
||||
/* Figure F.5: Encode_AC_Coefficients */
|
||||
for (k = 1; k < ke; k++) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
for (k = 0; k < ke;) {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
arith_encode(cinfo, st, 0); /* EOB decision */
|
||||
while ((v = (*block)[jpeg_natural_order[k]]) == 0) {
|
||||
arith_encode(cinfo, st + 1, 0); st += 3; k++;
|
||||
while ((v = (*block)[natural_order[++k]]) == 0) {
|
||||
arith_encode(cinfo, st + 1, 0);
|
||||
st += 3;
|
||||
}
|
||||
arith_encode(cinfo, st + 1, 1);
|
||||
/* Figure F.6: Encoding nonzero value v */
|
||||
/* Figure F.7: Encoding the sign of v */
|
||||
entropy->ac_stats[tbl][245] = 0;
|
||||
if (v > 0) {
|
||||
arith_encode(cinfo, entropy->ac_stats[tbl] + 245, 0);
|
||||
arith_encode(cinfo, entropy->fixed_bin, 0);
|
||||
} else {
|
||||
v = -v;
|
||||
arith_encode(cinfo, entropy->ac_stats[tbl] + 245, 1);
|
||||
arith_encode(cinfo, entropy->fixed_bin, 1);
|
||||
}
|
||||
st += 2;
|
||||
/* Figure F.8: Encoding the magnitude category of v */
|
||||
@@ -804,9 +822,9 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
while (m >>= 1)
|
||||
arith_encode(cinfo, st, (m & v) ? 1 : 0);
|
||||
}
|
||||
/* Encode EOB decision only if k < DCTSIZE2 */
|
||||
if (k < DCTSIZE2) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
/* Encode EOB decision only if k < cinfo->lim_Se */
|
||||
if (k < cinfo->lim_Se) {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
arith_encode(cinfo, st, 1);
|
||||
}
|
||||
}
|
||||
@@ -851,10 +869,11 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
} else
|
||||
entropy->pub.encode_mcu = encode_mcu;
|
||||
|
||||
/* Allocate & initialize requested statistics areas */
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
/* Allocate & initialize requested statistics areas */
|
||||
if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
|
||||
/* DC needs no table for refinement scan */
|
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0) {
|
||||
tbl = compptr->dc_tbl_no;
|
||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
||||
@@ -866,7 +885,8 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
entropy->last_dc_val[ci] = 0;
|
||||
entropy->dc_context[ci] = 0;
|
||||
}
|
||||
if (cinfo->progressive_mode == 0 || cinfo->Ss) {
|
||||
/* AC needs no table when not present */
|
||||
if (cinfo->Se) {
|
||||
tbl = compptr->ac_tbl_no;
|
||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
||||
@@ -909,7 +929,7 @@ jinit_arith_encoder (j_compress_ptr cinfo)
|
||||
entropy = (arith_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(arith_entropy_encoder));
|
||||
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass;
|
||||
entropy->pub.finish_pass = finish_pass;
|
||||
|
||||
@@ -918,4 +938,7 @@ jinit_arith_encoder (j_compress_ptr cinfo)
|
||||
entropy->dc_stats[i] = NULL;
|
||||
entropy->ac_stats[i] = NULL;
|
||||
}
|
||||
|
||||
/* Initialize index for fixed probability estimation */
|
||||
entropy->fixed_bin[0] = 113;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jccoefct.c
|
||||
*
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2003-2011 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -183,7 +184,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||
ypos, xpos, (JDIMENSION) blockcnt);
|
||||
if (blockcnt < compptr->MCU_width) {
|
||||
/* Create some dummy blocks at the right edge of the image. */
|
||||
jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt],
|
||||
FMEMZERO((void FAR *) coef->MCU_buffer[blkn + blockcnt],
|
||||
(compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
|
||||
for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
|
||||
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
|
||||
@@ -191,7 +192,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||
}
|
||||
} else {
|
||||
/* Create a row of dummy blocks at the bottom of the image. */
|
||||
jzero_far((void FAR *) coef->MCU_buffer[blkn],
|
||||
FMEMZERO((void FAR *) coef->MCU_buffer[blkn],
|
||||
compptr->MCU_width * SIZEOF(JBLOCK));
|
||||
for (bi = 0; bi < compptr->MCU_width; bi++) {
|
||||
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
|
||||
@@ -290,7 +291,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||
if (ndummy > 0) {
|
||||
/* Create dummy blocks at the right edge of the image. */
|
||||
thisblockrow += blocks_across; /* => first dummy block */
|
||||
jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
|
||||
FMEMZERO((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
|
||||
lastDC = thisblockrow[-1][0];
|
||||
for (bi = 0; bi < ndummy; bi++) {
|
||||
thisblockrow[bi][0] = lastDC;
|
||||
@@ -309,7 +310,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||
block_row++) {
|
||||
thisblockrow = buffer[block_row];
|
||||
lastblockrow = buffer[block_row-1];
|
||||
jzero_far((void FAR *) thisblockrow,
|
||||
FMEMZERO((void FAR *) thisblockrow,
|
||||
(size_t) (blocks_across * SIZEOF(JBLOCK)));
|
||||
for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
|
||||
lastDC = lastblockrow[h_samp_factor-1][0];
|
||||
|
||||
249
jccolor.c
249
jccolor.c
@@ -2,6 +2,7 @@
|
||||
* jccolor.c
|
||||
*
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modified 2011-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -28,13 +29,25 @@ typedef my_color_converter * my_cconvert_ptr;
|
||||
/**************** RGB -> YCbCr conversion: most common case **************/
|
||||
|
||||
/*
|
||||
* YCbCr is defined per CCIR 601-1, except that Cb and Cr are
|
||||
* normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
|
||||
* The conversion equations to be implemented are therefore
|
||||
* Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
|
||||
* Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE
|
||||
* Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE
|
||||
* (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
|
||||
* YCbCr is defined per Recommendation ITU-R BT.601-7 (03/2011),
|
||||
* previously known as Recommendation CCIR 601-1, except that Cb and Cr
|
||||
* 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
|
||||
* 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,
|
||||
* 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)
|
||||
@@ -48,9 +61,9 @@ typedef my_color_converter * my_cconvert_ptr;
|
||||
* 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.
|
||||
* 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
|
||||
* 16-bit samples, but if you want lossless storage you shouldn't be changing
|
||||
* colorspace anyway.
|
||||
* for 9-bit to 12-bit samples it is still acceptable. It's not very
|
||||
* reasonable for 16-bit samples, but if you want lossless storage you
|
||||
* shouldn't be changing colorspace anyway.
|
||||
* 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.
|
||||
*/
|
||||
@@ -95,21 +108,21 @@ rgb_ycc_start (j_compress_ptr cinfo)
|
||||
(TABLE_SIZE * SIZEOF(INT32)));
|
||||
|
||||
for (i = 0; i <= MAXJSAMPLE; i++) {
|
||||
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
|
||||
rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
|
||||
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
|
||||
rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
|
||||
rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
|
||||
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.299) * i;
|
||||
rgb_ycc_tab[i+G_Y_OFF] = FIX(0.587) * i;
|
||||
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
|
||||
rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.168735892)) * 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.
|
||||
* This ensures that the maximum output will round to MAXJSAMPLE
|
||||
* 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
|
||||
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+B_CR_OFF] = (-FIX(0.08131)) * i;
|
||||
rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.418687589)) * i;
|
||||
rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.081312411)) * i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,8 +145,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register int r, g, b;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr0, outptr1, outptr2;
|
||||
register JDIMENSION col;
|
||||
@@ -149,7 +162,6 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
|
||||
* must be too; we do not need an explicit range-limiting operation.
|
||||
* Hence the value being shifted is never negative, and we don't
|
||||
@@ -167,6 +179,7 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
||||
outptr2[col] = (JSAMPLE)
|
||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
||||
>> SCALEBITS);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,8 +201,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register int r, g, b;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr;
|
||||
register JDIMENSION col;
|
||||
@@ -197,17 +210,16 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr = *input_buf++;
|
||||
outptr = output_buf[0][output_row];
|
||||
output_row++;
|
||||
outptr = output_buf[0][output_row++];
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* Y */
|
||||
outptr[col] = (JSAMPLE)
|
||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||
>> SCALEBITS);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,8 +239,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register int r, g, b;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr0, outptr1, outptr2, outptr3;
|
||||
register JDIMENSION col;
|
||||
@@ -247,7 +259,6 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||
b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
|
||||
/* K passes through as-is */
|
||||
outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */
|
||||
inptr += 4;
|
||||
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
|
||||
* must be too; we do not need an explicit range-limiting operation.
|
||||
* Hence the value being shifted is never negative, and we don't
|
||||
@@ -265,6 +276,49 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||
outptr2[col] = (JSAMPLE)
|
||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
||||
>> SCALEBITS);
|
||||
inptr += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert some rows of samples to the JPEG colorspace.
|
||||
* [R,G,B] to [R-G,G,B-G] conversion with modulo calculation
|
||||
* (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)
|
||||
rgb_rgb1_convert (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
register int r, g, b;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr0, outptr1, outptr2;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->image_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr = *input_buf++;
|
||||
outptr0 = output_buf[0][output_row];
|
||||
outptr1 = output_buf[1][output_row];
|
||||
outptr2 = output_buf[2][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
/* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
|
||||
* (modulo) operator is equivalent to the bitmask operator AND.
|
||||
*/
|
||||
outptr0[col] = (JSAMPLE) ((r - g + CENTERJSAMPLE) & MAXJSAMPLE);
|
||||
outptr1[col] = (JSAMPLE) g;
|
||||
outptr2[col] = (JSAMPLE) ((b - g + CENTERJSAMPLE) & MAXJSAMPLE);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -273,7 +327,7 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||
/*
|
||||
* Convert some rows of samples to the JPEG colorspace.
|
||||
* 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)
|
||||
@@ -281,16 +335,15 @@ grayscale_convert (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
int instride = cinfo->input_components;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->image_width;
|
||||
int instride = cinfo->input_components;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr = *input_buf++;
|
||||
outptr = output_buf[0][output_row];
|
||||
output_row++;
|
||||
outptr = output_buf[0][output_row++];
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */
|
||||
inptr += instride;
|
||||
@@ -299,6 +352,39 @@ grayscale_convert (j_compress_ptr cinfo,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert some rows of samples to the JPEG colorspace.
|
||||
* No colorspace conversion, but change from interleaved
|
||||
* to separate-planes representation.
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
rgb_convert (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr0, outptr1, outptr2;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->image_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr = *input_buf++;
|
||||
outptr0 = output_buf[0][output_row];
|
||||
outptr1 = output_buf[1][output_row];
|
||||
outptr2 = output_buf[2][output_row];
|
||||
output_row++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
/* We can dispense with GETJSAMPLE() here */
|
||||
outptr0[col] = inptr[RGB_RED];
|
||||
outptr1[col] = inptr[RGB_GREEN];
|
||||
outptr2[col] = inptr[RGB_BLUE];
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert some rows of samples to the JPEG colorspace.
|
||||
* This version handles multi-component colorspaces without conversion.
|
||||
@@ -310,20 +396,20 @@ null_convert (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
int ci;
|
||||
register int nc = cinfo->num_components;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr;
|
||||
register JDIMENSION col;
|
||||
register int ci;
|
||||
int nc = cinfo->num_components;
|
||||
JDIMENSION num_cols = cinfo->image_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
/* It seems fastest to make a separate pass for each component. */
|
||||
for (ci = 0; ci < nc; ci++) {
|
||||
inptr = *input_buf;
|
||||
inptr = input_buf[0] + ci;
|
||||
outptr = output_buf[ci][output_row];
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
|
||||
*outptr++ = *inptr; /* don't need GETJSAMPLE() here */
|
||||
inptr += nc;
|
||||
}
|
||||
}
|
||||
@@ -356,7 +442,7 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
cconvert = (my_cconvert_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_color_converter));
|
||||
cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
|
||||
cinfo->cconvert = &cconvert->pub;
|
||||
/* set start_pass to null method until we find out differently */
|
||||
cconvert->pub.start_pass = null_method;
|
||||
|
||||
@@ -368,13 +454,13 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case JCS_RGB:
|
||||
#if RGB_PIXELSIZE != 3
|
||||
case JCS_BG_RGB:
|
||||
if (cinfo->input_components != RGB_PIXELSIZE)
|
||||
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
|
||||
break;
|
||||
#endif /* else share code with YCbCr */
|
||||
|
||||
case JCS_YCbCr:
|
||||
case JCS_BG_YCC:
|
||||
if (cinfo->input_components != 3)
|
||||
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
|
||||
break;
|
||||
@@ -391,41 +477,96 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Support color transform only for RGB colorspaces */
|
||||
if (cinfo->color_transform &&
|
||||
cinfo->jpeg_color_space != JCS_RGB &&
|
||||
cinfo->jpeg_color_space != JCS_BG_RGB)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
|
||||
/* Check num_components, set conversion method based on requested space */
|
||||
switch (cinfo->jpeg_color_space) {
|
||||
case JCS_GRAYSCALE:
|
||||
if (cinfo->num_components != 1)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (cinfo->in_color_space == JCS_GRAYSCALE)
|
||||
switch (cinfo->in_color_space) {
|
||||
case JCS_GRAYSCALE:
|
||||
case JCS_YCbCr:
|
||||
case JCS_BG_YCC:
|
||||
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.color_convert = rgb_gray_convert;
|
||||
} else if (cinfo->in_color_space == JCS_YCbCr)
|
||||
cconvert->pub.color_convert = grayscale_convert;
|
||||
else
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
break;
|
||||
|
||||
case JCS_RGB:
|
||||
case JCS_BG_RGB:
|
||||
if (cinfo->num_components != 3)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3)
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
else
|
||||
if (cinfo->in_color_space == cinfo->jpeg_color_space) {
|
||||
switch (cinfo->color_transform) {
|
||||
case JCT_NONE:
|
||||
cconvert->pub.color_convert = rgb_convert;
|
||||
break;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb_rgb1_convert;
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
} else
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
break;
|
||||
|
||||
case JCS_YCbCr:
|
||||
if (cinfo->num_components != 3)
|
||||
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.color_convert = rgb_ycc_convert;
|
||||
} else if (cinfo->in_color_space == JCS_YCbCr)
|
||||
break;
|
||||
case JCS_YCbCr:
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
else
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
|
||||
case JCS_CMYK:
|
||||
@@ -440,13 +581,17 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
case JCS_YCCK:
|
||||
if (cinfo->num_components != 4)
|
||||
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.color_convert = cmyk_ycck_convert;
|
||||
} else if (cinfo->in_color_space == JCS_YCCK)
|
||||
break;
|
||||
case JCS_YCCK:
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
else
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* allow null conversion of JCS_UNKNOWN */
|
||||
|
||||
79
jcdctmgr.c
79
jcdctmgr.c
@@ -2,6 +2,7 @@
|
||||
* jcdctmgr.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* 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 */
|
||||
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
|
||||
/* Same as above for the floating-point case. */
|
||||
float_DCT_method_ptr do_float_dct[MAX_COMPONENTS];
|
||||
FAST_FLOAT * float_divisors[NUM_QUANT_TBLS];
|
||||
#endif
|
||||
} my_fdct_controller;
|
||||
|
||||
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,
|
||||
* 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. */
|
||||
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
|
||||
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 */
|
||||
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. */
|
||||
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
|
||||
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 */
|
||||
JDIMENSION bi;
|
||||
|
||||
@@ -352,22 +361,17 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
|
||||
cinfo->quant_tbl_ptrs[qtblno] == NULL)
|
||||
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
|
||||
qtbl = cinfo->quant_tbl_ptrs[qtblno];
|
||||
/* Compute divisors for this quant table */
|
||||
/* We may do this more than once for same table, but it's not a big deal */
|
||||
/* Create divisor table from quant table */
|
||||
switch (method) {
|
||||
#ifdef PROVIDE_ISLOW_TABLES
|
||||
case JDCT_ISLOW:
|
||||
/* For LL&M IDCT method, divisors are equal to raw quantization
|
||||
* coefficients multiplied by 8 (to counteract scaling).
|
||||
*/
|
||||
if (fdct->divisors[qtblno] == NULL) {
|
||||
fdct->divisors[qtblno] = (DCTELEM *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
DCTSIZE2 * SIZEOF(DCTELEM));
|
||||
}
|
||||
dtbl = fdct->divisors[qtblno];
|
||||
dtbl = (DCTELEM *) compptr->dct_table;
|
||||
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;
|
||||
break;
|
||||
@@ -395,17 +399,12 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
|
||||
};
|
||||
SHIFT_TEMPS
|
||||
|
||||
if (fdct->divisors[qtblno] == NULL) {
|
||||
fdct->divisors[qtblno] = (DCTELEM *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
DCTSIZE2 * SIZEOF(DCTELEM));
|
||||
}
|
||||
dtbl = fdct->divisors[qtblno];
|
||||
dtbl = (DCTELEM *) compptr->dct_table;
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
dtbl[i] = (DCTELEM)
|
||||
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
|
||||
(INT32) aanscales[i]),
|
||||
CONST_BITS-3);
|
||||
compptr->component_needed ? CONST_BITS-4 : CONST_BITS-3);
|
||||
}
|
||||
}
|
||||
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
|
||||
* use a multiplication rather than a division.
|
||||
*/
|
||||
FAST_FLOAT * fdtbl;
|
||||
FAST_FLOAT * fdtbl = (FAST_FLOAT *) compptr->dct_table;
|
||||
int row, col;
|
||||
static const double aanscalefactor[DCTSIZE] = {
|
||||
1.0, 1.387039845, 1.306562965, 1.175875602,
|
||||
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;
|
||||
for (row = 0; row < DCTSIZE; row++) {
|
||||
for (col = 0; col < DCTSIZE; col++) {
|
||||
fdtbl[i] = (FAST_FLOAT)
|
||||
(1.0 / (((double) qtbl->quantval[i] *
|
||||
aanscalefactor[row] * aanscalefactor[col] * 8.0)));
|
||||
(1.0 / ((double) qtbl->quantval[i] *
|
||||
aanscalefactor[row] * aanscalefactor[col] *
|
||||
(compptr->component_needed ? 16.0 : 8.0)));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -464,19 +458,20 @@ GLOBAL(void)
|
||||
jinit_forward_dct (j_compress_ptr cinfo)
|
||||
{
|
||||
my_fdct_ptr fdct;
|
||||
int i;
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
fdct = (my_fdct_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_fdct_controller));
|
||||
cinfo->fdct = (struct jpeg_forward_dct *) fdct;
|
||||
cinfo->fdct = &fdct->pub;
|
||||
fdct->pub.start_pass = start_pass_fdctmgr;
|
||||
|
||||
/* Mark divisor tables unallocated */
|
||||
for (i = 0; i < NUM_QUANT_TBLS; i++) {
|
||||
fdct->divisors[i] = NULL;
|
||||
#ifdef DCT_FLOAT_SUPPORTED
|
||||
fdct->float_divisors[i] = NULL;
|
||||
#endif
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
/* Allocate a divisor table for each component */
|
||||
compptr->dct_table =
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(divisor_table));
|
||||
}
|
||||
}
|
||||
|
||||
299
jchuff.c
299
jchuff.c
@@ -2,7 +2,7 @@
|
||||
* jchuff.c
|
||||
*
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -87,8 +87,6 @@ typedef struct {
|
||||
unsigned int restarts_to_go; /* MCUs left in this restart interval */
|
||||
int next_restart_num; /* next restart number to write (0-7) */
|
||||
|
||||
/* Following four fields used only in sequential mode */
|
||||
|
||||
/* Pointers to derived tables (these workspaces have image lifespan) */
|
||||
c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];
|
||||
c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];
|
||||
@@ -114,15 +112,6 @@ typedef struct {
|
||||
unsigned int BE; /* # of buffered correction bits before MCU */
|
||||
char * bit_buffer; /* buffer for correction bits (1 per char) */
|
||||
/* packing correction bits tightly would save some space but cost time... */
|
||||
|
||||
/* Pointers to derived tables (these workspaces have image lifespan).
|
||||
* Since any one scan in progressive mode codes only DC or only AC,
|
||||
* we only need one set of tables, not one for DC and one for AC.
|
||||
*/
|
||||
c_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
|
||||
|
||||
/* Statistics tables for optimization; again, one set is enough */
|
||||
long * count_ptrs[NUM_HUFF_TBLS];
|
||||
} huff_entropy_encoder;
|
||||
|
||||
typedef huff_entropy_encoder * huff_entropy_ptr;
|
||||
@@ -319,20 +308,23 @@ emit_bits_s (working_state * state, unsigned int code, int size)
|
||||
/* Emit some bits; return TRUE if successful, FALSE if must suspend */
|
||||
{
|
||||
/* This routine is heavily used, so it's worth coding tightly. */
|
||||
register INT32 put_buffer = (INT32) code;
|
||||
register int put_bits = state->cur.put_bits;
|
||||
register INT32 put_buffer;
|
||||
register int put_bits;
|
||||
|
||||
/* if size is 0, caller used an invalid Huffman table entry */
|
||||
if (size == 0)
|
||||
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 |= 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) {
|
||||
int c = (int) ((put_buffer >> 16) & 0xFF);
|
||||
@@ -358,8 +350,8 @@ emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size)
|
||||
/* Emit some bits, unless we are in gather mode */
|
||||
{
|
||||
/* This routine is heavily used, so it's worth coding tightly. */
|
||||
register INT32 put_buffer = (INT32) code;
|
||||
register int put_bits = entropy->saved.put_bits;
|
||||
register INT32 put_buffer;
|
||||
register int put_bits;
|
||||
|
||||
/* if size is 0, caller used an invalid Huffman table entry */
|
||||
if (size == 0)
|
||||
@@ -368,9 +360,11 @@ emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size)
|
||||
if (entropy->gather_statistics)
|
||||
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 */
|
||||
|
||||
@@ -419,12 +413,25 @@ flush_bits_e (huff_entropy_ptr entropy)
|
||||
|
||||
INLINE
|
||||
LOCAL(void)
|
||||
emit_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
emit_dc_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
{
|
||||
if (entropy->gather_statistics)
|
||||
entropy->count_ptrs[tbl_no][symbol]++;
|
||||
entropy->dc_count_ptrs[tbl_no][symbol]++;
|
||||
else {
|
||||
c_derived_tbl * tbl = entropy->derived_tbls[tbl_no];
|
||||
c_derived_tbl * tbl = entropy->dc_derived_tbls[tbl_no];
|
||||
emit_bits_e(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INLINE
|
||||
LOCAL(void)
|
||||
emit_ac_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
{
|
||||
if (entropy->gather_statistics)
|
||||
entropy->ac_count_ptrs[tbl_no][symbol]++;
|
||||
else {
|
||||
c_derived_tbl * tbl = entropy->ac_derived_tbls[tbl_no];
|
||||
emit_bits_e(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
|
||||
}
|
||||
}
|
||||
@@ -467,7 +474,7 @@ emit_eobrun (huff_entropy_ptr entropy)
|
||||
if (nbits > 14)
|
||||
ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
|
||||
|
||||
emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
|
||||
emit_ac_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
|
||||
if (nbits)
|
||||
emit_bits_e(entropy, entropy->EOBRUN, nbits);
|
||||
|
||||
@@ -541,10 +548,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
register int temp, temp2;
|
||||
register int nbits;
|
||||
int blkn, ci;
|
||||
int Al = cinfo->Al;
|
||||
JBLOCKROW block;
|
||||
jpeg_component_info * compptr;
|
||||
int blkn, ci, tbl;
|
||||
ISHIFT_TEMPS
|
||||
|
||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||
@@ -557,21 +561,20 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/* Encode the MCU data blocks */
|
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||
block = MCU_data[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.
|
||||
* 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. */
|
||||
temp = temp2 - entropy->saved.last_dc_val[ci];
|
||||
entropy->saved.last_dc_val[ci] = temp2;
|
||||
temp2 = temp - entropy->saved.last_dc_val[ci];
|
||||
entropy->saved.last_dc_val[ci] = temp;
|
||||
|
||||
/* Encode the DC coefficient difference per section G.1.2.1 */
|
||||
temp2 = temp;
|
||||
temp = temp2;
|
||||
if (temp < 0) {
|
||||
temp = -temp; /* temp is abs value of input */
|
||||
/* For a negative input, want temp2 = bitwise complement of abs(input) */
|
||||
@@ -592,7 +595,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
|
||||
|
||||
/* Count/emit the Huffman-coded symbol for the number of bits */
|
||||
emit_symbol(entropy, compptr->dc_tbl_no, nbits);
|
||||
emit_dc_symbol(entropy, tbl, nbits);
|
||||
|
||||
/* Emit that number of bits of the value, if positive, */
|
||||
/* or the complement of its magnitude, if negative. */
|
||||
@@ -626,12 +629,12 @@ METHODDEF(boolean)
|
||||
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
register int temp, temp2;
|
||||
register int nbits;
|
||||
register int r, k;
|
||||
int Se = cinfo->Se;
|
||||
int Al = cinfo->Al;
|
||||
JBLOCKROW block;
|
||||
int Se, Al;
|
||||
|
||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
||||
@@ -641,6 +644,10 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if (entropy->restarts_to_go == 0)
|
||||
emit_restart_e(entropy, entropy->next_restart_num);
|
||||
|
||||
Se = cinfo->Se;
|
||||
Al = cinfo->Al;
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Encode the MCU data block */
|
||||
block = MCU_data[0];
|
||||
|
||||
@@ -649,7 +656,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
r = 0; /* r = run length of zeros */
|
||||
|
||||
for (k = cinfo->Ss; k <= Se; k++) {
|
||||
if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
|
||||
if ((temp = (*block)[natural_order[k]]) == 0) {
|
||||
r++;
|
||||
continue;
|
||||
}
|
||||
@@ -678,7 +685,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
emit_eobrun(entropy);
|
||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
||||
while (r > 15) {
|
||||
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
|
||||
emit_ac_symbol(entropy, entropy->ac_tbl_no, 0xF0);
|
||||
r -= 16;
|
||||
}
|
||||
|
||||
@@ -691,7 +698,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
|
||||
|
||||
/* Count/emit Huffman symbol for run length / number of bits */
|
||||
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
|
||||
emit_ac_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
|
||||
|
||||
/* Emit that number of bits of the value, if positive, */
|
||||
/* or the complement of its magnitude, if negative. */
|
||||
@@ -725,18 +732,15 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* Note: we assume such scans can be multi-component,
|
||||
* although the spec is not very clear on the point.
|
||||
*/
|
||||
|
||||
METHODDEF(boolean)
|
||||
encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
register int temp;
|
||||
int blkn;
|
||||
int Al = cinfo->Al;
|
||||
JBLOCKROW block;
|
||||
int Al, blkn;
|
||||
|
||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
|
||||
@@ -746,13 +750,12 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if (entropy->restarts_to_go == 0)
|
||||
emit_restart_e(entropy, entropy->next_restart_num);
|
||||
|
||||
Al = cinfo->Al;
|
||||
|
||||
/* Encode the MCU data blocks */
|
||||
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. */
|
||||
temp = (*block)[0];
|
||||
emit_bits_e(entropy, (unsigned int) (temp >> Al), 1);
|
||||
emit_bits_e(entropy, (unsigned int) (MCU_data[blkn][0][0] >> Al), 1);
|
||||
}
|
||||
|
||||
cinfo->dest->next_output_byte = entropy->next_output_byte;
|
||||
@@ -780,14 +783,14 @@ METHODDEF(boolean)
|
||||
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
register int temp;
|
||||
register int r, k;
|
||||
int Se, Al;
|
||||
int EOB;
|
||||
char *BR_buffer;
|
||||
unsigned int BR;
|
||||
int Se = cinfo->Se;
|
||||
int Al = cinfo->Al;
|
||||
JBLOCKROW block;
|
||||
int absvalues[DCTSIZE2];
|
||||
|
||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||
@@ -798,6 +801,10 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if (entropy->restarts_to_go == 0)
|
||||
emit_restart_e(entropy, entropy->next_restart_num);
|
||||
|
||||
Se = cinfo->Se;
|
||||
Al = cinfo->Al;
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Encode the MCU data block */
|
||||
block = MCU_data[0];
|
||||
|
||||
@@ -806,7 +813,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
*/
|
||||
EOB = 0;
|
||||
for (k = cinfo->Ss; k <= Se; k++) {
|
||||
temp = (*block)[jpeg_natural_order[k]];
|
||||
temp = (*block)[natural_order[k]];
|
||||
/* We must apply the point transform by Al. For AC coefficients this
|
||||
* is an integer division with rounding towards 0. To do this portably
|
||||
* in C, we shift after obtaining the absolute value.
|
||||
@@ -836,7 +843,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* emit any pending EOBRUN and the BE correction bits */
|
||||
emit_eobrun(entropy);
|
||||
/* Emit ZRL */
|
||||
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
|
||||
emit_ac_symbol(entropy, entropy->ac_tbl_no, 0xF0);
|
||||
r -= 16;
|
||||
/* Emit buffered correction bits that must be associated with ZRL */
|
||||
emit_buffered_bits(entropy, BR_buffer, BR);
|
||||
@@ -859,10 +866,10 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
emit_eobrun(entropy);
|
||||
|
||||
/* Count/emit Huffman symbol for run length / number of bits */
|
||||
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
|
||||
emit_ac_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
|
||||
|
||||
/* Emit output bit for newly-nonzero coef */
|
||||
temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
|
||||
temp = ((*block)[natural_order[k]] < 0) ? 0 : 1;
|
||||
emit_bits_e(entropy, (unsigned int) temp, 1);
|
||||
|
||||
/* Emit buffered correction bits that must be associated with this code */
|
||||
@@ -908,7 +915,9 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
|
||||
{
|
||||
register int temp, temp2;
|
||||
register int nbits;
|
||||
register int k, r, i;
|
||||
register int r, k;
|
||||
int Se = state->cinfo->lim_Se;
|
||||
const int * natural_order = state->cinfo->natural_order;
|
||||
|
||||
/* Encode the DC coefficient difference per section F.1.2.1 */
|
||||
|
||||
@@ -947,8 +956,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
|
||||
|
||||
r = 0; /* r = run length of zeros */
|
||||
|
||||
for (k = 1; k < DCTSIZE2; k++) {
|
||||
if ((temp = block[jpeg_natural_order[k]]) == 0) {
|
||||
for (k = 1; k <= Se; k++) {
|
||||
if ((temp2 = block[natural_order[k]]) == 0) {
|
||||
r++;
|
||||
} else {
|
||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
||||
@@ -958,7 +967,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
|
||||
r -= 16;
|
||||
}
|
||||
|
||||
temp2 = temp;
|
||||
temp = temp2;
|
||||
if (temp < 0) {
|
||||
temp = -temp; /* temp is abs value of input */
|
||||
/* This code assumes we are on a two's complement machine */
|
||||
@@ -974,8 +983,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
|
||||
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
|
||||
|
||||
/* Emit Huffman symbol for run length / number of bits */
|
||||
i = (r << 4) + nbits;
|
||||
if (! emit_bits_s(state, actbl->ehufco[i], actbl->ehufsi[i]))
|
||||
temp = (r << 4) + nbits;
|
||||
if (! emit_bits_s(state, actbl->ehufco[temp], actbl->ehufsi[temp]))
|
||||
return FALSE;
|
||||
|
||||
/* Emit that number of bits of the value, if positive, */
|
||||
@@ -1112,7 +1121,9 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
||||
{
|
||||
register int temp;
|
||||
register int nbits;
|
||||
register int k, r;
|
||||
register int r, k;
|
||||
int Se = cinfo->lim_Se;
|
||||
const int * natural_order = cinfo->natural_order;
|
||||
|
||||
/* Encode the DC coefficient difference per section F.1.2.1 */
|
||||
|
||||
@@ -1139,8 +1150,8 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
|
||||
|
||||
r = 0; /* r = run length of zeros */
|
||||
|
||||
for (k = 1; k < DCTSIZE2; k++) {
|
||||
if ((temp = block[jpeg_natural_order[k]]) == 0) {
|
||||
for (k = 1; k <= Se; k++) {
|
||||
if ((temp = block[natural_order[k]]) == 0) {
|
||||
r++;
|
||||
} else {
|
||||
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
|
||||
@@ -1383,63 +1394,44 @@ METHODDEF(void)
|
||||
finish_pass_gather (j_compress_ptr cinfo)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int ci, dctbl, actbl, tbl;
|
||||
int ci, tbl;
|
||||
jpeg_component_info * compptr;
|
||||
JHUFF_TBL **htblptr;
|
||||
boolean did_dc[NUM_HUFF_TBLS];
|
||||
boolean did_ac[NUM_HUFF_TBLS];
|
||||
boolean did[NUM_HUFF_TBLS];
|
||||
|
||||
/* It's important not to apply jpeg_gen_optimal_table more than once
|
||||
* per table, because it clobbers the input frequency counts!
|
||||
*/
|
||||
if (cinfo->progressive_mode) {
|
||||
if (cinfo->progressive_mode)
|
||||
/* Flush out buffered data (all we care about is counting the EOB symbol) */
|
||||
emit_eobrun(entropy);
|
||||
|
||||
MEMZERO(did, SIZEOF(did));
|
||||
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
if (cinfo->Ss == 0) {
|
||||
if (cinfo->Ah != 0) /* DC refinement needs no table */
|
||||
continue;
|
||||
tbl = compptr->dc_tbl_no;
|
||||
} else {
|
||||
tbl = compptr->ac_tbl_no;
|
||||
}
|
||||
if (! did[tbl]) {
|
||||
if (cinfo->Ss == 0)
|
||||
htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
|
||||
else
|
||||
htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
|
||||
if (*htblptr == NULL)
|
||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
|
||||
did[tbl] = TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MEMZERO(did_dc, SIZEOF(did_dc));
|
||||
MEMZERO(did_ac, SIZEOF(did_ac));
|
||||
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
dctbl = compptr->dc_tbl_no;
|
||||
actbl = compptr->ac_tbl_no;
|
||||
if (! did_dc[dctbl]) {
|
||||
htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
|
||||
/* DC needs no table for refinement scan */
|
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0) {
|
||||
tbl = compptr->dc_tbl_no;
|
||||
if (! did_dc[tbl]) {
|
||||
htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
|
||||
if (*htblptr == NULL)
|
||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
|
||||
did_dc[dctbl] = TRUE;
|
||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[tbl]);
|
||||
did_dc[tbl] = TRUE;
|
||||
}
|
||||
if (! did_ac[actbl]) {
|
||||
htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
|
||||
}
|
||||
/* AC needs no table when not present */
|
||||
if (cinfo->Se) {
|
||||
tbl = compptr->ac_tbl_no;
|
||||
if (! did_ac[tbl]) {
|
||||
htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
|
||||
if (*htblptr == NULL)
|
||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
|
||||
did_ac[actbl] = TRUE;
|
||||
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[tbl]);
|
||||
did_ac[tbl] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1456,7 +1448,7 @@ METHODDEF(void)
|
||||
start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int ci, dctbl, actbl, tbl;
|
||||
int ci, tbl;
|
||||
jpeg_component_info * compptr;
|
||||
|
||||
if (gather_statistics)
|
||||
@@ -1489,42 +1481,8 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
}
|
||||
}
|
||||
|
||||
/* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1
|
||||
* for AC coefficients.
|
||||
*/
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
/* Initialize DC predictions to 0 */
|
||||
entropy->saved.last_dc_val[ci] = 0;
|
||||
/* Get table index */
|
||||
if (cinfo->Ss == 0) {
|
||||
if (cinfo->Ah != 0) /* DC refinement needs no table */
|
||||
continue;
|
||||
tbl = compptr->dc_tbl_no;
|
||||
} else {
|
||||
entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
|
||||
}
|
||||
if (gather_statistics) {
|
||||
/* Check for invalid table index */
|
||||
/* (make_c_derived_tbl does this in the other path) */
|
||||
if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
|
||||
/* Allocate and zero the statistics tables */
|
||||
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
||||
if (entropy->count_ptrs[tbl] == NULL)
|
||||
entropy->count_ptrs[tbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
257 * SIZEOF(long));
|
||||
MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long));
|
||||
} else {
|
||||
/* Compute derived values for Huffman table */
|
||||
/* We may do this more than once for a table, but it's not expensive */
|
||||
jpeg_make_c_derived_tbl(cinfo, cinfo->Ss == 0, tbl,
|
||||
& entropy->derived_tbls[tbl]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize AC stuff */
|
||||
entropy->ac_tbl_no = cinfo->cur_comp_info[0]->ac_tbl_no;
|
||||
entropy->EOBRUN = 0;
|
||||
entropy->BE = 0;
|
||||
} else {
|
||||
@@ -1532,41 +1490,50 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
entropy->pub.encode_mcu = encode_mcu_gather;
|
||||
else
|
||||
entropy->pub.encode_mcu = encode_mcu_huff;
|
||||
}
|
||||
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
dctbl = compptr->dc_tbl_no;
|
||||
actbl = compptr->ac_tbl_no;
|
||||
/* DC needs no table for refinement scan */
|
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0) {
|
||||
tbl = compptr->dc_tbl_no;
|
||||
if (gather_statistics) {
|
||||
/* Check for invalid table indexes */
|
||||
/* Check for invalid table index */
|
||||
/* (make_c_derived_tbl does this in the other path) */
|
||||
if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
|
||||
if (actbl < 0 || actbl >= NUM_HUFF_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
|
||||
if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
|
||||
/* Allocate and zero the statistics tables */
|
||||
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
||||
if (entropy->dc_count_ptrs[dctbl] == NULL)
|
||||
entropy->dc_count_ptrs[dctbl] = (long *)
|
||||
if (entropy->dc_count_ptrs[tbl] == NULL)
|
||||
entropy->dc_count_ptrs[tbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
257 * SIZEOF(long));
|
||||
MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long));
|
||||
if (entropy->ac_count_ptrs[actbl] == NULL)
|
||||
entropy->ac_count_ptrs[actbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
257 * SIZEOF(long));
|
||||
MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long));
|
||||
MEMZERO(entropy->dc_count_ptrs[tbl], 257 * SIZEOF(long));
|
||||
} else {
|
||||
/* Compute derived values for Huffman tables */
|
||||
/* We may do this more than once for a table, but it's not expensive */
|
||||
jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
|
||||
& entropy->dc_derived_tbls[dctbl]);
|
||||
jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
|
||||
& entropy->ac_derived_tbls[actbl]);
|
||||
jpeg_make_c_derived_tbl(cinfo, TRUE, tbl,
|
||||
& entropy->dc_derived_tbls[tbl]);
|
||||
}
|
||||
/* Initialize DC predictions to 0 */
|
||||
entropy->saved.last_dc_val[ci] = 0;
|
||||
}
|
||||
/* AC needs no table when not present */
|
||||
if (cinfo->Se) {
|
||||
tbl = compptr->ac_tbl_no;
|
||||
if (gather_statistics) {
|
||||
if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
|
||||
if (entropy->ac_count_ptrs[tbl] == NULL)
|
||||
entropy->ac_count_ptrs[tbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
257 * SIZEOF(long));
|
||||
MEMZERO(entropy->ac_count_ptrs[tbl], 257 * SIZEOF(long));
|
||||
} else {
|
||||
jpeg_make_c_derived_tbl(cinfo, FALSE, tbl,
|
||||
& entropy->ac_derived_tbls[tbl]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize bit buffer to empty */
|
||||
@@ -1592,21 +1559,15 @@ jinit_huff_encoder (j_compress_ptr cinfo)
|
||||
entropy = (huff_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(huff_entropy_encoder));
|
||||
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass_huff;
|
||||
|
||||
if (cinfo->progressive_mode) {
|
||||
/* Mark tables unallocated */
|
||||
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
||||
entropy->derived_tbls[i] = NULL;
|
||||
entropy->count_ptrs[i] = NULL;
|
||||
}
|
||||
entropy->bit_buffer = NULL; /* needed only in AC refinement scan */
|
||||
} else {
|
||||
/* Mark tables unallocated */
|
||||
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
||||
entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
|
||||
entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (cinfo->progressive_mode)
|
||||
entropy->bit_buffer = NULL; /* needed only in AC refinement scan */
|
||||
}
|
||||
|
||||
19
jcinit.c
19
jcinit.c
@@ -2,6 +2,7 @@
|
||||
* jcinit.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -29,6 +30,24 @@
|
||||
GLOBAL(void)
|
||||
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) */
|
||||
jinit_c_master_control(cinfo, FALSE /* full compression */);
|
||||
|
||||
|
||||
110
jcmainct.c
110
jcmainct.c
@@ -2,6 +2,7 @@
|
||||
* jcmainct.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2003-2012 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -68,32 +69,32 @@ METHODDEF(void) process_data_buffer_main
|
||||
METHODDEF(void)
|
||||
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
|
||||
/* Do nothing in raw-data mode. */
|
||||
if (cinfo->raw_data_in)
|
||||
return;
|
||||
|
||||
main->cur_iMCU_row = 0; /* initialize counters */
|
||||
main->rowgroup_ctr = 0;
|
||||
main->suspended = FALSE;
|
||||
main->pass_mode = pass_mode; /* save mode for use by process_data */
|
||||
mainp->cur_iMCU_row = 0; /* initialize counters */
|
||||
mainp->rowgroup_ctr = 0;
|
||||
mainp->suspended = FALSE;
|
||||
mainp->pass_mode = pass_mode; /* save mode for use by process_data */
|
||||
|
||||
switch (pass_mode) {
|
||||
case JBUF_PASS_THRU:
|
||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||
if (main->whole_image[0] != NULL)
|
||||
if (mainp->whole_image[0] != NULL)
|
||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||
#endif
|
||||
main->pub.process_data = process_data_simple_main;
|
||||
mainp->pub.process_data = process_data_simple_main;
|
||||
break;
|
||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||
case JBUF_SAVE_SOURCE:
|
||||
case JBUF_CRANK_DEST:
|
||||
case JBUF_SAVE_AND_PASS:
|
||||
if (main->whole_image[0] == NULL)
|
||||
if (mainp->whole_image[0] == NULL)
|
||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||
main->pub.process_data = process_data_buffer_main;
|
||||
mainp->pub.process_data = process_data_buffer_main;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -114,46 +115,46 @@ process_data_simple_main (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||
JDIMENSION in_rows_avail)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
|
||||
while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||
while (mainp->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||
/* Read input data if we haven't filled the main buffer yet */
|
||||
if (main->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
if (mainp->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
(*cinfo->prep->pre_process_data) (cinfo,
|
||||
input_buf, in_row_ctr, in_rows_avail,
|
||||
main->buffer, &main->rowgroup_ctr,
|
||||
mainp->buffer, &mainp->rowgroup_ctr,
|
||||
(JDIMENSION) cinfo->min_DCT_v_scaled_size);
|
||||
|
||||
/* If we don't have a full iMCU row buffered, return to application for
|
||||
* more data. Note that preprocessor will always pad to fill the iMCU row
|
||||
* at the bottom of the image.
|
||||
*/
|
||||
if (main->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
if (mainp->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
return;
|
||||
|
||||
/* Send the completed row to the compressor */
|
||||
if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
|
||||
if (! (*cinfo->coef->compress_data) (cinfo, mainp->buffer)) {
|
||||
/* If compressor did not consume the whole row, then we must need to
|
||||
* suspend processing and return to the application. In this situation
|
||||
* we pretend we didn't yet consume the last input row; otherwise, if
|
||||
* it happened to be the last row of the image, the application would
|
||||
* think we were done.
|
||||
*/
|
||||
if (! main->suspended) {
|
||||
if (! mainp->suspended) {
|
||||
(*in_row_ctr)--;
|
||||
main->suspended = TRUE;
|
||||
mainp->suspended = TRUE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* We did finish the row. Undo our little suspension hack if a previous
|
||||
* call suspended; then mark the main buffer empty.
|
||||
*/
|
||||
if (main->suspended) {
|
||||
if (mainp->suspended) {
|
||||
(*in_row_ctr)++;
|
||||
main->suspended = FALSE;
|
||||
mainp->suspended = FALSE;
|
||||
}
|
||||
main->rowgroup_ctr = 0;
|
||||
main->cur_iMCU_row++;
|
||||
mainp->rowgroup_ctr = 0;
|
||||
mainp->cur_iMCU_row++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,25 +171,27 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||
JDIMENSION in_rows_avail)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
boolean writing = (main->pass_mode != JBUF_CRANK_DEST);
|
||||
boolean writing = (mainp->pass_mode != JBUF_CRANK_DEST);
|
||||
|
||||
while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||
while (mainp->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||
/* Realign the virtual buffers if at the start of an iMCU row. */
|
||||
if (main->rowgroup_ctr == 0) {
|
||||
if (mainp->rowgroup_ctr == 0) {
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
main->buffer[ci] = (*cinfo->mem->access_virt_sarray)
|
||||
((j_common_ptr) cinfo, main->whole_image[ci],
|
||||
main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
|
||||
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
|
||||
mainp->buffer[ci] = (*cinfo->mem->access_virt_sarray)
|
||||
((j_common_ptr) cinfo, mainp->whole_image[ci], mainp->cur_iMCU_row *
|
||||
((JDIMENSION) (compptr->v_samp_factor * cinfo->min_DCT_v_scaled_size)),
|
||||
(JDIMENSION) (compptr->v_samp_factor * cinfo->min_DCT_v_scaled_size),
|
||||
writing);
|
||||
}
|
||||
/* In a read pass, pretend we just read some source data. */
|
||||
if (! writing) {
|
||||
*in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
|
||||
main->rowgroup_ctr = DCTSIZE;
|
||||
*in_row_ctr += (JDIMENSION)
|
||||
(cinfo->max_v_samp_factor * cinfo->min_DCT_v_scaled_size);
|
||||
mainp->rowgroup_ctr = (JDIMENSION) cinfo->min_DCT_v_scaled_size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,40 +200,40 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
||||
if (writing) {
|
||||
(*cinfo->prep->pre_process_data) (cinfo,
|
||||
input_buf, in_row_ctr, in_rows_avail,
|
||||
main->buffer, &main->rowgroup_ctr,
|
||||
(JDIMENSION) DCTSIZE);
|
||||
mainp->buffer, &mainp->rowgroup_ctr,
|
||||
(JDIMENSION) cinfo->min_DCT_v_scaled_size);
|
||||
/* Return to application if we need more data to fill the iMCU row. */
|
||||
if (main->rowgroup_ctr < DCTSIZE)
|
||||
if (mainp->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Emit data, unless this is a sink-only pass. */
|
||||
if (main->pass_mode != JBUF_SAVE_SOURCE) {
|
||||
if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
|
||||
if (mainp->pass_mode != JBUF_SAVE_SOURCE) {
|
||||
if (! (*cinfo->coef->compress_data) (cinfo, mainp->buffer)) {
|
||||
/* If compressor did not consume the whole row, then we must need to
|
||||
* suspend processing and return to the application. In this situation
|
||||
* we pretend we didn't yet consume the last input row; otherwise, if
|
||||
* it happened to be the last row of the image, the application would
|
||||
* think we were done.
|
||||
*/
|
||||
if (! main->suspended) {
|
||||
if (! mainp->suspended) {
|
||||
(*in_row_ctr)--;
|
||||
main->suspended = TRUE;
|
||||
mainp->suspended = TRUE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* We did finish the row. Undo our little suspension hack if a previous
|
||||
* call suspended; then mark the main buffer empty.
|
||||
*/
|
||||
if (main->suspended) {
|
||||
if (mainp->suspended) {
|
||||
(*in_row_ctr)++;
|
||||
main->suspended = FALSE;
|
||||
mainp->suspended = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* If get here, we are done with this iMCU row. Mark buffer empty. */
|
||||
main->rowgroup_ctr = 0;
|
||||
main->cur_iMCU_row++;
|
||||
mainp->rowgroup_ctr = 0;
|
||||
mainp->cur_iMCU_row++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,15 +247,15 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
||||
GLOBAL(void)
|
||||
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||
{
|
||||
my_main_ptr main;
|
||||
my_main_ptr mainp;
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
main = (my_main_ptr)
|
||||
mainp = (my_main_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_main_controller));
|
||||
cinfo->main = (struct jpeg_c_main_controller *) main;
|
||||
main->pub.start_pass = start_pass_main;
|
||||
cinfo->main = &mainp->pub;
|
||||
mainp->pub.start_pass = start_pass_main;
|
||||
|
||||
/* We don't need to create a buffer in raw-data mode. */
|
||||
if (cinfo->raw_data_in)
|
||||
@@ -267,11 +270,12 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||
/* Note we pad the bottom to a multiple of the iMCU height */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
main->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
||||
mainp->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
||||
(long) compptr->v_samp_factor) * DCTSIZE,
|
||||
compptr->width_in_blocks * ((JDIMENSION) compptr->DCT_h_scaled_size),
|
||||
((JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
||||
(long) compptr->v_samp_factor)) *
|
||||
((JDIMENSION) cinfo->min_DCT_v_scaled_size),
|
||||
(JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size));
|
||||
}
|
||||
#else
|
||||
@@ -279,14 +283,14 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||
#endif
|
||||
} else {
|
||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||
main->whole_image[0] = NULL; /* flag for no virtual arrays */
|
||||
mainp->whole_image[0] = NULL; /* flag for no virtual arrays */
|
||||
#endif
|
||||
/* Allocate a strip buffer for each component */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
mainp->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||
compptr->width_in_blocks * ((JDIMENSION) compptr->DCT_h_scaled_size),
|
||||
(JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size));
|
||||
}
|
||||
}
|
||||
|
||||
122
jcmarker.c
122
jcmarker.c
@@ -2,6 +2,7 @@
|
||||
* jcmarker.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -72,6 +73,7 @@ typedef enum { /* JPEG marker codes */
|
||||
M_APP15 = 0xef,
|
||||
|
||||
M_JPG0 = 0xf0,
|
||||
M_JPG8 = 0xf8,
|
||||
M_JPG13 = 0xfd,
|
||||
M_COM = 0xfe,
|
||||
|
||||
@@ -153,21 +155,22 @@ emit_dqt (j_compress_ptr cinfo, int index)
|
||||
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
|
||||
|
||||
prec = 0;
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
if (qtbl->quantval[i] > 255)
|
||||
for (i = 0; i <= cinfo->lim_Se; i++) {
|
||||
if (qtbl->quantval[cinfo->natural_order[i]] > 255)
|
||||
prec = 1;
|
||||
}
|
||||
|
||||
if (! qtbl->sent_table) {
|
||||
emit_marker(cinfo, M_DQT);
|
||||
|
||||
emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
|
||||
emit_2bytes(cinfo,
|
||||
prec ? cinfo->lim_Se * 2 + 2 + 1 + 2 : cinfo->lim_Se + 1 + 1 + 2);
|
||||
|
||||
emit_byte(cinfo, index + (prec<<4));
|
||||
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
for (i = 0; i <= cinfo->lim_Se; i++) {
|
||||
/* The table entries must be emitted in zigzag order. */
|
||||
unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
|
||||
unsigned int qval = qtbl->quantval[cinfo->natural_order[i]];
|
||||
if (prec)
|
||||
emit_byte(cinfo, (int) (qval >> 8));
|
||||
emit_byte(cinfo, (int) (qval & 0xFF));
|
||||
@@ -235,7 +238,11 @@ emit_dac (j_compress_ptr cinfo)
|
||||
|
||||
for (i = 0; i < cinfo->comps_in_scan; i++) {
|
||||
compptr = cinfo->cur_comp_info[i];
|
||||
/* DC needs no table for refinement scan */
|
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0)
|
||||
dc_in_use[compptr->dc_tbl_no] = 1;
|
||||
/* AC needs no table when not present */
|
||||
if (cinfo->Se)
|
||||
ac_in_use[compptr->ac_tbl_no] = 1;
|
||||
}
|
||||
|
||||
@@ -243,6 +250,7 @@ emit_dac (j_compress_ptr cinfo)
|
||||
for (i = 0; i < NUM_ARITH_TBLS; i++)
|
||||
length += dc_in_use[i] + ac_in_use[i];
|
||||
|
||||
if (length) {
|
||||
emit_marker(cinfo, M_DAC);
|
||||
|
||||
emit_2bytes(cinfo, length*2 + 2);
|
||||
@@ -257,6 +265,7 @@ emit_dac (j_compress_ptr cinfo)
|
||||
emit_byte(cinfo, cinfo->arith_ac_K[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* C_ARITH_CODING_SUPPORTED */
|
||||
}
|
||||
|
||||
@@ -273,6 +282,37 @@ emit_dri (j_compress_ptr cinfo)
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
emit_lse_ict (j_compress_ptr cinfo)
|
||||
/* Emit an LSE inverse color transform specification marker */
|
||||
{
|
||||
/* Support only 1 transform */
|
||||
if (cinfo->color_transform != JCT_SUBTRACT_GREEN ||
|
||||
cinfo->num_components < 3)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
|
||||
emit_marker(cinfo, M_JPG8);
|
||||
|
||||
emit_2bytes(cinfo, 24); /* fixed length */
|
||||
|
||||
emit_byte(cinfo, 0x0D); /* ID inverse transform specification */
|
||||
emit_2bytes(cinfo, MAXJSAMPLE); /* MAXTRANS */
|
||||
emit_byte(cinfo, 3); /* Nt=3 */
|
||||
emit_byte(cinfo, cinfo->comp_info[1].component_id);
|
||||
emit_byte(cinfo, cinfo->comp_info[0].component_id);
|
||||
emit_byte(cinfo, cinfo->comp_info[2].component_id);
|
||||
emit_byte(cinfo, 0x80); /* F1: CENTER1=1, NORM1=0 */
|
||||
emit_2bytes(cinfo, 0); /* A(1,1)=0 */
|
||||
emit_2bytes(cinfo, 0); /* A(1,2)=0 */
|
||||
emit_byte(cinfo, 0); /* F2: CENTER2=0, NORM2=0 */
|
||||
emit_2bytes(cinfo, 1); /* A(2,1)=1 */
|
||||
emit_2bytes(cinfo, 0); /* A(2,2)=0 */
|
||||
emit_byte(cinfo, 0); /* F3: CENTER3=0, NORM3=0 */
|
||||
emit_2bytes(cinfo, 1); /* A(3,1)=1 */
|
||||
emit_2bytes(cinfo, 0); /* A(3,2)=0 */
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
|
||||
/* Emit a SOF marker */
|
||||
@@ -320,22 +360,16 @@ emit_sos (j_compress_ptr cinfo)
|
||||
for (i = 0; i < cinfo->comps_in_scan; i++) {
|
||||
compptr = cinfo->cur_comp_info[i];
|
||||
emit_byte(cinfo, compptr->component_id);
|
||||
td = compptr->dc_tbl_no;
|
||||
ta = compptr->ac_tbl_no;
|
||||
if (cinfo->progressive_mode) {
|
||||
/* Progressive mode: only DC or only AC tables are used in one scan;
|
||||
* furthermore, Huffman coding of DC refinement uses no table at all.
|
||||
* We emit 0 for unused field(s); this is recommended by the P&M text
|
||||
|
||||
/* We emit 0 for unused field(s); this is recommended by the P&M text
|
||||
* but does not seem to be specified in the standard.
|
||||
*/
|
||||
if (cinfo->Ss == 0) {
|
||||
ta = 0; /* DC scan */
|
||||
if (cinfo->Ah != 0 && !cinfo->arith_code)
|
||||
td = 0; /* no DC table either */
|
||||
} else {
|
||||
td = 0; /* AC scan */
|
||||
}
|
||||
}
|
||||
|
||||
/* DC needs no table for refinement scan */
|
||||
td = cinfo->Ss == 0 && cinfo->Ah == 0 ? compptr->dc_tbl_no : 0;
|
||||
/* AC needs no table when not present */
|
||||
ta = cinfo->Se ? compptr->ac_tbl_no : 0;
|
||||
|
||||
emit_byte(cinfo, (td << 4) + ta);
|
||||
}
|
||||
|
||||
@@ -345,6 +379,22 @@ emit_sos (j_compress_ptr cinfo)
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
emit_pseudo_sos (j_compress_ptr cinfo)
|
||||
/* Emit a pseudo SOS marker */
|
||||
{
|
||||
emit_marker(cinfo, M_SOS);
|
||||
|
||||
emit_2bytes(cinfo, 2 + 1 + 3); /* length */
|
||||
|
||||
emit_byte(cinfo, 0); /* Ns */
|
||||
|
||||
emit_byte(cinfo, 0); /* Ss */
|
||||
emit_byte(cinfo, cinfo->block_size * cinfo->block_size - 1); /* Se */
|
||||
emit_byte(cinfo, 0); /* Ah/Al */
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
emit_jfif_app0 (j_compress_ptr cinfo)
|
||||
/* Emit a JFIF-compliant APP0 marker */
|
||||
@@ -458,8 +508,8 @@ write_marker_byte (j_compress_ptr cinfo, int val)
|
||||
* Write datastream header.
|
||||
* This consists of an SOI and optional APPn markers.
|
||||
* We recommend use of the JFIF marker, but not the Adobe marker,
|
||||
* when using YCbCr or grayscale data. The JFIF marker should NOT
|
||||
* be used for any other JPEG colorspace. The Adobe marker is helpful
|
||||
* when using YCbCr or grayscale data. The JFIF marker is also used
|
||||
* for other standard JPEG colorspaces. The Adobe marker is helpful
|
||||
* to distinguish RGB, CMYK, and YCCK colorspaces.
|
||||
* Note that an application can write additional header markers after
|
||||
* jpeg_start_compress returns.
|
||||
@@ -484,7 +534,8 @@ write_file_header (j_compress_ptr cinfo)
|
||||
|
||||
/*
|
||||
* Write frame header.
|
||||
* This consists of DQT and SOFn markers.
|
||||
* This consists of DQT and SOFn markers,
|
||||
* a conditional LSE marker and a conditional pseudo SOS marker.
|
||||
* Note that we do not emit the SOF until we have emitted the DQT(s).
|
||||
* This avoids compatibility problems with incorrect implementations that
|
||||
* try to error-check the quant table numbers as soon as they see the SOF.
|
||||
@@ -511,7 +562,7 @@ write_frame_header (j_compress_ptr cinfo)
|
||||
* Note we assume that Huffman table numbers won't be changed later.
|
||||
*/
|
||||
if (cinfo->arith_code || cinfo->progressive_mode ||
|
||||
cinfo->data_precision != 8) {
|
||||
cinfo->data_precision != 8 || cinfo->block_size != DCTSIZE) {
|
||||
is_baseline = FALSE;
|
||||
} else {
|
||||
is_baseline = TRUE;
|
||||
@@ -541,6 +592,14 @@ write_frame_header (j_compress_ptr cinfo)
|
||||
else
|
||||
emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
|
||||
}
|
||||
|
||||
/* Check to emit LSE inverse color transform specification marker */
|
||||
if (cinfo->color_transform)
|
||||
emit_lse_ict(cinfo);
|
||||
|
||||
/* Check to emit pseudo SOS marker */
|
||||
if (cinfo->progressive_mode && cinfo->block_size != DCTSIZE)
|
||||
emit_pseudo_sos(cinfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -569,20 +628,13 @@ write_scan_header (j_compress_ptr cinfo)
|
||||
*/
|
||||
for (i = 0; i < cinfo->comps_in_scan; i++) {
|
||||
compptr = cinfo->cur_comp_info[i];
|
||||
if (cinfo->progressive_mode) {
|
||||
/* Progressive mode: only DC or only AC tables are used in one scan */
|
||||
if (cinfo->Ss == 0) {
|
||||
if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
|
||||
/* DC needs no table for refinement scan */
|
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0)
|
||||
emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
|
||||
} else {
|
||||
/* AC needs no table when not present */
|
||||
if (cinfo->Se)
|
||||
emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
|
||||
}
|
||||
} else {
|
||||
/* Sequential mode: need both DC and AC tables */
|
||||
emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
|
||||
emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Emit DRI if required --- note that DRI value could change for each scan.
|
||||
@@ -653,7 +705,7 @@ jinit_marker_writer (j_compress_ptr cinfo)
|
||||
marker = (my_marker_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_marker_writer));
|
||||
cinfo->marker = (struct jpeg_marker_writer *) marker;
|
||||
cinfo->marker = &marker->pub;
|
||||
/* Initialize method pointers */
|
||||
marker->pub.write_file_header = write_file_header;
|
||||
marker->pub.write_frame_header = write_frame_header;
|
||||
|
||||
290
jcmaster.c
290
jcmaster.c
@@ -2,7 +2,7 @@
|
||||
* jcmaster.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2003-2009 by Guido Vollbeding.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -55,125 +55,140 @@ jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
|
||||
{
|
||||
#ifdef DCT_SCALING_SUPPORTED
|
||||
|
||||
/* Sanity check on input image dimensions to prevent overflow in
|
||||
* following calculation.
|
||||
* We do check jpeg_width and jpeg_height in initial_setup below,
|
||||
* but image_width and image_height can come from arbitrary data,
|
||||
* and we need some space for multiplication by block_size.
|
||||
*/
|
||||
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
|
||||
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
|
||||
|
||||
/* Compute actual JPEG image dimensions and DCT scaling choices. */
|
||||
if (cinfo->scale_num >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/1 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width << 3;
|
||||
cinfo->jpeg_height = cinfo->image_height << 3;
|
||||
if (cinfo->scale_num >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/1 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width * cinfo->block_size;
|
||||
cinfo->jpeg_height = cinfo->image_height * cinfo->block_size;
|
||||
cinfo->min_DCT_h_scaled_size = 1;
|
||||
cinfo->min_DCT_v_scaled_size = 1;
|
||||
} else if (cinfo->scale_num >= cinfo->scale_denom * 4) {
|
||||
/* Provide 4/1 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width << 2;
|
||||
cinfo->jpeg_height = cinfo->image_height << 2;
|
||||
} else if (cinfo->scale_num * 2 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/2 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 2L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 2L);
|
||||
cinfo->min_DCT_h_scaled_size = 2;
|
||||
cinfo->min_DCT_v_scaled_size = 2;
|
||||
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/3 scaling */
|
||||
cinfo->jpeg_width = (cinfo->image_width << 1) + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 2, 3L);
|
||||
cinfo->jpeg_height = (cinfo->image_height << 1) + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 2, 3L);
|
||||
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/3 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 3L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 3L);
|
||||
cinfo->min_DCT_h_scaled_size = 3;
|
||||
cinfo->min_DCT_v_scaled_size = 3;
|
||||
} else if (cinfo->scale_num >= cinfo->scale_denom * 2) {
|
||||
/* Provide 2/1 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width << 1;
|
||||
cinfo->jpeg_height = cinfo->image_height << 1;
|
||||
} else if (cinfo->scale_num * 4 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/4 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 4L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 4L);
|
||||
cinfo->min_DCT_h_scaled_size = 4;
|
||||
cinfo->min_DCT_v_scaled_size = 4;
|
||||
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/5 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 3, 5L);
|
||||
cinfo->jpeg_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 3, 5L);
|
||||
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/5 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 5L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 5L);
|
||||
cinfo->min_DCT_h_scaled_size = 5;
|
||||
cinfo->min_DCT_v_scaled_size = 5;
|
||||
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * 4) {
|
||||
/* Provide 4/3 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 3L);
|
||||
cinfo->jpeg_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 3L);
|
||||
} else if (cinfo->scale_num * 6 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/6 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 6L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 6L);
|
||||
cinfo->min_DCT_h_scaled_size = 6;
|
||||
cinfo->min_DCT_v_scaled_size = 6;
|
||||
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/7 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 7L);
|
||||
cinfo->jpeg_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 7L);
|
||||
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/7 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 7L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 7L);
|
||||
cinfo->min_DCT_h_scaled_size = 7;
|
||||
cinfo->min_DCT_v_scaled_size = 7;
|
||||
} else if (cinfo->scale_num >= cinfo->scale_denom) {
|
||||
/* Provide 1/1 scaling */
|
||||
cinfo->jpeg_width = cinfo->image_width;
|
||||
cinfo->jpeg_height = cinfo->image_height;
|
||||
cinfo->min_DCT_h_scaled_size = DCTSIZE;
|
||||
cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
||||
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/9 scaling */
|
||||
} else if (cinfo->scale_num * 8 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/8 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 8, 9L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 8L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 8, 9L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 8;
|
||||
cinfo->min_DCT_v_scaled_size = 8;
|
||||
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/9 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 9L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 9L);
|
||||
cinfo->min_DCT_h_scaled_size = 9;
|
||||
cinfo->min_DCT_v_scaled_size = 9;
|
||||
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * 4) {
|
||||
/* Provide 4/5 scaling */
|
||||
} else if (cinfo->scale_num * 10 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/10 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 4, 5L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 10L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 4, 5L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 10L);
|
||||
cinfo->min_DCT_h_scaled_size = 10;
|
||||
cinfo->min_DCT_v_scaled_size = 10;
|
||||
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/11 scaling */
|
||||
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/11 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 8, 11L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 11L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 8, 11L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 11L);
|
||||
cinfo->min_DCT_h_scaled_size = 11;
|
||||
cinfo->min_DCT_v_scaled_size = 11;
|
||||
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * 2) {
|
||||
/* Provide 2/3 scaling */
|
||||
} else if (cinfo->scale_num * 12 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/12 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 2, 3L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 12L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 2, 3L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 12L);
|
||||
cinfo->min_DCT_h_scaled_size = 12;
|
||||
cinfo->min_DCT_v_scaled_size = 12;
|
||||
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/13 scaling */
|
||||
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/13 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 8, 13L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 13L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 8, 13L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 13L);
|
||||
cinfo->min_DCT_h_scaled_size = 13;
|
||||
cinfo->min_DCT_v_scaled_size = 13;
|
||||
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * 4) {
|
||||
/* Provide 4/7 scaling */
|
||||
} else if (cinfo->scale_num * 14 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/14 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 4, 7L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 14L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 4, 7L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 14L);
|
||||
cinfo->min_DCT_h_scaled_size = 14;
|
||||
cinfo->min_DCT_v_scaled_size = 14;
|
||||
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/15 scaling */
|
||||
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * cinfo->block_size) {
|
||||
/* Provide block_size/15 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 8, 15L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 15L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 8, 15L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 15L);
|
||||
cinfo->min_DCT_h_scaled_size = 15;
|
||||
cinfo->min_DCT_v_scaled_size = 15;
|
||||
} else {
|
||||
/* Provide 1/2 scaling */
|
||||
/* Provide block_size/16 scaling */
|
||||
cinfo->jpeg_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 2L);
|
||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 16L);
|
||||
cinfo->jpeg_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 2L);
|
||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 16L);
|
||||
cinfo->min_DCT_h_scaled_size = 16;
|
||||
cinfo->min_DCT_v_scaled_size = 16;
|
||||
}
|
||||
@@ -191,19 +206,50 @@ jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
initial_setup (j_compress_ptr cinfo)
|
||||
jpeg_calc_trans_dimensions (j_compress_ptr cinfo)
|
||||
{
|
||||
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
|
||||
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
|
||||
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
|
||||
|
||||
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
initial_setup (j_compress_ptr cinfo, boolean transcode_only)
|
||||
/* Do computations that are needed before master selection phase */
|
||||
{
|
||||
int ci, ssize;
|
||||
jpeg_component_info *compptr;
|
||||
long samplesperrow;
|
||||
JDIMENSION jd_samplesperrow;
|
||||
|
||||
if (transcode_only)
|
||||
jpeg_calc_trans_dimensions(cinfo);
|
||||
else
|
||||
jpeg_calc_jpeg_dimensions(cinfo);
|
||||
|
||||
/* Sanity check on block_size */
|
||||
if (cinfo->block_size < 1 || cinfo->block_size > 16)
|
||||
ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size);
|
||||
|
||||
/* Derive natural_order from block_size */
|
||||
switch (cinfo->block_size) {
|
||||
case 2: cinfo->natural_order = jpeg_natural_order2; break;
|
||||
case 3: cinfo->natural_order = jpeg_natural_order3; break;
|
||||
case 4: cinfo->natural_order = jpeg_natural_order4; break;
|
||||
case 5: cinfo->natural_order = jpeg_natural_order5; break;
|
||||
case 6: cinfo->natural_order = jpeg_natural_order6; break;
|
||||
case 7: cinfo->natural_order = jpeg_natural_order7; break;
|
||||
default: cinfo->natural_order = jpeg_natural_order; break;
|
||||
}
|
||||
|
||||
/* Derive lim_Se from block_size */
|
||||
cinfo->lim_Se = cinfo->block_size < DCTSIZE ?
|
||||
cinfo->block_size * cinfo->block_size - 1 : DCTSIZE2-1;
|
||||
|
||||
/* Sanity check on image dimensions */
|
||||
if (cinfo->jpeg_height <= 0 || cinfo->jpeg_width <= 0
|
||||
|| cinfo->num_components <= 0 || cinfo->input_components <= 0)
|
||||
if (cinfo->jpeg_height <= 0 || cinfo->jpeg_width <= 0 ||
|
||||
cinfo->num_components <= 0)
|
||||
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
||||
|
||||
/* Make sure image isn't bigger than I can handle */
|
||||
@@ -211,14 +257,8 @@ initial_setup (j_compress_ptr cinfo)
|
||||
(long) cinfo->jpeg_width > (long) JPEG_MAX_DIMENSION)
|
||||
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* For now, precision must match compiled-in value... */
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
/* Only 8 to 12 bits data precision are supported for DCT based JPEG */
|
||||
if (cinfo->data_precision < 8 || cinfo->data_precision > 12)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
|
||||
/* Check that number of components won't exceed internal array sizes */
|
||||
@@ -278,21 +318,23 @@ initial_setup (j_compress_ptr cinfo)
|
||||
/* Size in DCT blocks */
|
||||
compptr->width_in_blocks = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->jpeg_width * (long) compptr->h_samp_factor,
|
||||
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
||||
(long) (cinfo->max_h_samp_factor * cinfo->block_size));
|
||||
compptr->height_in_blocks = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->jpeg_height * (long) compptr->v_samp_factor,
|
||||
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
/* Size in samples */
|
||||
compptr->downsampled_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->jpeg_width *
|
||||
(long) (compptr->h_samp_factor * compptr->DCT_h_scaled_size),
|
||||
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
||||
(long) (cinfo->max_h_samp_factor * cinfo->block_size));
|
||||
compptr->downsampled_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->jpeg_height *
|
||||
(long) (compptr->v_samp_factor * compptr->DCT_v_scaled_size),
|
||||
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
||||
/* Mark component needed (this flag isn't actually used for compression) */
|
||||
compptr->component_needed = TRUE;
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
/* Don't need quantization scale after DCT,
|
||||
* until color conversion says otherwise.
|
||||
*/
|
||||
compptr->component_needed = FALSE;
|
||||
}
|
||||
|
||||
/* Compute number of fully interleaved MCU rows (number of times that
|
||||
@@ -300,7 +342,7 @@ initial_setup (j_compress_ptr cinfo)
|
||||
*/
|
||||
cinfo->total_iMCU_rows = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->jpeg_height,
|
||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
}
|
||||
|
||||
|
||||
@@ -440,6 +482,39 @@ validate_script (j_compress_ptr cinfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
reduce_script (j_compress_ptr cinfo)
|
||||
/* Adapt scan script for use with reduced block size;
|
||||
* assume that script has been validated before.
|
||||
*/
|
||||
{
|
||||
jpeg_scan_info * scanptr;
|
||||
int idxout, idxin;
|
||||
|
||||
/* Circumvent const declaration for this function */
|
||||
scanptr = (jpeg_scan_info *) cinfo->scan_info;
|
||||
idxout = 0;
|
||||
|
||||
for (idxin = 0; idxin < cinfo->num_scans; idxin++) {
|
||||
/* After skipping, idxout becomes smaller than idxin */
|
||||
if (idxin != idxout)
|
||||
/* Copy rest of data;
|
||||
* note we stay in given chunk of allocated memory.
|
||||
*/
|
||||
scanptr[idxout] = scanptr[idxin];
|
||||
if (scanptr[idxout].Ss > cinfo->lim_Se)
|
||||
/* Entire scan out of range - skip this entry */
|
||||
continue;
|
||||
if (scanptr[idxout].Se > cinfo->lim_Se)
|
||||
/* Limit scan to end of block */
|
||||
scanptr[idxout].Se = cinfo->lim_Se;
|
||||
idxout++;
|
||||
}
|
||||
|
||||
cinfo->num_scans = idxout;
|
||||
}
|
||||
|
||||
#endif /* C_MULTISCAN_FILES_SUPPORTED */
|
||||
|
||||
|
||||
@@ -460,10 +535,13 @@ select_scan_parameters (j_compress_ptr cinfo)
|
||||
cinfo->cur_comp_info[ci] =
|
||||
&cinfo->comp_info[scanptr->component_index[ci]];
|
||||
}
|
||||
if (cinfo->progressive_mode) {
|
||||
cinfo->Ss = scanptr->Ss;
|
||||
cinfo->Se = scanptr->Se;
|
||||
cinfo->Ah = scanptr->Ah;
|
||||
cinfo->Al = scanptr->Al;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -476,11 +554,11 @@ select_scan_parameters (j_compress_ptr cinfo)
|
||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||
cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
|
||||
}
|
||||
}
|
||||
cinfo->Ss = 0;
|
||||
cinfo->Se = DCTSIZE2-1;
|
||||
cinfo->Se = cinfo->block_size * cinfo->block_size - 1;
|
||||
cinfo->Ah = 0;
|
||||
cinfo->Al = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -528,10 +606,10 @@ per_scan_setup (j_compress_ptr cinfo)
|
||||
/* Overall image size in MCUs */
|
||||
cinfo->MCUs_per_row = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->jpeg_width,
|
||||
(long) (cinfo->max_h_samp_factor*DCTSIZE));
|
||||
(long) (cinfo->max_h_samp_factor * cinfo->block_size));
|
||||
cinfo->MCU_rows_in_scan = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->jpeg_height,
|
||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
|
||||
cinfo->blocks_in_MCU = 0;
|
||||
|
||||
@@ -727,18 +805,20 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
|
||||
master = (my_master_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
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.pass_startup = pass_startup;
|
||||
master->pub.finish_pass = finish_pass_master;
|
||||
master->pub.is_last_pass = FALSE;
|
||||
|
||||
/* Validate parameters, determine derived values */
|
||||
initial_setup(cinfo);
|
||||
initial_setup(cinfo, transcode_only);
|
||||
|
||||
if (cinfo->scan_info != NULL) {
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||
validate_script(cinfo);
|
||||
if (cinfo->block_size < DCTSIZE)
|
||||
reduce_script(cinfo);
|
||||
#else
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
#endif
|
||||
@@ -747,8 +827,14 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
|
||||
cinfo->num_scans = 1;
|
||||
}
|
||||
|
||||
if (cinfo->progressive_mode && cinfo->arith_code == 0) /* TEMPORARY HACK ??? */
|
||||
cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */
|
||||
if (cinfo->optimize_coding)
|
||||
cinfo->arith_code = FALSE; /* disable arithmetic coding */
|
||||
else if (! cinfo->arith_code &&
|
||||
(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 */
|
||||
if (transcode_only) {
|
||||
|
||||
14
jconfig.cfg
14
jconfig.cfg
@@ -17,6 +17,20 @@
|
||||
/* Define this if you get warnings about undefined structures. */
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
/* Define "boolean" as unsigned char, not enum, on Windows systems. */
|
||||
#ifdef _WIN32
|
||||
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
typedef unsigned char boolean;
|
||||
#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 */
|
||||
#endif
|
||||
|
||||
#ifdef JPEG_INTERNALS
|
||||
|
||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */
|
||||
/* Note: the above define is known to improve the code with Microsoft C 6.00A.
|
||||
* I do not know whether it is good for later compiler versions.
|
||||
* Please report any info on this point to jpeg-info@uunet.uu.net.
|
||||
* Please report any info on this point to jpeg-info@jpegclub.org.
|
||||
*/
|
||||
|
||||
#endif /* JPEG_INTERNALS */
|
||||
|
||||
16
jconfig.txt
16
jconfig.txt
@@ -2,6 +2,7 @@
|
||||
* jconfig.txt
|
||||
*
|
||||
* Copyright (C) 1991-1994, Thomas G. Lane.
|
||||
* Modified 2009-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -91,6 +92,21 @@
|
||||
*/
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
/* Define "boolean" as unsigned char, not enum, on Windows systems.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
typedef unsigned char boolean;
|
||||
#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 */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The following options affect code selection within the JPEG library,
|
||||
|
||||
11
jconfig.vc
11
jconfig.vc
@@ -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 */
|
||||
|
||||
#define HAVE_PROTOTYPES
|
||||
@@ -15,10 +16,16 @@
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
/* Define "boolean" as unsigned char, not int, per Windows custom */
|
||||
/* Define "boolean" as unsigned char, not enum, per Windows custom */
|
||||
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
typedef unsigned char boolean;
|
||||
#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 */
|
||||
|
||||
|
||||
|
||||
115
jcparam.c
115
jcparam.c
@@ -2,7 +2,7 @@
|
||||
* jcparam.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2008 by Guido Vollbeding.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -150,7 +150,7 @@ jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
|
||||
/* Set or change the 'quality' (quantization) setting, using default tables.
|
||||
* This is the standard quality-adjusting entry point for typical user
|
||||
* interfaces; only those who want detailed control over quantization tables
|
||||
* would use the preceding three routines directly.
|
||||
* would use the preceding routines directly.
|
||||
*/
|
||||
{
|
||||
/* Convert user 0-100 rating to percentage scaling */
|
||||
@@ -323,18 +323,17 @@ jpeg_set_defaults (j_compress_ptr cinfo)
|
||||
/* Expect normal source image, not raw downsampled data */
|
||||
cinfo->raw_data_in = FALSE;
|
||||
|
||||
/* Use Huffman coding, not arithmetic coding, by default */
|
||||
cinfo->arith_code = FALSE;
|
||||
/* The standard Huffman tables are only valid for 8-bit data precision.
|
||||
* 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 */
|
||||
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 */
|
||||
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
|
||||
* to 1.02, but there may still be some decoders in use that will complain
|
||||
* 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_minor_version = 1;
|
||||
@@ -367,6 +369,9 @@ jpeg_set_defaults (j_compress_ptr cinfo)
|
||||
cinfo->X_density = 1; /* Pixel aspect ratio is square by default */
|
||||
cinfo->Y_density = 1;
|
||||
|
||||
/* No color transform */
|
||||
cinfo->color_transform = JCT_NONE;
|
||||
|
||||
/* Choose JPEG colorspace based on input space, set defaults accordingly */
|
||||
|
||||
jpeg_default_colorspace(cinfo);
|
||||
@@ -381,6 +386,9 @@ GLOBAL(void)
|
||||
jpeg_default_colorspace (j_compress_ptr cinfo)
|
||||
{
|
||||
switch (cinfo->in_color_space) {
|
||||
case JCS_UNKNOWN:
|
||||
jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
|
||||
break;
|
||||
case JCS_GRAYSCALE:
|
||||
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
|
||||
break;
|
||||
@@ -396,8 +404,12 @@ jpeg_default_colorspace (j_compress_ptr cinfo)
|
||||
case JCS_YCCK:
|
||||
jpeg_set_colorspace(cinfo, JCS_YCCK);
|
||||
break;
|
||||
case JCS_UNKNOWN:
|
||||
jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
|
||||
case JCS_BG_RGB:
|
||||
/* 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;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
|
||||
@@ -438,27 +450,40 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
|
||||
cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
|
||||
|
||||
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:
|
||||
cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
|
||||
cinfo->num_components = 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;
|
||||
case JCS_RGB:
|
||||
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
|
||||
cinfo->num_components = 3;
|
||||
SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);
|
||||
SET_COMP(0, 0x52 /* 'R' */, 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, 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);
|
||||
break;
|
||||
case JCS_YCbCr:
|
||||
cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
|
||||
cinfo->num_components = 3;
|
||||
/* JFIF specifies component IDs 1,2,3 */
|
||||
/* We default to 2x2 subsamples of chrominance */
|
||||
SET_COMP(0, 1, 2,2, 0, 0,0);
|
||||
SET_COMP(1, 2, 1,1, 1, 1,1);
|
||||
SET_COMP(2, 3, 1,1, 1, 1,1);
|
||||
SET_COMP(0, 0x01, 2,2, 0, 0,0);
|
||||
SET_COMP(1, 0x02, 1,1, 1, 1,1);
|
||||
SET_COMP(2, 0x03, 1,1, 1, 1,1);
|
||||
break;
|
||||
case JCS_CMYK:
|
||||
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
|
||||
@@ -471,19 +496,33 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
|
||||
case JCS_YCCK:
|
||||
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
|
||||
cinfo->num_components = 4;
|
||||
SET_COMP(0, 1, 2,2, 0, 0,0);
|
||||
SET_COMP(1, 2, 1,1, 1, 1,1);
|
||||
SET_COMP(2, 3, 1,1, 1, 1,1);
|
||||
SET_COMP(3, 4, 2,2, 0, 0,0);
|
||||
SET_COMP(0, 0x01, 2,2, 0, 0,0);
|
||||
SET_COMP(1, 0x02, 1,1, 1, 1,1);
|
||||
SET_COMP(2, 0x03, 1,1, 1, 1,1);
|
||||
SET_COMP(3, 0x04, 2,2, 0, 0,0);
|
||||
break;
|
||||
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);
|
||||
}
|
||||
case JCS_BG_RGB:
|
||||
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 R/G/B component IDs */
|
||||
SET_COMP(0, 0x72 /* 'r' */, 1,1, 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;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
@@ -567,8 +606,10 @@ jpeg_simple_progression (j_compress_ptr cinfo)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
/* Figure space needed for script. Calculation must match code below! */
|
||||
if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||
/* Custom script for YCbCr color images. */
|
||||
if (ncomps == 3 &&
|
||||
(cinfo->jpeg_color_space == JCS_YCbCr ||
|
||||
cinfo->jpeg_color_space == JCS_BG_YCC)) {
|
||||
/* Custom script for YCC color images. */
|
||||
nscans = 10;
|
||||
} else {
|
||||
/* All-purpose script for other color spaces. */
|
||||
@@ -583,7 +624,7 @@ jpeg_simple_progression (j_compress_ptr cinfo)
|
||||
* multiple compressions without changing the settings. To avoid a memory
|
||||
* leak if jpeg_simple_progression is called repeatedly for the same JPEG
|
||||
* 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) {
|
||||
cinfo->script_space_size = MAX(nscans, 10);
|
||||
@@ -595,8 +636,10 @@ jpeg_simple_progression (j_compress_ptr cinfo)
|
||||
cinfo->scan_info = scanptr;
|
||||
cinfo->num_scans = nscans;
|
||||
|
||||
if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||
/* Custom script for YCbCr color images. */
|
||||
if (ncomps == 3 &&
|
||||
(cinfo->jpeg_color_space == JCS_YCbCr ||
|
||||
cinfo->jpeg_color_space == JCS_BG_YCC)) {
|
||||
/* Custom script for YCC color images. */
|
||||
/* Initial DC scan */
|
||||
scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
|
||||
/* Initial AC scan: get some luma data out in a hurry */
|
||||
|
||||
26
jctrans.c
26
jctrans.c
@@ -2,6 +2,7 @@
|
||||
* jctrans.c
|
||||
*
|
||||
* Copyright (C) 1995-1998, Thomas G. Lane.
|
||||
* Modified 2000-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -76,11 +77,18 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
||||
dstinfo->image_height = srcinfo->image_height;
|
||||
dstinfo->input_components = srcinfo->num_components;
|
||||
dstinfo->in_color_space = srcinfo->jpeg_color_space;
|
||||
dstinfo->jpeg_width = srcinfo->output_width;
|
||||
dstinfo->jpeg_height = srcinfo->output_height;
|
||||
dstinfo->min_DCT_h_scaled_size = srcinfo->min_DCT_h_scaled_size;
|
||||
dstinfo->min_DCT_v_scaled_size = srcinfo->min_DCT_v_scaled_size;
|
||||
/* Initialize all parameters to default values */
|
||||
jpeg_set_defaults(dstinfo);
|
||||
/* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
|
||||
* Fix it to get the right header markers for the image colorspace.
|
||||
* Note: Entropy table assignment in jpeg_set_colorspace depends
|
||||
* on color_transform.
|
||||
*/
|
||||
dstinfo->color_transform = srcinfo->color_transform;
|
||||
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
|
||||
dstinfo->data_precision = srcinfo->data_precision;
|
||||
dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
|
||||
@@ -125,7 +133,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
||||
ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
|
||||
}
|
||||
}
|
||||
/* Note: we do not copy the source's Huffman table assignments;
|
||||
/* Note: we do not copy the source's entropy table assignments;
|
||||
* instead we rely on jpeg_set_colorspace to have made a suitable choice.
|
||||
*/
|
||||
}
|
||||
@@ -135,10 +143,10 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
||||
* 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
|
||||
* 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->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_minor_version = srcinfo->JFIF_minor_version;
|
||||
}
|
||||
@@ -158,17 +166,13 @@ LOCAL(void)
|
||||
transencode_master_selection (j_compress_ptr cinfo,
|
||||
jvirt_barray_ptr * coef_arrays)
|
||||
{
|
||||
/* Although we don't actually use input_components for transcoding,
|
||||
* jcmaster.c's initial_setup will complain if input_components is 0.
|
||||
*/
|
||||
cinfo->input_components = 1;
|
||||
/* Initialize master control (includes parameter checking/processing) */
|
||||
jinit_c_master_control(cinfo, TRUE /* transcode only */);
|
||||
|
||||
/* Entropy encoding: either Huffman or arithmetic coding. */
|
||||
if (cinfo->arith_code) {
|
||||
if (cinfo->arith_code)
|
||||
jinit_arith_encoder(cinfo);
|
||||
} else {
|
||||
else {
|
||||
jinit_huff_encoder(cinfo);
|
||||
}
|
||||
|
||||
@@ -363,7 +367,7 @@ transencode_coef_controller (j_compress_ptr cinfo,
|
||||
coef = (my_coef_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_coef_controller));
|
||||
cinfo->coef = (struct jpeg_c_coef_controller *) coef;
|
||||
cinfo->coef = &coef->pub;
|
||||
coef->pub.start_pass = start_pass_coef;
|
||||
coef->pub.compress_data = compress_output;
|
||||
|
||||
@@ -374,7 +378,7 @@ transencode_coef_controller (j_compress_ptr cinfo,
|
||||
buffer = (JBLOCKROW)
|
||||
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
||||
jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
||||
FMEMZERO((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
|
||||
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
|
||||
coef->dummy_buffer[i] = buffer + i;
|
||||
}
|
||||
|
||||
39
jdapimin.c
39
jdapimin.c
@@ -2,7 +2,7 @@
|
||||
* jdapimin.c
|
||||
*
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -114,8 +114,9 @@ jpeg_abort_decompress (j_decompress_ptr cinfo)
|
||||
LOCAL(void)
|
||||
default_decompress_parms (j_decompress_ptr cinfo)
|
||||
{
|
||||
int cid0, cid1, cid2;
|
||||
|
||||
/* 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. */
|
||||
switch (cinfo->num_components) {
|
||||
case 1:
|
||||
@@ -124,9 +125,22 @@ default_decompress_parms (j_decompress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (cinfo->saw_JFIF_marker) {
|
||||
cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
|
||||
} else if (cinfo->saw_Adobe_marker) {
|
||||
cid0 = cinfo->comp_info[0].component_id;
|
||||
cid1 = cinfo->comp_info[1].component_id;
|
||||
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) {
|
||||
case 0:
|
||||
cinfo->jpeg_color_space = JCS_RGB;
|
||||
@@ -140,20 +154,9 @@ default_decompress_parms (j_decompress_ptr cinfo)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Saw no special markers, try to guess from the component IDs */
|
||||
int cid0 = cinfo->comp_info[0].component_id;
|
||||
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. */
|
||||
cinfo->out_color_space = JCS_RGB;
|
||||
break;
|
||||
@@ -186,8 +189,8 @@ default_decompress_parms (j_decompress_ptr cinfo)
|
||||
}
|
||||
|
||||
/* Set defaults for other decompression parameters. */
|
||||
cinfo->scale_num = DCTSIZE; /* 1:1 scaling */
|
||||
cinfo->scale_denom = DCTSIZE;
|
||||
cinfo->scale_num = cinfo->block_size; /* 1:1 scaling */
|
||||
cinfo->scale_denom = cinfo->block_size;
|
||||
cinfo->output_gamma = 1.0;
|
||||
cinfo->buffered_image = FALSE;
|
||||
cinfo->raw_data_out = FALSE;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jdapistd.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
|
||||
140
jdarith.c
140
jdarith.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jdarith.c
|
||||
*
|
||||
* Developed 1997 by Guido Vollbeding.
|
||||
* Developed 1997-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -37,6 +37,9 @@ typedef struct {
|
||||
/* Pointers to statistics areas (these workspaces have image lifespan) */
|
||||
unsigned char * dc_stats[NUM_ARITH_TBLS];
|
||||
unsigned char * ac_stats[NUM_ARITH_TBLS];
|
||||
|
||||
/* Statistics bin for coding with fixed probability 0.5 */
|
||||
unsigned char fixed_bin[4];
|
||||
} arith_entropy_decoder;
|
||||
|
||||
typedef arith_entropy_decoder * arith_entropy_ptr;
|
||||
@@ -45,8 +48,6 @@ typedef arith_entropy_decoder * arith_entropy_ptr;
|
||||
* for the statistics area.
|
||||
* According to sections F.1.4.4.1.3 and F.1.4.4.2, we need at least
|
||||
* 49 statistics bins for DC, and 245 statistics bins for AC coding.
|
||||
* Note that we use one additional AC bin for codings with fixed
|
||||
* probability (0.5), thus the minimum number for AC is 246.
|
||||
*
|
||||
* We use a compact representation with 1 byte per statistics bin,
|
||||
* thus the numbers directly represent byte sizes.
|
||||
@@ -93,7 +94,7 @@ get_byte (j_decompress_ptr cinfo)
|
||||
* (instead of fixed) with the bit shift counter CT.
|
||||
* Thus, we also need only one (variable instead of
|
||||
* 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).
|
||||
*
|
||||
* I've also introduced a new scheme for accessing
|
||||
@@ -104,7 +105,6 @@ get_byte (j_decompress_ptr cinfo)
|
||||
LOCAL(int)
|
||||
arith_decode (j_decompress_ptr cinfo, unsigned char *st)
|
||||
{
|
||||
extern const INT32 jaritab[];
|
||||
register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
|
||||
register unsigned char nl, nm;
|
||||
register INT32 qe, temp;
|
||||
@@ -145,11 +145,11 @@ arith_decode (j_decompress_ptr cinfo, unsigned char *st)
|
||||
e->a <<= 1;
|
||||
}
|
||||
|
||||
/* Fetch values from our compact representation of Table D.2:
|
||||
/* Fetch values from our compact representation of Table D.3(D.2):
|
||||
* Qe values and probability estimation state machine
|
||||
*/
|
||||
sv = *st;
|
||||
qe = jaritab[sv & 0x7F]; /* => Qe_Value */
|
||||
qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */
|
||||
nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */
|
||||
nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */
|
||||
|
||||
@@ -197,16 +197,17 @@ process_restart (j_decompress_ptr cinfo)
|
||||
if (! (*cinfo->marker->read_restart_marker) (cinfo))
|
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||
|
||||
/* Re-initialize statistics areas */
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
/* Re-initialize statistics areas */
|
||||
if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
|
||||
if (! cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
|
||||
MEMZERO(entropy->dc_stats[compptr->dc_tbl_no], DC_STAT_BINS);
|
||||
/* Reset DC predictions to 0 */
|
||||
entropy->last_dc_val[ci] = 0;
|
||||
entropy->dc_context[ci] = 0;
|
||||
}
|
||||
if (cinfo->progressive_mode == 0 || cinfo->Ss) {
|
||||
if ((! cinfo->progressive_mode && cinfo->lim_Se) ||
|
||||
(cinfo->progressive_mode && cinfo->Ss)) {
|
||||
MEMZERO(entropy->ac_stats[compptr->ac_tbl_no], AC_STAT_BINS);
|
||||
}
|
||||
}
|
||||
@@ -288,9 +289,9 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
}
|
||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
||||
if (m < (int) (((INT32) 1 << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
entropy->dc_context[ci] = 0; /* zero diff category */
|
||||
else if (m > (int) (((INT32) 1 << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
|
||||
else
|
||||
entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */
|
||||
@@ -324,6 +325,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
unsigned char *st;
|
||||
int tbl, sign, k;
|
||||
int v, m;
|
||||
const int * natural_order;
|
||||
|
||||
/* Process restart marker if needed */
|
||||
if (cinfo->restart_interval) {
|
||||
@@ -334,6 +336,8 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
if (entropy->ct == -1) return TRUE; /* if error do nothing */
|
||||
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* There is always only one block per MCU */
|
||||
block = MCU_data[0];
|
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
|
||||
@@ -341,12 +345,15 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
|
||||
|
||||
/* Figure F.20: Decode_AC_coefficients */
|
||||
for (k = cinfo->Ss; k <= cinfo->Se; k++) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
k = cinfo->Ss - 1;
|
||||
do {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
if (arith_decode(cinfo, st)) break; /* EOB flag */
|
||||
while (arith_decode(cinfo, st + 1) == 0) {
|
||||
st += 3; k++;
|
||||
if (k > cinfo->Se) {
|
||||
for (;;) {
|
||||
k++;
|
||||
if (arith_decode(cinfo, st + 1)) break;
|
||||
st += 3;
|
||||
if (k >= cinfo->Se) {
|
||||
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
|
||||
entropy->ct = -1; /* spectral overflow */
|
||||
return TRUE;
|
||||
@@ -354,8 +361,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
/* Figure F.21: Decoding nonzero value v */
|
||||
/* Figure F.22: Decoding the sign of v */
|
||||
entropy->ac_stats[tbl][245] = 0;
|
||||
sign = arith_decode(cinfo, entropy->ac_stats[tbl] + 245);
|
||||
sign = arith_decode(cinfo, entropy->fixed_bin);
|
||||
st += 2;
|
||||
/* Figure F.23: Decoding the magnitude category of v */
|
||||
if ((m = arith_decode(cinfo, st)) != 0) {
|
||||
@@ -380,8 +386,8 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if (arith_decode(cinfo, st)) v |= m;
|
||||
v += 1; if (sign) v = -v;
|
||||
/* Scale and output coefficient in natural (dezigzagged) order */
|
||||
(*block)[jpeg_natural_order[k]] = (JCOEF) (v << cinfo->Al);
|
||||
}
|
||||
(*block)[natural_order[k]] = (JCOEF) (v << cinfo->Al);
|
||||
} while (k < cinfo->Se);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -389,13 +395,15 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/*
|
||||
* 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)
|
||||
decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
||||
unsigned char st[4];
|
||||
unsigned char *st;
|
||||
int p1, blkn;
|
||||
|
||||
/* Process restart marker if needed */
|
||||
@@ -405,12 +413,12 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
entropy->restarts_to_go--;
|
||||
}
|
||||
|
||||
st = entropy->fixed_bin; /* use fixed probability estimation */
|
||||
p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
|
||||
/* Outer loop handles each block in the MCU */
|
||||
|
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||
st[0] = 0; /* use fixed probability estimation */
|
||||
/* Encoded data is simply the next bit of the two's-complement DC value */
|
||||
if (arith_decode(cinfo, st))
|
||||
MCU_data[blkn][0][0] |= p1;
|
||||
@@ -433,6 +441,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
unsigned char *st;
|
||||
int tbl, k, kex;
|
||||
int p1, m1;
|
||||
const int * natural_order;
|
||||
|
||||
/* Process restart marker if needed */
|
||||
if (cinfo->restart_interval) {
|
||||
@@ -443,6 +452,8 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
if (entropy->ct == -1) return TRUE; /* if error do nothing */
|
||||
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* There is always only one block per MCU */
|
||||
block = MCU_data[0];
|
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
|
||||
@@ -451,15 +462,18 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
|
||||
|
||||
/* Establish EOBx (previous stage end-of-block) index */
|
||||
for (kex = cinfo->Se + 1; kex > 1; kex--)
|
||||
if ((*block)[jpeg_natural_order[kex - 1]]) break;
|
||||
kex = cinfo->Se;
|
||||
do {
|
||||
if ((*block)[natural_order[kex]]) break;
|
||||
} while (--kex);
|
||||
|
||||
for (k = cinfo->Ss; k <= cinfo->Se; k++) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
k = cinfo->Ss - 1;
|
||||
do {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
if (k >= kex)
|
||||
if (arith_decode(cinfo, st)) break; /* EOB flag */
|
||||
for (;;) {
|
||||
thiscoef = *block + jpeg_natural_order[k];
|
||||
thiscoef = *block + natural_order[++k];
|
||||
if (*thiscoef) { /* previously nonzero coef */
|
||||
if (arith_decode(cinfo, st + 2)) {
|
||||
if (*thiscoef < 0)
|
||||
@@ -470,21 +484,20 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
break;
|
||||
}
|
||||
if (arith_decode(cinfo, st + 1)) { /* newly nonzero coef */
|
||||
entropy->ac_stats[tbl][245] = 0;
|
||||
if (arith_decode(cinfo, entropy->ac_stats[tbl] + 245))
|
||||
if (arith_decode(cinfo, entropy->fixed_bin))
|
||||
*thiscoef = m1;
|
||||
else
|
||||
*thiscoef = p1;
|
||||
break;
|
||||
}
|
||||
st += 3; k++;
|
||||
if (k > cinfo->Se) {
|
||||
st += 3;
|
||||
if (k >= cinfo->Se) {
|
||||
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
|
||||
entropy->ct = -1; /* spectral overflow */
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (k < cinfo->Se);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -503,6 +516,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
unsigned char *st;
|
||||
int blkn, ci, tbl, sign, k;
|
||||
int v, m;
|
||||
const int * natural_order;
|
||||
|
||||
/* Process restart marker if needed */
|
||||
if (cinfo->restart_interval) {
|
||||
@@ -513,6 +527,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
if (entropy->ct == -1) return TRUE; /* if error do nothing */
|
||||
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Outer loop handles each block in the MCU */
|
||||
|
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||
@@ -548,9 +564,9 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
}
|
||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
|
||||
if (m < (int) (((INT32) 1 << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
|
||||
entropy->dc_context[ci] = 0; /* zero diff category */
|
||||
else if (m > (int) (((INT32) 1 << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
|
||||
entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
|
||||
else
|
||||
entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */
|
||||
@@ -567,15 +583,19 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
|
||||
|
||||
if (cinfo->lim_Se == 0) continue;
|
||||
tbl = compptr->ac_tbl_no;
|
||||
k = 0;
|
||||
|
||||
/* Figure F.20: Decode_AC_coefficients */
|
||||
for (k = 1; k < DCTSIZE2; k++) {
|
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1);
|
||||
do {
|
||||
st = entropy->ac_stats[tbl] + 3 * k;
|
||||
if (arith_decode(cinfo, st)) break; /* EOB flag */
|
||||
while (arith_decode(cinfo, st + 1) == 0) {
|
||||
st += 3; k++;
|
||||
if (k >= DCTSIZE2) {
|
||||
for (;;) {
|
||||
k++;
|
||||
if (arith_decode(cinfo, st + 1)) break;
|
||||
st += 3;
|
||||
if (k >= cinfo->lim_Se) {
|
||||
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
|
||||
entropy->ct = -1; /* spectral overflow */
|
||||
return TRUE;
|
||||
@@ -583,8 +603,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
/* Figure F.21: Decoding nonzero value v */
|
||||
/* Figure F.22: Decoding the sign of v */
|
||||
entropy->ac_stats[tbl][245] = 0;
|
||||
sign = arith_decode(cinfo, entropy->ac_stats[tbl] + 245);
|
||||
sign = arith_decode(cinfo, entropy->fixed_bin);
|
||||
st += 2;
|
||||
/* Figure F.23: Decoding the magnitude category of v */
|
||||
if ((m = arith_decode(cinfo, st)) != 0) {
|
||||
@@ -608,8 +627,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
while (m >>= 1)
|
||||
if (arith_decode(cinfo, st)) v |= m;
|
||||
v += 1; if (sign) v = -v;
|
||||
(*block)[jpeg_natural_order[k]] = (JCOEF) v;
|
||||
}
|
||||
(*block)[natural_order[k]] = (JCOEF) v;
|
||||
} while (k < cinfo->lim_Se);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -634,7 +653,7 @@ start_pass (j_decompress_ptr cinfo)
|
||||
goto bad;
|
||||
} else {
|
||||
/* need not check Ss/Se < 0 since they came from unsigned bytes */
|
||||
if (cinfo->Se < cinfo->Ss || cinfo->Se >= DCTSIZE2)
|
||||
if (cinfo->Se < cinfo->Ss || cinfo->Se > cinfo->lim_Se)
|
||||
goto bad;
|
||||
/* AC scans may have only one component */
|
||||
if (cinfo->comps_in_scan != 1)
|
||||
@@ -680,20 +699,19 @@ start_pass (j_decompress_ptr cinfo)
|
||||
}
|
||||
} else {
|
||||
/* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
|
||||
* This ought to be an error condition, but we make it a warning because
|
||||
* there are some baseline files out there with all zeroes in these bytes.
|
||||
* This ought to be an error condition, but we make it a warning.
|
||||
*/
|
||||
if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
|
||||
cinfo->Ah != 0 || cinfo->Al != 0)
|
||||
if (cinfo->Ss != 0 || cinfo->Ah != 0 || cinfo->Al != 0 ||
|
||||
(cinfo->Se < DCTSIZE2 && cinfo->Se != cinfo->lim_Se))
|
||||
WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
|
||||
/* Select MCU decoding routine */
|
||||
entropy->pub.decode_mcu = decode_mcu;
|
||||
}
|
||||
|
||||
/* Allocate & initialize requested statistics areas */
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
/* Allocate & initialize requested statistics areas */
|
||||
if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
|
||||
if (! cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
|
||||
tbl = compptr->dc_tbl_no;
|
||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
||||
@@ -705,7 +723,8 @@ start_pass (j_decompress_ptr cinfo)
|
||||
entropy->last_dc_val[ci] = 0;
|
||||
entropy->dc_context[ci] = 0;
|
||||
}
|
||||
if (cinfo->progressive_mode == 0 || cinfo->Ss) {
|
||||
if ((! cinfo->progressive_mode && cinfo->lim_Se) ||
|
||||
(cinfo->progressive_mode && cinfo->Ss)) {
|
||||
tbl = compptr->ac_tbl_no;
|
||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
|
||||
@@ -726,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.
|
||||
*/
|
||||
@@ -739,8 +769,9 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
|
||||
entropy = (arith_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(arith_entropy_decoder));
|
||||
cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass;
|
||||
entropy->pub.finish_pass = finish_pass;
|
||||
|
||||
/* Mark tables unallocated */
|
||||
for (i = 0; i < NUM_ARITH_TBLS; i++) {
|
||||
@@ -748,6 +779,9 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
|
||||
entropy->ac_stats[i] = NULL;
|
||||
}
|
||||
|
||||
/* Initialize index for fixed probability estimation */
|
||||
entropy->fixed_bin[0] = 113;
|
||||
|
||||
if (cinfo->progressive_mode) {
|
||||
/* Create progression status table */
|
||||
int *coef_bit_ptr, ci;
|
||||
|
||||
125
jdatadst.c
125
jdatadst.c
@@ -2,13 +2,14 @@
|
||||
* jdatadst.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2012 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains compression data destination routines for the case of
|
||||
* emitting JPEG data to a file (or any stdio stream). While these routines
|
||||
* are sufficient for most applications, some will want to use a different
|
||||
* destination manager.
|
||||
* emitting JPEG data to memory or to a file (or any stdio stream).
|
||||
* While these routines are sufficient for most applications,
|
||||
* some will want to use a different destination manager.
|
||||
* IMPORTANT: we assume that fwrite() will correctly transcribe an array of
|
||||
* JOCTETs into 8-bit-wide elements on external storage. If char is wider
|
||||
* than 8 bits on your machine, you may need to do some tweaking.
|
||||
@@ -19,6 +20,11 @@
|
||||
#include "jpeglib.h"
|
||||
#include "jerror.h"
|
||||
|
||||
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
|
||||
extern void * malloc JPP((size_t size));
|
||||
extern void free JPP((void *ptr));
|
||||
#endif
|
||||
|
||||
|
||||
/* Expanded data destination object for stdio output */
|
||||
|
||||
@@ -34,6 +40,21 @@ typedef my_destination_mgr * my_dest_ptr;
|
||||
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
|
||||
|
||||
|
||||
/* Expanded data destination object for memory output */
|
||||
|
||||
typedef struct {
|
||||
struct jpeg_destination_mgr pub; /* public fields */
|
||||
|
||||
unsigned char ** outbuffer; /* target buffer */
|
||||
unsigned long * outsize;
|
||||
unsigned char * newbuffer; /* newly allocated buffer */
|
||||
JOCTET * buffer; /* start of buffer */
|
||||
size_t bufsize;
|
||||
} my_mem_destination_mgr;
|
||||
|
||||
typedef my_mem_destination_mgr * my_mem_dest_ptr;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize destination --- called by jpeg_start_compress
|
||||
* before any data is actually written.
|
||||
@@ -53,6 +74,12 @@ init_destination (j_compress_ptr cinfo)
|
||||
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
|
||||
}
|
||||
|
||||
METHODDEF(void)
|
||||
init_mem_destination (j_compress_ptr cinfo)
|
||||
{
|
||||
/* no work necessary here */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Empty the output buffer --- called whenever buffer fills up.
|
||||
@@ -92,6 +119,36 @@ empty_output_buffer (j_compress_ptr cinfo)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHODDEF(boolean)
|
||||
empty_mem_output_buffer (j_compress_ptr cinfo)
|
||||
{
|
||||
size_t nextsize;
|
||||
JOCTET * nextbuffer;
|
||||
my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
|
||||
|
||||
/* Try to allocate new buffer with double size */
|
||||
nextsize = dest->bufsize * 2;
|
||||
nextbuffer = (JOCTET *) malloc(nextsize);
|
||||
|
||||
if (nextbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
|
||||
MEMCOPY(nextbuffer, dest->buffer, dest->bufsize);
|
||||
|
||||
if (dest->newbuffer != NULL)
|
||||
free(dest->newbuffer);
|
||||
|
||||
dest->newbuffer = nextbuffer;
|
||||
|
||||
dest->pub.next_output_byte = nextbuffer + dest->bufsize;
|
||||
dest->pub.free_in_buffer = dest->bufsize;
|
||||
|
||||
dest->buffer = nextbuffer;
|
||||
dest->bufsize = nextsize;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Terminate destination --- called by jpeg_finish_compress
|
||||
@@ -119,6 +176,15 @@ term_destination (j_compress_ptr cinfo)
|
||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||
}
|
||||
|
||||
METHODDEF(void)
|
||||
term_mem_destination (j_compress_ptr cinfo)
|
||||
{
|
||||
my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
|
||||
|
||||
*dest->outbuffer = dest->buffer;
|
||||
*dest->outsize = dest->bufsize - dest->pub.free_in_buffer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prepare for output to a stdio stream.
|
||||
@@ -149,3 +215,56 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
|
||||
dest->pub.term_destination = term_destination;
|
||||
dest->outfile = outfile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prepare for output to a memory buffer.
|
||||
* The caller may supply an own initial buffer with appropriate size.
|
||||
* Otherwise, or when the actual data output exceeds the given size,
|
||||
* the library adapts the buffer size as necessary.
|
||||
* The standard library functions malloc/free are used for allocating
|
||||
* larger memory, so the buffer is available to the application after
|
||||
* finishing compression, and then the application is responsible for
|
||||
* freeing the requested memory.
|
||||
* Note: An initial buffer supplied by the caller is expected to be
|
||||
* managed by the application. The library does not free such buffer
|
||||
* when allocating a larger buffer.
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
jpeg_mem_dest (j_compress_ptr cinfo,
|
||||
unsigned char ** outbuffer, unsigned long * outsize)
|
||||
{
|
||||
my_mem_dest_ptr dest;
|
||||
|
||||
if (outbuffer == NULL || outsize == NULL) /* sanity check */
|
||||
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
||||
|
||||
/* The destination object is made permanent so that multiple JPEG images
|
||||
* can be written to the same buffer without re-executing jpeg_mem_dest.
|
||||
*/
|
||||
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->dest = (struct jpeg_destination_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(my_mem_destination_mgr));
|
||||
}
|
||||
|
||||
dest = (my_mem_dest_ptr) cinfo->dest;
|
||||
dest->pub.init_destination = init_mem_destination;
|
||||
dest->pub.empty_output_buffer = empty_mem_output_buffer;
|
||||
dest->pub.term_destination = term_mem_destination;
|
||||
dest->outbuffer = outbuffer;
|
||||
dest->outsize = outsize;
|
||||
dest->newbuffer = NULL;
|
||||
|
||||
if (*outbuffer == NULL || *outsize == 0) {
|
||||
/* Allocate initial buffer */
|
||||
dest->newbuffer = *outbuffer = (unsigned char *) malloc(OUTPUT_BUF_SIZE);
|
||||
if (dest->newbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
*outsize = OUTPUT_BUF_SIZE;
|
||||
}
|
||||
|
||||
dest->pub.next_output_byte = dest->buffer = *outbuffer;
|
||||
dest->pub.free_in_buffer = dest->bufsize = *outsize;
|
||||
}
|
||||
|
||||
81
jdatasrc.c
81
jdatasrc.c
@@ -2,13 +2,14 @@
|
||||
* jdatasrc.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains decompression data source routines for the case of
|
||||
* reading JPEG data from a file (or any stdio stream). While these routines
|
||||
* are sufficient for most applications, some will want to use a different
|
||||
* source manager.
|
||||
* reading JPEG data from memory or from a file (or any stdio stream).
|
||||
* While these routines are sufficient for most applications,
|
||||
* some will want to use a different source manager.
|
||||
* IMPORTANT: we assume that fread() will correctly transcribe an array of
|
||||
* JOCTETs from 8-bit-wide elements on external storage. If char is wider
|
||||
* than 8 bits on your machine, you may need to do some tweaking.
|
||||
@@ -52,6 +53,12 @@ init_source (j_decompress_ptr cinfo)
|
||||
src->start_of_file = TRUE;
|
||||
}
|
||||
|
||||
METHODDEF(void)
|
||||
init_mem_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
/* no work necessary here */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fill the input buffer --- called whenever buffer is emptied.
|
||||
@@ -111,6 +118,27 @@ fill_input_buffer (j_decompress_ptr cinfo)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHODDEF(boolean)
|
||||
fill_mem_input_buffer (j_decompress_ptr cinfo)
|
||||
{
|
||||
static const JOCTET mybuffer[4] = {
|
||||
(JOCTET) 0xFF, (JOCTET) JPEG_EOI, 0, 0
|
||||
};
|
||||
|
||||
/* The whole JPEG data is expected to reside in the supplied memory
|
||||
* buffer, so any request for more data beyond the given buffer size
|
||||
* is treated as an error.
|
||||
*/
|
||||
WARNMS(cinfo, JWRN_JPEG_EOF);
|
||||
|
||||
/* Insert a fake EOI marker */
|
||||
|
||||
cinfo->src->next_input_byte = mybuffer;
|
||||
cinfo->src->bytes_in_buffer = 2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Skip data --- used to skip over a potentially large amount of
|
||||
@@ -127,22 +155,22 @@ fill_input_buffer (j_decompress_ptr cinfo)
|
||||
METHODDEF(void)
|
||||
skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
{
|
||||
my_src_ptr src = (my_src_ptr) cinfo->src;
|
||||
struct jpeg_source_mgr * src = cinfo->src;
|
||||
|
||||
/* Just a dumb implementation for now. Could use fseek() except
|
||||
* it doesn't work on pipes. Not clear that being smart is worth
|
||||
* any trouble anyway --- large skips are infrequent.
|
||||
*/
|
||||
if (num_bytes > 0) {
|
||||
while (num_bytes > (long) src->pub.bytes_in_buffer) {
|
||||
num_bytes -= (long) src->pub.bytes_in_buffer;
|
||||
(void) fill_input_buffer(cinfo);
|
||||
while (num_bytes > (long) src->bytes_in_buffer) {
|
||||
num_bytes -= (long) src->bytes_in_buffer;
|
||||
(void) (*src->fill_input_buffer) (cinfo);
|
||||
/* note we assume that fill_input_buffer will never return FALSE,
|
||||
* so suspension need not be handled.
|
||||
*/
|
||||
}
|
||||
src->pub.next_input_byte += (size_t) num_bytes;
|
||||
src->pub.bytes_in_buffer -= (size_t) num_bytes;
|
||||
src->next_input_byte += (size_t) num_bytes;
|
||||
src->bytes_in_buffer -= (size_t) num_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,3 +238,38 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
|
||||
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
|
||||
src->pub.next_input_byte = NULL; /* until buffer loaded */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prepare for input from a supplied memory buffer.
|
||||
* The buffer must contain the whole JPEG data.
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
jpeg_mem_src (j_decompress_ptr cinfo,
|
||||
const unsigned char * inbuffer, unsigned long insize)
|
||||
{
|
||||
struct jpeg_source_mgr * src;
|
||||
|
||||
if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */
|
||||
ERREXIT(cinfo, JERR_INPUT_EMPTY);
|
||||
|
||||
/* The source object is made permanent so that a series of JPEG images
|
||||
* can be read from the same buffer by calling jpeg_mem_src only before
|
||||
* the first one.
|
||||
*/
|
||||
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->src = (struct jpeg_source_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(struct jpeg_source_mgr));
|
||||
}
|
||||
|
||||
src = cinfo->src;
|
||||
src->init_source = init_mem_source;
|
||||
src->fill_input_buffer = fill_mem_input_buffer;
|
||||
src->skip_input_data = skip_input_data;
|
||||
src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
|
||||
src->term_source = term_source;
|
||||
src->bytes_in_buffer = (size_t) insize;
|
||||
src->next_input_byte = (const JOCTET *) inbuffer;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jdcoefct.c
|
||||
*
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2002-2011 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -162,7 +163,8 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
||||
for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
|
||||
MCU_col_num++) {
|
||||
/* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
|
||||
jzero_far((void FAR *) coef->MCU_buffer[0],
|
||||
if (cinfo->lim_Se) /* can bypass in DC only case */
|
||||
FMEMZERO((void FAR *) coef->MCU_buffer[0],
|
||||
(size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
|
||||
if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
|
||||
/* Suspension forced; update state counters and exit */
|
||||
@@ -729,6 +731,9 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
|
||||
coef->MCU_buffer[i] = buffer + i;
|
||||
}
|
||||
if (cinfo->lim_Se == 0) /* DC only case: want to bypass later */
|
||||
FMEMZERO((void FAR *) buffer,
|
||||
(size_t) (D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)));
|
||||
coef->pub.consume_data = dummy_consume_data;
|
||||
coef->pub.decompress_data = decompress_onepass;
|
||||
coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
|
||||
|
||||
419
jdcolor.c
419
jdcolor.c
@@ -2,6 +2,7 @@
|
||||
* jdcolor.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2011-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -18,27 +19,57 @@
|
||||
typedef struct {
|
||||
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 * Cb_b_tab; /* => table for Cb to B conversion */
|
||||
INT32 * Cr_g_tab; /* => table for Cr to G conversion */
|
||||
INT32 * Cb_g_tab; /* => table for Cb to G conversion */
|
||||
|
||||
/* Private state for RGB->Y conversion */
|
||||
INT32 * rgb_y_tab; /* => table for RGB to Y conversion */
|
||||
} my_color_deconverter;
|
||||
|
||||
typedef my_color_deconverter * my_cconvert_ptr;
|
||||
|
||||
|
||||
/**************** YCbCr -> RGB conversion: most common case **************/
|
||||
/*************** YCbCr -> RGB conversion: most 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
|
||||
* normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
|
||||
* The conversion equations to be implemented are therefore
|
||||
* R = Y + 1.40200 * Cr
|
||||
* G = Y - 0.34414 * Cb - 0.71414 * Cr
|
||||
* B = Y + 1.77200 * Cb
|
||||
* YCbCr is defined per Recommendation ITU-R BT.601-7 (03/2011),
|
||||
* previously known as Recommendation CCIR 601-1, except that Cb and Cr
|
||||
* 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 + K * (1 - Kr) * Cr
|
||||
* G = Y - K * (Kb * (1 - Kb) * Cb + Kr * (1 - Kr) * Cr) / (1 - Kr - Kb)
|
||||
* B = Y + K * (1 - Kb) * Cb
|
||||
*
|
||||
* 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.
|
||||
* (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
|
||||
* as integers scaled up by 2^16 (about 4 digits precision); we have to divide
|
||||
@@ -49,9 +80,9 @@ typedef my_color_deconverter * my_cconvert_ptr;
|
||||
* 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.
|
||||
* 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
|
||||
* 16-bit samples, but if you want lossless storage you shouldn't be changing
|
||||
* colorspace anyway.
|
||||
* for 9-bit to 12-bit samples it is still acceptable. It's not very
|
||||
* reasonable for 16-bit samples, but if you want lossless storage you
|
||||
* shouldn't be changing colorspace anyway.
|
||||
* 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
|
||||
* together before rounding.
|
||||
@@ -61,13 +92,26 @@ typedef my_color_deconverter * my_cconvert_ptr;
|
||||
#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
|
||||
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
|
||||
|
||||
/* We allocate one big table for RGB->Y conversion and divide it up into
|
||||
* three parts, instead of doing three alloc_small requests. This lets us
|
||||
* use a single table base address, which can be held in a register in the
|
||||
* inner loops on many machines (more than can hold all three addresses,
|
||||
* anyway).
|
||||
*/
|
||||
|
||||
#define R_Y_OFF 0 /* offset to R => Y section */
|
||||
#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
|
||||
#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
|
||||
#define TABLE_SIZE (3*(MAXJSAMPLE+1))
|
||||
|
||||
|
||||
/*
|
||||
* Initialize tables for YCC->RGB colorspace conversion.
|
||||
* Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion.
|
||||
*/
|
||||
|
||||
LOCAL(void)
|
||||
build_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
/* Normal case, sYCC */
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
int i;
|
||||
@@ -90,17 +134,57 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
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 1.40200 * x */
|
||||
/* Cr=>R value is nearest int to 1.402 * x */
|
||||
cconvert->Cr_r_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 1.77200 * x */
|
||||
RIGHT_SHIFT(FIX(1.402) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 1.772 * x */
|
||||
cconvert->Cb_b_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -0.71414 * x */
|
||||
cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
|
||||
/* Cb=>G value is scaled-up -0.34414 * x */
|
||||
RIGHT_SHIFT(FIX(1.772) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -0.714136286 * x */
|
||||
cconvert->Cr_g_tab[i] = (- FIX(0.714136286)) * 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 */
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +229,9 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
|
||||
y = GETJSAMPLE(inptr0[col]);
|
||||
cb = GETJSAMPLE(inptr1[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,
|
||||
* for extended gamut (sYCC) and wide gamut (bg-sYCC) encodings.
|
||||
*/
|
||||
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
|
||||
outptr[RGB_GREEN] = range_limit[y +
|
||||
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
||||
@@ -157,7 +243,182 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
|
||||
}
|
||||
|
||||
|
||||
/**************** Cases other than YCbCr -> RGB **************/
|
||||
/**************** Cases other than YCC -> RGB ****************/
|
||||
|
||||
|
||||
/*
|
||||
* Initialize for RGB->grayscale colorspace conversion.
|
||||
*/
|
||||
|
||||
LOCAL(void)
|
||||
build_rgb_y_table (j_decompress_ptr cinfo)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
INT32 * rgb_y_tab;
|
||||
INT32 i;
|
||||
|
||||
/* Allocate and fill in the conversion tables. */
|
||||
cconvert->rgb_y_tab = rgb_y_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(TABLE_SIZE * SIZEOF(INT32)));
|
||||
|
||||
for (i = 0; i <= MAXJSAMPLE; i++) {
|
||||
rgb_y_tab[i+R_Y_OFF] = FIX(0.299) * i;
|
||||
rgb_y_tab[i+G_Y_OFF] = FIX(0.587) * i;
|
||||
rgb_y_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert RGB to grayscale.
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
rgb_gray_convert (j_decompress_ptr cinfo,
|
||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register INT32 * ctab = cconvert->rgb_y_tab;
|
||||
register int r, g, b;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr0, inptr1, inptr2;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr0 = input_buf[0][input_row];
|
||||
inptr1 = input_buf[1][input_row];
|
||||
inptr2 = input_buf[2][input_row];
|
||||
input_row++;
|
||||
outptr = *output_buf++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = GETJSAMPLE(inptr0[col]);
|
||||
g = GETJSAMPLE(inptr1[col]);
|
||||
b = GETJSAMPLE(inptr2[col]);
|
||||
/* Y */
|
||||
outptr[col] = (JSAMPLE)
|
||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||
>> SCALEBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* [R-G,G,B-G] to [R,G,B] conversion with modulo calculation
|
||||
* (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)
|
||||
rgb1_rgb_convert (j_decompress_ptr cinfo,
|
||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
register int r, g, b;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr0, inptr1, inptr2;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr0 = input_buf[0][input_row];
|
||||
inptr1 = input_buf[1][input_row];
|
||||
inptr2 = input_buf[2][input_row];
|
||||
input_row++;
|
||||
outptr = *output_buf++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = GETJSAMPLE(inptr0[col]);
|
||||
g = GETJSAMPLE(inptr1[col]);
|
||||
b = GETJSAMPLE(inptr2[col]);
|
||||
/* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
|
||||
* (modulo) operator is equivalent to the bitmask operator AND.
|
||||
*/
|
||||
outptr[RGB_RED] = (JSAMPLE) ((r + g - CENTERJSAMPLE) & MAXJSAMPLE);
|
||||
outptr[RGB_GREEN] = (JSAMPLE) g;
|
||||
outptr[RGB_BLUE] = (JSAMPLE) ((b + g - CENTERJSAMPLE) & MAXJSAMPLE);
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* [R-G,G,B-G] to grayscale conversion with modulo calculation
|
||||
* (inverse color transform).
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
rgb1_gray_convert (j_decompress_ptr cinfo,
|
||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register INT32 * ctab = cconvert->rgb_y_tab;
|
||||
register int r, g, b;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr0, inptr1, inptr2;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr0 = input_buf[0][input_row];
|
||||
inptr1 = input_buf[1][input_row];
|
||||
inptr2 = input_buf[2][input_row];
|
||||
input_row++;
|
||||
outptr = *output_buf++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
r = GETJSAMPLE(inptr0[col]);
|
||||
g = GETJSAMPLE(inptr1[col]);
|
||||
b = GETJSAMPLE(inptr2[col]);
|
||||
/* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
|
||||
* (modulo) operator is equivalent to the bitmask operator AND.
|
||||
*/
|
||||
r = (r + g - CENTERJSAMPLE) & MAXJSAMPLE;
|
||||
b = (b + g - CENTERJSAMPLE) & MAXJSAMPLE;
|
||||
/* Y */
|
||||
outptr[col] = (JSAMPLE)
|
||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||
>> SCALEBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* No colorspace change, but conversion from separate-planes
|
||||
* to interleaved representation.
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
rgb_convert (j_decompress_ptr cinfo,
|
||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr0, inptr1, inptr2;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr0 = input_buf[0][input_row];
|
||||
inptr1 = input_buf[1][input_row];
|
||||
inptr2 = input_buf[2][input_row];
|
||||
input_row++;
|
||||
outptr = *output_buf++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
/* We can dispense with GETJSAMPLE() here */
|
||||
outptr[RGB_RED] = inptr0[col];
|
||||
outptr[RGB_GREEN] = inptr1[col];
|
||||
outptr[RGB_BLUE] = inptr2[col];
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -170,19 +431,20 @@ null_convert (j_decompress_ptr cinfo,
|
||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
register JSAMPROW inptr, outptr;
|
||||
register JDIMENSION count;
|
||||
register int num_components = cinfo->num_components;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
int ci;
|
||||
register int nc = cinfo->num_components;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
for (ci = 0; ci < num_components; ci++) {
|
||||
for (ci = 0; ci < nc; ci++) {
|
||||
inptr = input_buf[ci][input_row];
|
||||
outptr = output_buf[0] + ci;
|
||||
for (count = num_cols; count > 0; count--) {
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
*outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */
|
||||
outptr += num_components;
|
||||
outptr += nc;
|
||||
}
|
||||
}
|
||||
input_row++;
|
||||
@@ -193,7 +455,7 @@ null_convert (j_decompress_ptr cinfo,
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -218,7 +480,8 @@ gray_rgb_convert (j_decompress_ptr cinfo,
|
||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
register JSAMPROW inptr, outptr;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
|
||||
@@ -271,7 +534,9 @@ ycck_cmyk_convert (j_decompress_ptr cinfo,
|
||||
y = GETJSAMPLE(inptr0[col]);
|
||||
cb = GETJSAMPLE(inptr1[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[1] = range_limit[MAXJSAMPLE - (y + /* green */
|
||||
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
||||
@@ -309,7 +574,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
cconvert = (my_cconvert_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_color_deconverter));
|
||||
cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;
|
||||
cinfo->cconvert = &cconvert->pub;
|
||||
cconvert->pub.start_pass = start_pass_dcolor;
|
||||
|
||||
/* Make sure num_components agrees with jpeg_color_space */
|
||||
@@ -321,6 +586,8 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
|
||||
case JCS_RGB:
|
||||
case JCS_YCbCr:
|
||||
case JCS_BG_RGB:
|
||||
case JCS_BG_YCC:
|
||||
if (cinfo->num_components != 3)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
break;
|
||||
@@ -337,6 +604,12 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Support color transform only for RGB colorspaces */
|
||||
if (cinfo->color_transform &&
|
||||
cinfo->jpeg_color_space != JCS_RGB &&
|
||||
cinfo->jpeg_color_space != JCS_BG_RGB)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
|
||||
/* Set out_color_components and conversion method based on requested space.
|
||||
* Also clear the component_needed flags for any unused components,
|
||||
* so that earlier pipeline stages can avoid useless computation.
|
||||
@@ -345,38 +618,94 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
switch (cinfo->out_color_space) {
|
||||
case JCS_GRAYSCALE:
|
||||
cinfo->out_color_components = 1;
|
||||
if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
|
||||
cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||
switch (cinfo->jpeg_color_space) {
|
||||
case JCS_GRAYSCALE:
|
||||
case JCS_YCbCr:
|
||||
case JCS_BG_YCC:
|
||||
cconvert->pub.color_convert = grayscale_convert;
|
||||
/* For color->grayscale conversion, only the Y (0) component is needed */
|
||||
for (ci = 1; ci < cinfo->num_components; ci++)
|
||||
cinfo->comp_info[ci].component_needed = FALSE;
|
||||
} else
|
||||
break;
|
||||
case JCS_RGB:
|
||||
switch (cinfo->color_transform) {
|
||||
case JCT_NONE:
|
||||
cconvert->pub.color_convert = rgb_gray_convert;
|
||||
break;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb1_gray_convert;
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
build_rgb_y_table(cinfo);
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
break;
|
||||
|
||||
case JCS_RGB:
|
||||
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;
|
||||
build_ycc_rgb_table(cinfo);
|
||||
} else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
|
||||
cconvert->pub.color_convert = gray_rgb_convert;
|
||||
} else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) {
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
break;
|
||||
case JCS_BG_YCC:
|
||||
cconvert->pub.color_convert = ycc_rgb_convert;
|
||||
build_bg_ycc_rgb_table(cinfo);
|
||||
break;
|
||||
case JCS_RGB:
|
||||
switch (cinfo->color_transform) {
|
||||
case JCT_NONE:
|
||||
cconvert->pub.color_convert = rgb_convert;
|
||||
break;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb1_rgb_convert;
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb1_rgb_convert;
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
} else
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
break;
|
||||
|
||||
case JCS_CMYK:
|
||||
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;
|
||||
build_ycc_rgb_table(cinfo);
|
||||
} else if (cinfo->jpeg_color_space == JCS_CMYK) {
|
||||
break;
|
||||
case JCS_CMYK:
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
} else
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
32
jdct.h
32
jdct.h
@@ -2,6 +2,7 @@
|
||||
* jdct.h
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* 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
|
||||
* 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
|
||||
* to do the combined operations quickly. See the comments with
|
||||
* prepare_range_limit_table (in jdmaster.c) for more info.
|
||||
* to do the combined operations quickly, assuming that MAXJSAMPLE+1
|
||||
* 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_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. */
|
||||
@@ -391,3 +395,23 @@ EXTERN(void) jpeg_idct_1x2
|
||||
#ifndef MULTIPLY16V16 /* default definition */
|
||||
#define MULTIPLY16V16(var1,var2) ((var1) * (var2))
|
||||
#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
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jddctmgr.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -324,6 +325,7 @@ start_pass (j_decompress_ptr cinfo)
|
||||
* coefficients scaled by scalefactor[row]*scalefactor[col], where
|
||||
* scalefactor[0] = 1
|
||||
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
||||
* We apply a further scale factor of 1/8.
|
||||
*/
|
||||
FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;
|
||||
int row, col;
|
||||
@@ -337,7 +339,7 @@ start_pass (j_decompress_ptr cinfo)
|
||||
for (col = 0; col < DCTSIZE; col++) {
|
||||
fmtbl[i] = (FLOAT_MULT_TYPE)
|
||||
((double) qtbl->quantval[i] *
|
||||
aanscalefactor[row] * aanscalefactor[col]);
|
||||
aanscalefactor[row] * aanscalefactor[col] * 0.125);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -366,7 +368,7 @@ jinit_inverse_dct (j_decompress_ptr cinfo)
|
||||
idct = (my_idct_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_idct_controller));
|
||||
cinfo->idct = (struct jpeg_inverse_dct *) idct;
|
||||
cinfo->idct = &idct->pub;
|
||||
idct->pub.start_pass = start_pass;
|
||||
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
|
||||
373
jdhuff.c
373
jdhuff.c
@@ -2,7 +2,7 @@
|
||||
* jdhuff.c
|
||||
*
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -229,6 +229,7 @@ typedef struct {
|
||||
savable_state saved; /* Other state at start of MCU */
|
||||
|
||||
/* These fields are NOT loaded into local working state. */
|
||||
boolean insufficient_data; /* set TRUE after emitting warning */
|
||||
unsigned int restarts_to_go; /* MCUs left in this restart interval */
|
||||
|
||||
/* Following two fields used only in progressive mode */
|
||||
@@ -267,6 +268,51 @@ static const int jpeg_zigzag_order[8][8] = {
|
||||
{ 35, 36, 48, 49, 57, 58, 62, 63 }
|
||||
};
|
||||
|
||||
static const int jpeg_zigzag_order7[7][7] = {
|
||||
{ 0, 1, 5, 6, 14, 15, 27 },
|
||||
{ 2, 4, 7, 13, 16, 26, 28 },
|
||||
{ 3, 8, 12, 17, 25, 29, 38 },
|
||||
{ 9, 11, 18, 24, 30, 37, 39 },
|
||||
{ 10, 19, 23, 31, 36, 40, 45 },
|
||||
{ 20, 22, 32, 35, 41, 44, 46 },
|
||||
{ 21, 33, 34, 42, 43, 47, 48 }
|
||||
};
|
||||
|
||||
static const int jpeg_zigzag_order6[6][6] = {
|
||||
{ 0, 1, 5, 6, 14, 15 },
|
||||
{ 2, 4, 7, 13, 16, 25 },
|
||||
{ 3, 8, 12, 17, 24, 26 },
|
||||
{ 9, 11, 18, 23, 27, 32 },
|
||||
{ 10, 19, 22, 28, 31, 33 },
|
||||
{ 20, 21, 29, 30, 34, 35 }
|
||||
};
|
||||
|
||||
static const int jpeg_zigzag_order5[5][5] = {
|
||||
{ 0, 1, 5, 6, 14 },
|
||||
{ 2, 4, 7, 13, 15 },
|
||||
{ 3, 8, 12, 16, 21 },
|
||||
{ 9, 11, 17, 20, 22 },
|
||||
{ 10, 18, 19, 23, 24 }
|
||||
};
|
||||
|
||||
static const int jpeg_zigzag_order4[4][4] = {
|
||||
{ 0, 1, 5, 6 },
|
||||
{ 2, 4, 7, 12 },
|
||||
{ 3, 8, 11, 13 },
|
||||
{ 9, 10, 14, 15 }
|
||||
};
|
||||
|
||||
static const int jpeg_zigzag_order3[3][3] = {
|
||||
{ 0, 1, 5 },
|
||||
{ 2, 4, 6 },
|
||||
{ 3, 7, 8 }
|
||||
};
|
||||
|
||||
static const int jpeg_zigzag_order2[2][2] = {
|
||||
{ 0, 1 },
|
||||
{ 2, 3 }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Compute the derived values for a Huffman table.
|
||||
@@ -496,9 +542,9 @@ jpeg_fill_bit_buffer (bitread_working_state * state,
|
||||
* We use a nonvolatile flag to ensure that only one warning message
|
||||
* appears per data segment.
|
||||
*/
|
||||
if (! cinfo->entropy->insufficient_data) {
|
||||
if (! ((huff_entropy_ptr) cinfo->entropy)->insufficient_data) {
|
||||
WARNMS(cinfo, JWRN_HIT_MARKER);
|
||||
cinfo->entropy->insufficient_data = TRUE;
|
||||
((huff_entropy_ptr) cinfo->entropy)->insufficient_data = TRUE;
|
||||
}
|
||||
/* Fill the buffer with zero bits */
|
||||
get_buffer <<= MIN_GET_BITS - bits_left;
|
||||
@@ -581,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.
|
||||
* Returns FALSE if must suspend.
|
||||
@@ -592,10 +654,7 @@ process_restart (j_decompress_ptr cinfo)
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int ci;
|
||||
|
||||
/* 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;
|
||||
finish_pass_huff(cinfo);
|
||||
|
||||
/* Advance past the RSTn marker */
|
||||
if (! (*cinfo->marker->read_restart_marker) (cinfo))
|
||||
@@ -616,7 +675,7 @@ process_restart (j_decompress_ptr cinfo)
|
||||
* leaving the flag set.
|
||||
*/
|
||||
if (cinfo->unread_marker == 0)
|
||||
entropy->pub.insufficient_data = FALSE;
|
||||
entropy->insufficient_data = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -668,7 +727,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* If we've run out of data, just leave the MCU set to zeroes.
|
||||
* This way, we return uniform gray for the remainder of the segment.
|
||||
*/
|
||||
if (! entropy->pub.insufficient_data) {
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
@@ -720,10 +779,10 @@ METHODDEF(boolean)
|
||||
decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int Se = cinfo->Se;
|
||||
int Al = cinfo->Al;
|
||||
register int s, k, r;
|
||||
unsigned int EOBRUN;
|
||||
int Se, Al;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
BITREAD_STATE_VARS;
|
||||
d_derived_tbl * tbl;
|
||||
@@ -738,7 +797,11 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* If we've run out of data, just leave the MCU set to zeroes.
|
||||
* This way, we return uniform gray for the remainder of the segment.
|
||||
*/
|
||||
if (! entropy->pub.insufficient_data) {
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
Se = cinfo->Se;
|
||||
Al = cinfo->Al;
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Load up working state.
|
||||
* We can avoid loading/saving bitread state if in an EOB run.
|
||||
@@ -747,7 +810,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/* There is always only one block per MCU */
|
||||
|
||||
if (EOBRUN > 0) /* if it's a band of zeroes... */
|
||||
if (EOBRUN) /* if it's a band of zeroes... */
|
||||
EOBRUN--; /* ...process it now (we do nothing) */
|
||||
else {
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
@@ -764,20 +827,19 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
r = GET_BITS(s);
|
||||
s = HUFF_EXTEND(r, s);
|
||||
/* Scale and output coefficient in natural (dezigzagged) order */
|
||||
(*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al);
|
||||
(*block)[natural_order[k]] = (JCOEF) (s << Al);
|
||||
} else {
|
||||
if (r == 15) { /* ZRL */
|
||||
k += 15; /* skip 15 zeroes in band */
|
||||
} else { /* EOBr, run length is 2^r + appended bits */
|
||||
EOBRUN = 1 << r;
|
||||
if (r != 15) { /* EOBr, run length is 2^r + appended bits */
|
||||
if (r) { /* EOBr, r > 0 */
|
||||
EOBRUN = 1 << r;
|
||||
CHECK_BIT_BUFFER(br_state, r, return FALSE);
|
||||
r = GET_BITS(r);
|
||||
EOBRUN += r;
|
||||
}
|
||||
EOBRUN--; /* this band is processed at this moment */
|
||||
}
|
||||
break; /* force end-of-band */
|
||||
}
|
||||
k += 15; /* ZRL: skip 15 zeroes in band */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,17 +859,15 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* Note: we assume such scans can be multi-component,
|
||||
* although the spec is not very clear on the point.
|
||||
*/
|
||||
|
||||
METHODDEF(boolean)
|
||||
decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
int blkn;
|
||||
JBLOCKROW block;
|
||||
int p1, blkn;
|
||||
BITREAD_STATE_VARS;
|
||||
|
||||
/* Process restart marker if needed; may have to suspend */
|
||||
@@ -824,15 +884,15 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* Load up working state */
|
||||
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 */
|
||||
|
||||
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 */
|
||||
CHECK_BIT_BUFFER(br_state, 1, return FALSE);
|
||||
if (GET_BITS(1))
|
||||
(*block)[0] |= p1;
|
||||
MCU_data[blkn][0][0] |= p1;
|
||||
/* Note: since we use |=, repeating the assignment later is safe */
|
||||
}
|
||||
|
||||
@@ -854,11 +914,10 @@ METHODDEF(boolean)
|
||||
decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int Se = cinfo->Se;
|
||||
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
|
||||
register int s, k, r;
|
||||
unsigned int EOBRUN;
|
||||
int Se, p1, m1;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
JCOEFPTR thiscoef;
|
||||
BITREAD_STATE_VARS;
|
||||
@@ -875,7 +934,12 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
/* If we've run out of data, don't modify the MCU.
|
||||
*/
|
||||
if (! entropy->pub.insufficient_data) {
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
Se = cinfo->Se;
|
||||
p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
@@ -897,7 +961,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
k = cinfo->Ss;
|
||||
|
||||
if (EOBRUN == 0) {
|
||||
for (; k <= Se; k++) {
|
||||
do {
|
||||
HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
|
||||
r = s >> 4;
|
||||
s &= 15;
|
||||
@@ -926,8 +990,8 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
* if the absolute value of the coefficient must be increased.
|
||||
*/
|
||||
do {
|
||||
thiscoef = *block + jpeg_natural_order[k];
|
||||
if (*thiscoef != 0) {
|
||||
thiscoef = *block + natural_order[k];
|
||||
if (*thiscoef) {
|
||||
CHECK_BIT_BUFFER(br_state, 1, goto undoit);
|
||||
if (GET_BITS(1)) {
|
||||
if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
|
||||
@@ -944,24 +1008,25 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
k++;
|
||||
} while (k <= Se);
|
||||
if (s) {
|
||||
int pos = jpeg_natural_order[k];
|
||||
int pos = natural_order[k];
|
||||
/* Output newly nonzero coefficient */
|
||||
(*block)[pos] = (JCOEF) s;
|
||||
/* Remember its position in case we have to suspend */
|
||||
newnz_pos[num_newnz++] = pos;
|
||||
}
|
||||
}
|
||||
k++;
|
||||
} while (k <= Se);
|
||||
}
|
||||
|
||||
if (EOBRUN > 0) {
|
||||
if (EOBRUN) {
|
||||
/* Scan any remaining coefficient positions after the end-of-band
|
||||
* (the last newly nonzero coefficient, if any). Append a correction
|
||||
* bit to each already-nonzero coefficient. A correction bit is 1
|
||||
* if the absolute value of the coefficient must be increased.
|
||||
*/
|
||||
for (; k <= Se; k++) {
|
||||
thiscoef = *block + jpeg_natural_order[k];
|
||||
if (*thiscoef != 0) {
|
||||
do {
|
||||
thiscoef = *block + natural_order[k];
|
||||
if (*thiscoef) {
|
||||
CHECK_BIT_BUFFER(br_state, 1, goto undoit);
|
||||
if (GET_BITS(1)) {
|
||||
if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
|
||||
@@ -972,7 +1037,8 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
k++;
|
||||
} while (k <= Se);
|
||||
/* Count one block completed in EOB run */
|
||||
EOBRUN--;
|
||||
}
|
||||
@@ -989,7 +1055,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
undoit:
|
||||
/* Re-zero any output coefficients that we made newly nonzero */
|
||||
while (num_newnz > 0)
|
||||
while (num_newnz)
|
||||
(*block)[newnz_pos[--num_newnz]] = 0;
|
||||
|
||||
return FALSE;
|
||||
@@ -997,7 +1063,136 @@ undoit:
|
||||
|
||||
|
||||
/*
|
||||
* Decode one MCU's worth of Huffman-compressed coefficients.
|
||||
* Decode one MCU's worth of Huffman-compressed coefficients,
|
||||
* partial blocks.
|
||||
*/
|
||||
|
||||
METHODDEF(boolean)
|
||||
decode_mcu_sub (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
const int * natural_order;
|
||||
int Se, blkn;
|
||||
BITREAD_STATE_VARS;
|
||||
savable_state state;
|
||||
|
||||
/* Process restart marker if needed; may have to suspend */
|
||||
if (cinfo->restart_interval) {
|
||||
if (entropy->restarts_to_go == 0)
|
||||
if (! process_restart(cinfo))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If we've run out of data, just leave the MCU set to zeroes.
|
||||
* This way, we return uniform gray for the remainder of the segment.
|
||||
*/
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
natural_order = cinfo->natural_order;
|
||||
Se = cinfo->lim_Se;
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
ASSIGN_STATE(state, entropy->saved);
|
||||
|
||||
/* Outer loop handles each block in the MCU */
|
||||
|
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
|
||||
JBLOCKROW block = MCU_data[blkn];
|
||||
d_derived_tbl * htbl;
|
||||
register int s, k, r;
|
||||
int coef_limit, ci;
|
||||
|
||||
/* Decode a single block's worth of coefficients */
|
||||
|
||||
/* Section F.2.2.1: decode the DC coefficient difference */
|
||||
htbl = entropy->dc_cur_tbls[blkn];
|
||||
HUFF_DECODE(s, br_state, htbl, return FALSE, label1);
|
||||
|
||||
htbl = entropy->ac_cur_tbls[blkn];
|
||||
k = 1;
|
||||
coef_limit = entropy->coef_limit[blkn];
|
||||
if (coef_limit) {
|
||||
/* Convert DC difference to actual value, update last_dc_val */
|
||||
if (s) {
|
||||
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
||||
r = GET_BITS(s);
|
||||
s = HUFF_EXTEND(r, s);
|
||||
}
|
||||
ci = cinfo->MCU_membership[blkn];
|
||||
s += state.last_dc_val[ci];
|
||||
state.last_dc_val[ci] = s;
|
||||
/* Output the DC coefficient */
|
||||
(*block)[0] = (JCOEF) s;
|
||||
|
||||
/* Section F.2.2.2: decode the AC coefficients */
|
||||
/* Since zeroes are skipped, output area must be cleared beforehand */
|
||||
for (; k < coef_limit; k++) {
|
||||
HUFF_DECODE(s, br_state, htbl, return FALSE, label2);
|
||||
|
||||
r = s >> 4;
|
||||
s &= 15;
|
||||
|
||||
if (s) {
|
||||
k += r;
|
||||
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
||||
r = GET_BITS(s);
|
||||
s = HUFF_EXTEND(r, s);
|
||||
/* Output coefficient in natural (dezigzagged) order.
|
||||
* Note: the extra entries in natural_order[] will save us
|
||||
* if k > Se, which could happen if the data is corrupted.
|
||||
*/
|
||||
(*block)[natural_order[k]] = (JCOEF) s;
|
||||
} else {
|
||||
if (r != 15)
|
||||
goto EndOfBlock;
|
||||
k += 15;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (s) {
|
||||
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
||||
DROP_BITS(s);
|
||||
}
|
||||
}
|
||||
|
||||
/* Section F.2.2.2: decode the AC coefficients */
|
||||
/* In this path we just discard the values */
|
||||
for (; k <= Se; k++) {
|
||||
HUFF_DECODE(s, br_state, htbl, return FALSE, label3);
|
||||
|
||||
r = s >> 4;
|
||||
s &= 15;
|
||||
|
||||
if (s) {
|
||||
k += r;
|
||||
CHECK_BIT_BUFFER(br_state, s, return FALSE);
|
||||
DROP_BITS(s);
|
||||
} else {
|
||||
if (r != 15)
|
||||
break;
|
||||
k += 15;
|
||||
}
|
||||
}
|
||||
|
||||
EndOfBlock: ;
|
||||
}
|
||||
|
||||
/* Completed MCU, so update state */
|
||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||
ASSIGN_STATE(entropy->saved, state);
|
||||
}
|
||||
|
||||
/* Account for restart interval (no-op if not using restarts) */
|
||||
entropy->restarts_to_go--;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Decode one MCU's worth of Huffman-compressed coefficients,
|
||||
* full-size blocks.
|
||||
*/
|
||||
|
||||
METHODDEF(boolean)
|
||||
@@ -1018,7 +1213,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
/* If we've run out of data, just leave the MCU set to zeroes.
|
||||
* This way, we return uniform gray for the remainder of the segment.
|
||||
*/
|
||||
if (! entropy->pub.insufficient_data) {
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
@@ -1127,7 +1322,7 @@ METHODDEF(void)
|
||||
start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int ci, blkn, dctbl, actbl, i;
|
||||
int ci, blkn, tbl, i;
|
||||
jpeg_component_info * compptr;
|
||||
|
||||
if (cinfo->progressive_mode) {
|
||||
@@ -1137,7 +1332,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
goto bad;
|
||||
} else {
|
||||
/* need not check Ss/Se < 0 since they came from unsigned bytes */
|
||||
if (cinfo->Se < cinfo->Ss || cinfo->Se >= DCTSIZE2)
|
||||
if (cinfo->Se < cinfo->Ss || cinfo->Se > cinfo->lim_Se)
|
||||
goto bad;
|
||||
/* AC scans may have only one component */
|
||||
if (cinfo->comps_in_scan != 1)
|
||||
@@ -1196,16 +1391,16 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
*/
|
||||
if (cinfo->Ss == 0) {
|
||||
if (cinfo->Ah == 0) { /* DC refinement needs no table */
|
||||
i = compptr->dc_tbl_no;
|
||||
jpeg_make_d_derived_tbl(cinfo, TRUE, i,
|
||||
& entropy->derived_tbls[i]);
|
||||
tbl = compptr->dc_tbl_no;
|
||||
jpeg_make_d_derived_tbl(cinfo, TRUE, tbl,
|
||||
& entropy->derived_tbls[tbl]);
|
||||
}
|
||||
} else {
|
||||
i = compptr->ac_tbl_no;
|
||||
jpeg_make_d_derived_tbl(cinfo, FALSE, i,
|
||||
& entropy->derived_tbls[i]);
|
||||
tbl = compptr->ac_tbl_no;
|
||||
jpeg_make_d_derived_tbl(cinfo, FALSE, tbl,
|
||||
& entropy->derived_tbls[tbl]);
|
||||
/* remember the single active table */
|
||||
entropy->ac_derived_tbl = entropy->derived_tbls[i];
|
||||
entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
|
||||
}
|
||||
/* Initialize DC predictions to 0 */
|
||||
entropy->saved.last_dc_val[ci] = 0;
|
||||
@@ -1218,23 +1413,35 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
* This ought to be an error condition, but we make it a warning because
|
||||
* there are some baseline files out there with all zeroes in these bytes.
|
||||
*/
|
||||
if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
|
||||
cinfo->Ah != 0 || cinfo->Al != 0)
|
||||
if (cinfo->Ss != 0 || cinfo->Ah != 0 || cinfo->Al != 0 ||
|
||||
((cinfo->is_baseline || cinfo->Se < DCTSIZE2) &&
|
||||
cinfo->Se != cinfo->lim_Se))
|
||||
WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
|
||||
|
||||
/* Select MCU decoding routine */
|
||||
/* We retain the hard-coded case for full-size blocks.
|
||||
* This is not necessary, but it appears that this version is slightly
|
||||
* more performant in the given implementation.
|
||||
* With an improved implementation we would prefer a single optimized
|
||||
* function.
|
||||
*/
|
||||
if (cinfo->lim_Se != DCTSIZE2-1)
|
||||
entropy->pub.decode_mcu = decode_mcu_sub;
|
||||
else
|
||||
entropy->pub.decode_mcu = decode_mcu;
|
||||
|
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
dctbl = compptr->dc_tbl_no;
|
||||
actbl = compptr->ac_tbl_no;
|
||||
/* Compute derived values for Huffman tables */
|
||||
/* We may do this more than once for a table, but it's not expensive */
|
||||
jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
|
||||
& entropy->dc_derived_tbls[dctbl]);
|
||||
jpeg_make_d_derived_tbl(cinfo, FALSE, actbl,
|
||||
& entropy->ac_derived_tbls[actbl]);
|
||||
tbl = compptr->dc_tbl_no;
|
||||
jpeg_make_d_derived_tbl(cinfo, TRUE, tbl,
|
||||
& entropy->dc_derived_tbls[tbl]);
|
||||
if (cinfo->lim_Se) { /* AC needs no table when not present */
|
||||
tbl = compptr->ac_tbl_no;
|
||||
jpeg_make_d_derived_tbl(cinfo, FALSE, tbl,
|
||||
& entropy->ac_derived_tbls[tbl]);
|
||||
}
|
||||
/* Initialize DC predictions to 0 */
|
||||
entropy->saved.last_dc_val[ci] = 0;
|
||||
}
|
||||
@@ -1249,10 +1456,47 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
/* Decide whether we really care about the coefficient values */
|
||||
if (compptr->component_needed) {
|
||||
ci = compptr->DCT_v_scaled_size;
|
||||
if (ci <= 0 || ci > 8) ci = 8;
|
||||
i = compptr->DCT_h_scaled_size;
|
||||
switch (cinfo->lim_Se) {
|
||||
case (1*1-1):
|
||||
entropy->coef_limit[blkn] = 1;
|
||||
break;
|
||||
case (2*2-1):
|
||||
if (ci <= 0 || ci > 2) ci = 2;
|
||||
if (i <= 0 || i > 2) i = 2;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order2[ci - 1][i - 1];
|
||||
break;
|
||||
case (3*3-1):
|
||||
if (ci <= 0 || ci > 3) ci = 3;
|
||||
if (i <= 0 || i > 3) i = 3;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order3[ci - 1][i - 1];
|
||||
break;
|
||||
case (4*4-1):
|
||||
if (ci <= 0 || ci > 4) ci = 4;
|
||||
if (i <= 0 || i > 4) i = 4;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order4[ci - 1][i - 1];
|
||||
break;
|
||||
case (5*5-1):
|
||||
if (ci <= 0 || ci > 5) ci = 5;
|
||||
if (i <= 0 || i > 5) i = 5;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order5[ci - 1][i - 1];
|
||||
break;
|
||||
case (6*6-1):
|
||||
if (ci <= 0 || ci > 6) ci = 6;
|
||||
if (i <= 0 || i > 6) i = 6;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order6[ci - 1][i - 1];
|
||||
break;
|
||||
case (7*7-1):
|
||||
if (ci <= 0 || ci > 7) ci = 7;
|
||||
if (i <= 0 || i > 7) i = 7;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order7[ci - 1][i - 1];
|
||||
break;
|
||||
default:
|
||||
if (ci <= 0 || ci > 8) ci = 8;
|
||||
if (i <= 0 || i > 8) i = 8;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order[ci - 1][i - 1];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
entropy->coef_limit[blkn] = 0;
|
||||
}
|
||||
@@ -1262,7 +1506,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
/* Initialize bitread state variables */
|
||||
entropy->bitstate.bits_left = 0;
|
||||
entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
|
||||
entropy->pub.insufficient_data = FALSE;
|
||||
entropy->insufficient_data = FALSE;
|
||||
|
||||
/* Initialize restart counter */
|
||||
entropy->restarts_to_go = cinfo->restart_interval;
|
||||
@@ -1282,8 +1526,9 @@ jinit_huff_decoder (j_decompress_ptr cinfo)
|
||||
entropy = (huff_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(huff_entropy_decoder));
|
||||
cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass_huff_decoder;
|
||||
entropy->pub.finish_pass = finish_pass_huff;
|
||||
|
||||
if (cinfo->progressive_mode) {
|
||||
/* Create progression status table */
|
||||
|
||||
330
jdinput.c
330
jdinput.c
@@ -2,7 +2,7 @@
|
||||
* jdinput.c
|
||||
*
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
typedef struct {
|
||||
struct jpeg_input_controller pub; /* public fields */
|
||||
|
||||
boolean inheaders; /* TRUE until first SOS is reached */
|
||||
int inheaders; /* Nonzero until first SOS is reached */
|
||||
} my_input_controller;
|
||||
|
||||
typedef my_input_controller * my_inputctl_ptr;
|
||||
@@ -36,6 +36,174 @@ METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo));
|
||||
* Routines to calculate various quantities related to the size of the image.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Compute output image dimensions and related values.
|
||||
* NOTE: this is exported for possible use by application.
|
||||
* Hence it mustn't do anything that can't be done twice.
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
jpeg_core_output_dimensions (j_decompress_ptr cinfo)
|
||||
/* Do computations that are needed before master selection phase.
|
||||
* This function is used for transcoding and full decompression.
|
||||
*/
|
||||
{
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
/* Compute actual output image dimensions and DCT scaling choices. */
|
||||
if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom) {
|
||||
/* Provide 1/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 1;
|
||||
cinfo->min_DCT_v_scaled_size = 1;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 2) {
|
||||
/* Provide 2/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 2L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 2L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 2;
|
||||
cinfo->min_DCT_v_scaled_size = 2;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 3) {
|
||||
/* Provide 3/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 3L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 3L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 3;
|
||||
cinfo->min_DCT_v_scaled_size = 3;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 4) {
|
||||
/* Provide 4/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 4L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 4L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 4;
|
||||
cinfo->min_DCT_v_scaled_size = 4;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 5) {
|
||||
/* Provide 5/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 5L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 5L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 5;
|
||||
cinfo->min_DCT_v_scaled_size = 5;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 6) {
|
||||
/* Provide 6/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 6L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 6L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 6;
|
||||
cinfo->min_DCT_v_scaled_size = 6;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 7) {
|
||||
/* Provide 7/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 7L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 7L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 7;
|
||||
cinfo->min_DCT_v_scaled_size = 7;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 8L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 8L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 8;
|
||||
cinfo->min_DCT_v_scaled_size = 8;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 9) {
|
||||
/* Provide 9/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 9L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 9L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 9;
|
||||
cinfo->min_DCT_v_scaled_size = 9;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 10) {
|
||||
/* Provide 10/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 10L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 10L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 10;
|
||||
cinfo->min_DCT_v_scaled_size = 10;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 11) {
|
||||
/* Provide 11/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 11L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 11L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 11;
|
||||
cinfo->min_DCT_v_scaled_size = 11;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 12) {
|
||||
/* Provide 12/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 12L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 12L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 12;
|
||||
cinfo->min_DCT_v_scaled_size = 12;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 13) {
|
||||
/* Provide 13/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 13L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 13L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 13;
|
||||
cinfo->min_DCT_v_scaled_size = 13;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 14) {
|
||||
/* Provide 14/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 14L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 14L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 14;
|
||||
cinfo->min_DCT_v_scaled_size = 14;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 15) {
|
||||
/* Provide 15/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 15L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 15L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 15;
|
||||
cinfo->min_DCT_v_scaled_size = 15;
|
||||
} else {
|
||||
/* Provide 16/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 16L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 16L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 16;
|
||||
cinfo->min_DCT_v_scaled_size = 16;
|
||||
}
|
||||
|
||||
/* Recompute dimensions of components */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size;
|
||||
compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size;
|
||||
}
|
||||
|
||||
#else /* !IDCT_SCALING_SUPPORTED */
|
||||
|
||||
/* Hardwire it to "no scaling" */
|
||||
cinfo->output_width = cinfo->image_width;
|
||||
cinfo->output_height = cinfo->image_height;
|
||||
/* initial_setup has already initialized DCT_scaled_size,
|
||||
* and has computed unscaled downsampled_width and downsampled_height.
|
||||
*/
|
||||
|
||||
#endif /* IDCT_SCALING_SUPPORTED */
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
initial_setup (j_decompress_ptr cinfo)
|
||||
/* Called once, when first SOS marker is reached */
|
||||
@@ -48,8 +216,8 @@ initial_setup (j_decompress_ptr cinfo)
|
||||
(long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
|
||||
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
|
||||
|
||||
/* For now, precision must match compiled-in value... */
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
/* Only 8 to 12 bits data precision are supported for DCT based JPEG */
|
||||
if (cinfo->data_precision < 8 || cinfo->data_precision > 12)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
|
||||
/* Check that number of components won't exceed internal array sizes */
|
||||
@@ -71,25 +239,121 @@ initial_setup (j_decompress_ptr cinfo)
|
||||
compptr->v_samp_factor);
|
||||
}
|
||||
|
||||
/* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
|
||||
* In the full decompressor, this will be overridden by jdmaster.c;
|
||||
* but in the transcoder, jdmaster.c is not used, so we must do it here.
|
||||
/* Derive block_size, natural_order, and lim_Se */
|
||||
if (cinfo->is_baseline || (cinfo->progressive_mode &&
|
||||
cinfo->comps_in_scan)) { /* no pseudo SOS marker */
|
||||
cinfo->block_size = DCTSIZE;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
} else
|
||||
switch (cinfo->Se) {
|
||||
case (1*1-1):
|
||||
cinfo->block_size = 1;
|
||||
cinfo->natural_order = jpeg_natural_order; /* not needed */
|
||||
cinfo->lim_Se = cinfo->Se;
|
||||
break;
|
||||
case (2*2-1):
|
||||
cinfo->block_size = 2;
|
||||
cinfo->natural_order = jpeg_natural_order2;
|
||||
cinfo->lim_Se = cinfo->Se;
|
||||
break;
|
||||
case (3*3-1):
|
||||
cinfo->block_size = 3;
|
||||
cinfo->natural_order = jpeg_natural_order3;
|
||||
cinfo->lim_Se = cinfo->Se;
|
||||
break;
|
||||
case (4*4-1):
|
||||
cinfo->block_size = 4;
|
||||
cinfo->natural_order = jpeg_natural_order4;
|
||||
cinfo->lim_Se = cinfo->Se;
|
||||
break;
|
||||
case (5*5-1):
|
||||
cinfo->block_size = 5;
|
||||
cinfo->natural_order = jpeg_natural_order5;
|
||||
cinfo->lim_Se = cinfo->Se;
|
||||
break;
|
||||
case (6*6-1):
|
||||
cinfo->block_size = 6;
|
||||
cinfo->natural_order = jpeg_natural_order6;
|
||||
cinfo->lim_Se = cinfo->Se;
|
||||
break;
|
||||
case (7*7-1):
|
||||
cinfo->block_size = 7;
|
||||
cinfo->natural_order = jpeg_natural_order7;
|
||||
cinfo->lim_Se = cinfo->Se;
|
||||
break;
|
||||
case (8*8-1):
|
||||
cinfo->block_size = 8;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (9*9-1):
|
||||
cinfo->block_size = 9;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (10*10-1):
|
||||
cinfo->block_size = 10;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (11*11-1):
|
||||
cinfo->block_size = 11;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (12*12-1):
|
||||
cinfo->block_size = 12;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (13*13-1):
|
||||
cinfo->block_size = 13;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (14*14-1):
|
||||
cinfo->block_size = 14;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (15*15-1):
|
||||
cinfo->block_size = 15;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
case (16*16-1):
|
||||
cinfo->block_size = 16;
|
||||
cinfo->natural_order = jpeg_natural_order;
|
||||
cinfo->lim_Se = DCTSIZE2-1;
|
||||
break;
|
||||
default:
|
||||
ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
|
||||
cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
|
||||
break;
|
||||
}
|
||||
|
||||
/* We initialize DCT_scaled_size and min_DCT_scaled_size to block_size.
|
||||
* In the full decompressor,
|
||||
* this will be overridden by jpeg_calc_output_dimensions in jdmaster.c;
|
||||
* but in the transcoder,
|
||||
* jpeg_calc_output_dimensions is not used, so we must do it here.
|
||||
*/
|
||||
cinfo->min_DCT_h_scaled_size = DCTSIZE;
|
||||
cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
||||
cinfo->min_DCT_h_scaled_size = cinfo->block_size;
|
||||
cinfo->min_DCT_v_scaled_size = cinfo->block_size;
|
||||
|
||||
/* Compute dimensions of components */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
compptr->DCT_h_scaled_size = DCTSIZE;
|
||||
compptr->DCT_v_scaled_size = DCTSIZE;
|
||||
compptr->DCT_h_scaled_size = cinfo->block_size;
|
||||
compptr->DCT_v_scaled_size = cinfo->block_size;
|
||||
/* Size in DCT blocks */
|
||||
compptr->width_in_blocks = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
|
||||
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
||||
(long) (cinfo->max_h_samp_factor * cinfo->block_size));
|
||||
compptr->height_in_blocks = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
|
||||
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
/* downsampled_width and downsampled_height will also be overridden by
|
||||
* jdmaster.c if we are doing full decompression. The transcoder library
|
||||
* doesn't use these values, but the calling application might.
|
||||
@@ -110,7 +374,7 @@ initial_setup (j_decompress_ptr cinfo)
|
||||
/* Compute number of fully interleaved MCU rows. */
|
||||
cinfo->total_iMCU_rows = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height,
|
||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
|
||||
/* Decide whether file contains multiple scans */
|
||||
if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
|
||||
@@ -164,10 +428,10 @@ per_scan_setup (j_decompress_ptr cinfo)
|
||||
/* Overall image size in MCUs */
|
||||
cinfo->MCUs_per_row = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width,
|
||||
(long) (cinfo->max_h_samp_factor*DCTSIZE));
|
||||
(long) (cinfo->max_h_samp_factor * cinfo->block_size));
|
||||
cinfo->MCU_rows_in_scan = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height,
|
||||
(long) (cinfo->max_v_samp_factor*DCTSIZE));
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
|
||||
cinfo->blocks_in_MCU = 0;
|
||||
|
||||
@@ -273,6 +537,7 @@ start_input_pass (j_decompress_ptr cinfo)
|
||||
METHODDEF(void)
|
||||
finish_input_pass (j_decompress_ptr cinfo)
|
||||
{
|
||||
(*cinfo->entropy->finish_pass) (cinfo);
|
||||
cinfo->inputctl->consume_input = consume_markers;
|
||||
}
|
||||
|
||||
@@ -285,6 +550,10 @@ finish_input_pass (j_decompress_ptr cinfo)
|
||||
* The consume_input method pointer points either here or to the
|
||||
* coefficient controller's consume_data routine, depending on whether
|
||||
* we are reading a compressed data segment or inter-segment markers.
|
||||
*
|
||||
* Note: This function should NOT return a pseudo SOS marker (with zero
|
||||
* component number) to the caller. A pseudo marker received by
|
||||
* read_markers is processed and then skipped for other markers.
|
||||
*/
|
||||
|
||||
METHODDEF(int)
|
||||
@@ -296,13 +565,19 @@ consume_markers (j_decompress_ptr cinfo)
|
||||
if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
|
||||
return JPEG_REACHED_EOI;
|
||||
|
||||
for (;;) { /* Loop to pass pseudo SOS marker */
|
||||
val = (*cinfo->marker->read_markers) (cinfo);
|
||||
|
||||
switch (val) {
|
||||
case JPEG_REACHED_SOS: /* Found SOS */
|
||||
if (inputctl->inheaders) { /* 1st SOS */
|
||||
if (inputctl->inheaders == 1)
|
||||
initial_setup(cinfo);
|
||||
inputctl->inheaders = FALSE;
|
||||
if (cinfo->comps_in_scan == 0) { /* pseudo SOS marker */
|
||||
inputctl->inheaders = 2;
|
||||
break;
|
||||
}
|
||||
inputctl->inheaders = 0;
|
||||
/* Note: start_input_pass must be called by jdmaster.c
|
||||
* before any more input can be consumed. jdapimin.c is
|
||||
* responsible for enforcing this sequencing.
|
||||
@@ -310,9 +585,11 @@ consume_markers (j_decompress_ptr cinfo)
|
||||
} else { /* 2nd or later SOS marker */
|
||||
if (! inputctl->pub.has_multiple_scans)
|
||||
ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
|
||||
if (cinfo->comps_in_scan == 0) /* unexpected pseudo SOS marker */
|
||||
break;
|
||||
start_input_pass(cinfo);
|
||||
}
|
||||
break;
|
||||
return val;
|
||||
case JPEG_REACHED_EOI: /* Found EOI */
|
||||
inputctl->pub.eoi_reached = TRUE;
|
||||
if (inputctl->inheaders) { /* Tables-only datastream, apparently */
|
||||
@@ -325,12 +602,13 @@ consume_markers (j_decompress_ptr cinfo)
|
||||
if (cinfo->output_scan_number > cinfo->input_scan_number)
|
||||
cinfo->output_scan_number = cinfo->input_scan_number;
|
||||
}
|
||||
break;
|
||||
case JPEG_SUSPENDED:
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
case JPEG_SUSPENDED:
|
||||
return val;
|
||||
default:
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -346,7 +624,7 @@ reset_input_controller (j_decompress_ptr cinfo)
|
||||
inputctl->pub.consume_input = consume_markers;
|
||||
inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
|
||||
inputctl->pub.eoi_reached = FALSE;
|
||||
inputctl->inheaders = TRUE;
|
||||
inputctl->inheaders = 1;
|
||||
/* Reset other modules */
|
||||
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
|
||||
(*cinfo->marker->reset_marker_reader) (cinfo);
|
||||
@@ -369,7 +647,7 @@ jinit_input_controller (j_decompress_ptr cinfo)
|
||||
inputctl = (my_inputctl_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(my_input_controller));
|
||||
cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
|
||||
cinfo->inputctl = &inputctl->pub;
|
||||
/* Initialize method pointers */
|
||||
inputctl->pub.consume_input = consume_markers;
|
||||
inputctl->pub.reset_input_controller = reset_input_controller;
|
||||
@@ -380,5 +658,5 @@ jinit_input_controller (j_decompress_ptr cinfo)
|
||||
*/
|
||||
inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
|
||||
inputctl->pub.eoi_reached = FALSE;
|
||||
inputctl->inheaders = TRUE;
|
||||
inputctl->inheaders = 1;
|
||||
}
|
||||
|
||||
125
jdmainct.c
125
jdmainct.c
@@ -2,6 +2,7 @@
|
||||
* jdmainct.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2012 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -159,7 +160,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||
* This is done only once, not once per pass.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
int ci, rgroup;
|
||||
int M = cinfo->min_DCT_v_scaled_size;
|
||||
jpeg_component_info *compptr;
|
||||
@@ -168,10 +169,10 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||
/* Get top-level space for component array pointers.
|
||||
* We alloc both arrays with one call to save a few cycles.
|
||||
*/
|
||||
main->xbuffer[0] = (JSAMPIMAGE)
|
||||
mainp->xbuffer[0] = (JSAMPIMAGE)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
|
||||
main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;
|
||||
mainp->xbuffer[1] = mainp->xbuffer[0] + cinfo->num_components;
|
||||
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
@@ -184,9 +185,9 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
|
||||
xbuf += rgroup; /* want one row group at negative offsets */
|
||||
main->xbuffer[0][ci] = xbuf;
|
||||
mainp->xbuffer[0][ci] = xbuf;
|
||||
xbuf += rgroup * (M + 4);
|
||||
main->xbuffer[1][ci] = xbuf;
|
||||
mainp->xbuffer[1][ci] = xbuf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +201,7 @@ make_funny_pointers (j_decompress_ptr cinfo)
|
||||
* This will be repeated at the beginning of each pass.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
int ci, i, rgroup;
|
||||
int M = cinfo->min_DCT_v_scaled_size;
|
||||
jpeg_component_info *compptr;
|
||||
@@ -210,10 +211,10 @@ make_funny_pointers (j_decompress_ptr cinfo)
|
||||
ci++, compptr++) {
|
||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||
xbuf0 = main->xbuffer[0][ci];
|
||||
xbuf1 = main->xbuffer[1][ci];
|
||||
xbuf0 = mainp->xbuffer[0][ci];
|
||||
xbuf1 = mainp->xbuffer[1][ci];
|
||||
/* First copy the workspace pointers as-is */
|
||||
buf = main->buffer[ci];
|
||||
buf = mainp->buffer[ci];
|
||||
for (i = 0; i < rgroup * (M + 2); i++) {
|
||||
xbuf0[i] = xbuf1[i] = buf[i];
|
||||
}
|
||||
@@ -240,7 +241,7 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
|
||||
* This changes the pointer list state from top-of-image to the normal state.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
int ci, i, rgroup;
|
||||
int M = cinfo->min_DCT_v_scaled_size;
|
||||
jpeg_component_info *compptr;
|
||||
@@ -250,8 +251,8 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
|
||||
ci++, compptr++) {
|
||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||
xbuf0 = main->xbuffer[0][ci];
|
||||
xbuf1 = main->xbuffer[1][ci];
|
||||
xbuf0 = mainp->xbuffer[0][ci];
|
||||
xbuf1 = mainp->xbuffer[1][ci];
|
||||
for (i = 0; i < rgroup; i++) {
|
||||
xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
|
||||
xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
|
||||
@@ -269,7 +270,7 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
int ci, i, rgroup, iMCUheight, rows_left;
|
||||
jpeg_component_info *compptr;
|
||||
JSAMPARRAY xbuf;
|
||||
@@ -286,12 +287,12 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||
* so we need only do it once.
|
||||
*/
|
||||
if (ci == 0) {
|
||||
main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
||||
mainp->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
||||
}
|
||||
/* Duplicate the last real sample row rgroup*2 times; this pads out the
|
||||
* last partial rowgroup and ensures at least one full rowgroup of context.
|
||||
*/
|
||||
xbuf = main->xbuffer[main->whichptr][ci];
|
||||
xbuf = mainp->xbuffer[mainp->whichptr][ci];
|
||||
for (i = 0; i < rgroup * 2; i++) {
|
||||
xbuf[rows_left + i] = xbuf[rows_left-1];
|
||||
}
|
||||
@@ -306,27 +307,27 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||
METHODDEF(void)
|
||||
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
|
||||
switch (pass_mode) {
|
||||
case JBUF_PASS_THRU:
|
||||
if (cinfo->upsample->need_context_rows) {
|
||||
main->pub.process_data = process_data_context_main;
|
||||
mainp->pub.process_data = process_data_context_main;
|
||||
make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
|
||||
main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
main->iMCU_row_ctr = 0;
|
||||
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
mainp->iMCU_row_ctr = 0;
|
||||
} else {
|
||||
/* Simple case with no context needed */
|
||||
main->pub.process_data = process_data_simple_main;
|
||||
mainp->pub.process_data = process_data_simple_main;
|
||||
}
|
||||
main->buffer_full = FALSE; /* Mark buffer empty */
|
||||
main->rowgroup_ctr = 0;
|
||||
mainp->buffer_full = FALSE; /* Mark buffer empty */
|
||||
mainp->rowgroup_ctr = 0;
|
||||
break;
|
||||
#ifdef QUANT_2PASS_SUPPORTED
|
||||
case JBUF_CRANK_DEST:
|
||||
/* For last pass of 2-pass quantization, just crank the postprocessor */
|
||||
main->pub.process_data = process_data_crank_post;
|
||||
mainp->pub.process_data = process_data_crank_post;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -346,14 +347,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||
JDIMENSION out_rows_avail)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
JDIMENSION rowgroups_avail;
|
||||
|
||||
/* Read input data if we haven't filled the main buffer yet */
|
||||
if (! main->buffer_full) {
|
||||
if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))
|
||||
if (! mainp->buffer_full) {
|
||||
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
|
||||
return; /* suspension forced, can do nothing more */
|
||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
}
|
||||
|
||||
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
|
||||
@@ -364,14 +365,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||
*/
|
||||
|
||||
/* Feed the postprocessor */
|
||||
(*cinfo->post->post_process_data) (cinfo, main->buffer,
|
||||
&main->rowgroup_ctr, rowgroups_avail,
|
||||
(*cinfo->post->post_process_data) (cinfo, mainp->buffer,
|
||||
&mainp->rowgroup_ctr, rowgroups_avail,
|
||||
output_buf, out_row_ctr, out_rows_avail);
|
||||
|
||||
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
||||
if (main->rowgroup_ctr >= rowgroups_avail) {
|
||||
main->buffer_full = FALSE;
|
||||
main->rowgroup_ctr = 0;
|
||||
if (mainp->rowgroup_ctr >= rowgroups_avail) {
|
||||
mainp->buffer_full = FALSE;
|
||||
mainp->rowgroup_ctr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,15 +387,15 @@ process_data_context_main (j_decompress_ptr cinfo,
|
||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||
JDIMENSION out_rows_avail)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
|
||||
/* Read input data if we haven't filled the main buffer yet */
|
||||
if (! main->buffer_full) {
|
||||
if (! mainp->buffer_full) {
|
||||
if (! (*cinfo->coef->decompress_data) (cinfo,
|
||||
main->xbuffer[main->whichptr]))
|
||||
mainp->xbuffer[mainp->whichptr]))
|
||||
return; /* suspension forced, can do nothing more */
|
||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
main->iMCU_row_ctr++; /* count rows received */
|
||||
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
mainp->iMCU_row_ctr++; /* count rows received */
|
||||
}
|
||||
|
||||
/* Postprocessor typically will not swallow all the input data it is handed
|
||||
@@ -402,47 +403,47 @@ process_data_context_main (j_decompress_ptr cinfo,
|
||||
* to exit and restart. This switch lets us keep track of how far we got.
|
||||
* Note that each case falls through to the next on successful completion.
|
||||
*/
|
||||
switch (main->context_state) {
|
||||
switch (mainp->context_state) {
|
||||
case CTX_POSTPONED_ROW:
|
||||
/* Call postprocessor using previously set pointers for postponed row */
|
||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
||||
(*cinfo->post->post_process_data) (cinfo, mainp->xbuffer[mainp->whichptr],
|
||||
&mainp->rowgroup_ctr, mainp->rowgroups_avail,
|
||||
output_buf, out_row_ctr, out_rows_avail);
|
||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
||||
if (mainp->rowgroup_ctr < mainp->rowgroups_avail)
|
||||
return; /* Need to suspend */
|
||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
if (*out_row_ctr >= out_rows_avail)
|
||||
return; /* Postprocessor exactly filled output buf */
|
||||
/*FALLTHROUGH*/
|
||||
case CTX_PREPARE_FOR_IMCU:
|
||||
/* Prepare to process first M-1 row groups of this iMCU row */
|
||||
main->rowgroup_ctr = 0;
|
||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1);
|
||||
mainp->rowgroup_ctr = 0;
|
||||
mainp->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1);
|
||||
/* Check for bottom of image: if so, tweak pointers to "duplicate"
|
||||
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
|
||||
*/
|
||||
if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
||||
if (mainp->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
||||
set_bottom_pointers(cinfo);
|
||||
main->context_state = CTX_PROCESS_IMCU;
|
||||
mainp->context_state = CTX_PROCESS_IMCU;
|
||||
/*FALLTHROUGH*/
|
||||
case CTX_PROCESS_IMCU:
|
||||
/* Call postprocessor using previously set pointers */
|
||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
||||
(*cinfo->post->post_process_data) (cinfo, mainp->xbuffer[mainp->whichptr],
|
||||
&mainp->rowgroup_ctr, mainp->rowgroups_avail,
|
||||
output_buf, out_row_ctr, out_rows_avail);
|
||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
||||
if (mainp->rowgroup_ctr < mainp->rowgroups_avail)
|
||||
return; /* Need to suspend */
|
||||
/* After the first iMCU, change wraparound pointers to normal state */
|
||||
if (main->iMCU_row_ctr == 1)
|
||||
if (mainp->iMCU_row_ctr == 1)
|
||||
set_wraparound_pointers(cinfo);
|
||||
/* Prepare to load new iMCU row using other xbuffer list */
|
||||
main->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
||||
main->buffer_full = FALSE;
|
||||
mainp->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
||||
mainp->buffer_full = FALSE;
|
||||
/* Still need to process last row group of this iMCU row, */
|
||||
/* which is saved at index M+1 of the other xbuffer */
|
||||
main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1);
|
||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2);
|
||||
main->context_state = CTX_POSTPONED_ROW;
|
||||
mainp->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1);
|
||||
mainp->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2);
|
||||
mainp->context_state = CTX_POSTPONED_ROW;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,15 +476,15 @@ process_data_crank_post (j_decompress_ptr cinfo,
|
||||
GLOBAL(void)
|
||||
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
{
|
||||
my_main_ptr main;
|
||||
my_main_ptr mainp;
|
||||
int ci, rgroup, ngroups;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
main = (my_main_ptr)
|
||||
mainp = (my_main_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_main_controller));
|
||||
cinfo->main = (struct jpeg_d_main_controller *) main;
|
||||
main->pub.start_pass = start_pass_main;
|
||||
cinfo->main = &mainp->pub;
|
||||
mainp->pub.start_pass = start_pass_main;
|
||||
|
||||
if (need_full_buffer) /* shouldn't happen */
|
||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||
@@ -504,9 +505,9 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
ci++, compptr++) {
|
||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
mainp->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||
compptr->width_in_blocks * ((JDIMENSION) compptr->DCT_h_scaled_size),
|
||||
(JDIMENSION) (rgroup * ngroups));
|
||||
}
|
||||
}
|
||||
|
||||
207
jdmarker.c
207
jdmarker.c
@@ -2,6 +2,7 @@
|
||||
* jdmarker.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2009-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -76,6 +77,7 @@ typedef enum { /* JPEG marker codes */
|
||||
M_APP15 = 0xef,
|
||||
|
||||
M_JPG0 = 0xf0,
|
||||
M_JPG8 = 0xf8,
|
||||
M_JPG13 = 0xfd,
|
||||
M_COM = 0xfe,
|
||||
|
||||
@@ -216,6 +218,7 @@ get_soi (j_decompress_ptr cinfo)
|
||||
/* Set initial assumptions for colorspace etc */
|
||||
|
||||
cinfo->jpeg_color_space = JCS_UNKNOWN;
|
||||
cinfo->color_transform = JCT_NONE;
|
||||
cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
|
||||
|
||||
cinfo->saw_JFIF_marker = FALSE;
|
||||
@@ -234,14 +237,16 @@ get_soi (j_decompress_ptr cinfo)
|
||||
|
||||
|
||||
LOCAL(boolean)
|
||||
get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
|
||||
get_sof (j_decompress_ptr cinfo, boolean is_baseline, boolean is_prog,
|
||||
boolean is_arith)
|
||||
/* Process a SOFn marker */
|
||||
{
|
||||
INT32 length;
|
||||
int c, ci;
|
||||
int c, ci, i;
|
||||
jpeg_component_info * compptr;
|
||||
INPUT_VARS(cinfo);
|
||||
|
||||
cinfo->is_baseline = is_baseline;
|
||||
cinfo->progressive_mode = is_prog;
|
||||
cinfo->arith_code = is_arith;
|
||||
|
||||
@@ -264,8 +269,8 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
|
||||
/* 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, */
|
||||
/* might as well have a general sanity check. */
|
||||
if (cinfo->image_height <= 0 || cinfo->image_width <= 0
|
||||
|| cinfo->num_components <= 0)
|
||||
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|
||||
cinfo->num_components <= 0)
|
||||
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
||||
|
||||
if (length != (cinfo->num_components * 3))
|
||||
@@ -276,10 +281,26 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
cinfo->num_components * SIZEOF(jpeg_component_info));
|
||||
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
for (ci = 0; ci < cinfo->num_components; ci++) {
|
||||
INPUT_BYTE(cinfo, c, return FALSE);
|
||||
/* Check to see whether component id has already been seen */
|
||||
/* (in violation of the spec, but unfortunately seen in some */
|
||||
/* files). If so, create "fake" component id equal to the */
|
||||
/* max id seen so far + 1. */
|
||||
for (i = 0, compptr = cinfo->comp_info; i < ci; i++, compptr++) {
|
||||
if (c == compptr->component_id) {
|
||||
compptr = cinfo->comp_info;
|
||||
c = compptr->component_id;
|
||||
compptr++;
|
||||
for (i = 1; i < ci; i++, compptr++) {
|
||||
if (compptr->component_id > c) c = compptr->component_id;
|
||||
}
|
||||
c++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
compptr->component_id = c;
|
||||
compptr->component_index = ci;
|
||||
INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
|
||||
INPUT_BYTE(cinfo, c, return FALSE);
|
||||
compptr->h_samp_factor = (c >> 4) & 15;
|
||||
compptr->v_samp_factor = (c ) & 15;
|
||||
@@ -302,12 +323,12 @@ get_sos (j_decompress_ptr cinfo)
|
||||
/* Process a SOS marker */
|
||||
{
|
||||
INT32 length;
|
||||
int i, ci, n, c, cc;
|
||||
int c, ci, i, n;
|
||||
jpeg_component_info * compptr;
|
||||
INPUT_VARS(cinfo);
|
||||
|
||||
if (! cinfo->marker->saw_SOF)
|
||||
ERREXIT(cinfo, JERR_SOS_NO_SOF);
|
||||
ERREXITS(cinfo, JERR_SOF_BEFORE, "SOS");
|
||||
|
||||
INPUT_2BYTES(cinfo, length, return FALSE);
|
||||
|
||||
@@ -315,7 +336,9 @@ get_sos (j_decompress_ptr cinfo)
|
||||
|
||||
TRACEMS1(cinfo, 1, JTRC_SOS, n);
|
||||
|
||||
if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
|
||||
if (length != (n * 2 + 6) || n > MAX_COMPS_IN_SCAN ||
|
||||
(n == 0 && !cinfo->progressive_mode))
|
||||
/* pseudo SOS marker only allowed in progressive mode */
|
||||
ERREXIT(cinfo, JERR_BAD_LENGTH);
|
||||
|
||||
cinfo->comps_in_scan = n;
|
||||
@@ -323,24 +346,41 @@ get_sos (j_decompress_ptr cinfo)
|
||||
/* Collect the component-spec parameters */
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
INPUT_BYTE(cinfo, cc, return FALSE);
|
||||
INPUT_BYTE(cinfo, c, return FALSE);
|
||||
|
||||
/* 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. */
|
||||
/* 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++) {
|
||||
if (c == cinfo->cur_comp_info[ci]->component_id) {
|
||||
c = cinfo->cur_comp_info[0]->component_id;
|
||||
for (ci = 1; ci < i; ci++) {
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
if (compptr->component_id > c) c = compptr->component_id;
|
||||
}
|
||||
c++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
if (cc == compptr->component_id)
|
||||
if (c == compptr->component_id)
|
||||
goto id_found;
|
||||
}
|
||||
|
||||
ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
|
||||
ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, c);
|
||||
|
||||
id_found:
|
||||
|
||||
cinfo->cur_comp_info[i] = compptr;
|
||||
INPUT_BYTE(cinfo, c, return FALSE);
|
||||
compptr->dc_tbl_no = (c >> 4) & 15;
|
||||
compptr->ac_tbl_no = (c ) & 15;
|
||||
|
||||
TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
|
||||
TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, compptr->component_id,
|
||||
compptr->dc_tbl_no, compptr->ac_tbl_no);
|
||||
}
|
||||
|
||||
@@ -359,8 +399,8 @@ get_sos (j_decompress_ptr cinfo)
|
||||
/* Prepare to scan data & restart markers */
|
||||
cinfo->marker->next_restart_num = 0;
|
||||
|
||||
/* Count another SOS marker */
|
||||
cinfo->input_scan_number++;
|
||||
/* Count another (non-pseudo) SOS marker */
|
||||
if (n) cinfo->input_scan_number++;
|
||||
|
||||
INPUT_SYNC(cinfo);
|
||||
return TRUE;
|
||||
@@ -456,6 +496,8 @@ get_dht (j_decompress_ptr cinfo)
|
||||
if (count > 256 || ((INT32) count) > length)
|
||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||
|
||||
MEMZERO(huffval, SIZEOF(huffval)); /* pre-zero array for later copy */
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
INPUT_BYTE(cinfo, huffval[i], return FALSE);
|
||||
|
||||
@@ -490,16 +532,18 @@ LOCAL(boolean)
|
||||
get_dqt (j_decompress_ptr cinfo)
|
||||
/* Process a DQT marker */
|
||||
{
|
||||
INT32 length;
|
||||
int n, i, prec;
|
||||
INT32 length, count, i;
|
||||
int n, prec;
|
||||
unsigned int tmp;
|
||||
JQUANT_TBL *quant_ptr;
|
||||
const int *natural_order;
|
||||
INPUT_VARS(cinfo);
|
||||
|
||||
INPUT_2BYTES(cinfo, length, return FALSE);
|
||||
length -= 2;
|
||||
|
||||
while (length > 0) {
|
||||
length--;
|
||||
INPUT_BYTE(cinfo, n, return FALSE);
|
||||
prec = n >> 4;
|
||||
n &= 0x0F;
|
||||
@@ -513,13 +557,43 @@ get_dqt (j_decompress_ptr cinfo)
|
||||
cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo);
|
||||
quant_ptr = cinfo->quant_tbl_ptrs[n];
|
||||
|
||||
if (prec) {
|
||||
if (length < DCTSIZE2 * 2) {
|
||||
/* Initialize full table for safety. */
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
quant_ptr->quantval[i] = 1;
|
||||
}
|
||||
count = length >> 1;
|
||||
} else
|
||||
count = DCTSIZE2;
|
||||
} else {
|
||||
if (length < DCTSIZE2) {
|
||||
/* Initialize full table for safety. */
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
quant_ptr->quantval[i] = 1;
|
||||
}
|
||||
count = length;
|
||||
} else
|
||||
count = DCTSIZE2;
|
||||
}
|
||||
|
||||
switch (count) {
|
||||
case (2*2): natural_order = jpeg_natural_order2; break;
|
||||
case (3*3): natural_order = jpeg_natural_order3; break;
|
||||
case (4*4): natural_order = jpeg_natural_order4; break;
|
||||
case (5*5): natural_order = jpeg_natural_order5; break;
|
||||
case (6*6): natural_order = jpeg_natural_order6; break;
|
||||
case (7*7): natural_order = jpeg_natural_order7; break;
|
||||
default: natural_order = jpeg_natural_order; break;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (prec)
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
else
|
||||
INPUT_BYTE(cinfo, tmp, return FALSE);
|
||||
/* We convert the zigzag-order table to natural array order. */
|
||||
quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp;
|
||||
quant_ptr->quantval[natural_order[i]] = (UINT16) tmp;
|
||||
}
|
||||
|
||||
if (cinfo->err->trace_level >= 2) {
|
||||
@@ -532,8 +606,8 @@ get_dqt (j_decompress_ptr cinfo)
|
||||
}
|
||||
}
|
||||
|
||||
length -= DCTSIZE2+1;
|
||||
if (prec) length -= DCTSIZE2;
|
||||
length -= count;
|
||||
if (prec) length -= count;
|
||||
}
|
||||
|
||||
if (length != 0)
|
||||
@@ -568,6 +642,68 @@ get_dri (j_decompress_ptr cinfo)
|
||||
}
|
||||
|
||||
|
||||
LOCAL(boolean)
|
||||
get_lse (j_decompress_ptr cinfo)
|
||||
/* Process an LSE marker */
|
||||
{
|
||||
INT32 length;
|
||||
unsigned int tmp;
|
||||
int cid;
|
||||
INPUT_VARS(cinfo);
|
||||
|
||||
if (! cinfo->marker->saw_SOF)
|
||||
ERREXITS(cinfo, JERR_SOF_BEFORE, "LSE");
|
||||
|
||||
if (cinfo->num_components < 3) goto bad;
|
||||
|
||||
INPUT_2BYTES(cinfo, length, return FALSE);
|
||||
|
||||
if (length != 24)
|
||||
ERREXIT(cinfo, JERR_BAD_LENGTH);
|
||||
|
||||
INPUT_BYTE(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0x0D) /* ID inverse transform specification */
|
||||
ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
if (tmp != MAXJSAMPLE) goto bad; /* MAXTRANS */
|
||||
INPUT_BYTE(cinfo, tmp, return FALSE);
|
||||
if (tmp != 3) goto bad; /* Nt=3 */
|
||||
INPUT_BYTE(cinfo, cid, return FALSE);
|
||||
if (cid != cinfo->comp_info[1].component_id) goto bad;
|
||||
INPUT_BYTE(cinfo, cid, return FALSE);
|
||||
if (cid != cinfo->comp_info[0].component_id) goto bad;
|
||||
INPUT_BYTE(cinfo, cid, return FALSE);
|
||||
if (cid != cinfo->comp_info[2].component_id) goto bad;
|
||||
INPUT_BYTE(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0x80) goto bad; /* F1: CENTER1=1, NORM1=0 */
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0) goto bad; /* A(1,1)=0 */
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0) goto bad; /* A(1,2)=0 */
|
||||
INPUT_BYTE(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0) goto bad; /* F2: CENTER2=0, NORM2=0 */
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
if (tmp != 1) goto bad; /* A(2,1)=1 */
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0) goto bad; /* A(2,2)=0 */
|
||||
INPUT_BYTE(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0) goto bad; /* F3: CENTER3=0, NORM3=0 */
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
if (tmp != 1) goto bad; /* A(3,1)=1 */
|
||||
INPUT_2BYTES(cinfo, tmp, return FALSE);
|
||||
if (tmp != 0) { /* A(3,2)=0 */
|
||||
bad:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
|
||||
/* OK, valid transform that we can handle. */
|
||||
cinfo->color_transform = JCT_SUBTRACT_GREEN;
|
||||
|
||||
INPUT_SYNC(cinfo);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Routines for processing APPn and COM markers.
|
||||
* These are either saved in memory or discarded, per application request.
|
||||
@@ -604,12 +740,13 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
|
||||
cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]);
|
||||
cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]);
|
||||
/* 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,
|
||||
* because some bozo at Hijaak couldn't read the spec.)
|
||||
* 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,
|
||||
cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
|
||||
/* Generate trace messages */
|
||||
@@ -946,6 +1083,11 @@ first_marker (j_decompress_ptr cinfo)
|
||||
*
|
||||
* Returns same codes as are defined for jpeg_consume_input:
|
||||
* JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
|
||||
*
|
||||
* Note: This function may return a pseudo SOS marker (with zero
|
||||
* component number) for treat by input controller's consume_input.
|
||||
* consume_input itself should filter out (skip) the pseudo marker
|
||||
* after processing for the caller.
|
||||
*/
|
||||
|
||||
METHODDEF(int)
|
||||
@@ -975,23 +1117,27 @@ read_markers (j_decompress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case M_SOF0: /* Baseline */
|
||||
if (! get_sof(cinfo, TRUE, FALSE, FALSE))
|
||||
return JPEG_SUSPENDED;
|
||||
break;
|
||||
|
||||
case M_SOF1: /* Extended sequential, Huffman */
|
||||
if (! get_sof(cinfo, FALSE, FALSE))
|
||||
if (! get_sof(cinfo, FALSE, FALSE, FALSE))
|
||||
return JPEG_SUSPENDED;
|
||||
break;
|
||||
|
||||
case M_SOF2: /* Progressive, Huffman */
|
||||
if (! get_sof(cinfo, TRUE, FALSE))
|
||||
if (! get_sof(cinfo, FALSE, TRUE, FALSE))
|
||||
return JPEG_SUSPENDED;
|
||||
break;
|
||||
|
||||
case M_SOF9: /* Extended sequential, arithmetic */
|
||||
if (! get_sof(cinfo, FALSE, TRUE))
|
||||
if (! get_sof(cinfo, FALSE, FALSE, TRUE))
|
||||
return JPEG_SUSPENDED;
|
||||
break;
|
||||
|
||||
case M_SOF10: /* Progressive, arithmetic */
|
||||
if (! get_sof(cinfo, TRUE, TRUE))
|
||||
if (! get_sof(cinfo, FALSE, TRUE, TRUE))
|
||||
return JPEG_SUSPENDED;
|
||||
break;
|
||||
|
||||
@@ -1039,6 +1185,11 @@ read_markers (j_decompress_ptr cinfo)
|
||||
return JPEG_SUSPENDED;
|
||||
break;
|
||||
|
||||
case M_JPG8:
|
||||
if (! get_lse(cinfo))
|
||||
return JPEG_SUSPENDED;
|
||||
break;
|
||||
|
||||
case M_APP0:
|
||||
case M_APP1:
|
||||
case M_APP2:
|
||||
@@ -1268,7 +1419,7 @@ jinit_marker_reader (j_decompress_ptr cinfo)
|
||||
marker = (my_marker_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(my_marker_reader));
|
||||
cinfo->marker = (struct jpeg_marker_reader *) marker;
|
||||
cinfo->marker = &marker->pub;
|
||||
/* Initialize public method pointers */
|
||||
marker->pub.reset_marker_reader = reset_marker_reader;
|
||||
marker->pub.read_markers = read_markers;
|
||||
|
||||
230
jdmaster.c
230
jdmaster.c
@@ -2,7 +2,7 @@
|
||||
* jdmaster.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -45,13 +45,26 @@ LOCAL(boolean)
|
||||
use_merged_upsample (j_decompress_ptr cinfo)
|
||||
{
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
/* Merging is the equivalent of plain box-filter upsampling */
|
||||
if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
|
||||
/* Merging is the equivalent of plain box-filter upsampling. */
|
||||
/* 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;
|
||||
/* 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_components != RGB_PIXELSIZE)
|
||||
cinfo->out_color_components != RGB_PIXELSIZE ||
|
||||
cinfo->color_transform)
|
||||
return FALSE;
|
||||
/* and it only handles 2h1v or 2h2v sampling ratios */
|
||||
if (cinfo->comp_info[0].h_samp_factor != 2 ||
|
||||
@@ -86,7 +99,9 @@ use_merged_upsample (j_decompress_ptr cinfo)
|
||||
|
||||
GLOBAL(void)
|
||||
jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
/* Do computations that are needed before master selection phase */
|
||||
/* Do computations that are needed before master selection phase.
|
||||
* This function is used for full decompression.
|
||||
*/
|
||||
{
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
int ci;
|
||||
@@ -97,134 +112,11 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
if (cinfo->global_state != DSTATE_READY)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
/* Compute core output image dimensions and DCT scaling choices. */
|
||||
jpeg_core_output_dimensions(cinfo);
|
||||
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
|
||||
/* Compute actual output image dimensions and DCT scaling choices. */
|
||||
if (cinfo->scale_num * 8 <= cinfo->scale_denom) {
|
||||
/* Provide 1/8 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 8L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 1;
|
||||
cinfo->min_DCT_v_scaled_size = 1;
|
||||
} else if (cinfo->scale_num * 4 <= cinfo->scale_denom) {
|
||||
/* Provide 1/4 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 4L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 4L);
|
||||
cinfo->min_DCT_h_scaled_size = 2;
|
||||
cinfo->min_DCT_v_scaled_size = 2;
|
||||
} else if (cinfo->scale_num * 8 <= cinfo->scale_denom * 3) {
|
||||
/* Provide 3/8 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 3L, 8L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 3L, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 3;
|
||||
cinfo->min_DCT_v_scaled_size = 3;
|
||||
} else if (cinfo->scale_num * 2 <= cinfo->scale_denom) {
|
||||
/* Provide 1/2 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 2L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 2L);
|
||||
cinfo->min_DCT_h_scaled_size = 4;
|
||||
cinfo->min_DCT_v_scaled_size = 4;
|
||||
} else if (cinfo->scale_num * 8 <= cinfo->scale_denom * 5) {
|
||||
/* Provide 5/8 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 5L, 8L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 5L, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 5;
|
||||
cinfo->min_DCT_v_scaled_size = 5;
|
||||
} else if (cinfo->scale_num * 4 <= cinfo->scale_denom * 3) {
|
||||
/* Provide 3/4 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 3L, 4L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 3L, 4L);
|
||||
cinfo->min_DCT_h_scaled_size = 6;
|
||||
cinfo->min_DCT_v_scaled_size = 6;
|
||||
} else if (cinfo->scale_num * 8 <= cinfo->scale_denom * 7) {
|
||||
/* Provide 7/8 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 7L, 8L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 7L, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 7;
|
||||
cinfo->min_DCT_v_scaled_size = 7;
|
||||
} else if (cinfo->scale_num <= cinfo->scale_denom) {
|
||||
/* Provide 1/1 scaling */
|
||||
cinfo->output_width = cinfo->image_width;
|
||||
cinfo->output_height = cinfo->image_height;
|
||||
cinfo->min_DCT_h_scaled_size = DCTSIZE;
|
||||
cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
||||
} else if (cinfo->scale_num * 8 <= cinfo->scale_denom * 9) {
|
||||
/* Provide 9/8 scaling */
|
||||
cinfo->output_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 8L);
|
||||
cinfo->output_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 9;
|
||||
cinfo->min_DCT_v_scaled_size = 9;
|
||||
} else if (cinfo->scale_num * 4 <= cinfo->scale_denom * 5) {
|
||||
/* Provide 5/4 scaling */
|
||||
cinfo->output_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 4L);
|
||||
cinfo->output_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 4L);
|
||||
cinfo->min_DCT_h_scaled_size = 10;
|
||||
cinfo->min_DCT_v_scaled_size = 10;
|
||||
} else if (cinfo->scale_num * 8 <= cinfo->scale_denom * 11) {
|
||||
/* Provide 11/8 scaling */
|
||||
cinfo->output_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 3L, 8L);
|
||||
cinfo->output_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 3L, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 11;
|
||||
cinfo->min_DCT_v_scaled_size = 11;
|
||||
} else if (cinfo->scale_num * 2 <= cinfo->scale_denom * 3) {
|
||||
/* Provide 3/2 scaling */
|
||||
cinfo->output_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 2L);
|
||||
cinfo->output_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 2L);
|
||||
cinfo->min_DCT_h_scaled_size = 12;
|
||||
cinfo->min_DCT_v_scaled_size = 12;
|
||||
} else if (cinfo->scale_num * 8 <= cinfo->scale_denom * 13) {
|
||||
/* Provide 13/8 scaling */
|
||||
cinfo->output_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 5L, 8L);
|
||||
cinfo->output_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 5L, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 13;
|
||||
cinfo->min_DCT_v_scaled_size = 13;
|
||||
} else if (cinfo->scale_num * 4 <= cinfo->scale_denom * 7) {
|
||||
/* Provide 7/4 scaling */
|
||||
cinfo->output_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 3L, 4L);
|
||||
cinfo->output_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 3L, 4L);
|
||||
cinfo->min_DCT_h_scaled_size = 14;
|
||||
cinfo->min_DCT_v_scaled_size = 14;
|
||||
} else if (cinfo->scale_num * 8 <= cinfo->scale_denom * 15) {
|
||||
/* Provide 15/8 scaling */
|
||||
cinfo->output_width = cinfo->image_width + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 7L, 8L);
|
||||
cinfo->output_height = cinfo->image_height + (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 7L, 8L);
|
||||
cinfo->min_DCT_h_scaled_size = 15;
|
||||
cinfo->min_DCT_v_scaled_size = 15;
|
||||
} else {
|
||||
/* Provide 2/1 scaling */
|
||||
cinfo->output_width = cinfo->image_width << 1;
|
||||
cinfo->output_height = cinfo->image_height << 1;
|
||||
cinfo->min_DCT_h_scaled_size = 16;
|
||||
cinfo->min_DCT_v_scaled_size = 16;
|
||||
}
|
||||
/* In selecting the actual DCT scaling for each component, we try to
|
||||
* scale up the chroma components via IDCT scaling rather than upsampling.
|
||||
* This saves time if the upsampler gets to use 1:1 scaling.
|
||||
@@ -263,22 +155,13 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
compptr->downsampled_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width *
|
||||
(long) (compptr->h_samp_factor * compptr->DCT_h_scaled_size),
|
||||
(long) (cinfo->max_h_samp_factor * DCTSIZE));
|
||||
(long) (cinfo->max_h_samp_factor * cinfo->block_size));
|
||||
compptr->downsampled_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height *
|
||||
(long) (compptr->v_samp_factor * compptr->DCT_v_scaled_size),
|
||||
(long) (cinfo->max_v_samp_factor * DCTSIZE));
|
||||
(long) (cinfo->max_v_samp_factor * cinfo->block_size));
|
||||
}
|
||||
|
||||
#else /* !IDCT_SCALING_SUPPORTED */
|
||||
|
||||
/* Hardwire it to "no scaling" */
|
||||
cinfo->output_width = cinfo->image_width;
|
||||
cinfo->output_height = cinfo->image_height;
|
||||
/* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,
|
||||
* and has computed unscaled downsampled_width and downsampled_height.
|
||||
*/
|
||||
|
||||
#endif /* IDCT_SCALING_SUPPORTED */
|
||||
|
||||
/* Report number of components in selected colorspace. */
|
||||
@@ -288,11 +171,11 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
cinfo->out_color_components = 1;
|
||||
break;
|
||||
case JCS_RGB:
|
||||
#if RGB_PIXELSIZE != 3
|
||||
case JCS_BG_RGB:
|
||||
cinfo->out_color_components = RGB_PIXELSIZE;
|
||||
break;
|
||||
#endif /* else share code with YCbCr */
|
||||
case JCS_YCbCr:
|
||||
case JCS_BG_YCC:
|
||||
cinfo->out_color_components = 3;
|
||||
break;
|
||||
case JCS_CMYK:
|
||||
@@ -328,30 +211,20 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
* These processes all use a common table prepared by the routine below.
|
||||
*
|
||||
* 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
|
||||
* -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial
|
||||
* limiting step (just after the IDCT), a wildly out-of-range value is
|
||||
* possible if the input data is corrupt. To avoid any chance of indexing
|
||||
* of x is within 2*(MAXJSAMPLE+1) of the legal range, so a table running
|
||||
* from -2*(MAXJSAMPLE+1) to 3*MAXJSAMPLE+2 is sufficient. But for the
|
||||
* initial limiting step (just after the IDCT), a wildly out-of-range value
|
||||
* 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
|
||||
* 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
|
||||
* samples. Under normal circumstances this is more than enough range and
|
||||
* 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.
|
||||
* 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.
|
||||
* So the post-IDCT limiting table ends up looking like this:
|
||||
* 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.
|
||||
* This is accomplished with SUBSET = CENTER - CENTERJSAMPLE.
|
||||
*
|
||||
* Note that the table is allocated in near data space on PCs; it's small
|
||||
* enough and used often enough to justify this.
|
||||
@@ -366,23 +239,17 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
|
||||
|
||||
table = (JSAMPLE *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE));
|
||||
table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */
|
||||
5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||
/* 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;
|
||||
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
|
||||
MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||
/* Main part of "simple" table: limit[x] = x */
|
||||
/* Main part of range limit table: limit[x] = x */
|
||||
for (i = 0; i <= MAXJSAMPLE; i++)
|
||||
table[i] = (JSAMPLE) i;
|
||||
table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */
|
||||
/* End of simple table, rest of first half of post-IDCT table */
|
||||
for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
|
||||
/* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
|
||||
for (; i < 3 * (MAXJSAMPLE+1); i++)
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -405,10 +272,19 @@ master_selection (j_decompress_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);
|
||||
|
||||
/* Initialize dimensions and other stuff */
|
||||
jpeg_calc_output_dimensions(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. */
|
||||
samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components;
|
||||
jd_samplesperrow = (JDIMENSION) samplesperrow;
|
||||
@@ -485,9 +361,9 @@ master_selection (j_decompress_ptr cinfo)
|
||||
/* Inverse DCT */
|
||||
jinit_inverse_dct(cinfo);
|
||||
/* Entropy decoding: either Huffman or arithmetic coding. */
|
||||
if (cinfo->arith_code) {
|
||||
if (cinfo->arith_code)
|
||||
jinit_arith_decoder(cinfo);
|
||||
} else {
|
||||
else {
|
||||
jinit_huff_decoder(cinfo);
|
||||
}
|
||||
|
||||
@@ -653,7 +529,7 @@ jinit_master_decompress (j_decompress_ptr cinfo)
|
||||
master = (my_master_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
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.finish_output_pass = finish_output_pass;
|
||||
|
||||
|
||||
67
jdmerge.c
67
jdmerge.c
@@ -2,6 +2,7 @@
|
||||
* jdmerge.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2013-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -23,7 +24,7 @@
|
||||
* multiplications needed for color conversion.
|
||||
*
|
||||
* 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.
|
||||
* No scaling needed at upsample time.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
LOCAL(void)
|
||||
build_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
/* Normal case, sYCC */
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
|
||||
int i;
|
||||
@@ -103,17 +105,57 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
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 1.40200 * x */
|
||||
/* Cr=>R value is nearest int to 1.402 * x */
|
||||
upsample->Cr_r_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 1.77200 * x */
|
||||
RIGHT_SHIFT(FIX(1.402) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 1.772 * x */
|
||||
upsample->Cb_b_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -0.71414 * x */
|
||||
upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x;
|
||||
/* Cb=>G value is scaled-up -0.34414 * x */
|
||||
RIGHT_SHIFT(FIX(1.772) * x + ONE_HALF, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -0.714136286 * x */
|
||||
upsample->Cr_g_tab[i] = (- FIX(0.714136286)) * 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 */
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +416,7 @@ jinit_merged_upsampler (j_decompress_ptr cinfo)
|
||||
upsample = (my_upsample_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_upsampler));
|
||||
cinfo->upsample = (struct jpeg_upsampler *) upsample;
|
||||
cinfo->upsample = &upsample->pub;
|
||||
upsample->pub.start_pass = start_pass_merged_upsample;
|
||||
upsample->pub.need_context_rows = FALSE;
|
||||
|
||||
@@ -394,6 +436,9 @@ jinit_merged_upsampler (j_decompress_ptr cinfo)
|
||||
upsample->spare_row = NULL;
|
||||
}
|
||||
|
||||
if (cinfo->jpeg_color_space == JCS_BG_YCC)
|
||||
build_bg_ycc_rgb_table(cinfo);
|
||||
else
|
||||
build_ycc_rgb_table(cinfo);
|
||||
}
|
||||
|
||||
|
||||
19
jdsample.c
19
jdsample.c
@@ -2,7 +2,7 @@
|
||||
* jdsample.c
|
||||
*
|
||||
* 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.
|
||||
* 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;
|
||||
int ci;
|
||||
jpeg_component_info * compptr;
|
||||
boolean need_buffer;
|
||||
int h_in_group, v_in_group, h_out_group, v_out_group;
|
||||
|
||||
upsample = (my_upsample_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_upsampler));
|
||||
cinfo->upsample = (struct jpeg_upsampler *) upsample;
|
||||
cinfo->upsample = &upsample->pub;
|
||||
upsample->pub.start_pass = start_pass_upsample;
|
||||
upsample->pub.upsample = sep_upsample;
|
||||
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;
|
||||
v_out_group = cinfo->max_v_samp_factor;
|
||||
upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
|
||||
need_buffer = TRUE;
|
||||
if (! compptr->component_needed) {
|
||||
/* Don't bother to upsample an uninteresting component. */
|
||||
upsample->methods[ci] = noop_upsample;
|
||||
need_buffer = FALSE;
|
||||
} else if (h_in_group == h_out_group && v_in_group == v_out_group) {
|
||||
continue; /* don't need to allocate buffer */
|
||||
}
|
||||
if (h_in_group == h_out_group && v_in_group == v_out_group) {
|
||||
/* Fullsize components can be processed without any work. */
|
||||
upsample->methods[ci] = fullsize_upsample;
|
||||
need_buffer = FALSE;
|
||||
} else if (h_in_group * 2 == h_out_group &&
|
||||
v_in_group == v_out_group) {
|
||||
continue; /* don't need to allocate buffer */
|
||||
}
|
||||
if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
|
||||
/* Special case for 2h1v upsampling */
|
||||
upsample->methods[ci] = h2v1_upsample;
|
||||
} 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);
|
||||
} else
|
||||
ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
|
||||
if (need_buffer) {
|
||||
upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(JDIMENSION) jround_up((long) cinfo->output_width,
|
||||
(long) cinfo->max_h_samp_factor),
|
||||
(JDIMENSION) cinfo->max_v_samp_factor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jdtrans.c
|
||||
*
|
||||
* Copyright (C) 1995-1997, Thomas G. Lane.
|
||||
* Modified 2000-2009 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -99,6 +100,9 @@ transdecode_master_selection (j_decompress_ptr cinfo)
|
||||
/* This is effectively a buffered-image operation. */
|
||||
cinfo->buffered_image = TRUE;
|
||||
|
||||
/* Compute output image dimensions and related values. */
|
||||
jpeg_core_output_dimensions(cinfo);
|
||||
|
||||
/* Entropy decoding: either Huffman or arithmetic coding. */
|
||||
if (cinfo->arith_code)
|
||||
jinit_arith_decoder(cinfo);
|
||||
|
||||
11
jerror.c
11
jerror.c
@@ -2,6 +2,7 @@
|
||||
* jerror.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2012-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -18,16 +19,16 @@
|
||||
* 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 */
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jversion.h"
|
||||
#include "jerror.h"
|
||||
|
||||
#ifdef USE_WINDOWS_MESSAGEBOX
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef EXIT_FAILURE /* define exit() codes if not provided */
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
@@ -66,7 +67,7 @@ const char * const jpeg_std_message_table[] = {
|
||||
* or jpeg_destroy) at some point.
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
METHODDEF(noreturn_t)
|
||||
error_exit (j_common_ptr cinfo)
|
||||
{
|
||||
/* Always display the message */
|
||||
|
||||
4
jerror.h
4
jerror.h
@@ -2,7 +2,7 @@
|
||||
* jerror.h
|
||||
*
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* Modified 1997-2012 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -106,11 +106,11 @@ JMESSAGE(JERR_QUANT_COMPONENTS,
|
||||
"Cannot quantize more than %d color components")
|
||||
JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
|
||||
JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
|
||||
JMESSAGE(JERR_SOF_BEFORE, "Invalid JPEG file structure: %s before SOF")
|
||||
JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
|
||||
JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
|
||||
JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
|
||||
JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
|
||||
JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
|
||||
JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
|
||||
JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
|
||||
JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* jfdctflt.c
|
||||
*
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
/*
|
||||
* Perform the forward DCT on one block of samples.
|
||||
*
|
||||
* cK represents cos(K*pi/16).
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
@@ -89,7 +91,7 @@ jpeg_fdct_float (FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col
|
||||
tmp11 = tmp1 + tmp2;
|
||||
tmp12 = tmp1 - tmp2;
|
||||
|
||||
/* Apply unsigned->signed conversion */
|
||||
/* Apply unsigned->signed conversion. */
|
||||
dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */
|
||||
dataptr[4] = tmp10 - tmp11;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* jfdctfst.c
|
||||
*
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -109,6 +109,8 @@
|
||||
|
||||
/*
|
||||
* Perform the forward DCT on one block of samples.
|
||||
*
|
||||
* cK represents cos(K*pi/16).
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
@@ -145,7 +147,7 @@ jpeg_fdct_ifast (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
|
||||
tmp11 = tmp1 + tmp2;
|
||||
tmp12 = tmp1 - tmp2;
|
||||
|
||||
/* Apply unsigned->signed conversion */
|
||||
/* Apply unsigned->signed conversion. */
|
||||
dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */
|
||||
dataptr[4] = tmp10 - tmp11;
|
||||
|
||||
|
||||
677
jfdctint.c
677
jfdctint.c
File diff suppressed because it is too large
Load Diff
62
jidctflt.c
62
jidctflt.c
@@ -2,6 +2,7 @@
|
||||
* jidctflt.c
|
||||
*
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Modified 2010-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -62,6 +63,8 @@
|
||||
|
||||
/*
|
||||
* Perform dequantization and inverse DCT on one block of coefficients.
|
||||
*
|
||||
* cK represents cos(K*pi/16).
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
@@ -79,7 +82,6 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
|
||||
int ctr;
|
||||
FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */
|
||||
SHIFT_TEMPS
|
||||
|
||||
/* Pass 1: process columns from input, store into work array. */
|
||||
|
||||
@@ -152,12 +154,12 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */
|
||||
|
||||
z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
|
||||
tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
|
||||
tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */
|
||||
tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */
|
||||
tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */
|
||||
|
||||
tmp6 = tmp12 - tmp7; /* phase 2 */
|
||||
tmp5 = tmp11 - tmp6;
|
||||
tmp4 = tmp10 + tmp5;
|
||||
tmp4 = tmp10 - tmp5;
|
||||
|
||||
wsptr[DCTSIZE*0] = tmp0 + tmp7;
|
||||
wsptr[DCTSIZE*7] = tmp0 - tmp7;
|
||||
@@ -165,8 +167,8 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
wsptr[DCTSIZE*6] = tmp1 - tmp6;
|
||||
wsptr[DCTSIZE*2] = tmp2 + tmp5;
|
||||
wsptr[DCTSIZE*5] = tmp2 - tmp5;
|
||||
wsptr[DCTSIZE*4] = tmp3 + tmp4;
|
||||
wsptr[DCTSIZE*3] = tmp3 - tmp4;
|
||||
wsptr[DCTSIZE*3] = tmp3 + tmp4;
|
||||
wsptr[DCTSIZE*4] = tmp3 - tmp4;
|
||||
|
||||
inptr++; /* advance pointers to next column */
|
||||
quantptr++;
|
||||
@@ -174,7 +176,6 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
|
||||
wsptr = workspace;
|
||||
for (ctr = 0; ctr < DCTSIZE; ctr++) {
|
||||
@@ -187,11 +188,14 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/* Even part */
|
||||
|
||||
tmp10 = wsptr[0] + wsptr[4];
|
||||
tmp11 = wsptr[0] - wsptr[4];
|
||||
/* Prepare range-limit and float->int conversion */
|
||||
z5 = wsptr[0] + (((FAST_FLOAT) RANGE_CENTER) + ((FAST_FLOAT) 0.5));
|
||||
tmp10 = z5 + wsptr[4];
|
||||
tmp11 = z5 - wsptr[4];
|
||||
|
||||
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;
|
||||
tmp3 = tmp10 - tmp13;
|
||||
@@ -205,35 +209,27 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
z11 = wsptr[1] + wsptr[7];
|
||||
z12 = wsptr[1] - wsptr[7];
|
||||
|
||||
tmp7 = z11 + z13;
|
||||
tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562);
|
||||
tmp7 = z11 + z13; /* phase 5 */
|
||||
tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */
|
||||
|
||||
z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
|
||||
tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
|
||||
tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */
|
||||
tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */
|
||||
tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */
|
||||
|
||||
tmp6 = tmp12 - tmp7;
|
||||
tmp6 = tmp12 - tmp7; /* phase 2 */
|
||||
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: float->int conversion and range-limit */
|
||||
|
||||
outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3)
|
||||
& RANGE_MASK];
|
||||
outptr[0] = 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[6] = range_limit[(int) (tmp1 - tmp6) & RANGE_MASK];
|
||||
outptr[2] = 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[4] = range_limit[(int) (tmp3 - tmp4) & RANGE_MASK];
|
||||
|
||||
wsptr += DCTSIZE; /* advance pointer to next row */
|
||||
}
|
||||
|
||||
89
jidctfst.c
89
jidctfst.c
@@ -2,6 +2,7 @@
|
||||
* jidctfst.c
|
||||
*
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Modified 2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -133,35 +134,10 @@
|
||||
#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.
|
||||
*
|
||||
* cK represents cos(K*pi/16).
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
@@ -180,7 +156,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
int ctr;
|
||||
int workspace[DCTSIZE2]; /* buffers data between passes */
|
||||
SHIFT_TEMPS /* for DESCALE */
|
||||
ISHIFT_TEMPS /* for IDESCALE */
|
||||
ISHIFT_TEMPS /* for IRIGHT_SHIFT */
|
||||
|
||||
/* 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 */
|
||||
|
||||
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
|
||||
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
|
||||
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
|
||||
tmp10 = z5 - MULTIPLY(z12, FIX_1_082392200); /* 2*(c2-c6) */
|
||||
tmp12 = z5 - MULTIPLY(z10, FIX_2_613125930); /* 2*(c2+c6) */
|
||||
|
||||
tmp6 = tmp12 - tmp7; /* phase 2 */
|
||||
tmp5 = tmp11 - tmp6;
|
||||
tmp4 = tmp10 + tmp5;
|
||||
tmp4 = tmp10 - tmp5;
|
||||
|
||||
wsptr[DCTSIZE*0] = (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*2] = (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 */
|
||||
quantptr++;
|
||||
wsptr++;
|
||||
}
|
||||
|
||||
/* 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, */
|
||||
/* and also undo the PASS1_BITS scaling. */
|
||||
/* 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,
|
||||
* and also undo the PASS1_BITS scaling.
|
||||
*/
|
||||
|
||||
wsptr = workspace;
|
||||
for (ctr = 0; ctr < DCTSIZE; ctr++) {
|
||||
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.
|
||||
* However, the column calculation has created many nonzero AC terms, so
|
||||
* 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 &&
|
||||
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
|
||||
/* 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];
|
||||
|
||||
outptr[0] = dcval;
|
||||
@@ -312,12 +295,12 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/* Even part */
|
||||
|
||||
tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
|
||||
tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]);
|
||||
tmp10 = z5 + (DCTELEM) wsptr[4];
|
||||
tmp11 = z5 - (DCTELEM) wsptr[4];
|
||||
|
||||
tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]);
|
||||
tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562)
|
||||
- tmp13;
|
||||
tmp13 = (DCTELEM) wsptr[2] + (DCTELEM) wsptr[6];
|
||||
tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6],
|
||||
FIX_1_414213562) - tmp13; /* 2*c4 */
|
||||
|
||||
tmp0 = 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 */
|
||||
|
||||
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
|
||||
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
|
||||
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
|
||||
tmp10 = z5 - MULTIPLY(z12, FIX_1_082392200); /* 2*(c2-c6) */
|
||||
tmp12 = z5 - MULTIPLY(z10, FIX_2_613125930); /* 2*(c2+c6) */
|
||||
|
||||
tmp6 = tmp12 - tmp7; /* phase 2 */
|
||||
tmp5 = tmp11 - tmp6;
|
||||
tmp4 = tmp10 + tmp5;
|
||||
tmp4 = tmp10 - tmp5;
|
||||
|
||||
/* 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];
|
||||
outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3)
|
||||
outptr[7] = range_limit[(int) IRIGHT_SHIFT(tmp0 - tmp7, PASS1_BITS+3)
|
||||
& 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];
|
||||
outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3)
|
||||
outptr[6] = range_limit[(int) IRIGHT_SHIFT(tmp1 - tmp6, PASS1_BITS+3)
|
||||
& 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];
|
||||
outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3)
|
||||
outptr[5] = range_limit[(int) IRIGHT_SHIFT(tmp2 - tmp5, PASS1_BITS+3)
|
||||
& 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];
|
||||
outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3)
|
||||
outptr[4] = range_limit[(int) IRIGHT_SHIFT(tmp3 - tmp4, PASS1_BITS+3)
|
||||
& RANGE_MASK];
|
||||
|
||||
wsptr += DCTSIZE; /* advance pointer to next row */
|
||||
|
||||
522
jidctint.c
522
jidctint.c
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
* jmemmgr.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2011-2012 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -213,7 +214,7 @@ print_mem_stats (j_common_ptr cinfo, int pool_id)
|
||||
#endif /* MEM_STATS */
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
LOCAL(noreturn_t)
|
||||
out_of_memory (j_common_ptr cinfo, int which)
|
||||
/* Report an out-of-memory error and stop execution */
|
||||
/* If we compiled MEM_STATS support, report alloc requests before dying */
|
||||
@@ -821,7 +822,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
|
||||
undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
|
||||
end_row -= ptr->cur_start_row;
|
||||
while (undef_row < end_row) {
|
||||
jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
|
||||
FMEMZERO((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
|
||||
undef_row++;
|
||||
}
|
||||
} else {
|
||||
@@ -906,7 +907,7 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
|
||||
undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
|
||||
end_row -= ptr->cur_start_row;
|
||||
while (undef_row < end_row) {
|
||||
jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
|
||||
FMEMZERO((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
|
||||
undef_row++;
|
||||
}
|
||||
} else {
|
||||
|
||||
107
jmorecfg.h
107
jmorecfg.h
@@ -2,7 +2,7 @@
|
||||
* jmorecfg.h
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* Modified 1997-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -15,13 +15,22 @@
|
||||
/*
|
||||
* Define BITS_IN_JSAMPLE as either
|
||||
* 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
|
||||
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
|
||||
* JPEG standard, and the IJG code does not support anything else!
|
||||
* We do not support run-time selection of data precision, sorry.
|
||||
* Only 8, 9, 10, 11, and 12 bits sample data precision are supported for
|
||||
* full-feature DCT processing. Further depths up to 16-bit may be added
|
||||
* 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 */
|
||||
|
||||
|
||||
#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
|
||||
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
|
||||
* On nearly all machines "short" will do nicely.
|
||||
@@ -160,11 +211,13 @@ typedef short INT16;
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
|
||||
#ifndef _BASETSD_H /* MinGW is slightly different */
|
||||
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
|
||||
typedef long INT32;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Datatype used for image dimensions. The JPEG standard only supports
|
||||
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
||||
@@ -208,6 +261,26 @@ typedef unsigned int JDIMENSION;
|
||||
#endif
|
||||
|
||||
|
||||
/* The noreturn type identifier is used to declare functions
|
||||
* which cannot return.
|
||||
* Compilers can thus create more optimized code and perform
|
||||
* better checks for warnings and errors.
|
||||
* Static analyzer tools can make improved inferences about
|
||||
* execution paths and are prevented from giving false alerts.
|
||||
*
|
||||
* Unfortunately, the proposed specifications of corresponding
|
||||
* extensions in the Dec 2011 ISO C standard revision (C11),
|
||||
* GCC, MSVC, etc. are not viable.
|
||||
* Thus we introduce a user defined type to declare noreturn
|
||||
* functions at least for clarity. A proper compiler would
|
||||
* have a suitable noreturn type to match in place of void.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_NORETURN_T
|
||||
typedef void noreturn_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* Here is the pseudo-keyword for declaring pointers that must be "far"
|
||||
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
|
||||
* by just saying "FAR *" where such a pointer is needed. In a few places
|
||||
@@ -231,14 +304,19 @@ typedef unsigned int JDIMENSION;
|
||||
*/
|
||||
|
||||
#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;
|
||||
#endif
|
||||
#ifndef FALSE /* in case these macros already exist */
|
||||
#define FALSE 0 /* values of boolean */
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#else
|
||||
typedef enum { FALSE = 0, TRUE = 1 } boolean;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -276,11 +354,12 @@ typedef int boolean;
|
||||
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
|
||||
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
|
||||
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
|
||||
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
|
||||
* precision, so jchuff.c normally uses entropy optimization to compute
|
||||
* usable tables for higher precision. If you don't want to do optimization,
|
||||
* you'll have to supply different default Huffman tables.
|
||||
/* Note: if you selected more than 8-bit data precision, it is dangerous to
|
||||
* turn off ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only
|
||||
* good for 8-bit precision, so arithmetic coding is recommended for higher
|
||||
* precision. The Huffman encoder normally uses entropy optimization to
|
||||
* 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
|
||||
* don't work for progressive mode. (This may get fixed, however.)
|
||||
*/
|
||||
@@ -291,7 +370,7 @@ typedef int boolean;
|
||||
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define 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 BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
|
||||
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
|
||||
@@ -310,9 +389,7 @@ typedef int boolean;
|
||||
* the offsets will also change the order in which colormap data is organized.
|
||||
* RESTRICTIONS:
|
||||
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
|
||||
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
|
||||
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
|
||||
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
||||
* 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
||||
* is not 3 (they don't understand about dummy color components!). So you
|
||||
* can't use color quantization if you change that value.
|
||||
*/
|
||||
|
||||
49
jpegint.h
49
jpegint.h
@@ -2,7 +2,7 @@
|
||||
* jpegint.h
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* Modified 1997-2013 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -211,12 +211,8 @@ struct jpeg_marker_reader {
|
||||
/* Entropy decoding */
|
||||
struct jpeg_entropy_decoder {
|
||||
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
||||
JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
|
||||
JBLOCKROW *MCU_data));
|
||||
|
||||
/* This is here to share code between baseline and progressive decoders; */
|
||||
/* other modules probably should not use it */
|
||||
boolean insufficient_data; /* set TRUE after emitting warning */
|
||||
JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW *MCU_data));
|
||||
JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
|
||||
};
|
||||
|
||||
/* Inverse DCT (also performs dequantization) */
|
||||
@@ -325,14 +321,41 @@ struct jpeg_color_quantizer {
|
||||
#define jinit_memory_mgr jIMemMgr
|
||||
#define jdiv_round_up jDivRound
|
||||
#define jround_up jRound
|
||||
#define jzero_far jZeroFar
|
||||
#define jcopy_sample_rows jCopySamples
|
||||
#define jcopy_block_row jCopyBlocks
|
||||
#define jzero_far jZeroFar
|
||||
#define jpeg_zigzag_order jZIGTable
|
||||
#define jpeg_natural_order jZAGTable
|
||||
#define jpeg_natural_order7 jZAG7Table
|
||||
#define jpeg_natural_order6 jZAG6Table
|
||||
#define jpeg_natural_order5 jZAG5Table
|
||||
#define jpeg_natural_order4 jZAG4Table
|
||||
#define jpeg_natural_order3 jZAG3Table
|
||||
#define jpeg_natural_order2 jZAG2Table
|
||||
#define jpeg_aritab jAriTab
|
||||
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
||||
|
||||
|
||||
/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
|
||||
* and coefficient-block arrays. This won't work on 80x86 because the arrays
|
||||
* are FAR and we're assuming a small-pointer memory model. However, some
|
||||
* DOS compilers provide far-pointer versions of memcpy() and memset() even
|
||||
* in the small-model libraries. These will be used if USE_FMEM is defined.
|
||||
* Otherwise, the routines in jutils.c do it the hard way.
|
||||
*/
|
||||
|
||||
#ifndef NEED_FAR_POINTERS /* normal case, same as regular macro */
|
||||
#define FMEMZERO(target,size) MEMZERO(target,size)
|
||||
#else /* 80x86 case */
|
||||
#ifdef USE_FMEM
|
||||
#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size))
|
||||
#else
|
||||
EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
|
||||
#define FMEMZERO(target,size) jzero_far(target, size)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Compression module initialization routines */
|
||||
EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
|
||||
EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
|
||||
@@ -378,12 +401,20 @@ EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
|
||||
int num_rows, JDIMENSION num_cols));
|
||||
EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
|
||||
JDIMENSION num_blocks));
|
||||
EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
|
||||
/* Constant tables in jutils.c */
|
||||
#if 0 /* This table is not actually needed in v6a */
|
||||
extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
|
||||
#endif
|
||||
extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
|
||||
extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */
|
||||
extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */
|
||||
extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */
|
||||
extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */
|
||||
extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */
|
||||
extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */
|
||||
|
||||
/* Arithmetic coding probability estimation tables in jaricom.c */
|
||||
extern const INT32 jpeg_aritab[];
|
||||
|
||||
/* Suppress undefined-structure complaints if necessary. */
|
||||
|
||||
|
||||
79
jpeglib.h
79
jpeglib.h
@@ -2,7 +2,7 @@
|
||||
* jpeglib.h
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* Modified 2002-2015 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -33,19 +33,21 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Version ID for the JPEG library.
|
||||
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 70".
|
||||
/* Version IDs for the JPEG library.
|
||||
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 90".
|
||||
*/
|
||||
|
||||
#define JPEG_LIB_VERSION 70 /* Version 7.0 */
|
||||
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
|
||||
#define JPEG_LIB_VERSION_MAJOR 9
|
||||
#define JPEG_LIB_VERSION_MINOR 2
|
||||
|
||||
|
||||
/* Various constants determining the sizes of things.
|
||||
* All of these are specified by the JPEG standard, so don't change them
|
||||
* if you want to be compatible.
|
||||
* All of these are specified by the JPEG standard,
|
||||
* so don't change them if you want to be compatible.
|
||||
*/
|
||||
|
||||
#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
|
||||
#define DCTSIZE 8 /* The basic DCT block is 8x8 coefficients */
|
||||
#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
|
||||
#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
|
||||
#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
|
||||
@@ -155,23 +157,28 @@ typedef struct {
|
||||
/* The downsampled dimensions are the component's actual, unpadded number
|
||||
* of samples at the main buffer (preprocessing/compression interface);
|
||||
* 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.
|
||||
*/
|
||||
JDIMENSION downsampled_width; /* actual width in samples */
|
||||
JDIMENSION downsampled_height; /* actual height in samples */
|
||||
/* This flag is used only for decompression. In cases where some of the
|
||||
* components will be ignored (eg grayscale output from YCbCr image),
|
||||
* we can skip most computations for the unused components.
|
||||
/* For decompression, in cases where some of the components will be
|
||||
* ignored (eg grayscale output from YCbCr image), we can skip most
|
||||
* 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. */
|
||||
/* The decompressor output side may not use these variables. */
|
||||
int MCU_width; /* number of blocks per MCU, horizontally */
|
||||
int MCU_height; /* number of blocks per MCU, vertically */
|
||||
int MCU_blocks; /* MCU_width * MCU_height */
|
||||
int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */
|
||||
int MCU_sample_width; /* MCU width in samples: MCU_width * DCT_h_scaled_size */
|
||||
int last_col_width; /* # of non-dummy blocks across in last MCU */
|
||||
int last_row_height; /* # of non-dummy blocks down in last MCU */
|
||||
|
||||
@@ -213,12 +220,21 @@ struct jpeg_marker_struct {
|
||||
typedef enum {
|
||||
JCS_UNKNOWN, /* error/unspecified */
|
||||
JCS_GRAYSCALE, /* monochrome */
|
||||
JCS_RGB, /* red/green/blue */
|
||||
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
|
||||
JCS_RGB, /* red/green/blue, standard RGB (sRGB) */
|
||||
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV), standard YCC */
|
||||
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;
|
||||
|
||||
/* Supported color transforms. */
|
||||
|
||||
typedef enum {
|
||||
JCT_NONE = 0,
|
||||
JCT_SUBTRACT_GREEN = 1
|
||||
} J_COLOR_TRANSFORM;
|
||||
|
||||
/* DCT/IDCT algorithm options. */
|
||||
|
||||
typedef enum {
|
||||
@@ -368,6 +384,9 @@ struct jpeg_compress_struct {
|
||||
UINT16 Y_density; /* Vertical pixel density */
|
||||
boolean write_Adobe_marker; /* should an Adobe marker be written? */
|
||||
|
||||
J_COLOR_TRANSFORM color_transform;
|
||||
/* Color transform identifier, writes LSE marker if nonzero */
|
||||
|
||||
/* State variable: index of next scanline to be written to
|
||||
* jpeg_write_scanlines(). Application may use this to control its
|
||||
* processing loop, e.g., "while (next_scanline < image_height)".
|
||||
@@ -414,6 +433,10 @@ struct jpeg_compress_struct {
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
int block_size; /* the basic DCT block size: 1..16 */
|
||||
const int * natural_order; /* natural-order position array */
|
||||
int lim_Se; /* min( Se, DCTSIZE2-1 ) */
|
||||
|
||||
/*
|
||||
* Links to compression subobjects (methods and private variables of modules)
|
||||
*/
|
||||
@@ -560,6 +583,7 @@ struct jpeg_decompress_struct {
|
||||
jpeg_component_info * comp_info;
|
||||
/* comp_info[i] describes component that appears i'th in SOF */
|
||||
|
||||
boolean is_baseline; /* TRUE if Baseline SOF0 encountered */
|
||||
boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
|
||||
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
|
||||
@@ -582,6 +606,9 @@ struct jpeg_decompress_struct {
|
||||
boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
|
||||
UINT8 Adobe_transform; /* Color transform code from Adobe marker */
|
||||
|
||||
J_COLOR_TRANSFORM color_transform;
|
||||
/* Color transform identifier derived from LSE marker, otherwise zero */
|
||||
|
||||
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
|
||||
/* Aside from the specific data retained from APPn markers known to the
|
||||
@@ -633,6 +660,12 @@ struct jpeg_decompress_struct {
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
/* These fields are derived from Se of first SOS marker.
|
||||
*/
|
||||
int block_size; /* the basic DCT block size: 1..16 */
|
||||
const int * natural_order; /* natural-order position array for entropy decode */
|
||||
int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */
|
||||
|
||||
/* This field is shared between entropy decoder and marker parser.
|
||||
* It is either zero or the code of a JPEG marker that has been
|
||||
* read from the data source, but has not yet been processed.
|
||||
@@ -668,7 +701,7 @@ struct jpeg_decompress_struct {
|
||||
|
||||
struct jpeg_error_mgr {
|
||||
/* Error exit handler: does not return to caller */
|
||||
JMETHOD(void, error_exit, (j_common_ptr cinfo));
|
||||
JMETHOD(noreturn_t, error_exit, (j_common_ptr cinfo));
|
||||
/* Conditionally emit a trace or warning message */
|
||||
JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
|
||||
/* Routine that actually outputs a trace or error message */
|
||||
@@ -862,6 +895,8 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
||||
#define jpeg_destroy_decompress jDestDecompress
|
||||
#define jpeg_stdio_dest jStdDest
|
||||
#define jpeg_stdio_src jStdSrc
|
||||
#define jpeg_mem_dest jMemDest
|
||||
#define jpeg_mem_src jMemSrc
|
||||
#define jpeg_set_defaults jSetDefaults
|
||||
#define jpeg_set_colorspace jSetColorspace
|
||||
#define jpeg_default_colorspace jDefColorspace
|
||||
@@ -894,6 +929,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
||||
#define jpeg_input_complete jInComplete
|
||||
#define jpeg_new_colormap jNewCMap
|
||||
#define jpeg_consume_input jConsumeInput
|
||||
#define jpeg_core_output_dimensions jCoreDimensions
|
||||
#define jpeg_calc_output_dimensions jCalcDimensions
|
||||
#define jpeg_save_markers jSaveMarkers
|
||||
#define jpeg_set_marker_processor jSetMarker
|
||||
@@ -938,6 +974,14 @@ EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
|
||||
EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
|
||||
EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
|
||||
|
||||
/* Data source and destination managers: memory buffers. */
|
||||
EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
|
||||
unsigned char ** outbuffer,
|
||||
unsigned long * outsize));
|
||||
EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
|
||||
const unsigned char * inbuffer,
|
||||
unsigned long insize));
|
||||
|
||||
/* Default parameter setup for compression */
|
||||
EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
|
||||
/* Compression parameter setup aids */
|
||||
@@ -1032,6 +1076,7 @@ EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
|
||||
#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
|
||||
|
||||
/* Precalculate output dimensions for current decompression parameters. */
|
||||
EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo));
|
||||
EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
|
||||
|
||||
/* Control saving of COM and APPn markers into marker_list. */
|
||||
|
||||
51
jpegtran.1
51
jpegtran.1
@@ -1,4 +1,4 @@
|
||||
.TH JPEGTRAN 1 "28 March 2009"
|
||||
.TH JPEGTRAN 1 "20 September 2015"
|
||||
.SH NAME
|
||||
jpegtran \- lossless transformation of JPEG files
|
||||
.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
|
||||
from landscape to portrait format by rotation.
|
||||
.PP
|
||||
For EXIF files and JPEG files containing Exif data, you may prefer to use
|
||||
.B exiftran
|
||||
instead.
|
||||
.PP
|
||||
.B jpegtran
|
||||
works by rearranging the compressed data (DCT coefficients), without
|
||||
ever fully decoding the image. Therefore, its transformations are lossless:
|
||||
@@ -28,7 +32,11 @@ followed by
|
||||
.B cjpeg
|
||||
to accomplish the same conversion. But by the same token,
|
||||
.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
|
||||
.B jpegtran
|
||||
reads the named JPEG/JFIF file, or the standard input if no file is
|
||||
@@ -156,16 +164,25 @@ image region but losslessly preserves what is inside. Like the rotate and
|
||||
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
|
||||
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
|
||||
dimensions to keep the lower right crop corner unchanged. (Thus, the output
|
||||
image covers at least the requested region, but may cover more.)
|
||||
left corner up and/or left to make it so, simultaneously increasing 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.)
|
||||
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:
|
||||
.TP
|
||||
.B \-crop WxH+X+Y
|
||||
Crop to a rectangular subarea of width W, height H starting at point X,Y.
|
||||
.PP
|
||||
Another not-strictly-lossless transformation switch is:
|
||||
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:
|
||||
.TP
|
||||
.B \-grayscale
|
||||
Force grayscale output.
|
||||
@@ -178,6 +195,19 @@ is particularly handy for fixing a monochrome picture that was mistakenly
|
||||
encoded as a color JPEG. (In such a case, the space savings from getting rid
|
||||
of the near-empty chroma channels won't be large; but the decoding time for
|
||||
a grayscale JPEG is substantially less than that for a color JPEG.)
|
||||
.TP
|
||||
.BI \-scale " M/N"
|
||||
Scale the output image by a factor M/N.
|
||||
.IP
|
||||
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 baseline JPEG. If the /N part is omitted,
|
||||
then M specifies the DCT scaled size to be applied on the given input. For
|
||||
baseline JPEG this is equivalent to M/8 scaling, since the source DCT size
|
||||
for baseline JPEG is 8.
|
||||
.B Caution:
|
||||
An implementation of the JPEG SmartScale extension is required for this
|
||||
feature. SmartScale enabled JPEG is not yet widely implemented, so many
|
||||
decoders will be unable to view a SmartScale extended JPEG file at all.
|
||||
.PP
|
||||
.B jpegtran
|
||||
also recognizes these switches that control what to do with "extra" markers,
|
||||
@@ -185,16 +215,17 @@ such as comment blocks:
|
||||
.TP
|
||||
.B \-copy none
|
||||
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
|
||||
.B \-copy comments
|
||||
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
|
||||
.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
|
||||
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
|
||||
The default behavior is
|
||||
.BR "\-copy comments" .
|
||||
|
||||
67
jpegtran.c
67
jpegtran.c
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* jpegtran.c
|
||||
*
|
||||
* Copyright (C) 1995-2001, Thomas G. Lane.
|
||||
* Copyright (C) 1995-2013, Thomas G. Lane, Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains a command-line user interface for JPEG transcoding.
|
||||
* It is very similar to cjpeg.c, but provides lossless transcoding between
|
||||
* different JPEG file formats. It also provides some lossless and sort-of-
|
||||
* lossless transformations of JPEG data.
|
||||
* It is very similar to cjpeg.c, and partly to djpeg.c, but provides
|
||||
* lossless transcoding between different JPEG file formats. It also
|
||||
* provides some lossless and sort-of-lossless transformations of JPEG data.
|
||||
*/
|
||||
|
||||
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
static const char * progname; /* program name for error messages */
|
||||
static char * outfilename; /* for -outfile switch */
|
||||
static char * scaleoption; /* -scale switch */
|
||||
static JCOPY_OPTION copyoption; /* -copy switch */
|
||||
static jpeg_transform_info transformoption; /* image transformation options */
|
||||
|
||||
@@ -62,26 +63,30 @@ usage (void)
|
||||
#ifdef C_PROGRESSIVE_SUPPORTED
|
||||
fprintf(stderr, " -progressive Create progressive JPEG file\n");
|
||||
#endif
|
||||
#if TRANSFORMS_SUPPORTED
|
||||
fprintf(stderr, "Switches for modifying the image:\n");
|
||||
#if TRANSFORMS_SUPPORTED
|
||||
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, " -grayscale Reduce to grayscale (omit color data)\n");
|
||||
fprintf(stderr, " -perfect Fail if there is non-transformable edge blocks\n");
|
||||
fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n");
|
||||
#endif
|
||||
fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n");
|
||||
#if TRANSFORMS_SUPPORTED
|
||||
fprintf(stderr, " -transpose Transpose image\n");
|
||||
fprintf(stderr, " -transverse Transverse transpose image\n");
|
||||
fprintf(stderr, " -trim Drop non-transformable edge blocks\n");
|
||||
#endif /* TRANSFORMS_SUPPORTED */
|
||||
fprintf(stderr, " -wipe WxH+X+Y Wipe (gray out) a rectangular subarea\n");
|
||||
#endif
|
||||
fprintf(stderr, "Switches for advanced users:\n");
|
||||
#ifdef C_ARITH_CODING_SUPPORTED
|
||||
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
|
||||
#endif
|
||||
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
|
||||
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
|
||||
fprintf(stderr, " -outfile name Specify name for output file\n");
|
||||
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
||||
fprintf(stderr, "Switches for wizards:\n");
|
||||
#ifdef C_ARITH_CODING_SUPPORTED
|
||||
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
|
||||
#endif
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
|
||||
#endif
|
||||
@@ -132,10 +137,11 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
/* Set up default JPEG parameters. */
|
||||
simple_progressive = FALSE;
|
||||
outfilename = NULL;
|
||||
scaleoption = NULL;
|
||||
copyoption = JCOPYOPT_DEFAULT;
|
||||
transformoption.transform = JXFORM_NONE;
|
||||
transformoption.trim = FALSE;
|
||||
transformoption.perfect = FALSE;
|
||||
transformoption.trim = FALSE;
|
||||
transformoption.force_grayscale = FALSE;
|
||||
transformoption.crop = FALSE;
|
||||
cinfo->err->trace_level = 0;
|
||||
@@ -182,7 +188,8 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
#if TRANSFORMS_SUPPORTED
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
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",
|
||||
progname, argv[argn]);
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -299,6 +306,13 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
else
|
||||
usage();
|
||||
|
||||
} else if (keymatch(arg, "scale", 4)) {
|
||||
/* Scale the output image by a fraction M/N. */
|
||||
if (++argn >= argc) /* advance to next argument */
|
||||
usage();
|
||||
scaleoption = argv[argn];
|
||||
/* We must postpone processing until decompression startup. */
|
||||
|
||||
} else if (keymatch(arg, "scans", 1)) {
|
||||
/* Set scan script. */
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||
@@ -324,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. */
|
||||
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 {
|
||||
usage(); /* bogus switch */
|
||||
}
|
||||
@@ -453,20 +482,22 @@ main (int argc, char **argv)
|
||||
/* Read file header */
|
||||
(void) jpeg_read_header(&srcinfo, TRUE);
|
||||
|
||||
/* Adjust default decompression parameters */
|
||||
if (scaleoption != NULL)
|
||||
if (sscanf(scaleoption, "%u/%u",
|
||||
&srcinfo.scale_num, &srcinfo.scale_denom) < 1)
|
||||
usage();
|
||||
|
||||
/* Any space needed by a transform option must be requested before
|
||||
* jpeg_read_coefficients so that memory allocation will be done right.
|
||||
*/
|
||||
#if TRANSFORMS_SUPPORTED
|
||||
/* Fails right away if -perfect is given and transformation is not perfect.
|
||||
/* Fail right away if -perfect is given and transformation is not perfect.
|
||||
*/
|
||||
if (transformoption.perfect &&
|
||||
!jtransform_perfect_transform(srcinfo.image_width, srcinfo.image_height,
|
||||
srcinfo.max_h_samp_factor * DCTSIZE, srcinfo.max_v_samp_factor * DCTSIZE,
|
||||
transformoption.transform)) {
|
||||
if (!jtransform_request_workspace(&srcinfo, &transformoption)) {
|
||||
fprintf(stderr, "%s: transformation is not perfect\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
jtransform_request_workspace(&srcinfo, &transformoption);
|
||||
#endif
|
||||
|
||||
/* Read source file as DCT coefficients */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jquant1.c
|
||||
*
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modified 2011 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -530,7 +531,7 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
|
||||
for (row = 0; row < num_rows; row++) {
|
||||
/* Initialize output values to 0 so can process components separately */
|
||||
jzero_far((void FAR *) output_buf[row],
|
||||
FMEMZERO((void FAR *) output_buf[row],
|
||||
(size_t) (width * SIZEOF(JSAMPLE)));
|
||||
row_index = cquantize->row_index;
|
||||
for (ci = 0; ci < nc; ci++) {
|
||||
@@ -635,7 +636,7 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
|
||||
for (row = 0; row < num_rows; row++) {
|
||||
/* Initialize output values to 0 so can process components separately */
|
||||
jzero_far((void FAR *) output_buf[row],
|
||||
FMEMZERO((void FAR *) output_buf[row],
|
||||
(size_t) (width * SIZEOF(JSAMPLE)));
|
||||
for (ci = 0; ci < nc; ci++) {
|
||||
input_ptr = input_buf[row] + ci;
|
||||
@@ -781,7 +782,7 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
|
||||
/* Initialize the propagated errors to zero. */
|
||||
arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR));
|
||||
for (i = 0; i < cinfo->out_color_components; i++)
|
||||
jzero_far((void FAR *) cquantize->fserrors[i], arraysize);
|
||||
FMEMZERO((void FAR *) cquantize->fserrors[i], arraysize);
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* jquant2.c
|
||||
*
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modified 2011 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -1203,7 +1204,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
|
||||
cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
|
||||
/* Initialize the propagated errors to zero. */
|
||||
jzero_far((void FAR *) cquantize->fserrors, arraysize);
|
||||
FMEMZERO((void FAR *) cquantize->fserrors, arraysize);
|
||||
/* Make the error-limit table if we didn't already. */
|
||||
if (cquantize->error_limiter == NULL)
|
||||
init_error_limit(cinfo);
|
||||
@@ -1214,7 +1215,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
|
||||
/* Zero the histogram or inverse color map, if necessary */
|
||||
if (cquantize->needs_zeroed) {
|
||||
for (i = 0; i < HIST_C0_ELEMS; i++) {
|
||||
jzero_far((void FAR *) histogram[i],
|
||||
FMEMZERO((void FAR *) histogram[i],
|
||||
HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell));
|
||||
}
|
||||
cquantize->needs_zeroed = FALSE;
|
||||
|
||||
90
jutils.c
90
jutils.c
@@ -2,6 +2,7 @@
|
||||
* jutils.c
|
||||
*
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modified 2009-2011 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -63,6 +64,57 @@ const int jpeg_natural_order[DCTSIZE2+16] = {
|
||||
63, 63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
|
||||
const int jpeg_natural_order7[7*7+16] = {
|
||||
0, 1, 8, 16, 9, 2, 3, 10,
|
||||
17, 24, 32, 25, 18, 11, 4, 5,
|
||||
12, 19, 26, 33, 40, 48, 41, 34,
|
||||
27, 20, 13, 6, 14, 21, 28, 35,
|
||||
42, 49, 50, 43, 36, 29, 22, 30,
|
||||
37, 44, 51, 52, 45, 38, 46, 53,
|
||||
54,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
|
||||
63, 63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
|
||||
const int jpeg_natural_order6[6*6+16] = {
|
||||
0, 1, 8, 16, 9, 2, 3, 10,
|
||||
17, 24, 32, 25, 18, 11, 4, 5,
|
||||
12, 19, 26, 33, 40, 41, 34, 27,
|
||||
20, 13, 21, 28, 35, 42, 43, 36,
|
||||
29, 37, 44, 45,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
|
||||
63, 63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
|
||||
const int jpeg_natural_order5[5*5+16] = {
|
||||
0, 1, 8, 16, 9, 2, 3, 10,
|
||||
17, 24, 32, 25, 18, 11, 4, 12,
|
||||
19, 26, 33, 34, 27, 20, 28, 35,
|
||||
36,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
|
||||
63, 63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
|
||||
const int jpeg_natural_order4[4*4+16] = {
|
||||
0, 1, 8, 16, 9, 2, 3, 10,
|
||||
17, 24, 25, 18, 11, 19, 26, 27,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
|
||||
63, 63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
|
||||
const int jpeg_natural_order3[3*3+16] = {
|
||||
0, 1, 8, 16, 9, 2, 10, 17,
|
||||
18,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
|
||||
63, 63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
|
||||
const int jpeg_natural_order2[2*2+16] = {
|
||||
0, 1, 8, 9,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
|
||||
63, 63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Arithmetic utilities
|
||||
@@ -96,13 +148,27 @@ jround_up (long a, long b)
|
||||
* is not all that great, because these routines aren't very heavily used.)
|
||||
*/
|
||||
|
||||
#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */
|
||||
#ifndef NEED_FAR_POINTERS /* normal case, same as regular macro */
|
||||
#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size)
|
||||
#define FMEMZERO(target,size) MEMZERO(target,size)
|
||||
#else /* 80x86 case, define if we can */
|
||||
#ifdef USE_FMEM
|
||||
#define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size))
|
||||
#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size))
|
||||
#else
|
||||
/* This function is for use by the FMEMZERO macro defined in jpegint.h.
|
||||
* Do not call this function directly, use the FMEMZERO macro instead.
|
||||
*/
|
||||
GLOBAL(void)
|
||||
jzero_far (void FAR * target, size_t bytestozero)
|
||||
/* Zero out a chunk of FAR memory. */
|
||||
/* This might be sample-array data, block-array data, or alloc_large data. */
|
||||
{
|
||||
register char FAR * ptr = (char FAR *) target;
|
||||
register size_t count;
|
||||
|
||||
for (count = bytestozero; count > 0; count--) {
|
||||
*ptr++ = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -159,21 +225,3 @@ jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
GLOBAL(void)
|
||||
jzero_far (void FAR * target, size_t bytestozero)
|
||||
/* Zero out a chunk of FAR memory. */
|
||||
/* This might be sample-array data, block-array data, or alloc_large data. */
|
||||
{
|
||||
#ifdef FMEMZERO
|
||||
FMEMZERO(target, bytestozero);
|
||||
#else
|
||||
register char FAR * ptr = (char FAR *) target;
|
||||
register size_t count;
|
||||
|
||||
for (count = bytestozero; count > 0; count--) {
|
||||
*ptr++ = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jversion.h
|
||||
*
|
||||
* Copyright (C) 1991-2009, 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.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -9,6 +9,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#define JVERSION "7 27-Jun-2009"
|
||||
#define JVERSION "9b 17-Jan-2016"
|
||||
|
||||
#define JCOPYRIGHT "Copyright (C) 2009, Thomas G. Lane, Guido Vollbeding"
|
||||
#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
LIBJPEG_7.0 {
|
||||
LIBJPEG_9.0 {
|
||||
global:
|
||||
*;
|
||||
};
|
||||
|
||||
212
libjpeg.txt
212
libjpeg.txt
@@ -1,6 +1,6 @@
|
||||
USING THE IJG JPEG LIBRARY
|
||||
|
||||
Copyright (C) 1994-2009, 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.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
@@ -95,8 +95,8 @@ use.) Unsupported ISO options include:
|
||||
* Lossless JPEG
|
||||
* DNL marker
|
||||
* Nonintegral subsampling ratios
|
||||
We support both 8- and 12-bit data precision, but this is a compile-time
|
||||
choice rather than a run-time choice; hence it is difficult to use both
|
||||
We support 8-bit to 12-bit data precision, but this is a compile-time choice
|
||||
rather than a run-time choice; hence it is difficult to use different
|
||||
precisions in a single application.
|
||||
|
||||
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
|
||||
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
|
||||
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.)
|
||||
|
||||
|
||||
@@ -876,6 +876,22 @@ jpeg_simple_progression (j_compress_ptr cinfo)
|
||||
|
||||
Compression parameters (cinfo fields) include:
|
||||
|
||||
boolean arith_code
|
||||
If TRUE, use arithmetic coding.
|
||||
If FALSE, use Huffman coding.
|
||||
|
||||
int block_size
|
||||
Set DCT block size. All N from 1 to 16 are possible.
|
||||
Default is 8 (baseline format).
|
||||
Larger values produce higher compression,
|
||||
smaller values produce higher quality.
|
||||
An exact DCT stage is possible with 1 or 2.
|
||||
With the default quality of 75 and default Luminance qtable
|
||||
the DCT+Quantization stage is lossless for value 1.
|
||||
Note that values other than 8 require a SmartScale capable decoder,
|
||||
introduced with IJG JPEG 8. Setting the block_size parameter for
|
||||
compression works with version 8c and later.
|
||||
|
||||
J_DCT_METHOD dct_method
|
||||
Selects the algorithm used for the DCT step. Choices are:
|
||||
JDCT_ISLOW: slow but accurate integer algorithm
|
||||
@@ -895,14 +911,25 @@ J_DCT_METHOD dct_method
|
||||
unsigned int scale_num, scale_denom
|
||||
Scale the image by the fraction scale_num/scale_denom. Default is
|
||||
1/1, or no scaling. Currently, the supported scaling ratios are
|
||||
8/N with all N from 1 to 16. (The library design allows for arbitrary
|
||||
scaling ratios but this is not likely to be implemented any time soon.)
|
||||
M/N with all N from 1 to 16, where M is the destination DCT size,
|
||||
which is 8 by default (see block_size parameter above).
|
||||
(The library design allows for arbitrary scaling ratios but this
|
||||
is not likely to be implemented any time soon.)
|
||||
|
||||
J_COLOR_SPACE jpeg_color_space
|
||||
int num_components
|
||||
The JPEG color space and corresponding number of components; see
|
||||
"Special color spaces", below, for more info. We recommend using
|
||||
jpeg_set_color_space() if you want to change these.
|
||||
jpeg_set_colorspace() if you want to change these.
|
||||
|
||||
J_COLOR_TRANSFORM color_transform
|
||||
Internal color transform identifier, writes LSE marker if nonzero
|
||||
(requires decoder with inverse color transform support, introduced
|
||||
with IJG JPEG 9).
|
||||
Two values are currently possible: JCT_NONE and JCT_SUBTRACT_GREEN.
|
||||
Set this value for lossless RGB application *before* calling
|
||||
jpeg_set_colorspace(), because entropy table assignment in
|
||||
jpeg_set_colorspace() depends on color_transform.
|
||||
|
||||
boolean optimize_coding
|
||||
TRUE causes the compressor to compute optimal Huffman coding tables
|
||||
@@ -1123,16 +1150,17 @@ J_COLOR_SPACE out_color_space
|
||||
|
||||
unsigned int scale_num, scale_denom
|
||||
Scale the image by the fraction scale_num/scale_denom. Currently,
|
||||
the supported scaling ratios are N/8 with all N from 1 to 16. (The
|
||||
library design allows for arbitrary scaling ratios but this is not
|
||||
likely to be implemented any time soon.) The values are initialized
|
||||
by jpeg_read_header() with the source DCT size, which is currently
|
||||
8/8. If you change only the scale_num value while leaving the other
|
||||
unchanged, then this specifies the DCT scaled size to be applied on
|
||||
the given input, which is currently equivalent to N/8 scaling, since
|
||||
the source DCT size is currently always 8. Smaller scaling ratios
|
||||
permit significantly faster decoding since fewer pixels need be
|
||||
processed and a simpler IDCT method can be used.
|
||||
the supported scaling ratios are M/N with all M from 1 to 16, where
|
||||
N is the source DCT size, which is 8 for baseline JPEG. (The library
|
||||
design allows for arbitrary scaling ratios but this is not likely
|
||||
to be implemented any time soon.) The values are initialized by
|
||||
jpeg_read_header() with the source DCT size. For baseline JPEG
|
||||
this is 8/8. If you change only the scale_num value while leaving
|
||||
the other unchanged, then this specifies the DCT scaled size to be
|
||||
applied on the given input. For baseline JPEG this is equivalent
|
||||
to M/8 scaling, since the source DCT size for baseline JPEG is 8.
|
||||
Smaller scaling ratios permit significantly faster decoding since
|
||||
fewer pixels need be processed and a simpler IDCT method can be used.
|
||||
|
||||
boolean quantize_colors
|
||||
If set TRUE, colormapped output will be delivered. Default is FALSE,
|
||||
@@ -1245,9 +1273,10 @@ Special color spaces
|
||||
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 before compressing, since this permits greater compression. The
|
||||
existing de-facto JPEG file format standards specify YCbCr or grayscale data
|
||||
(JFIF), or grayscale, RGB, YCbCr, CMYK, or YCCK (Adobe). For special
|
||||
applications such as multispectral images, other color spaces can be used,
|
||||
existing JPEG file interchange format standards specify YCbCr or GRAYSCALE
|
||||
data (JFIF version 1), GRAYSCALE, RGB, YCbCr, CMYK, or YCCK (Adobe), or BG_RGB
|
||||
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.
|
||||
|
||||
The JPEG library can handle the most common colorspace conversions (namely
|
||||
@@ -1264,22 +1293,25 @@ jpeg_set_colorspace(). Of course you must select a supported transformation.
|
||||
jccolor.c currently supports the following transformations:
|
||||
RGB => YCbCr
|
||||
RGB => GRAYSCALE
|
||||
RGB => BG_YCC
|
||||
YCbCr => GRAYSCALE
|
||||
YCbCr => BG_YCC
|
||||
CMYK => YCCK
|
||||
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
|
||||
indicate the color space of the JPEG file. It is important to ensure that
|
||||
these are written correctly, or omitted if the JPEG file's color space is not
|
||||
one of the ones supported by the de-facto standards. jpeg_set_colorspace()
|
||||
will set the compression parameters to include or omit the APPn markers
|
||||
properly, so long as it is told the truth about the JPEG color space.
|
||||
For example, if you are writing some random 3-component color space without
|
||||
conversion, don't try to fake out the library by setting in_color_space and
|
||||
jpeg_color_space to JCS_YCbCr; use JCS_UNKNOWN. You may want to write an
|
||||
APPn marker of your own devising to identify the colorspace --- see "Special
|
||||
markers", below.
|
||||
The file interchange format standards (JFIF and Adobe) specify APPn markers
|
||||
that indicate the color space of the JPEG file. It is important to ensure
|
||||
that these are written correctly, or omitted if the JPEG file's color space
|
||||
is not one of the ones supported by the interchange standards.
|
||||
jpeg_set_colorspace() will set the compression parameters to include or omit
|
||||
the APPn markers properly, so long as it is told the truth about the JPEG
|
||||
color space. For example, if you are writing some random 3-component color
|
||||
space without conversion, don't try to fake out the library by setting
|
||||
in_color_space and jpeg_color_space to JCS_YCbCr; use JCS_UNKNOWN.
|
||||
You may want to write an APPn marker of your own devising to identify
|
||||
the colorspace --- see "Special markers", below.
|
||||
|
||||
When told that the color space is UNKNOWN, the library will default to using
|
||||
luminance-quality compression parameters for all color components. You may
|
||||
@@ -1295,8 +1327,11 @@ jpeg_read_header's guess by setting jpeg_color_space. jpeg_read_header also
|
||||
selects a default output color space based on (its guess of) jpeg_color_space;
|
||||
set out_color_space to override this. Again, you must select a supported
|
||||
transformation. jdcolor.c currently supports
|
||||
YCbCr => GRAYSCALE
|
||||
YCbCr => RGB
|
||||
YCbCr => GRAYSCALE
|
||||
BG_YCC => RGB
|
||||
BG_YCC => GRAYSCALE
|
||||
RGB => GRAYSCALE
|
||||
GRAYSCALE => RGB
|
||||
YCCK => CMYK
|
||||
as well as the null transforms. (Since GRAYSCALE=>RGB is provided, an
|
||||
@@ -1432,21 +1467,22 @@ Compressed data handling (source and destination managers)
|
||||
|
||||
The JPEG compression library sends its compressed data to a "destination
|
||||
manager" module. The default destination manager just writes the data to a
|
||||
stdio stream, but you can provide your own manager to do something else.
|
||||
Similarly, the decompression library calls a "source manager" to obtain the
|
||||
compressed data; you can provide your own source manager if you want the data
|
||||
to come from somewhere other than a stdio stream.
|
||||
memory buffer or to a stdio stream, but you can provide your own manager to
|
||||
do something else. Similarly, the decompression library calls a "source
|
||||
manager" to obtain the compressed data; you can provide your own source
|
||||
manager if you want the data to come from somewhere other than a memory
|
||||
buffer or a stdio stream.
|
||||
|
||||
In both cases, compressed data is processed a bufferload at a time: the
|
||||
destination or source manager provides a work buffer, and the library invokes
|
||||
the manager only when the buffer is filled or emptied. (You could define a
|
||||
one-character buffer to force the manager to be invoked for each byte, but
|
||||
that would be rather inefficient.) The buffer's size and location are
|
||||
controlled by the manager, not by the library. For example, if you desired to
|
||||
decompress a JPEG datastream that was all in memory, you could just make the
|
||||
buffer pointer and length point to the original data in memory. Then the
|
||||
buffer-reload procedure would be invoked only if the decompressor ran off the
|
||||
end of the datastream, which would indicate an erroneous datastream.
|
||||
controlled by the manager, not by the library. For example, the memory
|
||||
source manager just makes the buffer pointer and length point to the original
|
||||
data in memory. In this case the buffer-reload procedure will be invoked
|
||||
only if the decompressor ran off the end of the datastream, which would
|
||||
indicate an erroneous datastream.
|
||||
|
||||
The work buffer is defined as an array of datatype JOCTET, which is generally
|
||||
"char" or "unsigned char". On a machine where char is not exactly 8 bits
|
||||
@@ -1498,7 +1534,8 @@ You will also need code to create a jpeg_destination_mgr struct, fill in its
|
||||
method pointers, and insert a pointer to the struct into the "dest" field of
|
||||
the JPEG compression object. This can be done in-line in your setup code if
|
||||
you like, but it's probably cleaner to provide a separate routine similar to
|
||||
the jpeg_stdio_dest() routine of the supplied destination manager.
|
||||
the jpeg_stdio_dest() or jpeg_mem_dest() routines of the supplied destination
|
||||
managers.
|
||||
|
||||
Decompression source managers follow a parallel design, but with some
|
||||
additional frammishes. The source manager struct contains a pointer and count
|
||||
@@ -1574,10 +1611,10 @@ You will also need code to create a jpeg_source_mgr struct, fill in its method
|
||||
pointers, and insert a pointer to the struct into the "src" field of the JPEG
|
||||
decompression object. This can be done in-line in your setup code if you
|
||||
like, but it's probably cleaner to provide a separate routine similar to the
|
||||
jpeg_stdio_src() routine of the supplied source manager.
|
||||
jpeg_stdio_src() or jpeg_mem_src() routines of the supplied source managers.
|
||||
|
||||
For more information, consult the stdio source and destination managers
|
||||
in jdatasrc.c and jdatadst.c.
|
||||
For more information, consult the memory and stdio source and destination
|
||||
managers in jdatasrc.c and jdatadst.c.
|
||||
|
||||
|
||||
I/O suspension
|
||||
@@ -2554,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
|
||||
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
|
||||
multiple of 8 valid samples, and there must be a multiple of 8 sample rows
|
||||
for each component. (For applications such as conversion of digital TV
|
||||
images, the standard image size is usually a multiple of the DCT block size,
|
||||
so that no padding need actually be done.)
|
||||
multiple of block_size valid samples, and there must be a multiple of
|
||||
block_size sample rows for each component. (For applications such as
|
||||
conversion of digital TV images, the standard image size is usually a
|
||||
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
|
||||
compression, except that you call jpeg_write_raw_data() in place of
|
||||
@@ -2583,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.
|
||||
|
||||
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
|
||||
value must be at least max_v_samp_factor*DCTSIZE, and the return value will
|
||||
be exactly that amount (or possibly some multiple of that amount, in future
|
||||
library versions). This is true even on the last call at the bottom of the
|
||||
image; don't forget to pad your data as necessary.
|
||||
v_samp_factor*block_size sample rows of each component. The passed num_lines
|
||||
value must be at least max_v_samp_factor*block_size, and the return value
|
||||
will be exactly that amount (or possibly some multiple of that amount, in
|
||||
future library versions). This is true even on the last call at the bottom
|
||||
of the image; don't forget to pad your data as necessary.
|
||||
|
||||
The required dimensions of the supplied data can be computed for each
|
||||
component as
|
||||
cinfo->comp_info[i].width_in_blocks*DCTSIZE samples per row
|
||||
cinfo->comp_info[i].height_in_blocks*DCTSIZE rows in image
|
||||
cinfo->comp_info[i].width_in_blocks*block_size samples per row
|
||||
cinfo->comp_info[i].height_in_blocks*block_size rows in image
|
||||
after jpeg_start_compress() has initialized those fields. If the valid data
|
||||
is smaller than this, it must be padded appropriately. For some sampling
|
||||
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
|
||||
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
|
||||
cinfo->comp_info[0].h_samp_factor = 2 for Y
|
||||
cinfo->comp_info[0].v_samp_factor = 2
|
||||
@@ -2640,8 +2677,8 @@ Then call jpeg_read_raw_data() in place of jpeg_read_scanlines(). The
|
||||
decompression process is otherwise the same as usual.
|
||||
|
||||
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
|
||||
the same as for raw-data compression). The buffer you pass must be large
|
||||
buffer of at least max_v_samp_factor*block_size scanlines (scanline counting
|
||||
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
|
||||
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
|
||||
@@ -2897,10 +2934,10 @@ This does not count any memory allocated by the application, such as a
|
||||
buffer to hold the final output image.
|
||||
|
||||
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
|
||||
quantization pixel buffer. The "fixed-size" data will be somewhat smaller
|
||||
with 16-bit ints, larger with 64-bit ints. Also, CMYK or other unusual
|
||||
color spaces will require different amounts of space.
|
||||
32-bit ints. For 9-bit to 12-bit JPEG data, double the size of the strip
|
||||
buffers and quantization pixel buffer. The "fixed-size" data will be
|
||||
somewhat smaller with 16-bit ints, larger with 64-bit ints. Also, CMYK
|
||||
or other unusual color spaces will require different amounts of space.
|
||||
|
||||
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
|
||||
@@ -2922,27 +2959,34 @@ Library compile-time options
|
||||
|
||||
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
|
||||
a 12-bit DCT process. The IJG code supports 12-bit lossy JPEG if you define
|
||||
BITS_IN_JSAMPLE as 12 rather than 8. Note that this causes JSAMPLE to be
|
||||
larger than a char, so it affects the surrounding application's image data.
|
||||
The sample applications cjpeg and djpeg can support 12-bit mode only for PPM
|
||||
and GIF file formats; you must disable the other file formats to compile a
|
||||
12-bit cjpeg or djpeg. (install.txt has more information about that.)
|
||||
At present, a 12-bit library can handle *only* 12-bit images, not both
|
||||
precisions. (If you need to include both 8- and 12-bit libraries 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 12-bit copies
|
||||
from separate application source files. This is untested ... if you try it,
|
||||
we'd like to hear whether it works!)
|
||||
The IJG code currently supports 8-bit to 12-bit sample data precision by
|
||||
defining BITS_IN_JSAMPLE as 8, 9, 10, 11, or 12.
|
||||
Note that a value larger than 8 causes JSAMPLE to be larger than a char,
|
||||
so it affects the surrounding application's image data.
|
||||
The sample applications cjpeg and djpeg can support deeper than 8-bit data
|
||||
only for PPM and GIF file formats; you must disable the other file formats
|
||||
to compile a 9-bit to 12-bit cjpeg or djpeg. (install.txt has more
|
||||
information about that.)
|
||||
Run-time selection and conversion of data precision are currently not
|
||||
supported and may be added later.
|
||||
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.
|
||||
(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,
|
||||
in order to generate valid Huffman tables. This is necessary because our
|
||||
default Huffman tables only cover 8-bit data. If you need to output 12-bit
|
||||
files in one pass, you'll have to supply suitable default Huffman tables.
|
||||
You may also want to supply your own DCT quantization tables; the existing
|
||||
quality-scaling code has been developed for 8-bit use, and probably doesn't
|
||||
generate especially good tables for 12-bit.
|
||||
Note that the standard Huffman tables are only valid for 8-bit data precision.
|
||||
If 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. You may also want to supply your
|
||||
own DCT quantization tables; the existing quality-scaling code has been
|
||||
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
|
||||
by MAX_COMPONENTS. The JPEG standard allows up to 255 components, but we
|
||||
|
||||
33
makeasln.v10
Normal file
33
makeasln.v10
Normal file
@@ -0,0 +1,33 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD>
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cjpeg", "cjpeg.vcxproj", "{2E7FAAD9-2F58-4BDE-81F2-1D6D3FB8BF57}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "djpeg", "djpeg.vcxproj", "{11043137-B453-4DFA-9010-4D2B9DC1545C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpegtran", "jpegtran.vcxproj", "{025BAC50-51B5-4FFE-BC47-3F920BB4047E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rdjpgcom", "rdjpgcom.vcxproj", "{C81513DB-78DC-46BC-BC98-82E745203976}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wrjpgcom", "wrjpgcom.vcxproj", "{B57065D4-DDDA-4668-BAF5-2D49270C973C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2E7FAAD9-2F58-4BDE-81F2-1D6D3FB8BF57}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2E7FAAD9-2F58-4BDE-81F2-1D6D3FB8BF57}.Release|Win32.Build.0 = Release|Win32
|
||||
{11043137-B453-4DFA-9010-4D2B9DC1545C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{11043137-B453-4DFA-9010-4D2B9DC1545C}.Release|Win32.Build.0 = Release|Win32
|
||||
{025BAC50-51B5-4FFE-BC47-3F920BB4047E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{025BAC50-51B5-4FFE-BC47-3F920BB4047E}.Release|Win32.Build.0 = Release|Win32
|
||||
{C81513DB-78DC-46BC-BC98-82E745203976}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C81513DB-78DC-46BC-BC98-82E745203976}.Release|Win32.Build.0 = Release|Win32
|
||||
{B57065D4-DDDA-4668-BAF5-2D49270C973C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B57065D4-DDDA-4668-BAF5-2D49270C973C}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
33
makeasln.vc9
33
makeasln.vc9
@@ -1,33 +0,0 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD>
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cjpeg", "cjpeg.vcproj", "{B4F61778-C45D-45C6-9E87-06F03F50519F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "djpeg", "djpeg.vcproj", "{9B7E57AE-31CD-405E-8070-26A8303B9DC9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpegtran", "jpegtran.vcproj", "{813C33AF-9031-49D2-BA19-93D600CDD404}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rdjpgcom", "rdjpgcom.vcproj", "{EB107F86-A8CC-4507-8115-88D31DDE4CDF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wrjpgcom", "wrjpgcom.vcproj", "{178670D7-FA7F-44A8-96C7-11B1CA14269C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B4F61778-C45D-45C6-9E87-06F03F50519F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B4F61778-C45D-45C6-9E87-06F03F50519F}.Release|Win32.Build.0 = Release|Win32
|
||||
{9B7E57AE-31CD-405E-8070-26A8303B9DC9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9B7E57AE-31CD-405E-8070-26A8303B9DC9}.Release|Win32.Build.0 = Release|Win32
|
||||
{813C33AF-9031-49D2-BA19-93D600CDD404}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{813C33AF-9031-49D2-BA19-93D600CDD404}.Release|Win32.Build.0 = Release|Win32
|
||||
{EB107F86-A8CC-4507-8115-88D31DDE4CDF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EB107F86-A8CC-4507-8115-88D31DDE4CDF}.Release|Win32.Build.0 = Release|Win32
|
||||
{178670D7-FA7F-44A8-96C7-11B1CA14269C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{178670D7-FA7F-44A8-96C7-11B1CA14269C}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
69
makecfil.v10
Normal file
69
makecfil.v10
Normal file
@@ -0,0 +1,69 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="cderror.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cdjpeg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jconfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jerror.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jinclude.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jmorecfg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jpeglib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jversion.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="cdjpeg.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cjpeg.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rdbmp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rdgif.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rdppm.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rdrle.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rdswitch.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rdtarga.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
186
makecvcp.vc9
186
makecvcp.vc9
@@ -1,186 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="cjpeg"
|
||||
ProjectGUID="{B4F61778-C45D-45C6-9E87-06F03F50519F}"
|
||||
RootNamespace="cjpeg"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ProjectName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
EnableIntrinsicFunctions="false"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Release\jpeg.lib"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Quelldateien"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\cdjpeg.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\cjpeg.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\rdbmp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\rdgif.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\rdppm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\rdrle.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\rdswitch.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\rdtarga.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Headerdateien"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\cderror.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\cdjpeg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jconfig.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jerror.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jinclude.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jmorecfg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jpeglib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jversion.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Ressourcendateien"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
76
makecvcx.v10
Normal file
76
makecvcx.v10
Normal file
@@ -0,0 +1,76 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2E7FAAD9-2F58-4BDE-81F2-1D6D3FB8BF57}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>cjpeg</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>Release\jpeg.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="cderror.h" />
|
||||
<ClInclude Include="cdjpeg.h" />
|
||||
<ClInclude Include="jconfig.h" />
|
||||
<ClInclude Include="jerror.h" />
|
||||
<ClInclude Include="jinclude.h" />
|
||||
<ClInclude Include="jmorecfg.h" />
|
||||
<ClInclude Include="jpeglib.h" />
|
||||
<ClInclude Include="jversion.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="cdjpeg.c" />
|
||||
<ClCompile Include="cjpeg.c" />
|
||||
<ClCompile Include="rdbmp.c" />
|
||||
<ClCompile Include="rdgif.c" />
|
||||
<ClCompile Include="rdppm.c" />
|
||||
<ClCompile Include="rdrle.c" />
|
||||
<ClCompile Include="rdswitch.c" />
|
||||
<ClCompile Include="rdtarga.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
69
makedfil.v10
Normal file
69
makedfil.v10
Normal file
@@ -0,0 +1,69 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="cderror.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cdjpeg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jconfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jerror.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jinclude.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jmorecfg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jpeglib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jversion.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="cdjpeg.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="djpeg.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rdcolmap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wrbmp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wrgif.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wrppm.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wrrle.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wrtarga.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
186
makedvcp.vc9
186
makedvcp.vc9
@@ -1,186 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="djpeg"
|
||||
ProjectGUID="{9B7E57AE-31CD-405E-8070-26A8303B9DC9}"
|
||||
RootNamespace="djpeg"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ProjectName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
EnableIntrinsicFunctions="false"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Release\jpeg.lib"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Quelldateien"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\cdjpeg.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\djpeg.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\rdcolmap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\wrbmp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\wrgif.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\wrppm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\wrrle.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\wrtarga.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Headerdateien"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\cderror.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\cdjpeg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jconfig.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jerror.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jinclude.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jmorecfg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jpeglib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jversion.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Ressourcendateien"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
76
makedvcx.v10
Normal file
76
makedvcx.v10
Normal file
@@ -0,0 +1,76 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{11043137-B453-4DFA-9010-4D2B9DC1545C}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>djpeg</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>Release\jpeg.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="cderror.h" />
|
||||
<ClInclude Include="cdjpeg.h" />
|
||||
<ClInclude Include="jconfig.h" />
|
||||
<ClInclude Include="jerror.h" />
|
||||
<ClInclude Include="jinclude.h" />
|
||||
<ClInclude Include="jmorecfg.h" />
|
||||
<ClInclude Include="jpeglib.h" />
|
||||
<ClInclude Include="jversion.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="cdjpeg.c" />
|
||||
<ClCompile Include="djpeg.c" />
|
||||
<ClCompile Include="rdcolmap.c" />
|
||||
<ClCompile Include="wrbmp.c" />
|
||||
<ClCompile Include="wrgif.c" />
|
||||
<ClCompile Include="wrppm.c" />
|
||||
<ClCompile Include="wrrle.c" />
|
||||
<ClCompile Include="wrtarga.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -60,22 +60,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
243
makefile.b32
Normal file
243
makefile.b32
Normal 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
|
||||
27
makefile.bcc
27
makefile.bcc
@@ -87,22 +87,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
27
makefile.dj
27
makefile.dj
@@ -60,22 +60,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
@@ -61,22 +61,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
27
makefile.mc6
27
makefile.mc6
@@ -58,22 +58,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
27
makefile.mms
27
makefile.mms
@@ -47,22 +47,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
27
makefile.sas
27
makefile.sas
@@ -69,22 +69,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
@@ -64,22 +64,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
|
||||
86
makefile.vc
86
makefile.vc
@@ -57,22 +57,23 @@ 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 \
|
||||
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.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.vc9 \
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
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) \
|
||||
@@ -130,8 +131,48 @@ clean:
|
||||
$(RM) *.obj *.exe libjpeg.lib
|
||||
$(RM) testout*
|
||||
|
||||
test: cjpeg.exe djpeg.exe jpegtran.exe
|
||||
$(RM) testout*
|
||||
setup-vc6:
|
||||
ren jconfig.vc jconfig.h
|
||||
ren makejdsw.vc6 jpeg.dsw
|
||||
ren makeadsw.vc6 apps.dsw
|
||||
ren makejmak.vc6 jpeg.mak
|
||||
ren makejdep.vc6 jpeg.dep
|
||||
ren makejdsp.vc6 jpeg.dsp
|
||||
ren makecmak.vc6 cjpeg.mak
|
||||
ren makecdep.vc6 cjpeg.dep
|
||||
ren makecdsp.vc6 cjpeg.dsp
|
||||
ren makedmak.vc6 djpeg.mak
|
||||
ren makeddep.vc6 djpeg.dep
|
||||
ren makeddsp.vc6 djpeg.dsp
|
||||
ren maketmak.vc6 jpegtran.mak
|
||||
ren maketdep.vc6 jpegtran.dep
|
||||
ren maketdsp.vc6 jpegtran.dsp
|
||||
ren makermak.vc6 rdjpgcom.mak
|
||||
ren makerdep.vc6 rdjpgcom.dep
|
||||
ren makerdsp.vc6 rdjpgcom.dsp
|
||||
ren makewmak.vc6 wrjpgcom.mak
|
||||
ren makewdep.vc6 wrjpgcom.dep
|
||||
ren makewdsp.vc6 wrjpgcom.dsp
|
||||
|
||||
setup-v10:
|
||||
ren jconfig.vc jconfig.h
|
||||
ren makejsln.v10 jpeg.sln
|
||||
ren makeasln.v10 apps.sln
|
||||
ren makejvcx.v10 jpeg.vcxproj
|
||||
ren makejfil.v10 jpeg.vcxproj.filters
|
||||
ren makecvcx.v10 cjpeg.vcxproj
|
||||
ren makecfil.v10 cjpeg.vcxproj.filters
|
||||
ren makedvcx.v10 djpeg.vcxproj
|
||||
ren makedfil.v10 djpeg.vcxproj.filters
|
||||
ren maketvcx.v10 jpegtran.vcxproj
|
||||
ren maketfil.v10 jpegtran.vcxproj.filters
|
||||
ren makervcx.v10 rdjpgcom.vcxproj
|
||||
ren makerfil.v10 rdjpgcom.vcxproj.filters
|
||||
ren makewvcx.v10 wrjpgcom.vcxproj
|
||||
ren makewfil.v10 wrjpgcom.vcxproj.filters
|
||||
|
||||
test:
|
||||
IF EXIST testout* $(RM) 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
|
||||
@@ -145,6 +186,21 @@ test: cjpeg.exe djpeg.exe jpegtran.exe
|
||||
fc /b testimgp.jpg testoutp.jpg
|
||||
fc /b testorig.jpg testoutt.jpg
|
||||
|
||||
test-build:
|
||||
IF EXIST testout* $(RM) testout*
|
||||
.\djpeg\Release\djpeg -dct int -ppm -outfile testout.ppm testorig.jpg
|
||||
.\djpeg\Release\djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg
|
||||
.\cjpeg\Release\cjpeg -dct int -outfile testout.jpg testimg.ppm
|
||||
.\djpeg\Release\djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
|
||||
.\cjpeg\Release\cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
|
||||
.\jpegtran\Release\jpegtran -outfile testoutt.jpg testprog.jpg
|
||||
fc /b testimg.ppm testout.ppm
|
||||
fc /b testimg.bmp testout.bmp
|
||||
fc /b testimg.jpg testout.jpg
|
||||
fc /b testimg.ppm testoutp.ppm
|
||||
fc /b testimgp.jpg testoutp.jpg
|
||||
fc /b testorig.jpg testoutt.jpg
|
||||
|
||||
|
||||
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
|
||||
|
||||
27
makefile.wat
27
makefile.wat
@@ -59,22 +59,23 @@ 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 &
|
||||
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.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.vc9 &
|
||||
makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 &
|
||||
makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st &
|
||||
makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms &
|
||||
makefile.vms makvms.opt
|
||||
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
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm &
|
||||
libjpeg.map
|
||||
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) &
|
||||
|
||||
186
makejfil.v10
Normal file
186
makejfil.v10
Normal file
@@ -0,0 +1,186 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="jconfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jdct.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jerror.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jinclude.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jmemsys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jmorecfg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jpegint.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jpeglib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jversion.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="jaricom.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcapimin.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcapistd.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcarith.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jccoefct.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jccolor.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcdctmgr.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jchuff.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcinit.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcmainct.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcmarker.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcmaster.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcomapi.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcparam.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcprepct.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jcsample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jctrans.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdapimin.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdapistd.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdarith.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdatadst.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdatasrc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdcoefct.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdcolor.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jddctmgr.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdhuff.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdinput.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdmainct.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdmarker.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdmaster.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdmerge.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdpostct.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdsample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jdtrans.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jerror.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jfdctflt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jfdctfst.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jfdctint.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jidctflt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jidctfst.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jidctint.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jmemmgr.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jmemnobs.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jquant1.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jquant2.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="jutils.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,15 +1,15 @@
|
||||
‹¯¨
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "jpeg.vcproj", "{E61592E1-28F4-4AFC-9EE1-9BE833A061C1}"
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "jpeg.vcxproj", "{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E61592E1-28F4-4AFC-9EE1-9BE833A061C1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E61592E1-28F4-4AFC-9EE1-9BE833A061C1}.Release|Win32.Build.0 = Release|Win32
|
||||
{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
328
makejvcp.vc9
328
makejvcp.vc9
@@ -1,328 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="jpeg"
|
||||
ProjectGUID="{E61592E1-28F4-4AFC-9EE1-9BE833A061C1}"
|
||||
RootNamespace="jpeg"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
EnableIntrinsicFunctions="false"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Quelldateien"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\jaricom.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcapimin.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcapistd.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcarith.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jccoefct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jccolor.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcdctmgr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jchuff.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcinit.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcmainct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcmarker.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcmaster.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcomapi.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcparam.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcprepct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jcsample.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jctrans.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdapimin.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdapistd.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdarith.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdatadst.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdatasrc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdcoefct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdcolor.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jddctmgr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdhuff.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdinput.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdmainct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdmarker.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdmaster.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdmerge.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdpostct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdsample.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdtrans.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jerror.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jfdctflt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jfdctfst.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jfdctint.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jidctflt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jidctfst.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jidctint.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jmemmgr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jmemnobs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jquant1.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jquant2.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jutils.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Headerdateien"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\jconfig.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jdct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jerror.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jinclude.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jmemsys.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jmorecfg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jpegint.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jpeglib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\jversion.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Ressourcendateien"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user