Add wasm tacle-bench targets
This commit is contained in:
26
targets/wasm-tacle/sequential/cjpeg_wrbmp/CMakeLists.txt
Normal file
26
targets/wasm-tacle/sequential/cjpeg_wrbmp/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
||||
# ~~~
|
||||
# SPDX-License-Identifier: MIT
|
||||
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
|
||||
# ~~~
|
||||
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(cjpeg_wrbmp)
|
||||
|
||||
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
|
||||
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
|
||||
|
||||
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
|
||||
set(APP_SOURCE_FILE_PATH
|
||||
"generated/modified_sources/inline/cjpeg_wrbmp.c")
|
||||
else()
|
||||
set(APP_SOURCE_FILE_PATH
|
||||
"generated/modified_sources/default/cjpeg_wrbmp.c"
|
||||
"generated/modified_sources/default/input.c")
|
||||
endif()
|
||||
|
||||
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)
|
||||
|
||||
|
||||
104
targets/wasm-tacle/sequential/cjpeg_wrbmp/ChangeLog.txt
Executable file
104
targets/wasm-tacle/sequential/cjpeg_wrbmp/ChangeLog.txt
Executable file
@ -0,0 +1,104 @@
|
||||
File: cjpeg_jpeg6b_wrbmp.c
|
||||
Original provenience:
|
||||
|
||||
2017-04-18:
|
||||
- Annotated cjpeg_wrbmp_main as entry-point for timing analysis
|
||||
|
||||
2015-10-14:
|
||||
- Remove comment on line 1
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Changed struct name to cjpeg_jpeg6b_wrbmp_name
|
||||
- Changed the global variable from {name} to cjpeg_jpeg6b_wrbmp_{name}
|
||||
- Changed the functions from {name} to cjpeg_jpeg6b_wrbmp_{name}
|
||||
- Removed code in comment
|
||||
- Added cjpeg_jpeg6b_wrbmp_main()
|
||||
- Added cjpeg_jpeg6b_wrbmp_return()
|
||||
- Added cjpeg_jpeg6b_wrbmp_init()
|
||||
- Added forward declaration of the functions
|
||||
- Removed unused variables: test_image[] and color_map[]
|
||||
- Applied Code Style
|
||||
|
||||
File: input.c
|
||||
Original provenience:
|
||||
|
||||
2015-10-12:
|
||||
- Remove comment on line 1
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Removed _jpeg6b_ from the prefix
|
||||
- Changed the global variable from colormap to cjpeg_jpeg6b_wrbmp_colormap
|
||||
- Removed unused variables: test_image[] and color_map[]
|
||||
- Moved initialization of cjpeg_jpeg6b_wrbmp_colormap to function. This function is called from cjpeg_jpeg6b_wrbmp_init function
|
||||
- Applied Code Style
|
||||
|
||||
File: cderror.h
|
||||
Original provenience:
|
||||
|
||||
2015-10-12:
|
||||
- Remove comment on line 1
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Removed _jpeg6b_ from the prefix
|
||||
- Changed JMESSAGE to CJPEG_JPEG6B_WRBMP_JMESSAGE
|
||||
- Changed JMAKE_ENUM_LIST to CJPEG_JPEG6B_WRBMP_JMAKE_ENUM_LIST
|
||||
- Applied Code Style
|
||||
|
||||
|
||||
File: cdjpeg.h
|
||||
Original provenience:
|
||||
|
||||
2015-10-12:
|
||||
- Remove comment on line 1
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Rename structs and typedef to cjpeg_jpeg6b_wrbmp_{name}
|
||||
- Removed unused defines
|
||||
|
||||
File: jconfig.h
|
||||
Original provenience:
|
||||
|
||||
2015-10-12:
|
||||
- Remove comment on line 1
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Change defines to CJPEG_JPEG6B_WRBMP_{NAME}
|
||||
- Removed _jpeg6b_ from the prefix
|
||||
- Applied Code Style
|
||||
|
||||
|
||||
File: jerror.h
|
||||
Original provenience:
|
||||
|
||||
2015-10-12:
|
||||
- Remove comment on line 1
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Removed error and warning defines
|
||||
- Removed _jpeg6b_ from the prefix
|
||||
- Applied Code Style
|
||||
|
||||
|
||||
File: jmorecfg.h
|
||||
Original provenience:
|
||||
|
||||
2015-10-12:
|
||||
- Remove comment on line 1
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Removed unused comments
|
||||
- Removed _jpeg6b_ from the prefix
|
||||
- Removed unused defines
|
||||
- Removed unused typedefs
|
||||
- Applied Code Style
|
||||
|
||||
|
||||
File: jpeglib.h
|
||||
Original provenience:
|
||||
|
||||
2015-10-12:
|
||||
- Remove comment on line 1
|
||||
- Used define value directly
|
||||
- Remove unused typedefs, defines
|
||||
- Removed _jpeg6b_ from the prefix
|
||||
- Changed struct name to cjpeg_jpeg6b_wrbmp_{name}
|
||||
- Changed define {name} to cjpeg_jpeg6b_wrbmp_{name}
|
||||
- Added generic TACLeBench header to line 1
|
||||
- Applied Code Style
|
||||
|
||||
|
||||
|
||||
|
||||
383
targets/wasm-tacle/sequential/cjpeg_wrbmp/README
Executable file
383
targets/wasm-tacle/sequential/cjpeg_wrbmp/README
Executable file
@ -0,0 +1,383 @@
|
||||
The Independent JPEG Group's JPEG software
|
||||
==========================================
|
||||
|
||||
README for release 6a of 7-Feb-96
|
||||
=================================
|
||||
|
||||
This distribution contains the sixth 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.
|
||||
|
||||
Serious users of this software (particularly those incorporating it into
|
||||
larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to
|
||||
our electronic mailing list. Mailing list members are notified of updates
|
||||
and have a chance to participate in technical discussions, etc.
|
||||
|
||||
This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz, Jim
|
||||
Boucher, Lee Crocker, Julian Minguillon, 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.
|
||||
|
||||
|
||||
DOCUMENTATION ROADMAP
|
||||
=====================
|
||||
|
||||
This file contains the following sections:
|
||||
|
||||
OVERVIEW General description of JPEG and the IJG software.
|
||||
LEGAL ISSUES Copyright, lack of warranty, terms of distribution.
|
||||
REFERENCES Where to learn more about JPEG.
|
||||
ARCHIVE LOCATIONS Where to find newer versions of this software.
|
||||
RELATED SOFTWARE Other stuff you should get.
|
||||
FILE FORMAT WARS Software *not* to get.
|
||||
TO DO Plans for future IJG releases.
|
||||
|
||||
Other documentation files in the distribution are:
|
||||
|
||||
User documentation:
|
||||
install.doc How to configure and install the IJG software.
|
||||
usage.doc Usage instructions for cjpeg, djpeg, jpegtran,
|
||||
rdjpgcom, and wrjpgcom.
|
||||
*.1 Unix-style man pages for programs (same info as usage.doc).
|
||||
wizard.doc Advanced usage instructions for JPEG wizards only.
|
||||
change.log Version-to-version change highlights.
|
||||
Programmer and internal documentation:
|
||||
libjpeg.doc How to use the JPEG library in your own programs.
|
||||
example.c Sample code for calling the JPEG library.
|
||||
structure.doc Overview of the JPEG library's internal structure.
|
||||
filelist.doc Road map of IJG files.
|
||||
coderules.doc Coding style rules --- please read if you contribute code.
|
||||
|
||||
Please read at least the files install.doc and usage.doc. Useful information
|
||||
can also be found in the JPEG FAQ (Frequently Asked Questions) article. See
|
||||
ARCHIVE LOCATIONS below to find out where to obtain the FAQ article.
|
||||
|
||||
If you want to understand how the JPEG code works, we suggest reading one or
|
||||
more of the REFERENCES, then looking at the documentation files (in roughly
|
||||
the order listed) before diving into the code.
|
||||
|
||||
|
||||
OVERVIEW
|
||||
========
|
||||
|
||||
This package contains C software to implement JPEG image compression and
|
||||
decompression. JPEG (pronounced "jay-peg") is a standardized compression
|
||||
method for full-color and gray-scale images. JPEG is intended for compressing
|
||||
"real-world" scenes; line drawings, cartoons and other non-realistic images
|
||||
are not its strong suit. JPEG is lossy, meaning that the output image is not
|
||||
exactly identical to the input image. Hence you must not use JPEG if you
|
||||
have to have identical output bits. However, on typical photographic images,
|
||||
very good compression levels can be obtained with no visible change, and
|
||||
remarkably high compression levels are possible if you can tolerate a
|
||||
low-quality image. For more details, see the references, or just experiment
|
||||
with various compression settings.
|
||||
|
||||
This software implements JPEG baseline, extended-sequential, and progressive
|
||||
compression processes. Provision is made for supporting all variants of these
|
||||
processes, although some uncommon parameter settings aren't implemented yet.
|
||||
For legal reasons, we are not distributing code for the arithmetic-coding
|
||||
variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting
|
||||
the hierarchical or lossless processes defined in the standard.
|
||||
|
||||
We provide a set of library routines for reading and writing JPEG image files,
|
||||
plus two sample applications "cjpeg" and "djpeg", which use the library to
|
||||
perform conversion between JPEG and some other popular image file formats.
|
||||
The library is intended to be reused in other applications.
|
||||
|
||||
In order to support file conversion and viewing software, we have included
|
||||
considerable functionality beyond the bare JPEG coding/decoding capability;
|
||||
for example, the color quantization modules are not strictly part of JPEG
|
||||
decoding, but they are essential for output to colormapped file formats or
|
||||
colormapped displays. These extra functions can be compiled out of the
|
||||
library if not required for a particular application. We have also included
|
||||
"jpegtran", a utility for lossless transcoding between different JPEG
|
||||
processes, and "rdjpgcom" and "wrjpgcom", two simple applications for
|
||||
inserting and extracting textual comments in JFIF files.
|
||||
|
||||
The emphasis in designing this software has been on achieving portability and
|
||||
flexibility, while also making it fast enough to be useful. In particular,
|
||||
the software is not intended to be read as a tutorial on JPEG. (See the
|
||||
REFERENCES section for introductory material.) Rather, it is intended to
|
||||
be reliable, portable, industrial-strength code. We do not claim to have
|
||||
achieved that goal in every aspect of the software, but we strive for it.
|
||||
|
||||
We welcome the use of this software as a component of commercial products.
|
||||
No royalty is required, but we do ask for an acknowledgement in product
|
||||
documentation, as described under LEGAL ISSUES.
|
||||
|
||||
|
||||
LEGAL ISSUES
|
||||
============
|
||||
|
||||
In plain English:
|
||||
|
||||
1. We don't promise that this software works. (But if you find any bugs,
|
||||
please let us know!)
|
||||
2. You can use this software for whatever you want. You don't have to pay us.
|
||||
3. You may not pretend that you wrote this software. If you use it in a
|
||||
program, you must acknowledge somewhere in your documentation that
|
||||
you've used the IJG code.
|
||||
|
||||
In legalese:
|
||||
|
||||
The authors make NO WARRANTY or representation, either express or implied,
|
||||
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-1996, Thomas G. Lane.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to these
|
||||
conditions:
|
||||
(1) If any part of the source code for this software is distributed, then this
|
||||
README file must be included, with this copyright and no-warranty notice
|
||||
unaltered; and any additions, deletions, or changes to the original files
|
||||
must be clearly indicated in accompanying documentation.
|
||||
(2) If only executable code is distributed, then the accompanying
|
||||
documentation must state that "this software is based in part on the work of
|
||||
the Independent JPEG Group".
|
||||
(3) Permission for use of this software is granted only if the user accepts
|
||||
full responsibility for any undesirable consequences; the authors accept
|
||||
NO LIABILITY for damages of any kind.
|
||||
|
||||
These conditions apply to any software derived from or based on the IJG code,
|
||||
not just to the unmodified library. If you use our work, you ought to
|
||||
acknowledge us.
|
||||
|
||||
Permission is NOT granted for the use of any IJG author's name or company name
|
||||
in advertising or publicity relating to this software or products derived from
|
||||
it. This software may be referred to only as "the Independent JPEG Group's
|
||||
software".
|
||||
|
||||
We specifically permit and encourage the use of this software as the basis of
|
||||
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 configuration script "configure" was produced with GNU Autoconf. It
|
||||
is copyright by the Free Software Foundation but is freely distributable.
|
||||
|
||||
It appears that the arithmetic coding option of the JPEG spec is covered by
|
||||
patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
|
||||
legally be used without obtaining one or more licenses. For this reason,
|
||||
support for arithmetic coding has been removed from the free JPEG software.
|
||||
(Since arithmetic coding provides only a marginal gain over the unpatented
|
||||
Huffman mode, it is unlikely that very many implementations will support it.)
|
||||
So far as we are aware, there are no patent restrictions on the remaining
|
||||
code.
|
||||
|
||||
WARNING: Unisys has begun to enforce their patent on LZW compression against
|
||||
GIF encoders and decoders. You will need a license from Unisys to use the
|
||||
included rdgif.c or wrgif.c files in a commercial or shareware application.
|
||||
At this time, Unisys is not enforcing their patent against freeware, so
|
||||
distribution of this package remains legal. However, we intend to remove
|
||||
GIF support from the IJG package as soon as a suitable replacement format
|
||||
becomes reasonably popular.
|
||||
|
||||
We are required to state that
|
||||
"The Graphics Interchange Format(c) is the Copyright property of
|
||||
CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
||||
CompuServe Incorporated."
|
||||
|
||||
|
||||
REFERENCES
|
||||
==========
|
||||
|
||||
We highly recommend reading one or more of these references before trying to
|
||||
understand the innards of the JPEG software.
|
||||
|
||||
The best short technical introduction to the JPEG compression algorithm is
|
||||
Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
|
||||
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 ftp.uu.net, graphics/jpeg/wallace.ps.gz. 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, and it may not be used for commercial purposes.
|
||||
|
||||
A somewhat less technical, more leisurely introduction to JPEG can be found in
|
||||
"The Data Compression Book" by Mark Nelson, published by M&T Books (Redwood
|
||||
City, CA), 1991, ISBN 1-55851-216-0. This book provides good explanations and
|
||||
example C code for a multitude of compression methods including JPEG. It is
|
||||
an excellent source if you are comfortable reading C code but don't know much
|
||||
about data compression in general. The book's JPEG sample code is far from
|
||||
industrial-strength, but when you are ready to look at a full implementation,
|
||||
you've got one here...
|
||||
|
||||
The best full description of JPEG is the textbook "JPEG Still Image Data
|
||||
Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published
|
||||
by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp.
|
||||
The book includes the complete text of the ISO JPEG standards (DIS 10918-1
|
||||
and draft DIS 10918-2). This is by far the most complete exposition of JPEG
|
||||
in existence, and we highly recommend it.
|
||||
|
||||
The JPEG standard itself is not available electronically; you must order a
|
||||
paper copy through ISO or ITU. (Unless you feel a need to own a certified
|
||||
official copy, we recommend buying the Pennebaker and Mitchell book instead;
|
||||
it's much cheaper and includes a great deal of useful explanatory material.)
|
||||
In the USA, copies of the standard may be ordered from ANSI Sales at (212)
|
||||
642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI
|
||||
doesn't take credit card orders, but Global does.) It's not cheap: as of
|
||||
1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7%
|
||||
shipping/handling. The standard is divided into two parts, Part 1 being the
|
||||
actual specification, while Part 2 covers compliance testing methods. Part 1
|
||||
is titled "Digital Compression and Coding of Continuous-tone Still Images,
|
||||
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.
|
||||
|
||||
Extensions to the original JPEG standard are defined in JPEG Part 3, a new ISO
|
||||
document. Part 3 is undergoing ISO balloting and is expected to be approved
|
||||
by the end of 1995; it will have document numbers ISO/IEC IS 10918-3, ITU-T
|
||||
T.84. IJG currently does not support any Part 3 extensions.
|
||||
|
||||
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 ftp.uu.net, file
|
||||
graphics/jpeg/jfif.ps.gz. It can also be obtained by e-mail from the C-Cube
|
||||
mail server, netlib@c3.pla.ca.us. Send the message "send jfif_ps from jpeg"
|
||||
to the server to obtain the JFIF document; send the message "help" if you have
|
||||
trouble.
|
||||
|
||||
The TIFF 6.0 file format specification can be obtained by FTP from sgi.com
|
||||
(192.48.153.1), file graphics/tiff/TIFF6.ps.Z; or you can order a printed
|
||||
copy from Aldus Corp. at (206) 628-6593. The JPEG incorporation scheme
|
||||
found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems.
|
||||
IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6).
|
||||
Instead, we recommend the JPEG design proposed by TIFF Technical Note #2
|
||||
(Compression tag 7). Copies of this Note can be obtained from sgi.com or
|
||||
from ftp.uu.net:/graphics/jpeg/. It is expected that the next revision of
|
||||
the TIFF spec will replace the 6.0 JPEG design with the Note's design.
|
||||
Although IJG's own code does not support TIFF/JPEG, the free libtiff library
|
||||
uses our library to implement TIFF/JPEG per the Note. libtiff is available
|
||||
from sgi.com:/graphics/tiff/.
|
||||
|
||||
|
||||
ARCHIVE LOCATIONS
|
||||
=================
|
||||
|
||||
The "official" archive site for this software is ftp.uu.net (Internet
|
||||
address 192.48.96.9). The most recent released version can always be found
|
||||
there in directory graphics/jpeg. This particular version will be archived
|
||||
as graphics/jpeg/jpegsrc.v6a.tar.gz. If you are on the Internet, you
|
||||
can retrieve files from ftp.uu.net by standard anonymous FTP. If you don't
|
||||
have FTP access, UUNET's archives are also available via UUCP; contact
|
||||
help@uunet.uu.net for information on retrieving files that way.
|
||||
|
||||
Numerous Internet sites maintain copies of the UUNET files. However, only
|
||||
ftp.uu.net is guaranteed to have the latest official version.
|
||||
|
||||
You can also obtain this software in DOS-compatible "zip" archive format from
|
||||
the SimTel archives (ftp.coast.net:/SimTel/msdos/graphics/), or on CompuServe
|
||||
in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 "JPEG Tools".
|
||||
Again, these versions may sometimes lag behind the ftp.uu.net release.
|
||||
|
||||
The JPEG FAQ (Frequently Asked Questions) article is a useful source of
|
||||
general information about JPEG. It is updated constantly and therefore is
|
||||
not included in this distribution. The FAQ is posted every two weeks to
|
||||
Usenet newsgroups comp.graphics.misc, news.answers, and other groups.
|
||||
You can always obtain the latest version from the news.answers archive at
|
||||
rtfm.mit.edu. By FTP, fetch /pub/usenet/news.answers/jpeg-faq/part1 and
|
||||
.../part2. If you don't have FTP, send e-mail to mail-server@rtfm.mit.edu
|
||||
with body
|
||||
send usenet/news.answers/jpeg-faq/part1
|
||||
send usenet/news.answers/jpeg-faq/part2
|
||||
|
||||
|
||||
RELATED SOFTWARE
|
||||
================
|
||||
|
||||
Numerous viewing and image manipulation programs now support JPEG. (Quite a
|
||||
few of them use this library to do so.) The JPEG FAQ described above lists
|
||||
some of the more popular free and shareware viewers, and tells where to
|
||||
obtain them on Internet.
|
||||
|
||||
If you are on a Unix machine, we highly recommend Jef Poskanzer's free
|
||||
PBMPLUS image software, which provides many useful operations on PPM-format
|
||||
image files. In particular, it can convert PPM images to and from a wide
|
||||
range of other formats. You can obtain this package by FTP from ftp.x.org
|
||||
(contrib/pbmplus*.tar.Z) or ftp.ee.lbl.gov (pbmplus*.tar.Z). There is also
|
||||
a newer update of this package called NETPBM, available from
|
||||
wuarchive.wustl.edu under directory /graphics/graphics/packages/NetPBM/.
|
||||
Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software
|
||||
is; you are likely to have difficulty making it work on any non-Unix machine.
|
||||
|
||||
A different free JPEG implementation, written by the PVRG group at Stanford,
|
||||
is available from havefun.stanford.edu in directory pub/jpeg. This program
|
||||
is designed for research and experimentation rather than production use;
|
||||
it is slower, harder to use, and less portable than the IJG code, but it
|
||||
is easier to read and modify. Also, the PVRG code supports lossless JPEG,
|
||||
which we do not.
|
||||
|
||||
|
||||
FILE FORMAT WARS
|
||||
================
|
||||
|
||||
Some JPEG programs produce files that are not compatible with our library.
|
||||
The root of the problem is that the ISO JPEG committee failed to specify a
|
||||
concrete file format. Some vendors "filled in the blanks" on their own,
|
||||
creating proprietary formats that no one else could read. (For example, none
|
||||
of the early commercial JPEG implementations for the Macintosh were able to
|
||||
exchange compressed files.)
|
||||
|
||||
The file format we have adopted is called JFIF (see REFERENCES). This format
|
||||
has been agreed to by a number of major commercial JPEG vendors, and it has
|
||||
become the de facto standard. JFIF is a minimal or "low end" representation.
|
||||
We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF
|
||||
Technical Note #2) for "high end" applications that need to record a lot of
|
||||
additional data about an image. TIFF/JPEG is fairly new and not yet widely
|
||||
supported, unfortunately.
|
||||
|
||||
The upcoming JPEG Part 3 standard defines a file format called SPIFF.
|
||||
SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should
|
||||
be able to read the most common variant of SPIFF. SPIFF has some technical
|
||||
advantages over JFIF, but its major claim to fame is simply that it is an
|
||||
official standard rather than an informal one. At this point it is unclear
|
||||
whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto
|
||||
standard. IJG intends to support SPIFF once the standard is frozen, but we
|
||||
have not decided whether it should become our default output format or not.
|
||||
(In any case, our decoder will remain capable of reading JFIF indefinitely.)
|
||||
|
||||
Various proprietary file formats incorporating JPEG compression also exist.
|
||||
We have little or no sympathy for the existence of these formats. Indeed,
|
||||
one of the original reasons for developing this free software was to help
|
||||
force convergence on common, open format standards for JPEG files. Don't
|
||||
use a proprietary file format!
|
||||
|
||||
|
||||
TO DO
|
||||
=====
|
||||
|
||||
In future versions, we are considering supporting some of the upcoming JPEG
|
||||
Part 3 extensions --- principally, variable quantization and the SPIFF file
|
||||
format.
|
||||
|
||||
Tuning the software for better behavior at low quality/high compression
|
||||
settings is also of interest. The current method for scaling the
|
||||
quantization tables is known not to be very good at low Q values.
|
||||
|
||||
As always, speeding things up is high on our priority list.
|
||||
|
||||
Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net.
|
||||
140
targets/wasm-tacle/sequential/cjpeg_wrbmp/cderror.h
Executable file
140
targets/wasm-tacle/sequential/cjpeg_wrbmp/cderror.h
Executable file
@ -0,0 +1,140 @@
|
||||
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cderror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
This file defines the error and message codes for the cjpeg/djpeg
|
||||
applications. These strings are not needed as part of the JPEG library
|
||||
proper.
|
||||
Edit this file to add new codes, or to translate the message strings to
|
||||
some other language.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CJPEG_WRBMP_JMESSAGE
|
||||
#ifndef CDERROR_H
|
||||
#define CDERROR_H
|
||||
/*First time through, define the enum list*/
|
||||
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#else
|
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined*/
|
||||
#define CJPEG_WRBMP_JMESSAGE(code,string)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
typedef enum {
|
||||
|
||||
#define CJPEG_WRBMP_JMESSAGE(code,string) code ,
|
||||
|
||||
#endif
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE( JMSG_FIRSTADDONCODE = 1000, NULL ) //Must be first entry!
|
||||
|
||||
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADCMAP, "Unsupported BMP colormap format" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADHEADER, "Invalid BMP file: bad header length" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BMP_NOT, "Not a BMP file - does not start with BM" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_BMP, "%ux%u 24-bit BMP image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image" )
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_GIF_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_GIF_BUG, "GIF output got confused" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_GIF_CODESIZE, "Bogus GIF codesize %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_GIF_NOT, "Not a GIF file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_GIF, "%ux%ux%d GIF image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_GIF_BADVERSION,
|
||||
"Warning: unexpected GIF version number '%c%c%c'" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_GIF_BADDATA, "Corrupt data in GIF file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_GIF_ENDCODE, "Premature end of GIF image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_GIF_NOMOREDATA, "Ran out of GIF bits" )
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_PPM_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_PPM_NOT, "Not a PPM/PGM file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_PGM, "%ux%u PGM image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_PGM_TEXT, "%ux%u text PGM image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_PPM, "%ux%u PPM image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_PPM_TEXT, "%ux%u text PPM image" )
|
||||
#endif
|
||||
|
||||
#ifdef RLE_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_BADERROR, "Bogus error code from RLE library" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_EMPTY, "Empty RLE file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_EOF, "Premature EOF in RLE header" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_MEM, "Insufficient memory for RLE header" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_NOT, "Not an RLE file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_RLE, "%ux%u full-color RLE file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_RLE_GRAY, "%ux%u grayscale RLE file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d" )
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TGA_BADCMAP, "Unsupported Targa colormap format" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TGA_BADPARMS, "Invalid or unsupported Targa file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_TGA, "%ux%u RGB Targa image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_TGA_GRAY, "%ux%u grayscale Targa image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_TGA_MAPPED, "%ux%u colormapped Targa image" )
|
||||
#else
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TGA_NOTCOMP, "Targa support was not compiled" )
|
||||
#endif
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_CMAP_FILE,
|
||||
"Color map file is invalid or of unsupported format" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TOO_MANY_COLORS,
|
||||
"Output file format cannot handle %d colormap entries" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_UNGETC_FAILED, "ungetc failed" )
|
||||
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_UNKNOWN_FORMAT,
|
||||
"Unrecognized input file format --- perhaps you need -targa" )
|
||||
#else
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_UNKNOWN_FORMAT, "Unrecognized input file format" )
|
||||
#endif
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_UNSUPPORTED_FORMAT, "Unsupported output file format" )
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
JMSG_LASTADDONCODE
|
||||
} CJPEG_WRBMP_ADDON_MESSAGE_CODE;
|
||||
|
||||
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#endif
|
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default*/
|
||||
#undef CJPEG_WRBMP_JMESSAGE
|
||||
105
targets/wasm-tacle/sequential/cjpeg_wrbmp/cdjpeg.h
Executable file
105
targets/wasm-tacle/sequential/cjpeg_wrbmp/cdjpeg.h
Executable file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cdjpeg.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
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 common declarations for the sample applications
|
||||
cjpeg and djpeg. It is NOT used by the core JPEG library.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
#ifndef CDJPEG_H
|
||||
#define CDJPEG_H
|
||||
|
||||
#define CJPEG_WRBMP_JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
|
||||
#define CJPEG_WRBMP_JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "jerror.h" /* get library error codes too */
|
||||
#include "cderror.h" /* get application-specific error codes */
|
||||
|
||||
typedef struct cjpeg_wrbmp_cjpeg_source_struct
|
||||
*cjpeg_wrbmp_cjpeg_source_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_cjpeg_source_struct {
|
||||
CJPEG_WRBMP_JMETHOD( void, start_input,
|
||||
( cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo ) );
|
||||
CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JDIMENSION, get_pixel_rows,
|
||||
( cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo ) );
|
||||
CJPEG_WRBMP_JMETHOD( void, finish_input,
|
||||
( cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo ) );
|
||||
|
||||
CJPEG_WRBMP_FILE *input_file;
|
||||
|
||||
CJPEG_WRBMP_JSAMPARRAY buffer;
|
||||
CJPEG_WRBMP_JDIMENSION buffer_height;
|
||||
};
|
||||
|
||||
|
||||
typedef struct cjpeg_wrbmp_djpeg_dest_struct
|
||||
*cjpeg_wrbmp_djpeg_dest_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct {
|
||||
CJPEG_WRBMP_JMETHOD( void, start_output,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo ) );
|
||||
/* Emit the specified number of pixel rows from the buffer. */
|
||||
CJPEG_WRBMP_JMETHOD( void, put_pixel_rows,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo,
|
||||
CJPEG_WRBMP_JDIMENSION rows_supplied ) );
|
||||
/* Finish up at the end of the image. */
|
||||
CJPEG_WRBMP_JMETHOD( void, finish_output,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo ) );
|
||||
|
||||
/* Target file spec; filled in by djpeg.c after object is created. */
|
||||
CJPEG_WRBMP_FILE *output_file;
|
||||
|
||||
/* Output pixel-row buffer. Created by module init or start_output.
|
||||
Width is cinfo->output_width * cinfo->output_components;
|
||||
height is buffer_height.
|
||||
*/
|
||||
CJPEG_WRBMP_JSAMPARRAY buffer;
|
||||
CJPEG_WRBMP_JDIMENSION buffer_height;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
cjpeg/djpeg may need to perform extra passes to convert to or from
|
||||
the source/destination file format. The JPEG library does not know
|
||||
about these passes, but we'd like them to be counted by the progress
|
||||
monitor. We use an expanded progress monitor object to hold the
|
||||
additional pass count.
|
||||
*/
|
||||
|
||||
struct cjpeg_wrbmp_cdjpeg_progress_mgr {
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr
|
||||
pub; /* fields known to JPEG library */
|
||||
int completed_extra_passes; /* extra passes completed */
|
||||
int total_extra_passes; /* total extra */
|
||||
/* last printed percentage stored here to avoid multiple printouts */
|
||||
int percent_done;
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_cdjpeg_progress_mgr
|
||||
*cjpeg_wrbmp_cd_progress_ptr;
|
||||
|
||||
#endif
|
||||
|
||||
219
targets/wasm-tacle/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c
Executable file
219
targets/wasm-tacle/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c
Executable file
@ -0,0 +1,219 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cjpeg_jpeg6b_wrbmp.c
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
Function: This file contains routines to write output images in Microsoft "BMP"
|
||||
format (MS Windows 3.x and OS/2 1.x flavors).
|
||||
Either 8-bit colormapped or 24-bit full-color format can be written.
|
||||
No compression is supported.
|
||||
|
||||
These routines may need modification for non-Unix environments or
|
||||
specialized applications. As they stand, they assume output to
|
||||
an ordinary stdio stream.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: a brief summary of major functional changes (not formatting)
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#include "cdjpeg.h"
|
||||
|
||||
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
|
||||
|
||||
/*
|
||||
Declaration of global variables
|
||||
*/
|
||||
typedef struct {
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct pub; /* public fields */
|
||||
cjpeg_wrbmp_boolean is_os2; /* saves the OS2 format request flag */
|
||||
cjpeg_wrbmp_jvirt_sarray_ptr
|
||||
whole_image; /* needed to reverse row order */
|
||||
CJPEG_WRBMP_JDIMENSION data_width; /* JSAMPLEs per row */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
row_width; /* physical width of one row in the BMP file */
|
||||
int pad_bytes; /* number of padding bytes needed per row */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
cur_output_row; /* next row# to write to virtual array */
|
||||
} cjpeg_wrbmp_bmp_dest_struct;
|
||||
|
||||
typedef cjpeg_wrbmp_bmp_dest_struct *cjpeg_wrbmp_bmp_dest_ptr;
|
||||
extern unsigned char cjpeg_wrbmp_colormap[ 3 ][ 256 ];
|
||||
unsigned char cjpeg_wrbmp_output_array[ 6144 ];
|
||||
unsigned char *cjpeg_wrbmp_jpeg_stream /*= cjpeg_jpeg6b_wrbmp_output_array*/;
|
||||
int cjpeg_wrbmp_checksum;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct
|
||||
cjpeg_wrbmp_jpeg_dec_1;
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct
|
||||
cjpeg_wrbmp_jpeg_dec_2;
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct
|
||||
cjpeg_wrbmp_djpeg_dest;
|
||||
cjpeg_wrbmp_bmp_dest_struct cjpeg_wrbmp_bmp_dest;
|
||||
|
||||
/*
|
||||
Forward declaration of functions
|
||||
*/
|
||||
void cjpeg_wrbmp_initInput( void );
|
||||
void cjpeg_wrbmp_finish_output_bmp( cjpeg_wrbmp_j_decompress_ptr cinfo );
|
||||
void cjpeg_wrbmp_write_colormap( cjpeg_wrbmp_j_decompress_ptr
|
||||
cinfo,
|
||||
int map_colors, int map_entry_size,
|
||||
int cMap );
|
||||
int cjpeg_wrbmp_putc_modified( int character );
|
||||
void cjpeg_wrbmp_init();
|
||||
void cjpeg_wrbmp_main();
|
||||
int cjpeg_wrbmp_return();
|
||||
int main();
|
||||
|
||||
/*
|
||||
Initialization functions
|
||||
*/
|
||||
void cjpeg_wrbmp_init()
|
||||
{
|
||||
cjpeg_wrbmp_initInput();
|
||||
|
||||
cjpeg_wrbmp_jpeg_dec_1.progress = 0;
|
||||
cjpeg_wrbmp_jpeg_dec_1.output_height = 30;
|
||||
cjpeg_wrbmp_jpeg_dec_1.actual_number_of_colors = 256;
|
||||
cjpeg_wrbmp_jpeg_dec_1.out_color_components = 2;
|
||||
|
||||
cjpeg_wrbmp_jpeg_dec_2.progress = 0;
|
||||
cjpeg_wrbmp_jpeg_dec_2.output_height = 30;
|
||||
cjpeg_wrbmp_jpeg_dec_2.actual_number_of_colors = 256;
|
||||
cjpeg_wrbmp_jpeg_dec_2.out_color_components = 3;
|
||||
|
||||
cjpeg_wrbmp_jpeg_stream = cjpeg_wrbmp_output_array;
|
||||
|
||||
cjpeg_wrbmp_checksum = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Calculation functions
|
||||
*/
|
||||
int cjpeg_wrbmp_putc_modified( int character )
|
||||
{
|
||||
*( cjpeg_wrbmp_jpeg_stream ) = character;
|
||||
|
||||
++cjpeg_wrbmp_jpeg_stream;
|
||||
|
||||
cjpeg_wrbmp_checksum += character;
|
||||
|
||||
return character;
|
||||
}
|
||||
|
||||
void cjpeg_wrbmp_finish_output_bmp( cjpeg_wrbmp_j_decompress_ptr cinfo )
|
||||
{
|
||||
CJPEG_WRBMP_JDIMENSION row;
|
||||
cjpeg_wrbmp_cd_progress_ptr progress =
|
||||
( cjpeg_wrbmp_cd_progress_ptr ) cinfo->progress;
|
||||
|
||||
// Write the file body from our virtual array
|
||||
_Pragma( "loopbound min 30 max 30" )
|
||||
for ( row = cinfo->output_height; row > 0; --row ) {
|
||||
if ( progress != 0 ) {
|
||||
progress->pub.pass_counter = ( long )( cinfo->output_height - row );
|
||||
progress->pub.pass_limit = ( long ) cinfo->output_height;
|
||||
}
|
||||
}
|
||||
|
||||
if ( progress != 0 )
|
||||
progress->completed_extra_passes++;
|
||||
}
|
||||
|
||||
void cjpeg_wrbmp_write_colormap( cjpeg_wrbmp_j_decompress_ptr
|
||||
cinfo,
|
||||
int map_colors, int map_entry_size, int cMap )
|
||||
{
|
||||
|
||||
int num_colors = cinfo->actual_number_of_colors;
|
||||
int i;
|
||||
|
||||
if ( cMap != 0 ) {
|
||||
|
||||
if ( cinfo->out_color_components == 3 ) {
|
||||
// Normal case with RGB colormap
|
||||
_Pragma( "loopbound min 256 max 256" )
|
||||
for ( i = 0; i < num_colors; i++ ) {
|
||||
cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE(
|
||||
cjpeg_wrbmp_colormap[ 2 ][ i ] ) );
|
||||
cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE(
|
||||
cjpeg_wrbmp_colormap[ 1 ][ i ] ) );
|
||||
cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE(
|
||||
cjpeg_wrbmp_colormap[ 0 ][ i ] ) );
|
||||
|
||||
if ( map_entry_size == 4 )
|
||||
cjpeg_wrbmp_putc_modified( 0 );
|
||||
}
|
||||
} else {
|
||||
// Grayscale colormap (only happens with grayscale quantization)
|
||||
_Pragma( "loopbound min 256 max 256" )
|
||||
for ( i = 0; i < num_colors; i++ ) {
|
||||
|
||||
cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE(
|
||||
cjpeg_wrbmp_colormap[ 2 ][ i ] ) );
|
||||
cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE(
|
||||
cjpeg_wrbmp_colormap[ 1 ][ i ] ) );
|
||||
cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE(
|
||||
cjpeg_wrbmp_colormap[ 0 ][ i ] ) );
|
||||
|
||||
if ( map_entry_size == 4 )
|
||||
cjpeg_wrbmp_putc_modified( 0 );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If no colormap, must be grayscale data. Generate a linear "map".
|
||||
_Pragma( "loopbound min 256 max 256" )
|
||||
for ( i = 0; i < 256; i++ ) {
|
||||
cjpeg_wrbmp_putc_modified( i );
|
||||
cjpeg_wrbmp_putc_modified( i );
|
||||
cjpeg_wrbmp_putc_modified( i );
|
||||
|
||||
if ( map_entry_size == 4 )
|
||||
cjpeg_wrbmp_putc_modified( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
// Pad colormap with zeros to ensure specified number of colormap entries.
|
||||
_Pragma( "loopbound min 512 max 512" )
|
||||
for ( ; i < map_colors; i++ ) {
|
||||
cjpeg_wrbmp_putc_modified( 0 );
|
||||
cjpeg_wrbmp_putc_modified( 0 );
|
||||
cjpeg_wrbmp_putc_modified( 0 );
|
||||
|
||||
if ( map_entry_size == 4 )
|
||||
cjpeg_wrbmp_putc_modified( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void _Pragma( "entrypoint" ) cjpeg_wrbmp_main()
|
||||
{
|
||||
cjpeg_wrbmp_finish_output_bmp( &cjpeg_wrbmp_jpeg_dec_1 );
|
||||
cjpeg_wrbmp_write_colormap( &cjpeg_wrbmp_jpeg_dec_1, 768, 4, 1 );
|
||||
|
||||
cjpeg_wrbmp_finish_output_bmp( &cjpeg_wrbmp_jpeg_dec_2 );
|
||||
cjpeg_wrbmp_write_colormap( &cjpeg_wrbmp_jpeg_dec_2, 768, 4, 1 );
|
||||
}
|
||||
|
||||
int cjpeg_wrbmp_return()
|
||||
{
|
||||
return ( cjpeg_wrbmp_checksum + ( -209330 ) ) != 0;
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
cjpeg_wrbmp_init();
|
||||
cjpeg_wrbmp_main();
|
||||
|
||||
return ( cjpeg_wrbmp_return() );
|
||||
}
|
||||
|
||||
#endif /* BMP_SUPPORTED */
|
||||
|
||||
BIN
targets/wasm-tacle/sequential/cjpeg_wrbmp/generated/default/cjpeg_wrbmp.wasm
Executable file
BIN
targets/wasm-tacle/sequential/cjpeg_wrbmp/generated/default/cjpeg_wrbmp.wasm
Executable file
Binary file not shown.
@ -0,0 +1,972 @@
|
||||
(module $cjpeg_wrbmp.wasm
|
||||
(type (;0;) (func (param i32 i32)))
|
||||
(type (;1;) (func (param i32 i32 i32) (result i32)))
|
||||
(type (;2;) (func))
|
||||
(type (;3;) (func (param i32 i32 i32 i32)))
|
||||
(type (;4;) (func (result i32)))
|
||||
(import "__pragma" "loopbound" (func $__pragma_loopbound (type 0)))
|
||||
(import "env" "memcpy" (func $memcpy (type 1)))
|
||||
(func $__wasm_apply_data_relocs (type 2))
|
||||
(func $cjpeg_wrbmp_write_colormap (type 3) (param i32 i32 i32 i32)
|
||||
(local i32 i32 i32 i32)
|
||||
block ;; label = @1
|
||||
block ;; label = @2
|
||||
local.get 3
|
||||
i32.eqz
|
||||
br_if 0 (;@2;)
|
||||
local.get 0
|
||||
i32.load offset=128
|
||||
local.set 3
|
||||
local.get 0
|
||||
i32.load offset=116
|
||||
local.set 0
|
||||
i32.const 256
|
||||
i32.const 256
|
||||
call $__pragma_loopbound
|
||||
block ;; label = @3
|
||||
local.get 0
|
||||
i32.const 3
|
||||
i32.ne
|
||||
br_if 0 (;@3;)
|
||||
block ;; label = @4
|
||||
local.get 3
|
||||
i32.const 1
|
||||
i32.ge_s
|
||||
br_if 0 (;@4;)
|
||||
i32.const 0
|
||||
local.set 3
|
||||
br 3 (;@1;)
|
||||
end
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.set 0
|
||||
local.get 2
|
||||
i32.const 4
|
||||
i32.ne
|
||||
local.set 4
|
||||
i32.const 0
|
||||
local.set 5
|
||||
loop ;; label = @4
|
||||
local.get 0
|
||||
i32.const 8880
|
||||
local.get 5
|
||||
i32.add
|
||||
local.tee 6
|
||||
i32.const 512
|
||||
i32.add
|
||||
i32.load8_u
|
||||
local.tee 7
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 7
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 0
|
||||
local.get 6
|
||||
i32.const 256
|
||||
i32.add
|
||||
i32.load8_u
|
||||
local.tee 7
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 7
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 0
|
||||
local.get 6
|
||||
i32.load8_u
|
||||
local.tee 6
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 6
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
block ;; label = @5
|
||||
local.get 4
|
||||
br_if 0 (;@5;)
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
end
|
||||
local.get 3
|
||||
local.get 5
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 5
|
||||
i32.ne
|
||||
br_if 0 (;@4;)
|
||||
br 3 (;@1;)
|
||||
end
|
||||
end
|
||||
block ;; label = @3
|
||||
local.get 3
|
||||
i32.const 1
|
||||
i32.ge_s
|
||||
br_if 0 (;@3;)
|
||||
i32.const 0
|
||||
local.set 3
|
||||
br 2 (;@1;)
|
||||
end
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.set 0
|
||||
local.get 2
|
||||
i32.const 4
|
||||
i32.ne
|
||||
local.set 4
|
||||
i32.const 0
|
||||
local.set 5
|
||||
loop ;; label = @3
|
||||
local.get 0
|
||||
i32.const 8880
|
||||
local.get 5
|
||||
i32.add
|
||||
local.tee 6
|
||||
i32.const 512
|
||||
i32.add
|
||||
i32.load8_u
|
||||
local.tee 7
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 7
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 0
|
||||
local.get 6
|
||||
i32.const 256
|
||||
i32.add
|
||||
i32.load8_u
|
||||
local.tee 7
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 7
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 0
|
||||
local.get 6
|
||||
i32.load8_u
|
||||
local.tee 6
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 6
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
block ;; label = @4
|
||||
local.get 4
|
||||
br_if 0 (;@4;)
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
end
|
||||
local.get 3
|
||||
local.get 5
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 5
|
||||
i32.ne
|
||||
br_if 0 (;@3;)
|
||||
br 2 (;@1;)
|
||||
end
|
||||
end
|
||||
i32.const 256
|
||||
i32.const 256
|
||||
call $__pragma_loopbound
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.set 5
|
||||
block ;; label = @2
|
||||
local.get 2
|
||||
i32.const 4
|
||||
i32.eq
|
||||
br_if 0 (;@2;)
|
||||
i32.const 0
|
||||
local.set 0
|
||||
loop ;; label = @3
|
||||
local.get 5
|
||||
local.get 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 3
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 3
|
||||
local.get 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 3
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 3
|
||||
local.get 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 5
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
i32.const 256
|
||||
local.set 3
|
||||
local.get 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.const 256
|
||||
i32.ne
|
||||
br_if 0 (;@3;)
|
||||
br 2 (;@1;)
|
||||
end
|
||||
end
|
||||
i32.const 0
|
||||
local.set 0
|
||||
loop ;; label = @2
|
||||
local.get 5
|
||||
local.get 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 3
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 3
|
||||
local.get 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 3
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 3
|
||||
local.get 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 3
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.add
|
||||
i32.store offset=8868
|
||||
local.get 3
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 5
|
||||
i32.store offset=8864
|
||||
i32.const 256
|
||||
local.set 3
|
||||
local.get 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.const 256
|
||||
i32.ne
|
||||
br_if 0 (;@2;)
|
||||
end
|
||||
end
|
||||
i32.const 512
|
||||
i32.const 512
|
||||
call $__pragma_loopbound
|
||||
block ;; label = @1
|
||||
local.get 1
|
||||
local.get 3
|
||||
i32.le_s
|
||||
br_if 0 (;@1;)
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.set 0
|
||||
block ;; label = @2
|
||||
local.get 2
|
||||
i32.const 4
|
||||
i32.eq
|
||||
br_if 0 (;@2;)
|
||||
block ;; label = @3
|
||||
block ;; label = @4
|
||||
local.get 1
|
||||
local.get 3
|
||||
i32.sub
|
||||
i32.const 1
|
||||
i32.and
|
||||
br_if 0 (;@4;)
|
||||
local.get 3
|
||||
local.set 5
|
||||
br 1 (;@3;)
|
||||
end
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
local.get 3
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set 5
|
||||
end
|
||||
local.get 3
|
||||
local.get 1
|
||||
i32.const -1
|
||||
i32.add
|
||||
i32.eq
|
||||
br_if 1 (;@1;)
|
||||
local.get 1
|
||||
local.get 5
|
||||
i32.sub
|
||||
local.set 3
|
||||
loop ;; label = @3
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
local.get 3
|
||||
i32.const -2
|
||||
i32.add
|
||||
local.tee 3
|
||||
br_if 0 (;@3;)
|
||||
br 2 (;@1;)
|
||||
end
|
||||
end
|
||||
block ;; label = @2
|
||||
block ;; label = @3
|
||||
local.get 1
|
||||
local.get 3
|
||||
i32.sub
|
||||
i32.const 1
|
||||
i32.and
|
||||
br_if 0 (;@3;)
|
||||
local.get 3
|
||||
local.set 5
|
||||
br 1 (;@2;)
|
||||
end
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
local.get 3
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set 5
|
||||
end
|
||||
local.get 3
|
||||
local.get 1
|
||||
i32.const -1
|
||||
i32.add
|
||||
i32.eq
|
||||
br_if 0 (;@1;)
|
||||
local.get 1
|
||||
local.get 5
|
||||
i32.sub
|
||||
local.set 3
|
||||
loop ;; label = @2
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
local.tee 0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=8864
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=8864
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.tee 0
|
||||
i32.store offset=8864
|
||||
local.get 3
|
||||
i32.const -2
|
||||
i32.add
|
||||
local.tee 3
|
||||
br_if 0 (;@2;)
|
||||
end
|
||||
end)
|
||||
(func $cjpeg_wrbmp_main (type 2)
|
||||
(local i32 i32)
|
||||
i32.const 0
|
||||
i32.load offset=1800
|
||||
local.set 0
|
||||
i32.const 30
|
||||
i32.const 30
|
||||
call $__pragma_loopbound
|
||||
block ;; label = @1
|
||||
block ;; label = @2
|
||||
block ;; label = @3
|
||||
i32.const 0
|
||||
i32.load offset=1904
|
||||
local.tee 1
|
||||
i32.eqz
|
||||
br_if 0 (;@3;)
|
||||
local.get 0
|
||||
i32.eqz
|
||||
br_if 2 (;@1;)
|
||||
local.get 0
|
||||
local.get 1
|
||||
i32.store offset=8
|
||||
local.get 0
|
||||
local.get 1
|
||||
i32.const -1
|
||||
i32.add
|
||||
i32.store offset=4
|
||||
br 1 (;@2;)
|
||||
end
|
||||
local.get 0
|
||||
i32.eqz
|
||||
br_if 1 (;@1;)
|
||||
end
|
||||
local.get 0
|
||||
local.get 0
|
||||
i32.load offset=20
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=20
|
||||
end
|
||||
i32.const 1792
|
||||
i32.const 768
|
||||
i32.const 4
|
||||
i32.const 1
|
||||
call $cjpeg_wrbmp_write_colormap
|
||||
i32.const 0
|
||||
i32.load offset=2260
|
||||
local.set 0
|
||||
i32.const 30
|
||||
i32.const 30
|
||||
call $__pragma_loopbound
|
||||
block ;; label = @1
|
||||
block ;; label = @2
|
||||
block ;; label = @3
|
||||
i32.const 0
|
||||
i32.load offset=2364
|
||||
local.tee 1
|
||||
i32.eqz
|
||||
br_if 0 (;@3;)
|
||||
local.get 0
|
||||
i32.eqz
|
||||
br_if 2 (;@1;)
|
||||
local.get 0
|
||||
local.get 1
|
||||
i32.store offset=8
|
||||
local.get 0
|
||||
local.get 1
|
||||
i32.const -1
|
||||
i32.add
|
||||
i32.store offset=4
|
||||
br 1 (;@2;)
|
||||
end
|
||||
local.get 0
|
||||
i32.eqz
|
||||
br_if 1 (;@1;)
|
||||
end
|
||||
local.get 0
|
||||
local.get 0
|
||||
i32.load offset=20
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.store offset=20
|
||||
end
|
||||
i32.const 2252
|
||||
i32.const 768
|
||||
i32.const 4
|
||||
i32.const 1
|
||||
call $cjpeg_wrbmp_write_colormap)
|
||||
(func $__original_main (type 4) (result i32)
|
||||
call $cjpeg_wrbmp_initInput
|
||||
i32.const 0
|
||||
i32.const 256
|
||||
i32.store offset=1920
|
||||
i32.const 0
|
||||
i64.const 8589934622
|
||||
i64.store offset=1904 align=4
|
||||
i32.const 0
|
||||
i32.const 256
|
||||
i32.store offset=2380
|
||||
i32.const 0
|
||||
i64.const 12884901918
|
||||
i64.store offset=2364 align=4
|
||||
i32.const 0
|
||||
i32.const 2720
|
||||
i32.store offset=8864
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.store offset=1800
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.store offset=2260
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.store offset=8868
|
||||
call $cjpeg_wrbmp_main
|
||||
i32.const 0
|
||||
i32.load offset=8868
|
||||
i32.const 209330
|
||||
i32.ne)
|
||||
(func $cjpeg_wrbmp_initInput (type 2)
|
||||
(local i32 i32 i32)
|
||||
global.get $__stack_pointer
|
||||
i32.const 768
|
||||
i32.sub
|
||||
local.tee 0
|
||||
global.set $__stack_pointer
|
||||
local.get 0
|
||||
i32.const 1024
|
||||
i32.const 768
|
||||
call $memcpy
|
||||
local.set 1
|
||||
i32.const 3
|
||||
i32.const 3
|
||||
call $__pragma_loopbound
|
||||
i32.const 256
|
||||
i32.const 256
|
||||
call $__pragma_loopbound
|
||||
i32.const -256
|
||||
local.set 0
|
||||
loop ;; label = @1
|
||||
local.get 0
|
||||
i32.const 9136
|
||||
i32.add
|
||||
local.get 1
|
||||
local.get 0
|
||||
i32.add
|
||||
local.tee 2
|
||||
i32.const 256
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9137
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 257
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9138
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 258
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9139
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 259
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 4
|
||||
i32.add
|
||||
local.tee 0
|
||||
br_if 0 (;@1;)
|
||||
end
|
||||
i32.const 256
|
||||
i32.const 256
|
||||
call $__pragma_loopbound
|
||||
i32.const -256
|
||||
local.set 0
|
||||
loop ;; label = @1
|
||||
local.get 0
|
||||
i32.const 9392
|
||||
i32.add
|
||||
local.get 1
|
||||
local.get 0
|
||||
i32.add
|
||||
local.tee 2
|
||||
i32.const 512
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9393
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 513
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9394
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 514
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9395
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 515
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 4
|
||||
i32.add
|
||||
local.tee 0
|
||||
br_if 0 (;@1;)
|
||||
end
|
||||
i32.const 256
|
||||
i32.const 256
|
||||
call $__pragma_loopbound
|
||||
i32.const -256
|
||||
local.set 0
|
||||
loop ;; label = @1
|
||||
local.get 0
|
||||
i32.const 9648
|
||||
i32.add
|
||||
local.get 1
|
||||
local.get 0
|
||||
i32.add
|
||||
local.tee 2
|
||||
i32.const 768
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9649
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 769
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9650
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 770
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 9651
|
||||
i32.add
|
||||
local.get 2
|
||||
i32.const 771
|
||||
i32.add
|
||||
i32.load8_u
|
||||
i32.store8
|
||||
local.get 0
|
||||
i32.const 4
|
||||
i32.add
|
||||
local.tee 0
|
||||
br_if 0 (;@1;)
|
||||
end
|
||||
local.get 1
|
||||
i32.const 768
|
||||
i32.add
|
||||
global.set $__stack_pointer)
|
||||
(table (;0;) 1 1 funcref)
|
||||
(memory (;0;) 1)
|
||||
(global $__stack_pointer (mut i32) (i32.const 13744))
|
||||
(global (;1;) i32 (i32.const 9648))
|
||||
(global (;2;) i32 (i32.const 13744))
|
||||
(export "memory" (memory 0))
|
||||
(export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs))
|
||||
(export "entrypoint" (func $cjpeg_wrbmp_main))
|
||||
(export "main" (func $__original_main))
|
||||
(export "__data_end" (global 1))
|
||||
(export "__heap_base" (global 2))
|
||||
(data $.rodata (i32.const 1024) ",i\99G\97\a0\bcZ\d1\83\ddr]|\d0\cf\da6\91q\99\ef\e2S\f3\97bCr\99S\batH\bc\bem\a2\da\85\d0\d1s\fb\87Y\8f\e2\e6\f6\98\f3\98s\b4N\f6\a4\fauL\96\98\bc\fb\c3\7fo\e1\d0^]\8f\83\c9\d3c]\be\9dy\f0u\b9\a7\89\98\bc\fa;\f8\f5s\f0\c0\d1\8f\88b\e0\a7\87\84\bdH\f9\cd,j`\93\f7\f9\e4\e0\f9\bep\87\a8_\cd\ab:pO\ceK\f2\bc\bd\e1\b9Q\dd\99\f4\c6\ab\a3\9f\d1\f0\8a\94\cf\a6\c0\bc\97b\be\d1\9a\e1H`\f9\bf\df\cf\a3\cf\85\fb\b7\87\89\9f\f7\a7S{\c7\cb\90\8e\edM\80u\a9\ca\88\80\bc\a87\de\a9t<K\aff\d9\a8\b9\bd\e1}\c0po\a8\ef\e1\a8a\81\be\af\a9\e1\aa\e2\e1\e2\e0\86j\fa\de\94\f1\a8\a6\a0_\bef\b4\c1o\97\a5\ab\c84\86\a9\df\a6\e1\a9o\b9m8\f4\9d\fa\e2\e7w\bc*\8f.[T\c9\8c[R\8c\1fX,\ab9s\ce;\91ut5\e8uP<B@u\aeY\b2\93?S;g\8b\d3@Dbv5wZ\a1\e8\abb\b0\ecv\9d\b4MrX\1cw(aE\bd\fc\e1w`\dbTRi\9e1\c8=uN?\93\8cElZ\a1i\berTLF+\9c\de`H\8fZi8\90N\81#Bed1i\82\a0\ef\81\8dS+Dj\84S\5c\82\af?\83O\c0i9\a0v\a2\8dN\c0\80\ce\c9\cb\a2\9f\a3\dd\b7\9d\b1\bd\c0\81\826h-e\fc4[\b11\ddto\8f\5c\8e\9f\83\ad=\9f\adQ\81\d6\d5\91\8f\e8C\91\82c\edn\a0\83C2\81\83\7fL\5c\cb`\ce\b0\b4Uc\a2v@N\be\bf-e\81:H\d31ssU=dtk\8fu\db\9a\e1\ae\a0\a3w\bej\ba1-\b1\93U\8a*\ae;DxG\818\95aDX\94<\ef\b3\95h,L%8L\98z\99M\bf)L'a.m\ac+t[f1\c9DX-5_\a0\aff\a4t2L-V\bd\d82=]\c4[d:t\df\a6f~\dd\9eV\eb7qx4s*V7\a5\f7\c2\a0l\aalbM\a8*\b3F`>G\d8dG\9by\92V\86ir1d2w\da_Q\dcNf2}D\aa$>w\81,\97H\8f\f1\83\89OI7z\ccIJ\83\dd5YH\b2<@\91\9d\9c\b1e\b4p\c2\ce\b2\a8\dd\99\c9w\de\a5\bc\d4u\b4-\86*\82\e5/k\ac(\dd\92\84\8an\90\bcp\84@\a2\91\8c\c8\b5\d7\8b\c5\b7j~tY\cc\98{\a14.\83\a7\ad>F\97\97\c5\b1\b8`ae\826?\8d\b9-~`.G\ac&rdjEv\8a\7fc\7f\c6\cc\f2\f8\c5\f1J\bd\b2\fcA-\94\91a\a8-o+@\a4Pq/\88S*[\c5_\de\a7\5cb"))
|
||||
@ -0,0 +1,377 @@
|
||||
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cderror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
This file defines the error and message codes for the cjpeg/djpeg
|
||||
applications. These strings are not needed as part of the JPEG library
|
||||
proper.
|
||||
Edit this file to add new codes, or to translate the message strings to
|
||||
some other language.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CJPEG_WRBMP_JMESSAGE
|
||||
#ifndef CDERROR_H
|
||||
#define CDERROR_H
|
||||
/*First time through, define the enum list*/
|
||||
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#else
|
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined*/
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
typedef enum {
|
||||
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string) code,
|
||||
|
||||
#endif
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE(JMSG_FIRSTADDONCODE = 1000,
|
||||
NULL) // Must be first entry!
|
||||
|
||||
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BMP_BADCMAP,
|
||||
"Unsupported BMP colormap format") CJPEG_WRBMP_JMESSAGE(JERR_BMP_BADDEPTH,
|
||||
"Only 8- and "
|
||||
"24-bit BMP "
|
||||
"files are "
|
||||
"supported")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BMP_BADHEADER,
|
||||
"Inv"
|
||||
"ali"
|
||||
"d "
|
||||
"BMP"
|
||||
" fi"
|
||||
"le:"
|
||||
" ba"
|
||||
"d "
|
||||
"hea"
|
||||
"der"
|
||||
" le"
|
||||
"ngt"
|
||||
"h") CJPEG_WRBMP_JMESSAGE(JERR_BMP_BADPLANES,
|
||||
"Invalid BMP file: biPlanes not equal to "
|
||||
"1") CJPEG_WRBMP_JMESSAGE(JERR_BMP_COLORSPACE,
|
||||
"BMP output "
|
||||
"must be "
|
||||
"grayscale or "
|
||||
"RGB")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs "
|
||||
"not yet supported") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BMP_NOT, "N"
|
||||
"o"
|
||||
"t"
|
||||
" "
|
||||
"a"
|
||||
" "
|
||||
"B"
|
||||
"M"
|
||||
"P"
|
||||
" "
|
||||
"f"
|
||||
"i"
|
||||
"l"
|
||||
"e"
|
||||
" "
|
||||
"-"
|
||||
" "
|
||||
"d"
|
||||
"o"
|
||||
"e"
|
||||
"s"
|
||||
" "
|
||||
"n"
|
||||
"o"
|
||||
"t"
|
||||
" "
|
||||
"s"
|
||||
"t"
|
||||
"a"
|
||||
"r"
|
||||
"t"
|
||||
" "
|
||||
"w"
|
||||
"i"
|
||||
"t"
|
||||
"h"
|
||||
" "
|
||||
"B"
|
||||
"M") CJPEG_WRBMP_JMESSAGE(JTRC_BMP,
|
||||
"%ux%u 24-bit BMP "
|
||||
"image") CJPEG_WRBMP_JMESSAGE(JTRC_BMP_MAPPED,
|
||||
"%ux%u 8-bit colormapped BMP "
|
||||
"image")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_BMP_OS2,
|
||||
"%ux%u 24-bit OS2 BMP image") CJPEG_WRBMP_JMESSAGE(JTRC_BMP_OS2_MAPPED,
|
||||
"%ux%u "
|
||||
"8-bit "
|
||||
"colorma"
|
||||
"pped"
|
||||
" OS2 "
|
||||
"BMP "
|
||||
"image")
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_GIF_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_GIF_BUG, "GIF output got "
|
||||
"confused") CJPEG_WRBMP_JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_GIF_COLORSPACE,
|
||||
"GIF output "
|
||||
"must be "
|
||||
"grayscale "
|
||||
"or RGB") CJPEG_WRBMP_JMESSAGE(JERR_GIF_IMAGENOTFOUND,
|
||||
"Too few images in GIF "
|
||||
"file") CJPEG_WRBMP_JMESSAGE(JERR_GIF_NOT,
|
||||
"Not a GIF file")
|
||||
CJPEG_WRBMP_JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_GIF_BADVERSION,
|
||||
"Warning: "
|
||||
"unexpected "
|
||||
"GIF "
|
||||
"version "
|
||||
"number "
|
||||
"'%c%c%c'") CJPEG_WRBMP_JMESSAGE(JTRC_GIF_EXTENSION,
|
||||
"Ignoring GIF "
|
||||
"extension "
|
||||
"block of "
|
||||
"type 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_GIF_NONSQUARE,
|
||||
"Caution: nonsquare pixels in "
|
||||
"input")
|
||||
CJPEG_WRBMP_JMESSAGE(JWRN_GIF_BADDATA, "Corrupt "
|
||||
"data in "
|
||||
"GIF file") CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_GIF_CHAR,
|
||||
"Bogus char "
|
||||
"0x%02x in GIF "
|
||||
"file, "
|
||||
"ignoring") CJPEG_WRBMP_JMESSAGE(JWRN_GIF_ENDCODE,
|
||||
"Premature "
|
||||
"end of GIF "
|
||||
"image") CJPEG_WRBMP_JMESSAGE(JWRN_GIF_NOMOREDATA,
|
||||
"Ran out of GIF bits")
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_PPM_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_PPM_COLORSPACE,
|
||||
"PPM "
|
||||
"outp"
|
||||
"ut "
|
||||
"must"
|
||||
" be "
|
||||
"gray"
|
||||
"scal"
|
||||
"e "
|
||||
"or "
|
||||
"RGB") CJPEG_WRBMP_JMESSAGE(JERR_PPM_NONNUMERIC,
|
||||
"Nonnumeric "
|
||||
"data in PPM "
|
||||
"file")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_PPM_NOT,
|
||||
"Not a "
|
||||
"PPM/"
|
||||
"PGM "
|
||||
"file") CJPEG_WRBMP_JMESSAGE(JTRC_PGM,
|
||||
"%ux%u "
|
||||
"PGM "
|
||||
"image")
|
||||
CJPEG_WRBMP_JMESSAGE(JTRC_PGM_TEXT, "%u"
|
||||
"x%"
|
||||
"u "
|
||||
"te"
|
||||
"xt"
|
||||
" P"
|
||||
"GM"
|
||||
" i"
|
||||
"ma"
|
||||
"g"
|
||||
"e") CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_PPM,
|
||||
"%ux%u "
|
||||
"PPM "
|
||||
"image") CJPEG_WRBMP_JMESSAGE(JTRC_PPM_TEXT,
|
||||
"%ux%"
|
||||
"u "
|
||||
"text"
|
||||
" PPM"
|
||||
" ima"
|
||||
"ge")
|
||||
#endif
|
||||
|
||||
#ifdef RLE_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_RLE_BADERROR,
|
||||
"Bogus error code from RLE "
|
||||
"library") CJPEG_WRBMP_JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_RLE_DIMENSIONS,
|
||||
"Image dimensions (%ux%u) "
|
||||
"too large for RLE")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_RLE_EMPTY,
|
||||
"Empty RLE file")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_RLE_EOF,
|
||||
"P"
|
||||
"r"
|
||||
"e"
|
||||
"m"
|
||||
"a"
|
||||
"t"
|
||||
"u"
|
||||
"r"
|
||||
"e"
|
||||
" "
|
||||
"E"
|
||||
"O"
|
||||
"F"
|
||||
" "
|
||||
"i"
|
||||
"n"
|
||||
" "
|
||||
"R"
|
||||
"L"
|
||||
"E"
|
||||
" "
|
||||
"h"
|
||||
"e"
|
||||
"a"
|
||||
"d"
|
||||
"e"
|
||||
"r") CJPEG_WRBMP_JMESSAGE(JERR_RLE_MEM,
|
||||
"Insufficient memory for RLE header") CJPEG_WRBMP_JMESSAGE(JERR_RLE_NOT, "Not an RLE file") CJPEG_WRBMP_JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") CJPEG_WRBMP_JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") CJPEG_WRBMP_JMESSAGE(JTRC_RLE,
|
||||
"%ux%u full-color RLE file") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_GRAY,
|
||||
"%ux%u grayscale RLE file") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE "
|
||||
"file with map of "
|
||||
"length %d") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_MAPPED,
|
||||
"%ux%u colormapped RLE file with map of length %d")
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_TGA_BADCMAP,
|
||||
"Unsupported "
|
||||
"Targa "
|
||||
"colormap "
|
||||
"format") CJPEG_WRBMP_JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_TGA_COLORSPACE,
|
||||
"Targa "
|
||||
"output "
|
||||
"must be "
|
||||
"grayscale "
|
||||
"or "
|
||||
"RGB") CJPEG_WRBMP_JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_TGA_GRAY, "%ux%u "
|
||||
"grayscale "
|
||||
"Targa "
|
||||
"image")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_TGA_MAPPED,
|
||||
"%u"
|
||||
"x%"
|
||||
"u "
|
||||
"co"
|
||||
"lo"
|
||||
"rm"
|
||||
"ap"
|
||||
"pe"
|
||||
"d "
|
||||
"Ta"
|
||||
"rg"
|
||||
"a "
|
||||
"im"
|
||||
"ag"
|
||||
"e")
|
||||
#else
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
|
||||
#endif
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_CMAP_FILE,
|
||||
"Color "
|
||||
"map "
|
||||
"file "
|
||||
"is "
|
||||
"invali"
|
||||
"d or "
|
||||
"of "
|
||||
"unsupp"
|
||||
"orted "
|
||||
"forma"
|
||||
"t")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_TOO_MANY_COLORS,
|
||||
"Ou"
|
||||
"tp"
|
||||
"ut"
|
||||
" f"
|
||||
"il"
|
||||
"e "
|
||||
"fo"
|
||||
"rm"
|
||||
"at"
|
||||
" c"
|
||||
"an"
|
||||
"no"
|
||||
"t "
|
||||
"ha"
|
||||
"nd"
|
||||
"le"
|
||||
" %"
|
||||
"d "
|
||||
"co"
|
||||
"lo"
|
||||
"rm"
|
||||
"ap"
|
||||
" e"
|
||||
"nt"
|
||||
"ri"
|
||||
"e"
|
||||
"s")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_UNGETC_FAILED,
|
||||
"ungetc failed")
|
||||
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_UNKNOWN_FORMAT,
|
||||
"Unrecognized input file format --- perhaps you need -targa")
|
||||
#else
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
|
||||
#endif
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_UNSUPPORTED_FORMAT,
|
||||
"Unsupported output file format")
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
JMSG_LASTADDONCODE
|
||||
} CJPEG_WRBMP_ADDON_MESSAGE_CODE;
|
||||
|
||||
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#endif
|
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default*/
|
||||
#undef CJPEG_WRBMP_JMESSAGE
|
||||
@ -0,0 +1,99 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cdjpeg.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
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 common declarations for the sample applications
|
||||
cjpeg and djpeg. It is NOT used by the core JPEG library.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CDJPEG_H
|
||||
#define CDJPEG_H
|
||||
|
||||
#define CJPEG_WRBMP_JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
|
||||
#define CJPEG_WRBMP_JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see \
|
||||
xxx_SUPPORTED */
|
||||
|
||||
#include "cderror.h" /* get application-specific error codes */
|
||||
#include "jerror.h" /* get library error codes too */
|
||||
#include "jpeglib.h"
|
||||
|
||||
typedef struct cjpeg_wrbmp_cjpeg_source_struct *cjpeg_wrbmp_cjpeg_source_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_cjpeg_source_struct {
|
||||
CJPEG_WRBMP_JMETHOD(void, start_input,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JDIMENSION, get_pixel_rows,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
|
||||
CJPEG_WRBMP_JMETHOD(void, finish_input,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
|
||||
|
||||
CJPEG_WRBMP_FILE *input_file;
|
||||
|
||||
CJPEG_WRBMP_JSAMPARRAY buffer;
|
||||
CJPEG_WRBMP_JDIMENSION buffer_height;
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_djpeg_dest_struct *cjpeg_wrbmp_djpeg_dest_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct {
|
||||
CJPEG_WRBMP_JMETHOD(void, start_output,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo));
|
||||
/* Emit the specified number of pixel rows from the buffer. */
|
||||
CJPEG_WRBMP_JMETHOD(void, put_pixel_rows,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo,
|
||||
CJPEG_WRBMP_JDIMENSION rows_supplied));
|
||||
/* Finish up at the end of the image. */
|
||||
CJPEG_WRBMP_JMETHOD(void, finish_output,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo));
|
||||
|
||||
/* Target file spec; filled in by djpeg.c after object is created. */
|
||||
CJPEG_WRBMP_FILE *output_file;
|
||||
|
||||
/* Output pixel-row buffer. Created by module init or start_output.
|
||||
Width is cinfo->output_width * cinfo->output_components;
|
||||
height is buffer_height.
|
||||
*/
|
||||
CJPEG_WRBMP_JSAMPARRAY buffer;
|
||||
CJPEG_WRBMP_JDIMENSION buffer_height;
|
||||
};
|
||||
|
||||
/*
|
||||
cjpeg/djpeg may need to perform extra passes to convert to or from
|
||||
the source/destination file format. The JPEG library does not know
|
||||
about these passes, but we'd like them to be counted by the progress
|
||||
monitor. We use an expanded progress monitor object to hold the
|
||||
additional pass count.
|
||||
*/
|
||||
|
||||
struct cjpeg_wrbmp_cdjpeg_progress_mgr {
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr pub; /* fields known to JPEG library */
|
||||
int completed_extra_passes; /* extra passes completed */
|
||||
int total_extra_passes; /* total extra */
|
||||
/* last printed percentage stored here to avoid multiple printouts */
|
||||
int percent_done;
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_cdjpeg_progress_mgr *cjpeg_wrbmp_cd_progress_ptr;
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,216 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cjpeg_jpeg6b_wrbmp.c
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
Function: This file contains routines to write output images in Microsoft
|
||||
"BMP" format (MS Windows 3.x and OS/2 1.x flavors). Either 8-bit colormapped
|
||||
or 24-bit full-color format can be written. No compression is supported.
|
||||
|
||||
These routines may need modification for non-Unix environments or
|
||||
specialized applications. As they stand, they assume output to
|
||||
an ordinary stdio stream.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: a brief summary of major functional changes (not formatting)
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#include "cdjpeg.h"
|
||||
|
||||
// Wasm loop bounds
|
||||
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
|
||||
|
||||
/*
|
||||
Declaration of global variables
|
||||
*/
|
||||
typedef struct {
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct pub; /* public fields */
|
||||
cjpeg_wrbmp_boolean is_os2; /* saves the OS2 format request flag */
|
||||
cjpeg_wrbmp_jvirt_sarray_ptr whole_image; /* needed to reverse row order */
|
||||
CJPEG_WRBMP_JDIMENSION data_width; /* JSAMPLEs per row */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
row_width; /* physical width of one row in the BMP file */
|
||||
int pad_bytes; /* number of padding bytes needed per row */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
cur_output_row; /* next row# to write to virtual array */
|
||||
} cjpeg_wrbmp_bmp_dest_struct;
|
||||
|
||||
typedef cjpeg_wrbmp_bmp_dest_struct *cjpeg_wrbmp_bmp_dest_ptr;
|
||||
extern unsigned char cjpeg_wrbmp_colormap[3][256];
|
||||
unsigned char cjpeg_wrbmp_output_array[6144];
|
||||
unsigned char *cjpeg_wrbmp_jpeg_stream /*= cjpeg_jpeg6b_wrbmp_output_array*/;
|
||||
int cjpeg_wrbmp_checksum;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct cjpeg_wrbmp_jpeg_dec_1;
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct cjpeg_wrbmp_jpeg_dec_2;
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct cjpeg_wrbmp_djpeg_dest;
|
||||
cjpeg_wrbmp_bmp_dest_struct cjpeg_wrbmp_bmp_dest;
|
||||
|
||||
/*
|
||||
Forward declaration of functions
|
||||
*/
|
||||
void cjpeg_wrbmp_initInput(void);
|
||||
void cjpeg_wrbmp_finish_output_bmp(cjpeg_wrbmp_j_decompress_ptr cinfo);
|
||||
void cjpeg_wrbmp_write_colormap(cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
int map_colors, int map_entry_size, int cMap);
|
||||
int cjpeg_wrbmp_putc_modified(int character);
|
||||
void cjpeg_wrbmp_init();
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
cjpeg_wrbmp_main();
|
||||
int cjpeg_wrbmp_return();
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int main();
|
||||
|
||||
/*
|
||||
Initialization functions
|
||||
*/
|
||||
void
|
||||
cjpeg_wrbmp_init() {
|
||||
cjpeg_wrbmp_initInput();
|
||||
|
||||
cjpeg_wrbmp_jpeg_dec_1.progress = 0;
|
||||
cjpeg_wrbmp_jpeg_dec_1.output_height = 30;
|
||||
cjpeg_wrbmp_jpeg_dec_1.actual_number_of_colors = 256;
|
||||
cjpeg_wrbmp_jpeg_dec_1.out_color_components = 2;
|
||||
|
||||
cjpeg_wrbmp_jpeg_dec_2.progress = 0;
|
||||
cjpeg_wrbmp_jpeg_dec_2.output_height = 30;
|
||||
cjpeg_wrbmp_jpeg_dec_2.actual_number_of_colors = 256;
|
||||
cjpeg_wrbmp_jpeg_dec_2.out_color_components = 3;
|
||||
|
||||
cjpeg_wrbmp_jpeg_stream = cjpeg_wrbmp_output_array;
|
||||
|
||||
cjpeg_wrbmp_checksum = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Calculation functions
|
||||
*/
|
||||
int
|
||||
cjpeg_wrbmp_putc_modified(int character) {
|
||||
*(cjpeg_wrbmp_jpeg_stream) = character;
|
||||
|
||||
++cjpeg_wrbmp_jpeg_stream;
|
||||
|
||||
cjpeg_wrbmp_checksum += character;
|
||||
|
||||
return character;
|
||||
}
|
||||
|
||||
void
|
||||
cjpeg_wrbmp_finish_output_bmp(cjpeg_wrbmp_j_decompress_ptr cinfo) {
|
||||
CJPEG_WRBMP_JDIMENSION row;
|
||||
cjpeg_wrbmp_cd_progress_ptr progress =
|
||||
(cjpeg_wrbmp_cd_progress_ptr) cinfo->progress;
|
||||
|
||||
// Write the file body from our virtual array
|
||||
__pragma_loopbound(30, 30);
|
||||
for (row = cinfo->output_height; row > 0; --row) {
|
||||
if (progress != 0) {
|
||||
progress->pub.pass_counter = (long) (cinfo->output_height - row);
|
||||
progress->pub.pass_limit = (long) cinfo->output_height;
|
||||
}
|
||||
}
|
||||
|
||||
if (progress != 0)
|
||||
progress->completed_extra_passes++;
|
||||
}
|
||||
|
||||
void
|
||||
cjpeg_wrbmp_write_colormap(cjpeg_wrbmp_j_decompress_ptr cinfo, int map_colors,
|
||||
int map_entry_size, int cMap) {
|
||||
|
||||
int num_colors = cinfo->actual_number_of_colors;
|
||||
int i;
|
||||
|
||||
if (cMap != 0) {
|
||||
|
||||
if (cinfo->out_color_components == 3) {
|
||||
// Normal case with RGB colormap
|
||||
__pragma_loopbound(256, 256);
|
||||
for (i = 0; i < num_colors; i++) {
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[2][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[1][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[0][i]));
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
} else {
|
||||
// Grayscale colormap (only happens with grayscale quantization)
|
||||
__pragma_loopbound(256, 256);
|
||||
for (i = 0; i < num_colors; i++) {
|
||||
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[2][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[1][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[0][i]));
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If no colormap, must be grayscale data. Generate a linear "map".
|
||||
__pragma_loopbound(256, 256);
|
||||
for (i = 0; i < 256; i++) {
|
||||
cjpeg_wrbmp_putc_modified(i);
|
||||
cjpeg_wrbmp_putc_modified(i);
|
||||
cjpeg_wrbmp_putc_modified(i);
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Pad colormap with zeros to ensure specified number of colormap entries.
|
||||
__pragma_loopbound(512, 512);
|
||||
for (; i < map_colors; i++) {
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
cjpeg_wrbmp_main() {
|
||||
cjpeg_wrbmp_finish_output_bmp(&cjpeg_wrbmp_jpeg_dec_1);
|
||||
cjpeg_wrbmp_write_colormap(&cjpeg_wrbmp_jpeg_dec_1, 768, 4, 1);
|
||||
|
||||
cjpeg_wrbmp_finish_output_bmp(&cjpeg_wrbmp_jpeg_dec_2);
|
||||
cjpeg_wrbmp_write_colormap(&cjpeg_wrbmp_jpeg_dec_2, 768, 4, 1);
|
||||
}
|
||||
|
||||
int
|
||||
cjpeg_wrbmp_return() {
|
||||
return (cjpeg_wrbmp_checksum + (-209330)) != 0;
|
||||
}
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int
|
||||
main(void) {
|
||||
cjpeg_wrbmp_init();
|
||||
cjpeg_wrbmp_main();
|
||||
|
||||
return (cjpeg_wrbmp_return());
|
||||
}
|
||||
|
||||
#endif /* BMP_SUPPORTED */
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: input.c
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
Function: Input variables for the cjpeg_jpeg6b_wrbmp.c
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
// Wasm loop bounds
|
||||
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
unsigned char cjpeg_wrbmp_colormap[3][256];
|
||||
|
||||
void
|
||||
cjpeg_wrbmp_initInput(void) {
|
||||
int i, j;
|
||||
volatile unsigned char tmp[3][256] = {
|
||||
{44, 105, 153, 71, 151, 160, 188, 90, 209, 131, 221, 114, 93, 124,
|
||||
208, 207, 218, 54, 145, 113, 153, 239, 226, 83, 243, 151, 98, 67,
|
||||
114, 153, 83, 186, 116, 72, 188, 190, 109, 162, 218, 133, 208, 209,
|
||||
115, 251, 135, 89, 143, 226, 230, 246, 152, 243, 152, 115, 180, 78,
|
||||
246, 164, 250, 117, 76, 150, 152, 188, 251, 195, 127, 111, 225, 208,
|
||||
94, 93, 143, 131, 201, 211, 99, 93, 190, 157, 121, 240, 117, 185,
|
||||
167, 137, 152, 188, 250, 59, 248, 245, 115, 240, 192, 209, 143, 136,
|
||||
98, 224, 167, 135, 132, 189, 72, 249, 205, 44, 106, 96, 147, 247,
|
||||
249, 228, 224, 249, 190, 112, 135, 168, 95, 205, 171, 58, 112, 79,
|
||||
206, 75, 242, 188, 189, 225, 185, 81, 221, 153, 244, 198, 171, 163,
|
||||
159, 209, 240, 138, 148, 207, 166, 192, 188, 151, 98, 190, 209, 154,
|
||||
225, 72, 96, 249, 191, 223, 207, 163, 207, 133, 251, 183, 135, 137,
|
||||
159, 247, 167, 83, 123, 199, 203, 144, 142, 237, 77, 128, 117, 169,
|
||||
202, 136, 128, 188, 168, 55, 222, 169, 116, 60, 75, 175, 102, 217,
|
||||
168, 185, 189, 225, 125, 192, 112, 111, 168, 239, 225, 168, 97, 129,
|
||||
190, 175, 169, 225, 170, 226, 225, 226, 224, 134, 106, 250, 222, 148,
|
||||
241, 168, 166, 160, 95, 190, 102, 180, 193, 111, 151, 165, 171, 200,
|
||||
52, 134, 169, 223, 166, 225, 169, 111, 185, 109, 56, 244, 157, 250,
|
||||
226, 231, 119, 188},
|
||||
{42, 143, 46, 91, 84, 201, 140, 91, 82, 140, 31, 88, 44, 171,
|
||||
57, 115, 206, 59, 145, 117, 116, 53, 232, 117, 80, 60, 66, 64,
|
||||
117, 174, 89, 178, 147, 63, 83, 59, 103, 139, 211, 64, 68, 98,
|
||||
118, 53, 119, 90, 161, 232, 171, 98, 176, 236, 118, 157, 180, 77,
|
||||
114, 88, 28, 119, 40, 97, 69, 189, 252, 225, 119, 96, 219, 84,
|
||||
82, 105, 158, 49, 200, 61, 117, 78, 63, 147, 140, 69, 108, 90,
|
||||
161, 105, 190, 114, 84, 76, 70, 43, 156, 222, 96, 72, 143, 90,
|
||||
105, 56, 144, 78, 129, 35, 66, 101, 100, 49, 105, 130, 160, 239,
|
||||
129, 141, 83, 43, 68, 106, 132, 83, 92, 130, 175, 63, 131, 79,
|
||||
192, 105, 57, 160, 118, 162, 141, 78, 192, 128, 206, 201, 203, 162,
|
||||
159, 163, 221, 183, 157, 177, 189, 192, 129, 130, 54, 104, 45, 101,
|
||||
252, 52, 91, 177, 49, 221, 116, 111, 143, 92, 142, 159, 131, 173,
|
||||
61, 159, 173, 81, 129, 214, 213, 145, 143, 232, 67, 145, 130, 99,
|
||||
237, 110, 160, 131, 67, 50, 129, 131, 127, 76, 92, 203, 96, 206,
|
||||
176, 180, 85, 99, 162, 118, 64, 78, 190, 191, 45, 101, 129, 58,
|
||||
72, 211, 49, 115, 115, 85, 61, 100, 116, 107, 143, 117, 219, 154,
|
||||
225, 174, 160, 163, 119, 190, 106, 186, 49, 45, 177, 147, 85, 138,
|
||||
42, 174, 59, 68, 120, 71, 129, 56, 149, 97, 68, 88, 148, 60,
|
||||
239, 179, 149, 104},
|
||||
{44, 76, 37, 56, 76, 152, 122, 153, 77, 191, 41, 76, 39, 97,
|
||||
46, 109, 172, 43, 116, 91, 102, 49, 201, 68, 88, 45, 53, 95,
|
||||
160, 175, 102, 164, 116, 50, 76, 45, 86, 189, 216, 50, 61, 93,
|
||||
196, 91, 100, 58, 116, 223, 166, 102, 126, 221, 158, 86, 235, 55,
|
||||
113, 120, 52, 115, 42, 86, 55, 165, 247, 194, 160, 108, 170, 108,
|
||||
98, 77, 168, 42, 179, 70, 96, 62, 71, 216, 100, 71, 155, 121,
|
||||
146, 86, 134, 105, 114, 49, 100, 50, 119, 218, 95, 81, 220, 78,
|
||||
102, 50, 125, 68, 170, 36, 62, 119, 129, 44, 151, 72, 143, 241,
|
||||
131, 137, 79, 73, 55, 122, 204, 73, 74, 131, 221, 53, 89, 72,
|
||||
178, 60, 64, 145, 157, 156, 177, 101, 180, 112, 194, 206, 178, 168,
|
||||
221, 153, 201, 119, 222, 165, 188, 212, 117, 180, 45, 134, 42, 130,
|
||||
229, 47, 107, 172, 40, 221, 146, 132, 138, 110, 144, 188, 112, 132,
|
||||
64, 162, 145, 140, 200, 181, 215, 139, 197, 183, 106, 126, 116, 89,
|
||||
204, 152, 123, 161, 52, 46, 131, 167, 173, 62, 70, 151, 151, 197,
|
||||
177, 184, 96, 97, 101, 130, 54, 63, 141, 185, 45, 126, 96, 46,
|
||||
71, 172, 38, 114, 100, 106, 69, 118, 138, 127, 99, 127, 198, 204,
|
||||
242, 248, 197, 241, 74, 189, 178, 252, 65, 45, 148, 145, 97, 168,
|
||||
45, 111, 43, 64, 164, 80, 113, 47, 136, 83, 42, 91, 197, 95,
|
||||
222, 167, 92, 98}};
|
||||
|
||||
__pragma_loopbound(3, 3);
|
||||
for (i = 0; i < 3; i++) {
|
||||
__pragma_loopbound(256, 256);
|
||||
for (j = 0; j < 256; j++)
|
||||
cjpeg_wrbmp_colormap[i][j] = tmp[i][j];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cderror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README files
|
||||
*/
|
||||
|
||||
#ifndef JCONFIG_H
|
||||
#define JCONFIG_H
|
||||
|
||||
#define CJPEG_WRBMP_HAVE_PROTOTYPES
|
||||
#define CJPEG_WRBMP_HAVE_UNSIGNED_CHAR
|
||||
#define CJPEG_WRBMP_HAVE_UNSIGNED_SHORT
|
||||
#undef void
|
||||
#undef const
|
||||
#undef CHAR_IS_UNSIGNED
|
||||
#define CJPEG_WRBMP_HAVE_STDDEF_H
|
||||
#define CJPEG_WRBMP_HAVE_STDLIB_H
|
||||
#undef NEED_BSD_STRINGS
|
||||
#undef NEED_SYS_TYPES_H
|
||||
#undef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||
/* Define this if you get warnings about undefined structures. */
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
|
||||
|
||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||
#define INLINE __inline__
|
||||
/* These are for configuring the JPEG memory manager. */
|
||||
#undef DEFAULT_MAX_MEM
|
||||
#undef NO_MKTEMP
|
||||
|
||||
#endif /* JPEG_INTERNALS */
|
||||
|
||||
#ifdef CJPEG_WRBMP_JPEG_CJPEG_DJPEG
|
||||
|
||||
#define CJPEG_WRBMP_BMP_SUPPORTED /* BMP image file format */
|
||||
#define CJPEG_WRBMP_GIF_SUPPORTED /* GIF image file format */
|
||||
#define CJPEG_WRBMP_PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||
#define CJPEG_WRBMP_TARGA_SUPPORTED /* Targa image file format */
|
||||
|
||||
#undef TWO_FILE_COMMANDLINE
|
||||
#undef NEED_SIGNAL_CATCHER
|
||||
#undef DONT_USE_B_MODE
|
||||
|
||||
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
|
||||
#undef PROGRESS_REPORT
|
||||
|
||||
#endif /* JPEG_CJPEG_DJPEG */
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,333 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jerror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file defines the error and message codes for the JPEG library.
|
||||
Edit this file to add new codes, or to translate the message strings to
|
||||
some other language.
|
||||
A set of error-reporting macros are defined too. Some applications using
|
||||
the JPEG library may wish to include this file to get the error codes
|
||||
sand/or the macros.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
/*
|
||||
To define the enum list of message codes, include this file without
|
||||
defining macro JMESSAGE. To create a message string table, include it
|
||||
again with a suitable JMESSAGE definition (see jerror.c for an example).
|
||||
*/
|
||||
|
||||
#ifndef CJPEG_WRBMP_JMESSAGE
|
||||
#ifndef JERROR_H
|
||||
/* First time through, define the enum list */
|
||||
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#else
|
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string)
|
||||
#endif /* JERROR_H */
|
||||
#endif /* JMESSAGE */
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
typedef enum {
|
||||
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string) code,
|
||||
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE(JMSG_NOMESSAGE,
|
||||
"Bogus message code %d") /* Must be first entry! */
|
||||
|
||||
/* For maintenance convenience, list is alphabetical by message code name */
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_ARITH_NOTIMPL,
|
||||
"Sorry, there are legal "
|
||||
"restrictions on arithmetic "
|
||||
"coding") CJPEG_WRBMP_JMESSAGE(JERR_BAD_ALIGN_TYPE,
|
||||
"ALIGN_TYPE is wrong, please fix")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_ALLOC_CHUNK,
|
||||
"MAX_ALLOC_"
|
||||
"CHUNK is "
|
||||
"wrong, please "
|
||||
"fix") CJPEG_WRBMP_JMESSAGE(JERR_BAD_BUFFER_MODE,
|
||||
"Bogus buffer control mode")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_COMPONENT_ID,
|
||||
"Invalid "
|
||||
"component ID %d "
|
||||
"in SOS") CJPEG_WRBMP_JMESSAGE(JERR_BAD_DCT_COEF,
|
||||
"DCT coefficient out of "
|
||||
"range")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_DCTSIZE,
|
||||
"IDCT output block size %d not supported")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_HUFF_TABLE,
|
||||
"Bogus Huffman table "
|
||||
"definition")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_IN_COLORSPACE,
|
||||
"Bogus input colorspace")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_J_COLORSPACE,
|
||||
"Bogus JPEG colorspace")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_LENGTH, "Bogus "
|
||||
"marker "
|
||||
"length")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_LIB_VERSION,
|
||||
"Wrong JPEG library version: "
|
||||
"library is %d, caller expects %d")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large "
|
||||
"for interleaved scan") CJPEG_WRBMP_JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code "
|
||||
"%d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PRECISION,
|
||||
"Unsupported JPEG data precision %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PROGRESSION, "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PROG_SCRIPT, "Invalid progressive parameters at scan script entry %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_SAMPLING,
|
||||
"Bogus sampling factors") CJPEG_WRBMP_JMESSAGE(JERR_BAD_SCAN_SCRIPT,
|
||||
"Invalid scan script at entry %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_STATE,
|
||||
"Improper call to JPEG library in state %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_STRUCT_SIZE,
|
||||
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") CJPEG_WRBMP_JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") CJPEG_WRBMP_JMESSAGE(JERR_BUFFER_SIZE,
|
||||
"Buffer passed to JPEG library is too small") CJPEG_WRBMP_JMESSAGE(JERR_CANT_SUSPEND,
|
||||
"Suspension not allowed here") CJPEG_WRBMP_JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") CJPEG_WRBMP_JMESSAGE(JERR_CONVERSION_NOTIMPL,
|
||||
"Unsupported color conversion request") CJPEG_WRBMP_JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") CJPEG_WRBMP_JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") CJPEG_WRBMP_JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") CJPEG_WRBMP_JMESSAGE(JERR_DQT_INDEX,
|
||||
"Bogus DQT index %d") CJPEG_WRBMP_JMESSAGE(JERR_EMPTY_IMAGE,
|
||||
"Empty JPEG image (DNL not supported)") CJPEG_WRBMP_JMESSAGE(JERR_EMS_READ, "Read from EMS failed") CJPEG_WRBMP_JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") CJPEG_WRBMP_JMESSAGE(JERR_EOI_EXPECTED,
|
||||
"Didn't expect more than one scan") CJPEG_WRBMP_JMESSAGE(JERR_FILE_READ, "Input file read error") CJPEG_WRBMP_JMESSAGE(JERR_FILE_WRITE,
|
||||
"Output file write error --- out of disk space?") CJPEG_WRBMP_JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL,
|
||||
"Fractional sampling not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") CJPEG_WRBMP_JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") CJPEG_WRBMP_JMESSAGE(JERR_IMAGE_TOO_BIG,
|
||||
"Maximum supported image dimension is %u pixels") CJPEG_WRBMP_JMESSAGE(JERR_INPUT_EMPTY,
|
||||
"Empty input file") CJPEG_WRBMP_JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") CJPEG_WRBMP_JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, "Cannot transcode due to multiple use of quantization table %d") CJPEG_WRBMP_JMESSAGE(JERR_MISSING_DATA,
|
||||
"Scan script does not transmit all data") CJPEG_WRBMP_JMESSAGE(JERR_MODE_CHANGE,
|
||||
"Invalid color quantization mode change") CJPEG_WRBMP_JMESSAGE(JERR_NOTIMPL, "Not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_NOT_COMPILED,
|
||||
"Requested feature was omitted at compile time") CJPEG_WRBMP_JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") CJPEG_WRBMP_JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") CJPEG_WRBMP_JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") CJPEG_WRBMP_JMESSAGE(JERR_NO_QUANT_TABLE,
|
||||
"Quantization table 0x%02x was not defined") CJPEG_WRBMP_JMESSAGE(JERR_NO_SOI,
|
||||
"Not a JPEG file: starts with 0x%02x 0x%02x") CJPEG_WRBMP_JMESSAGE(JERR_OUT_OF_MEMORY,
|
||||
"Insufficient memory (case %d)") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_COMPONENTS,
|
||||
"Cannot quantize more than %d color components") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_SOF_NO_SOS, "Invalid JPEG "
|
||||
"file "
|
||||
"structure: "
|
||||
"missing SOS "
|
||||
"marker") CJPEG_WRBMP_JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_SOS_NO_SOF, "Invalid "
|
||||
"JPEG "
|
||||
"file "
|
||||
"structure"
|
||||
": SOS "
|
||||
"before "
|
||||
"SOF") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_SEEK,
|
||||
"Seek failed on temporary file") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_WRITE, "Write failed on temporary file --- out of disk space?") CJPEG_WRBMP_JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") CJPEG_WRBMP_JMESSAGE(JERR_UNKNOWN_MARKER,
|
||||
"Unsupported marker type 0x%02x") CJPEG_WRBMP_JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") CJPEG_WRBMP_JMESSAGE(JERR_WIDTH_OVERFLOW,
|
||||
"Image too wide for this implementation") CJPEG_WRBMP_JMESSAGE(JERR_XMS_READ,
|
||||
"Read from XMS failed") CJPEG_WRBMP_JMESSAGE(JERR_XMS_WRITE,
|
||||
"Write to XMS failed") CJPEG_WRBMP_JMESSAGE(JMSG_COPYRIGHT,
|
||||
JCOPYRIGHT) CJPEG_WRBMP_JMESSAGE(JMSG_VERSION, JVERSION) CJPEG_WRBMP_JMESSAGE(JTRC_16BIT_TABLES, "Caution: quantization tables are too coarse for baseline JPEG") CJPEG_WRBMP_JMESSAGE(JTRC_ADOBE,
|
||||
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") CJPEG_WRBMP_JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") CJPEG_WRBMP_JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") CJPEG_WRBMP_JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_DQT,
|
||||
"Define Quantization Table %d precision %d") CJPEG_WRBMP_JMESSAGE(JTRC_DRI,
|
||||
"Define Restart Interval %u") CJPEG_WRBMP_JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_EOI,
|
||||
"End Of Image") CJPEG_WRBMP_JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, "Warning: thumbnail image size does not match data length %u") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_EXTENSION,
|
||||
"JFIF extension marker: type 0x%02x, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_THUMBNAIL,
|
||||
" with %d x %d thumbnail image") CJPEG_WRBMP_JMESSAGE(JTRC_MISC_MARKER,
|
||||
"Miscellaneous marker 0x%02x, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_QUANTVALS,
|
||||
" %4u %4u %4u %4u %4u %4u %4u %4u") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") CJPEG_WRBMP_JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") CJPEG_WRBMP_JMESSAGE(JTRC_RST, "RST%d") CJPEG_WRBMP_JMESSAGE(JTRC_SMOOTH_NOTIMPL,
|
||||
"Smoothing not supported with nonstandard sampling ratios") CJPEG_WRBMP_JMESSAGE(JTRC_SOF,
|
||||
"Start Of Frame 0x%02x: width=%u, height=%u, components=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOF_COMPONENT,
|
||||
" Component %d: %dhx%dv q=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOI, "Start of Image") CJPEG_WRBMP_JMESSAGE(JTRC_SOS,
|
||||
"Start Of Scan: %d components") CJPEG_WRBMP_JMESSAGE(JTRC_SOS_COMPONENT,
|
||||
" Component %d: dc=%d ac=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") CJPEG_WRBMP_JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") CJPEG_WRBMP_JMESSAGE(JTRC_TFILE_OPEN,
|
||||
"Opened temporary file %s") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_JPEG,
|
||||
"JFIF extension marker: JPEG-compressed thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_PALETTE,
|
||||
"JFIF extension marker: palette thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_RGB,
|
||||
"JFIF extension marker: RGB thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_UNKNOWN_IDS,
|
||||
"Unrecognized"
|
||||
" component "
|
||||
"IDs %d %d "
|
||||
"%d, "
|
||||
"assuming "
|
||||
"YCbCr") CJPEG_WRBMP_JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_XMS_OPEN,
|
||||
"Obtained XMS handle %u") CJPEG_WRBMP_JMESSAGE(JWRN_ADOBE_XFORM,
|
||||
"Unknown Adobe color "
|
||||
"transform code %d")
|
||||
CJPEG_WRBMP_JMESSAGE(JWRN_BOGUS_PROGRESSION,
|
||||
"I"
|
||||
"n"
|
||||
"c"
|
||||
"o"
|
||||
"n"
|
||||
"s"
|
||||
"i"
|
||||
"s"
|
||||
"t"
|
||||
"e"
|
||||
"n"
|
||||
"t"
|
||||
" "
|
||||
"p"
|
||||
"r"
|
||||
"o"
|
||||
"g"
|
||||
"r"
|
||||
"e"
|
||||
"s"
|
||||
"s"
|
||||
"i"
|
||||
"o"
|
||||
"n"
|
||||
" "
|
||||
"s"
|
||||
"e"
|
||||
"q"
|
||||
"u"
|
||||
"e"
|
||||
"n"
|
||||
"c"
|
||||
"e"
|
||||
" "
|
||||
"f"
|
||||
"o"
|
||||
"r"
|
||||
" "
|
||||
"c"
|
||||
"o"
|
||||
"m"
|
||||
"p"
|
||||
"o"
|
||||
"n"
|
||||
"e"
|
||||
"n"
|
||||
"t"
|
||||
" "
|
||||
"%"
|
||||
"d"
|
||||
" "
|
||||
"c"
|
||||
"o"
|
||||
"e"
|
||||
"f"
|
||||
"f"
|
||||
"i"
|
||||
"c"
|
||||
"i"
|
||||
"e"
|
||||
"n"
|
||||
"t"
|
||||
" "
|
||||
"%"
|
||||
"d") CJPEG_WRBMP_JMESSAGE(JWRN_EXTRANEOUS_DATA,
|
||||
"Corrupt JPEG data: %u "
|
||||
"extraneous bytes "
|
||||
"before marker 0x%02x")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_HIT_MARKER,
|
||||
"Corrupt JPEG "
|
||||
"data: "
|
||||
"premature end "
|
||||
"of data "
|
||||
"segment")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_HUFF_BAD_CODE,
|
||||
"Corrupt "
|
||||
"JPEG "
|
||||
"data: bad "
|
||||
"Huffman "
|
||||
"code")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_JFIF_MAJOR,
|
||||
"Warnin"
|
||||
"g: "
|
||||
"unknow"
|
||||
"n "
|
||||
"JFIF "
|
||||
"revisi"
|
||||
"on "
|
||||
"number"
|
||||
" "
|
||||
"%d.%"
|
||||
"02d") CJPEG_WRBMP_JMESSAGE(JWRN_JPEG_EOF,
|
||||
"Premature end of JPEG file")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_MUST_RESYNC,
|
||||
"Co"
|
||||
"rr"
|
||||
"up"
|
||||
"t "
|
||||
"JP"
|
||||
"EG"
|
||||
" "
|
||||
"da"
|
||||
"ta"
|
||||
": "
|
||||
"fo"
|
||||
"un"
|
||||
"d "
|
||||
"ma"
|
||||
"rk"
|
||||
"er"
|
||||
" "
|
||||
"0x"
|
||||
"%0"
|
||||
"2x"
|
||||
" "
|
||||
"in"
|
||||
"st"
|
||||
"ea"
|
||||
"d "
|
||||
"of"
|
||||
" R"
|
||||
"ST"
|
||||
"%"
|
||||
"d")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_NOT_SEQUENTIAL,
|
||||
"Invali"
|
||||
"d SOS "
|
||||
"parame"
|
||||
"ters "
|
||||
"for "
|
||||
"sequen"
|
||||
"tial "
|
||||
"JPEG")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_TOO_MUCH_DATA,
|
||||
"Ap"
|
||||
"pl"
|
||||
"ic"
|
||||
"at"
|
||||
"io"
|
||||
"n "
|
||||
"tr"
|
||||
"an"
|
||||
"sf"
|
||||
"er"
|
||||
"re"
|
||||
"d "
|
||||
"to"
|
||||
"o "
|
||||
"ma"
|
||||
"ny"
|
||||
" s"
|
||||
"ca"
|
||||
"nl"
|
||||
"in"
|
||||
"e"
|
||||
"s")
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
JMSG_LASTMSGCODE
|
||||
} CJPEG_WRBMP_J_MESSAGE_CODE;
|
||||
|
||||
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
|
||||
#undef CJPEG_WRBMP_JMESSAGE
|
||||
@ -0,0 +1,91 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jmorecfg.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
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 additional configuration options that customize the
|
||||
JPEG software for special applications or support machine-dependent
|
||||
optimizations. Most users will not need to touch this file.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
#ifndef JMORECFG_H
|
||||
#define JMORECFG_H
|
||||
|
||||
#define CJPEG_WRBMP_GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
typedef unsigned char CJPEG_WRBMP_JSAMPLE;
|
||||
typedef short CJPEG_WRBMP_JCOEF;
|
||||
typedef unsigned char CJPEG_WRBMP_JOCTET;
|
||||
|
||||
/* These typedefs are used for various table entries and so forth.
|
||||
They must be at least as wide as specified; but making them too big
|
||||
won't cost a huge amount of memory, so we don't provide special
|
||||
extraction code like we did for JSAMPLE. (In other words, these
|
||||
typedefs live at a different point on the speed/space tradeoff curve.)
|
||||
*/
|
||||
|
||||
/* UINT8 must hold at least the values 0..255. */
|
||||
|
||||
typedef unsigned char CJPEG_WRBMP_UINT8;
|
||||
|
||||
/* UINT16 must hold at least the values 0..65535. */
|
||||
|
||||
typedef unsigned short CJPEG_WRBMP_UINT16;
|
||||
|
||||
/* INT16 must hold at least the values -32768..32767. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
||||
typedef short INT16;
|
||||
#endif
|
||||
|
||||
/* INT32 must hold at least signed 32-bit values. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||
typedef long INT32;
|
||||
#endif
|
||||
|
||||
typedef unsigned int CJPEG_WRBMP_JDIMENSION;
|
||||
|
||||
/* This macro is used to declare a "method", that is, a function pointer.
|
||||
We want to supply prototype parameters if the compiler can cope.
|
||||
Note that the arglist parameter must be parenthesized!
|
||||
Again, you can customize this if you need special linkage keywords.
|
||||
*/
|
||||
|
||||
#define EXTERN(type) extern type
|
||||
|
||||
#ifdef CJPEG_WRBMP_HAVE_PROTOTYPES
|
||||
#define CJPEG_WRBMP_JMETHOD(type, methodname, arglist) type(*methodname) arglist
|
||||
#else
|
||||
#define CJPEG_WRBMP_JMETHOD(type, methodname, arglist) type (*methodname)()
|
||||
#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
|
||||
explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||
*/
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
|
||||
#define CJPEG_WRBMP_FAR far
|
||||
#else
|
||||
#define CJPEG_WRBMP_FAR
|
||||
#endif
|
||||
|
||||
#ifndef CJPEG_JPEG6B_WRBMP_HAVE_BOOLEAN
|
||||
typedef int cjpeg_wrbmp_boolean;
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,844 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jpeglib.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
This file defines the application interface for the JPEG library.
|
||||
Most applications using the library need only include this file,
|
||||
and perhaps jerror.h if they want to know the exact error codes.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
#ifndef JPEGLIB_H
|
||||
#define JPEGLIB_H
|
||||
|
||||
typedef int CJPEG_WRBMP_FILE;
|
||||
typedef unsigned int cjpeg_wrbmp_size_t;
|
||||
|
||||
/*
|
||||
First we include the configuration files that record how this
|
||||
installation of the JPEG library is set up. jconfig.h can be
|
||||
generated automatically for many systems. jmorecfg.h contains
|
||||
manual configuration options that most people need not worry about.
|
||||
*/
|
||||
|
||||
#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
|
||||
#include "jconfig.h" /* widely used configuration options */
|
||||
#endif
|
||||
#include "jmorecfg.h" /* seldom changed options */
|
||||
|
||||
/* Data structures for images (arrays of samples and of DCT coefficients).
|
||||
On 80x86 machines, the image arrays are too big for near pointers,
|
||||
but the pointer arrays can fit in near memory.
|
||||
*/
|
||||
|
||||
typedef CJPEG_WRBMP_JSAMPLE CJPEG_WRBMP_FAR
|
||||
*CJPEG_WRBMP_JSAMPROW; /* ptr to one image row of pixel samples. */
|
||||
typedef CJPEG_WRBMP_JSAMPROW
|
||||
*CJPEG_WRBMP_JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
|
||||
typedef CJPEG_WRBMP_JSAMPARRAY
|
||||
*CJPEG_WRBMP_JSAMPIMAGE; /* a 3-D sample array: top index is color */
|
||||
|
||||
typedef CJPEG_WRBMP_JCOEF
|
||||
CJPEG_WRBMP_JBLOCK[64]; /* one block of coefficients */
|
||||
typedef CJPEG_WRBMP_JBLOCK CJPEG_WRBMP_FAR
|
||||
*CJPEG_WRBMP_JBLOCKROW; /* pointer to one row of coefficient blocks */
|
||||
typedef CJPEG_WRBMP_JBLOCKROW
|
||||
*CJPEG_WRBMP_JBLOCKARRAY; /* a 2-D array of coefficient blocks */
|
||||
typedef CJPEG_WRBMP_JBLOCKARRAY
|
||||
*CJPEG_WRBMP_JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
|
||||
|
||||
typedef CJPEG_WRBMP_JCOEF CJPEG_WRBMP_FAR
|
||||
*JCOEFPTR; /* useful in a couple of places */
|
||||
|
||||
/* Types for JPEG compression parameters and working tables. */
|
||||
|
||||
/* DCT coefficient quantization tables. */
|
||||
|
||||
typedef struct {
|
||||
/* This array gives the coefficient quantizers in natural array order
|
||||
(not the zigzag order in which they are stored in a JPEG DQT marker).
|
||||
CAUTION: IJG versions prior to v6a kept this array in zigzag order.
|
||||
*/
|
||||
CJPEG_WRBMP_UINT16
|
||||
quantval[64]; /* quantization step for each coefficient */
|
||||
/* This field is used only during compression. It's initialized FALSE when
|
||||
the table is created, and set TRUE when it's been output to the file.
|
||||
You could suppress output of a table by setting this to TRUE.
|
||||
(See jpeg_suppress_tables for an example.)
|
||||
*/
|
||||
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
|
||||
} CJPEG_WRBMP_JQUANT_TBL;
|
||||
|
||||
/* Huffman coding tables. */
|
||||
|
||||
typedef struct {
|
||||
/* These two fields directly represent the contents of a JPEG DHT marker */
|
||||
CJPEG_WRBMP_UINT8 bits[17]; /* bits[ k ] = # of symbols with codes of */
|
||||
/* length k bits; bits[ 0 ] is unused */
|
||||
CJPEG_WRBMP_UINT8
|
||||
huffval[256]; /* The symbols, in order of incr code length */
|
||||
/* This field is used only during compression. It's initialized FALSE when
|
||||
the table is created, and set TRUE when it's been output to the file.
|
||||
You could suppress output of a table by setting this to TRUE.
|
||||
(See jpeg_suppress_tables for an example.)
|
||||
*/
|
||||
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
|
||||
} CJPEG_WRBMP_JHUFF_TBL;
|
||||
|
||||
/* Basic info about one component (color channel). */
|
||||
|
||||
typedef struct {
|
||||
/* These values are fixed over the whole image. */
|
||||
/* For compression, they must be supplied by parameter setup; */
|
||||
/* for decompression, they are read from the SOF marker. */
|
||||
int component_id; /* identifier for this component (0..255) */
|
||||
int component_index; /* its index in SOF or cinfo->comp_info[ ] */
|
||||
int h_samp_factor; /* horizontal sampling factor (1..4) */
|
||||
int v_samp_factor; /* vertical sampling factor (1..4) */
|
||||
int quant_tbl_no; /* quantization table selector (0..3) */
|
||||
/* These values may vary between scans. */
|
||||
/* For compression, they must be supplied by parameter setup; */
|
||||
/* for decompression, they are read from the SOS marker. */
|
||||
/* The decompressor output side may not use these variables. */
|
||||
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
||||
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
||||
|
||||
/* Remaining fields should be treated as private by applications. */
|
||||
|
||||
/* These values are computed during compression or decompression startup: */
|
||||
/* Component's size in DCT blocks.
|
||||
Any dummy blocks added to complete an MCU are not counted; therefore
|
||||
these values do not depend on whether a scan is interleaved or not.
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION width_in_blocks;
|
||||
CJPEG_WRBMP_JDIMENSION height_in_blocks;
|
||||
/* Size of a DCT block in samples. Always DCTSIZE for compression.
|
||||
For decompression this is the size of the output from one DCT block,
|
||||
reflecting any scaling we choose to apply during the IDCT step.
|
||||
Values of 1,2,4,8 are likely to be supported. Note that different
|
||||
components may receive different IDCT scalings.
|
||||
*/
|
||||
int DCT_scaled_size;
|
||||
/* The downsampled dimensions are the component's actual, unpadded number
|
||||
of samples at the main buffer (preprocessing/compression interface), thus
|
||||
downsampled_width = ceil(image_width * Hi/Hmax)
|
||||
and similarly for height. For decompression, IDCT scaling is included,
|
||||
so downsampled_width = ceil(image_width * Hi/Hmax *
|
||||
DCT_scaled_size/DCTSIZE)
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION downsampled_width; /* actual width in samples */
|
||||
CJPEG_WRBMP_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.
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
component_needed; /* do we need the value of this component? */
|
||||
|
||||
/* 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 last_col_width; /* # of non-dummy blocks across in last MCU */
|
||||
int last_row_height; /* # of non-dummy blocks down in last MCU */
|
||||
|
||||
/* Saved quantization table for component; NULL if none yet saved.
|
||||
See jdinput.c comments about the need for this information.
|
||||
This field is currently used only for decompression.
|
||||
*/
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_table;
|
||||
|
||||
/* Private per-component storage for DCT or IDCT subsystem. */
|
||||
void *dct_table;
|
||||
} cjpeg_wrbmp_jpeg_component_info;
|
||||
|
||||
/* The script for encoding a multiple-scan file is an array of these: */
|
||||
|
||||
typedef struct {
|
||||
int comps_in_scan; /* number of components encoded in this scan */
|
||||
int component_index[4]; /* their SOF/comp_info[ ] indexes */
|
||||
int Ss, Se; /* progressive JPEG spectral selection parms */
|
||||
int Ah, Al; /* progressive JPEG successive approx. parms */
|
||||
} cjpeg_wrbmp_jpeg_scan_info;
|
||||
|
||||
/* The decompressor can save APPn and COM markers in a list of these: */
|
||||
|
||||
typedef struct cjpeg_wrbmp_jpeg_marker_struct CJPEG_WRBMP_FAR
|
||||
*jpeg_saved_marker_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_marker_struct {
|
||||
jpeg_saved_marker_ptr next; /* next in list, or NULL */
|
||||
CJPEG_WRBMP_UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
|
||||
unsigned int original_length; /* # bytes of data in the file */
|
||||
unsigned int data_length; /* # bytes of data saved at data[ ] */
|
||||
CJPEG_WRBMP_JOCTET CJPEG_WRBMP_FAR
|
||||
*data; /* the data contained in the marker */
|
||||
/* the marker length word is not counted in data_length or original_length
|
||||
*/
|
||||
};
|
||||
|
||||
/* Known color spaces. */
|
||||
|
||||
typedef enum {
|
||||
JCS_UNKNOWN, /* error/unspecified */
|
||||
JCS_GRAYSCALE, /* monochrome */
|
||||
JCS_RGB, /* red/green/blue */
|
||||
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
|
||||
JCS_CMYK, /* C/M/Y/K */
|
||||
JCS_YCCK /* Y/Cb/Cr/K */
|
||||
} CJPEG_WRBMP_J_COLOR_SPACE;
|
||||
|
||||
/* DCT/IDCT algorithm options. */
|
||||
|
||||
typedef enum {
|
||||
JDCT_ISLOW, /* slow but accurate integer algorithm */
|
||||
JDCT_IFAST, /* faster, less accurate integer method */
|
||||
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
|
||||
} CJPEG_WRBMP_J_DCT_METHOD;
|
||||
|
||||
/* Dithering options for decompression. */
|
||||
|
||||
typedef enum {
|
||||
JDITHER_NONE, /* no dithering */
|
||||
JDITHER_ORDERED, /* simple ordered dither */
|
||||
JDITHER_FS /* Floyd-Steinberg error diffusion dither */
|
||||
} CJPEG_WRBMP_J_DITHER_MODE;
|
||||
|
||||
/* Common fields between JPEG compression and decompression master structs. */
|
||||
|
||||
#define cjpeg_wrbmp_jpeg_common_fields \
|
||||
struct cjpeg_wrbmp_jpeg_error_mgr *err; /* Error handler module */ \
|
||||
struct cjpeg_wrbmp_jpeg_memory_mgr *mem; /* Memory manager module */ \
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr \
|
||||
*progress; /* Progress monitor, or NULL if none */ \
|
||||
void *client_data; /* Available for use by application */ \
|
||||
cjpeg_wrbmp_boolean \
|
||||
is_decompressor; /* So common code can tell which is which */ \
|
||||
int global_state /* For checking call sequence validity */
|
||||
|
||||
/* Routines that are to be used by both halves of the library are declared
|
||||
to receive a pointer to this structure. There are no actual instances of
|
||||
jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
|
||||
*/
|
||||
struct cjpeg_wrbmp_jpeg_common_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields common to both master struct types
|
||||
*/
|
||||
/* Additional fields follow in an actual jpeg_compress_struct or
|
||||
jpeg_decompress_struct. All three structs must agree on these
|
||||
initial fields! (This would be a lot cleaner in C++.)
|
||||
*/
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_jpeg_common_struct *cjpeg_wrbmp_j_common_ptr;
|
||||
typedef struct cjpeg_wrbmp_jpeg_compress_struct *cjpeg_wrbmp_j_compress_ptr;
|
||||
typedef struct cjpeg_wrbmp_jpeg_decompress_struct *cjpeg_wrbmp_j_decompress_ptr;
|
||||
|
||||
/* Master record for a compression instance */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_compress_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_decompress_struct
|
||||
*/
|
||||
|
||||
/* Destination for compressed data */
|
||||
struct cjpeg_wrbmp_jpeg_destination_mgr *dest;
|
||||
|
||||
/* Description of source image --- these fields must be filled in by
|
||||
outer application before starting compression. in_color_space must
|
||||
be correct before you can even call jpeg_set_defaults().
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION image_width; /* input image width */
|
||||
CJPEG_WRBMP_JDIMENSION image_height; /* input image height */
|
||||
int input_components; /* # of color components in input image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE in_color_space; /* colorspace of input image */
|
||||
|
||||
float input_gamma; /* image gamma of input image */
|
||||
|
||||
/* Compression parameters --- these fields must be set before calling
|
||||
jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
|
||||
initialize everything to reasonable defaults, then changing anything
|
||||
the application specifically wants to change. That way you won't get
|
||||
burnt when new parameters are added. Also note that there are several
|
||||
helper routines to simplify changing parameters.
|
||||
*/
|
||||
|
||||
int data_precision; /* bits of precision in image data */
|
||||
|
||||
int num_components; /* # of color components in JPEG image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE
|
||||
jpeg_color_space; /* colorspace of JPEG image */
|
||||
|
||||
cjpeg_wrbmp_jpeg_component_info *comp_info;
|
||||
/* comp_info[ i ] describes component that appears i'th in SOF */
|
||||
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4];
|
||||
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4];
|
||||
/* ptrs to Huffman coding tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_L[16]; /* L values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_U[16]; /* U values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_ac_K[16]; /* Kx values for AC arith-coding tables */
|
||||
|
||||
int num_scans; /* # of entries in scan_info array */
|
||||
const cjpeg_wrbmp_jpeg_scan_info
|
||||
*scan_info; /* script for multi-scan file, or NULL */
|
||||
/* The default value of scan_info is NULL, which causes a single-scan
|
||||
sequential JPEG file to be emitted. To create a multi-scan file,
|
||||
set num_scans and scan_info to point to an array of scan definitions.
|
||||
*/
|
||||
|
||||
cjpeg_wrbmp_boolean raw_data_in; /* TRUE=caller supplies downsampled data */
|
||||
cjpeg_wrbmp_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
cjpeg_wrbmp_boolean
|
||||
optimize_coding; /* TRUE=optimize entropy encoding parms */
|
||||
cjpeg_wrbmp_boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
|
||||
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* DCT algorithm selector */
|
||||
|
||||
/* The restart interval can be specified in absolute MCUs by setting
|
||||
restart_interval, or in MCU rows by setting restart_in_rows
|
||||
(in which case the correct restart_interval will be figured
|
||||
for each scan).
|
||||
*/
|
||||
unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
|
||||
int restart_in_rows; /* if > 0, MCU rows per restart interval */
|
||||
|
||||
/* Parameters controlling emission of special markers. */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
write_JFIF_header; /* should a JFIF marker be written? */
|
||||
CJPEG_WRBMP_UINT8
|
||||
JFIF_major_version; /* What to write for the JFIF version number */
|
||||
CJPEG_WRBMP_UINT8 JFIF_minor_version;
|
||||
/* These three values are not used by the JPEG code, merely copied */
|
||||
/* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
|
||||
/* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
|
||||
/* ratio is defined by X_density/Y_density even when density_unit=0. */
|
||||
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
|
||||
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
|
||||
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
|
||||
cjpeg_wrbmp_boolean
|
||||
write_Adobe_marker; /* should an Adobe marker be written? */
|
||||
|
||||
/* 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)".
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION next_scanline; /* 0 .. image_height-1 */
|
||||
|
||||
/* Remaining fields are known throughout compressor, but generally
|
||||
should not be touched by a surrounding application.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are computed during compression startup
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
progressive_mode; /* TRUE if scan script uses progressive mode */
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
||||
/* The coefficient controller receives data in units of MCU rows as defined
|
||||
for fully interleaved scans (whether the JPEG file is interleaved or
|
||||
not). There are v_samp_factor * DCTSIZE sample rows of each component in
|
||||
an "iMCU" (interleaved MCU) row.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are valid during any one scan.
|
||||
They describe the components and MCUs actually appearing in the scan.
|
||||
*/
|
||||
int comps_in_scan; /* # of JPEG components in this scan */
|
||||
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4];
|
||||
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[10];
|
||||
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
cjpeg_wrbmp_jpeg_scan_info
|
||||
*script_space; /* workspace for jpeg_simple_progression */
|
||||
int script_space_size;
|
||||
};
|
||||
|
||||
/* Master record for a decompression instance */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_compress_struct
|
||||
*/
|
||||
|
||||
/* Source of compressed data */
|
||||
struct cjpeg_wrbmp_jpeg_source_mgr *src;
|
||||
|
||||
/* Basic description of image --- filled in by jpeg_read_header(). */
|
||||
/* Application may inspect these values to decide how to process image. */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
image_width; /* nominal image width (from SOF marker) */
|
||||
CJPEG_WRBMP_JDIMENSION image_height; /* nominal image height */
|
||||
int num_components; /* # of color components in JPEG image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE
|
||||
jpeg_color_space; /* colorspace of JPEG image */
|
||||
|
||||
/* Decompression processing parameters --- these fields must be set before
|
||||
calling jpeg_start_decompress(). Note that jpeg_read_header()
|
||||
initializes them to default values.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_J_COLOR_SPACE out_color_space; /* colorspace for output */
|
||||
|
||||
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
|
||||
|
||||
float output_gamma; /* image gamma wanted in output */
|
||||
|
||||
cjpeg_wrbmp_boolean buffered_image; /* TRUE=multiple output passes */
|
||||
cjpeg_wrbmp_boolean raw_data_out; /* TRUE=downsampled data wanted */
|
||||
|
||||
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* IDCT algorithm selector */
|
||||
cjpeg_wrbmp_boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
|
||||
cjpeg_wrbmp_boolean
|
||||
do_block_smoothing; /* TRUE=apply interblock smoothing */
|
||||
|
||||
cjpeg_wrbmp_boolean quantize_colors; /* TRUE=colormapped output wanted */
|
||||
/* the following are ignored if not quantize_colors: */
|
||||
CJPEG_WRBMP_J_DITHER_MODE
|
||||
dither_mode; /* type of color dithering to use */
|
||||
cjpeg_wrbmp_boolean
|
||||
two_pass_quantize; /* TRUE=use two-pass color quantization */
|
||||
int desired_number_of_colors; /* max # colors to use in created colormap */
|
||||
/* these are significant only in buffered-image mode: */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_1pass_quant; /* enable future use of 1-pass quantizer */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_EXTERNal_quant; /* enable future use of EXTERNal colormap */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_2pass_quant; /* enable future use of 2-pass quantizer */
|
||||
|
||||
/* Description of actual output image that will be returned to application.
|
||||
These fields are computed by jpeg_start_decompress().
|
||||
You can also use jpeg_calc_output_dimensions() to determine these values
|
||||
in advance of calling jpeg_start_decompress().
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION output_width; /* scaled image width */
|
||||
CJPEG_WRBMP_JDIMENSION output_height; /* scaled image height */
|
||||
int out_color_components; /* # of color components in out_color_space */
|
||||
int output_components; /* # of color components returned */
|
||||
/* output_components is 1 (a colormap index) when quantizing colors;
|
||||
otherwise it equals out_color_components.
|
||||
*/
|
||||
int rec_outbuf_height; /* min recommended height of scanline buffer */
|
||||
/* If the buffer passed to jpeg_read_scanlines() is less than this many rows
|
||||
high, space and time will be wasted due to unnecessary data copying.
|
||||
Usually rec_outbuf_height will be 1 or 2, at most 4.
|
||||
*/
|
||||
|
||||
/* When quantizing colors, the output colormap is described by these fields.
|
||||
The application can supply a colormap by setting colormap non-NULL before
|
||||
calling jpeg_start_decompress; otherwise a colormap is created during
|
||||
jpeg_start_decompress or jpeg_start_output.
|
||||
The map has out_color_components rows and actual_number_of_colors
|
||||
columns.
|
||||
*/
|
||||
int actual_number_of_colors; /* number of entries in use */
|
||||
CJPEG_WRBMP_JSAMPARRAY
|
||||
colormap; /* The color map as a 2-D pixel array */
|
||||
|
||||
/* State variables: these variables indicate the progress of decompression.
|
||||
The application may examine these but must not modify them.
|
||||
*/
|
||||
|
||||
/* Row index of next scanline to be read from jpeg_read_scanlines().
|
||||
Application may use this to control its processing loop, e.g.,
|
||||
"while (output_scanline < output_height)".
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION output_scanline; /* 0 .. output_height-1 */
|
||||
|
||||
/* Current input scan number and number of iMCU rows completed in scan.
|
||||
These indicate the progress of the decompressor input side.
|
||||
*/
|
||||
int input_scan_number; /* Number of SOS markers seen so far */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
input_iMCU_row; /* Number of iMCU rows completed */
|
||||
|
||||
/* The "output scan number" is the notional scan being displayed by the
|
||||
output side. The decompressor will not allow output scan/row number
|
||||
to get ahead of input scan/row, but it can fall arbitrarily far behind.
|
||||
*/
|
||||
int output_scan_number; /* Nominal scan number being displayed */
|
||||
CJPEG_WRBMP_JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
|
||||
|
||||
/* Current progression status. coef_bits[ c ][ i ] indicates the precision
|
||||
with which component c's DCT coefficient i (in zigzag order) is known.
|
||||
It is -1 when no data has yet been received, otherwise it is the point
|
||||
transform (shift) value for the most recent scan of the coefficient
|
||||
(thus, 0 at completion of the progression).
|
||||
This pointer is NULL when reading a non-progressive file.
|
||||
*/
|
||||
int (*coef_bits)[64]; /* -1 or current Al value for each coef */
|
||||
|
||||
/* Internal JPEG parameters --- the application usually need not look at
|
||||
these fields. Note that the decompressor output side may not use
|
||||
any parameters that can change between scans.
|
||||
*/
|
||||
|
||||
/* Quantization and Huffman tables are carried forward across input
|
||||
datastreams when processing abbreviated JPEG datastreams.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4];
|
||||
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4];
|
||||
/* ptrs to Huffman coding tables, or NULL if not defined */
|
||||
|
||||
/* These parameters are never carried across datastreams, since they
|
||||
are given in SOF/SOS markers or defined to be reset by SOI.
|
||||
*/
|
||||
|
||||
int data_precision; /* bits of precision in image data */
|
||||
|
||||
cjpeg_wrbmp_jpeg_component_info *comp_info;
|
||||
/* comp_info[ i ] describes component that appears i'th in SOF */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
progressive_mode; /* TRUE if SOFn specifies progressive mode */
|
||||
cjpeg_wrbmp_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_L[16]; /* L values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_U[16]; /* U values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_ac_K[16]; /* Kx values for AC arith-coding tables */
|
||||
|
||||
unsigned int
|
||||
restart_interval; /* MCUs per restart interval, or 0 for no restart */
|
||||
|
||||
/* These fields record data obtained from optional markers recognized by
|
||||
the JPEG library.
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
|
||||
/* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
|
||||
CJPEG_WRBMP_UINT8 JFIF_major_version; /* JFIF version number */
|
||||
CJPEG_WRBMP_UINT8 JFIF_minor_version;
|
||||
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
|
||||
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
|
||||
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
|
||||
cjpeg_wrbmp_boolean
|
||||
saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
|
||||
CJPEG_WRBMP_UINT8
|
||||
Adobe_transform; /* Color transform code from Adobe marker */
|
||||
|
||||
cjpeg_wrbmp_boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
|
||||
/* Aside from the specific data retained from APPn markers known to the
|
||||
library, the uninterpreted contents of any or all APPn and COM markers
|
||||
can be saved in a list for examination by the application.
|
||||
*/
|
||||
jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
|
||||
|
||||
/* Remaining fields are known throughout decompressor, but generally
|
||||
should not be touched by a surrounding application.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are computed during decompression startup
|
||||
*/
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
|
||||
/* The coefficient controller's input and output progress is measured in
|
||||
units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
|
||||
in fully interleaved JPEG scans, but are used whether the scan is
|
||||
interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
||||
rows of each component. Therefore, the IDCT output contains
|
||||
v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JSAMPLE
|
||||
*sample_range_limit; /* table for fast range-limiting */
|
||||
|
||||
/*
|
||||
These fields are valid during any one scan.
|
||||
They describe the components and MCUs actually appearing in the scan.
|
||||
Note that the decompressor output side must not use these fields.
|
||||
*/
|
||||
int comps_in_scan; /* # of JPEG components in this scan */
|
||||
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4];
|
||||
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[10];
|
||||
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
int unread_marker;
|
||||
|
||||
/*
|
||||
Links to decompression subobjects (methods, private variables of modules)
|
||||
*/
|
||||
struct jpeg_decomp_master *master;
|
||||
struct jpeg_d_main_controller *main;
|
||||
struct jpeg_d_coef_controller *coef;
|
||||
struct jpeg_d_post_controller *post;
|
||||
struct jpeg_input_controller *inputctl;
|
||||
struct jpeg_marker_reader *marker;
|
||||
struct jpeg_entropy_decoder *entropy;
|
||||
struct jpeg_inverse_dct *idct;
|
||||
struct jpeg_upsampler *upsample;
|
||||
struct jpeg_color_deconverter *cconvert;
|
||||
struct jpeg_color_quantizer *cquantize;
|
||||
};
|
||||
|
||||
/* "Object" declarations for JPEG modules that may be supplied or called
|
||||
directly by the surrounding application.
|
||||
As with all objects in the JPEG library, these structs only define the
|
||||
publicly visible methods and state variables of a module. Additional
|
||||
private fields may exist after the public ones.
|
||||
*/
|
||||
|
||||
/* Error handler object */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_error_mgr {
|
||||
/* Error exit handler: does not return to caller */
|
||||
CJPEG_WRBMP_JMETHOD(void, error_exit, (cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
/* Conditionally emit a trace or warning message */
|
||||
CJPEG_WRBMP_JMETHOD(void, emit_message,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int msg_level));
|
||||
/* Routine that actually outputs a trace or error message */
|
||||
CJPEG_WRBMP_JMETHOD(void, output_message, (cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
/* Format a message string for the most recent JPEG error or message */
|
||||
CJPEG_WRBMP_JMETHOD(void, format_message,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, char *buffer));
|
||||
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
||||
/* Reset error state variables at start of a new image */
|
||||
CJPEG_WRBMP_JMETHOD(void, reset_error_mgr,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
|
||||
/* The message ID code and any parameters are saved here.
|
||||
A message can have one string parameter or up to 8 int parameters.
|
||||
*/
|
||||
int msg_code;
|
||||
#define JMSG_STR_PARM_MAX 80
|
||||
/*
|
||||
union {
|
||||
int i[ 8 ];
|
||||
char s[ JMSG_STR_PARM_MAX ];
|
||||
} msg_parm;
|
||||
*/
|
||||
/* Standard state variables for error facility */
|
||||
|
||||
int trace_level; /* max msg_level that will be displayed */
|
||||
|
||||
/* For recoverable corrupt-data errors, we emit a warning message,
|
||||
but keep going unless emit_message chooses to abort. emit_message
|
||||
should count warnings in num_warnings. The surrounding application
|
||||
can check for bad data by seeing if num_warnings is nonzero at the
|
||||
end of processing.
|
||||
*/
|
||||
long num_warnings; /* number of corrupt-data warnings */
|
||||
|
||||
/* These fields point to the table(s) of error message strings.
|
||||
An application can change the table pointer to switch to a different
|
||||
message list (typically, to change the language in which errors are
|
||||
reported). Some applications may wish to add additional error codes
|
||||
that will be handled by the JPEG library error mechanism; the second
|
||||
table pointer is used for this purpose.
|
||||
|
||||
First table includes all errors generated by JPEG library itself.
|
||||
Error code 0 is reserved for a "no such error string" message.
|
||||
*/
|
||||
const char *const *jpeg_message_table; /* Library errors */
|
||||
int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
|
||||
/* Second table can be added by application (see cjpeg/djpeg for example).
|
||||
It contains strings numbered first_addon_message..last_addon_message.
|
||||
*/
|
||||
const char *const *addon_message_table; /* Non-library errors */
|
||||
int first_addon_message; /* code for first string in addon table */
|
||||
int last_addon_message; /* code for last string in addon table */
|
||||
};
|
||||
|
||||
/* Progress monitor object */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr {
|
||||
CJPEG_WRBMP_JMETHOD(void, progress_monitor,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
|
||||
long pass_counter; /* work units completed in this pass */
|
||||
long pass_limit; /* total number of work units in this pass */
|
||||
int completed_passes; /* passes completed so far */
|
||||
int total_passes; /* total number of passes expected */
|
||||
};
|
||||
|
||||
/* Data destination object for compression */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_destination_mgr {
|
||||
CJPEG_WRBMP_JOCTET
|
||||
*next_output_byte; /* => next byte to write in buffer */
|
||||
cjpeg_wrbmp_size_t
|
||||
free_in_buffer; /* # of byte spaces remaining in buffer */
|
||||
|
||||
CJPEG_WRBMP_JMETHOD(void, init_destination,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, empty_output_buffer,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(void, term_destination,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo));
|
||||
};
|
||||
|
||||
/* Data source object for decompression */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_source_mgr {
|
||||
const CJPEG_WRBMP_JOCTET
|
||||
*next_input_byte; /* => next byte to read from buffer */
|
||||
cjpeg_wrbmp_size_t bytes_in_buffer; /* # of bytes remaining in buffer */
|
||||
|
||||
CJPEG_WRBMP_JMETHOD(void, init_source,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, fill_input_buffer,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(void, skip_input_data,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo, long num_bytes));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, resync_to_restart,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo, int desired));
|
||||
CJPEG_WRBMP_JMETHOD(void, term_source,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
};
|
||||
|
||||
/* Memory manager object.
|
||||
Allocates "small" objects (a few K total), "large" objects (tens of K),
|
||||
and "really big" objects (virtual arrays with backing store if needed).
|
||||
The memory manager does not allow individual objects to be freed; rather,
|
||||
each created object is assigned to a pool, and whole pools can be freed
|
||||
at once. This is faster and more convenient than remembering exactly what
|
||||
to free, especially where malloc()/free() are not too speedy.
|
||||
NB: alloc routines never return NULL. They exit to error_exit if not
|
||||
successful.
|
||||
*/
|
||||
|
||||
typedef struct jvirt_sarray_control *cjpeg_wrbmp_jvirt_sarray_ptr;
|
||||
typedef struct jvirt_barray_control *cjpeg_wrbmp_jvirt_barray_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_memory_mgr {
|
||||
/* Method pointers */
|
||||
CJPEG_WRBMP_JMETHOD(void *, alloc_small,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_size_t sizeofobject));
|
||||
CJPEG_WRBMP_JMETHOD(void CJPEG_WRBMP_FAR *, alloc_large,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_size_t sizeofobject));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JSAMPARRAY, alloc_sarray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
CJPEG_WRBMP_JDIMENSION samplesperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JBLOCKARRAY, alloc_barray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
CJPEG_WRBMP_JDIMENSION blocksperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_jvirt_sarray_ptr, request_virt_sarray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_boolean pre_zero,
|
||||
CJPEG_WRBMP_JDIMENSION samplesperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows,
|
||||
CJPEG_WRBMP_JDIMENSION maxaccess));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_jvirt_barray_ptr, request_virt_barray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_boolean pre_zero,
|
||||
CJPEG_WRBMP_JDIMENSION blocksperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows,
|
||||
CJPEG_WRBMP_JDIMENSION maxaccess));
|
||||
CJPEG_WRBMP_JMETHOD(void, realize_virt_arrays,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JSAMPARRAY, access_virt_sarray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
cjpeg_wrbmp_jvirt_sarray_ptr ptr,
|
||||
CJPEG_WRBMP_JDIMENSION start_row,
|
||||
CJPEG_WRBMP_JDIMENSION num_rows,
|
||||
cjpeg_wrbmp_boolean writable));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JBLOCKARRAY, access_virt_barray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
cjpeg_wrbmp_jvirt_barray_ptr ptr,
|
||||
CJPEG_WRBMP_JDIMENSION start_row,
|
||||
CJPEG_WRBMP_JDIMENSION num_rows,
|
||||
cjpeg_wrbmp_boolean writable));
|
||||
CJPEG_WRBMP_JMETHOD(void, free_pool,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id));
|
||||
CJPEG_WRBMP_JMETHOD(void, self_destruct, (cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
|
||||
/* Limit on memory allocation for this JPEG object. (Note that this is
|
||||
merely advisory, not a guaranteed maximum; it only affects the space
|
||||
used for virtual-array buffers.) May be changed by outer application
|
||||
after creating the JPEG object.
|
||||
*/
|
||||
long max_memory_to_use;
|
||||
|
||||
/* Maximum allocation request accepted by alloc_large. */
|
||||
long max_alloc_chunk;
|
||||
};
|
||||
|
||||
/* Routine signature for application-supplied marker processing methods.
|
||||
Need not pass marker code since it is stored in cinfo->unread_marker.
|
||||
*/
|
||||
typedef CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, jpeg_marker_parser_method,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
|
||||
/*
|
||||
The JPEG library modules define JPEG_INTERNALS before including this file.
|
||||
The internal structure declarations are read only when that is true.
|
||||
Applications using the library should not include jpegint.h, but may wish
|
||||
to include jerror.h.
|
||||
*/
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
|
||||
#include "jerror.h" /* fetch error codes too */
|
||||
#include "jpegint.h" /* fetch private declarations */
|
||||
#endif
|
||||
|
||||
#endif /* JPEGLIB_H */
|
||||
@ -0,0 +1,377 @@
|
||||
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cderror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
This file defines the error and message codes for the cjpeg/djpeg
|
||||
applications. These strings are not needed as part of the JPEG library
|
||||
proper.
|
||||
Edit this file to add new codes, or to translate the message strings to
|
||||
some other language.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CJPEG_WRBMP_JMESSAGE
|
||||
#ifndef CDERROR_H
|
||||
#define CDERROR_H
|
||||
/*First time through, define the enum list*/
|
||||
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#else
|
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined*/
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
typedef enum {
|
||||
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string) code,
|
||||
|
||||
#endif
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE(JMSG_FIRSTADDONCODE = 1000,
|
||||
NULL) // Must be first entry!
|
||||
|
||||
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BMP_BADCMAP,
|
||||
"Unsupported BMP colormap format") CJPEG_WRBMP_JMESSAGE(JERR_BMP_BADDEPTH,
|
||||
"Only 8- and "
|
||||
"24-bit BMP "
|
||||
"files are "
|
||||
"supported")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BMP_BADHEADER,
|
||||
"Inv"
|
||||
"ali"
|
||||
"d "
|
||||
"BMP"
|
||||
" fi"
|
||||
"le:"
|
||||
" ba"
|
||||
"d "
|
||||
"hea"
|
||||
"der"
|
||||
" le"
|
||||
"ngt"
|
||||
"h") CJPEG_WRBMP_JMESSAGE(JERR_BMP_BADPLANES,
|
||||
"Invalid BMP file: biPlanes not equal to "
|
||||
"1") CJPEG_WRBMP_JMESSAGE(JERR_BMP_COLORSPACE,
|
||||
"BMP output "
|
||||
"must be "
|
||||
"grayscale or "
|
||||
"RGB")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs "
|
||||
"not yet supported") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BMP_NOT, "N"
|
||||
"o"
|
||||
"t"
|
||||
" "
|
||||
"a"
|
||||
" "
|
||||
"B"
|
||||
"M"
|
||||
"P"
|
||||
" "
|
||||
"f"
|
||||
"i"
|
||||
"l"
|
||||
"e"
|
||||
" "
|
||||
"-"
|
||||
" "
|
||||
"d"
|
||||
"o"
|
||||
"e"
|
||||
"s"
|
||||
" "
|
||||
"n"
|
||||
"o"
|
||||
"t"
|
||||
" "
|
||||
"s"
|
||||
"t"
|
||||
"a"
|
||||
"r"
|
||||
"t"
|
||||
" "
|
||||
"w"
|
||||
"i"
|
||||
"t"
|
||||
"h"
|
||||
" "
|
||||
"B"
|
||||
"M") CJPEG_WRBMP_JMESSAGE(JTRC_BMP,
|
||||
"%ux%u 24-bit BMP "
|
||||
"image") CJPEG_WRBMP_JMESSAGE(JTRC_BMP_MAPPED,
|
||||
"%ux%u 8-bit colormapped BMP "
|
||||
"image")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_BMP_OS2,
|
||||
"%ux%u 24-bit OS2 BMP image") CJPEG_WRBMP_JMESSAGE(JTRC_BMP_OS2_MAPPED,
|
||||
"%ux%u "
|
||||
"8-bit "
|
||||
"colorma"
|
||||
"pped"
|
||||
" OS2 "
|
||||
"BMP "
|
||||
"image")
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_GIF_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_GIF_BUG, "GIF output got "
|
||||
"confused") CJPEG_WRBMP_JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_GIF_COLORSPACE,
|
||||
"GIF output "
|
||||
"must be "
|
||||
"grayscale "
|
||||
"or RGB") CJPEG_WRBMP_JMESSAGE(JERR_GIF_IMAGENOTFOUND,
|
||||
"Too few images in GIF "
|
||||
"file") CJPEG_WRBMP_JMESSAGE(JERR_GIF_NOT,
|
||||
"Not a GIF file")
|
||||
CJPEG_WRBMP_JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_GIF_BADVERSION,
|
||||
"Warning: "
|
||||
"unexpected "
|
||||
"GIF "
|
||||
"version "
|
||||
"number "
|
||||
"'%c%c%c'") CJPEG_WRBMP_JMESSAGE(JTRC_GIF_EXTENSION,
|
||||
"Ignoring GIF "
|
||||
"extension "
|
||||
"block of "
|
||||
"type 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_GIF_NONSQUARE,
|
||||
"Caution: nonsquare pixels in "
|
||||
"input")
|
||||
CJPEG_WRBMP_JMESSAGE(JWRN_GIF_BADDATA, "Corrupt "
|
||||
"data in "
|
||||
"GIF file") CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_GIF_CHAR,
|
||||
"Bogus char "
|
||||
"0x%02x in GIF "
|
||||
"file, "
|
||||
"ignoring") CJPEG_WRBMP_JMESSAGE(JWRN_GIF_ENDCODE,
|
||||
"Premature "
|
||||
"end of GIF "
|
||||
"image") CJPEG_WRBMP_JMESSAGE(JWRN_GIF_NOMOREDATA,
|
||||
"Ran out of GIF bits")
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_PPM_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_PPM_COLORSPACE,
|
||||
"PPM "
|
||||
"outp"
|
||||
"ut "
|
||||
"must"
|
||||
" be "
|
||||
"gray"
|
||||
"scal"
|
||||
"e "
|
||||
"or "
|
||||
"RGB") CJPEG_WRBMP_JMESSAGE(JERR_PPM_NONNUMERIC,
|
||||
"Nonnumeric "
|
||||
"data in PPM "
|
||||
"file")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_PPM_NOT,
|
||||
"Not a "
|
||||
"PPM/"
|
||||
"PGM "
|
||||
"file") CJPEG_WRBMP_JMESSAGE(JTRC_PGM,
|
||||
"%ux%u "
|
||||
"PGM "
|
||||
"image")
|
||||
CJPEG_WRBMP_JMESSAGE(JTRC_PGM_TEXT, "%u"
|
||||
"x%"
|
||||
"u "
|
||||
"te"
|
||||
"xt"
|
||||
" P"
|
||||
"GM"
|
||||
" i"
|
||||
"ma"
|
||||
"g"
|
||||
"e") CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_PPM,
|
||||
"%ux%u "
|
||||
"PPM "
|
||||
"image") CJPEG_WRBMP_JMESSAGE(JTRC_PPM_TEXT,
|
||||
"%ux%"
|
||||
"u "
|
||||
"text"
|
||||
" PPM"
|
||||
" ima"
|
||||
"ge")
|
||||
#endif
|
||||
|
||||
#ifdef RLE_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_RLE_BADERROR,
|
||||
"Bogus error code from RLE "
|
||||
"library") CJPEG_WRBMP_JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_RLE_DIMENSIONS,
|
||||
"Image dimensions (%ux%u) "
|
||||
"too large for RLE")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_RLE_EMPTY,
|
||||
"Empty RLE file")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_RLE_EOF,
|
||||
"P"
|
||||
"r"
|
||||
"e"
|
||||
"m"
|
||||
"a"
|
||||
"t"
|
||||
"u"
|
||||
"r"
|
||||
"e"
|
||||
" "
|
||||
"E"
|
||||
"O"
|
||||
"F"
|
||||
" "
|
||||
"i"
|
||||
"n"
|
||||
" "
|
||||
"R"
|
||||
"L"
|
||||
"E"
|
||||
" "
|
||||
"h"
|
||||
"e"
|
||||
"a"
|
||||
"d"
|
||||
"e"
|
||||
"r") CJPEG_WRBMP_JMESSAGE(JERR_RLE_MEM,
|
||||
"Insufficient memory for RLE header") CJPEG_WRBMP_JMESSAGE(JERR_RLE_NOT, "Not an RLE file") CJPEG_WRBMP_JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") CJPEG_WRBMP_JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") CJPEG_WRBMP_JMESSAGE(JTRC_RLE,
|
||||
"%ux%u full-color RLE file") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_GRAY,
|
||||
"%ux%u grayscale RLE file") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE "
|
||||
"file with map of "
|
||||
"length %d") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_MAPPED,
|
||||
"%ux%u colormapped RLE file with map of length %d")
|
||||
#endif
|
||||
|
||||
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_TGA_BADCMAP,
|
||||
"Unsupported "
|
||||
"Targa "
|
||||
"colormap "
|
||||
"format") CJPEG_WRBMP_JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_TGA_COLORSPACE,
|
||||
"Targa "
|
||||
"output "
|
||||
"must be "
|
||||
"grayscale "
|
||||
"or "
|
||||
"RGB") CJPEG_WRBMP_JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_TGA_GRAY, "%ux%u "
|
||||
"grayscale "
|
||||
"Targa "
|
||||
"image")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JTRC_TGA_MAPPED,
|
||||
"%u"
|
||||
"x%"
|
||||
"u "
|
||||
"co"
|
||||
"lo"
|
||||
"rm"
|
||||
"ap"
|
||||
"pe"
|
||||
"d "
|
||||
"Ta"
|
||||
"rg"
|
||||
"a "
|
||||
"im"
|
||||
"ag"
|
||||
"e")
|
||||
#else
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
|
||||
#endif
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_CMAP_FILE,
|
||||
"Color "
|
||||
"map "
|
||||
"file "
|
||||
"is "
|
||||
"invali"
|
||||
"d or "
|
||||
"of "
|
||||
"unsupp"
|
||||
"orted "
|
||||
"forma"
|
||||
"t")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_TOO_MANY_COLORS,
|
||||
"Ou"
|
||||
"tp"
|
||||
"ut"
|
||||
" f"
|
||||
"il"
|
||||
"e "
|
||||
"fo"
|
||||
"rm"
|
||||
"at"
|
||||
" c"
|
||||
"an"
|
||||
"no"
|
||||
"t "
|
||||
"ha"
|
||||
"nd"
|
||||
"le"
|
||||
" %"
|
||||
"d "
|
||||
"co"
|
||||
"lo"
|
||||
"rm"
|
||||
"ap"
|
||||
" e"
|
||||
"nt"
|
||||
"ri"
|
||||
"e"
|
||||
"s")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_UNGETC_FAILED,
|
||||
"ungetc failed")
|
||||
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_UNKNOWN_FORMAT,
|
||||
"Unrecognized input file format --- perhaps you need -targa")
|
||||
#else
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
|
||||
#endif
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_UNSUPPORTED_FORMAT,
|
||||
"Unsupported output file format")
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
JMSG_LASTADDONCODE
|
||||
} CJPEG_WRBMP_ADDON_MESSAGE_CODE;
|
||||
|
||||
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#endif
|
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default*/
|
||||
#undef CJPEG_WRBMP_JMESSAGE
|
||||
@ -0,0 +1,99 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cdjpeg.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
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 common declarations for the sample applications
|
||||
cjpeg and djpeg. It is NOT used by the core JPEG library.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CDJPEG_H
|
||||
#define CDJPEG_H
|
||||
|
||||
#define CJPEG_WRBMP_JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
|
||||
#define CJPEG_WRBMP_JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see \
|
||||
xxx_SUPPORTED */
|
||||
|
||||
#include "cderror.h" /* get application-specific error codes */
|
||||
#include "jerror.h" /* get library error codes too */
|
||||
#include "jpeglib.h"
|
||||
|
||||
typedef struct cjpeg_wrbmp_cjpeg_source_struct *cjpeg_wrbmp_cjpeg_source_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_cjpeg_source_struct {
|
||||
CJPEG_WRBMP_JMETHOD(void, start_input,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JDIMENSION, get_pixel_rows,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
|
||||
CJPEG_WRBMP_JMETHOD(void, finish_input,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo,
|
||||
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
|
||||
|
||||
CJPEG_WRBMP_FILE *input_file;
|
||||
|
||||
CJPEG_WRBMP_JSAMPARRAY buffer;
|
||||
CJPEG_WRBMP_JDIMENSION buffer_height;
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_djpeg_dest_struct *cjpeg_wrbmp_djpeg_dest_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct {
|
||||
CJPEG_WRBMP_JMETHOD(void, start_output,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo));
|
||||
/* Emit the specified number of pixel rows from the buffer. */
|
||||
CJPEG_WRBMP_JMETHOD(void, put_pixel_rows,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo,
|
||||
CJPEG_WRBMP_JDIMENSION rows_supplied));
|
||||
/* Finish up at the end of the image. */
|
||||
CJPEG_WRBMP_JMETHOD(void, finish_output,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo,
|
||||
cjpeg_wrbmp_djpeg_dest_ptr dinfo));
|
||||
|
||||
/* Target file spec; filled in by djpeg.c after object is created. */
|
||||
CJPEG_WRBMP_FILE *output_file;
|
||||
|
||||
/* Output pixel-row buffer. Created by module init or start_output.
|
||||
Width is cinfo->output_width * cinfo->output_components;
|
||||
height is buffer_height.
|
||||
*/
|
||||
CJPEG_WRBMP_JSAMPARRAY buffer;
|
||||
CJPEG_WRBMP_JDIMENSION buffer_height;
|
||||
};
|
||||
|
||||
/*
|
||||
cjpeg/djpeg may need to perform extra passes to convert to or from
|
||||
the source/destination file format. The JPEG library does not know
|
||||
about these passes, but we'd like them to be counted by the progress
|
||||
monitor. We use an expanded progress monitor object to hold the
|
||||
additional pass count.
|
||||
*/
|
||||
|
||||
struct cjpeg_wrbmp_cdjpeg_progress_mgr {
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr pub; /* fields known to JPEG library */
|
||||
int completed_extra_passes; /* extra passes completed */
|
||||
int total_extra_passes; /* total extra */
|
||||
/* last printed percentage stored here to avoid multiple printouts */
|
||||
int percent_done;
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_cdjpeg_progress_mgr *cjpeg_wrbmp_cd_progress_ptr;
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,228 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cjpeg_jpeg6b_wrbmp.c
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
Function: This file contains routines to write output images in Microsoft
|
||||
"BMP" format (MS Windows 3.x and OS/2 1.x flavors). Either 8-bit colormapped
|
||||
or 24-bit full-color format can be written. No compression is supported.
|
||||
|
||||
These routines may need modification for non-Unix environments or
|
||||
specialized applications. As they stand, they assume output to
|
||||
an ordinary stdio stream.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: a brief summary of major functional changes (not formatting)
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
#include "cdjpeg.h"
|
||||
|
||||
// Wasm loop bounds
|
||||
|
||||
|
||||
#include "input.c"
|
||||
|
||||
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
|
||||
|
||||
/*
|
||||
Declaration of global variables
|
||||
*/
|
||||
typedef struct {
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct pub; /* public fields */
|
||||
cjpeg_wrbmp_boolean is_os2; /* saves the OS2 format request flag */
|
||||
cjpeg_wrbmp_jvirt_sarray_ptr whole_image; /* needed to reverse row order */
|
||||
CJPEG_WRBMP_JDIMENSION data_width; /* JSAMPLEs per row */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
row_width; /* physical width of one row in the BMP file */
|
||||
int pad_bytes; /* number of padding bytes needed per row */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
cur_output_row; /* next row# to write to virtual array */
|
||||
} cjpeg_wrbmp_bmp_dest_struct;
|
||||
|
||||
typedef cjpeg_wrbmp_bmp_dest_struct *cjpeg_wrbmp_bmp_dest_ptr;
|
||||
extern unsigned char cjpeg_wrbmp_colormap[3][256];
|
||||
unsigned char cjpeg_wrbmp_output_array[6144];
|
||||
unsigned char *cjpeg_wrbmp_jpeg_stream /*= cjpeg_jpeg6b_wrbmp_output_array*/;
|
||||
int cjpeg_wrbmp_checksum;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct cjpeg_wrbmp_jpeg_dec_1;
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct cjpeg_wrbmp_jpeg_dec_2;
|
||||
struct cjpeg_wrbmp_djpeg_dest_struct cjpeg_wrbmp_djpeg_dest;
|
||||
cjpeg_wrbmp_bmp_dest_struct cjpeg_wrbmp_bmp_dest;
|
||||
|
||||
/*
|
||||
Forward declaration of functions
|
||||
*/
|
||||
__attribute__((always_inline)) static inline void cjpeg_wrbmp_initInput(void);
|
||||
__attribute__((always_inline)) static inline void
|
||||
cjpeg_wrbmp_finish_output_bmp(cjpeg_wrbmp_j_decompress_ptr cinfo);
|
||||
__attribute__((always_inline)) static inline void
|
||||
cjpeg_wrbmp_write_colormap(cjpeg_wrbmp_j_decompress_ptr cinfo, int map_colors,
|
||||
int map_entry_size, int cMap);
|
||||
__attribute__((always_inline)) static inline int
|
||||
cjpeg_wrbmp_putc_modified(int character);
|
||||
__attribute__((always_inline)) static inline void cjpeg_wrbmp_init();
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
cjpeg_wrbmp_main();
|
||||
__attribute__((always_inline)) static inline int cjpeg_wrbmp_return();
|
||||
__attribute__((noinline)) __attribute__((export_name("main")))
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int
|
||||
main();
|
||||
|
||||
/*
|
||||
Initialization functions
|
||||
*/
|
||||
__attribute__((always_inline)) static inline void
|
||||
cjpeg_wrbmp_init() {
|
||||
cjpeg_wrbmp_initInput();
|
||||
|
||||
cjpeg_wrbmp_jpeg_dec_1.progress = 0;
|
||||
cjpeg_wrbmp_jpeg_dec_1.output_height = 30;
|
||||
cjpeg_wrbmp_jpeg_dec_1.actual_number_of_colors = 256;
|
||||
cjpeg_wrbmp_jpeg_dec_1.out_color_components = 2;
|
||||
|
||||
cjpeg_wrbmp_jpeg_dec_2.progress = 0;
|
||||
cjpeg_wrbmp_jpeg_dec_2.output_height = 30;
|
||||
cjpeg_wrbmp_jpeg_dec_2.actual_number_of_colors = 256;
|
||||
cjpeg_wrbmp_jpeg_dec_2.out_color_components = 3;
|
||||
|
||||
cjpeg_wrbmp_jpeg_stream = cjpeg_wrbmp_output_array;
|
||||
|
||||
cjpeg_wrbmp_checksum = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Calculation functions
|
||||
*/
|
||||
__attribute__((always_inline)) static inline int
|
||||
cjpeg_wrbmp_putc_modified(int character) {
|
||||
*(cjpeg_wrbmp_jpeg_stream) = character;
|
||||
|
||||
++cjpeg_wrbmp_jpeg_stream;
|
||||
|
||||
cjpeg_wrbmp_checksum += character;
|
||||
|
||||
return character;
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
cjpeg_wrbmp_finish_output_bmp(cjpeg_wrbmp_j_decompress_ptr cinfo) {
|
||||
CJPEG_WRBMP_JDIMENSION row;
|
||||
cjpeg_wrbmp_cd_progress_ptr progress =
|
||||
(cjpeg_wrbmp_cd_progress_ptr) cinfo->progress;
|
||||
|
||||
// Write the file body from our virtual array
|
||||
__pragma_loopbound(30, 30);
|
||||
for (row = cinfo->output_height; row > 0; --row) {
|
||||
if (progress != 0) {
|
||||
progress->pub.pass_counter = (long) (cinfo->output_height - row);
|
||||
progress->pub.pass_limit = (long) cinfo->output_height;
|
||||
}
|
||||
}
|
||||
|
||||
if (progress != 0)
|
||||
progress->completed_extra_passes++;
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
cjpeg_wrbmp_write_colormap(cjpeg_wrbmp_j_decompress_ptr cinfo, int map_colors,
|
||||
int map_entry_size, int cMap) {
|
||||
|
||||
int num_colors = cinfo->actual_number_of_colors;
|
||||
int i;
|
||||
|
||||
if (cMap != 0) {
|
||||
|
||||
if (cinfo->out_color_components == 3) {
|
||||
// Normal case with RGB colormap
|
||||
__pragma_loopbound(256, 256);
|
||||
for (i = 0; i < num_colors; i++) {
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[2][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[1][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[0][i]));
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
} else {
|
||||
// Grayscale colormap (only happens with grayscale quantization)
|
||||
__pragma_loopbound(256, 256);
|
||||
for (i = 0; i < num_colors; i++) {
|
||||
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[2][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[1][i]));
|
||||
cjpeg_wrbmp_putc_modified(
|
||||
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[0][i]));
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If no colormap, must be grayscale data. Generate a linear "map".
|
||||
__pragma_loopbound(256, 256);
|
||||
for (i = 0; i < 256; i++) {
|
||||
cjpeg_wrbmp_putc_modified(i);
|
||||
cjpeg_wrbmp_putc_modified(i);
|
||||
cjpeg_wrbmp_putc_modified(i);
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Pad colormap with zeros to ensure specified number of colormap entries.
|
||||
__pragma_loopbound(512, 512);
|
||||
for (; i < map_colors; i++) {
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
|
||||
if (map_entry_size == 4)
|
||||
cjpeg_wrbmp_putc_modified(0);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
cjpeg_wrbmp_main() {
|
||||
cjpeg_wrbmp_finish_output_bmp(&cjpeg_wrbmp_jpeg_dec_1);
|
||||
cjpeg_wrbmp_write_colormap(&cjpeg_wrbmp_jpeg_dec_1, 768, 4, 1);
|
||||
|
||||
cjpeg_wrbmp_finish_output_bmp(&cjpeg_wrbmp_jpeg_dec_2);
|
||||
cjpeg_wrbmp_write_colormap(&cjpeg_wrbmp_jpeg_dec_2, 768, 4, 1);
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) static inline int
|
||||
cjpeg_wrbmp_return() {
|
||||
return (cjpeg_wrbmp_checksum + (-209330)) != 0;
|
||||
}
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("main")))
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int
|
||||
main(void) {
|
||||
cjpeg_wrbmp_init();
|
||||
cjpeg_wrbmp_main();
|
||||
|
||||
return (cjpeg_wrbmp_return());
|
||||
}
|
||||
|
||||
#endif /* BMP_SUPPORTED */
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: input.c
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
Function: Input variables for the cjpeg_jpeg6b_wrbmp.c
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
// Wasm loop bounds
|
||||
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
unsigned char cjpeg_wrbmp_colormap[3][256];
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
cjpeg_wrbmp_initInput(void) {
|
||||
int i, j;
|
||||
volatile unsigned char tmp[3][256] = {
|
||||
{44, 105, 153, 71, 151, 160, 188, 90, 209, 131, 221, 114, 93, 124,
|
||||
208, 207, 218, 54, 145, 113, 153, 239, 226, 83, 243, 151, 98, 67,
|
||||
114, 153, 83, 186, 116, 72, 188, 190, 109, 162, 218, 133, 208, 209,
|
||||
115, 251, 135, 89, 143, 226, 230, 246, 152, 243, 152, 115, 180, 78,
|
||||
246, 164, 250, 117, 76, 150, 152, 188, 251, 195, 127, 111, 225, 208,
|
||||
94, 93, 143, 131, 201, 211, 99, 93, 190, 157, 121, 240, 117, 185,
|
||||
167, 137, 152, 188, 250, 59, 248, 245, 115, 240, 192, 209, 143, 136,
|
||||
98, 224, 167, 135, 132, 189, 72, 249, 205, 44, 106, 96, 147, 247,
|
||||
249, 228, 224, 249, 190, 112, 135, 168, 95, 205, 171, 58, 112, 79,
|
||||
206, 75, 242, 188, 189, 225, 185, 81, 221, 153, 244, 198, 171, 163,
|
||||
159, 209, 240, 138, 148, 207, 166, 192, 188, 151, 98, 190, 209, 154,
|
||||
225, 72, 96, 249, 191, 223, 207, 163, 207, 133, 251, 183, 135, 137,
|
||||
159, 247, 167, 83, 123, 199, 203, 144, 142, 237, 77, 128, 117, 169,
|
||||
202, 136, 128, 188, 168, 55, 222, 169, 116, 60, 75, 175, 102, 217,
|
||||
168, 185, 189, 225, 125, 192, 112, 111, 168, 239, 225, 168, 97, 129,
|
||||
190, 175, 169, 225, 170, 226, 225, 226, 224, 134, 106, 250, 222, 148,
|
||||
241, 168, 166, 160, 95, 190, 102, 180, 193, 111, 151, 165, 171, 200,
|
||||
52, 134, 169, 223, 166, 225, 169, 111, 185, 109, 56, 244, 157, 250,
|
||||
226, 231, 119, 188},
|
||||
{42, 143, 46, 91, 84, 201, 140, 91, 82, 140, 31, 88, 44, 171,
|
||||
57, 115, 206, 59, 145, 117, 116, 53, 232, 117, 80, 60, 66, 64,
|
||||
117, 174, 89, 178, 147, 63, 83, 59, 103, 139, 211, 64, 68, 98,
|
||||
118, 53, 119, 90, 161, 232, 171, 98, 176, 236, 118, 157, 180, 77,
|
||||
114, 88, 28, 119, 40, 97, 69, 189, 252, 225, 119, 96, 219, 84,
|
||||
82, 105, 158, 49, 200, 61, 117, 78, 63, 147, 140, 69, 108, 90,
|
||||
161, 105, 190, 114, 84, 76, 70, 43, 156, 222, 96, 72, 143, 90,
|
||||
105, 56, 144, 78, 129, 35, 66, 101, 100, 49, 105, 130, 160, 239,
|
||||
129, 141, 83, 43, 68, 106, 132, 83, 92, 130, 175, 63, 131, 79,
|
||||
192, 105, 57, 160, 118, 162, 141, 78, 192, 128, 206, 201, 203, 162,
|
||||
159, 163, 221, 183, 157, 177, 189, 192, 129, 130, 54, 104, 45, 101,
|
||||
252, 52, 91, 177, 49, 221, 116, 111, 143, 92, 142, 159, 131, 173,
|
||||
61, 159, 173, 81, 129, 214, 213, 145, 143, 232, 67, 145, 130, 99,
|
||||
237, 110, 160, 131, 67, 50, 129, 131, 127, 76, 92, 203, 96, 206,
|
||||
176, 180, 85, 99, 162, 118, 64, 78, 190, 191, 45, 101, 129, 58,
|
||||
72, 211, 49, 115, 115, 85, 61, 100, 116, 107, 143, 117, 219, 154,
|
||||
225, 174, 160, 163, 119, 190, 106, 186, 49, 45, 177, 147, 85, 138,
|
||||
42, 174, 59, 68, 120, 71, 129, 56, 149, 97, 68, 88, 148, 60,
|
||||
239, 179, 149, 104},
|
||||
{44, 76, 37, 56, 76, 152, 122, 153, 77, 191, 41, 76, 39, 97,
|
||||
46, 109, 172, 43, 116, 91, 102, 49, 201, 68, 88, 45, 53, 95,
|
||||
160, 175, 102, 164, 116, 50, 76, 45, 86, 189, 216, 50, 61, 93,
|
||||
196, 91, 100, 58, 116, 223, 166, 102, 126, 221, 158, 86, 235, 55,
|
||||
113, 120, 52, 115, 42, 86, 55, 165, 247, 194, 160, 108, 170, 108,
|
||||
98, 77, 168, 42, 179, 70, 96, 62, 71, 216, 100, 71, 155, 121,
|
||||
146, 86, 134, 105, 114, 49, 100, 50, 119, 218, 95, 81, 220, 78,
|
||||
102, 50, 125, 68, 170, 36, 62, 119, 129, 44, 151, 72, 143, 241,
|
||||
131, 137, 79, 73, 55, 122, 204, 73, 74, 131, 221, 53, 89, 72,
|
||||
178, 60, 64, 145, 157, 156, 177, 101, 180, 112, 194, 206, 178, 168,
|
||||
221, 153, 201, 119, 222, 165, 188, 212, 117, 180, 45, 134, 42, 130,
|
||||
229, 47, 107, 172, 40, 221, 146, 132, 138, 110, 144, 188, 112, 132,
|
||||
64, 162, 145, 140, 200, 181, 215, 139, 197, 183, 106, 126, 116, 89,
|
||||
204, 152, 123, 161, 52, 46, 131, 167, 173, 62, 70, 151, 151, 197,
|
||||
177, 184, 96, 97, 101, 130, 54, 63, 141, 185, 45, 126, 96, 46,
|
||||
71, 172, 38, 114, 100, 106, 69, 118, 138, 127, 99, 127, 198, 204,
|
||||
242, 248, 197, 241, 74, 189, 178, 252, 65, 45, 148, 145, 97, 168,
|
||||
45, 111, 43, 64, 164, 80, 113, 47, 136, 83, 42, 91, 197, 95,
|
||||
222, 167, 92, 98}};
|
||||
|
||||
__pragma_loopbound(3, 3);
|
||||
for (i = 0; i < 3; i++) {
|
||||
__pragma_loopbound(256, 256);
|
||||
for (j = 0; j < 256; j++)
|
||||
cjpeg_wrbmp_colormap[i][j] = tmp[i][j];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cderror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README files
|
||||
*/
|
||||
|
||||
#ifndef JCONFIG_H
|
||||
#define JCONFIG_H
|
||||
|
||||
#define CJPEG_WRBMP_HAVE_PROTOTYPES
|
||||
#define CJPEG_WRBMP_HAVE_UNSIGNED_CHAR
|
||||
#define CJPEG_WRBMP_HAVE_UNSIGNED_SHORT
|
||||
#undef void
|
||||
#undef const
|
||||
#undef CHAR_IS_UNSIGNED
|
||||
#define CJPEG_WRBMP_HAVE_STDDEF_H
|
||||
#define CJPEG_WRBMP_HAVE_STDLIB_H
|
||||
#undef NEED_BSD_STRINGS
|
||||
#undef NEED_SYS_TYPES_H
|
||||
#undef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||
/* Define this if you get warnings about undefined structures. */
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
|
||||
|
||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||
#define INLINE __inline__
|
||||
/* These are for configuring the JPEG memory manager. */
|
||||
#undef DEFAULT_MAX_MEM
|
||||
#undef NO_MKTEMP
|
||||
|
||||
#endif /* JPEG_INTERNALS */
|
||||
|
||||
#ifdef CJPEG_WRBMP_JPEG_CJPEG_DJPEG
|
||||
|
||||
#define CJPEG_WRBMP_BMP_SUPPORTED /* BMP image file format */
|
||||
#define CJPEG_WRBMP_GIF_SUPPORTED /* GIF image file format */
|
||||
#define CJPEG_WRBMP_PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||
#define CJPEG_WRBMP_TARGA_SUPPORTED /* Targa image file format */
|
||||
|
||||
#undef TWO_FILE_COMMANDLINE
|
||||
#undef NEED_SIGNAL_CATCHER
|
||||
#undef DONT_USE_B_MODE
|
||||
|
||||
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
|
||||
#undef PROGRESS_REPORT
|
||||
|
||||
#endif /* JPEG_CJPEG_DJPEG */
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,333 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jerror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file defines the error and message codes for the JPEG library.
|
||||
Edit this file to add new codes, or to translate the message strings to
|
||||
some other language.
|
||||
A set of error-reporting macros are defined too. Some applications using
|
||||
the JPEG library may wish to include this file to get the error codes
|
||||
sand/or the macros.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
/*
|
||||
To define the enum list of message codes, include this file without
|
||||
defining macro JMESSAGE. To create a message string table, include it
|
||||
again with a suitable JMESSAGE definition (see jerror.c for an example).
|
||||
*/
|
||||
|
||||
#ifndef CJPEG_WRBMP_JMESSAGE
|
||||
#ifndef JERROR_H
|
||||
/* First time through, define the enum list */
|
||||
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#else
|
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string)
|
||||
#endif /* JERROR_H */
|
||||
#endif /* JMESSAGE */
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
typedef enum {
|
||||
|
||||
#define CJPEG_WRBMP_JMESSAGE(code, string) code,
|
||||
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE(JMSG_NOMESSAGE,
|
||||
"Bogus message code %d") /* Must be first entry! */
|
||||
|
||||
/* For maintenance convenience, list is alphabetical by message code name */
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_ARITH_NOTIMPL,
|
||||
"Sorry, there are legal "
|
||||
"restrictions on arithmetic "
|
||||
"coding") CJPEG_WRBMP_JMESSAGE(JERR_BAD_ALIGN_TYPE,
|
||||
"ALIGN_TYPE is wrong, please fix")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_ALLOC_CHUNK,
|
||||
"MAX_ALLOC_"
|
||||
"CHUNK is "
|
||||
"wrong, please "
|
||||
"fix") CJPEG_WRBMP_JMESSAGE(JERR_BAD_BUFFER_MODE,
|
||||
"Bogus buffer control mode")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_COMPONENT_ID,
|
||||
"Invalid "
|
||||
"component ID %d "
|
||||
"in SOS") CJPEG_WRBMP_JMESSAGE(JERR_BAD_DCT_COEF,
|
||||
"DCT coefficient out of "
|
||||
"range")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_DCTSIZE,
|
||||
"IDCT output block size %d not supported")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_HUFF_TABLE,
|
||||
"Bogus Huffman table "
|
||||
"definition")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_IN_COLORSPACE,
|
||||
"Bogus input colorspace")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_J_COLORSPACE,
|
||||
"Bogus JPEG colorspace")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_LENGTH, "Bogus "
|
||||
"marker "
|
||||
"length")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_BAD_LIB_VERSION,
|
||||
"Wrong JPEG library version: "
|
||||
"library is %d, caller expects %d")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large "
|
||||
"for interleaved scan") CJPEG_WRBMP_JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code "
|
||||
"%d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PRECISION,
|
||||
"Unsupported JPEG data precision %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PROGRESSION, "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PROG_SCRIPT, "Invalid progressive parameters at scan script entry %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_SAMPLING,
|
||||
"Bogus sampling factors") CJPEG_WRBMP_JMESSAGE(JERR_BAD_SCAN_SCRIPT,
|
||||
"Invalid scan script at entry %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_STATE,
|
||||
"Improper call to JPEG library in state %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_STRUCT_SIZE,
|
||||
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") CJPEG_WRBMP_JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") CJPEG_WRBMP_JMESSAGE(JERR_BUFFER_SIZE,
|
||||
"Buffer passed to JPEG library is too small") CJPEG_WRBMP_JMESSAGE(JERR_CANT_SUSPEND,
|
||||
"Suspension not allowed here") CJPEG_WRBMP_JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") CJPEG_WRBMP_JMESSAGE(JERR_CONVERSION_NOTIMPL,
|
||||
"Unsupported color conversion request") CJPEG_WRBMP_JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") CJPEG_WRBMP_JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") CJPEG_WRBMP_JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") CJPEG_WRBMP_JMESSAGE(JERR_DQT_INDEX,
|
||||
"Bogus DQT index %d") CJPEG_WRBMP_JMESSAGE(JERR_EMPTY_IMAGE,
|
||||
"Empty JPEG image (DNL not supported)") CJPEG_WRBMP_JMESSAGE(JERR_EMS_READ, "Read from EMS failed") CJPEG_WRBMP_JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") CJPEG_WRBMP_JMESSAGE(JERR_EOI_EXPECTED,
|
||||
"Didn't expect more than one scan") CJPEG_WRBMP_JMESSAGE(JERR_FILE_READ, "Input file read error") CJPEG_WRBMP_JMESSAGE(JERR_FILE_WRITE,
|
||||
"Output file write error --- out of disk space?") CJPEG_WRBMP_JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL,
|
||||
"Fractional sampling not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") CJPEG_WRBMP_JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") CJPEG_WRBMP_JMESSAGE(JERR_IMAGE_TOO_BIG,
|
||||
"Maximum supported image dimension is %u pixels") CJPEG_WRBMP_JMESSAGE(JERR_INPUT_EMPTY,
|
||||
"Empty input file") CJPEG_WRBMP_JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") CJPEG_WRBMP_JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, "Cannot transcode due to multiple use of quantization table %d") CJPEG_WRBMP_JMESSAGE(JERR_MISSING_DATA,
|
||||
"Scan script does not transmit all data") CJPEG_WRBMP_JMESSAGE(JERR_MODE_CHANGE,
|
||||
"Invalid color quantization mode change") CJPEG_WRBMP_JMESSAGE(JERR_NOTIMPL, "Not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_NOT_COMPILED,
|
||||
"Requested feature was omitted at compile time") CJPEG_WRBMP_JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") CJPEG_WRBMP_JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") CJPEG_WRBMP_JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") CJPEG_WRBMP_JMESSAGE(JERR_NO_QUANT_TABLE,
|
||||
"Quantization table 0x%02x was not defined") CJPEG_WRBMP_JMESSAGE(JERR_NO_SOI,
|
||||
"Not a JPEG file: starts with 0x%02x 0x%02x") CJPEG_WRBMP_JMESSAGE(JERR_OUT_OF_MEMORY,
|
||||
"Insufficient memory (case %d)") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_COMPONENTS,
|
||||
"Cannot quantize more than %d color components") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_SOF_NO_SOS, "Invalid JPEG "
|
||||
"file "
|
||||
"structure: "
|
||||
"missing SOS "
|
||||
"marker") CJPEG_WRBMP_JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") CJPEG_WRBMP_JMESSAGE(
|
||||
JERR_SOS_NO_SOF, "Invalid "
|
||||
"JPEG "
|
||||
"file "
|
||||
"structure"
|
||||
": SOS "
|
||||
"before "
|
||||
"SOF") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
|
||||
CJPEG_WRBMP_JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_SEEK,
|
||||
"Seek failed on temporary file") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_WRITE, "Write failed on temporary file --- out of disk space?") CJPEG_WRBMP_JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") CJPEG_WRBMP_JMESSAGE(JERR_UNKNOWN_MARKER,
|
||||
"Unsupported marker type 0x%02x") CJPEG_WRBMP_JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") CJPEG_WRBMP_JMESSAGE(JERR_WIDTH_OVERFLOW,
|
||||
"Image too wide for this implementation") CJPEG_WRBMP_JMESSAGE(JERR_XMS_READ,
|
||||
"Read from XMS failed") CJPEG_WRBMP_JMESSAGE(JERR_XMS_WRITE,
|
||||
"Write to XMS failed") CJPEG_WRBMP_JMESSAGE(JMSG_COPYRIGHT,
|
||||
JCOPYRIGHT) CJPEG_WRBMP_JMESSAGE(JMSG_VERSION, JVERSION) CJPEG_WRBMP_JMESSAGE(JTRC_16BIT_TABLES, "Caution: quantization tables are too coarse for baseline JPEG") CJPEG_WRBMP_JMESSAGE(JTRC_ADOBE,
|
||||
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") CJPEG_WRBMP_JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") CJPEG_WRBMP_JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") CJPEG_WRBMP_JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_DQT,
|
||||
"Define Quantization Table %d precision %d") CJPEG_WRBMP_JMESSAGE(JTRC_DRI,
|
||||
"Define Restart Interval %u") CJPEG_WRBMP_JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_EOI,
|
||||
"End Of Image") CJPEG_WRBMP_JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, "Warning: thumbnail image size does not match data length %u") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_EXTENSION,
|
||||
"JFIF extension marker: type 0x%02x, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_THUMBNAIL,
|
||||
" with %d x %d thumbnail image") CJPEG_WRBMP_JMESSAGE(JTRC_MISC_MARKER,
|
||||
"Miscellaneous marker 0x%02x, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_QUANTVALS,
|
||||
" %4u %4u %4u %4u %4u %4u %4u %4u") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") CJPEG_WRBMP_JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") CJPEG_WRBMP_JMESSAGE(JTRC_RST, "RST%d") CJPEG_WRBMP_JMESSAGE(JTRC_SMOOTH_NOTIMPL,
|
||||
"Smoothing not supported with nonstandard sampling ratios") CJPEG_WRBMP_JMESSAGE(JTRC_SOF,
|
||||
"Start Of Frame 0x%02x: width=%u, height=%u, components=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOF_COMPONENT,
|
||||
" Component %d: %dhx%dv q=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOI, "Start of Image") CJPEG_WRBMP_JMESSAGE(JTRC_SOS,
|
||||
"Start Of Scan: %d components") CJPEG_WRBMP_JMESSAGE(JTRC_SOS_COMPONENT,
|
||||
" Component %d: dc=%d ac=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") CJPEG_WRBMP_JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") CJPEG_WRBMP_JMESSAGE(JTRC_TFILE_OPEN,
|
||||
"Opened temporary file %s") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_JPEG,
|
||||
"JFIF extension marker: JPEG-compressed thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_PALETTE,
|
||||
"JFIF extension marker: palette thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_RGB,
|
||||
"JFIF extension marker: RGB thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_UNKNOWN_IDS,
|
||||
"Unrecognized"
|
||||
" component "
|
||||
"IDs %d %d "
|
||||
"%d, "
|
||||
"assuming "
|
||||
"YCbCr") CJPEG_WRBMP_JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_XMS_OPEN,
|
||||
"Obtained XMS handle %u") CJPEG_WRBMP_JMESSAGE(JWRN_ADOBE_XFORM,
|
||||
"Unknown Adobe color "
|
||||
"transform code %d")
|
||||
CJPEG_WRBMP_JMESSAGE(JWRN_BOGUS_PROGRESSION,
|
||||
"I"
|
||||
"n"
|
||||
"c"
|
||||
"o"
|
||||
"n"
|
||||
"s"
|
||||
"i"
|
||||
"s"
|
||||
"t"
|
||||
"e"
|
||||
"n"
|
||||
"t"
|
||||
" "
|
||||
"p"
|
||||
"r"
|
||||
"o"
|
||||
"g"
|
||||
"r"
|
||||
"e"
|
||||
"s"
|
||||
"s"
|
||||
"i"
|
||||
"o"
|
||||
"n"
|
||||
" "
|
||||
"s"
|
||||
"e"
|
||||
"q"
|
||||
"u"
|
||||
"e"
|
||||
"n"
|
||||
"c"
|
||||
"e"
|
||||
" "
|
||||
"f"
|
||||
"o"
|
||||
"r"
|
||||
" "
|
||||
"c"
|
||||
"o"
|
||||
"m"
|
||||
"p"
|
||||
"o"
|
||||
"n"
|
||||
"e"
|
||||
"n"
|
||||
"t"
|
||||
" "
|
||||
"%"
|
||||
"d"
|
||||
" "
|
||||
"c"
|
||||
"o"
|
||||
"e"
|
||||
"f"
|
||||
"f"
|
||||
"i"
|
||||
"c"
|
||||
"i"
|
||||
"e"
|
||||
"n"
|
||||
"t"
|
||||
" "
|
||||
"%"
|
||||
"d") CJPEG_WRBMP_JMESSAGE(JWRN_EXTRANEOUS_DATA,
|
||||
"Corrupt JPEG data: %u "
|
||||
"extraneous bytes "
|
||||
"before marker 0x%02x")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_HIT_MARKER,
|
||||
"Corrupt JPEG "
|
||||
"data: "
|
||||
"premature end "
|
||||
"of data "
|
||||
"segment")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_HUFF_BAD_CODE,
|
||||
"Corrupt "
|
||||
"JPEG "
|
||||
"data: bad "
|
||||
"Huffman "
|
||||
"code")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_JFIF_MAJOR,
|
||||
"Warnin"
|
||||
"g: "
|
||||
"unknow"
|
||||
"n "
|
||||
"JFIF "
|
||||
"revisi"
|
||||
"on "
|
||||
"number"
|
||||
" "
|
||||
"%d.%"
|
||||
"02d") CJPEG_WRBMP_JMESSAGE(JWRN_JPEG_EOF,
|
||||
"Premature end of JPEG file")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_MUST_RESYNC,
|
||||
"Co"
|
||||
"rr"
|
||||
"up"
|
||||
"t "
|
||||
"JP"
|
||||
"EG"
|
||||
" "
|
||||
"da"
|
||||
"ta"
|
||||
": "
|
||||
"fo"
|
||||
"un"
|
||||
"d "
|
||||
"ma"
|
||||
"rk"
|
||||
"er"
|
||||
" "
|
||||
"0x"
|
||||
"%0"
|
||||
"2x"
|
||||
" "
|
||||
"in"
|
||||
"st"
|
||||
"ea"
|
||||
"d "
|
||||
"of"
|
||||
" R"
|
||||
"ST"
|
||||
"%"
|
||||
"d")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_NOT_SEQUENTIAL,
|
||||
"Invali"
|
||||
"d SOS "
|
||||
"parame"
|
||||
"ters "
|
||||
"for "
|
||||
"sequen"
|
||||
"tial "
|
||||
"JPEG")
|
||||
CJPEG_WRBMP_JMESSAGE(
|
||||
JWRN_TOO_MUCH_DATA,
|
||||
"Ap"
|
||||
"pl"
|
||||
"ic"
|
||||
"at"
|
||||
"io"
|
||||
"n "
|
||||
"tr"
|
||||
"an"
|
||||
"sf"
|
||||
"er"
|
||||
"re"
|
||||
"d "
|
||||
"to"
|
||||
"o "
|
||||
"ma"
|
||||
"ny"
|
||||
" s"
|
||||
"ca"
|
||||
"nl"
|
||||
"in"
|
||||
"e"
|
||||
"s")
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
JMSG_LASTMSGCODE
|
||||
} CJPEG_WRBMP_J_MESSAGE_CODE;
|
||||
|
||||
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
|
||||
#undef CJPEG_WRBMP_JMESSAGE
|
||||
@ -0,0 +1,91 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jmorecfg.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
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 additional configuration options that customize the
|
||||
JPEG software for special applications or support machine-dependent
|
||||
optimizations. Most users will not need to touch this file.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
#ifndef JMORECFG_H
|
||||
#define JMORECFG_H
|
||||
|
||||
#define CJPEG_WRBMP_GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
typedef unsigned char CJPEG_WRBMP_JSAMPLE;
|
||||
typedef short CJPEG_WRBMP_JCOEF;
|
||||
typedef unsigned char CJPEG_WRBMP_JOCTET;
|
||||
|
||||
/* These typedefs are used for various table entries and so forth.
|
||||
They must be at least as wide as specified; but making them too big
|
||||
won't cost a huge amount of memory, so we don't provide special
|
||||
extraction code like we did for JSAMPLE. (In other words, these
|
||||
typedefs live at a different point on the speed/space tradeoff curve.)
|
||||
*/
|
||||
|
||||
/* UINT8 must hold at least the values 0..255. */
|
||||
|
||||
typedef unsigned char CJPEG_WRBMP_UINT8;
|
||||
|
||||
/* UINT16 must hold at least the values 0..65535. */
|
||||
|
||||
typedef unsigned short CJPEG_WRBMP_UINT16;
|
||||
|
||||
/* INT16 must hold at least the values -32768..32767. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
||||
typedef short INT16;
|
||||
#endif
|
||||
|
||||
/* INT32 must hold at least signed 32-bit values. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||
typedef long INT32;
|
||||
#endif
|
||||
|
||||
typedef unsigned int CJPEG_WRBMP_JDIMENSION;
|
||||
|
||||
/* This macro is used to declare a "method", that is, a function pointer.
|
||||
We want to supply prototype parameters if the compiler can cope.
|
||||
Note that the arglist parameter must be parenthesized!
|
||||
Again, you can customize this if you need special linkage keywords.
|
||||
*/
|
||||
|
||||
#define EXTERN(type) extern type
|
||||
|
||||
#ifdef CJPEG_WRBMP_HAVE_PROTOTYPES
|
||||
#define CJPEG_WRBMP_JMETHOD(type, methodname, arglist) type(*methodname) arglist
|
||||
#else
|
||||
#define CJPEG_WRBMP_JMETHOD(type, methodname, arglist) type (*methodname)()
|
||||
#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
|
||||
explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||
*/
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
|
||||
#define CJPEG_WRBMP_FAR far
|
||||
#else
|
||||
#define CJPEG_WRBMP_FAR
|
||||
#endif
|
||||
|
||||
#ifndef CJPEG_JPEG6B_WRBMP_HAVE_BOOLEAN
|
||||
typedef int cjpeg_wrbmp_boolean;
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,844 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jpeglib.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
This file defines the application interface for the JPEG library.
|
||||
Most applications using the library need only include this file,
|
||||
and perhaps jerror.h if they want to know the exact error codes.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
#ifndef JPEGLIB_H
|
||||
#define JPEGLIB_H
|
||||
|
||||
typedef int CJPEG_WRBMP_FILE;
|
||||
typedef unsigned int cjpeg_wrbmp_size_t;
|
||||
|
||||
/*
|
||||
First we include the configuration files that record how this
|
||||
installation of the JPEG library is set up. jconfig.h can be
|
||||
generated automatically for many systems. jmorecfg.h contains
|
||||
manual configuration options that most people need not worry about.
|
||||
*/
|
||||
|
||||
#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
|
||||
#include "jconfig.h" /* widely used configuration options */
|
||||
#endif
|
||||
#include "jmorecfg.h" /* seldom changed options */
|
||||
|
||||
/* Data structures for images (arrays of samples and of DCT coefficients).
|
||||
On 80x86 machines, the image arrays are too big for near pointers,
|
||||
but the pointer arrays can fit in near memory.
|
||||
*/
|
||||
|
||||
typedef CJPEG_WRBMP_JSAMPLE CJPEG_WRBMP_FAR
|
||||
*CJPEG_WRBMP_JSAMPROW; /* ptr to one image row of pixel samples. */
|
||||
typedef CJPEG_WRBMP_JSAMPROW
|
||||
*CJPEG_WRBMP_JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
|
||||
typedef CJPEG_WRBMP_JSAMPARRAY
|
||||
*CJPEG_WRBMP_JSAMPIMAGE; /* a 3-D sample array: top index is color */
|
||||
|
||||
typedef CJPEG_WRBMP_JCOEF
|
||||
CJPEG_WRBMP_JBLOCK[64]; /* one block of coefficients */
|
||||
typedef CJPEG_WRBMP_JBLOCK CJPEG_WRBMP_FAR
|
||||
*CJPEG_WRBMP_JBLOCKROW; /* pointer to one row of coefficient blocks */
|
||||
typedef CJPEG_WRBMP_JBLOCKROW
|
||||
*CJPEG_WRBMP_JBLOCKARRAY; /* a 2-D array of coefficient blocks */
|
||||
typedef CJPEG_WRBMP_JBLOCKARRAY
|
||||
*CJPEG_WRBMP_JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
|
||||
|
||||
typedef CJPEG_WRBMP_JCOEF CJPEG_WRBMP_FAR
|
||||
*JCOEFPTR; /* useful in a couple of places */
|
||||
|
||||
/* Types for JPEG compression parameters and working tables. */
|
||||
|
||||
/* DCT coefficient quantization tables. */
|
||||
|
||||
typedef struct {
|
||||
/* This array gives the coefficient quantizers in natural array order
|
||||
(not the zigzag order in which they are stored in a JPEG DQT marker).
|
||||
CAUTION: IJG versions prior to v6a kept this array in zigzag order.
|
||||
*/
|
||||
CJPEG_WRBMP_UINT16
|
||||
quantval[64]; /* quantization step for each coefficient */
|
||||
/* This field is used only during compression. It's initialized FALSE when
|
||||
the table is created, and set TRUE when it's been output to the file.
|
||||
You could suppress output of a table by setting this to TRUE.
|
||||
(See jpeg_suppress_tables for an example.)
|
||||
*/
|
||||
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
|
||||
} CJPEG_WRBMP_JQUANT_TBL;
|
||||
|
||||
/* Huffman coding tables. */
|
||||
|
||||
typedef struct {
|
||||
/* These two fields directly represent the contents of a JPEG DHT marker */
|
||||
CJPEG_WRBMP_UINT8 bits[17]; /* bits[ k ] = # of symbols with codes of */
|
||||
/* length k bits; bits[ 0 ] is unused */
|
||||
CJPEG_WRBMP_UINT8
|
||||
huffval[256]; /* The symbols, in order of incr code length */
|
||||
/* This field is used only during compression. It's initialized FALSE when
|
||||
the table is created, and set TRUE when it's been output to the file.
|
||||
You could suppress output of a table by setting this to TRUE.
|
||||
(See jpeg_suppress_tables for an example.)
|
||||
*/
|
||||
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
|
||||
} CJPEG_WRBMP_JHUFF_TBL;
|
||||
|
||||
/* Basic info about one component (color channel). */
|
||||
|
||||
typedef struct {
|
||||
/* These values are fixed over the whole image. */
|
||||
/* For compression, they must be supplied by parameter setup; */
|
||||
/* for decompression, they are read from the SOF marker. */
|
||||
int component_id; /* identifier for this component (0..255) */
|
||||
int component_index; /* its index in SOF or cinfo->comp_info[ ] */
|
||||
int h_samp_factor; /* horizontal sampling factor (1..4) */
|
||||
int v_samp_factor; /* vertical sampling factor (1..4) */
|
||||
int quant_tbl_no; /* quantization table selector (0..3) */
|
||||
/* These values may vary between scans. */
|
||||
/* For compression, they must be supplied by parameter setup; */
|
||||
/* for decompression, they are read from the SOS marker. */
|
||||
/* The decompressor output side may not use these variables. */
|
||||
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
||||
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
||||
|
||||
/* Remaining fields should be treated as private by applications. */
|
||||
|
||||
/* These values are computed during compression or decompression startup: */
|
||||
/* Component's size in DCT blocks.
|
||||
Any dummy blocks added to complete an MCU are not counted; therefore
|
||||
these values do not depend on whether a scan is interleaved or not.
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION width_in_blocks;
|
||||
CJPEG_WRBMP_JDIMENSION height_in_blocks;
|
||||
/* Size of a DCT block in samples. Always DCTSIZE for compression.
|
||||
For decompression this is the size of the output from one DCT block,
|
||||
reflecting any scaling we choose to apply during the IDCT step.
|
||||
Values of 1,2,4,8 are likely to be supported. Note that different
|
||||
components may receive different IDCT scalings.
|
||||
*/
|
||||
int DCT_scaled_size;
|
||||
/* The downsampled dimensions are the component's actual, unpadded number
|
||||
of samples at the main buffer (preprocessing/compression interface), thus
|
||||
downsampled_width = ceil(image_width * Hi/Hmax)
|
||||
and similarly for height. For decompression, IDCT scaling is included,
|
||||
so downsampled_width = ceil(image_width * Hi/Hmax *
|
||||
DCT_scaled_size/DCTSIZE)
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION downsampled_width; /* actual width in samples */
|
||||
CJPEG_WRBMP_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.
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
component_needed; /* do we need the value of this component? */
|
||||
|
||||
/* 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 last_col_width; /* # of non-dummy blocks across in last MCU */
|
||||
int last_row_height; /* # of non-dummy blocks down in last MCU */
|
||||
|
||||
/* Saved quantization table for component; NULL if none yet saved.
|
||||
See jdinput.c comments about the need for this information.
|
||||
This field is currently used only for decompression.
|
||||
*/
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_table;
|
||||
|
||||
/* Private per-component storage for DCT or IDCT subsystem. */
|
||||
void *dct_table;
|
||||
} cjpeg_wrbmp_jpeg_component_info;
|
||||
|
||||
/* The script for encoding a multiple-scan file is an array of these: */
|
||||
|
||||
typedef struct {
|
||||
int comps_in_scan; /* number of components encoded in this scan */
|
||||
int component_index[4]; /* their SOF/comp_info[ ] indexes */
|
||||
int Ss, Se; /* progressive JPEG spectral selection parms */
|
||||
int Ah, Al; /* progressive JPEG successive approx. parms */
|
||||
} cjpeg_wrbmp_jpeg_scan_info;
|
||||
|
||||
/* The decompressor can save APPn and COM markers in a list of these: */
|
||||
|
||||
typedef struct cjpeg_wrbmp_jpeg_marker_struct CJPEG_WRBMP_FAR
|
||||
*jpeg_saved_marker_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_marker_struct {
|
||||
jpeg_saved_marker_ptr next; /* next in list, or NULL */
|
||||
CJPEG_WRBMP_UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
|
||||
unsigned int original_length; /* # bytes of data in the file */
|
||||
unsigned int data_length; /* # bytes of data saved at data[ ] */
|
||||
CJPEG_WRBMP_JOCTET CJPEG_WRBMP_FAR
|
||||
*data; /* the data contained in the marker */
|
||||
/* the marker length word is not counted in data_length or original_length
|
||||
*/
|
||||
};
|
||||
|
||||
/* Known color spaces. */
|
||||
|
||||
typedef enum {
|
||||
JCS_UNKNOWN, /* error/unspecified */
|
||||
JCS_GRAYSCALE, /* monochrome */
|
||||
JCS_RGB, /* red/green/blue */
|
||||
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
|
||||
JCS_CMYK, /* C/M/Y/K */
|
||||
JCS_YCCK /* Y/Cb/Cr/K */
|
||||
} CJPEG_WRBMP_J_COLOR_SPACE;
|
||||
|
||||
/* DCT/IDCT algorithm options. */
|
||||
|
||||
typedef enum {
|
||||
JDCT_ISLOW, /* slow but accurate integer algorithm */
|
||||
JDCT_IFAST, /* faster, less accurate integer method */
|
||||
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
|
||||
} CJPEG_WRBMP_J_DCT_METHOD;
|
||||
|
||||
/* Dithering options for decompression. */
|
||||
|
||||
typedef enum {
|
||||
JDITHER_NONE, /* no dithering */
|
||||
JDITHER_ORDERED, /* simple ordered dither */
|
||||
JDITHER_FS /* Floyd-Steinberg error diffusion dither */
|
||||
} CJPEG_WRBMP_J_DITHER_MODE;
|
||||
|
||||
/* Common fields between JPEG compression and decompression master structs. */
|
||||
|
||||
#define cjpeg_wrbmp_jpeg_common_fields \
|
||||
struct cjpeg_wrbmp_jpeg_error_mgr *err; /* Error handler module */ \
|
||||
struct cjpeg_wrbmp_jpeg_memory_mgr *mem; /* Memory manager module */ \
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr \
|
||||
*progress; /* Progress monitor, or NULL if none */ \
|
||||
void *client_data; /* Available for use by application */ \
|
||||
cjpeg_wrbmp_boolean \
|
||||
is_decompressor; /* So common code can tell which is which */ \
|
||||
int global_state /* For checking call sequence validity */
|
||||
|
||||
/* Routines that are to be used by both halves of the library are declared
|
||||
to receive a pointer to this structure. There are no actual instances of
|
||||
jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
|
||||
*/
|
||||
struct cjpeg_wrbmp_jpeg_common_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields common to both master struct types
|
||||
*/
|
||||
/* Additional fields follow in an actual jpeg_compress_struct or
|
||||
jpeg_decompress_struct. All three structs must agree on these
|
||||
initial fields! (This would be a lot cleaner in C++.)
|
||||
*/
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_jpeg_common_struct *cjpeg_wrbmp_j_common_ptr;
|
||||
typedef struct cjpeg_wrbmp_jpeg_compress_struct *cjpeg_wrbmp_j_compress_ptr;
|
||||
typedef struct cjpeg_wrbmp_jpeg_decompress_struct *cjpeg_wrbmp_j_decompress_ptr;
|
||||
|
||||
/* Master record for a compression instance */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_compress_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_decompress_struct
|
||||
*/
|
||||
|
||||
/* Destination for compressed data */
|
||||
struct cjpeg_wrbmp_jpeg_destination_mgr *dest;
|
||||
|
||||
/* Description of source image --- these fields must be filled in by
|
||||
outer application before starting compression. in_color_space must
|
||||
be correct before you can even call jpeg_set_defaults().
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION image_width; /* input image width */
|
||||
CJPEG_WRBMP_JDIMENSION image_height; /* input image height */
|
||||
int input_components; /* # of color components in input image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE in_color_space; /* colorspace of input image */
|
||||
|
||||
float input_gamma; /* image gamma of input image */
|
||||
|
||||
/* Compression parameters --- these fields must be set before calling
|
||||
jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
|
||||
initialize everything to reasonable defaults, then changing anything
|
||||
the application specifically wants to change. That way you won't get
|
||||
burnt when new parameters are added. Also note that there are several
|
||||
helper routines to simplify changing parameters.
|
||||
*/
|
||||
|
||||
int data_precision; /* bits of precision in image data */
|
||||
|
||||
int num_components; /* # of color components in JPEG image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE
|
||||
jpeg_color_space; /* colorspace of JPEG image */
|
||||
|
||||
cjpeg_wrbmp_jpeg_component_info *comp_info;
|
||||
/* comp_info[ i ] describes component that appears i'th in SOF */
|
||||
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4];
|
||||
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4];
|
||||
/* ptrs to Huffman coding tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_L[16]; /* L values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_U[16]; /* U values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_ac_K[16]; /* Kx values for AC arith-coding tables */
|
||||
|
||||
int num_scans; /* # of entries in scan_info array */
|
||||
const cjpeg_wrbmp_jpeg_scan_info
|
||||
*scan_info; /* script for multi-scan file, or NULL */
|
||||
/* The default value of scan_info is NULL, which causes a single-scan
|
||||
sequential JPEG file to be emitted. To create a multi-scan file,
|
||||
set num_scans and scan_info to point to an array of scan definitions.
|
||||
*/
|
||||
|
||||
cjpeg_wrbmp_boolean raw_data_in; /* TRUE=caller supplies downsampled data */
|
||||
cjpeg_wrbmp_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
cjpeg_wrbmp_boolean
|
||||
optimize_coding; /* TRUE=optimize entropy encoding parms */
|
||||
cjpeg_wrbmp_boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
|
||||
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* DCT algorithm selector */
|
||||
|
||||
/* The restart interval can be specified in absolute MCUs by setting
|
||||
restart_interval, or in MCU rows by setting restart_in_rows
|
||||
(in which case the correct restart_interval will be figured
|
||||
for each scan).
|
||||
*/
|
||||
unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
|
||||
int restart_in_rows; /* if > 0, MCU rows per restart interval */
|
||||
|
||||
/* Parameters controlling emission of special markers. */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
write_JFIF_header; /* should a JFIF marker be written? */
|
||||
CJPEG_WRBMP_UINT8
|
||||
JFIF_major_version; /* What to write for the JFIF version number */
|
||||
CJPEG_WRBMP_UINT8 JFIF_minor_version;
|
||||
/* These three values are not used by the JPEG code, merely copied */
|
||||
/* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
|
||||
/* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
|
||||
/* ratio is defined by X_density/Y_density even when density_unit=0. */
|
||||
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
|
||||
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
|
||||
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
|
||||
cjpeg_wrbmp_boolean
|
||||
write_Adobe_marker; /* should an Adobe marker be written? */
|
||||
|
||||
/* 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)".
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION next_scanline; /* 0 .. image_height-1 */
|
||||
|
||||
/* Remaining fields are known throughout compressor, but generally
|
||||
should not be touched by a surrounding application.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are computed during compression startup
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
progressive_mode; /* TRUE if scan script uses progressive mode */
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
||||
/* The coefficient controller receives data in units of MCU rows as defined
|
||||
for fully interleaved scans (whether the JPEG file is interleaved or
|
||||
not). There are v_samp_factor * DCTSIZE sample rows of each component in
|
||||
an "iMCU" (interleaved MCU) row.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are valid during any one scan.
|
||||
They describe the components and MCUs actually appearing in the scan.
|
||||
*/
|
||||
int comps_in_scan; /* # of JPEG components in this scan */
|
||||
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4];
|
||||
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[10];
|
||||
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
cjpeg_wrbmp_jpeg_scan_info
|
||||
*script_space; /* workspace for jpeg_simple_progression */
|
||||
int script_space_size;
|
||||
};
|
||||
|
||||
/* Master record for a decompression instance */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_compress_struct
|
||||
*/
|
||||
|
||||
/* Source of compressed data */
|
||||
struct cjpeg_wrbmp_jpeg_source_mgr *src;
|
||||
|
||||
/* Basic description of image --- filled in by jpeg_read_header(). */
|
||||
/* Application may inspect these values to decide how to process image. */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
image_width; /* nominal image width (from SOF marker) */
|
||||
CJPEG_WRBMP_JDIMENSION image_height; /* nominal image height */
|
||||
int num_components; /* # of color components in JPEG image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE
|
||||
jpeg_color_space; /* colorspace of JPEG image */
|
||||
|
||||
/* Decompression processing parameters --- these fields must be set before
|
||||
calling jpeg_start_decompress(). Note that jpeg_read_header()
|
||||
initializes them to default values.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_J_COLOR_SPACE out_color_space; /* colorspace for output */
|
||||
|
||||
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
|
||||
|
||||
float output_gamma; /* image gamma wanted in output */
|
||||
|
||||
cjpeg_wrbmp_boolean buffered_image; /* TRUE=multiple output passes */
|
||||
cjpeg_wrbmp_boolean raw_data_out; /* TRUE=downsampled data wanted */
|
||||
|
||||
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* IDCT algorithm selector */
|
||||
cjpeg_wrbmp_boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
|
||||
cjpeg_wrbmp_boolean
|
||||
do_block_smoothing; /* TRUE=apply interblock smoothing */
|
||||
|
||||
cjpeg_wrbmp_boolean quantize_colors; /* TRUE=colormapped output wanted */
|
||||
/* the following are ignored if not quantize_colors: */
|
||||
CJPEG_WRBMP_J_DITHER_MODE
|
||||
dither_mode; /* type of color dithering to use */
|
||||
cjpeg_wrbmp_boolean
|
||||
two_pass_quantize; /* TRUE=use two-pass color quantization */
|
||||
int desired_number_of_colors; /* max # colors to use in created colormap */
|
||||
/* these are significant only in buffered-image mode: */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_1pass_quant; /* enable future use of 1-pass quantizer */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_EXTERNal_quant; /* enable future use of EXTERNal colormap */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_2pass_quant; /* enable future use of 2-pass quantizer */
|
||||
|
||||
/* Description of actual output image that will be returned to application.
|
||||
These fields are computed by jpeg_start_decompress().
|
||||
You can also use jpeg_calc_output_dimensions() to determine these values
|
||||
in advance of calling jpeg_start_decompress().
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION output_width; /* scaled image width */
|
||||
CJPEG_WRBMP_JDIMENSION output_height; /* scaled image height */
|
||||
int out_color_components; /* # of color components in out_color_space */
|
||||
int output_components; /* # of color components returned */
|
||||
/* output_components is 1 (a colormap index) when quantizing colors;
|
||||
otherwise it equals out_color_components.
|
||||
*/
|
||||
int rec_outbuf_height; /* min recommended height of scanline buffer */
|
||||
/* If the buffer passed to jpeg_read_scanlines() is less than this many rows
|
||||
high, space and time will be wasted due to unnecessary data copying.
|
||||
Usually rec_outbuf_height will be 1 or 2, at most 4.
|
||||
*/
|
||||
|
||||
/* When quantizing colors, the output colormap is described by these fields.
|
||||
The application can supply a colormap by setting colormap non-NULL before
|
||||
calling jpeg_start_decompress; otherwise a colormap is created during
|
||||
jpeg_start_decompress or jpeg_start_output.
|
||||
The map has out_color_components rows and actual_number_of_colors
|
||||
columns.
|
||||
*/
|
||||
int actual_number_of_colors; /* number of entries in use */
|
||||
CJPEG_WRBMP_JSAMPARRAY
|
||||
colormap; /* The color map as a 2-D pixel array */
|
||||
|
||||
/* State variables: these variables indicate the progress of decompression.
|
||||
The application may examine these but must not modify them.
|
||||
*/
|
||||
|
||||
/* Row index of next scanline to be read from jpeg_read_scanlines().
|
||||
Application may use this to control its processing loop, e.g.,
|
||||
"while (output_scanline < output_height)".
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION output_scanline; /* 0 .. output_height-1 */
|
||||
|
||||
/* Current input scan number and number of iMCU rows completed in scan.
|
||||
These indicate the progress of the decompressor input side.
|
||||
*/
|
||||
int input_scan_number; /* Number of SOS markers seen so far */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
input_iMCU_row; /* Number of iMCU rows completed */
|
||||
|
||||
/* The "output scan number" is the notional scan being displayed by the
|
||||
output side. The decompressor will not allow output scan/row number
|
||||
to get ahead of input scan/row, but it can fall arbitrarily far behind.
|
||||
*/
|
||||
int output_scan_number; /* Nominal scan number being displayed */
|
||||
CJPEG_WRBMP_JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
|
||||
|
||||
/* Current progression status. coef_bits[ c ][ i ] indicates the precision
|
||||
with which component c's DCT coefficient i (in zigzag order) is known.
|
||||
It is -1 when no data has yet been received, otherwise it is the point
|
||||
transform (shift) value for the most recent scan of the coefficient
|
||||
(thus, 0 at completion of the progression).
|
||||
This pointer is NULL when reading a non-progressive file.
|
||||
*/
|
||||
int (*coef_bits)[64]; /* -1 or current Al value for each coef */
|
||||
|
||||
/* Internal JPEG parameters --- the application usually need not look at
|
||||
these fields. Note that the decompressor output side may not use
|
||||
any parameters that can change between scans.
|
||||
*/
|
||||
|
||||
/* Quantization and Huffman tables are carried forward across input
|
||||
datastreams when processing abbreviated JPEG datastreams.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4];
|
||||
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4];
|
||||
/* ptrs to Huffman coding tables, or NULL if not defined */
|
||||
|
||||
/* These parameters are never carried across datastreams, since they
|
||||
are given in SOF/SOS markers or defined to be reset by SOI.
|
||||
*/
|
||||
|
||||
int data_precision; /* bits of precision in image data */
|
||||
|
||||
cjpeg_wrbmp_jpeg_component_info *comp_info;
|
||||
/* comp_info[ i ] describes component that appears i'th in SOF */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
progressive_mode; /* TRUE if SOFn specifies progressive mode */
|
||||
cjpeg_wrbmp_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_L[16]; /* L values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_U[16]; /* U values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_ac_K[16]; /* Kx values for AC arith-coding tables */
|
||||
|
||||
unsigned int
|
||||
restart_interval; /* MCUs per restart interval, or 0 for no restart */
|
||||
|
||||
/* These fields record data obtained from optional markers recognized by
|
||||
the JPEG library.
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
|
||||
/* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
|
||||
CJPEG_WRBMP_UINT8 JFIF_major_version; /* JFIF version number */
|
||||
CJPEG_WRBMP_UINT8 JFIF_minor_version;
|
||||
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
|
||||
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
|
||||
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
|
||||
cjpeg_wrbmp_boolean
|
||||
saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
|
||||
CJPEG_WRBMP_UINT8
|
||||
Adobe_transform; /* Color transform code from Adobe marker */
|
||||
|
||||
cjpeg_wrbmp_boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
|
||||
/* Aside from the specific data retained from APPn markers known to the
|
||||
library, the uninterpreted contents of any or all APPn and COM markers
|
||||
can be saved in a list for examination by the application.
|
||||
*/
|
||||
jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
|
||||
|
||||
/* Remaining fields are known throughout decompressor, but generally
|
||||
should not be touched by a surrounding application.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are computed during decompression startup
|
||||
*/
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
|
||||
/* The coefficient controller's input and output progress is measured in
|
||||
units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
|
||||
in fully interleaved JPEG scans, but are used whether the scan is
|
||||
interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
||||
rows of each component. Therefore, the IDCT output contains
|
||||
v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JSAMPLE
|
||||
*sample_range_limit; /* table for fast range-limiting */
|
||||
|
||||
/*
|
||||
These fields are valid during any one scan.
|
||||
They describe the components and MCUs actually appearing in the scan.
|
||||
Note that the decompressor output side must not use these fields.
|
||||
*/
|
||||
int comps_in_scan; /* # of JPEG components in this scan */
|
||||
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4];
|
||||
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[10];
|
||||
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
int unread_marker;
|
||||
|
||||
/*
|
||||
Links to decompression subobjects (methods, private variables of modules)
|
||||
*/
|
||||
struct jpeg_decomp_master *master;
|
||||
struct jpeg_d_main_controller *main;
|
||||
struct jpeg_d_coef_controller *coef;
|
||||
struct jpeg_d_post_controller *post;
|
||||
struct jpeg_input_controller *inputctl;
|
||||
struct jpeg_marker_reader *marker;
|
||||
struct jpeg_entropy_decoder *entropy;
|
||||
struct jpeg_inverse_dct *idct;
|
||||
struct jpeg_upsampler *upsample;
|
||||
struct jpeg_color_deconverter *cconvert;
|
||||
struct jpeg_color_quantizer *cquantize;
|
||||
};
|
||||
|
||||
/* "Object" declarations for JPEG modules that may be supplied or called
|
||||
directly by the surrounding application.
|
||||
As with all objects in the JPEG library, these structs only define the
|
||||
publicly visible methods and state variables of a module. Additional
|
||||
private fields may exist after the public ones.
|
||||
*/
|
||||
|
||||
/* Error handler object */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_error_mgr {
|
||||
/* Error exit handler: does not return to caller */
|
||||
CJPEG_WRBMP_JMETHOD(void, error_exit, (cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
/* Conditionally emit a trace or warning message */
|
||||
CJPEG_WRBMP_JMETHOD(void, emit_message,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int msg_level));
|
||||
/* Routine that actually outputs a trace or error message */
|
||||
CJPEG_WRBMP_JMETHOD(void, output_message, (cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
/* Format a message string for the most recent JPEG error or message */
|
||||
CJPEG_WRBMP_JMETHOD(void, format_message,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, char *buffer));
|
||||
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
||||
/* Reset error state variables at start of a new image */
|
||||
CJPEG_WRBMP_JMETHOD(void, reset_error_mgr,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
|
||||
/* The message ID code and any parameters are saved here.
|
||||
A message can have one string parameter or up to 8 int parameters.
|
||||
*/
|
||||
int msg_code;
|
||||
#define JMSG_STR_PARM_MAX 80
|
||||
/*
|
||||
union {
|
||||
int i[ 8 ];
|
||||
char s[ JMSG_STR_PARM_MAX ];
|
||||
} msg_parm;
|
||||
*/
|
||||
/* Standard state variables for error facility */
|
||||
|
||||
int trace_level; /* max msg_level that will be displayed */
|
||||
|
||||
/* For recoverable corrupt-data errors, we emit a warning message,
|
||||
but keep going unless emit_message chooses to abort. emit_message
|
||||
should count warnings in num_warnings. The surrounding application
|
||||
can check for bad data by seeing if num_warnings is nonzero at the
|
||||
end of processing.
|
||||
*/
|
||||
long num_warnings; /* number of corrupt-data warnings */
|
||||
|
||||
/* These fields point to the table(s) of error message strings.
|
||||
An application can change the table pointer to switch to a different
|
||||
message list (typically, to change the language in which errors are
|
||||
reported). Some applications may wish to add additional error codes
|
||||
that will be handled by the JPEG library error mechanism; the second
|
||||
table pointer is used for this purpose.
|
||||
|
||||
First table includes all errors generated by JPEG library itself.
|
||||
Error code 0 is reserved for a "no such error string" message.
|
||||
*/
|
||||
const char *const *jpeg_message_table; /* Library errors */
|
||||
int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
|
||||
/* Second table can be added by application (see cjpeg/djpeg for example).
|
||||
It contains strings numbered first_addon_message..last_addon_message.
|
||||
*/
|
||||
const char *const *addon_message_table; /* Non-library errors */
|
||||
int first_addon_message; /* code for first string in addon table */
|
||||
int last_addon_message; /* code for last string in addon table */
|
||||
};
|
||||
|
||||
/* Progress monitor object */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr {
|
||||
CJPEG_WRBMP_JMETHOD(void, progress_monitor,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
|
||||
long pass_counter; /* work units completed in this pass */
|
||||
long pass_limit; /* total number of work units in this pass */
|
||||
int completed_passes; /* passes completed so far */
|
||||
int total_passes; /* total number of passes expected */
|
||||
};
|
||||
|
||||
/* Data destination object for compression */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_destination_mgr {
|
||||
CJPEG_WRBMP_JOCTET
|
||||
*next_output_byte; /* => next byte to write in buffer */
|
||||
cjpeg_wrbmp_size_t
|
||||
free_in_buffer; /* # of byte spaces remaining in buffer */
|
||||
|
||||
CJPEG_WRBMP_JMETHOD(void, init_destination,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, empty_output_buffer,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(void, term_destination,
|
||||
(cjpeg_wrbmp_j_compress_ptr cinfo));
|
||||
};
|
||||
|
||||
/* Data source object for decompression */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_source_mgr {
|
||||
const CJPEG_WRBMP_JOCTET
|
||||
*next_input_byte; /* => next byte to read from buffer */
|
||||
cjpeg_wrbmp_size_t bytes_in_buffer; /* # of bytes remaining in buffer */
|
||||
|
||||
CJPEG_WRBMP_JMETHOD(void, init_source,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, fill_input_buffer,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(void, skip_input_data,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo, long num_bytes));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, resync_to_restart,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo, int desired));
|
||||
CJPEG_WRBMP_JMETHOD(void, term_source,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
};
|
||||
|
||||
/* Memory manager object.
|
||||
Allocates "small" objects (a few K total), "large" objects (tens of K),
|
||||
and "really big" objects (virtual arrays with backing store if needed).
|
||||
The memory manager does not allow individual objects to be freed; rather,
|
||||
each created object is assigned to a pool, and whole pools can be freed
|
||||
at once. This is faster and more convenient than remembering exactly what
|
||||
to free, especially where malloc()/free() are not too speedy.
|
||||
NB: alloc routines never return NULL. They exit to error_exit if not
|
||||
successful.
|
||||
*/
|
||||
|
||||
typedef struct jvirt_sarray_control *cjpeg_wrbmp_jvirt_sarray_ptr;
|
||||
typedef struct jvirt_barray_control *cjpeg_wrbmp_jvirt_barray_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_memory_mgr {
|
||||
/* Method pointers */
|
||||
CJPEG_WRBMP_JMETHOD(void *, alloc_small,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_size_t sizeofobject));
|
||||
CJPEG_WRBMP_JMETHOD(void CJPEG_WRBMP_FAR *, alloc_large,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_size_t sizeofobject));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JSAMPARRAY, alloc_sarray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
CJPEG_WRBMP_JDIMENSION samplesperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JBLOCKARRAY, alloc_barray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
CJPEG_WRBMP_JDIMENSION blocksperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_jvirt_sarray_ptr, request_virt_sarray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_boolean pre_zero,
|
||||
CJPEG_WRBMP_JDIMENSION samplesperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows,
|
||||
CJPEG_WRBMP_JDIMENSION maxaccess));
|
||||
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_jvirt_barray_ptr, request_virt_barray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_boolean pre_zero,
|
||||
CJPEG_WRBMP_JDIMENSION blocksperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows,
|
||||
CJPEG_WRBMP_JDIMENSION maxaccess));
|
||||
CJPEG_WRBMP_JMETHOD(void, realize_virt_arrays,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JSAMPARRAY, access_virt_sarray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
cjpeg_wrbmp_jvirt_sarray_ptr ptr,
|
||||
CJPEG_WRBMP_JDIMENSION start_row,
|
||||
CJPEG_WRBMP_JDIMENSION num_rows,
|
||||
cjpeg_wrbmp_boolean writable));
|
||||
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JBLOCKARRAY, access_virt_barray,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
cjpeg_wrbmp_jvirt_barray_ptr ptr,
|
||||
CJPEG_WRBMP_JDIMENSION start_row,
|
||||
CJPEG_WRBMP_JDIMENSION num_rows,
|
||||
cjpeg_wrbmp_boolean writable));
|
||||
CJPEG_WRBMP_JMETHOD(void, free_pool,
|
||||
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id));
|
||||
CJPEG_WRBMP_JMETHOD(void, self_destruct, (cjpeg_wrbmp_j_common_ptr cinfo));
|
||||
|
||||
/* Limit on memory allocation for this JPEG object. (Note that this is
|
||||
merely advisory, not a guaranteed maximum; it only affects the space
|
||||
used for virtual-array buffers.) May be changed by outer application
|
||||
after creating the JPEG object.
|
||||
*/
|
||||
long max_memory_to_use;
|
||||
|
||||
/* Maximum allocation request accepted by alloc_large. */
|
||||
long max_alloc_chunk;
|
||||
};
|
||||
|
||||
/* Routine signature for application-supplied marker processing methods.
|
||||
Need not pass marker code since it is stored in cinfo->unread_marker.
|
||||
*/
|
||||
typedef CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, jpeg_marker_parser_method,
|
||||
(cjpeg_wrbmp_j_decompress_ptr cinfo));
|
||||
|
||||
/*
|
||||
The JPEG library modules define JPEG_INTERNALS before including this file.
|
||||
The internal structure declarations are read only when that is true.
|
||||
Applications using the library should not include jpegint.h, but may wish
|
||||
to include jerror.h.
|
||||
*/
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
|
||||
#include "jerror.h" /* fetch error codes too */
|
||||
#include "jpegint.h" /* fetch private declarations */
|
||||
#endif
|
||||
|
||||
#endif /* JPEGLIB_H */
|
||||
86
targets/wasm-tacle/sequential/cjpeg_wrbmp/input.c
Executable file
86
targets/wasm-tacle/sequential/cjpeg_wrbmp/input.c
Executable file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: input.c
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
Function: Input variables for the cjpeg_jpeg6b_wrbmp.c
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
|
||||
*/
|
||||
|
||||
unsigned char cjpeg_wrbmp_colormap[ 3 ][ 256 ];
|
||||
|
||||
void cjpeg_wrbmp_initInput( void )
|
||||
{
|
||||
int i, j;
|
||||
volatile unsigned char tmp[ 3 ][ 256 ] = {{
|
||||
44, 105, 153, 71, 151, 160, 188, 90, 209, 131,
|
||||
221, 114, 93, 124, 208, 207, 218, 54, 145, 113, 153, 239, 226, 83, 243, 151,
|
||||
98, 67, 114, 153, 83, 186, 116, 72, 188, 190, 109, 162, 218, 133, 208, 209,
|
||||
115, 251, 135, 89, 143, 226, 230, 246, 152, 243, 152, 115, 180, 78, 246, 164,
|
||||
250, 117, 76, 150, 152, 188, 251, 195, 127, 111, 225, 208, 94, 93, 143, 131,
|
||||
201, 211, 99, 93, 190, 157, 121, 240, 117, 185, 167, 137, 152, 188, 250, 59,
|
||||
248, 245, 115, 240, 192, 209, 143, 136, 98, 224, 167, 135, 132, 189, 72, 249,
|
||||
205, 44, 106, 96, 147, 247, 249, 228, 224, 249, 190, 112, 135, 168, 95, 205,
|
||||
171, 58, 112, 79, 206, 75, 242, 188, 189, 225, 185, 81, 221, 153, 244, 198,
|
||||
171, 163, 159, 209, 240, 138, 148, 207, 166, 192, 188, 151, 98, 190, 209, 154,
|
||||
225, 72, 96, 249, 191, 223, 207, 163, 207, 133, 251, 183, 135, 137, 159, 247,
|
||||
167, 83, 123, 199, 203, 144, 142, 237, 77, 128, 117, 169, 202, 136, 128, 188,
|
||||
168, 55, 222, 169, 116, 60, 75, 175, 102, 217, 168, 185, 189, 225, 125, 192,
|
||||
112, 111, 168, 239, 225, 168, 97, 129, 190, 175, 169, 225, 170, 226, 225, 226,
|
||||
224, 134, 106, 250, 222, 148, 241, 168, 166, 160, 95, 190, 102, 180, 193, 111,
|
||||
151, 165, 171, 200, 52, 134, 169, 223, 166, 225, 169, 111, 185, 109, 56, 244,
|
||||
157, 250, 226, 231, 119, 188
|
||||
}, {
|
||||
42, 143, 46, 91, 84, 201, 140, 91, 82, 140, 31,
|
||||
88, 44, 171, 57, 115, 206, 59, 145, 117, 116, 53, 232, 117, 80, 60, 66, 64,
|
||||
117, 174, 89, 178, 147, 63, 83, 59, 103, 139, 211, 64, 68, 98, 118, 53, 119,
|
||||
90, 161, 232, 171, 98, 176, 236, 118, 157, 180, 77, 114, 88, 28, 119, 40, 97,
|
||||
69, 189, 252, 225, 119, 96, 219, 84, 82, 105, 158, 49, 200, 61, 117, 78, 63,
|
||||
147, 140, 69, 108, 90, 161, 105, 190, 114, 84, 76, 70, 43, 156, 222, 96, 72,
|
||||
143, 90, 105, 56, 144, 78, 129, 35, 66, 101, 100, 49, 105, 130, 160, 239, 129,
|
||||
141, 83, 43, 68, 106, 132, 83, 92, 130, 175, 63, 131, 79, 192, 105, 57, 160,
|
||||
118, 162, 141, 78, 192, 128, 206, 201, 203, 162, 159, 163, 221, 183, 157, 177,
|
||||
189, 192, 129, 130, 54, 104, 45, 101, 252, 52, 91, 177, 49, 221, 116, 111, 143,
|
||||
92, 142, 159, 131, 173, 61, 159, 173, 81, 129, 214, 213, 145, 143, 232, 67,
|
||||
145, 130, 99, 237, 110, 160, 131, 67, 50, 129, 131, 127, 76, 92, 203, 96, 206,
|
||||
176, 180, 85, 99, 162, 118, 64, 78, 190, 191, 45, 101, 129, 58, 72, 211, 49,
|
||||
115, 115, 85, 61, 100, 116, 107, 143, 117, 219, 154, 225, 174, 160, 163, 119,
|
||||
190, 106, 186, 49, 45, 177, 147, 85, 138, 42, 174, 59, 68, 120, 71, 129, 56,
|
||||
149, 97, 68, 88, 148, 60, 239, 179, 149, 104
|
||||
}, {
|
||||
44, 76, 37, 56, 76, 152, 122,
|
||||
153, 77, 191, 41, 76, 39, 97, 46, 109, 172, 43, 116, 91, 102, 49, 201, 68, 88,
|
||||
45, 53, 95, 160, 175, 102, 164, 116, 50, 76, 45, 86, 189, 216, 50, 61, 93, 196,
|
||||
91, 100, 58, 116, 223, 166, 102, 126, 221, 158, 86, 235, 55, 113, 120, 52, 115,
|
||||
42, 86, 55, 165, 247, 194, 160, 108, 170, 108, 98, 77, 168, 42, 179, 70, 96,
|
||||
62, 71, 216, 100, 71, 155, 121, 146, 86, 134, 105, 114, 49, 100, 50, 119, 218,
|
||||
95, 81, 220, 78, 102, 50, 125, 68, 170, 36, 62, 119, 129, 44, 151, 72, 143,
|
||||
241, 131, 137, 79, 73, 55, 122, 204, 73, 74, 131, 221, 53, 89, 72, 178, 60, 64,
|
||||
145, 157, 156, 177, 101, 180, 112, 194, 206, 178, 168, 221, 153, 201, 119, 222,
|
||||
165, 188, 212, 117, 180, 45, 134, 42, 130, 229, 47, 107, 172, 40, 221, 146,
|
||||
132, 138, 110, 144, 188, 112, 132, 64, 162, 145, 140, 200, 181, 215, 139, 197,
|
||||
183, 106, 126, 116, 89, 204, 152, 123, 161, 52, 46, 131, 167, 173, 62, 70, 151,
|
||||
151, 197, 177, 184, 96, 97, 101, 130, 54, 63, 141, 185, 45, 126, 96, 46, 71,
|
||||
172, 38, 114, 100, 106, 69, 118, 138, 127, 99, 127, 198, 204, 242, 248, 197,
|
||||
241, 74, 189, 178, 252, 65, 45, 148, 145, 97, 168, 45, 111, 43, 64, 164, 80,
|
||||
113, 47, 136, 83, 42, 91, 197, 95, 222, 167, 92, 98
|
||||
}
|
||||
};
|
||||
|
||||
_Pragma( "loopbound min 3 max 3" )
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
_Pragma( "loopbound min 256 max 256" )
|
||||
for ( j = 0; j < 256; j++ )
|
||||
cjpeg_wrbmp_colormap[ i ][ j ] = tmp[ i ][ j ];
|
||||
}
|
||||
}
|
||||
65
targets/wasm-tacle/sequential/cjpeg_wrbmp/jconfig.h
Executable file
65
targets/wasm-tacle/sequential/cjpeg_wrbmp/jconfig.h
Executable file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: cderror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README files
|
||||
*/
|
||||
|
||||
#ifndef JCONFIG_H
|
||||
#define JCONFIG_H
|
||||
|
||||
#define CJPEG_WRBMP_HAVE_PROTOTYPES
|
||||
#define CJPEG_WRBMP_HAVE_UNSIGNED_CHAR
|
||||
#define CJPEG_WRBMP_HAVE_UNSIGNED_SHORT
|
||||
#undef void
|
||||
#undef const
|
||||
#undef CHAR_IS_UNSIGNED
|
||||
#define CJPEG_WRBMP_HAVE_STDDEF_H
|
||||
#define CJPEG_WRBMP_HAVE_STDLIB_H
|
||||
#undef NEED_BSD_STRINGS
|
||||
#undef NEED_SYS_TYPES_H
|
||||
#undef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||
/* Define this if you get warnings about undefined structures. */
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
|
||||
|
||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||
#define INLINE __inline__
|
||||
/* These are for configuring the JPEG memory manager. */
|
||||
#undef DEFAULT_MAX_MEM
|
||||
#undef NO_MKTEMP
|
||||
|
||||
#endif /* JPEG_INTERNALS */
|
||||
|
||||
#ifdef CJPEG_WRBMP_JPEG_CJPEG_DJPEG
|
||||
|
||||
#define CJPEG_WRBMP_BMP_SUPPORTED /* BMP image file format */
|
||||
#define CJPEG_WRBMP_GIF_SUPPORTED /* GIF image file format */
|
||||
#define CJPEG_WRBMP_PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||
#define CJPEG_WRBMP_TARGA_SUPPORTED /* Targa image file format */
|
||||
|
||||
#undef TWO_FILE_COMMANDLINE
|
||||
#undef NEED_SIGNAL_CATCHER
|
||||
#undef DONT_USE_B_MODE
|
||||
|
||||
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
|
||||
#undef PROGRESS_REPORT
|
||||
|
||||
#endif /* JPEG_CJPEG_DJPEG */
|
||||
|
||||
#endif
|
||||
203
targets/wasm-tacle/sequential/cjpeg_wrbmp/jerror.h
Executable file
203
targets/wasm-tacle/sequential/cjpeg_wrbmp/jerror.h
Executable file
@ -0,0 +1,203 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jerror.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file defines the error and message codes for the JPEG library.
|
||||
Edit this file to add new codes, or to translate the message strings to
|
||||
some other language.
|
||||
A set of error-reporting macros are defined too. Some applications using
|
||||
the JPEG library may wish to include this file to get the error codes
|
||||
sand/or the macros.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
/*
|
||||
To define the enum list of message codes, include this file without
|
||||
defining macro JMESSAGE. To create a message string table, include it
|
||||
again with a suitable JMESSAGE definition (see jerror.c for an example).
|
||||
*/
|
||||
#ifndef CJPEG_WRBMP_JMESSAGE
|
||||
#ifndef JERROR_H
|
||||
/* First time through, define the enum list */
|
||||
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#else
|
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
||||
#define CJPEG_WRBMP_JMESSAGE(code,string)
|
||||
#endif /* JERROR_H */
|
||||
#endif /* JMESSAGE */
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
typedef enum {
|
||||
|
||||
#define CJPEG_WRBMP_JMESSAGE(code,string) code ,
|
||||
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
CJPEG_WRBMP_JMESSAGE( JMSG_NOMESSAGE, "Bogus message code %d" ) /* Must be first entry! */
|
||||
|
||||
/* For maintenance convenience, list is alphabetical by message code name */
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_ARITH_NOTIMPL,
|
||||
"Sorry, there are legal restrictions on arithmetic coding" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_BUFFER_MODE, "Bogus buffer control mode" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_DCT_COEF, "DCT coefficient out of range" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_DCTSIZE, "IDCT output block size %d not supported" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_IN_COLORSPACE, "Bogus input colorspace" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_LENGTH, "Bogus marker length" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_LIB_VERSION,
|
||||
"Wrong JPEG library version: library is %d, caller expects %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_POOL_ID, "Invalid memory pool code %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_PRECISION, "Unsupported JPEG data precision %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_PROGRESSION,
|
||||
"Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_PROG_SCRIPT,
|
||||
"Invalid progressive parameters at scan script entry %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_SAMPLING, "Bogus sampling factors" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_STATE, "Improper call to JPEG library in state %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_STRUCT_SIZE,
|
||||
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_CANT_SUSPEND, "Suspension not allowed here" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_COMPONENT_COUNT, "Too many color components: %d, max %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_DAC_INDEX, "Bogus DAC index %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_DAC_VALUE, "Bogus DAC value 0x%x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_DHT_INDEX, "Bogus DHT index %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_DQT_INDEX, "Bogus DQT index %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_EMS_READ, "Read from EMS failed" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_EMS_WRITE, "Write to EMS failed" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_EOI_EXPECTED, "Didn't expect more than one scan" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_FILE_READ, "Input file read error" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_FILE_WRITE, "Output file write error --- out of disk space?" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_INPUT_EMPTY, "Empty input file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_INPUT_EOF, "Premature end of input file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_MISMATCHED_QUANT_TABLE,
|
||||
"Cannot transcode due to multiple use of quantization table %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_MISSING_DATA, "Scan script does not transmit all data" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_MODE_CHANGE, "Invalid color quantization mode change" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_NOTIMPL, "Not implemented yet" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_NOT_COMPILED, "Requested feature was omitted at compile time" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_NO_BACKING_STORE, "Backing store not supported" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_NO_IMAGE, "JPEG datastream contains no image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_QUANT_COMPONENTS,
|
||||
"Cannot quantize more than %d color components" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TFILE_CREATE, "Failed to create temporary file %s" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TFILE_READ, "Read failed on temporary file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TFILE_SEEK, "Seek failed on temporary file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TFILE_WRITE,
|
||||
"Write failed on temporary file --- out of disk space?" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_VIRTUAL_BUG, "Virtual array controller messed up" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_WIDTH_OVERFLOW, "Image too wide for this implementation" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_XMS_READ, "Read from XMS failed" )
|
||||
CJPEG_WRBMP_JMESSAGE( JERR_XMS_WRITE, "Write to XMS failed" )
|
||||
CJPEG_WRBMP_JMESSAGE( JMSG_COPYRIGHT, JCOPYRIGHT )
|
||||
CJPEG_WRBMP_JMESSAGE( JMSG_VERSION, JVERSION )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_16BIT_TABLES,
|
||||
"Caution: quantization tables are too coarse for baseline JPEG" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_ADOBE,
|
||||
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_DHT, "Define Huffman Table 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_DQT, "Define Quantization Table %d precision %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_DRI, "Define Restart Interval %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_EMS_CLOSE, "Freed EMS handle %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_EMS_OPEN, "Obtained EMS handle %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_EOI, "End Of Image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_JFIF_BADTHUMBNAILSIZE,
|
||||
"Warning: thumbnail image size does not match data length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_JFIF_EXTENSION,
|
||||
"JFIF extension marker: type 0x%02x, length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_QUANT_NCOLORS, "Quantizing to %d colors" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_QUANT_SELECTED, "Selected %d colors for quantization" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_RST, "RST%d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_SMOOTH_NOTIMPL,
|
||||
"Smoothing not supported with nonstandard sampling ratios" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_SOI, "Start of Image" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_SOS, "Start Of Scan: %d components" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_TFILE_CLOSE, "Closed temporary file %s" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_TFILE_OPEN, "Opened temporary file %s" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_THUMB_JPEG,
|
||||
"JFIF extension marker: JPEG-compressed thumbnail image, length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_THUMB_PALETTE,
|
||||
"JFIF extension marker: palette thumbnail image, length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_THUMB_RGB,
|
||||
"JFIF extension marker: RGB thumbnail image, length %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_UNKNOWN_IDS,
|
||||
"Unrecognized component IDs %d %d %d, assuming YCbCr" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_XMS_CLOSE, "Freed XMS handle %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JTRC_XMS_OPEN, "Obtained XMS handle %u" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_BOGUS_PROGRESSION,
|
||||
"Inconsistent progression sequence for component %d coefficient %d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_EXTRANEOUS_DATA,
|
||||
"Corrupt JPEG data: %u extraneous bytes before marker 0x%02x" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_JPEG_EOF, "Premature end of JPEG file" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_MUST_RESYNC,
|
||||
"Corrupt JPEG data: found marker 0x%02x instead of RST%d" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG" )
|
||||
CJPEG_WRBMP_JMESSAGE( JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines" )
|
||||
|
||||
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
|
||||
JMSG_LASTMSGCODE
|
||||
} CJPEG_WRBMP_J_MESSAGE_CODE;
|
||||
|
||||
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
|
||||
#undef CJPEG_WRBMP_JMESSAGE
|
||||
95
targets/wasm-tacle/sequential/cjpeg_wrbmp/jmorecfg.h
Executable file
95
targets/wasm-tacle/sequential/cjpeg_wrbmp/jmorecfg.h
Executable file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jmorecfg.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
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 additional configuration options that customize the
|
||||
JPEG software for special applications or support machine-dependent
|
||||
optimizations. Most users will not need to touch this file.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
#ifndef JMORECFG_H
|
||||
#define JMORECFG_H
|
||||
|
||||
|
||||
#define CJPEG_WRBMP_GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
typedef unsigned char CJPEG_WRBMP_JSAMPLE;
|
||||
typedef short CJPEG_WRBMP_JCOEF;
|
||||
typedef unsigned char CJPEG_WRBMP_JOCTET;
|
||||
|
||||
/* These typedefs are used for various table entries and so forth.
|
||||
They must be at least as wide as specified; but making them too big
|
||||
won't cost a huge amount of memory, so we don't provide special
|
||||
extraction code like we did for JSAMPLE. (In other words, these
|
||||
typedefs live at a different point on the speed/space tradeoff curve.)
|
||||
*/
|
||||
|
||||
/* UINT8 must hold at least the values 0..255. */
|
||||
|
||||
typedef unsigned char CJPEG_WRBMP_UINT8;
|
||||
|
||||
|
||||
/* UINT16 must hold at least the values 0..65535. */
|
||||
|
||||
typedef unsigned short CJPEG_WRBMP_UINT16;
|
||||
|
||||
|
||||
/* INT16 must hold at least the values -32768..32767. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
||||
typedef short INT16;
|
||||
#endif
|
||||
|
||||
/* INT32 must hold at least signed 32-bit values. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||
typedef long INT32;
|
||||
#endif
|
||||
|
||||
typedef unsigned int CJPEG_WRBMP_JDIMENSION;
|
||||
|
||||
/* This macro is used to declare a "method", that is, a function pointer.
|
||||
We want to supply prototype parameters if the compiler can cope.
|
||||
Note that the arglist parameter must be parenthesized!
|
||||
Again, you can customize this if you need special linkage keywords.
|
||||
*/
|
||||
|
||||
#define EXTERN(type) extern type
|
||||
|
||||
#ifdef CJPEG_WRBMP_HAVE_PROTOTYPES
|
||||
#define CJPEG_WRBMP_JMETHOD(type,methodname,arglist) type (*methodname) arglist
|
||||
#else
|
||||
#define CJPEG_WRBMP_JMETHOD(type,methodname,arglist) type (*methodname) ()
|
||||
#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
|
||||
explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||
*/
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
|
||||
#define CJPEG_WRBMP_FAR far
|
||||
#else
|
||||
#define CJPEG_WRBMP_FAR
|
||||
#endif
|
||||
|
||||
#ifndef CJPEG_JPEG6B_WRBMP_HAVE_BOOLEAN
|
||||
typedef int cjpeg_wrbmp_boolean;
|
||||
#endif
|
||||
#endif
|
||||
869
targets/wasm-tacle/sequential/cjpeg_wrbmp/jpeglib.h
Executable file
869
targets/wasm-tacle/sequential/cjpeg_wrbmp/jpeglib.h
Executable file
@ -0,0 +1,869 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 1.x
|
||||
|
||||
Name: jpeglib.h
|
||||
|
||||
Author: Thomas G. Lane.
|
||||
|
||||
This file is part of the Independent JPEG Group's software.
|
||||
For conditions of distribution and use, see the accompanying README file.
|
||||
|
||||
This file defines the application interface for the JPEG library.
|
||||
Most applications using the library need only include this file,
|
||||
and perhaps jerror.h if they want to know the exact error codes.
|
||||
|
||||
Source: Independent JPEG Group's software
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: See the accompanying README file
|
||||
*/
|
||||
|
||||
|
||||
#ifndef JPEGLIB_H
|
||||
#define JPEGLIB_H
|
||||
|
||||
typedef int CJPEG_WRBMP_FILE;
|
||||
typedef unsigned int cjpeg_wrbmp_size_t;
|
||||
|
||||
/*
|
||||
First we include the configuration files that record how this
|
||||
installation of the JPEG library is set up. jconfig.h can be
|
||||
generated automatically for many systems. jmorecfg.h contains
|
||||
manual configuration options that most people need not worry about.
|
||||
*/
|
||||
|
||||
#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
|
||||
#include "jconfig.h" /* widely used configuration options */
|
||||
#endif
|
||||
#include "jmorecfg.h" /* seldom changed options */
|
||||
|
||||
/* Data structures for images (arrays of samples and of DCT coefficients).
|
||||
On 80x86 machines, the image arrays are too big for near pointers,
|
||||
but the pointer arrays can fit in near memory.
|
||||
*/
|
||||
|
||||
typedef CJPEG_WRBMP_JSAMPLE CJPEG_WRBMP_FAR
|
||||
*CJPEG_WRBMP_JSAMPROW; /* ptr to one image row of pixel samples. */
|
||||
typedef CJPEG_WRBMP_JSAMPROW
|
||||
*CJPEG_WRBMP_JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
|
||||
typedef CJPEG_WRBMP_JSAMPARRAY
|
||||
*CJPEG_WRBMP_JSAMPIMAGE; /* a 3-D sample array: top index is color */
|
||||
|
||||
typedef CJPEG_WRBMP_JCOEF
|
||||
CJPEG_WRBMP_JBLOCK[ 64 ]; /* one block of coefficients */
|
||||
typedef CJPEG_WRBMP_JBLOCK CJPEG_WRBMP_FAR
|
||||
*CJPEG_WRBMP_JBLOCKROW; /* pointer to one row of coefficient blocks */
|
||||
typedef CJPEG_WRBMP_JBLOCKROW
|
||||
*CJPEG_WRBMP_JBLOCKARRAY; /* a 2-D array of coefficient blocks */
|
||||
typedef CJPEG_WRBMP_JBLOCKARRAY
|
||||
*CJPEG_WRBMP_JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
|
||||
|
||||
typedef CJPEG_WRBMP_JCOEF CJPEG_WRBMP_FAR
|
||||
*JCOEFPTR; /* useful in a couple of places */
|
||||
|
||||
|
||||
/* Types for JPEG compression parameters and working tables. */
|
||||
|
||||
|
||||
/* DCT coefficient quantization tables. */
|
||||
|
||||
typedef struct {
|
||||
/* This array gives the coefficient quantizers in natural array order
|
||||
(not the zigzag order in which they are stored in a JPEG DQT marker).
|
||||
CAUTION: IJG versions prior to v6a kept this array in zigzag order.
|
||||
*/
|
||||
CJPEG_WRBMP_UINT16
|
||||
quantval[ 64 ]; /* quantization step for each coefficient */
|
||||
/* This field is used only during compression. It's initialized FALSE when
|
||||
the table is created, and set TRUE when it's been output to the file.
|
||||
You could suppress output of a table by setting this to TRUE.
|
||||
(See jpeg_suppress_tables for an example.)
|
||||
*/
|
||||
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
|
||||
} CJPEG_WRBMP_JQUANT_TBL;
|
||||
|
||||
|
||||
/* Huffman coding tables. */
|
||||
|
||||
typedef struct {
|
||||
/* These two fields directly represent the contents of a JPEG DHT marker */
|
||||
CJPEG_WRBMP_UINT8 bits[ 17 ]; /* bits[ k ] = # of symbols with codes of */
|
||||
/* length k bits; bits[ 0 ] is unused */
|
||||
CJPEG_WRBMP_UINT8
|
||||
huffval[ 256 ]; /* The symbols, in order of incr code length */
|
||||
/* This field is used only during compression. It's initialized FALSE when
|
||||
the table is created, and set TRUE when it's been output to the file.
|
||||
You could suppress output of a table by setting this to TRUE.
|
||||
(See jpeg_suppress_tables for an example.)
|
||||
*/
|
||||
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
|
||||
} CJPEG_WRBMP_JHUFF_TBL;
|
||||
|
||||
|
||||
/* Basic info about one component (color channel). */
|
||||
|
||||
typedef struct {
|
||||
/* These values are fixed over the whole image. */
|
||||
/* For compression, they must be supplied by parameter setup; */
|
||||
/* for decompression, they are read from the SOF marker. */
|
||||
int component_id; /* identifier for this component (0..255) */
|
||||
int component_index; /* its index in SOF or cinfo->comp_info[ ] */
|
||||
int h_samp_factor; /* horizontal sampling factor (1..4) */
|
||||
int v_samp_factor; /* vertical sampling factor (1..4) */
|
||||
int quant_tbl_no; /* quantization table selector (0..3) */
|
||||
/* These values may vary between scans. */
|
||||
/* For compression, they must be supplied by parameter setup; */
|
||||
/* for decompression, they are read from the SOS marker. */
|
||||
/* The decompressor output side may not use these variables. */
|
||||
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
||||
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
||||
|
||||
/* Remaining fields should be treated as private by applications. */
|
||||
|
||||
/* These values are computed during compression or decompression startup: */
|
||||
/* Component's size in DCT blocks.
|
||||
Any dummy blocks added to complete an MCU are not counted; therefore
|
||||
these values do not depend on whether a scan is interleaved or not.
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION width_in_blocks;
|
||||
CJPEG_WRBMP_JDIMENSION height_in_blocks;
|
||||
/* Size of a DCT block in samples. Always DCTSIZE for compression.
|
||||
For decompression this is the size of the output from one DCT block,
|
||||
reflecting any scaling we choose to apply during the IDCT step.
|
||||
Values of 1,2,4,8 are likely to be supported. Note that different
|
||||
components may receive different IDCT scalings.
|
||||
*/
|
||||
int DCT_scaled_size;
|
||||
/* The downsampled dimensions are the component's actual, unpadded number
|
||||
of samples at the main buffer (preprocessing/compression interface), thus
|
||||
downsampled_width = ceil(image_width * Hi/Hmax)
|
||||
and similarly for height. For decompression, IDCT scaling is included, so
|
||||
downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION downsampled_width; /* actual width in samples */
|
||||
CJPEG_WRBMP_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.
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
component_needed; /* do we need the value of this component? */
|
||||
|
||||
/* 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 last_col_width; /* # of non-dummy blocks across in last MCU */
|
||||
int last_row_height; /* # of non-dummy blocks down in last MCU */
|
||||
|
||||
/* Saved quantization table for component; NULL if none yet saved.
|
||||
See jdinput.c comments about the need for this information.
|
||||
This field is currently used only for decompression.
|
||||
*/
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_table;
|
||||
|
||||
/* Private per-component storage for DCT or IDCT subsystem. */
|
||||
void *dct_table;
|
||||
} cjpeg_wrbmp_jpeg_component_info;
|
||||
|
||||
|
||||
/* The script for encoding a multiple-scan file is an array of these: */
|
||||
|
||||
typedef struct {
|
||||
int comps_in_scan; /* number of components encoded in this scan */
|
||||
int component_index[ 4 ]; /* their SOF/comp_info[ ] indexes */
|
||||
int Ss, Se; /* progressive JPEG spectral selection parms */
|
||||
int Ah, Al; /* progressive JPEG successive approx. parms */
|
||||
} cjpeg_wrbmp_jpeg_scan_info;
|
||||
|
||||
/* The decompressor can save APPn and COM markers in a list of these: */
|
||||
|
||||
typedef struct cjpeg_wrbmp_jpeg_marker_struct CJPEG_WRBMP_FAR
|
||||
*jpeg_saved_marker_ptr;
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_marker_struct {
|
||||
jpeg_saved_marker_ptr next; /* next in list, or NULL */
|
||||
CJPEG_WRBMP_UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
|
||||
unsigned int original_length; /* # bytes of data in the file */
|
||||
unsigned int data_length; /* # bytes of data saved at data[ ] */
|
||||
CJPEG_WRBMP_JOCTET CJPEG_WRBMP_FAR
|
||||
*data; /* the data contained in the marker */
|
||||
/* the marker length word is not counted in data_length or original_length */
|
||||
};
|
||||
|
||||
/* Known color spaces. */
|
||||
|
||||
typedef enum {
|
||||
JCS_UNKNOWN, /* error/unspecified */
|
||||
JCS_GRAYSCALE, /* monochrome */
|
||||
JCS_RGB, /* red/green/blue */
|
||||
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
|
||||
JCS_CMYK, /* C/M/Y/K */
|
||||
JCS_YCCK /* Y/Cb/Cr/K */
|
||||
} CJPEG_WRBMP_J_COLOR_SPACE;
|
||||
|
||||
/* DCT/IDCT algorithm options. */
|
||||
|
||||
typedef enum {
|
||||
JDCT_ISLOW, /* slow but accurate integer algorithm */
|
||||
JDCT_IFAST, /* faster, less accurate integer method */
|
||||
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
|
||||
} CJPEG_WRBMP_J_DCT_METHOD;
|
||||
|
||||
/* Dithering options for decompression. */
|
||||
|
||||
typedef enum {
|
||||
JDITHER_NONE, /* no dithering */
|
||||
JDITHER_ORDERED, /* simple ordered dither */
|
||||
JDITHER_FS /* Floyd-Steinberg error diffusion dither */
|
||||
} CJPEG_WRBMP_J_DITHER_MODE;
|
||||
|
||||
|
||||
/* Common fields between JPEG compression and decompression master structs. */
|
||||
|
||||
#define cjpeg_wrbmp_jpeg_common_fields \
|
||||
struct cjpeg_wrbmp_jpeg_error_mgr * err; /* Error handler module */\
|
||||
struct cjpeg_wrbmp_jpeg_memory_mgr * mem; /* Memory manager module */\
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
|
||||
void * client_data; /* Available for use by application */\
|
||||
cjpeg_wrbmp_boolean is_decompressor; /* So common code can tell which is which */\
|
||||
int global_state /* For checking call sequence validity */
|
||||
|
||||
/* Routines that are to be used by both halves of the library are declared
|
||||
to receive a pointer to this structure. There are no actual instances of
|
||||
jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
|
||||
*/
|
||||
struct cjpeg_wrbmp_jpeg_common_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields common to both master struct types */
|
||||
/* Additional fields follow in an actual jpeg_compress_struct or
|
||||
jpeg_decompress_struct. All three structs must agree on these
|
||||
initial fields! (This would be a lot cleaner in C++.)
|
||||
*/
|
||||
};
|
||||
|
||||
typedef struct cjpeg_wrbmp_jpeg_common_struct
|
||||
*cjpeg_wrbmp_j_common_ptr;
|
||||
typedef struct cjpeg_wrbmp_jpeg_compress_struct
|
||||
*cjpeg_wrbmp_j_compress_ptr;
|
||||
typedef struct cjpeg_wrbmp_jpeg_decompress_struct
|
||||
*cjpeg_wrbmp_j_decompress_ptr;
|
||||
|
||||
|
||||
/* Master record for a compression instance */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_compress_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */
|
||||
|
||||
/* Destination for compressed data */
|
||||
struct cjpeg_wrbmp_jpeg_destination_mgr *dest;
|
||||
|
||||
/* Description of source image --- these fields must be filled in by
|
||||
outer application before starting compression. in_color_space must
|
||||
be correct before you can even call jpeg_set_defaults().
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION image_width; /* input image width */
|
||||
CJPEG_WRBMP_JDIMENSION image_height; /* input image height */
|
||||
int input_components; /* # of color components in input image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE in_color_space; /* colorspace of input image */
|
||||
|
||||
float input_gamma; /* image gamma of input image */
|
||||
|
||||
/* Compression parameters --- these fields must be set before calling
|
||||
jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
|
||||
initialize everything to reasonable defaults, then changing anything
|
||||
the application specifically wants to change. That way you won't get
|
||||
burnt when new parameters are added. Also note that there are several
|
||||
helper routines to simplify changing parameters.
|
||||
*/
|
||||
|
||||
int data_precision; /* bits of precision in image data */
|
||||
|
||||
int num_components; /* # of color components in JPEG image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE
|
||||
jpeg_color_space; /* colorspace of JPEG image */
|
||||
|
||||
cjpeg_wrbmp_jpeg_component_info *comp_info;
|
||||
/* comp_info[ i ] describes component that appears i'th in SOF */
|
||||
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[ 4 ];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[ 4 ];
|
||||
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[ 4 ];
|
||||
/* ptrs to Huffman coding tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_L[ 16 ]; /* L values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_U[ 16 ]; /* U values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_ac_K[ 16 ]; /* Kx values for AC arith-coding tables */
|
||||
|
||||
int num_scans; /* # of entries in scan_info array */
|
||||
const cjpeg_wrbmp_jpeg_scan_info
|
||||
*scan_info; /* script for multi-scan file, or NULL */
|
||||
/* The default value of scan_info is NULL, which causes a single-scan
|
||||
sequential JPEG file to be emitted. To create a multi-scan file,
|
||||
set num_scans and scan_info to point to an array of scan definitions.
|
||||
*/
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
raw_data_in; /* TRUE=caller supplies downsampled data */
|
||||
cjpeg_wrbmp_boolean
|
||||
arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
cjpeg_wrbmp_boolean
|
||||
optimize_coding; /* TRUE=optimize entropy encoding parms */
|
||||
cjpeg_wrbmp_boolean
|
||||
CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
|
||||
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* DCT algorithm selector */
|
||||
|
||||
/* The restart interval can be specified in absolute MCUs by setting
|
||||
restart_interval, or in MCU rows by setting restart_in_rows
|
||||
(in which case the correct restart_interval will be figured
|
||||
for each scan).
|
||||
*/
|
||||
unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
|
||||
int restart_in_rows; /* if > 0, MCU rows per restart interval */
|
||||
|
||||
/* Parameters controlling emission of special markers. */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
write_JFIF_header; /* should a JFIF marker be written? */
|
||||
CJPEG_WRBMP_UINT8
|
||||
JFIF_major_version; /* What to write for the JFIF version number */
|
||||
CJPEG_WRBMP_UINT8 JFIF_minor_version;
|
||||
/* These three values are not used by the JPEG code, merely copied */
|
||||
/* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
|
||||
/* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
|
||||
/* ratio is defined by X_density/Y_density even when density_unit=0. */
|
||||
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
|
||||
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
|
||||
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
|
||||
cjpeg_wrbmp_boolean
|
||||
write_Adobe_marker; /* should an Adobe marker be written? */
|
||||
|
||||
/* 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)".
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION next_scanline; /* 0 .. image_height-1 */
|
||||
|
||||
/* Remaining fields are known throughout compressor, but generally
|
||||
should not be touched by a surrounding application.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are computed during compression startup
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
progressive_mode; /* TRUE if scan script uses progressive mode */
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
||||
/* The coefficient controller receives data in units of MCU rows as defined
|
||||
for fully interleaved scans (whether the JPEG file is interleaved or not).
|
||||
There are v_samp_factor * DCTSIZE sample rows of each component in an
|
||||
"iMCU" (interleaved MCU) row.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are valid during any one scan.
|
||||
They describe the components and MCUs actually appearing in the scan.
|
||||
*/
|
||||
int comps_in_scan; /* # of JPEG components in this scan */
|
||||
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[ 4 ];
|
||||
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[ 10 ];
|
||||
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
cjpeg_wrbmp_jpeg_scan_info
|
||||
*script_space; /* workspace for jpeg_simple_progression */
|
||||
int script_space_size;
|
||||
};
|
||||
|
||||
|
||||
/* Master record for a decompression instance */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_decompress_struct {
|
||||
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
|
||||
|
||||
/* Source of compressed data */
|
||||
struct cjpeg_wrbmp_jpeg_source_mgr *src;
|
||||
|
||||
/* Basic description of image --- filled in by jpeg_read_header(). */
|
||||
/* Application may inspect these values to decide how to process image. */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
image_width; /* nominal image width (from SOF marker) */
|
||||
CJPEG_WRBMP_JDIMENSION image_height; /* nominal image height */
|
||||
int num_components; /* # of color components in JPEG image */
|
||||
CJPEG_WRBMP_J_COLOR_SPACE
|
||||
jpeg_color_space; /* colorspace of JPEG image */
|
||||
|
||||
/* Decompression processing parameters --- these fields must be set before
|
||||
calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
|
||||
them to default values.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_J_COLOR_SPACE out_color_space; /* colorspace for output */
|
||||
|
||||
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
|
||||
|
||||
float output_gamma; /* image gamma wanted in output */
|
||||
|
||||
cjpeg_wrbmp_boolean buffered_image; /* TRUE=multiple output passes */
|
||||
cjpeg_wrbmp_boolean raw_data_out; /* TRUE=downsampled data wanted */
|
||||
|
||||
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* IDCT algorithm selector */
|
||||
cjpeg_wrbmp_boolean
|
||||
do_fancy_upsampling; /* TRUE=apply fancy upsampling */
|
||||
cjpeg_wrbmp_boolean
|
||||
do_block_smoothing; /* TRUE=apply interblock smoothing */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
quantize_colors; /* TRUE=colormapped output wanted */
|
||||
/* the following are ignored if not quantize_colors: */
|
||||
CJPEG_WRBMP_J_DITHER_MODE
|
||||
dither_mode; /* type of color dithering to use */
|
||||
cjpeg_wrbmp_boolean
|
||||
two_pass_quantize; /* TRUE=use two-pass color quantization */
|
||||
int desired_number_of_colors; /* max # colors to use in created colormap */
|
||||
/* these are significant only in buffered-image mode: */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_1pass_quant; /* enable future use of 1-pass quantizer */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_EXTERNal_quant;/* enable future use of EXTERNal colormap */
|
||||
cjpeg_wrbmp_boolean
|
||||
enable_2pass_quant; /* enable future use of 2-pass quantizer */
|
||||
|
||||
/* Description of actual output image that will be returned to application.
|
||||
These fields are computed by jpeg_start_decompress().
|
||||
You can also use jpeg_calc_output_dimensions() to determine these values
|
||||
in advance of calling jpeg_start_decompress().
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION output_width; /* scaled image width */
|
||||
CJPEG_WRBMP_JDIMENSION output_height; /* scaled image height */
|
||||
int out_color_components; /* # of color components in out_color_space */
|
||||
int output_components; /* # of color components returned */
|
||||
/* output_components is 1 (a colormap index) when quantizing colors;
|
||||
otherwise it equals out_color_components.
|
||||
*/
|
||||
int rec_outbuf_height; /* min recommended height of scanline buffer */
|
||||
/* If the buffer passed to jpeg_read_scanlines() is less than this many rows
|
||||
high, space and time will be wasted due to unnecessary data copying.
|
||||
Usually rec_outbuf_height will be 1 or 2, at most 4.
|
||||
*/
|
||||
|
||||
/* When quantizing colors, the output colormap is described by these fields.
|
||||
The application can supply a colormap by setting colormap non-NULL before
|
||||
calling jpeg_start_decompress; otherwise a colormap is created during
|
||||
jpeg_start_decompress or jpeg_start_output.
|
||||
The map has out_color_components rows and actual_number_of_colors columns.
|
||||
*/
|
||||
int actual_number_of_colors; /* number of entries in use */
|
||||
CJPEG_WRBMP_JSAMPARRAY
|
||||
colormap; /* The color map as a 2-D pixel array */
|
||||
|
||||
/* State variables: these variables indicate the progress of decompression.
|
||||
The application may examine these but must not modify them.
|
||||
*/
|
||||
|
||||
/* Row index of next scanline to be read from jpeg_read_scanlines().
|
||||
Application may use this to control its processing loop, e.g.,
|
||||
"while (output_scanline < output_height)".
|
||||
*/
|
||||
CJPEG_WRBMP_JDIMENSION output_scanline; /* 0 .. output_height-1 */
|
||||
|
||||
/* Current input scan number and number of iMCU rows completed in scan.
|
||||
These indicate the progress of the decompressor input side.
|
||||
*/
|
||||
int input_scan_number; /* Number of SOS markers seen so far */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
input_iMCU_row; /* Number of iMCU rows completed */
|
||||
|
||||
/* The "output scan number" is the notional scan being displayed by the
|
||||
output side. The decompressor will not allow output scan/row number
|
||||
to get ahead of input scan/row, but it can fall arbitrarily far behind.
|
||||
*/
|
||||
int output_scan_number; /* Nominal scan number being displayed */
|
||||
CJPEG_WRBMP_JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
|
||||
|
||||
/* Current progression status. coef_bits[ c ][ i ] indicates the precision
|
||||
with which component c's DCT coefficient i (in zigzag order) is known.
|
||||
It is -1 when no data has yet been received, otherwise it is the point
|
||||
transform (shift) value for the most recent scan of the coefficient
|
||||
(thus, 0 at completion of the progression).
|
||||
This pointer is NULL when reading a non-progressive file.
|
||||
*/
|
||||
int ( *coef_bits )[ 64 ]; /* -1 or current Al value for each coef */
|
||||
|
||||
/* Internal JPEG parameters --- the application usually need not look at
|
||||
these fields. Note that the decompressor output side may not use
|
||||
any parameters that can change between scans.
|
||||
*/
|
||||
|
||||
/* Quantization and Huffman tables are carried forward across input
|
||||
datastreams when processing abbreviated JPEG datastreams.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[ 4 ];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
||||
|
||||
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[ 4 ];
|
||||
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[ 4 ];
|
||||
/* ptrs to Huffman coding tables, or NULL if not defined */
|
||||
|
||||
/* These parameters are never carried across datastreams, since they
|
||||
are given in SOF/SOS markers or defined to be reset by SOI.
|
||||
*/
|
||||
|
||||
int data_precision; /* bits of precision in image data */
|
||||
|
||||
cjpeg_wrbmp_jpeg_component_info *comp_info;
|
||||
/* comp_info[ i ] describes component that appears i'th in SOF */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
progressive_mode; /* TRUE if SOFn specifies progressive mode */
|
||||
cjpeg_wrbmp_boolean
|
||||
arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_L[ 16 ]; /* L values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_dc_U[ 16 ]; /* U values for DC arith-coding tables */
|
||||
CJPEG_WRBMP_UINT8
|
||||
arith_ac_K[ 16 ]; /* Kx values for AC arith-coding tables */
|
||||
|
||||
unsigned int
|
||||
restart_interval; /* MCUs per restart interval, or 0 for no restart */
|
||||
|
||||
/* These fields record data obtained from optional markers recognized by
|
||||
the JPEG library.
|
||||
*/
|
||||
cjpeg_wrbmp_boolean
|
||||
saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
|
||||
/* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
|
||||
CJPEG_WRBMP_UINT8 JFIF_major_version; /* JFIF version number */
|
||||
CJPEG_WRBMP_UINT8 JFIF_minor_version;
|
||||
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
|
||||
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
|
||||
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
|
||||
cjpeg_wrbmp_boolean
|
||||
saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
|
||||
CJPEG_WRBMP_UINT8
|
||||
Adobe_transform; /* Color transform code from Adobe marker */
|
||||
|
||||
cjpeg_wrbmp_boolean
|
||||
CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
|
||||
/* Aside from the specific data retained from APPn markers known to the
|
||||
library, the uninterpreted contents of any or all APPn and COM markers
|
||||
can be saved in a list for examination by the application.
|
||||
*/
|
||||
jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
|
||||
|
||||
/* Remaining fields are known throughout decompressor, but generally
|
||||
should not be touched by a surrounding application.
|
||||
*/
|
||||
|
||||
/*
|
||||
These fields are computed during decompression startup
|
||||
*/
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
|
||||
/* The coefficient controller's input and output progress is measured in
|
||||
units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
|
||||
in fully interleaved JPEG scans, but are used whether the scan is
|
||||
interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
||||
rows of each component. Therefore, the IDCT output contains
|
||||
v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
|
||||
*/
|
||||
|
||||
CJPEG_WRBMP_JSAMPLE
|
||||
*sample_range_limit; /* table for fast range-limiting */
|
||||
|
||||
/*
|
||||
These fields are valid during any one scan.
|
||||
They describe the components and MCUs actually appearing in the scan.
|
||||
Note that the decompressor output side must not use these fields.
|
||||
*/
|
||||
int comps_in_scan; /* # of JPEG components in this scan */
|
||||
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[ 4 ];
|
||||
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
|
||||
|
||||
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
CJPEG_WRBMP_JDIMENSION
|
||||
MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[ 10 ];
|
||||
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
int unread_marker;
|
||||
|
||||
/*
|
||||
Links to decompression subobjects (methods, private variables of modules)
|
||||
*/
|
||||
struct jpeg_decomp_master *master;
|
||||
struct jpeg_d_main_controller *main;
|
||||
struct jpeg_d_coef_controller *coef;
|
||||
struct jpeg_d_post_controller *post;
|
||||
struct jpeg_input_controller *inputctl;
|
||||
struct jpeg_marker_reader *marker;
|
||||
struct jpeg_entropy_decoder *entropy;
|
||||
struct jpeg_inverse_dct *idct;
|
||||
struct jpeg_upsampler *upsample;
|
||||
struct jpeg_color_deconverter *cconvert;
|
||||
struct jpeg_color_quantizer *cquantize;
|
||||
};
|
||||
|
||||
|
||||
/* "Object" declarations for JPEG modules that may be supplied or called
|
||||
directly by the surrounding application.
|
||||
As with all objects in the JPEG library, these structs only define the
|
||||
publicly visible methods and state variables of a module. Additional
|
||||
private fields may exist after the public ones.
|
||||
*/
|
||||
|
||||
|
||||
/* Error handler object */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_error_mgr {
|
||||
/* Error exit handler: does not return to caller */
|
||||
CJPEG_WRBMP_JMETHOD( void, error_exit,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo ) );
|
||||
/* Conditionally emit a trace or warning message */
|
||||
CJPEG_WRBMP_JMETHOD( void, emit_message,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo, int msg_level ) );
|
||||
/* Routine that actually outputs a trace or error message */
|
||||
CJPEG_WRBMP_JMETHOD( void, output_message,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo ) );
|
||||
/* Format a message string for the most recent JPEG error or message */
|
||||
CJPEG_WRBMP_JMETHOD( void, format_message,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo, char *buffer ) );
|
||||
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
||||
/* Reset error state variables at start of a new image */
|
||||
CJPEG_WRBMP_JMETHOD( void, reset_error_mgr,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo ) );
|
||||
|
||||
/* The message ID code and any parameters are saved here.
|
||||
A message can have one string parameter or up to 8 int parameters.
|
||||
*/
|
||||
int msg_code;
|
||||
#define JMSG_STR_PARM_MAX 80
|
||||
/*
|
||||
union {
|
||||
int i[ 8 ];
|
||||
char s[ JMSG_STR_PARM_MAX ];
|
||||
} msg_parm;
|
||||
*/
|
||||
/* Standard state variables for error facility */
|
||||
|
||||
int trace_level; /* max msg_level that will be displayed */
|
||||
|
||||
/* For recoverable corrupt-data errors, we emit a warning message,
|
||||
but keep going unless emit_message chooses to abort. emit_message
|
||||
should count warnings in num_warnings. The surrounding application
|
||||
can check for bad data by seeing if num_warnings is nonzero at the
|
||||
end of processing.
|
||||
*/
|
||||
long num_warnings; /* number of corrupt-data warnings */
|
||||
|
||||
/* These fields point to the table(s) of error message strings.
|
||||
An application can change the table pointer to switch to a different
|
||||
message list (typically, to change the language in which errors are
|
||||
reported). Some applications may wish to add additional error codes
|
||||
that will be handled by the JPEG library error mechanism; the second
|
||||
table pointer is used for this purpose.
|
||||
|
||||
First table includes all errors generated by JPEG library itself.
|
||||
Error code 0 is reserved for a "no such error string" message.
|
||||
*/
|
||||
const char *const *jpeg_message_table; /* Library errors */
|
||||
int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
|
||||
/* Second table can be added by application (see cjpeg/djpeg for example).
|
||||
It contains strings numbered first_addon_message..last_addon_message.
|
||||
*/
|
||||
const char *const *addon_message_table; /* Non-library errors */
|
||||
int first_addon_message; /* code for first string in addon table */
|
||||
int last_addon_message; /* code for last string in addon table */
|
||||
};
|
||||
|
||||
|
||||
/* Progress monitor object */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_progress_mgr {
|
||||
CJPEG_WRBMP_JMETHOD( void, progress_monitor,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo ) );
|
||||
|
||||
long pass_counter; /* work units completed in this pass */
|
||||
long pass_limit; /* total number of work units in this pass */
|
||||
int completed_passes; /* passes completed so far */
|
||||
int total_passes; /* total number of passes expected */
|
||||
};
|
||||
|
||||
|
||||
/* Data destination object for compression */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_destination_mgr {
|
||||
CJPEG_WRBMP_JOCTET
|
||||
*next_output_byte; /* => next byte to write in buffer */
|
||||
cjpeg_wrbmp_size_t
|
||||
free_in_buffer; /* # of byte spaces remaining in buffer */
|
||||
|
||||
CJPEG_WRBMP_JMETHOD( void, init_destination,
|
||||
( cjpeg_wrbmp_j_compress_ptr cinfo ) );
|
||||
CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean, empty_output_buffer,
|
||||
( cjpeg_wrbmp_j_compress_ptr cinfo ) );
|
||||
CJPEG_WRBMP_JMETHOD( void, term_destination,
|
||||
( cjpeg_wrbmp_j_compress_ptr cinfo ) );
|
||||
};
|
||||
|
||||
|
||||
/* Data source object for decompression */
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_source_mgr {
|
||||
const CJPEG_WRBMP_JOCTET
|
||||
*next_input_byte; /* => next byte to read from buffer */
|
||||
cjpeg_wrbmp_size_t bytes_in_buffer; /* # of bytes remaining in buffer */
|
||||
|
||||
CJPEG_WRBMP_JMETHOD( void, init_source,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo ) );
|
||||
CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean, fill_input_buffer,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo ) );
|
||||
CJPEG_WRBMP_JMETHOD( void, skip_input_data,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo, long num_bytes ) );
|
||||
CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean, resync_to_restart,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo, int desired ) );
|
||||
CJPEG_WRBMP_JMETHOD( void, term_source,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo ) );
|
||||
};
|
||||
|
||||
|
||||
/* Memory manager object.
|
||||
Allocates "small" objects (a few K total), "large" objects (tens of K),
|
||||
and "really big" objects (virtual arrays with backing store if needed).
|
||||
The memory manager does not allow individual objects to be freed; rather,
|
||||
each created object is assigned to a pool, and whole pools can be freed
|
||||
at once. This is faster and more convenient than remembering exactly what
|
||||
to free, especially where malloc()/free() are not too speedy.
|
||||
NB: alloc routines never return NULL. They exit to error_exit if not
|
||||
successful.
|
||||
*/
|
||||
|
||||
typedef struct jvirt_sarray_control *cjpeg_wrbmp_jvirt_sarray_ptr;
|
||||
typedef struct jvirt_barray_control *cjpeg_wrbmp_jvirt_barray_ptr;
|
||||
|
||||
|
||||
struct cjpeg_wrbmp_jpeg_memory_mgr {
|
||||
/* Method pointers */
|
||||
CJPEG_WRBMP_JMETHOD( void *, alloc_small,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_size_t sizeofobject ) );
|
||||
CJPEG_WRBMP_JMETHOD( void CJPEG_WRBMP_FAR *, alloc_large,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
cjpeg_wrbmp_size_t sizeofobject ) );
|
||||
CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JSAMPARRAY, alloc_sarray,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
CJPEG_WRBMP_JDIMENSION samplesperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows ) );
|
||||
CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JBLOCKARRAY, alloc_barray,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
|
||||
CJPEG_WRBMP_JDIMENSION blocksperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows ) );
|
||||
CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_jvirt_sarray_ptr,
|
||||
request_virt_sarray, ( cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
int pool_id,
|
||||
cjpeg_wrbmp_boolean pre_zero,
|
||||
CJPEG_WRBMP_JDIMENSION samplesperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows,
|
||||
CJPEG_WRBMP_JDIMENSION maxaccess ) );
|
||||
CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_jvirt_barray_ptr,
|
||||
request_virt_barray, ( cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
int pool_id,
|
||||
cjpeg_wrbmp_boolean pre_zero,
|
||||
CJPEG_WRBMP_JDIMENSION blocksperrow,
|
||||
CJPEG_WRBMP_JDIMENSION numrows,
|
||||
CJPEG_WRBMP_JDIMENSION maxaccess ) );
|
||||
CJPEG_WRBMP_JMETHOD( void, realize_virt_arrays,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo ) );
|
||||
CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JSAMPARRAY, access_virt_sarray,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
cjpeg_wrbmp_jvirt_sarray_ptr ptr,
|
||||
CJPEG_WRBMP_JDIMENSION start_row,
|
||||
CJPEG_WRBMP_JDIMENSION num_rows,
|
||||
cjpeg_wrbmp_boolean writable ) );
|
||||
CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JBLOCKARRAY, access_virt_barray,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo,
|
||||
cjpeg_wrbmp_jvirt_barray_ptr ptr,
|
||||
CJPEG_WRBMP_JDIMENSION start_row,
|
||||
CJPEG_WRBMP_JDIMENSION num_rows,
|
||||
cjpeg_wrbmp_boolean writable ) );
|
||||
CJPEG_WRBMP_JMETHOD( void, free_pool,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id ) );
|
||||
CJPEG_WRBMP_JMETHOD( void, self_destruct,
|
||||
( cjpeg_wrbmp_j_common_ptr cinfo ) );
|
||||
|
||||
/* Limit on memory allocation for this JPEG object. (Note that this is
|
||||
merely advisory, not a guaranteed maximum; it only affects the space
|
||||
used for virtual-array buffers.) May be changed by outer application
|
||||
after creating the JPEG object.
|
||||
*/
|
||||
long max_memory_to_use;
|
||||
|
||||
/* Maximum allocation request accepted by alloc_large. */
|
||||
long max_alloc_chunk;
|
||||
};
|
||||
|
||||
|
||||
/* Routine signature for application-supplied marker processing methods.
|
||||
Need not pass marker code since it is stored in cinfo->unread_marker.
|
||||
*/
|
||||
typedef CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean,
|
||||
jpeg_marker_parser_method,
|
||||
( cjpeg_wrbmp_j_decompress_ptr cinfo ) );
|
||||
|
||||
/*
|
||||
The JPEG library modules define JPEG_INTERNALS before including this file.
|
||||
The internal structure declarations are read only when that is true.
|
||||
Applications using the library should not include jpegint.h, but may wish
|
||||
to include jerror.h.
|
||||
*/
|
||||
|
||||
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
|
||||
#include "jpegint.h" /* fetch private declarations */
|
||||
#include "jerror.h" /* fetch error codes too */
|
||||
#endif
|
||||
|
||||
#endif /* JPEGLIB_H */
|
||||
Reference in New Issue
Block a user