diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
| commit | 386b7d3366f1359a265da207a9cafa3edf553b64 (patch) | |
| tree | c76120c2c138faed822e4ae386be6ef22a738a78 /all_pairs/source/cjpeg_wrbmp | |
| parent | 54a3f7091a2146b29c73a6fdc4b62a5c4ad7a3d8 (diff) | |
Reorganize and commit all the modified TACLeBench code and run scripts
Diffstat (limited to 'all_pairs/source/cjpeg_wrbmp')
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/ChangeLog.txt | 104 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/README | 383 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/cderror.h | 140 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/cdjpeg.h | 105 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c | 225 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/input.c | 79 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/jconfig.h | 65 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/jerror.h | 203 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/jmorecfg.h | 95 | ||||
| -rw-r--r-- | all_pairs/source/cjpeg_wrbmp/jpeglib.h | 869 |
10 files changed, 2268 insertions, 0 deletions
diff --git a/all_pairs/source/cjpeg_wrbmp/ChangeLog.txt b/all_pairs/source/cjpeg_wrbmp/ChangeLog.txt new file mode 100644 index 0000000..df21770 --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/ChangeLog.txt | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | File: cjpeg_jpeg6b_wrbmp.c | ||
| 2 | Original provenience: | ||
| 3 | |||
| 4 | 2017-04-18: | ||
| 5 | - Annotated cjpeg_wrbmp_main as entry-point for timing analysis | ||
| 6 | |||
| 7 | 2015-10-14: | ||
| 8 | - Remove comment on line 1 | ||
| 9 | - Added generic TACLeBench header to line 1 | ||
| 10 | - Changed struct name to cjpeg_jpeg6b_wrbmp_name | ||
| 11 | - Changed the global variable from {name} to cjpeg_jpeg6b_wrbmp_{name} | ||
| 12 | - Changed the functions from {name} to cjpeg_jpeg6b_wrbmp_{name} | ||
| 13 | - Removed code in comment | ||
| 14 | - Added cjpeg_jpeg6b_wrbmp_main() | ||
| 15 | - Added cjpeg_jpeg6b_wrbmp_return() | ||
| 16 | - Added cjpeg_jpeg6b_wrbmp_init() | ||
| 17 | - Added forward declaration of the functions | ||
| 18 | - Removed unused variables: test_image[] and color_map[] | ||
| 19 | - Applied Code Style | ||
| 20 | |||
| 21 | File: input.c | ||
| 22 | Original provenience: | ||
| 23 | |||
| 24 | 2015-10-12: | ||
| 25 | - Remove comment on line 1 | ||
| 26 | - Added generic TACLeBench header to line 1 | ||
| 27 | - Removed _jpeg6b_ from the prefix | ||
| 28 | - Changed the global variable from colormap to cjpeg_jpeg6b_wrbmp_colormap | ||
| 29 | - Removed unused variables: test_image[] and color_map[] | ||
| 30 | - Moved initialization of cjpeg_jpeg6b_wrbmp_colormap to function. This function is called from cjpeg_jpeg6b_wrbmp_init function | ||
| 31 | - Applied Code Style | ||
| 32 | |||
| 33 | File: cderror.h | ||
| 34 | Original provenience: | ||
| 35 | |||
| 36 | 2015-10-12: | ||
| 37 | - Remove comment on line 1 | ||
| 38 | - Added generic TACLeBench header to line 1 | ||
| 39 | - Removed _jpeg6b_ from the prefix | ||
| 40 | - Changed JMESSAGE to CJPEG_JPEG6B_WRBMP_JMESSAGE | ||
| 41 | - Changed JMAKE_ENUM_LIST to CJPEG_JPEG6B_WRBMP_JMAKE_ENUM_LIST | ||
| 42 | - Applied Code Style | ||
| 43 | |||
| 44 | |||
| 45 | File: cdjpeg.h | ||
| 46 | Original provenience: | ||
| 47 | |||
| 48 | 2015-10-12: | ||
| 49 | - Remove comment on line 1 | ||
| 50 | - Added generic TACLeBench header to line 1 | ||
| 51 | - Rename structs and typedef to cjpeg_jpeg6b_wrbmp_{name} | ||
| 52 | - Removed unused defines | ||
| 53 | |||
| 54 | File: jconfig.h | ||
| 55 | Original provenience: | ||
| 56 | |||
| 57 | 2015-10-12: | ||
| 58 | - Remove comment on line 1 | ||
| 59 | - Added generic TACLeBench header to line 1 | ||
| 60 | - Change defines to CJPEG_JPEG6B_WRBMP_{NAME} | ||
| 61 | - Removed _jpeg6b_ from the prefix | ||
| 62 | - Applied Code Style | ||
| 63 | |||
| 64 | |||
| 65 | File: jerror.h | ||
| 66 | Original provenience: | ||
| 67 | |||
| 68 | 2015-10-12: | ||
| 69 | - Remove comment on line 1 | ||
| 70 | - Added generic TACLeBench header to line 1 | ||
| 71 | - Removed error and warning defines | ||
| 72 | - Removed _jpeg6b_ from the prefix | ||
| 73 | - Applied Code Style | ||
| 74 | |||
| 75 | |||
| 76 | File: jmorecfg.h | ||
| 77 | Original provenience: | ||
| 78 | |||
| 79 | 2015-10-12: | ||
| 80 | - Remove comment on line 1 | ||
| 81 | - Added generic TACLeBench header to line 1 | ||
| 82 | - Removed unused comments | ||
| 83 | - Removed _jpeg6b_ from the prefix | ||
| 84 | - Removed unused defines | ||
| 85 | - Removed unused typedefs | ||
| 86 | - Applied Code Style | ||
| 87 | |||
| 88 | |||
| 89 | File: jpeglib.h | ||
| 90 | Original provenience: | ||
| 91 | |||
| 92 | 2015-10-12: | ||
| 93 | - Remove comment on line 1 | ||
| 94 | - Used define value directly | ||
| 95 | - Remove unused typedefs, defines | ||
| 96 | - Removed _jpeg6b_ from the prefix | ||
| 97 | - Changed struct name to cjpeg_jpeg6b_wrbmp_{name} | ||
| 98 | - Changed define {name} to cjpeg_jpeg6b_wrbmp_{name} | ||
| 99 | - Added generic TACLeBench header to line 1 | ||
| 100 | - Applied Code Style | ||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | |||
diff --git a/all_pairs/source/cjpeg_wrbmp/README b/all_pairs/source/cjpeg_wrbmp/README new file mode 100644 index 0000000..fa69a18 --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/README | |||
| @@ -0,0 +1,383 @@ | |||
| 1 | The Independent JPEG Group's JPEG software | ||
| 2 | ========================================== | ||
| 3 | |||
| 4 | README for release 6a of 7-Feb-96 | ||
| 5 | ================================= | ||
| 6 | |||
| 7 | This distribution contains the sixth public release of the Independent JPEG | ||
| 8 | Group's free JPEG software. You are welcome to redistribute this software and | ||
| 9 | to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. | ||
| 10 | |||
| 11 | Serious users of this software (particularly those incorporating it into | ||
| 12 | larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to | ||
| 13 | our electronic mailing list. Mailing list members are notified of updates | ||
| 14 | and have a chance to participate in technical discussions, etc. | ||
| 15 | |||
| 16 | This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz, Jim | ||
| 17 | Boucher, Lee Crocker, Julian Minguillon, George Phillips, Davide Rossi, | ||
| 18 | Ge' Weijers, and other members of the Independent JPEG Group. | ||
| 19 | |||
| 20 | IJG is not affiliated with the official ISO JPEG standards committee. | ||
| 21 | |||
| 22 | |||
| 23 | DOCUMENTATION ROADMAP | ||
| 24 | ===================== | ||
| 25 | |||
| 26 | This file contains the following sections: | ||
| 27 | |||
| 28 | OVERVIEW General description of JPEG and the IJG software. | ||
| 29 | LEGAL ISSUES Copyright, lack of warranty, terms of distribution. | ||
| 30 | REFERENCES Where to learn more about JPEG. | ||
| 31 | ARCHIVE LOCATIONS Where to find newer versions of this software. | ||
| 32 | RELATED SOFTWARE Other stuff you should get. | ||
| 33 | FILE FORMAT WARS Software *not* to get. | ||
| 34 | TO DO Plans for future IJG releases. | ||
| 35 | |||
| 36 | Other documentation files in the distribution are: | ||
| 37 | |||
| 38 | User documentation: | ||
| 39 | install.doc How to configure and install the IJG software. | ||
| 40 | usage.doc Usage instructions for cjpeg, djpeg, jpegtran, | ||
| 41 | rdjpgcom, and wrjpgcom. | ||
| 42 | *.1 Unix-style man pages for programs (same info as usage.doc). | ||
| 43 | wizard.doc Advanced usage instructions for JPEG wizards only. | ||
| 44 | change.log Version-to-version change highlights. | ||
| 45 | Programmer and internal documentation: | ||
| 46 | libjpeg.doc How to use the JPEG library in your own programs. | ||
| 47 | example.c Sample code for calling the JPEG library. | ||
| 48 | structure.doc Overview of the JPEG library's internal structure. | ||
| 49 | filelist.doc Road map of IJG files. | ||
| 50 | coderules.doc Coding style rules --- please read if you contribute code. | ||
| 51 | |||
| 52 | Please read at least the files install.doc and usage.doc. Useful information | ||
| 53 | can also be found in the JPEG FAQ (Frequently Asked Questions) article. See | ||
| 54 | ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. | ||
| 55 | |||
| 56 | If you want to understand how the JPEG code works, we suggest reading one or | ||
| 57 | more of the REFERENCES, then looking at the documentation files (in roughly | ||
| 58 | the order listed) before diving into the code. | ||
| 59 | |||
| 60 | |||
| 61 | OVERVIEW | ||
| 62 | ======== | ||
| 63 | |||
| 64 | This package contains C software to implement JPEG image compression and | ||
| 65 | decompression. JPEG (pronounced "jay-peg") is a standardized compression | ||
| 66 | method for full-color and gray-scale images. JPEG is intended for compressing | ||
| 67 | "real-world" scenes; line drawings, cartoons and other non-realistic images | ||
| 68 | are not its strong suit. JPEG is lossy, meaning that the output image is not | ||
| 69 | exactly identical to the input image. Hence you must not use JPEG if you | ||
| 70 | have to have identical output bits. However, on typical photographic images, | ||
| 71 | very good compression levels can be obtained with no visible change, and | ||
| 72 | remarkably high compression levels are possible if you can tolerate a | ||
| 73 | low-quality image. For more details, see the references, or just experiment | ||
| 74 | with various compression settings. | ||
| 75 | |||
| 76 | This software implements JPEG baseline, extended-sequential, and progressive | ||
| 77 | compression processes. Provision is made for supporting all variants of these | ||
| 78 | processes, although some uncommon parameter settings aren't implemented yet. | ||
| 79 | For legal reasons, we are not distributing code for the arithmetic-coding | ||
| 80 | variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting | ||
| 81 | the hierarchical or lossless processes defined in the standard. | ||
| 82 | |||
| 83 | We provide a set of library routines for reading and writing JPEG image files, | ||
| 84 | plus two sample applications "cjpeg" and "djpeg", which use the library to | ||
| 85 | perform conversion between JPEG and some other popular image file formats. | ||
| 86 | The library is intended to be reused in other applications. | ||
| 87 | |||
| 88 | In order to support file conversion and viewing software, we have included | ||
| 89 | considerable functionality beyond the bare JPEG coding/decoding capability; | ||
| 90 | for example, the color quantization modules are not strictly part of JPEG | ||
| 91 | decoding, but they are essential for output to colormapped file formats or | ||
| 92 | colormapped displays. These extra functions can be compiled out of the | ||
| 93 | library if not required for a particular application. We have also included | ||
| 94 | "jpegtran", a utility for lossless transcoding between different JPEG | ||
| 95 | processes, and "rdjpgcom" and "wrjpgcom", two simple applications for | ||
| 96 | inserting and extracting textual comments in JFIF files. | ||
| 97 | |||
| 98 | The emphasis in designing this software has been on achieving portability and | ||
| 99 | flexibility, while also making it fast enough to be useful. In particular, | ||
| 100 | the software is not intended to be read as a tutorial on JPEG. (See the | ||
| 101 | REFERENCES section for introductory material.) Rather, it is intended to | ||
| 102 | be reliable, portable, industrial-strength code. We do not claim to have | ||
| 103 | achieved that goal in every aspect of the software, but we strive for it. | ||
| 104 | |||
| 105 | We welcome the use of this software as a component of commercial products. | ||
| 106 | No royalty is required, but we do ask for an acknowledgement in product | ||
| 107 | documentation, as described under LEGAL ISSUES. | ||
| 108 | |||
| 109 | |||
| 110 | LEGAL ISSUES | ||
| 111 | ============ | ||
| 112 | |||
| 113 | In plain English: | ||
| 114 | |||
| 115 | 1. We don't promise that this software works. (But if you find any bugs, | ||
| 116 | please let us know!) | ||
| 117 | 2. You can use this software for whatever you want. You don't have to pay us. | ||
| 118 | 3. You may not pretend that you wrote this software. If you use it in a | ||
| 119 | program, you must acknowledge somewhere in your documentation that | ||
| 120 | you've used the IJG code. | ||
| 121 | |||
| 122 | In legalese: | ||
| 123 | |||
| 124 | The authors make NO WARRANTY or representation, either express or implied, | ||
| 125 | with respect to this software, its quality, accuracy, merchantability, or | ||
| 126 | fitness for a particular purpose. This software is provided "AS IS", and you, | ||
| 127 | its user, assume the entire risk as to its quality and accuracy. | ||
| 128 | |||
| 129 | This software is copyright (C) 1991-1996, Thomas G. Lane. | ||
| 130 | All Rights Reserved except as specified below. | ||
| 131 | |||
| 132 | Permission is hereby granted to use, copy, modify, and distribute this | ||
| 133 | software (or portions thereof) for any purpose, without fee, subject to these | ||
| 134 | conditions: | ||
| 135 | (1) If any part of the source code for this software is distributed, then this | ||
| 136 | README file must be included, with this copyright and no-warranty notice | ||
| 137 | unaltered; and any additions, deletions, or changes to the original files | ||
| 138 | must be clearly indicated in accompanying documentation. | ||
| 139 | (2) If only executable code is distributed, then the accompanying | ||
| 140 | documentation must state that "this software is based in part on the work of | ||
| 141 | the Independent JPEG Group". | ||
| 142 | (3) Permission for use of this software is granted only if the user accepts | ||
| 143 | full responsibility for any undesirable consequences; the authors accept | ||
| 144 | NO LIABILITY for damages of any kind. | ||
| 145 | |||
| 146 | These conditions apply to any software derived from or based on the IJG code, | ||
| 147 | not just to the unmodified library. If you use our work, you ought to | ||
| 148 | acknowledge us. | ||
| 149 | |||
| 150 | Permission is NOT granted for the use of any IJG author's name or company name | ||
| 151 | in advertising or publicity relating to this software or products derived from | ||
| 152 | it. This software may be referred to only as "the Independent JPEG Group's | ||
| 153 | software". | ||
| 154 | |||
| 155 | We specifically permit and encourage the use of this software as the basis of | ||
| 156 | commercial products, provided that all warranty or liability claims are | ||
| 157 | assumed by the product vendor. | ||
| 158 | |||
| 159 | |||
| 160 | ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, | ||
| 161 | sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. | ||
| 162 | ansi2knr.c is NOT covered by the above copyright and conditions, but instead | ||
| 163 | by the usual distribution terms of the Free Software Foundation; principally, | ||
| 164 | that you must include source code if you redistribute it. (See the file | ||
| 165 | ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part | ||
| 166 | of any program generated from the IJG code, this does not limit you more than | ||
| 167 | the foregoing paragraphs do. | ||
| 168 | |||
| 169 | The configuration script "configure" was produced with GNU Autoconf. It | ||
| 170 | is copyright by the Free Software Foundation but is freely distributable. | ||
| 171 | |||
| 172 | It appears that the arithmetic coding option of the JPEG spec is covered by | ||
| 173 | patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot | ||
| 174 | legally be used without obtaining one or more licenses. For this reason, | ||
| 175 | support for arithmetic coding has been removed from the free JPEG software. | ||
| 176 | (Since arithmetic coding provides only a marginal gain over the unpatented | ||
| 177 | Huffman mode, it is unlikely that very many implementations will support it.) | ||
| 178 | So far as we are aware, there are no patent restrictions on the remaining | ||
| 179 | code. | ||
| 180 | |||
| 181 | WARNING: Unisys has begun to enforce their patent on LZW compression against | ||
| 182 | GIF encoders and decoders. You will need a license from Unisys to use the | ||
| 183 | included rdgif.c or wrgif.c files in a commercial or shareware application. | ||
| 184 | At this time, Unisys is not enforcing their patent against freeware, so | ||
| 185 | distribution of this package remains legal. However, we intend to remove | ||
| 186 | GIF support from the IJG package as soon as a suitable replacement format | ||
| 187 | becomes reasonably popular. | ||
| 188 | |||
| 189 | We are required to state that | ||
| 190 | "The Graphics Interchange Format(c) is the Copyright property of | ||
| 191 | CompuServe Incorporated. GIF(sm) is a Service Mark property of | ||
| 192 | CompuServe Incorporated." | ||
| 193 | |||
| 194 | |||
| 195 | REFERENCES | ||
| 196 | ========== | ||
| 197 | |||
| 198 | We highly recommend reading one or more of these references before trying to | ||
| 199 | understand the innards of the JPEG software. | ||
| 200 | |||
| 201 | The best short technical introduction to the JPEG compression algorithm is | ||
| 202 | Wallace, Gregory K. "The JPEG Still Picture Compression Standard", | ||
| 203 | Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. | ||
| 204 | (Adjacent articles in that issue discuss MPEG motion picture compression, | ||
| 205 | applications of JPEG, and related topics.) If you don't have the CACM issue | ||
| 206 | handy, a PostScript file containing a revised version of Wallace's article | ||
| 207 | is available at ftp.uu.net, graphics/jpeg/wallace.ps.gz. The file (actually | ||
| 208 | a preprint for an article that appeared in IEEE Trans. Consumer Electronics) | ||
| 209 | omits the sample images that appeared in CACM, but it includes corrections | ||
| 210 | and some added material. Note: the Wallace article is copyright ACM and | ||
| 211 | IEEE, and it may not be used for commercial purposes. | ||
| 212 | |||
| 213 | A somewhat less technical, more leisurely introduction to JPEG can be found in | ||
| 214 | "The Data Compression Book" by Mark Nelson, published by M&T Books (Redwood | ||
| 215 | City, CA), 1991, ISBN 1-55851-216-0. This book provides good explanations and | ||
| 216 | example C code for a multitude of compression methods including JPEG. It is | ||
| 217 | an excellent source if you are comfortable reading C code but don't know much | ||
| 218 | about data compression in general. The book's JPEG sample code is far from | ||
| 219 | industrial-strength, but when you are ready to look at a full implementation, | ||
| 220 | you've got one here... | ||
| 221 | |||
| 222 | The best full description of JPEG is the textbook "JPEG Still Image Data | ||
| 223 | Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published | ||
| 224 | by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp. | ||
| 225 | The book includes the complete text of the ISO JPEG standards (DIS 10918-1 | ||
| 226 | and draft DIS 10918-2). This is by far the most complete exposition of JPEG | ||
| 227 | in existence, and we highly recommend it. | ||
| 228 | |||
| 229 | The JPEG standard itself is not available electronically; you must order a | ||
| 230 | paper copy through ISO or ITU. (Unless you feel a need to own a certified | ||
| 231 | official copy, we recommend buying the Pennebaker and Mitchell book instead; | ||
| 232 | it's much cheaper and includes a great deal of useful explanatory material.) | ||
| 233 | In the USA, copies of the standard may be ordered from ANSI Sales at (212) | ||
| 234 | 642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI | ||
| 235 | doesn't take credit card orders, but Global does.) It's not cheap: as of | ||
| 236 | 1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7% | ||
| 237 | shipping/handling. The standard is divided into two parts, Part 1 being the | ||
| 238 | actual specification, while Part 2 covers compliance testing methods. Part 1 | ||
| 239 | is titled "Digital Compression and Coding of Continuous-tone Still Images, | ||
| 240 | Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS | ||
| 241 | 10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of | ||
| 242 | Continuous-tone Still Images, Part 2: Compliance testing" and has document | ||
| 243 | numbers ISO/IEC IS 10918-2, ITU-T T.83. | ||
| 244 | |||
| 245 | Extensions to the original JPEG standard are defined in JPEG Part 3, a new ISO | ||
| 246 | document. Part 3 is undergoing ISO balloting and is expected to be approved | ||
| 247 | by the end of 1995; it will have document numbers ISO/IEC IS 10918-3, ITU-T | ||
| 248 | T.84. IJG currently does not support any Part 3 extensions. | ||
| 249 | |||
| 250 | The JPEG standard does not specify all details of an interchangeable file | ||
| 251 | format. For the omitted details we follow the "JFIF" conventions, revision | ||
| 252 | 1.02. A copy of the JFIF spec is available from: | ||
| 253 | Literature Department | ||
| 254 | C-Cube Microsystems, Inc. | ||
| 255 | 1778 McCarthy Blvd. | ||
| 256 | Milpitas, CA 95035 | ||
| 257 | phone (408) 944-6300, fax (408) 944-6314 | ||
| 258 | A PostScript version of this document is available at ftp.uu.net, file | ||
| 259 | graphics/jpeg/jfif.ps.gz. It can also be obtained by e-mail from the C-Cube | ||
| 260 | mail server, netlib@c3.pla.ca.us. Send the message "send jfif_ps from jpeg" | ||
| 261 | to the server to obtain the JFIF document; send the message "help" if you have | ||
| 262 | trouble. | ||
| 263 | |||
| 264 | The TIFF 6.0 file format specification can be obtained by FTP from sgi.com | ||
| 265 | (192.48.153.1), file graphics/tiff/TIFF6.ps.Z; or you can order a printed | ||
| 266 | copy from Aldus Corp. at (206) 628-6593. The JPEG incorporation scheme | ||
| 267 | found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems. | ||
| 268 | IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). | ||
| 269 | Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 | ||
| 270 | (Compression tag 7). Copies of this Note can be obtained from sgi.com or | ||
| 271 | from ftp.uu.net:/graphics/jpeg/. It is expected that the next revision of | ||
| 272 | the TIFF spec will replace the 6.0 JPEG design with the Note's design. | ||
| 273 | Although IJG's own code does not support TIFF/JPEG, the free libtiff library | ||
| 274 | uses our library to implement TIFF/JPEG per the Note. libtiff is available | ||
| 275 | from sgi.com:/graphics/tiff/. | ||
| 276 | |||
| 277 | |||
| 278 | ARCHIVE LOCATIONS | ||
| 279 | ================= | ||
| 280 | |||
| 281 | The "official" archive site for this software is ftp.uu.net (Internet | ||
| 282 | address 192.48.96.9). The most recent released version can always be found | ||
| 283 | there in directory graphics/jpeg. This particular version will be archived | ||
| 284 | as graphics/jpeg/jpegsrc.v6a.tar.gz. If you are on the Internet, you | ||
| 285 | can retrieve files from ftp.uu.net by standard anonymous FTP. If you don't | ||
| 286 | have FTP access, UUNET's archives are also available via UUCP; contact | ||
| 287 | help@uunet.uu.net for information on retrieving files that way. | ||
| 288 | |||
| 289 | Numerous Internet sites maintain copies of the UUNET files. However, only | ||
| 290 | ftp.uu.net is guaranteed to have the latest official version. | ||
| 291 | |||
| 292 | You can also obtain this software in DOS-compatible "zip" archive format from | ||
| 293 | the SimTel archives (ftp.coast.net:/SimTel/msdos/graphics/), or on CompuServe | ||
| 294 | in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 "JPEG Tools". | ||
| 295 | Again, these versions may sometimes lag behind the ftp.uu.net release. | ||
| 296 | |||
| 297 | The JPEG FAQ (Frequently Asked Questions) article is a useful source of | ||
| 298 | general information about JPEG. It is updated constantly and therefore is | ||
| 299 | not included in this distribution. The FAQ is posted every two weeks to | ||
| 300 | Usenet newsgroups comp.graphics.misc, news.answers, and other groups. | ||
| 301 | You can always obtain the latest version from the news.answers archive at | ||
| 302 | rtfm.mit.edu. By FTP, fetch /pub/usenet/news.answers/jpeg-faq/part1 and | ||
| 303 | .../part2. If you don't have FTP, send e-mail to mail-server@rtfm.mit.edu | ||
| 304 | with body | ||
| 305 | send usenet/news.answers/jpeg-faq/part1 | ||
| 306 | send usenet/news.answers/jpeg-faq/part2 | ||
| 307 | |||
| 308 | |||
| 309 | RELATED SOFTWARE | ||
| 310 | ================ | ||
| 311 | |||
| 312 | Numerous viewing and image manipulation programs now support JPEG. (Quite a | ||
| 313 | few of them use this library to do so.) The JPEG FAQ described above lists | ||
| 314 | some of the more popular free and shareware viewers, and tells where to | ||
| 315 | obtain them on Internet. | ||
| 316 | |||
| 317 | If you are on a Unix machine, we highly recommend Jef Poskanzer's free | ||
| 318 | PBMPLUS image software, which provides many useful operations on PPM-format | ||
| 319 | image files. In particular, it can convert PPM images to and from a wide | ||
| 320 | range of other formats. You can obtain this package by FTP from ftp.x.org | ||
| 321 | (contrib/pbmplus*.tar.Z) or ftp.ee.lbl.gov (pbmplus*.tar.Z). There is also | ||
| 322 | a newer update of this package called NETPBM, available from | ||
| 323 | wuarchive.wustl.edu under directory /graphics/graphics/packages/NetPBM/. | ||
| 324 | Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software | ||
| 325 | is; you are likely to have difficulty making it work on any non-Unix machine. | ||
| 326 | |||
| 327 | A different free JPEG implementation, written by the PVRG group at Stanford, | ||
| 328 | is available from havefun.stanford.edu in directory pub/jpeg. This program | ||
| 329 | is designed for research and experimentation rather than production use; | ||
| 330 | it is slower, harder to use, and less portable than the IJG code, but it | ||
| 331 | is easier to read and modify. Also, the PVRG code supports lossless JPEG, | ||
| 332 | which we do not. | ||
| 333 | |||
| 334 | |||
| 335 | FILE FORMAT WARS | ||
| 336 | ================ | ||
| 337 | |||
| 338 | Some JPEG programs produce files that are not compatible with our library. | ||
| 339 | The root of the problem is that the ISO JPEG committee failed to specify a | ||
| 340 | concrete file format. Some vendors "filled in the blanks" on their own, | ||
| 341 | creating proprietary formats that no one else could read. (For example, none | ||
| 342 | of the early commercial JPEG implementations for the Macintosh were able to | ||
| 343 | exchange compressed files.) | ||
| 344 | |||
| 345 | The file format we have adopted is called JFIF (see REFERENCES). This format | ||
| 346 | has been agreed to by a number of major commercial JPEG vendors, and it has | ||
| 347 | become the de facto standard. JFIF is a minimal or "low end" representation. | ||
| 348 | We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF | ||
| 349 | Technical Note #2) for "high end" applications that need to record a lot of | ||
| 350 | additional data about an image. TIFF/JPEG is fairly new and not yet widely | ||
| 351 | supported, unfortunately. | ||
| 352 | |||
| 353 | The upcoming JPEG Part 3 standard defines a file format called SPIFF. | ||
| 354 | SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should | ||
| 355 | be able to read the most common variant of SPIFF. SPIFF has some technical | ||
| 356 | advantages over JFIF, but its major claim to fame is simply that it is an | ||
| 357 | official standard rather than an informal one. At this point it is unclear | ||
| 358 | whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto | ||
| 359 | standard. IJG intends to support SPIFF once the standard is frozen, but we | ||
| 360 | have not decided whether it should become our default output format or not. | ||
| 361 | (In any case, our decoder will remain capable of reading JFIF indefinitely.) | ||
| 362 | |||
| 363 | Various proprietary file formats incorporating JPEG compression also exist. | ||
| 364 | We have little or no sympathy for the existence of these formats. Indeed, | ||
| 365 | one of the original reasons for developing this free software was to help | ||
| 366 | force convergence on common, open format standards for JPEG files. Don't | ||
| 367 | use a proprietary file format! | ||
| 368 | |||
| 369 | |||
| 370 | TO DO | ||
| 371 | ===== | ||
| 372 | |||
| 373 | In future versions, we are considering supporting some of the upcoming JPEG | ||
| 374 | Part 3 extensions --- principally, variable quantization and the SPIFF file | ||
| 375 | format. | ||
| 376 | |||
| 377 | Tuning the software for better behavior at low quality/high compression | ||
| 378 | settings is also of interest. The current method for scaling the | ||
| 379 | quantization tables is known not to be very good at low Q values. | ||
| 380 | |||
| 381 | As always, speeding things up is high on our priority list. | ||
| 382 | |||
| 383 | Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net. | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/cderror.h b/all_pairs/source/cjpeg_wrbmp/cderror.h new file mode 100644 index 0000000..e479834 --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/cderror.h | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | |||
| 2 | /* | ||
| 3 | |||
| 4 | This program is part of the TACLeBench benchmark suite. | ||
| 5 | Version V 1.x | ||
| 6 | |||
| 7 | Name: cderror.h | ||
| 8 | |||
| 9 | Author: Thomas G. Lane. | ||
| 10 | |||
| 11 | This file is part of the Independent JPEG Group's software. | ||
| 12 | For conditions of distribution and use, see the accompanying README file. | ||
| 13 | |||
| 14 | This file defines the error and message codes for the cjpeg/djpeg | ||
| 15 | applications. These strings are not needed as part of the JPEG library | ||
| 16 | proper. | ||
| 17 | Edit this file to add new codes, or to translate the message strings to | ||
| 18 | some other language. | ||
| 19 | |||
| 20 | Source: Independent JPEG Group's software | ||
| 21 | |||
| 22 | Changes: no major functional changes | ||
| 23 | |||
| 24 | License: See the accompanying README file | ||
| 25 | |||
| 26 | */ | ||
| 27 | |||
| 28 | #ifndef CJPEG_WRBMP_JMESSAGE | ||
| 29 | #ifndef CDERROR_H | ||
| 30 | #define CDERROR_H | ||
| 31 | /*First time through, define the enum list*/ | ||
| 32 | #define CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 33 | #else | ||
| 34 | /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined*/ | ||
| 35 | #define CJPEG_WRBMP_JMESSAGE(code,string) | ||
| 36 | #endif | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 40 | |||
| 41 | typedef enum { | ||
| 42 | |||
| 43 | #define CJPEG_WRBMP_JMESSAGE(code,string) code , | ||
| 44 | |||
| 45 | #endif | ||
| 46 | |||
| 47 | CJPEG_WRBMP_JMESSAGE( JMSG_FIRSTADDONCODE = 1000, NULL ) //Must be first entry! | ||
| 48 | |||
| 49 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED | ||
| 50 | CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADCMAP, "Unsupported BMP colormap format" ) | ||
| 51 | CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported" ) | ||
| 52 | CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADHEADER, "Invalid BMP file: bad header length" ) | ||
| 53 | CJPEG_WRBMP_JMESSAGE( JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1" ) | ||
| 54 | CJPEG_WRBMP_JMESSAGE( JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB" ) | ||
| 55 | CJPEG_WRBMP_JMESSAGE( JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported" ) | ||
| 56 | CJPEG_WRBMP_JMESSAGE( JERR_BMP_NOT, "Not a BMP file - does not start with BM" ) | ||
| 57 | CJPEG_WRBMP_JMESSAGE( JTRC_BMP, "%ux%u 24-bit BMP image" ) | ||
| 58 | CJPEG_WRBMP_JMESSAGE( JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image" ) | ||
| 59 | CJPEG_WRBMP_JMESSAGE( JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image" ) | ||
| 60 | CJPEG_WRBMP_JMESSAGE( JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image" ) | ||
| 61 | #endif | ||
| 62 | |||
| 63 | #ifdef CJPEG_WRBMP_GIF_SUPPORTED | ||
| 64 | CJPEG_WRBMP_JMESSAGE( JERR_GIF_BUG, "GIF output got confused" ) | ||
| 65 | CJPEG_WRBMP_JMESSAGE( JERR_GIF_CODESIZE, "Bogus GIF codesize %d" ) | ||
| 66 | CJPEG_WRBMP_JMESSAGE( JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB" ) | ||
| 67 | CJPEG_WRBMP_JMESSAGE( JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file" ) | ||
| 68 | CJPEG_WRBMP_JMESSAGE( JERR_GIF_NOT, "Not a GIF file" ) | ||
| 69 | CJPEG_WRBMP_JMESSAGE( JTRC_GIF, "%ux%ux%d GIF image" ) | ||
| 70 | CJPEG_WRBMP_JMESSAGE( JTRC_GIF_BADVERSION, | ||
| 71 | "Warning: unexpected GIF version number '%c%c%c'" ) | ||
| 72 | CJPEG_WRBMP_JMESSAGE( JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x" ) | ||
| 73 | CJPEG_WRBMP_JMESSAGE( JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input" ) | ||
| 74 | CJPEG_WRBMP_JMESSAGE( JWRN_GIF_BADDATA, "Corrupt data in GIF file" ) | ||
| 75 | CJPEG_WRBMP_JMESSAGE( JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring" ) | ||
| 76 | CJPEG_WRBMP_JMESSAGE( JWRN_GIF_ENDCODE, "Premature end of GIF image" ) | ||
| 77 | CJPEG_WRBMP_JMESSAGE( JWRN_GIF_NOMOREDATA, "Ran out of GIF bits" ) | ||
| 78 | #endif | ||
| 79 | |||
| 80 | #ifdef CJPEG_WRBMP_PPM_SUPPORTED | ||
| 81 | CJPEG_WRBMP_JMESSAGE( JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB" ) | ||
| 82 | CJPEG_WRBMP_JMESSAGE( JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file" ) | ||
| 83 | CJPEG_WRBMP_JMESSAGE( JERR_PPM_NOT, "Not a PPM/PGM file" ) | ||
| 84 | CJPEG_WRBMP_JMESSAGE( JTRC_PGM, "%ux%u PGM image" ) | ||
| 85 | CJPEG_WRBMP_JMESSAGE( JTRC_PGM_TEXT, "%ux%u text PGM image" ) | ||
| 86 | CJPEG_WRBMP_JMESSAGE( JTRC_PPM, "%ux%u PPM image" ) | ||
| 87 | CJPEG_WRBMP_JMESSAGE( JTRC_PPM_TEXT, "%ux%u text PPM image" ) | ||
| 88 | #endif | ||
| 89 | |||
| 90 | #ifdef RLE_SUPPORTED | ||
| 91 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_BADERROR, "Bogus error code from RLE library" ) | ||
| 92 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB" ) | ||
| 93 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE" ) | ||
| 94 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_EMPTY, "Empty RLE file" ) | ||
| 95 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_EOF, "Premature EOF in RLE header" ) | ||
| 96 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_MEM, "Insufficient memory for RLE header" ) | ||
| 97 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_NOT, "Not an RLE file" ) | ||
| 98 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE" ) | ||
| 99 | CJPEG_WRBMP_JMESSAGE( JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup" ) | ||
| 100 | CJPEG_WRBMP_JMESSAGE( JTRC_RLE, "%ux%u full-color RLE file" ) | ||
| 101 | CJPEG_WRBMP_JMESSAGE( JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d" ) | ||
| 102 | CJPEG_WRBMP_JMESSAGE( JTRC_RLE_GRAY, "%ux%u grayscale RLE file" ) | ||
| 103 | CJPEG_WRBMP_JMESSAGE( JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d" ) | ||
| 104 | CJPEG_WRBMP_JMESSAGE( JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d" ) | ||
| 105 | #endif | ||
| 106 | |||
| 107 | #ifdef CJPEG_WRBMP_TARGA_SUPPORTED | ||
| 108 | CJPEG_WRBMP_JMESSAGE( JERR_TGA_BADCMAP, "Unsupported Targa colormap format" ) | ||
| 109 | CJPEG_WRBMP_JMESSAGE( JERR_TGA_BADPARMS, "Invalid or unsupported Targa file" ) | ||
| 110 | CJPEG_WRBMP_JMESSAGE( JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB" ) | ||
| 111 | CJPEG_WRBMP_JMESSAGE( JTRC_TGA, "%ux%u RGB Targa image" ) | ||
| 112 | CJPEG_WRBMP_JMESSAGE( JTRC_TGA_GRAY, "%ux%u grayscale Targa image" ) | ||
| 113 | CJPEG_WRBMP_JMESSAGE( JTRC_TGA_MAPPED, "%ux%u colormapped Targa image" ) | ||
| 114 | #else | ||
| 115 | CJPEG_WRBMP_JMESSAGE( JERR_TGA_NOTCOMP, "Targa support was not compiled" ) | ||
| 116 | #endif | ||
| 117 | |||
| 118 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_CMAP_FILE, | ||
| 119 | "Color map file is invalid or of unsupported format" ) | ||
| 120 | CJPEG_WRBMP_JMESSAGE( JERR_TOO_MANY_COLORS, | ||
| 121 | "Output file format cannot handle %d colormap entries" ) | ||
| 122 | CJPEG_WRBMP_JMESSAGE( JERR_UNGETC_FAILED, "ungetc failed" ) | ||
| 123 | #ifdef CJPEG_WRBMP_TARGA_SUPPORTED | ||
| 124 | CJPEG_WRBMP_JMESSAGE( JERR_UNKNOWN_FORMAT, | ||
| 125 | "Unrecognized input file format --- perhaps you need -targa" ) | ||
| 126 | #else | ||
| 127 | CJPEG_WRBMP_JMESSAGE( JERR_UNKNOWN_FORMAT, "Unrecognized input file format" ) | ||
| 128 | #endif | ||
| 129 | CJPEG_WRBMP_JMESSAGE( JERR_UNSUPPORTED_FORMAT, "Unsupported output file format" ) | ||
| 130 | |||
| 131 | #ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 132 | |||
| 133 | JMSG_LASTADDONCODE | ||
| 134 | } CJPEG_WRBMP_ADDON_MESSAGE_CODE; | ||
| 135 | |||
| 136 | #undef CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 137 | #endif | ||
| 138 | |||
| 139 | /* Zap JMESSAGE macro so that future re-inclusions do nothing by default*/ | ||
| 140 | #undef CJPEG_WRBMP_JMESSAGE | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/cdjpeg.h b/all_pairs/source/cjpeg_wrbmp/cdjpeg.h new file mode 100644 index 0000000..6c3fc7b --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/cdjpeg.h | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: cdjpeg.h | ||
| 7 | |||
| 8 | Author: Thomas G. Lane. | ||
| 9 | |||
| 10 | This file is part of the Independent JPEG Group's software. | ||
| 11 | For conditions of distribution and use, see the accompanying README file. | ||
| 12 | |||
| 13 | This file contains common declarations for the sample applications | ||
| 14 | cjpeg and djpeg. It is NOT used by the core JPEG library. | ||
| 15 | |||
| 16 | Source: Independent JPEG Group's software | ||
| 17 | |||
| 18 | Changes: no major functional changes | ||
| 19 | |||
| 20 | License: See the accompanying README file | ||
| 21 | |||
| 22 | */ | ||
| 23 | #ifndef CDJPEG_H | ||
| 24 | #define CDJPEG_H | ||
| 25 | |||
| 26 | #define CJPEG_WRBMP_JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ | ||
| 27 | #define CJPEG_WRBMP_JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ | ||
| 28 | |||
| 29 | #include "jpeglib.h" | ||
| 30 | #include "jerror.h" /* get library error codes too */ | ||
| 31 | #include "cderror.h" /* get application-specific error codes */ | ||
| 32 | |||
| 33 | typedef struct cjpeg_wrbmp_cjpeg_source_struct | ||
| 34 | *cjpeg_wrbmp_cjpeg_source_ptr; | ||
| 35 | |||
| 36 | struct cjpeg_wrbmp_cjpeg_source_struct { | ||
| 37 | CJPEG_WRBMP_JMETHOD( void, start_input, | ||
| 38 | ( cjpeg_wrbmp_j_compress_ptr cinfo, | ||
| 39 | cjpeg_wrbmp_cjpeg_source_ptr sinfo ) ); | ||
| 40 | CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JDIMENSION, get_pixel_rows, | ||
| 41 | ( cjpeg_wrbmp_j_compress_ptr cinfo, | ||
| 42 | cjpeg_wrbmp_cjpeg_source_ptr sinfo ) ); | ||
| 43 | CJPEG_WRBMP_JMETHOD( void, finish_input, | ||
| 44 | ( cjpeg_wrbmp_j_compress_ptr cinfo, | ||
| 45 | cjpeg_wrbmp_cjpeg_source_ptr sinfo ) ); | ||
| 46 | |||
| 47 | CJPEG_WRBMP_FILE *input_file; | ||
| 48 | |||
| 49 | CJPEG_WRBMP_JSAMPARRAY buffer; | ||
| 50 | CJPEG_WRBMP_JDIMENSION buffer_height; | ||
| 51 | }; | ||
| 52 | |||
| 53 | |||
| 54 | typedef struct cjpeg_wrbmp_djpeg_dest_struct | ||
| 55 | *cjpeg_wrbmp_djpeg_dest_ptr; | ||
| 56 | |||
| 57 | struct cjpeg_wrbmp_djpeg_dest_struct { | ||
| 58 | CJPEG_WRBMP_JMETHOD( void, start_output, | ||
| 59 | ( cjpeg_wrbmp_j_decompress_ptr cinfo, | ||
| 60 | cjpeg_wrbmp_djpeg_dest_ptr dinfo ) ); | ||
| 61 | /* Emit the specified number of pixel rows from the buffer. */ | ||
| 62 | CJPEG_WRBMP_JMETHOD( void, put_pixel_rows, | ||
| 63 | ( cjpeg_wrbmp_j_decompress_ptr cinfo, | ||
| 64 | cjpeg_wrbmp_djpeg_dest_ptr dinfo, | ||
| 65 | CJPEG_WRBMP_JDIMENSION rows_supplied ) ); | ||
| 66 | /* Finish up at the end of the image. */ | ||
| 67 | CJPEG_WRBMP_JMETHOD( void, finish_output, | ||
| 68 | ( cjpeg_wrbmp_j_decompress_ptr cinfo, | ||
| 69 | cjpeg_wrbmp_djpeg_dest_ptr dinfo ) ); | ||
| 70 | |||
| 71 | /* Target file spec; filled in by djpeg.c after object is created. */ | ||
| 72 | CJPEG_WRBMP_FILE *output_file; | ||
| 73 | |||
| 74 | /* Output pixel-row buffer. Created by module init or start_output. | ||
| 75 | Width is cinfo->output_width * cinfo->output_components; | ||
| 76 | height is buffer_height. | ||
| 77 | */ | ||
| 78 | CJPEG_WRBMP_JSAMPARRAY buffer; | ||
| 79 | CJPEG_WRBMP_JDIMENSION buffer_height; | ||
| 80 | } ; | ||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | /* | ||
| 85 | cjpeg/djpeg may need to perform extra passes to convert to or from | ||
| 86 | the source/destination file format. The JPEG library does not know | ||
| 87 | about these passes, but we'd like them to be counted by the progress | ||
| 88 | monitor. We use an expanded progress monitor object to hold the | ||
| 89 | additional pass count. | ||
| 90 | */ | ||
| 91 | |||
| 92 | struct cjpeg_wrbmp_cdjpeg_progress_mgr { | ||
| 93 | struct cjpeg_wrbmp_jpeg_progress_mgr | ||
| 94 | pub; /* fields known to JPEG library */ | ||
| 95 | int completed_extra_passes; /* extra passes completed */ | ||
| 96 | int total_extra_passes; /* total extra */ | ||
| 97 | /* last printed percentage stored here to avoid multiple printouts */ | ||
| 98 | int percent_done; | ||
| 99 | }; | ||
| 100 | |||
| 101 | typedef struct cjpeg_wrbmp_cdjpeg_progress_mgr | ||
| 102 | *cjpeg_wrbmp_cd_progress_ptr; | ||
| 103 | |||
| 104 | #endif | ||
| 105 | |||
diff --git a/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c b/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c new file mode 100644 index 0000000..7bef7ab --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c | |||
| @@ -0,0 +1,225 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: cjpeg_jpeg6b_wrbmp.c | ||
| 7 | |||
| 8 | Author: Thomas G. Lane. | ||
| 9 | |||
| 10 | Function: This file contains routines to write output images in Microsoft "BMP" | ||
| 11 | format (MS Windows 3.x and OS/2 1.x flavors). | ||
| 12 | Either 8-bit colormapped or 24-bit full-color format can be written. | ||
| 13 | No compression is supported. | ||
| 14 | |||
| 15 | These routines may need modification for non-Unix environments or | ||
| 16 | specialized applications. As they stand, they assume output to | ||
| 17 | an ordinary stdio stream. | ||
| 18 | |||
| 19 | Source: Independent JPEG Group's software | ||
| 20 | |||
| 21 | Changes: a brief summary of major functional changes (not formatting) | ||
| 22 | |||
| 23 | License: See the accompanying README file | ||
| 24 | |||
| 25 | */ | ||
| 26 | |||
| 27 | #include "../extra.h" | ||
| 28 | #include "cdjpeg.h" | ||
| 29 | |||
| 30 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED | ||
| 31 | |||
| 32 | /* | ||
| 33 | Declaration of global variables | ||
| 34 | */ | ||
| 35 | typedef struct { | ||
| 36 | struct cjpeg_wrbmp_djpeg_dest_struct pub; /* public fields */ | ||
| 37 | cjpeg_wrbmp_boolean is_os2; /* saves the OS2 format request flag */ | ||
| 38 | cjpeg_wrbmp_jvirt_sarray_ptr | ||
| 39 | whole_image; /* needed to reverse row order */ | ||
| 40 | CJPEG_WRBMP_JDIMENSION data_width; /* JSAMPLEs per row */ | ||
| 41 | CJPEG_WRBMP_JDIMENSION | ||
| 42 | row_width; /* physical width of one row in the BMP file */ | ||
| 43 | int pad_bytes; /* number of padding bytes needed per row */ | ||
| 44 | CJPEG_WRBMP_JDIMENSION | ||
| 45 | cur_output_row; /* next row# to write to virtual array */ | ||
| 46 | } cjpeg_wrbmp_bmp_dest_struct; | ||
| 47 | |||
| 48 | typedef cjpeg_wrbmp_bmp_dest_struct *cjpeg_wrbmp_bmp_dest_ptr; | ||
| 49 | extern unsigned char cjpeg_wrbmp_colormap[3][256]; | ||
| 50 | unsigned char cjpeg_wrbmp_output_array[6144]; | ||
| 51 | unsigned char *cjpeg_wrbmp_jpeg_stream /*= cjpeg_jpeg6b_wrbmp_output_array*/; | ||
| 52 | int cjpeg_wrbmp_checksum; | ||
| 53 | |||
| 54 | struct cjpeg_wrbmp_jpeg_decompress_struct | ||
| 55 | cjpeg_wrbmp_jpeg_dec_1; | ||
| 56 | struct cjpeg_wrbmp_jpeg_decompress_struct | ||
| 57 | cjpeg_wrbmp_jpeg_dec_2; | ||
| 58 | struct cjpeg_wrbmp_djpeg_dest_struct | ||
| 59 | cjpeg_wrbmp_djpeg_dest; | ||
| 60 | cjpeg_wrbmp_bmp_dest_struct cjpeg_wrbmp_bmp_dest; | ||
| 61 | |||
| 62 | /* | ||
| 63 | Forward declaration of functions | ||
| 64 | */ | ||
| 65 | void cjpeg_wrbmp_initInput( void ); | ||
| 66 | void cjpeg_wrbmp_finish_output_bmp( cjpeg_wrbmp_j_decompress_ptr cinfo); | ||
| 67 | void cjpeg_wrbmp_write_colormap( cjpeg_wrbmp_j_decompress_ptr | ||
| 68 | cinfo, | ||
| 69 | int map_colors, int map_entry_size, | ||
| 70 | int cMap ); | ||
| 71 | int cjpeg_wrbmp_putc_modified( int character ); | ||
| 72 | void cjpeg_wrbmp_init(); | ||
| 73 | void cjpeg_wrbmp_main(); | ||
| 74 | int cjpeg_wrbmp_return(); | ||
| 75 | //int main(); | ||
| 76 | |||
| 77 | /* | ||
| 78 | Initialization functions | ||
| 79 | */ | ||
| 80 | void cjpeg_wrbmp_init() | ||
| 81 | { | ||
| 82 | cjpeg_wrbmp_initInput(); | ||
| 83 | |||
| 84 | cjpeg_wrbmp_jpeg_dec_1.progress = 0; | ||
| 85 | cjpeg_wrbmp_jpeg_dec_1.output_height = 30; | ||
| 86 | cjpeg_wrbmp_jpeg_dec_1.actual_number_of_colors = 256; | ||
| 87 | cjpeg_wrbmp_jpeg_dec_1.out_color_components = 2; | ||
| 88 | |||
| 89 | cjpeg_wrbmp_jpeg_dec_2.progress = 0; | ||
| 90 | cjpeg_wrbmp_jpeg_dec_2.output_height = 30; | ||
| 91 | cjpeg_wrbmp_jpeg_dec_2.actual_number_of_colors = 256; | ||
| 92 | cjpeg_wrbmp_jpeg_dec_2.out_color_components = 3; | ||
| 93 | |||
| 94 | cjpeg_wrbmp_jpeg_stream = cjpeg_wrbmp_output_array; | ||
| 95 | |||
| 96 | cjpeg_wrbmp_checksum = 0; | ||
| 97 | } | ||
| 98 | |||
| 99 | /* | ||
| 100 | Calculation functions | ||
| 101 | */ | ||
| 102 | int cjpeg_wrbmp_putc_modified( int character ) | ||
| 103 | { | ||
| 104 | *( cjpeg_wrbmp_jpeg_stream ) = character; | ||
| 105 | |||
| 106 | ++cjpeg_wrbmp_jpeg_stream; | ||
| 107 | |||
| 108 | cjpeg_wrbmp_checksum += character; | ||
| 109 | |||
| 110 | return character; | ||
| 111 | } | ||
| 112 | |||
| 113 | void cjpeg_wrbmp_finish_output_bmp( cjpeg_wrbmp_j_decompress_ptr cinfo ) | ||
| 114 | { | ||
| 115 | CJPEG_WRBMP_JDIMENSION row; | ||
| 116 | cjpeg_wrbmp_cd_progress_ptr progress = | ||
| 117 | ( cjpeg_wrbmp_cd_progress_ptr ) cinfo->progress; | ||
| 118 | |||
| 119 | // Write the file body from our virtual array | ||
| 120 | _Pragma( "loopbound min 30 max 30" ) | ||
| 121 | for ( row = cinfo->output_height; row > 0; --row ) { | ||
| 122 | if ( progress != 0 ) { | ||
| 123 | progress->pub.pass_counter = ( long )( cinfo->output_height - row ); | ||
| 124 | progress->pub.pass_limit = ( long ) cinfo->output_height; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | if ( progress != 0 ) | ||
| 129 | progress->completed_extra_passes++; | ||
| 130 | } | ||
| 131 | |||
| 132 | void cjpeg_wrbmp_write_colormap( cjpeg_wrbmp_j_decompress_ptr | ||
| 133 | cinfo, | ||
| 134 | int map_colors, int map_entry_size, int cMap ) | ||
| 135 | { | ||
| 136 | |||
| 137 | int num_colors = cinfo->actual_number_of_colors; | ||
| 138 | int i; | ||
| 139 | |||
| 140 | if ( cMap != 0 ) { | ||
| 141 | |||
| 142 | if ( cinfo->out_color_components == 3 ) { | ||
| 143 | // Normal case with RGB colormap | ||
| 144 | _Pragma( "loopbound min 256 max 256" ) | ||
| 145 | for ( i = 0; i < num_colors; i++ ) { | ||
| 146 | cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE( | ||
| 147 | cjpeg_wrbmp_colormap[2][i] ) ); | ||
| 148 | cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE( | ||
| 149 | cjpeg_wrbmp_colormap[1][i] ) ); | ||
| 150 | cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE( | ||
| 151 | cjpeg_wrbmp_colormap[0][i] ) ); | ||
| 152 | |||
| 153 | if ( map_entry_size == 4 ) | ||
| 154 | cjpeg_wrbmp_putc_modified( 0 ); | ||
| 155 | } | ||
| 156 | } else { | ||
| 157 | // Grayscale colormap (only happens with grayscale quantization) | ||
| 158 | _Pragma( "loopbound min 256 max 256" ) | ||
| 159 | for ( i = 0; i < num_colors; i++ ) { | ||
| 160 | |||
| 161 | cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE( | ||
| 162 | cjpeg_wrbmp_colormap[2][i] ) ); | ||
| 163 | cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE( | ||
| 164 | cjpeg_wrbmp_colormap[1][i] ) ); | ||
| 165 | cjpeg_wrbmp_putc_modified( CJPEG_WRBMP_GETJSAMPLE( | ||
| 166 | cjpeg_wrbmp_colormap[0][i] ) ); | ||
| 167 | |||
| 168 | if ( map_entry_size == 4 ) | ||
| 169 | cjpeg_wrbmp_putc_modified( 0 ); | ||
| 170 | } | ||
| 171 | } | ||
| 172 | } else { | ||
| 173 | // If no colormap, must be grayscale data. Generate a linear "map". | ||
| 174 | _Pragma( "loopbound min 256 max 256" ) | ||
| 175 | for ( i = 0; i < 256; i++ ) { | ||
| 176 | cjpeg_wrbmp_putc_modified( i ); | ||
| 177 | cjpeg_wrbmp_putc_modified( i ); | ||
| 178 | cjpeg_wrbmp_putc_modified( i ); | ||
| 179 | |||
| 180 | if ( map_entry_size == 4 ) | ||
| 181 | cjpeg_wrbmp_putc_modified( 0 ); | ||
| 182 | } | ||
| 183 | } | ||
| 184 | |||
| 185 | // Pad colormap with zeros to ensure specified number of colormap entries. | ||
| 186 | _Pragma( "loopbound min 512 max 512" ) | ||
| 187 | for ( ; i < map_colors; i++ ) { | ||
| 188 | cjpeg_wrbmp_putc_modified( 0 ); | ||
| 189 | cjpeg_wrbmp_putc_modified( 0 ); | ||
| 190 | cjpeg_wrbmp_putc_modified( 0 ); | ||
| 191 | |||
| 192 | if ( map_entry_size == 4 ) | ||
| 193 | cjpeg_wrbmp_putc_modified( 0 ); | ||
| 194 | } | ||
| 195 | } | ||
| 196 | |||
| 197 | void _Pragma( "entrypoint" ) cjpeg_wrbmp_main() | ||
| 198 | { | ||
| 199 | cjpeg_wrbmp_finish_output_bmp( &cjpeg_wrbmp_jpeg_dec_1); | ||
| 200 | cjpeg_wrbmp_write_colormap( &cjpeg_wrbmp_jpeg_dec_1, 768, 4, 1 ); | ||
| 201 | |||
| 202 | cjpeg_wrbmp_finish_output_bmp( &cjpeg_wrbmp_jpeg_dec_2 ); | ||
| 203 | cjpeg_wrbmp_write_colormap( &cjpeg_wrbmp_jpeg_dec_2, 768, 4, 1 ); | ||
| 204 | } | ||
| 205 | |||
| 206 | int cjpeg_wrbmp_return() | ||
| 207 | { | ||
| 208 | return (cjpeg_wrbmp_checksum + (-209330) ) != 0; | ||
| 209 | } | ||
| 210 | |||
| 211 | int main(int argc, char **argv) | ||
| 212 | { | ||
| 213 | SET_UP | ||
| 214 | for (jobsComplete=-1; jobsComplete<maxJobs; jobsComplete++){ | ||
| 215 | START_LOOP | ||
| 216 | cjpeg_wrbmp_init(); | ||
| 217 | cjpeg_wrbmp_main(); | ||
| 218 | STOP_LOOP | ||
| 219 | } | ||
| 220 | WRITE_TO_FILE | ||
| 221 | return ( cjpeg_wrbmp_return() ); | ||
| 222 | } | ||
| 223 | |||
| 224 | #endif /* BMP_SUPPORTED */ | ||
| 225 | |||
diff --git a/all_pairs/source/cjpeg_wrbmp/input.c b/all_pairs/source/cjpeg_wrbmp/input.c new file mode 100644 index 0000000..08dec28 --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/input.c | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: input.c | ||
| 7 | |||
| 8 | Author: Thomas G. Lane. | ||
| 9 | |||
| 10 | Function: Input variables for the cjpeg_jpeg6b_wrbmp.c | ||
| 11 | |||
| 12 | Source: Independent JPEG Group's software | ||
| 13 | |||
| 14 | Changes: no major functional changes | ||
| 15 | |||
| 16 | License: See the accompanying README file | ||
| 17 | |||
| 18 | */ | ||
| 19 | |||
| 20 | unsigned char cjpeg_wrbmp_colormap[3][256]; | ||
| 21 | |||
| 22 | void cjpeg_wrbmp_initInput( void ) | ||
| 23 | { | ||
| 24 | int i, j; | ||
| 25 | volatile unsigned char tmp[3][256] = {{44 , 105 , 153 , 71 , 151 , 160 , 188 , 90 , 209 , 131 , | ||
| 26 | 221 , 114 , 93 , 124 , 208 , 207 , 218 , 54 , 145 , 113 , 153 , 239 , 226 , 83 , 243 , 151 , | ||
| 27 | 98 , 67 , 114 , 153 , 83 , 186 , 116 , 72 , 188 , 190 , 109 , 162 , 218 , 133 , 208 , 209, | ||
| 28 | 115 , 251 , 135 , 89 , 143 , 226 , 230 , 246 , 152 , 243 , 152 , 115 , 180 , 78 , 246 , 164, | ||
| 29 | 250 , 117 , 76 , 150 , 152 , 188 , 251 , 195 , 127 , 111 , 225 , 208 , 94 , 93 , 143 , 131, | ||
| 30 | 201 , 211 , 99 , 93 , 190 , 157 , 121 , 240 , 117 , 185 , 167 , 137 , 152 , 188 , 250 , 59, | ||
| 31 | 248 , 245 , 115 , 240 , 192 , 209 , 143 , 136 , 98 , 224 , 167 , 135 , 132 , 189 , 72 , 249, | ||
| 32 | 205 , 44 , 106 , 96 , 147 , 247 , 249 , 228 , 224 , 249 , 190 , 112 , 135 , 168 , 95 , 205, | ||
| 33 | 171 , 58 , 112 , 79 , 206 , 75 , 242 , 188 , 189 , 225 , 185 , 81 , 221 , 153 , 244 , 198, | ||
| 34 | 171 , 163 , 159 , 209 , 240 , 138 , 148 , 207 , 166 , 192 , 188 , 151 , 98 , 190 , 209 , 154, | ||
| 35 | 225 , 72 , 96 , 249 , 191 , 223 , 207 , 163 , 207 , 133 , 251 , 183 , 135 , 137 , 159 , 247, | ||
| 36 | 167 , 83 , 123 , 199 , 203 , 144 , 142 , 237 , 77 , 128 , 117 , 169 , 202 , 136 , 128 , 188, | ||
| 37 | 168 , 55 , 222 , 169 , 116 , 60 , 75 , 175 , 102 , 217 , 168 , 185 , 189 , 225 , 125 , 192, | ||
| 38 | 112 , 111 , 168 , 239 , 225 , 168 , 97 , 129 , 190 , 175 , 169 , 225 , 170 , 226 , 225 , 226, | ||
| 39 | 224 , 134 , 106 , 250 , 222 , 148 , 241 , 168 , 166 , 160 , 95 , 190 , 102 , 180 , 193 , 111, | ||
| 40 | 151 , 165 , 171 , 200 , 52 , 134 , 169 , 223 , 166 , 225 , 169 , 111 , 185 , 109 , 56 , 244, | ||
| 41 | 157 , 250 , 226 , 231 , 119 , 188 },{42 , 143 , 46 , 91 , 84 , 201 , 140 , 91 , 82 , 140 , 31, | ||
| 42 | 88 , 44 , 171 , 57 , 115 , 206 , 59 , 145 , 117 , 116 , 53 , 232 , 117 , 80 , 60 , 66 , 64, | ||
| 43 | 117 , 174 , 89 , 178 , 147 , 63 , 83 , 59 , 103 , 139 , 211 , 64 , 68 , 98 , 118 , 53 , 119, | ||
| 44 | 90 , 161 , 232 , 171 , 98 , 176 , 236 , 118 , 157 , 180 , 77 , 114 , 88 , 28 , 119 , 40 , 97, | ||
| 45 | 69 , 189 , 252 , 225 , 119 , 96 , 219 , 84 , 82 , 105 , 158 , 49 , 200 , 61 , 117 , 78 , 63, | ||
| 46 | 147 , 140 , 69 , 108 , 90 , 161 , 105 , 190 , 114 , 84 , 76 , 70 , 43 , 156 , 222 , 96 , 72, | ||
| 47 | 143 , 90 , 105 , 56 , 144 , 78 , 129 , 35 , 66 , 101 , 100 , 49 , 105 , 130 , 160 , 239 , 129, | ||
| 48 | 141 , 83 , 43 , 68 , 106 , 132 , 83 , 92 , 130 , 175 , 63 , 131 , 79 , 192 , 105 , 57 , 160, | ||
| 49 | 118 , 162 , 141 , 78 , 192 , 128 , 206 , 201 , 203 , 162 , 159 , 163 , 221 , 183 , 157 , 177, | ||
| 50 | 189 , 192 , 129 , 130 , 54 , 104 , 45 , 101 , 252 , 52 , 91 , 177 , 49 , 221 , 116 , 111 , 143, | ||
| 51 | 92 , 142 , 159 , 131 , 173 , 61 , 159 , 173 , 81 , 129 , 214 , 213 , 145 , 143 , 232 , 67, | ||
| 52 | 145 , 130 , 99 , 237 , 110 , 160 , 131 , 67 , 50 , 129 , 131 , 127 , 76 , 92 , 203 , 96 , 206, | ||
| 53 | 176 , 180 , 85 , 99 , 162 , 118 , 64 , 78 , 190 , 191 , 45 , 101 , 129 , 58 , 72 , 211 , 49, | ||
| 54 | 115 , 115 , 85 , 61 , 100 , 116 , 107 , 143 , 117 , 219 , 154 , 225 , 174 , 160 , 163 , 119, | ||
| 55 | 190 , 106 , 186 , 49 , 45 , 177 , 147 , 85 , 138 , 42 , 174 , 59 , 68 , 120 , 71 , 129 , 56, | ||
| 56 | 149 , 97 , 68 , 88 , 148 , 60 , 239 , 179 , 149 , 104},{44 , 76 , 37 , 56 , 76 , 152 , 122, | ||
| 57 | 153 , 77 , 191 , 41 , 76 , 39 , 97 , 46 , 109 , 172 , 43 , 116 , 91 , 102 , 49 , 201 , 68 , 88, | ||
| 58 | 45 , 53 , 95 , 160 , 175 , 102 , 164 , 116 , 50 , 76 , 45 , 86 , 189 , 216 , 50 , 61 , 93 , 196, | ||
| 59 | 91 , 100 , 58 , 116 , 223 , 166 , 102 , 126 , 221 , 158 , 86 , 235 , 55 , 113 , 120 , 52 , 115, | ||
| 60 | 42 , 86 , 55 , 165 , 247 , 194 , 160 , 108 , 170 , 108 , 98 , 77 , 168 , 42 , 179 , 70 , 96, | ||
| 61 | 62 , 71 , 216 , 100 , 71 , 155 , 121 , 146 , 86 , 134 , 105 , 114 , 49 , 100 , 50 , 119 , 218, | ||
| 62 | 95 , 81 , 220 , 78 , 102 , 50 , 125 , 68 , 170 , 36 , 62 , 119 , 129 , 44 , 151 , 72 , 143, | ||
| 63 | 241 , 131 , 137 , 79 , 73 , 55 , 122 , 204 , 73 , 74 , 131 , 221 , 53 , 89 , 72 , 178 , 60 , 64, | ||
| 64 | 145 , 157 , 156 , 177 , 101 , 180 , 112 , 194 , 206 , 178 , 168 , 221 , 153 , 201 , 119 , 222, | ||
| 65 | 165 , 188 , 212 , 117 , 180 , 45 , 134 , 42 , 130 , 229 , 47 , 107 , 172 , 40 , 221 , 146, | ||
| 66 | 132 , 138 , 110 , 144 , 188 , 112 , 132 , 64 , 162 , 145 , 140 , 200 , 181 , 215 , 139 , 197, | ||
| 67 | 183 , 106 , 126 , 116 , 89 , 204 , 152 , 123 , 161 , 52 , 46 , 131 , 167 , 173 , 62 , 70 , 151, | ||
| 68 | 151 , 197 , 177 , 184 , 96 , 97 , 101 , 130 , 54 , 63 , 141 , 185 , 45 , 126 , 96 , 46 , 71, | ||
| 69 | 172 , 38 , 114 , 100 , 106 , 69 , 118 , 138 , 127 , 99 , 127 , 198 , 204 , 242 , 248 , 197, | ||
| 70 | 241 , 74 , 189 , 178 , 252 , 65 , 45 , 148 , 145 , 97 , 168 , 45 , 111 , 43 , 64 , 164 , 80, | ||
| 71 | 113 , 47 , 136 , 83 , 42 , 91 , 197 , 95 , 222 , 167 , 92 , 98}}; | ||
| 72 | |||
| 73 | for ( i = 0; i < 3; i++ ) { | ||
| 74 | for ( j = 0; j < 256; j++ ) | ||
| 75 | { | ||
| 76 | cjpeg_wrbmp_colormap[i][j] = tmp[i][j]; | ||
| 77 | } | ||
| 78 | } | ||
| 79 | } | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/jconfig.h b/all_pairs/source/cjpeg_wrbmp/jconfig.h new file mode 100644 index 0000000..9c73988 --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/jconfig.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: cderror.h | ||
| 7 | |||
| 8 | Author: Thomas G. Lane. | ||
| 9 | |||
| 10 | This file is part of the Independent JPEG Group's software. | ||
| 11 | For conditions of distribution and use, see the accompanying README file. | ||
| 12 | |||
| 13 | Source: Independent JPEG Group's software | ||
| 14 | |||
| 15 | Changes: no major functional changes | ||
| 16 | |||
| 17 | License: See the accompanying README files | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef JCONFIG_H | ||
| 21 | #define JCONFIG_H | ||
| 22 | |||
| 23 | #define CJPEG_WRBMP_HAVE_PROTOTYPES | ||
| 24 | #define CJPEG_WRBMP_HAVE_UNSIGNED_CHAR | ||
| 25 | #define CJPEG_WRBMP_HAVE_UNSIGNED_SHORT | ||
| 26 | #undef void | ||
| 27 | #undef const | ||
| 28 | #undef CHAR_IS_UNSIGNED | ||
| 29 | #define CJPEG_WRBMP_HAVE_STDDEF_H | ||
| 30 | #define CJPEG_WRBMP_HAVE_STDLIB_H | ||
| 31 | #undef NEED_BSD_STRINGS | ||
| 32 | #undef NEED_SYS_TYPES_H | ||
| 33 | #undef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS | ||
| 34 | #undef NEED_SHORT_EXTERNAL_NAMES | ||
| 35 | /* Define this if you get warnings about undefined structures. */ | ||
| 36 | #undef INCOMPLETE_TYPES_BROKEN | ||
| 37 | |||
| 38 | #ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS | ||
| 39 | |||
| 40 | #undef RIGHT_SHIFT_IS_UNSIGNED | ||
| 41 | #define INLINE __inline__ | ||
| 42 | /* These are for configuring the JPEG memory manager. */ | ||
| 43 | #undef DEFAULT_MAX_MEM | ||
| 44 | #undef NO_MKTEMP | ||
| 45 | |||
| 46 | #endif /* JPEG_INTERNALS */ | ||
| 47 | |||
| 48 | #ifdef CJPEG_WRBMP_JPEG_CJPEG_DJPEG | ||
| 49 | |||
| 50 | #define CJPEG_WRBMP_BMP_SUPPORTED /* BMP image file format */ | ||
| 51 | #define CJPEG_WRBMP_GIF_SUPPORTED /* GIF image file format */ | ||
| 52 | #define CJPEG_WRBMP_PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ | ||
| 53 | #undef RLE_SUPPORTED /* Utah RLE image file format */ | ||
| 54 | #define CJPEG_WRBMP_TARGA_SUPPORTED /* Targa image file format */ | ||
| 55 | |||
| 56 | #undef TWO_FILE_COMMANDLINE | ||
| 57 | #undef NEED_SIGNAL_CATCHER | ||
| 58 | #undef DONT_USE_B_MODE | ||
| 59 | |||
| 60 | /* Define this if you want percent-done progress reports from cjpeg/djpeg. */ | ||
| 61 | #undef PROGRESS_REPORT | ||
| 62 | |||
| 63 | #endif /* JPEG_CJPEG_DJPEG */ | ||
| 64 | |||
| 65 | #endif | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/jerror.h b/all_pairs/source/cjpeg_wrbmp/jerror.h new file mode 100644 index 0000000..1dc2798 --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/jerror.h | |||
| @@ -0,0 +1,203 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: jerror.h | ||
| 7 | |||
| 8 | Author: Thomas G. Lane. | ||
| 9 | |||
| 10 | This file defines the error and message codes for the JPEG library. | ||
| 11 | Edit this file to add new codes, or to translate the message strings to | ||
| 12 | some other language. | ||
| 13 | A set of error-reporting macros are defined too. Some applications using | ||
| 14 | the JPEG library may wish to include this file to get the error codes | ||
| 15 | sand/or the macros. | ||
| 16 | |||
| 17 | Source: Independent JPEG Group's software | ||
| 18 | |||
| 19 | Changes: no major functional changes | ||
| 20 | |||
| 21 | License: See the accompanying README file | ||
| 22 | */ | ||
| 23 | |||
| 24 | /* | ||
| 25 | To define the enum list of message codes, include this file without | ||
| 26 | defining macro JMESSAGE. To create a message string table, include it | ||
| 27 | again with a suitable JMESSAGE definition (see jerror.c for an example). | ||
| 28 | */ | ||
| 29 | #ifndef CJPEG_WRBMP_JMESSAGE | ||
| 30 | #ifndef JERROR_H | ||
| 31 | /* First time through, define the enum list */ | ||
| 32 | #define CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 33 | #else | ||
| 34 | /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ | ||
| 35 | #define CJPEG_WRBMP_JMESSAGE(code,string) | ||
| 36 | #endif /* JERROR_H */ | ||
| 37 | #endif /* JMESSAGE */ | ||
| 38 | |||
| 39 | #ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 40 | |||
| 41 | typedef enum { | ||
| 42 | |||
| 43 | #define CJPEG_WRBMP_JMESSAGE(code,string) code , | ||
| 44 | |||
| 45 | #endif /* JMAKE_ENUM_LIST */ | ||
| 46 | |||
| 47 | CJPEG_WRBMP_JMESSAGE( JMSG_NOMESSAGE, "Bogus message code %d" ) /* Must be first entry! */ | ||
| 48 | |||
| 49 | /* For maintenance convenience, list is alphabetical by message code name */ | ||
| 50 | CJPEG_WRBMP_JMESSAGE( JERR_ARITH_NOTIMPL, | ||
| 51 | "Sorry, there are legal restrictions on arithmetic coding" ) | ||
| 52 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix" ) | ||
| 53 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix" ) | ||
| 54 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_BUFFER_MODE, "Bogus buffer control mode" ) | ||
| 55 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS" ) | ||
| 56 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_DCT_COEF, "DCT coefficient out of range" ) | ||
| 57 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_DCTSIZE, "IDCT output block size %d not supported" ) | ||
| 58 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition" ) | ||
| 59 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_IN_COLORSPACE, "Bogus input colorspace" ) | ||
| 60 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace" ) | ||
| 61 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_LENGTH, "Bogus marker length" ) | ||
| 62 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_LIB_VERSION, | ||
| 63 | "Wrong JPEG library version: library is %d, caller expects %d" ) | ||
| 64 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan" ) | ||
| 65 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_POOL_ID, "Invalid memory pool code %d" ) | ||
| 66 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_PRECISION, "Unsupported JPEG data precision %d" ) | ||
| 67 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_PROGRESSION, | ||
| 68 | "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d" ) | ||
| 69 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_PROG_SCRIPT, | ||
| 70 | "Invalid progressive parameters at scan script entry %d" ) | ||
| 71 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_SAMPLING, "Bogus sampling factors" ) | ||
| 72 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d" ) | ||
| 73 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_STATE, "Improper call to JPEG library in state %d" ) | ||
| 74 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_STRUCT_SIZE, | ||
| 75 | "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u" ) | ||
| 76 | CJPEG_WRBMP_JMESSAGE( JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access" ) | ||
| 77 | CJPEG_WRBMP_JMESSAGE( JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small" ) | ||
| 78 | CJPEG_WRBMP_JMESSAGE( JERR_CANT_SUSPEND, "Suspension not allowed here" ) | ||
| 79 | CJPEG_WRBMP_JMESSAGE( JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet" ) | ||
| 80 | CJPEG_WRBMP_JMESSAGE( JERR_COMPONENT_COUNT, "Too many color components: %d, max %d" ) | ||
| 81 | CJPEG_WRBMP_JMESSAGE( JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request" ) | ||
| 82 | CJPEG_WRBMP_JMESSAGE( JERR_DAC_INDEX, "Bogus DAC index %d" ) | ||
| 83 | CJPEG_WRBMP_JMESSAGE( JERR_DAC_VALUE, "Bogus DAC value 0x%x" ) | ||
| 84 | CJPEG_WRBMP_JMESSAGE( JERR_DHT_INDEX, "Bogus DHT index %d" ) | ||
| 85 | CJPEG_WRBMP_JMESSAGE( JERR_DQT_INDEX, "Bogus DQT index %d" ) | ||
| 86 | CJPEG_WRBMP_JMESSAGE( JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)" ) | ||
| 87 | CJPEG_WRBMP_JMESSAGE( JERR_EMS_READ, "Read from EMS failed" ) | ||
| 88 | CJPEG_WRBMP_JMESSAGE( JERR_EMS_WRITE, "Write to EMS failed" ) | ||
| 89 | CJPEG_WRBMP_JMESSAGE( JERR_EOI_EXPECTED, "Didn't expect more than one scan" ) | ||
| 90 | CJPEG_WRBMP_JMESSAGE( JERR_FILE_READ, "Input file read error" ) | ||
| 91 | CJPEG_WRBMP_JMESSAGE( JERR_FILE_WRITE, "Output file write error --- out of disk space?" ) | ||
| 92 | CJPEG_WRBMP_JMESSAGE( JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet" ) | ||
| 93 | CJPEG_WRBMP_JMESSAGE( JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow" ) | ||
| 94 | CJPEG_WRBMP_JMESSAGE( JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry" ) | ||
| 95 | CJPEG_WRBMP_JMESSAGE( JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels" ) | ||
| 96 | CJPEG_WRBMP_JMESSAGE( JERR_INPUT_EMPTY, "Empty input file" ) | ||
| 97 | CJPEG_WRBMP_JMESSAGE( JERR_INPUT_EOF, "Premature end of input file" ) | ||
| 98 | CJPEG_WRBMP_JMESSAGE( JERR_MISMATCHED_QUANT_TABLE, | ||
| 99 | "Cannot transcode due to multiple use of quantization table %d" ) | ||
| 100 | CJPEG_WRBMP_JMESSAGE( JERR_MISSING_DATA, "Scan script does not transmit all data" ) | ||
| 101 | CJPEG_WRBMP_JMESSAGE( JERR_MODE_CHANGE, "Invalid color quantization mode change" ) | ||
| 102 | CJPEG_WRBMP_JMESSAGE( JERR_NOTIMPL, "Not implemented yet" ) | ||
| 103 | CJPEG_WRBMP_JMESSAGE( JERR_NOT_COMPILED, "Requested feature was omitted at compile time" ) | ||
| 104 | CJPEG_WRBMP_JMESSAGE( JERR_NO_BACKING_STORE, "Backing store not supported" ) | ||
| 105 | CJPEG_WRBMP_JMESSAGE( JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined" ) | ||
| 106 | CJPEG_WRBMP_JMESSAGE( JERR_NO_IMAGE, "JPEG datastream contains no image" ) | ||
| 107 | CJPEG_WRBMP_JMESSAGE( JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined" ) | ||
| 108 | CJPEG_WRBMP_JMESSAGE( JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x" ) | ||
| 109 | CJPEG_WRBMP_JMESSAGE( JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)" ) | ||
| 110 | CJPEG_WRBMP_JMESSAGE( JERR_QUANT_COMPONENTS, | ||
| 111 | "Cannot quantize more than %d color components" ) | ||
| 112 | CJPEG_WRBMP_JMESSAGE( JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors" ) | ||
| 113 | CJPEG_WRBMP_JMESSAGE( JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors" ) | ||
| 114 | CJPEG_WRBMP_JMESSAGE( JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers" ) | ||
| 115 | CJPEG_WRBMP_JMESSAGE( JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker" ) | ||
| 116 | CJPEG_WRBMP_JMESSAGE( JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x" ) | ||
| 117 | CJPEG_WRBMP_JMESSAGE( JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers" ) | ||
| 118 | CJPEG_WRBMP_JMESSAGE( JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF" ) | ||
| 119 | CJPEG_WRBMP_JMESSAGE( JERR_TFILE_CREATE, "Failed to create temporary file %s" ) | ||
| 120 | CJPEG_WRBMP_JMESSAGE( JERR_TFILE_READ, "Read failed on temporary file" ) | ||
| 121 | CJPEG_WRBMP_JMESSAGE( JERR_TFILE_SEEK, "Seek failed on temporary file" ) | ||
| 122 | CJPEG_WRBMP_JMESSAGE( JERR_TFILE_WRITE, | ||
| 123 | "Write failed on temporary file --- out of disk space?" ) | ||
| 124 | CJPEG_WRBMP_JMESSAGE( JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines" ) | ||
| 125 | CJPEG_WRBMP_JMESSAGE( JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x" ) | ||
| 126 | CJPEG_WRBMP_JMESSAGE( JERR_VIRTUAL_BUG, "Virtual array controller messed up" ) | ||
| 127 | CJPEG_WRBMP_JMESSAGE( JERR_WIDTH_OVERFLOW, "Image too wide for this implementation" ) | ||
| 128 | CJPEG_WRBMP_JMESSAGE( JERR_XMS_READ, "Read from XMS failed" ) | ||
| 129 | CJPEG_WRBMP_JMESSAGE( JERR_XMS_WRITE, "Write to XMS failed" ) | ||
| 130 | CJPEG_WRBMP_JMESSAGE( JMSG_COPYRIGHT, JCOPYRIGHT ) | ||
| 131 | CJPEG_WRBMP_JMESSAGE( JMSG_VERSION, JVERSION ) | ||
| 132 | CJPEG_WRBMP_JMESSAGE( JTRC_16BIT_TABLES, | ||
| 133 | "Caution: quantization tables are too coarse for baseline JPEG" ) | ||
| 134 | CJPEG_WRBMP_JMESSAGE( JTRC_ADOBE, | ||
| 135 | "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d" ) | ||
| 136 | CJPEG_WRBMP_JMESSAGE( JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u" ) | ||
| 137 | CJPEG_WRBMP_JMESSAGE( JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u" ) | ||
| 138 | CJPEG_WRBMP_JMESSAGE( JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x" ) | ||
| 139 | CJPEG_WRBMP_JMESSAGE( JTRC_DHT, "Define Huffman Table 0x%02x" ) | ||
| 140 | CJPEG_WRBMP_JMESSAGE( JTRC_DQT, "Define Quantization Table %d precision %d" ) | ||
| 141 | CJPEG_WRBMP_JMESSAGE( JTRC_DRI, "Define Restart Interval %u" ) | ||
| 142 | CJPEG_WRBMP_JMESSAGE( JTRC_EMS_CLOSE, "Freed EMS handle %u" ) | ||
| 143 | CJPEG_WRBMP_JMESSAGE( JTRC_EMS_OPEN, "Obtained EMS handle %u" ) | ||
| 144 | CJPEG_WRBMP_JMESSAGE( JTRC_EOI, "End Of Image" ) | ||
| 145 | CJPEG_WRBMP_JMESSAGE( JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d" ) | ||
| 146 | CJPEG_WRBMP_JMESSAGE( JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d" ) | ||
| 147 | CJPEG_WRBMP_JMESSAGE( JTRC_JFIF_BADTHUMBNAILSIZE, | ||
| 148 | "Warning: thumbnail image size does not match data length %u" ) | ||
| 149 | CJPEG_WRBMP_JMESSAGE( JTRC_JFIF_EXTENSION, | ||
| 150 | "JFIF extension marker: type 0x%02x, length %u" ) | ||
| 151 | CJPEG_WRBMP_JMESSAGE( JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image" ) | ||
| 152 | CJPEG_WRBMP_JMESSAGE( JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u" ) | ||
| 153 | CJPEG_WRBMP_JMESSAGE( JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x" ) | ||
| 154 | CJPEG_WRBMP_JMESSAGE( JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u" ) | ||
| 155 | CJPEG_WRBMP_JMESSAGE( JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors" ) | ||
| 156 | CJPEG_WRBMP_JMESSAGE( JTRC_QUANT_NCOLORS, "Quantizing to %d colors" ) | ||
| 157 | CJPEG_WRBMP_JMESSAGE( JTRC_QUANT_SELECTED, "Selected %d colors for quantization" ) | ||
| 158 | CJPEG_WRBMP_JMESSAGE( JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d" ) | ||
| 159 | CJPEG_WRBMP_JMESSAGE( JTRC_RST, "RST%d" ) | ||
| 160 | CJPEG_WRBMP_JMESSAGE( JTRC_SMOOTH_NOTIMPL, | ||
| 161 | "Smoothing not supported with nonstandard sampling ratios" ) | ||
| 162 | CJPEG_WRBMP_JMESSAGE( JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d" ) | ||
| 163 | CJPEG_WRBMP_JMESSAGE( JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d" ) | ||
| 164 | CJPEG_WRBMP_JMESSAGE( JTRC_SOI, "Start of Image" ) | ||
| 165 | CJPEG_WRBMP_JMESSAGE( JTRC_SOS, "Start Of Scan: %d components" ) | ||
| 166 | CJPEG_WRBMP_JMESSAGE( JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d" ) | ||
| 167 | CJPEG_WRBMP_JMESSAGE( JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d" ) | ||
| 168 | CJPEG_WRBMP_JMESSAGE( JTRC_TFILE_CLOSE, "Closed temporary file %s" ) | ||
| 169 | CJPEG_WRBMP_JMESSAGE( JTRC_TFILE_OPEN, "Opened temporary file %s" ) | ||
| 170 | CJPEG_WRBMP_JMESSAGE( JTRC_THUMB_JPEG, | ||
| 171 | "JFIF extension marker: JPEG-compressed thumbnail image, length %u" ) | ||
| 172 | CJPEG_WRBMP_JMESSAGE( JTRC_THUMB_PALETTE, | ||
| 173 | "JFIF extension marker: palette thumbnail image, length %u" ) | ||
| 174 | CJPEG_WRBMP_JMESSAGE( JTRC_THUMB_RGB, | ||
| 175 | "JFIF extension marker: RGB thumbnail image, length %u" ) | ||
| 176 | CJPEG_WRBMP_JMESSAGE( JTRC_UNKNOWN_IDS, | ||
| 177 | "Unrecognized component IDs %d %d %d, assuming YCbCr" ) | ||
| 178 | CJPEG_WRBMP_JMESSAGE( JTRC_XMS_CLOSE, "Freed XMS handle %u" ) | ||
| 179 | CJPEG_WRBMP_JMESSAGE( JTRC_XMS_OPEN, "Obtained XMS handle %u" ) | ||
| 180 | CJPEG_WRBMP_JMESSAGE( JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d" ) | ||
| 181 | CJPEG_WRBMP_JMESSAGE( JWRN_BOGUS_PROGRESSION, | ||
| 182 | "Inconsistent progression sequence for component %d coefficient %d" ) | ||
| 183 | CJPEG_WRBMP_JMESSAGE( JWRN_EXTRANEOUS_DATA, | ||
| 184 | "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x" ) | ||
| 185 | CJPEG_WRBMP_JMESSAGE( JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment" ) | ||
| 186 | CJPEG_WRBMP_JMESSAGE( JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code" ) | ||
| 187 | CJPEG_WRBMP_JMESSAGE( JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d" ) | ||
| 188 | CJPEG_WRBMP_JMESSAGE( JWRN_JPEG_EOF, "Premature end of JPEG file" ) | ||
| 189 | CJPEG_WRBMP_JMESSAGE( JWRN_MUST_RESYNC, | ||
| 190 | "Corrupt JPEG data: found marker 0x%02x instead of RST%d" ) | ||
| 191 | CJPEG_WRBMP_JMESSAGE( JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG" ) | ||
| 192 | CJPEG_WRBMP_JMESSAGE( JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines" ) | ||
| 193 | |||
| 194 | #ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 195 | |||
| 196 | JMSG_LASTMSGCODE | ||
| 197 | } CJPEG_WRBMP_J_MESSAGE_CODE; | ||
| 198 | |||
| 199 | #undef CJPEG_WRBMP_JMAKE_ENUM_LIST | ||
| 200 | #endif /* JMAKE_ENUM_LIST */ | ||
| 201 | |||
| 202 | /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ | ||
| 203 | #undef CJPEG_WRBMP_JMESSAGE | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/jmorecfg.h b/all_pairs/source/cjpeg_wrbmp/jmorecfg.h new file mode 100644 index 0000000..84ee16a --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/jmorecfg.h | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: jmorecfg.h | ||
| 7 | |||
| 8 | Author: Thomas G. Lane. | ||
| 9 | |||
| 10 | This file is part of the Independent JPEG Group's software. | ||
| 11 | For conditions of distribution and use, see the accompanying README file. | ||
| 12 | |||
| 13 | This file contains additional configuration options that customize the | ||
| 14 | JPEG software for special applications or support machine-dependent | ||
| 15 | optimizations. Most users will not need to touch this file. | ||
| 16 | |||
| 17 | Source: Independent JPEG Group's software | ||
| 18 | |||
| 19 | Changes: no major functional changes | ||
| 20 | |||
| 21 | License: See the accompanying README file | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef JMORECFG_H | ||
| 25 | #define JMORECFG_H | ||
| 26 | |||
| 27 | |||
| 28 | #define CJPEG_WRBMP_GETJSAMPLE(value) ((int) (value)) | ||
| 29 | |||
| 30 | typedef unsigned char CJPEG_WRBMP_JSAMPLE; | ||
| 31 | typedef short CJPEG_WRBMP_JCOEF; | ||
| 32 | typedef unsigned char CJPEG_WRBMP_JOCTET; | ||
| 33 | |||
| 34 | /* These typedefs are used for various table entries and so forth. | ||
| 35 | They must be at least as wide as specified; but making them too big | ||
| 36 | won't cost a huge amount of memory, so we don't provide special | ||
| 37 | extraction code like we did for JSAMPLE. (In other words, these | ||
| 38 | typedefs live at a different point on the speed/space tradeoff curve.) | ||
| 39 | */ | ||
| 40 | |||
| 41 | /* UINT8 must hold at least the values 0..255. */ | ||
| 42 | |||
| 43 | typedef unsigned char CJPEG_WRBMP_UINT8; | ||
| 44 | |||
| 45 | |||
| 46 | /* UINT16 must hold at least the values 0..65535. */ | ||
| 47 | |||
| 48 | typedef unsigned short CJPEG_WRBMP_UINT16; | ||
| 49 | |||
| 50 | |||
| 51 | /* INT16 must hold at least the values -32768..32767. */ | ||
| 52 | |||
| 53 | #ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ | ||
| 54 | typedef short INT16; | ||
| 55 | #endif | ||
| 56 | |||
| 57 | /* INT32 must hold at least signed 32-bit values. */ | ||
| 58 | |||
| 59 | #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ | ||
| 60 | typedef long INT32; | ||
| 61 | #endif | ||
| 62 | |||
| 63 | typedef unsigned int CJPEG_WRBMP_JDIMENSION; | ||
| 64 | |||
| 65 | /* This macro is used to declare a "method", that is, a function pointer. | ||
| 66 | We want to supply prototype parameters if the compiler can cope. | ||
| 67 | Note that the arglist parameter must be parenthesized! | ||
| 68 | Again, you can customize this if you need special linkage keywords. | ||
| 69 | */ | ||
| 70 | |||
| 71 | #define EXTERN(type) extern type | ||
| 72 | |||
| 73 | #ifdef CJPEG_WRBMP_HAVE_PROTOTYPES | ||
| 74 | #define CJPEG_WRBMP_JMETHOD(type,methodname,arglist) type (*methodname) arglist | ||
| 75 | #else | ||
| 76 | #define CJPEG_WRBMP_JMETHOD(type,methodname,arglist) type (*methodname) () | ||
| 77 | #endif | ||
| 78 | |||
| 79 | |||
| 80 | /* Here is the pseudo-keyword for declaring pointers that must be "far" | ||
| 81 | on 80x86 machines. Most of the specialized coding for 80x86 is handled | ||
| 82 | by just saying "FAR *" where such a pointer is needed. In a few places | ||
| 83 | explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. | ||
| 84 | */ | ||
| 85 | |||
| 86 | #ifdef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS | ||
| 87 | #define CJPEG_WRBMP_FAR far | ||
| 88 | #else | ||
| 89 | #define CJPEG_WRBMP_FAR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef CJPEG_JPEG6B_WRBMP_HAVE_BOOLEAN | ||
| 93 | typedef int cjpeg_wrbmp_boolean; | ||
| 94 | #endif | ||
| 95 | #endif | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/jpeglib.h b/all_pairs/source/cjpeg_wrbmp/jpeglib.h new file mode 100644 index 0000000..ab3fba3 --- /dev/null +++ b/all_pairs/source/cjpeg_wrbmp/jpeglib.h | |||
| @@ -0,0 +1,869 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: jpeglib.h | ||
| 7 | |||
| 8 | Author: Thomas G. Lane. | ||
| 9 | |||
| 10 | This file is part of the Independent JPEG Group's software. | ||
| 11 | For conditions of distribution and use, see the accompanying README file. | ||
| 12 | |||
| 13 | This file defines the application interface for the JPEG library. | ||
| 14 | Most applications using the library need only include this file, | ||
| 15 | and perhaps jerror.h if they want to know the exact error codes. | ||
| 16 | |||
| 17 | Source: Independent JPEG Group's software | ||
| 18 | |||
| 19 | Changes: no major functional changes | ||
| 20 | |||
| 21 | License: See the accompanying README file | ||
| 22 | */ | ||
| 23 | |||
| 24 | |||
| 25 | #ifndef JPEGLIB_H | ||
| 26 | #define JPEGLIB_H | ||
| 27 | |||
| 28 | typedef int CJPEG_WRBMP_FILE; | ||
| 29 | typedef unsigned int cjpeg_wrbmp_size_x; | ||
| 30 | |||
| 31 | /* | ||
| 32 | First we include the configuration files that record how this | ||
| 33 | installation of the JPEG library is set up. jconfig.h can be | ||
| 34 | generated automatically for many systems. jmorecfg.h contains | ||
| 35 | manual configuration options that most people need not worry about. | ||
| 36 | */ | ||
| 37 | |||
| 38 | #ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ | ||
| 39 | #include "jconfig.h" /* widely used configuration options */ | ||
| 40 | #endif | ||
| 41 | #include "jmorecfg.h" /* seldom changed options */ | ||
| 42 | |||
| 43 | /* Data structures for images (arrays of samples and of DCT coefficients). | ||
| 44 | On 80x86 machines, the image arrays are too big for near pointers, | ||
| 45 | but the pointer arrays can fit in near memory. | ||
| 46 | */ | ||
| 47 | |||
| 48 | typedef CJPEG_WRBMP_JSAMPLE CJPEG_WRBMP_FAR | ||
| 49 | *CJPEG_WRBMP_JSAMPROW; /* ptr to one image row of pixel samples. */ | ||
| 50 | typedef CJPEG_WRBMP_JSAMPROW | ||
| 51 | *CJPEG_WRBMP_JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ | ||
| 52 | typedef CJPEG_WRBMP_JSAMPARRAY | ||
| 53 | *CJPEG_WRBMP_JSAMPIMAGE; /* a 3-D sample array: top index is color */ | ||
| 54 | |||
| 55 | typedef CJPEG_WRBMP_JCOEF | ||
| 56 | CJPEG_WRBMP_JBLOCK[64]; /* one block of coefficients */ | ||
| 57 | typedef CJPEG_WRBMP_JBLOCK CJPEG_WRBMP_FAR | ||
| 58 | *CJPEG_WRBMP_JBLOCKROW; /* pointer to one row of coefficient blocks */ | ||
| 59 | typedef CJPEG_WRBMP_JBLOCKROW | ||
| 60 | *CJPEG_WRBMP_JBLOCKARRAY; /* a 2-D array of coefficient blocks */ | ||
| 61 | typedef CJPEG_WRBMP_JBLOCKARRAY | ||
| 62 | *CJPEG_WRBMP_JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ | ||
| 63 | |||
| 64 | typedef CJPEG_WRBMP_JCOEF CJPEG_WRBMP_FAR | ||
| 65 | *JCOEFPTR; /* useful in a couple of places */ | ||
| 66 | |||
| 67 | |||
| 68 | /* Types for JPEG compression parameters and working tables. */ | ||
| 69 | |||
| 70 | |||
| 71 | /* DCT coefficient quantization tables. */ | ||
| 72 | |||
| 73 | typedef struct { | ||
| 74 | /* This array gives the coefficient quantizers in natural array order | ||
| 75 | (not the zigzag order in which they are stored in a JPEG DQT marker). | ||
| 76 | CAUTION: IJG versions prior to v6a kept this array in zigzag order. | ||
| 77 | */ | ||
| 78 | CJPEG_WRBMP_UINT16 | ||
| 79 | quantval[64]; /* quantization step for each coefficient */ | ||
| 80 | /* This field is used only during compression. It's initialized FALSE when | ||
| 81 | the table is created, and set TRUE when it's been output to the file. | ||
| 82 | You could suppress output of a table by setting this to TRUE. | ||
| 83 | (See jpeg_suppress_tables for an example.) | ||
| 84 | */ | ||
| 85 | cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */ | ||
| 86 | } CJPEG_WRBMP_JQUANT_TBL; | ||
| 87 | |||
| 88 | |||
| 89 | /* Huffman coding tables. */ | ||
| 90 | |||
| 91 | typedef struct { | ||
| 92 | /* These two fields directly represent the contents of a JPEG DHT marker */ | ||
| 93 | CJPEG_WRBMP_UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ | ||
| 94 | /* length k bits; bits[0] is unused */ | ||
| 95 | CJPEG_WRBMP_UINT8 | ||
| 96 | huffval[256]; /* The symbols, in order of incr code length */ | ||
| 97 | /* This field is used only during compression. It's initialized FALSE when | ||
| 98 | the table is created, and set TRUE when it's been output to the file. | ||
| 99 | You could suppress output of a table by setting this to TRUE. | ||
| 100 | (See jpeg_suppress_tables for an example.) | ||
| 101 | */ | ||
| 102 | cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */ | ||
| 103 | } CJPEG_WRBMP_JHUFF_TBL; | ||
| 104 | |||
| 105 | |||
| 106 | /* Basic info about one component (color channel). */ | ||
| 107 | |||
| 108 | typedef struct { | ||
| 109 | /* These values are fixed over the whole image. */ | ||
| 110 | /* For compression, they must be supplied by parameter setup; */ | ||
| 111 | /* for decompression, they are read from the SOF marker. */ | ||
| 112 | int component_id; /* identifier for this component (0..255) */ | ||
| 113 | int component_index; /* its index in SOF or cinfo->comp_info[] */ | ||
| 114 | int h_samp_factor; /* horizontal sampling factor (1..4) */ | ||
| 115 | int v_samp_factor; /* vertical sampling factor (1..4) */ | ||
| 116 | int quant_tbl_no; /* quantization table selector (0..3) */ | ||
| 117 | /* These values may vary between scans. */ | ||
| 118 | /* For compression, they must be supplied by parameter setup; */ | ||
| 119 | /* for decompression, they are read from the SOS marker. */ | ||
| 120 | /* The decompressor output side may not use these variables. */ | ||
| 121 | int dc_tbl_no; /* DC entropy table selector (0..3) */ | ||
| 122 | int ac_tbl_no; /* AC entropy table selector (0..3) */ | ||
| 123 | |||
| 124 | /* Remaining fields should be treated as private by applications. */ | ||
| 125 | |||
| 126 | /* These values are computed during compression or decompression startup: */ | ||
| 127 | /* Component's size in DCT blocks. | ||
| 128 | Any dummy blocks added to complete an MCU are not counted; therefore | ||
| 129 | these values do not depend on whether a scan is interleaved or not. | ||
| 130 | */ | ||
| 131 | CJPEG_WRBMP_JDIMENSION width_in_blocks; | ||
| 132 | CJPEG_WRBMP_JDIMENSION height_in_blocks; | ||
| 133 | /* Size of a DCT block in samples. Always DCTSIZE for compression. | ||
| 134 | For decompression this is the size of the output from one DCT block, | ||
| 135 | reflecting any scaling we choose to apply during the IDCT step. | ||
| 136 | Values of 1,2,4,8 are likely to be supported. Note that different | ||
| 137 | components may receive different IDCT scalings. | ||
| 138 | */ | ||
| 139 | int DCT_scaled_size; | ||
| 140 | /* The downsampled dimensions are the component's actual, unpadded number | ||
| 141 | of samples at the main buffer (preprocessing/compression interface), thus | ||
| 142 | downsampled_width = ceil(image_width * Hi/Hmax) | ||
| 143 | and similarly for height. For decompression, IDCT scaling is included, so | ||
| 144 | downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE) | ||
| 145 | */ | ||
| 146 | CJPEG_WRBMP_JDIMENSION downsampled_width; /* actual width in samples */ | ||
| 147 | CJPEG_WRBMP_JDIMENSION downsampled_height; /* actual height in samples */ | ||
| 148 | /* This flag is used only for decompression. In cases where some of the | ||
| 149 | components will be ignored (eg grayscale output from YCbCr image), | ||
| 150 | we can skip most computations for the unused components. | ||
| 151 | */ | ||
| 152 | cjpeg_wrbmp_boolean | ||
| 153 | component_needed; /* do we need the value of this component? */ | ||
| 154 | |||
| 155 | /* These values are computed before starting a scan of the component. */ | ||
| 156 | /* The decompressor output side may not use these variables. */ | ||
| 157 | int MCU_width; /* number of blocks per MCU, horizontally */ | ||
| 158 | int MCU_height; /* number of blocks per MCU, vertically */ | ||
| 159 | int MCU_blocks; /* MCU_width * MCU_height */ | ||
| 160 | int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */ | ||
| 161 | int last_col_width; /* # of non-dummy blocks across in last MCU */ | ||
| 162 | int last_row_height; /* # of non-dummy blocks down in last MCU */ | ||
| 163 | |||
| 164 | /* Saved quantization table for component; NULL if none yet saved. | ||
| 165 | See jdinput.c comments about the need for this information. | ||
| 166 | This field is currently used only for decompression. | ||
| 167 | */ | ||
| 168 | CJPEG_WRBMP_JQUANT_TBL *quant_table; | ||
| 169 | |||
| 170 | /* Private per-component storage for DCT or IDCT subsystem. */ | ||
| 171 | void *dct_table; | ||
| 172 | } cjpeg_wrbmp_jpeg_component_info; | ||
| 173 | |||
| 174 | |||
| 175 | /* The script for encoding a multiple-scan file is an array of these: */ | ||
| 176 | |||
| 177 | typedef struct { | ||
| 178 | int comps_in_scan; /* number of components encoded in this scan */ | ||
| 179 | int component_index[4]; /* their SOF/comp_info[] indexes */ | ||
| 180 | int Ss, Se; /* progressive JPEG spectral selection parms */ | ||
| 181 | int Ah, Al; /* progressive JPEG successive approx. parms */ | ||
| 182 | } cjpeg_wrbmp_jpeg_scan_info; | ||
| 183 | |||
| 184 | /* The decompressor can save APPn and COM markers in a list of these: */ | ||
| 185 | |||
| 186 | typedef struct cjpeg_wrbmp_jpeg_marker_struct CJPEG_WRBMP_FAR | ||
| 187 | *jpeg_saved_marker_ptr; | ||
| 188 | |||
| 189 | struct cjpeg_wrbmp_jpeg_marker_struct { | ||
| 190 | jpeg_saved_marker_ptr next; /* next in list, or NULL */ | ||
| 191 | CJPEG_WRBMP_UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ | ||
| 192 | unsigned int original_length; /* # bytes of data in the file */ | ||
| 193 | unsigned int data_length; /* # bytes of data saved at data[] */ | ||
| 194 | CJPEG_WRBMP_JOCTET CJPEG_WRBMP_FAR | ||
| 195 | *data; /* the data contained in the marker */ | ||
| 196 | /* the marker length word is not counted in data_length or original_length */ | ||
| 197 | }; | ||
| 198 | |||
| 199 | /* Known color spaces. */ | ||
| 200 | |||
| 201 | typedef enum { | ||
| 202 | JCS_UNKNOWN, /* error/unspecified */ | ||
| 203 | JCS_GRAYSCALE, /* monochrome */ | ||
| 204 | JCS_RGB, /* red/green/blue */ | ||
| 205 | JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ | ||
| 206 | JCS_CMYK, /* C/M/Y/K */ | ||
| 207 | JCS_YCCK /* Y/Cb/Cr/K */ | ||
| 208 | } CJPEG_WRBMP_J_COLOR_SPACE; | ||
| 209 | |||
| 210 | /* DCT/IDCT algorithm options. */ | ||
| 211 | |||
| 212 | typedef enum { | ||
| 213 | JDCT_ISLOW, /* slow but accurate integer algorithm */ | ||
| 214 | JDCT_IFAST, /* faster, less accurate integer method */ | ||
| 215 | JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ | ||
| 216 | } CJPEG_WRBMP_J_DCT_METHOD; | ||
| 217 | |||
| 218 | /* Dithering options for decompression. */ | ||
| 219 | |||
| 220 | typedef enum { | ||
| 221 | JDITHER_NONE, /* no dithering */ | ||
| 222 | JDITHER_ORDERED, /* simple ordered dither */ | ||
| 223 | JDITHER_FS /* Floyd-Steinberg error diffusion dither */ | ||
| 224 | } CJPEG_WRBMP_J_DITHER_MODE; | ||
| 225 | |||
| 226 | |||
| 227 | /* Common fields between JPEG compression and decompression master structs. */ | ||
| 228 | |||
| 229 | #define cjpeg_wrbmp_jpeg_common_fields \ | ||
| 230 | struct cjpeg_wrbmp_jpeg_error_mgr * err; /* Error handler module */\ | ||
| 231 | struct cjpeg_wrbmp_jpeg_memory_mgr * mem; /* Memory manager module */\ | ||
| 232 | struct cjpeg_wrbmp_jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ | ||
| 233 | void * client_data; /* Available for use by application */\ | ||
| 234 | cjpeg_wrbmp_boolean is_decompressor; /* So common code can tell which is which */\ | ||
| 235 | int global_state /* For checking call sequence validity */ | ||
| 236 | |||
| 237 | /* Routines that are to be used by both halves of the library are declared | ||
| 238 | to receive a pointer to this structure. There are no actual instances of | ||
| 239 | jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. | ||
| 240 | */ | ||
| 241 | struct cjpeg_wrbmp_jpeg_common_struct { | ||
| 242 | cjpeg_wrbmp_jpeg_common_fields; /* Fields common to both master struct types */ | ||
| 243 | /* Additional fields follow in an actual jpeg_compress_struct or | ||
| 244 | jpeg_decompress_struct. All three structs must agree on these | ||
| 245 | initial fields! (This would be a lot cleaner in C++.) | ||
| 246 | */ | ||
| 247 | }; | ||
| 248 | |||
| 249 | typedef struct cjpeg_wrbmp_jpeg_common_struct | ||
| 250 | *cjpeg_wrbmp_j_common_ptr; | ||
| 251 | typedef struct cjpeg_wrbmp_jpeg_compress_struct | ||
| 252 | *cjpeg_wrbmp_j_compress_ptr; | ||
| 253 | typedef struct cjpeg_wrbmp_jpeg_decompress_struct | ||
| 254 | *cjpeg_wrbmp_j_decompress_ptr; | ||
| 255 | |||
| 256 | |||
| 257 | /* Master record for a compression instance */ | ||
| 258 | |||
| 259 | struct cjpeg_wrbmp_jpeg_compress_struct { | ||
| 260 | cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ | ||
| 261 | |||
| 262 | /* Destination for compressed data */ | ||
| 263 | struct cjpeg_wrbmp_jpeg_destination_mgr *dest; | ||
| 264 | |||
| 265 | /* Description of source image --- these fields must be filled in by | ||
| 266 | outer application before starting compression. in_color_space must | ||
| 267 | be correct before you can even call jpeg_set_defaults(). | ||
| 268 | */ | ||
| 269 | |||
| 270 | CJPEG_WRBMP_JDIMENSION image_width; /* input image width */ | ||
| 271 | CJPEG_WRBMP_JDIMENSION image_height; /* input image height */ | ||
| 272 | int input_components; /* # of color components in input image */ | ||
| 273 | CJPEG_WRBMP_J_COLOR_SPACE in_color_space; /* colorspace of input image */ | ||
| 274 | |||
| 275 | float input_gamma; /* image gamma of input image */ | ||
| 276 | |||
| 277 | /* Compression parameters --- these fields must be set before calling | ||
| 278 | jpeg_start_compress(). We recommend calling jpeg_set_defaults() to | ||
| 279 | initialize everything to reasonable defaults, then changing anything | ||
| 280 | the application specifically wants to change. That way you won't get | ||
| 281 | burnt when new parameters are added. Also note that there are several | ||
| 282 | helper routines to simplify changing parameters. | ||
| 283 | */ | ||
| 284 | |||
| 285 | int data_precision; /* bits of precision in image data */ | ||
| 286 | |||
| 287 | int num_components; /* # of color components in JPEG image */ | ||
| 288 | CJPEG_WRBMP_J_COLOR_SPACE | ||
| 289 | jpeg_color_space; /* colorspace of JPEG image */ | ||
| 290 | |||
| 291 | cjpeg_wrbmp_jpeg_component_info *comp_info; | ||
| 292 | /* comp_info[i] describes component that appears i'th in SOF */ | ||
| 293 | |||
| 294 | CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4]; | ||
| 295 | /* ptrs to coefficient quantization tables, or NULL if not defined */ | ||
| 296 | |||
| 297 | CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4]; | ||
| 298 | CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4]; | ||
| 299 | /* ptrs to Huffman coding tables, or NULL if not defined */ | ||
| 300 | |||
| 301 | CJPEG_WRBMP_UINT8 | ||
| 302 | arith_dc_L[16]; /* L values for DC arith-coding tables */ | ||
| 303 | CJPEG_WRBMP_UINT8 | ||
| 304 | arith_dc_U[16]; /* U values for DC arith-coding tables */ | ||
| 305 | CJPEG_WRBMP_UINT8 | ||
| 306 | arith_ac_K[16]; /* Kx values for AC arith-coding tables */ | ||
| 307 | |||
| 308 | int num_scans; /* # of entries in scan_info array */ | ||
| 309 | const cjpeg_wrbmp_jpeg_scan_info | ||
| 310 | *scan_info; /* script for multi-scan file, or NULL */ | ||
| 311 | /* The default value of scan_info is NULL, which causes a single-scan | ||
| 312 | sequential JPEG file to be emitted. To create a multi-scan file, | ||
| 313 | set num_scans and scan_info to point to an array of scan definitions. | ||
| 314 | */ | ||
| 315 | |||
| 316 | cjpeg_wrbmp_boolean | ||
| 317 | raw_data_in; /* TRUE=caller supplies downsampled data */ | ||
| 318 | cjpeg_wrbmp_boolean | ||
| 319 | arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ | ||
| 320 | cjpeg_wrbmp_boolean | ||
| 321 | optimize_coding; /* TRUE=optimize entropy encoding parms */ | ||
| 322 | cjpeg_wrbmp_boolean | ||
| 323 | CCIR601_sampling; /* TRUE=first samples are cosited */ | ||
| 324 | int smoothing_factor; /* 1..100, or 0 for no input smoothing */ | ||
| 325 | CJPEG_WRBMP_J_DCT_METHOD dct_method; /* DCT algorithm selector */ | ||
| 326 | |||
| 327 | /* The restart interval can be specified in absolute MCUs by setting | ||
| 328 | restart_interval, or in MCU rows by setting restart_in_rows | ||
| 329 | (in which case the correct restart_interval will be figured | ||
| 330 | for each scan). | ||
| 331 | */ | ||
| 332 | unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ | ||
| 333 | int restart_in_rows; /* if > 0, MCU rows per restart interval */ | ||
| 334 | |||
| 335 | /* Parameters controlling emission of special markers. */ | ||
| 336 | |||
| 337 | cjpeg_wrbmp_boolean | ||
| 338 | write_JFIF_header; /* should a JFIF marker be written? */ | ||
| 339 | CJPEG_WRBMP_UINT8 | ||
| 340 | JFIF_major_version; /* What to write for the JFIF version number */ | ||
| 341 | CJPEG_WRBMP_UINT8 JFIF_minor_version; | ||
| 342 | /* These three values are not used by the JPEG code, merely copied */ | ||
| 343 | /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ | ||
| 344 | /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ | ||
| 345 | /* ratio is defined by X_density/Y_density even when density_unit=0. */ | ||
| 346 | CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */ | ||
| 347 | CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */ | ||
| 348 | CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */ | ||
| 349 | cjpeg_wrbmp_boolean | ||
| 350 | write_Adobe_marker; /* should an Adobe marker be written? */ | ||
| 351 | |||
| 352 | /* State variable: index of next scanline to be written to | ||
| 353 | jpeg_write_scanlines(). Application may use this to control its | ||
| 354 | processing loop, e.g., "while (next_scanline < image_height)". | ||
| 355 | */ | ||
| 356 | |||
| 357 | CJPEG_WRBMP_JDIMENSION next_scanline; /* 0 .. image_height-1 */ | ||
| 358 | |||
| 359 | /* Remaining fields are known throughout compressor, but generally | ||
| 360 | should not be touched by a surrounding application. | ||
| 361 | */ | ||
| 362 | |||
| 363 | /* | ||
| 364 | These fields are computed during compression startup | ||
| 365 | */ | ||
| 366 | cjpeg_wrbmp_boolean | ||
| 367 | progressive_mode; /* TRUE if scan script uses progressive mode */ | ||
| 368 | int max_h_samp_factor; /* largest h_samp_factor */ | ||
| 369 | int max_v_samp_factor; /* largest v_samp_factor */ | ||
| 370 | |||
| 371 | CJPEG_WRBMP_JDIMENSION | ||
| 372 | total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ | ||
| 373 | /* The coefficient controller receives data in units of MCU rows as defined | ||
| 374 | for fully interleaved scans (whether the JPEG file is interleaved or not). | ||
| 375 | There are v_samp_factor * DCTSIZE sample rows of each component in an | ||
| 376 | "iMCU" (interleaved MCU) row. | ||
| 377 | */ | ||
| 378 | |||
| 379 | /* | ||
| 380 | These fields are valid during any one scan. | ||
| 381 | They describe the components and MCUs actually appearing in the scan. | ||
| 382 | */ | ||
| 383 | int comps_in_scan; /* # of JPEG components in this scan */ | ||
| 384 | cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4]; | ||
| 385 | /* *cur_comp_info[i] describes component that appears i'th in SOS */ | ||
| 386 | |||
| 387 | CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */ | ||
| 388 | CJPEG_WRBMP_JDIMENSION | ||
| 389 | MCU_rows_in_scan; /* # of MCU rows in the image */ | ||
| 390 | |||
| 391 | int blocks_in_MCU; /* # of DCT blocks per MCU */ | ||
| 392 | int MCU_membership[10]; | ||
| 393 | /* MCU_membership[i] is index in cur_comp_info of component owning */ | ||
| 394 | /* i'th block in an MCU */ | ||
| 395 | |||
| 396 | int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ | ||
| 397 | |||
| 398 | cjpeg_wrbmp_jpeg_scan_info | ||
| 399 | *script_space; /* workspace for jpeg_simple_progression */ | ||
| 400 | int script_space_size; | ||
| 401 | }; | ||
| 402 | |||
| 403 | |||
| 404 | /* Master record for a decompression instance */ | ||
| 405 | |||
| 406 | struct cjpeg_wrbmp_jpeg_decompress_struct { | ||
| 407 | cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ | ||
| 408 | |||
| 409 | /* Source of compressed data */ | ||
| 410 | struct cjpeg_wrbmp_jpeg_source_mgr *src; | ||
| 411 | |||
| 412 | /* Basic description of image --- filled in by jpeg_read_header(). */ | ||
| 413 | /* Application may inspect these values to decide how to process image. */ | ||
| 414 | |||
| 415 | CJPEG_WRBMP_JDIMENSION | ||
| 416 | image_width; /* nominal image width (from SOF marker) */ | ||
| 417 | CJPEG_WRBMP_JDIMENSION image_height; /* nominal image height */ | ||
| 418 | int num_components; /* # of color components in JPEG image */ | ||
| 419 | CJPEG_WRBMP_J_COLOR_SPACE | ||
| 420 | jpeg_color_space; /* colorspace of JPEG image */ | ||
| 421 | |||
| 422 | /* Decompression processing parameters --- these fields must be set before | ||
| 423 | calling jpeg_start_decompress(). Note that jpeg_read_header() initializes | ||
| 424 | them to default values. | ||
| 425 | */ | ||
| 426 | |||
| 427 | CJPEG_WRBMP_J_COLOR_SPACE out_color_space; /* colorspace for output */ | ||
| 428 | |||
| 429 | unsigned int scale_num, scale_denom; /* fraction by which to scale image */ | ||
| 430 | |||
| 431 | float output_gamma; /* image gamma wanted in output */ | ||
| 432 | |||
| 433 | cjpeg_wrbmp_boolean buffered_image; /* TRUE=multiple output passes */ | ||
| 434 | cjpeg_wrbmp_boolean raw_data_out; /* TRUE=downsampled data wanted */ | ||
| 435 | |||
| 436 | CJPEG_WRBMP_J_DCT_METHOD dct_method; /* IDCT algorithm selector */ | ||
| 437 | cjpeg_wrbmp_boolean | ||
| 438 | do_fancy_upsampling; /* TRUE=apply fancy upsampling */ | ||
| 439 | cjpeg_wrbmp_boolean | ||
| 440 | do_block_smoothing; /* TRUE=apply interblock smoothing */ | ||
| 441 | |||
| 442 | cjpeg_wrbmp_boolean | ||
| 443 | quantize_colors; /* TRUE=colormapped output wanted */ | ||
| 444 | /* the following are ignored if not quantize_colors: */ | ||
| 445 | CJPEG_WRBMP_J_DITHER_MODE | ||
| 446 | dither_mode; /* type of color dithering to use */ | ||
| 447 | cjpeg_wrbmp_boolean | ||
| 448 | two_pass_quantize; /* TRUE=use two-pass color quantization */ | ||
| 449 | int desired_number_of_colors; /* max # colors to use in created colormap */ | ||
| 450 | /* these are significant only in buffered-image mode: */ | ||
| 451 | cjpeg_wrbmp_boolean | ||
| 452 | enable_1pass_quant; /* enable future use of 1-pass quantizer */ | ||
| 453 | cjpeg_wrbmp_boolean | ||
| 454 | enable_EXTERNal_quant;/* enable future use of EXTERNal colormap */ | ||
| 455 | cjpeg_wrbmp_boolean | ||
| 456 | enable_2pass_quant; /* enable future use of 2-pass quantizer */ | ||
| 457 | |||
| 458 | /* Description of actual output image that will be returned to application. | ||
| 459 | These fields are computed by jpeg_start_decompress(). | ||
| 460 | You can also use jpeg_calc_output_dimensions() to determine these values | ||
| 461 | in advance of calling jpeg_start_decompress(). | ||
| 462 | */ | ||
| 463 | |||
| 464 | CJPEG_WRBMP_JDIMENSION output_width; /* scaled image width */ | ||
| 465 | CJPEG_WRBMP_JDIMENSION output_height; /* scaled image height */ | ||
| 466 | int out_color_components; /* # of color components in out_color_space */ | ||
| 467 | int output_components; /* # of color components returned */ | ||
| 468 | /* output_components is 1 (a colormap index) when quantizing colors; | ||
| 469 | otherwise it equals out_color_components. | ||
| 470 | */ | ||
| 471 | int rec_outbuf_height; /* min recommended height of scanline buffer */ | ||
| 472 | /* If the buffer passed to jpeg_read_scanlines() is less than this many rows | ||
| 473 | high, space and time will be wasted due to unnecessary data copying. | ||
| 474 | Usually rec_outbuf_height will be 1 or 2, at most 4. | ||
| 475 | */ | ||
| 476 | |||
| 477 | /* When quantizing colors, the output colormap is described by these fields. | ||
| 478 | The application can supply a colormap by setting colormap non-NULL before | ||
| 479 | calling jpeg_start_decompress; otherwise a colormap is created during | ||
| 480 | jpeg_start_decompress or jpeg_start_output. | ||
| 481 | The map has out_color_components rows and actual_number_of_colors columns. | ||
| 482 | */ | ||
| 483 | int actual_number_of_colors; /* number of entries in use */ | ||
| 484 | CJPEG_WRBMP_JSAMPARRAY | ||
| 485 | colormap; /* The color map as a 2-D pixel array */ | ||
| 486 | |||
| 487 | /* State variables: these variables indicate the progress of decompression. | ||
| 488 | The application may examine these but must not modify them. | ||
| 489 | */ | ||
| 490 | |||
| 491 | /* Row index of next scanline to be read from jpeg_read_scanlines(). | ||
| 492 | Application may use this to control its processing loop, e.g., | ||
| 493 | "while (output_scanline < output_height)". | ||
| 494 | */ | ||
| 495 | CJPEG_WRBMP_JDIMENSION output_scanline; /* 0 .. output_height-1 */ | ||
| 496 | |||
| 497 | /* Current input scan number and number of iMCU rows completed in scan. | ||
| 498 | These indicate the progress of the decompressor input side. | ||
| 499 | */ | ||
| 500 | int input_scan_number; /* Number of SOS markers seen so far */ | ||
| 501 | CJPEG_WRBMP_JDIMENSION | ||
| 502 | input_iMCU_row; /* Number of iMCU rows completed */ | ||
| 503 | |||
| 504 | /* The "output scan number" is the notional scan being displayed by the | ||
| 505 | output side. The decompressor will not allow output scan/row number | ||
| 506 | to get ahead of input scan/row, but it can fall arbitrarily far behind. | ||
| 507 | */ | ||
| 508 | int output_scan_number; /* Nominal scan number being displayed */ | ||
| 509 | CJPEG_WRBMP_JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ | ||
| 510 | |||
| 511 | /* Current progression status. coef_bits[c][i] indicates the precision | ||
| 512 | with which component c's DCT coefficient i (in zigzag order) is known. | ||
| 513 | It is -1 when no data has yet been received, otherwise it is the point | ||
| 514 | transform (shift) value for the most recent scan of the coefficient | ||
| 515 | (thus, 0 at completion of the progression). | ||
| 516 | This pointer is NULL when reading a non-progressive file. | ||
| 517 | */ | ||
| 518 | int ( *coef_bits )[64]; /* -1 or current Al value for each coef */ | ||
| 519 | |||
| 520 | /* Internal JPEG parameters --- the application usually need not look at | ||
| 521 | these fields. Note that the decompressor output side may not use | ||
| 522 | any parameters that can change between scans. | ||
| 523 | */ | ||
| 524 | |||
| 525 | /* Quantization and Huffman tables are carried forward across input | ||
| 526 | datastreams when processing abbreviated JPEG datastreams. | ||
| 527 | */ | ||
| 528 | |||
| 529 | CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4]; | ||
| 530 | /* ptrs to coefficient quantization tables, or NULL if not defined */ | ||
| 531 | |||
| 532 | CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4]; | ||
| 533 | CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4]; | ||
| 534 | /* ptrs to Huffman coding tables, or NULL if not defined */ | ||
| 535 | |||
| 536 | /* These parameters are never carried across datastreams, since they | ||
| 537 | are given in SOF/SOS markers or defined to be reset by SOI. | ||
| 538 | */ | ||
| 539 | |||
| 540 | int data_precision; /* bits of precision in image data */ | ||
| 541 | |||
| 542 | cjpeg_wrbmp_jpeg_component_info *comp_info; | ||
| 543 | /* comp_info[i] describes component that appears i'th in SOF */ | ||
| 544 | |||
| 545 | cjpeg_wrbmp_boolean | ||
| 546 | progressive_mode; /* TRUE if SOFn specifies progressive mode */ | ||
| 547 | cjpeg_wrbmp_boolean | ||
| 548 | arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ | ||
| 549 | |||
| 550 | CJPEG_WRBMP_UINT8 | ||
| 551 | arith_dc_L[16]; /* L values for DC arith-coding tables */ | ||
| 552 | CJPEG_WRBMP_UINT8 | ||
| 553 | arith_dc_U[16]; /* U values for DC arith-coding tables */ | ||
| 554 | CJPEG_WRBMP_UINT8 | ||
| 555 | arith_ac_K[16]; /* Kx values for AC arith-coding tables */ | ||
| 556 | |||
| 557 | unsigned int | ||
| 558 | restart_interval; /* MCUs per restart interval, or 0 for no restart */ | ||
| 559 | |||
| 560 | /* These fields record data obtained from optional markers recognized by | ||
| 561 | the JPEG library. | ||
| 562 | */ | ||
| 563 | cjpeg_wrbmp_boolean | ||
| 564 | saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ | ||
| 565 | /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ | ||
| 566 | CJPEG_WRBMP_UINT8 JFIF_major_version; /* JFIF version number */ | ||
| 567 | CJPEG_WRBMP_UINT8 JFIF_minor_version; | ||
| 568 | CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */ | ||
| 569 | CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */ | ||
| 570 | CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */ | ||
| 571 | cjpeg_wrbmp_boolean | ||
| 572 | saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ | ||
| 573 | CJPEG_WRBMP_UINT8 | ||
| 574 | Adobe_transform; /* Color transform code from Adobe marker */ | ||
| 575 | |||
| 576 | cjpeg_wrbmp_boolean | ||
| 577 | CCIR601_sampling; /* TRUE=first samples are cosited */ | ||
| 578 | |||
| 579 | /* Aside from the specific data retained from APPn markers known to the | ||
| 580 | library, the uninterpreted contents of any or all APPn and COM markers | ||
| 581 | can be saved in a list for examination by the application. | ||
| 582 | */ | ||
| 583 | jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ | ||
| 584 | |||
| 585 | /* Remaining fields are known throughout decompressor, but generally | ||
| 586 | should not be touched by a surrounding application. | ||
| 587 | */ | ||
| 588 | |||
| 589 | /* | ||
| 590 | These fields are computed during decompression startup | ||
| 591 | */ | ||
| 592 | int max_h_samp_factor; /* largest h_samp_factor */ | ||
| 593 | int max_v_samp_factor; /* largest v_samp_factor */ | ||
| 594 | |||
| 595 | int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ | ||
| 596 | |||
| 597 | CJPEG_WRBMP_JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ | ||
| 598 | /* The coefficient controller's input and output progress is measured in | ||
| 599 | units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows | ||
| 600 | in fully interleaved JPEG scans, but are used whether the scan is | ||
| 601 | interleaved or not. We define an iMCU row as v_samp_factor DCT block | ||
| 602 | rows of each component. Therefore, the IDCT output contains | ||
| 603 | v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row. | ||
| 604 | */ | ||
| 605 | |||
| 606 | CJPEG_WRBMP_JSAMPLE | ||
| 607 | *sample_range_limit; /* table for fast range-limiting */ | ||
| 608 | |||
| 609 | /* | ||
| 610 | These fields are valid during any one scan. | ||
| 611 | They describe the components and MCUs actually appearing in the scan. | ||
| 612 | Note that the decompressor output side must not use these fields. | ||
| 613 | */ | ||
| 614 | int comps_in_scan; /* # of JPEG components in this scan */ | ||
| 615 | cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4]; | ||
| 616 | /* *cur_comp_info[i] describes component that appears i'th in SOS */ | ||
| 617 | |||
| 618 | CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */ | ||
| 619 | CJPEG_WRBMP_JDIMENSION | ||
| 620 | MCU_rows_in_scan; /* # of MCU rows in the image */ | ||
| 621 | |||
| 622 | int blocks_in_MCU; /* # of DCT blocks per MCU */ | ||
| 623 | int MCU_membership[10]; | ||
| 624 | /* MCU_membership[i] is index in cur_comp_info of component owning */ | ||
| 625 | /* i'th block in an MCU */ | ||
| 626 | |||
| 627 | int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ | ||
| 628 | |||
| 629 | /* This field is shared between entropy decoder and marker parser. | ||
| 630 | It is either zero or the code of a JPEG marker that has been | ||
| 631 | read from the data source, but has not yet been processed. | ||
| 632 | */ | ||
| 633 | int unread_marker; | ||
| 634 | |||
| 635 | /* | ||
| 636 | Links to decompression subobjects (methods, private variables of modules) | ||
| 637 | */ | ||
| 638 | struct jpeg_decomp_master *master; | ||
| 639 | struct jpeg_d_main_controller *main; | ||
| 640 | struct jpeg_d_coef_controller *coef; | ||
| 641 | struct jpeg_d_post_controller *post; | ||
| 642 | struct jpeg_input_controller *inputctl; | ||
| 643 | struct jpeg_marker_reader *marker; | ||
| 644 | struct jpeg_entropy_decoder *entropy; | ||
| 645 | struct jpeg_inverse_dct *idct; | ||
| 646 | struct jpeg_upsampler *upsample; | ||
| 647 | struct jpeg_color_deconverter *cconvert; | ||
| 648 | struct jpeg_color_quantizer *cquantize; | ||
| 649 | }; | ||
| 650 | |||
| 651 | |||
| 652 | /* "Object" declarations for JPEG modules that may be supplied or called | ||
| 653 | directly by the surrounding application. | ||
| 654 | As with all objects in the JPEG library, these structs only define the | ||
| 655 | publicly visible methods and state variables of a module. Additional | ||
| 656 | private fields may exist after the public ones. | ||
| 657 | */ | ||
| 658 | |||
| 659 | |||
| 660 | /* Error handler object */ | ||
| 661 | |||
| 662 | struct cjpeg_wrbmp_jpeg_error_mgr { | ||
| 663 | /* Error exit handler: does not return to caller */ | ||
| 664 | CJPEG_WRBMP_JMETHOD( void, error_exit, | ||
| 665 | ( cjpeg_wrbmp_j_common_ptr cinfo ) ); | ||
| 666 | /* Conditionally emit a trace or warning message */ | ||
| 667 | CJPEG_WRBMP_JMETHOD( void, emit_message, | ||
| 668 | ( cjpeg_wrbmp_j_common_ptr cinfo, int msg_level ) ); | ||
| 669 | /* Routine that actually outputs a trace or error message */ | ||
| 670 | CJPEG_WRBMP_JMETHOD( void, output_message, | ||
| 671 | ( cjpeg_wrbmp_j_common_ptr cinfo ) ); | ||
| 672 | /* Format a message string for the most recent JPEG error or message */ | ||
| 673 | CJPEG_WRBMP_JMETHOD( void, format_message, | ||
| 674 | ( cjpeg_wrbmp_j_common_ptr cinfo, char *buffer ) ); | ||
| 675 | #define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ | ||
| 676 | /* Reset error state variables at start of a new image */ | ||
| 677 | CJPEG_WRBMP_JMETHOD( void, reset_error_mgr, | ||
| 678 | ( cjpeg_wrbmp_j_common_ptr cinfo ) ); | ||
| 679 | |||
| 680 | /* The message ID code and any parameters are saved here. | ||
| 681 | A message can have one string parameter or up to 8 int parameters. | ||
| 682 | */ | ||
| 683 | int msg_code; | ||
| 684 | #define JMSG_STR_PARM_MAX 80 | ||
| 685 | /* | ||
| 686 | union { | ||
| 687 | int i[8]; | ||
| 688 | char s[JMSG_STR_PARM_MAX]; | ||
| 689 | } msg_parm; | ||
| 690 | */ | ||
| 691 | /* Standard state variables for error facility */ | ||
| 692 | |||
| 693 | int trace_level; /* max msg_level that will be displayed */ | ||
| 694 | |||
| 695 | /* For recoverable corrupt-data errors, we emit a warning message, | ||
| 696 | but keep going unless emit_message chooses to abort. emit_message | ||
| 697 | should count warnings in num_warnings. The surrounding application | ||
| 698 | can check for bad data by seeing if num_warnings is nonzero at the | ||
| 699 | end of processing. | ||
| 700 | */ | ||
| 701 | long num_warnings; /* number of corrupt-data warnings */ | ||
| 702 | |||
| 703 | /* These fields point to the table(s) of error message strings. | ||
| 704 | An application can change the table pointer to switch to a different | ||
| 705 | message list (typically, to change the language in which errors are | ||
| 706 | reported). Some applications may wish to add additional error codes | ||
| 707 | that will be handled by the JPEG library error mechanism; the second | ||
| 708 | table pointer is used for this purpose. | ||
| 709 | |||
| 710 | First table includes all errors generated by JPEG library itself. | ||
| 711 | Error code 0 is reserved for a "no such error string" message. | ||
| 712 | */ | ||
| 713 | const char *const *jpeg_message_table; /* Library errors */ | ||
| 714 | int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ | ||
| 715 | /* Second table can be added by application (see cjpeg/djpeg for example). | ||
| 716 | It contains strings numbered first_addon_message..last_addon_message. | ||
| 717 | */ | ||
| 718 | const char *const *addon_message_table; /* Non-library errors */ | ||
| 719 | int first_addon_message; /* code for first string in addon table */ | ||
| 720 | int last_addon_message; /* code for last string in addon table */ | ||
| 721 | }; | ||
| 722 | |||
| 723 | |||
| 724 | /* Progress monitor object */ | ||
| 725 | |||
| 726 | struct cjpeg_wrbmp_jpeg_progress_mgr { | ||
| 727 | CJPEG_WRBMP_JMETHOD( void, progress_monitor, | ||
| 728 | ( cjpeg_wrbmp_j_common_ptr cinfo ) ); | ||
| 729 | |||
| 730 | long pass_counter; /* work units completed in this pass */ | ||
| 731 | long pass_limit; /* total number of work units in this pass */ | ||
| 732 | int completed_passes; /* passes completed so far */ | ||
| 733 | int total_passes; /* total number of passes expected */ | ||
| 734 | }; | ||
| 735 | |||
| 736 | |||
| 737 | /* Data destination object for compression */ | ||
| 738 | |||
| 739 | struct cjpeg_wrbmp_jpeg_destination_mgr { | ||
| 740 | CJPEG_WRBMP_JOCTET | ||
| 741 | *next_output_byte; /* => next byte to write in buffer */ | ||
| 742 | cjpeg_wrbmp_size_x | ||
| 743 | free_in_buffer; /* # of byte spaces remaining in buffer */ | ||
| 744 | |||
| 745 | CJPEG_WRBMP_JMETHOD( void, init_destination, | ||
| 746 | ( cjpeg_wrbmp_j_compress_ptr cinfo ) ); | ||
| 747 | CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean, empty_output_buffer, | ||
| 748 | ( cjpeg_wrbmp_j_compress_ptr cinfo ) ); | ||
| 749 | CJPEG_WRBMP_JMETHOD( void, term_destination, | ||
| 750 | ( cjpeg_wrbmp_j_compress_ptr cinfo ) ); | ||
| 751 | }; | ||
| 752 | |||
| 753 | |||
| 754 | /* Data source object for decompression */ | ||
| 755 | |||
| 756 | struct cjpeg_wrbmp_jpeg_source_mgr { | ||
| 757 | const CJPEG_WRBMP_JOCTET | ||
| 758 | *next_input_byte; /* => next byte to read from buffer */ | ||
| 759 | cjpeg_wrbmp_size_x bytes_in_buffer; /* # of bytes remaining in buffer */ | ||
| 760 | |||
| 761 | CJPEG_WRBMP_JMETHOD( void, init_source, | ||
| 762 | ( cjpeg_wrbmp_j_decompress_ptr cinfo ) ); | ||
| 763 | CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean, fill_input_buffer, | ||
| 764 | ( cjpeg_wrbmp_j_decompress_ptr cinfo ) ); | ||
| 765 | CJPEG_WRBMP_JMETHOD( void, skip_input_data, | ||
| 766 | ( cjpeg_wrbmp_j_decompress_ptr cinfo, long num_bytes ) ); | ||
| 767 | CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean, resync_to_restart, | ||
| 768 | ( cjpeg_wrbmp_j_decompress_ptr cinfo, int desired ) ); | ||
| 769 | CJPEG_WRBMP_JMETHOD( void, term_source, | ||
| 770 | ( cjpeg_wrbmp_j_decompress_ptr cinfo ) ); | ||
| 771 | }; | ||
| 772 | |||
| 773 | |||
| 774 | /* Memory manager object. | ||
| 775 | Allocates "small" objects (a few K total), "large" objects (tens of K), | ||
| 776 | and "really big" objects (virtual arrays with backing store if needed). | ||
| 777 | The memory manager does not allow individual objects to be freed; rather, | ||
| 778 | each created object is assigned to a pool, and whole pools can be freed | ||
| 779 | at once. This is faster and more convenient than remembering exactly what | ||
| 780 | to free, especially where malloc()/free() are not too speedy. | ||
| 781 | NB: alloc routines never return NULL. They exit to error_exit if not | ||
| 782 | successful. | ||
| 783 | */ | ||
| 784 | |||
| 785 | typedef struct jvirt_sarray_control *cjpeg_wrbmp_jvirt_sarray_ptr; | ||
| 786 | typedef struct jvirt_barray_control *cjpeg_wrbmp_jvirt_barray_ptr; | ||
| 787 | |||
| 788 | |||
| 789 | struct cjpeg_wrbmp_jpeg_memory_mgr { | ||
| 790 | /* Method pointers */ | ||
| 791 | CJPEG_WRBMP_JMETHOD( void *, alloc_small, | ||
| 792 | ( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id, | ||
| 793 | cjpeg_wrbmp_size_x sizeofobject ) ); | ||
| 794 | CJPEG_WRBMP_JMETHOD( void CJPEG_WRBMP_FAR *, alloc_large, | ||
| 795 | ( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id, | ||
| 796 | cjpeg_wrbmp_size_x sizeofobject ) ); | ||
| 797 | CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JSAMPARRAY, alloc_sarray, | ||
| 798 | ( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id, | ||
| 799 | CJPEG_WRBMP_JDIMENSION samplesperrow, | ||
| 800 | CJPEG_WRBMP_JDIMENSION numrows ) ); | ||
| 801 | CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JBLOCKARRAY, alloc_barray, | ||
| 802 | ( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id, | ||
| 803 | CJPEG_WRBMP_JDIMENSION blocksperrow, | ||
| 804 | CJPEG_WRBMP_JDIMENSION numrows ) ); | ||
| 805 | CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_jvirt_sarray_ptr, | ||
| 806 | request_virt_sarray, ( cjpeg_wrbmp_j_common_ptr cinfo, | ||
| 807 | int pool_id, | ||
| 808 | cjpeg_wrbmp_boolean pre_zero, | ||
| 809 | CJPEG_WRBMP_JDIMENSION samplesperrow, | ||
| 810 | CJPEG_WRBMP_JDIMENSION numrows, | ||
| 811 | CJPEG_WRBMP_JDIMENSION maxaccess ) ); | ||
| 812 | CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_jvirt_barray_ptr, | ||
| 813 | request_virt_barray, ( cjpeg_wrbmp_j_common_ptr cinfo, | ||
| 814 | int pool_id, | ||
| 815 | cjpeg_wrbmp_boolean pre_zero, | ||
| 816 | CJPEG_WRBMP_JDIMENSION blocksperrow, | ||
| 817 | CJPEG_WRBMP_JDIMENSION numrows, | ||
| 818 | CJPEG_WRBMP_JDIMENSION maxaccess ) ); | ||
| 819 | CJPEG_WRBMP_JMETHOD( void, realize_virt_arrays, | ||
| 820 | ( cjpeg_wrbmp_j_common_ptr cinfo ) ); | ||
| 821 | CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JSAMPARRAY, access_virt_sarray, | ||
| 822 | ( cjpeg_wrbmp_j_common_ptr cinfo, | ||
| 823 | cjpeg_wrbmp_jvirt_sarray_ptr ptr, | ||
| 824 | CJPEG_WRBMP_JDIMENSION start_row, | ||
| 825 | CJPEG_WRBMP_JDIMENSION num_rows, | ||
| 826 | cjpeg_wrbmp_boolean writable ) ); | ||
| 827 | CJPEG_WRBMP_JMETHOD( CJPEG_WRBMP_JBLOCKARRAY, access_virt_barray, | ||
| 828 | ( cjpeg_wrbmp_j_common_ptr cinfo, | ||
| 829 | cjpeg_wrbmp_jvirt_barray_ptr ptr, | ||
| 830 | CJPEG_WRBMP_JDIMENSION start_row, | ||
| 831 | CJPEG_WRBMP_JDIMENSION num_rows, | ||
| 832 | cjpeg_wrbmp_boolean writable ) ); | ||
| 833 | CJPEG_WRBMP_JMETHOD( void, free_pool, | ||
| 834 | ( cjpeg_wrbmp_j_common_ptr cinfo, int pool_id ) ); | ||
| 835 | CJPEG_WRBMP_JMETHOD( void, self_destruct, | ||
| 836 | ( cjpeg_wrbmp_j_common_ptr cinfo ) ); | ||
| 837 | |||
| 838 | /* Limit on memory allocation for this JPEG object. (Note that this is | ||
| 839 | merely advisory, not a guaranteed maximum; it only affects the space | ||
| 840 | used for virtual-array buffers.) May be changed by outer application | ||
| 841 | after creating the JPEG object. | ||
| 842 | */ | ||
| 843 | long max_memory_to_use; | ||
| 844 | |||
| 845 | /* Maximum allocation request accepted by alloc_large. */ | ||
| 846 | long max_alloc_chunk; | ||
| 847 | }; | ||
| 848 | |||
| 849 | |||
| 850 | /* Routine signature for application-supplied marker processing methods. | ||
| 851 | Need not pass marker code since it is stored in cinfo->unread_marker. | ||
| 852 | */ | ||
| 853 | typedef CJPEG_WRBMP_JMETHOD( cjpeg_wrbmp_boolean, | ||
| 854 | jpeg_marker_parser_method, | ||
| 855 | ( cjpeg_wrbmp_j_decompress_ptr cinfo ) ); | ||
| 856 | |||
| 857 | /* | ||
| 858 | The JPEG library modules define JPEG_INTERNALS before including this file. | ||
| 859 | The internal structure declarations are read only when that is true. | ||
| 860 | Applications using the library should not include jpegint.h, but may wish | ||
| 861 | to include jerror.h. | ||
| 862 | */ | ||
| 863 | |||
| 864 | #ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS | ||
| 865 | #include "jpegint.h" /* fetch private declarations */ | ||
| 866 | #include "jerror.h" /* fetch error codes too */ | ||
| 867 | #endif | ||
| 868 | |||
| 869 | #endif /* JPEGLIB_H */ | ||
