image_compressor_pack 1.0.0.1-amd64-freebsd-11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.txt +22 -0
- data/lib/.paths.yml +12 -0
- data/lib/image_compressor_pack/dynamically_linked_recipes.yml +102 -0
- data/lib/image_compressor_pack/recipes.rb +42 -0
- data/lib/image_compressor_pack/statically_linked_recipes.yml +109 -0
- data/lib/image_compressor_pack/version.rb +3 -0
- data/lib/image_compressor_pack.rb +24 -0
- data/ports/advancecomp-1.22-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/gifsicle-1.88-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/jhead-3.0-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/jpeg-archive-2.1.1-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/jpegoptim-1.4.4-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/lcms2-2.8-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/libpng-1.6.26-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/mozjpeg-3.1-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/nasm-2.12.02-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/optipng-0.7.6-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/pngcrush-1.8.10-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/pngquant-2.8.0-x86_64-unknown-freebsd11.0.installed +0 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/bin/advdef +0 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/bin/advmng +0 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/bin/advpng +0 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/bin/advzip +0 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/share/man/man1/advdef.1 +83 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/share/man/man1/advmng.1 +197 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/share/man/man1/advpng.1 +93 -0
- data/ports/x86_64-unknown-freebsd11.0/advancecomp/1.22/share/man/man1/advzip.1 +116 -0
- data/ports/x86_64-unknown-freebsd11.0/gifsicle/1.88/bin/gifsicle +0 -0
- data/ports/x86_64-unknown-freebsd11.0/gifsicle/1.88/share/man/man1/gifsicle.1 +1318 -0
- data/ports/x86_64-unknown-freebsd11.0/jhead/3.0/bin/jhead +0 -0
- data/ports/x86_64-unknown-freebsd11.0/jpeg-archive/2.1.1/bin/jpeg-archive +40 -0
- data/ports/x86_64-unknown-freebsd11.0/jpeg-archive/2.1.1/bin/jpeg-compare +0 -0
- data/ports/x86_64-unknown-freebsd11.0/jpeg-archive/2.1.1/bin/jpeg-hash +0 -0
- data/ports/x86_64-unknown-freebsd11.0/jpeg-archive/2.1.1/bin/jpeg-recompress +0 -0
- data/ports/x86_64-unknown-freebsd11.0/jpegoptim/1.4.4/bin/jpegoptim +0 -0
- data/ports/x86_64-unknown-freebsd11.0/jpegoptim/1.4.4/share/man/man1/jpegoptim.1 +186 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/bin/linkicc +0 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/bin/psicc +0 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/bin/transicc +0 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/include/lcms2.h +1903 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/include/lcms2_plugin.h +665 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/lib/liblcms2.a +0 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/lib/liblcms2.la +41 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/lib/pkgconfig/lcms2.pc +11 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/share/man/man1/jpgicc.1 +122 -0
- data/ports/x86_64-unknown-freebsd11.0/lcms2/2.8/share/man/man1/tificc.1 +117 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/include/libpng16/png.h +3266 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/include/libpng16/pngconf.h +622 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/include/libpng16/pnglibconf.h +213 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/include/png.h +1 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/include/pngconf.h +1 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/include/pnglibconf.h +1 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/lib/libpng.a +1 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/lib/libpng.la +1 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/lib/libpng16.a +0 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/lib/libpng16.la +41 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/lib/pkgconfig/libpng16.pc +11 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/share/man/man3/libpng.3 +6179 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/share/man/man3/libpngpf.3 +18 -0
- data/ports/x86_64-unknown-freebsd11.0/libpng/1.6.26/share/man/man5/png.5 +74 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/bin/cjpeg +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/bin/djpeg +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/bin/jpegtran +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/bin/rdjpgcom +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/bin/tjbench +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/bin/wrjpgcom +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/include/jconfig.h +71 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/include/jerror.h +320 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/include/jmorecfg.h +390 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/include/jpeglib.h +1185 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/include/turbojpeg.h +1538 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/lib/libjpeg.a +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/lib/libjpeg.la +41 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/lib/libturbojpeg.a +0 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/lib/libturbojpeg.la +41 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/README +281 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/README-mozilla.txt +194 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/README-turbo.txt +363 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/example.c +433 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/libjpeg.txt +3015 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/structure.txt +906 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/usage.txt +649 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/doc/wizard.txt +211 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/man/man1/cjpeg.1 +352 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/man/man1/djpeg.1 +278 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/man/man1/jpegtran.1 +269 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/man/man1/rdjpgcom.1 +63 -0
- data/ports/x86_64-unknown-freebsd11.0/mozjpeg/3.1/share/man/man1/wrjpgcom.1 +103 -0
- data/ports/x86_64-unknown-freebsd11.0/nasm/2.12.02/bin/nasm +0 -0
- data/ports/x86_64-unknown-freebsd11.0/nasm/2.12.02/bin/ndisasm +0 -0
- data/ports/x86_64-unknown-freebsd11.0/nasm/2.12.02/share/man/man1/nasm.1 +429 -0
- data/ports/x86_64-unknown-freebsd11.0/nasm/2.12.02/share/man/man1/ndisasm.1 +120 -0
- data/ports/x86_64-unknown-freebsd11.0/optipng/0.7.6/bin/optipng +0 -0
- data/ports/x86_64-unknown-freebsd11.0/optipng/0.7.6/man/man1/optipng.1 +343 -0
- data/ports/x86_64-unknown-freebsd11.0/pngcrush/1.8.10/bin/pngcrush +0 -0
- data/ports/x86_64-unknown-freebsd11.0/pngquant/2.8.0/bin/pngquant +0 -0
- data/ports/x86_64-unknown-freebsd11.0/pngquant/2.8.0/share/man/man1/pngquant.1 +127 -0
- data/ports/x86_64-unknown-freebsd11.0/zlib/1.2.8/include/zconf.h +511 -0
- data/ports/x86_64-unknown-freebsd11.0/zlib/1.2.8/include/zlib.h +1768 -0
- data/ports/x86_64-unknown-freebsd11.0/zlib/1.2.8/lib/libz.a +0 -0
- data/ports/x86_64-unknown-freebsd11.0/zlib/1.2.8/lib/pkgconfig/zlib.pc +13 -0
- data/ports/x86_64-unknown-freebsd11.0/zlib/1.2.8/share/man/man3/zlib.3 +151 -0
- data/ports/zlib-1.2.8-x86_64-unknown-freebsd11.0.installed +0 -0
- data.tar.gz.sig +0 -0
- metadata +251 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,1185 @@
|
|
1
|
+
/*
|
2
|
+
* jpeglib.h
|
3
|
+
*
|
4
|
+
* This file was part of the Independent JPEG Group's software:
|
5
|
+
* Copyright (C) 1991-1998, Thomas G. Lane.
|
6
|
+
* Modified 2002-2009 by Guido Vollbeding.
|
7
|
+
* libjpeg-turbo Modifications:
|
8
|
+
* Copyright (C) 2009-2011, 2013-2014, D. R. Commander.
|
9
|
+
* mozjpeg Modifications:
|
10
|
+
* Copyright (C) 2014, Mozilla Corporation.
|
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
|
+
|
18
|
+
#ifndef JPEGLIB_H
|
19
|
+
#define JPEGLIB_H
|
20
|
+
|
21
|
+
/*
|
22
|
+
* First we include the configuration files that record how this
|
23
|
+
* installation of the JPEG library is set up. jconfig.h can be
|
24
|
+
* generated automatically for many systems. jmorecfg.h contains
|
25
|
+
* manual configuration options that most people need not worry about.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
|
29
|
+
#include "jconfig.h" /* widely used configuration options */
|
30
|
+
#endif
|
31
|
+
#include "jmorecfg.h" /* seldom changed options */
|
32
|
+
|
33
|
+
|
34
|
+
#ifdef __cplusplus
|
35
|
+
#ifndef DONT_USE_EXTERN_C
|
36
|
+
extern "C" {
|
37
|
+
#endif
|
38
|
+
#endif
|
39
|
+
|
40
|
+
|
41
|
+
/* Various constants determining the sizes of things.
|
42
|
+
* All of these are specified by the JPEG standard, so don't change them
|
43
|
+
* if you want to be compatible.
|
44
|
+
*/
|
45
|
+
|
46
|
+
#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
|
47
|
+
#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
|
48
|
+
#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
|
49
|
+
#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
|
50
|
+
#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */
|
51
|
+
#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
|
52
|
+
#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
|
53
|
+
/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
|
54
|
+
* the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
|
55
|
+
* If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
|
56
|
+
* to handle it. We even let you do this from the jconfig.h file. However,
|
57
|
+
* we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
|
58
|
+
* sometimes emits noncompliant files doesn't mean you should too.
|
59
|
+
*/
|
60
|
+
#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
|
61
|
+
#ifndef D_MAX_BLOCKS_IN_MCU
|
62
|
+
#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
|
63
|
+
#endif
|
64
|
+
|
65
|
+
|
66
|
+
/* Data structures for images (arrays of samples and of DCT coefficients).
|
67
|
+
*/
|
68
|
+
|
69
|
+
typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */
|
70
|
+
typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
|
71
|
+
typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
|
72
|
+
|
73
|
+
typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
|
74
|
+
typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */
|
75
|
+
typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */
|
76
|
+
typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
|
77
|
+
|
78
|
+
typedef JCOEF *JCOEFPTR; /* useful in a couple of places */
|
79
|
+
|
80
|
+
|
81
|
+
/* Types for JPEG compression parameters and working tables. */
|
82
|
+
|
83
|
+
|
84
|
+
/* DCT coefficient quantization tables. */
|
85
|
+
|
86
|
+
typedef struct {
|
87
|
+
/* This array gives the coefficient quantizers in natural array order
|
88
|
+
* (not the zigzag order in which they are stored in a JPEG DQT marker).
|
89
|
+
* CAUTION: IJG versions prior to v6a kept this array in zigzag order.
|
90
|
+
*/
|
91
|
+
UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */
|
92
|
+
/* This field is used only during compression. It's initialized FALSE when
|
93
|
+
* the table is created, and set TRUE when it's been output to the file.
|
94
|
+
* You could suppress output of a table by setting this to TRUE.
|
95
|
+
* (See jpeg_suppress_tables for an example.)
|
96
|
+
*/
|
97
|
+
boolean sent_table; /* TRUE when table has been output */
|
98
|
+
} JQUANT_TBL;
|
99
|
+
|
100
|
+
|
101
|
+
/* Huffman coding tables. */
|
102
|
+
|
103
|
+
typedef struct {
|
104
|
+
/* These two fields directly represent the contents of a JPEG DHT marker */
|
105
|
+
UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
|
106
|
+
/* length k bits; bits[0] is unused */
|
107
|
+
UINT8 huffval[256]; /* The symbols, in order of incr code length */
|
108
|
+
/* This field is used only during compression. It's initialized FALSE when
|
109
|
+
* the table is created, and set TRUE when it's been output to the file.
|
110
|
+
* You could suppress output of a table by setting this to TRUE.
|
111
|
+
* (See jpeg_suppress_tables for an example.)
|
112
|
+
*/
|
113
|
+
boolean sent_table; /* TRUE when table has been output */
|
114
|
+
} JHUFF_TBL;
|
115
|
+
|
116
|
+
|
117
|
+
/* Basic info about one component (color channel). */
|
118
|
+
|
119
|
+
typedef struct {
|
120
|
+
/* These values are fixed over the whole image. */
|
121
|
+
/* For compression, they must be supplied by parameter setup; */
|
122
|
+
/* for decompression, they are read from the SOF marker. */
|
123
|
+
int component_id; /* identifier for this component (0..255) */
|
124
|
+
int component_index; /* its index in SOF or cinfo->comp_info[] */
|
125
|
+
int h_samp_factor; /* horizontal sampling factor (1..4) */
|
126
|
+
int v_samp_factor; /* vertical sampling factor (1..4) */
|
127
|
+
int quant_tbl_no; /* quantization table selector (0..3) */
|
128
|
+
/* These values may vary between scans. */
|
129
|
+
/* For compression, they must be supplied by parameter setup; */
|
130
|
+
/* for decompression, they are read from the SOS marker. */
|
131
|
+
/* The decompressor output side may not use these variables. */
|
132
|
+
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
133
|
+
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
134
|
+
|
135
|
+
/* Remaining fields should be treated as private by applications. */
|
136
|
+
|
137
|
+
/* These values are computed during compression or decompression startup: */
|
138
|
+
/* Component's size in DCT blocks.
|
139
|
+
* Any dummy blocks added to complete an MCU are not counted; therefore
|
140
|
+
* these values do not depend on whether a scan is interleaved or not.
|
141
|
+
*/
|
142
|
+
JDIMENSION width_in_blocks;
|
143
|
+
JDIMENSION height_in_blocks;
|
144
|
+
/* Size of a DCT block in samples. Always DCTSIZE for compression.
|
145
|
+
* For decompression this is the size of the output from one DCT block,
|
146
|
+
* reflecting any scaling we choose to apply during the IDCT step.
|
147
|
+
* Values from 1 to 16 are supported.
|
148
|
+
* Note that different components may receive different IDCT scalings.
|
149
|
+
*/
|
150
|
+
#if JPEG_LIB_VERSION >= 70
|
151
|
+
int DCT_h_scaled_size;
|
152
|
+
int DCT_v_scaled_size;
|
153
|
+
#else
|
154
|
+
int DCT_scaled_size;
|
155
|
+
#endif
|
156
|
+
/* The downsampled dimensions are the component's actual, unpadded number
|
157
|
+
* of samples at the main buffer (preprocessing/compression interface), thus
|
158
|
+
* downsampled_width = ceil(image_width * Hi/Hmax)
|
159
|
+
* and similarly for height. For decompression, IDCT scaling is included, so
|
160
|
+
* downsampled_width = ceil(image_width * Hi/Hmax * DCT_[h_]scaled_size/DCTSIZE)
|
161
|
+
*/
|
162
|
+
JDIMENSION downsampled_width; /* actual width in samples */
|
163
|
+
JDIMENSION downsampled_height; /* actual height in samples */
|
164
|
+
/* This flag is used only for decompression. In cases where some of the
|
165
|
+
* components will be ignored (eg grayscale output from YCbCr image),
|
166
|
+
* we can skip most computations for the unused components.
|
167
|
+
*/
|
168
|
+
boolean component_needed; /* do we need the value of this component? */
|
169
|
+
|
170
|
+
/* These values are computed before starting a scan of the component. */
|
171
|
+
/* The decompressor output side may not use these variables. */
|
172
|
+
int MCU_width; /* number of blocks per MCU, horizontally */
|
173
|
+
int MCU_height; /* number of blocks per MCU, vertically */
|
174
|
+
int MCU_blocks; /* MCU_width * MCU_height */
|
175
|
+
int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_[h_]scaled_size */
|
176
|
+
int last_col_width; /* # of non-dummy blocks across in last MCU */
|
177
|
+
int last_row_height; /* # of non-dummy blocks down in last MCU */
|
178
|
+
|
179
|
+
/* Saved quantization table for component; NULL if none yet saved.
|
180
|
+
* See jdinput.c comments about the need for this information.
|
181
|
+
* This field is currently used only for decompression.
|
182
|
+
*/
|
183
|
+
JQUANT_TBL * quant_table;
|
184
|
+
|
185
|
+
/* Private per-component storage for DCT or IDCT subsystem. */
|
186
|
+
void * dct_table;
|
187
|
+
} jpeg_component_info;
|
188
|
+
|
189
|
+
|
190
|
+
/* The script for encoding a multiple-scan file is an array of these: */
|
191
|
+
|
192
|
+
typedef struct {
|
193
|
+
int comps_in_scan; /* number of components encoded in this scan */
|
194
|
+
int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
|
195
|
+
int Ss, Se; /* progressive JPEG spectral selection parms */
|
196
|
+
int Ah, Al; /* progressive JPEG successive approx. parms */
|
197
|
+
} jpeg_scan_info;
|
198
|
+
|
199
|
+
/* The decompressor can save APPn and COM markers in a list of these: */
|
200
|
+
|
201
|
+
typedef struct jpeg_marker_struct * jpeg_saved_marker_ptr;
|
202
|
+
|
203
|
+
struct jpeg_marker_struct {
|
204
|
+
jpeg_saved_marker_ptr next; /* next in list, or NULL */
|
205
|
+
UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
|
206
|
+
unsigned int original_length; /* # bytes of data in the file */
|
207
|
+
unsigned int data_length; /* # bytes of data saved at data[] */
|
208
|
+
JOCTET * data; /* the data contained in the marker */
|
209
|
+
/* the marker length word is not counted in data_length or original_length */
|
210
|
+
};
|
211
|
+
|
212
|
+
/* Known color spaces. */
|
213
|
+
|
214
|
+
#define JCS_EXTENSIONS 1
|
215
|
+
#define JCS_ALPHA_EXTENSIONS 1
|
216
|
+
|
217
|
+
typedef enum {
|
218
|
+
JCS_UNKNOWN, /* error/unspecified */
|
219
|
+
JCS_GRAYSCALE, /* monochrome */
|
220
|
+
JCS_RGB, /* red/green/blue as specified by the RGB_RED,
|
221
|
+
RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros */
|
222
|
+
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
|
223
|
+
JCS_CMYK, /* C/M/Y/K */
|
224
|
+
JCS_YCCK, /* Y/Cb/Cr/K */
|
225
|
+
JCS_EXT_RGB, /* red/green/blue */
|
226
|
+
JCS_EXT_RGBX, /* red/green/blue/x */
|
227
|
+
JCS_EXT_BGR, /* blue/green/red */
|
228
|
+
JCS_EXT_BGRX, /* blue/green/red/x */
|
229
|
+
JCS_EXT_XBGR, /* x/blue/green/red */
|
230
|
+
JCS_EXT_XRGB, /* x/red/green/blue */
|
231
|
+
/* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR,
|
232
|
+
or JCS_EXT_XRGB during decompression, the X byte is undefined, and in
|
233
|
+
order to ensure the best performance, libjpeg-turbo can set that byte to
|
234
|
+
whatever value it wishes. Use the following colorspace constants to
|
235
|
+
ensure that the X byte is set to 0xFF, so that it can be interpreted as an
|
236
|
+
opaque alpha channel. */
|
237
|
+
JCS_EXT_RGBA, /* red/green/blue/alpha */
|
238
|
+
JCS_EXT_BGRA, /* blue/green/red/alpha */
|
239
|
+
JCS_EXT_ABGR, /* alpha/blue/green/red */
|
240
|
+
JCS_EXT_ARGB, /* alpha/red/green/blue */
|
241
|
+
JCS_RGB565 /* 5-bit red/6-bit green/5-bit blue */
|
242
|
+
} J_COLOR_SPACE;
|
243
|
+
|
244
|
+
/* DCT/IDCT algorithm options. */
|
245
|
+
|
246
|
+
typedef enum {
|
247
|
+
JDCT_ISLOW, /* slow but accurate integer algorithm */
|
248
|
+
JDCT_IFAST, /* faster, less accurate integer method */
|
249
|
+
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
|
250
|
+
} J_DCT_METHOD;
|
251
|
+
|
252
|
+
#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
|
253
|
+
#define JDCT_DEFAULT JDCT_ISLOW
|
254
|
+
#endif
|
255
|
+
#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */
|
256
|
+
#define JDCT_FASTEST JDCT_IFAST
|
257
|
+
#endif
|
258
|
+
|
259
|
+
/* Dithering options for decompression. */
|
260
|
+
|
261
|
+
typedef enum {
|
262
|
+
JDITHER_NONE, /* no dithering */
|
263
|
+
JDITHER_ORDERED, /* simple ordered dither */
|
264
|
+
JDITHER_FS /* Floyd-Steinberg error diffusion dither */
|
265
|
+
} J_DITHER_MODE;
|
266
|
+
|
267
|
+
|
268
|
+
/* These 32-bit GUIDs and the corresponding jpeg_*_get_*_param()/
|
269
|
+
* jpeg_*_set_*_param() functions allow for extending the libjpeg API without
|
270
|
+
* breaking backward ABI compatibility. The actual parameters are stored in
|
271
|
+
* the opaque jpeg_comp_master and jpeg_decomp_master structs.
|
272
|
+
*/
|
273
|
+
|
274
|
+
/* Boolean extension parameters */
|
275
|
+
|
276
|
+
typedef enum {
|
277
|
+
JBOOLEAN_OPTIMIZE_SCANS = 0x680C061E, /* TRUE=optimize progressive coding scans */
|
278
|
+
JBOOLEAN_TRELLIS_QUANT = 0xC5122033, /* TRUE=use trellis quantization */
|
279
|
+
JBOOLEAN_TRELLIS_QUANT_DC = 0x339D4C0C, /* TRUE=use trellis quant for DC coefficient */
|
280
|
+
JBOOLEAN_TRELLIS_EOB_OPT = 0xD7F73780, /* TRUE=optimize for sequences of EOB */
|
281
|
+
JBOOLEAN_USE_LAMBDA_WEIGHT_TBL = 0x339DB65F, /* TRUE=use lambda weighting table */
|
282
|
+
JBOOLEAN_USE_SCANS_IN_TRELLIS = 0xFD841435, /* TRUE=use scans in trellis optimization */
|
283
|
+
JBOOLEAN_TRELLIS_Q_OPT = 0xE12AE269, /* TRUE=optimize quant table in trellis loop */
|
284
|
+
JBOOLEAN_OVERSHOOT_DERINGING = 0x3F4BBBF9 /* TRUE=preprocess input to reduce ringing of edges on white background */
|
285
|
+
} J_BOOLEAN_PARAM;
|
286
|
+
|
287
|
+
/* Floating point parameters */
|
288
|
+
|
289
|
+
typedef enum {
|
290
|
+
JFLOAT_LAMBDA_LOG_SCALE1 = 0x5B61A599,
|
291
|
+
JFLOAT_LAMBDA_LOG_SCALE2 = 0xB9BBAE03,
|
292
|
+
JFLOAT_TRELLIS_DELTA_DC_WEIGHT = 0x13775453
|
293
|
+
} J_FLOAT_PARAM;
|
294
|
+
|
295
|
+
/* Integer parameters */
|
296
|
+
|
297
|
+
typedef enum {
|
298
|
+
JINT_COMPRESS_PROFILE = 0xE9918625, /* compression profile */
|
299
|
+
JINT_TRELLIS_FREQ_SPLIT = 0x6FAFF127, /* splitting point for frequency in trellis quantization */
|
300
|
+
JINT_TRELLIS_NUM_LOOPS = 0xB63EBF39, /* number of trellis loops */
|
301
|
+
JINT_BASE_QUANT_TBL_IDX = 0x44492AB1, /* base quantization table index */
|
302
|
+
JINT_DC_SCAN_OPT_MODE = 0x0BE7AD3C /* DC scan optimization mode */
|
303
|
+
} J_INT_PARAM;
|
304
|
+
|
305
|
+
|
306
|
+
/* Values for the JINT_COMPRESS_PROFILE parameter (32-bit GUIDs) */
|
307
|
+
|
308
|
+
enum {
|
309
|
+
JCP_MAX_COMPRESSION = 0x5D083AAD, /* best compression ratio (progressive, all mozjpeg extensions) */
|
310
|
+
JCP_FASTEST = 0x2AEA5CB4 /* libjpeg[-turbo] defaults (baseline, no mozjpeg extensions) */
|
311
|
+
};
|
312
|
+
|
313
|
+
|
314
|
+
/* Common fields between JPEG compression and decompression master structs. */
|
315
|
+
|
316
|
+
#define jpeg_common_fields \
|
317
|
+
struct jpeg_error_mgr * err; /* Error handler module */\
|
318
|
+
struct jpeg_memory_mgr * mem; /* Memory manager module */\
|
319
|
+
struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
|
320
|
+
void * client_data; /* Available for use by application */\
|
321
|
+
boolean is_decompressor; /* So common code can tell which is which */\
|
322
|
+
int global_state /* For checking call sequence validity */
|
323
|
+
|
324
|
+
/* Routines that are to be used by both halves of the library are declared
|
325
|
+
* to receive a pointer to this structure. There are no actual instances of
|
326
|
+
* jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
|
327
|
+
*/
|
328
|
+
struct jpeg_common_struct {
|
329
|
+
jpeg_common_fields; /* Fields common to both master struct types */
|
330
|
+
/* Additional fields follow in an actual jpeg_compress_struct or
|
331
|
+
* jpeg_decompress_struct. All three structs must agree on these
|
332
|
+
* initial fields! (This would be a lot cleaner in C++.)
|
333
|
+
*/
|
334
|
+
};
|
335
|
+
|
336
|
+
typedef struct jpeg_common_struct * j_common_ptr;
|
337
|
+
typedef struct jpeg_compress_struct * j_compress_ptr;
|
338
|
+
typedef struct jpeg_decompress_struct * j_decompress_ptr;
|
339
|
+
|
340
|
+
|
341
|
+
/* Master record for a compression instance */
|
342
|
+
|
343
|
+
struct jpeg_compress_struct {
|
344
|
+
jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */
|
345
|
+
|
346
|
+
/* Destination for compressed data */
|
347
|
+
struct jpeg_destination_mgr * dest;
|
348
|
+
|
349
|
+
/* Description of source image --- these fields must be filled in by
|
350
|
+
* outer application before starting compression. in_color_space must
|
351
|
+
* be correct before you can even call jpeg_set_defaults().
|
352
|
+
*/
|
353
|
+
|
354
|
+
JDIMENSION image_width; /* input image width */
|
355
|
+
JDIMENSION image_height; /* input image height */
|
356
|
+
int input_components; /* # of color components in input image */
|
357
|
+
J_COLOR_SPACE in_color_space; /* colorspace of input image */
|
358
|
+
|
359
|
+
double input_gamma; /* image gamma of input image */
|
360
|
+
|
361
|
+
/* Compression parameters --- these fields must be set before calling
|
362
|
+
* jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
|
363
|
+
* initialize everything to reasonable defaults, then changing anything
|
364
|
+
* the application specifically wants to change. That way you won't get
|
365
|
+
* burnt when new parameters are added. Also note that there are several
|
366
|
+
* helper routines to simplify changing parameters.
|
367
|
+
*/
|
368
|
+
|
369
|
+
#if JPEG_LIB_VERSION >= 70
|
370
|
+
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
|
371
|
+
|
372
|
+
JDIMENSION jpeg_width; /* scaled JPEG image width */
|
373
|
+
JDIMENSION jpeg_height; /* scaled JPEG image height */
|
374
|
+
/* Dimensions of actual JPEG image that will be written to file,
|
375
|
+
* derived from input dimensions by scaling factors above.
|
376
|
+
* These fields are computed by jpeg_start_compress().
|
377
|
+
* You can also use jpeg_calc_jpeg_dimensions() to determine these values
|
378
|
+
* in advance of calling jpeg_start_compress().
|
379
|
+
*/
|
380
|
+
#endif
|
381
|
+
|
382
|
+
int data_precision; /* bits of precision in image data */
|
383
|
+
|
384
|
+
int num_components; /* # of color components in JPEG image */
|
385
|
+
J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
|
386
|
+
|
387
|
+
jpeg_component_info * comp_info;
|
388
|
+
/* comp_info[i] describes component that appears i'th in SOF */
|
389
|
+
|
390
|
+
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
|
391
|
+
#if JPEG_LIB_VERSION >= 70
|
392
|
+
int q_scale_factor[NUM_QUANT_TBLS];
|
393
|
+
#endif
|
394
|
+
/* ptrs to coefficient quantization tables, or NULL if not defined,
|
395
|
+
* and corresponding scale factors (percentage, initialized 100).
|
396
|
+
*/
|
397
|
+
|
398
|
+
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
|
399
|
+
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
|
400
|
+
/* ptrs to Huffman coding tables, or NULL if not defined */
|
401
|
+
|
402
|
+
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
|
403
|
+
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
|
404
|
+
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
|
405
|
+
|
406
|
+
int num_scans; /* # of entries in scan_info array */
|
407
|
+
const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
|
408
|
+
/* The default value of scan_info is NULL, which causes a single-scan
|
409
|
+
* sequential JPEG file to be emitted. To create a multi-scan file,
|
410
|
+
* set num_scans and scan_info to point to an array of scan definitions.
|
411
|
+
*/
|
412
|
+
|
413
|
+
boolean raw_data_in; /* TRUE=caller supplies downsampled data */
|
414
|
+
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
415
|
+
boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
|
416
|
+
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
417
|
+
#if JPEG_LIB_VERSION >= 70
|
418
|
+
boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */
|
419
|
+
#endif
|
420
|
+
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
|
421
|
+
J_DCT_METHOD dct_method; /* DCT algorithm selector */
|
422
|
+
|
423
|
+
/* The restart interval can be specified in absolute MCUs by setting
|
424
|
+
* restart_interval, or in MCU rows by setting restart_in_rows
|
425
|
+
* (in which case the correct restart_interval will be figured
|
426
|
+
* for each scan).
|
427
|
+
*/
|
428
|
+
unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
|
429
|
+
int restart_in_rows; /* if > 0, MCU rows per restart interval */
|
430
|
+
|
431
|
+
/* Parameters controlling emission of special markers. */
|
432
|
+
|
433
|
+
boolean write_JFIF_header; /* should a JFIF marker be written? */
|
434
|
+
UINT8 JFIF_major_version; /* What to write for the JFIF version number */
|
435
|
+
UINT8 JFIF_minor_version;
|
436
|
+
/* These three values are not used by the JPEG code, merely copied */
|
437
|
+
/* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
|
438
|
+
/* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
|
439
|
+
/* ratio is defined by X_density/Y_density even when density_unit=0. */
|
440
|
+
UINT8 density_unit; /* JFIF code for pixel size units */
|
441
|
+
UINT16 X_density; /* Horizontal pixel density */
|
442
|
+
UINT16 Y_density; /* Vertical pixel density */
|
443
|
+
boolean write_Adobe_marker; /* should an Adobe marker be written? */
|
444
|
+
|
445
|
+
/* State variable: index of next scanline to be written to
|
446
|
+
* jpeg_write_scanlines(). Application may use this to control its
|
447
|
+
* processing loop, e.g., "while (next_scanline < image_height)".
|
448
|
+
*/
|
449
|
+
|
450
|
+
JDIMENSION next_scanline; /* 0 .. image_height-1 */
|
451
|
+
|
452
|
+
/* Remaining fields are known throughout compressor, but generally
|
453
|
+
* should not be touched by a surrounding application.
|
454
|
+
*/
|
455
|
+
|
456
|
+
/*
|
457
|
+
* These fields are computed during compression startup
|
458
|
+
*/
|
459
|
+
boolean progressive_mode; /* TRUE if scan script uses progressive mode */
|
460
|
+
int max_h_samp_factor; /* largest h_samp_factor */
|
461
|
+
int max_v_samp_factor; /* largest v_samp_factor */
|
462
|
+
|
463
|
+
#if JPEG_LIB_VERSION >= 70
|
464
|
+
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
|
465
|
+
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
|
466
|
+
#endif
|
467
|
+
|
468
|
+
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
469
|
+
/* The coefficient controller receives data in units of MCU rows as defined
|
470
|
+
* for fully interleaved scans (whether the JPEG file is interleaved or not).
|
471
|
+
* There are v_samp_factor * DCTSIZE sample rows of each component in an
|
472
|
+
* "iMCU" (interleaved MCU) row.
|
473
|
+
*/
|
474
|
+
|
475
|
+
/*
|
476
|
+
* These fields are valid during any one scan.
|
477
|
+
* They describe the components and MCUs actually appearing in the scan.
|
478
|
+
*/
|
479
|
+
int comps_in_scan; /* # of JPEG components in this scan */
|
480
|
+
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
|
481
|
+
/* *cur_comp_info[i] describes component that appears i'th in SOS */
|
482
|
+
|
483
|
+
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
484
|
+
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
485
|
+
|
486
|
+
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
487
|
+
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
|
488
|
+
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
489
|
+
/* i'th block in an MCU */
|
490
|
+
|
491
|
+
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
492
|
+
|
493
|
+
#if JPEG_LIB_VERSION >= 80
|
494
|
+
int block_size; /* the basic DCT block size: 1..16 */
|
495
|
+
const int * natural_order; /* natural-order position array */
|
496
|
+
int lim_Se; /* min( Se, DCTSIZE2-1 ) */
|
497
|
+
#endif
|
498
|
+
|
499
|
+
/*
|
500
|
+
* Links to compression subobjects (methods and private variables of modules)
|
501
|
+
*/
|
502
|
+
struct jpeg_comp_master * master;
|
503
|
+
struct jpeg_c_main_controller * main;
|
504
|
+
struct jpeg_c_prep_controller * prep;
|
505
|
+
struct jpeg_c_coef_controller * coef;
|
506
|
+
struct jpeg_marker_writer * marker;
|
507
|
+
struct jpeg_color_converter * cconvert;
|
508
|
+
struct jpeg_downsampler * downsample;
|
509
|
+
struct jpeg_forward_dct * fdct;
|
510
|
+
struct jpeg_entropy_encoder * entropy;
|
511
|
+
jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */
|
512
|
+
int script_space_size;
|
513
|
+
};
|
514
|
+
|
515
|
+
|
516
|
+
/* Master record for a decompression instance */
|
517
|
+
|
518
|
+
struct jpeg_decompress_struct {
|
519
|
+
jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
|
520
|
+
|
521
|
+
/* Source of compressed data */
|
522
|
+
struct jpeg_source_mgr * src;
|
523
|
+
|
524
|
+
/* Basic description of image --- filled in by jpeg_read_header(). */
|
525
|
+
/* Application may inspect these values to decide how to process image. */
|
526
|
+
|
527
|
+
JDIMENSION image_width; /* nominal image width (from SOF marker) */
|
528
|
+
JDIMENSION image_height; /* nominal image height */
|
529
|
+
int num_components; /* # of color components in JPEG image */
|
530
|
+
J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
|
531
|
+
|
532
|
+
/* Decompression processing parameters --- these fields must be set before
|
533
|
+
* calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
|
534
|
+
* them to default values.
|
535
|
+
*/
|
536
|
+
|
537
|
+
J_COLOR_SPACE out_color_space; /* colorspace for output */
|
538
|
+
|
539
|
+
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
|
540
|
+
|
541
|
+
double output_gamma; /* image gamma wanted in output */
|
542
|
+
|
543
|
+
boolean buffered_image; /* TRUE=multiple output passes */
|
544
|
+
boolean raw_data_out; /* TRUE=downsampled data wanted */
|
545
|
+
|
546
|
+
J_DCT_METHOD dct_method; /* IDCT algorithm selector */
|
547
|
+
boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
|
548
|
+
boolean do_block_smoothing; /* TRUE=apply interblock smoothing */
|
549
|
+
|
550
|
+
boolean quantize_colors; /* TRUE=colormapped output wanted */
|
551
|
+
/* the following are ignored if not quantize_colors: */
|
552
|
+
J_DITHER_MODE dither_mode; /* type of color dithering to use */
|
553
|
+
boolean two_pass_quantize; /* TRUE=use two-pass color quantization */
|
554
|
+
int desired_number_of_colors; /* max # colors to use in created colormap */
|
555
|
+
/* these are significant only in buffered-image mode: */
|
556
|
+
boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */
|
557
|
+
boolean enable_external_quant;/* enable future use of external colormap */
|
558
|
+
boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */
|
559
|
+
|
560
|
+
/* Description of actual output image that will be returned to application.
|
561
|
+
* These fields are computed by jpeg_start_decompress().
|
562
|
+
* You can also use jpeg_calc_output_dimensions() to determine these values
|
563
|
+
* in advance of calling jpeg_start_decompress().
|
564
|
+
*/
|
565
|
+
|
566
|
+
JDIMENSION output_width; /* scaled image width */
|
567
|
+
JDIMENSION output_height; /* scaled image height */
|
568
|
+
int out_color_components; /* # of color components in out_color_space */
|
569
|
+
int output_components; /* # of color components returned */
|
570
|
+
/* output_components is 1 (a colormap index) when quantizing colors;
|
571
|
+
* otherwise it equals out_color_components.
|
572
|
+
*/
|
573
|
+
int rec_outbuf_height; /* min recommended height of scanline buffer */
|
574
|
+
/* If the buffer passed to jpeg_read_scanlines() is less than this many rows
|
575
|
+
* high, space and time will be wasted due to unnecessary data copying.
|
576
|
+
* Usually rec_outbuf_height will be 1 or 2, at most 4.
|
577
|
+
*/
|
578
|
+
|
579
|
+
/* When quantizing colors, the output colormap is described by these fields.
|
580
|
+
* The application can supply a colormap by setting colormap non-NULL before
|
581
|
+
* calling jpeg_start_decompress; otherwise a colormap is created during
|
582
|
+
* jpeg_start_decompress or jpeg_start_output.
|
583
|
+
* The map has out_color_components rows and actual_number_of_colors columns.
|
584
|
+
*/
|
585
|
+
int actual_number_of_colors; /* number of entries in use */
|
586
|
+
JSAMPARRAY colormap; /* The color map as a 2-D pixel array */
|
587
|
+
|
588
|
+
/* State variables: these variables indicate the progress of decompression.
|
589
|
+
* The application may examine these but must not modify them.
|
590
|
+
*/
|
591
|
+
|
592
|
+
/* Row index of next scanline to be read from jpeg_read_scanlines().
|
593
|
+
* Application may use this to control its processing loop, e.g.,
|
594
|
+
* "while (output_scanline < output_height)".
|
595
|
+
*/
|
596
|
+
JDIMENSION output_scanline; /* 0 .. output_height-1 */
|
597
|
+
|
598
|
+
/* Current input scan number and number of iMCU rows completed in scan.
|
599
|
+
* These indicate the progress of the decompressor input side.
|
600
|
+
*/
|
601
|
+
int input_scan_number; /* Number of SOS markers seen so far */
|
602
|
+
JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */
|
603
|
+
|
604
|
+
/* The "output scan number" is the notional scan being displayed by the
|
605
|
+
* output side. The decompressor will not allow output scan/row number
|
606
|
+
* to get ahead of input scan/row, but it can fall arbitrarily far behind.
|
607
|
+
*/
|
608
|
+
int output_scan_number; /* Nominal scan number being displayed */
|
609
|
+
JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
|
610
|
+
|
611
|
+
/* Current progression status. coef_bits[c][i] indicates the precision
|
612
|
+
* with which component c's DCT coefficient i (in zigzag order) is known.
|
613
|
+
* It is -1 when no data has yet been received, otherwise it is the point
|
614
|
+
* transform (shift) value for the most recent scan of the coefficient
|
615
|
+
* (thus, 0 at completion of the progression).
|
616
|
+
* This pointer is NULL when reading a non-progressive file.
|
617
|
+
*/
|
618
|
+
int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */
|
619
|
+
|
620
|
+
/* Internal JPEG parameters --- the application usually need not look at
|
621
|
+
* these fields. Note that the decompressor output side may not use
|
622
|
+
* any parameters that can change between scans.
|
623
|
+
*/
|
624
|
+
|
625
|
+
/* Quantization and Huffman tables are carried forward across input
|
626
|
+
* datastreams when processing abbreviated JPEG datastreams.
|
627
|
+
*/
|
628
|
+
|
629
|
+
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
|
630
|
+
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
631
|
+
|
632
|
+
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
|
633
|
+
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
|
634
|
+
/* ptrs to Huffman coding tables, or NULL if not defined */
|
635
|
+
|
636
|
+
/* These parameters are never carried across datastreams, since they
|
637
|
+
* are given in SOF/SOS markers or defined to be reset by SOI.
|
638
|
+
*/
|
639
|
+
|
640
|
+
int data_precision; /* bits of precision in image data */
|
641
|
+
|
642
|
+
jpeg_component_info * comp_info;
|
643
|
+
/* comp_info[i] describes component that appears i'th in SOF */
|
644
|
+
|
645
|
+
#if JPEG_LIB_VERSION >= 80
|
646
|
+
boolean is_baseline; /* TRUE if Baseline SOF0 encountered */
|
647
|
+
#endif
|
648
|
+
boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
|
649
|
+
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
650
|
+
|
651
|
+
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
|
652
|
+
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
|
653
|
+
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
|
654
|
+
|
655
|
+
unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
|
656
|
+
|
657
|
+
/* These fields record data obtained from optional markers recognized by
|
658
|
+
* the JPEG library.
|
659
|
+
*/
|
660
|
+
boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
|
661
|
+
/* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
|
662
|
+
UINT8 JFIF_major_version; /* JFIF version number */
|
663
|
+
UINT8 JFIF_minor_version;
|
664
|
+
UINT8 density_unit; /* JFIF code for pixel size units */
|
665
|
+
UINT16 X_density; /* Horizontal pixel density */
|
666
|
+
UINT16 Y_density; /* Vertical pixel density */
|
667
|
+
boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
|
668
|
+
UINT8 Adobe_transform; /* Color transform code from Adobe marker */
|
669
|
+
|
670
|
+
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
671
|
+
|
672
|
+
/* Aside from the specific data retained from APPn markers known to the
|
673
|
+
* library, the uninterpreted contents of any or all APPn and COM markers
|
674
|
+
* can be saved in a list for examination by the application.
|
675
|
+
*/
|
676
|
+
jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
|
677
|
+
|
678
|
+
/* Remaining fields are known throughout decompressor, but generally
|
679
|
+
* should not be touched by a surrounding application.
|
680
|
+
*/
|
681
|
+
|
682
|
+
/*
|
683
|
+
* These fields are computed during decompression startup
|
684
|
+
*/
|
685
|
+
int max_h_samp_factor; /* largest h_samp_factor */
|
686
|
+
int max_v_samp_factor; /* largest v_samp_factor */
|
687
|
+
|
688
|
+
#if JPEG_LIB_VERSION >= 70
|
689
|
+
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
|
690
|
+
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
|
691
|
+
#else
|
692
|
+
int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
|
693
|
+
#endif
|
694
|
+
|
695
|
+
JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
|
696
|
+
/* The coefficient controller's input and output progress is measured in
|
697
|
+
* units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
|
698
|
+
* in fully interleaved JPEG scans, but are used whether the scan is
|
699
|
+
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
700
|
+
* rows of each component. Therefore, the IDCT output contains
|
701
|
+
* v_samp_factor*DCT_[v_]scaled_size sample rows of a component per iMCU row.
|
702
|
+
*/
|
703
|
+
|
704
|
+
JSAMPLE * sample_range_limit; /* table for fast range-limiting */
|
705
|
+
|
706
|
+
/*
|
707
|
+
* These fields are valid during any one scan.
|
708
|
+
* They describe the components and MCUs actually appearing in the scan.
|
709
|
+
* Note that the decompressor output side must not use these fields.
|
710
|
+
*/
|
711
|
+
int comps_in_scan; /* # of JPEG components in this scan */
|
712
|
+
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
|
713
|
+
/* *cur_comp_info[i] describes component that appears i'th in SOS */
|
714
|
+
|
715
|
+
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
716
|
+
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
717
|
+
|
718
|
+
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
719
|
+
int MCU_membership[D_MAX_BLOCKS_IN_MCU];
|
720
|
+
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
721
|
+
/* i'th block in an MCU */
|
722
|
+
|
723
|
+
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
724
|
+
|
725
|
+
#if JPEG_LIB_VERSION >= 80
|
726
|
+
/* These fields are derived from Se of first SOS marker.
|
727
|
+
*/
|
728
|
+
int block_size; /* the basic DCT block size: 1..16 */
|
729
|
+
const int * natural_order; /* natural-order position array for entropy decode */
|
730
|
+
int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */
|
731
|
+
#endif
|
732
|
+
|
733
|
+
/* This field is shared between entropy decoder and marker parser.
|
734
|
+
* It is either zero or the code of a JPEG marker that has been
|
735
|
+
* read from the data source, but has not yet been processed.
|
736
|
+
*/
|
737
|
+
int unread_marker;
|
738
|
+
|
739
|
+
/*
|
740
|
+
* Links to decompression subobjects (methods, private variables of modules)
|
741
|
+
*/
|
742
|
+
struct jpeg_decomp_master * master;
|
743
|
+
struct jpeg_d_main_controller * main;
|
744
|
+
struct jpeg_d_coef_controller * coef;
|
745
|
+
struct jpeg_d_post_controller * post;
|
746
|
+
struct jpeg_input_controller * inputctl;
|
747
|
+
struct jpeg_marker_reader * marker;
|
748
|
+
struct jpeg_entropy_decoder * entropy;
|
749
|
+
struct jpeg_inverse_dct * idct;
|
750
|
+
struct jpeg_upsampler * upsample;
|
751
|
+
struct jpeg_color_deconverter * cconvert;
|
752
|
+
struct jpeg_color_quantizer * cquantize;
|
753
|
+
};
|
754
|
+
|
755
|
+
|
756
|
+
/* "Object" declarations for JPEG modules that may be supplied or called
|
757
|
+
* directly by the surrounding application.
|
758
|
+
* As with all objects in the JPEG library, these structs only define the
|
759
|
+
* publicly visible methods and state variables of a module. Additional
|
760
|
+
* private fields may exist after the public ones.
|
761
|
+
*/
|
762
|
+
|
763
|
+
|
764
|
+
/* Error handler object */
|
765
|
+
|
766
|
+
struct jpeg_error_mgr {
|
767
|
+
/* Error exit handler: does not return to caller */
|
768
|
+
void (*error_exit) (j_common_ptr cinfo);
|
769
|
+
/* Conditionally emit a trace or warning message */
|
770
|
+
void (*emit_message) (j_common_ptr cinfo, int msg_level);
|
771
|
+
/* Routine that actually outputs a trace or error message */
|
772
|
+
void (*output_message) (j_common_ptr cinfo);
|
773
|
+
/* Format a message string for the most recent JPEG error or message */
|
774
|
+
void (*format_message) (j_common_ptr cinfo, char * buffer);
|
775
|
+
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
776
|
+
/* Reset error state variables at start of a new image */
|
777
|
+
void (*reset_error_mgr) (j_common_ptr cinfo);
|
778
|
+
|
779
|
+
/* The message ID code and any parameters are saved here.
|
780
|
+
* A message can have one string parameter or up to 8 int parameters.
|
781
|
+
*/
|
782
|
+
int msg_code;
|
783
|
+
#define JMSG_STR_PARM_MAX 80
|
784
|
+
union {
|
785
|
+
int i[8];
|
786
|
+
char s[JMSG_STR_PARM_MAX];
|
787
|
+
} msg_parm;
|
788
|
+
|
789
|
+
/* Standard state variables for error facility */
|
790
|
+
|
791
|
+
int trace_level; /* max msg_level that will be displayed */
|
792
|
+
|
793
|
+
/* For recoverable corrupt-data errors, we emit a warning message,
|
794
|
+
* but keep going unless emit_message chooses to abort. emit_message
|
795
|
+
* should count warnings in num_warnings. The surrounding application
|
796
|
+
* can check for bad data by seeing if num_warnings is nonzero at the
|
797
|
+
* end of processing.
|
798
|
+
*/
|
799
|
+
long num_warnings; /* number of corrupt-data warnings */
|
800
|
+
|
801
|
+
/* These fields point to the table(s) of error message strings.
|
802
|
+
* An application can change the table pointer to switch to a different
|
803
|
+
* message list (typically, to change the language in which errors are
|
804
|
+
* reported). Some applications may wish to add additional error codes
|
805
|
+
* that will be handled by the JPEG library error mechanism; the second
|
806
|
+
* table pointer is used for this purpose.
|
807
|
+
*
|
808
|
+
* First table includes all errors generated by JPEG library itself.
|
809
|
+
* Error code 0 is reserved for a "no such error string" message.
|
810
|
+
*/
|
811
|
+
const char * const * jpeg_message_table; /* Library errors */
|
812
|
+
int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
|
813
|
+
/* Second table can be added by application (see cjpeg/djpeg for example).
|
814
|
+
* It contains strings numbered first_addon_message..last_addon_message.
|
815
|
+
*/
|
816
|
+
const char * const * addon_message_table; /* Non-library errors */
|
817
|
+
int first_addon_message; /* code for first string in addon table */
|
818
|
+
int last_addon_message; /* code for last string in addon table */
|
819
|
+
};
|
820
|
+
|
821
|
+
|
822
|
+
/* Progress monitor object */
|
823
|
+
|
824
|
+
struct jpeg_progress_mgr {
|
825
|
+
void (*progress_monitor) (j_common_ptr cinfo);
|
826
|
+
|
827
|
+
long pass_counter; /* work units completed in this pass */
|
828
|
+
long pass_limit; /* total number of work units in this pass */
|
829
|
+
int completed_passes; /* passes completed so far */
|
830
|
+
int total_passes; /* total number of passes expected */
|
831
|
+
};
|
832
|
+
|
833
|
+
|
834
|
+
/* Data destination object for compression */
|
835
|
+
|
836
|
+
struct jpeg_destination_mgr {
|
837
|
+
JOCTET * next_output_byte; /* => next byte to write in buffer */
|
838
|
+
size_t free_in_buffer; /* # of byte spaces remaining in buffer */
|
839
|
+
|
840
|
+
void (*init_destination) (j_compress_ptr cinfo);
|
841
|
+
boolean (*empty_output_buffer) (j_compress_ptr cinfo);
|
842
|
+
void (*term_destination) (j_compress_ptr cinfo);
|
843
|
+
};
|
844
|
+
|
845
|
+
|
846
|
+
/* Data source object for decompression */
|
847
|
+
|
848
|
+
struct jpeg_source_mgr {
|
849
|
+
const JOCTET * next_input_byte; /* => next byte to read from buffer */
|
850
|
+
size_t bytes_in_buffer; /* # of bytes remaining in buffer */
|
851
|
+
|
852
|
+
void (*init_source) (j_decompress_ptr cinfo);
|
853
|
+
boolean (*fill_input_buffer) (j_decompress_ptr cinfo);
|
854
|
+
void (*skip_input_data) (j_decompress_ptr cinfo, long num_bytes);
|
855
|
+
boolean (*resync_to_restart) (j_decompress_ptr cinfo, int desired);
|
856
|
+
void (*term_source) (j_decompress_ptr cinfo);
|
857
|
+
};
|
858
|
+
|
859
|
+
|
860
|
+
/* Memory manager object.
|
861
|
+
* Allocates "small" objects (a few K total), "large" objects (tens of K),
|
862
|
+
* and "really big" objects (virtual arrays with backing store if needed).
|
863
|
+
* The memory manager does not allow individual objects to be freed; rather,
|
864
|
+
* each created object is assigned to a pool, and whole pools can be freed
|
865
|
+
* at once. This is faster and more convenient than remembering exactly what
|
866
|
+
* to free, especially where malloc()/free() are not too speedy.
|
867
|
+
* NB: alloc routines never return NULL. They exit to error_exit if not
|
868
|
+
* successful.
|
869
|
+
*/
|
870
|
+
|
871
|
+
#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */
|
872
|
+
#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
|
873
|
+
#define JPOOL_NUMPOOLS 2
|
874
|
+
|
875
|
+
typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
|
876
|
+
typedef struct jvirt_barray_control * jvirt_barray_ptr;
|
877
|
+
|
878
|
+
|
879
|
+
struct jpeg_memory_mgr {
|
880
|
+
/* Method pointers */
|
881
|
+
void * (*alloc_small) (j_common_ptr cinfo, int pool_id, size_t sizeofobject);
|
882
|
+
void * (*alloc_large) (j_common_ptr cinfo, int pool_id,
|
883
|
+
size_t sizeofobject);
|
884
|
+
JSAMPARRAY (*alloc_sarray) (j_common_ptr cinfo, int pool_id,
|
885
|
+
JDIMENSION samplesperrow, JDIMENSION numrows);
|
886
|
+
JBLOCKARRAY (*alloc_barray) (j_common_ptr cinfo, int pool_id,
|
887
|
+
JDIMENSION blocksperrow, JDIMENSION numrows);
|
888
|
+
jvirt_sarray_ptr (*request_virt_sarray) (j_common_ptr cinfo, int pool_id,
|
889
|
+
boolean pre_zero,
|
890
|
+
JDIMENSION samplesperrow,
|
891
|
+
JDIMENSION numrows,
|
892
|
+
JDIMENSION maxaccess);
|
893
|
+
jvirt_barray_ptr (*request_virt_barray) (j_common_ptr cinfo, int pool_id,
|
894
|
+
boolean pre_zero,
|
895
|
+
JDIMENSION blocksperrow,
|
896
|
+
JDIMENSION numrows,
|
897
|
+
JDIMENSION maxaccess);
|
898
|
+
void (*realize_virt_arrays) (j_common_ptr cinfo);
|
899
|
+
JSAMPARRAY (*access_virt_sarray) (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
|
900
|
+
JDIMENSION start_row, JDIMENSION num_rows,
|
901
|
+
boolean writable);
|
902
|
+
JBLOCKARRAY (*access_virt_barray) (j_common_ptr cinfo, jvirt_barray_ptr ptr,
|
903
|
+
JDIMENSION start_row, JDIMENSION num_rows,
|
904
|
+
boolean writable);
|
905
|
+
void (*free_pool) (j_common_ptr cinfo, int pool_id);
|
906
|
+
void (*self_destruct) (j_common_ptr cinfo);
|
907
|
+
|
908
|
+
/* Limit on memory allocation for this JPEG object. (Note that this is
|
909
|
+
* merely advisory, not a guaranteed maximum; it only affects the space
|
910
|
+
* used for virtual-array buffers.) May be changed by outer application
|
911
|
+
* after creating the JPEG object.
|
912
|
+
*/
|
913
|
+
long max_memory_to_use;
|
914
|
+
|
915
|
+
/* Maximum allocation request accepted by alloc_large. */
|
916
|
+
long max_alloc_chunk;
|
917
|
+
};
|
918
|
+
|
919
|
+
|
920
|
+
/* Routine signature for application-supplied marker processing methods.
|
921
|
+
* Need not pass marker code since it is stored in cinfo->unread_marker.
|
922
|
+
*/
|
923
|
+
typedef boolean (*jpeg_marker_parser_method) (j_decompress_ptr cinfo);
|
924
|
+
|
925
|
+
|
926
|
+
/* Originally, this macro was used as a way of defining function prototypes
|
927
|
+
* for both modern compilers as well as older compilers that did not support
|
928
|
+
* prototype parameters. libjpeg-turbo has never supported these older,
|
929
|
+
* non-ANSI compilers, but the macro is still included because there is some
|
930
|
+
* software out there that uses it.
|
931
|
+
*/
|
932
|
+
|
933
|
+
#define JPP(arglist) arglist
|
934
|
+
|
935
|
+
|
936
|
+
/* Default error-management setup */
|
937
|
+
EXTERN(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr * err);
|
938
|
+
|
939
|
+
/* Initialization of JPEG compression objects.
|
940
|
+
* jpeg_create_compress() and jpeg_create_decompress() are the exported
|
941
|
+
* names that applications should call. These expand to calls on
|
942
|
+
* jpeg_CreateCompress and jpeg_CreateDecompress with additional information
|
943
|
+
* passed for version mismatch checking.
|
944
|
+
* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
|
945
|
+
*/
|
946
|
+
#define jpeg_create_compress(cinfo) \
|
947
|
+
jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
|
948
|
+
(size_t) sizeof(struct jpeg_compress_struct))
|
949
|
+
#define jpeg_create_decompress(cinfo) \
|
950
|
+
jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
|
951
|
+
(size_t) sizeof(struct jpeg_decompress_struct))
|
952
|
+
EXTERN(void) jpeg_CreateCompress (j_compress_ptr cinfo, int version,
|
953
|
+
size_t structsize);
|
954
|
+
EXTERN(void) jpeg_CreateDecompress (j_decompress_ptr cinfo, int version,
|
955
|
+
size_t structsize);
|
956
|
+
/* Destruction of JPEG compression objects */
|
957
|
+
EXTERN(void) jpeg_destroy_compress (j_compress_ptr cinfo);
|
958
|
+
EXTERN(void) jpeg_destroy_decompress (j_decompress_ptr cinfo);
|
959
|
+
|
960
|
+
/* Standard data source and destination managers: stdio streams. */
|
961
|
+
/* Caller is responsible for opening the file before and closing after. */
|
962
|
+
EXTERN(void) jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile);
|
963
|
+
EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile);
|
964
|
+
|
965
|
+
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
966
|
+
/* Data source and destination managers: memory buffers. */
|
967
|
+
EXTERN(void) jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer,
|
968
|
+
unsigned long * outsize);
|
969
|
+
EXTERN(void) jpeg_mem_src (j_decompress_ptr cinfo, const unsigned char * inbuffer,
|
970
|
+
unsigned long insize);
|
971
|
+
#endif
|
972
|
+
|
973
|
+
/* Default parameter setup for compression */
|
974
|
+
EXTERN(void) jpeg_set_defaults (j_compress_ptr cinfo);
|
975
|
+
/* Compression parameter setup aids */
|
976
|
+
EXTERN(void) jpeg_set_colorspace (j_compress_ptr cinfo,
|
977
|
+
J_COLOR_SPACE colorspace);
|
978
|
+
EXTERN(void) jpeg_default_colorspace (j_compress_ptr cinfo);
|
979
|
+
EXTERN(void) jpeg_set_quality (j_compress_ptr cinfo, int quality,
|
980
|
+
boolean force_baseline);
|
981
|
+
EXTERN(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
|
982
|
+
boolean force_baseline);
|
983
|
+
#if JPEG_LIB_VERSION >= 70
|
984
|
+
EXTERN(void) jpeg_default_qtables (j_compress_ptr cinfo,
|
985
|
+
boolean force_baseline);
|
986
|
+
#endif
|
987
|
+
EXTERN(void) jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
|
988
|
+
const unsigned int *basic_table,
|
989
|
+
int scale_factor, boolean force_baseline);
|
990
|
+
EXTERN(int) jpeg_quality_scaling (int quality);
|
991
|
+
EXTERN(float) jpeg_float_quality_scaling (float quality);
|
992
|
+
EXTERN(void) jpeg_simple_progression (j_compress_ptr cinfo);
|
993
|
+
EXTERN(void) jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress);
|
994
|
+
EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table (j_common_ptr cinfo);
|
995
|
+
EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table (j_common_ptr cinfo);
|
996
|
+
|
997
|
+
/* Main entry points for compression */
|
998
|
+
EXTERN(void) jpeg_start_compress (j_compress_ptr cinfo,
|
999
|
+
boolean write_all_tables);
|
1000
|
+
EXTERN(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo,
|
1001
|
+
JSAMPARRAY scanlines,
|
1002
|
+
JDIMENSION num_lines);
|
1003
|
+
EXTERN(void) jpeg_finish_compress (j_compress_ptr cinfo);
|
1004
|
+
|
1005
|
+
#if JPEG_LIB_VERSION >= 70
|
1006
|
+
/* Precalculate JPEG dimensions for current compression parameters. */
|
1007
|
+
EXTERN(void) jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo);
|
1008
|
+
#endif
|
1009
|
+
|
1010
|
+
/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
|
1011
|
+
EXTERN(JDIMENSION) jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
|
1012
|
+
JDIMENSION num_lines);
|
1013
|
+
|
1014
|
+
/* Write a special marker. See libjpeg.txt concerning safe usage. */
|
1015
|
+
EXTERN(void) jpeg_write_marker (j_compress_ptr cinfo, int marker,
|
1016
|
+
const JOCTET * dataptr, unsigned int datalen);
|
1017
|
+
/* Same, but piecemeal. */
|
1018
|
+
EXTERN(void) jpeg_write_m_header (j_compress_ptr cinfo, int marker,
|
1019
|
+
unsigned int datalen);
|
1020
|
+
EXTERN(void) jpeg_write_m_byte (j_compress_ptr cinfo, int val);
|
1021
|
+
|
1022
|
+
/* Alternate compression function: just write an abbreviated table file */
|
1023
|
+
EXTERN(void) jpeg_write_tables (j_compress_ptr cinfo);
|
1024
|
+
|
1025
|
+
/* Decompression startup: read start of JPEG datastream to see what's there */
|
1026
|
+
EXTERN(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image);
|
1027
|
+
/* Return value is one of: */
|
1028
|
+
#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
|
1029
|
+
#define JPEG_HEADER_OK 1 /* Found valid image datastream */
|
1030
|
+
#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
|
1031
|
+
/* If you pass require_image = TRUE (normal case), you need not check for
|
1032
|
+
* a TABLES_ONLY return code; an abbreviated file will cause an error exit.
|
1033
|
+
* JPEG_SUSPENDED is only possible if you use a data source module that can
|
1034
|
+
* give a suspension return (the stdio source module doesn't).
|
1035
|
+
*/
|
1036
|
+
|
1037
|
+
/* Main entry points for decompression */
|
1038
|
+
EXTERN(boolean) jpeg_start_decompress (j_decompress_ptr cinfo);
|
1039
|
+
EXTERN(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo,
|
1040
|
+
JSAMPARRAY scanlines,
|
1041
|
+
JDIMENSION max_lines);
|
1042
|
+
EXTERN(boolean) jpeg_finish_decompress (j_decompress_ptr cinfo);
|
1043
|
+
|
1044
|
+
/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
|
1045
|
+
EXTERN(JDIMENSION) jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
|
1046
|
+
JDIMENSION max_lines);
|
1047
|
+
|
1048
|
+
/* Additional entry points for buffered-image mode. */
|
1049
|
+
EXTERN(boolean) jpeg_has_multiple_scans (const j_decompress_ptr cinfo);
|
1050
|
+
EXTERN(boolean) jpeg_start_output (j_decompress_ptr cinfo, int scan_number);
|
1051
|
+
EXTERN(boolean) jpeg_finish_output (j_decompress_ptr cinfo);
|
1052
|
+
EXTERN(boolean) jpeg_input_complete (const j_decompress_ptr cinfo);
|
1053
|
+
EXTERN(void) jpeg_new_colormap (j_decompress_ptr cinfo);
|
1054
|
+
EXTERN(int) jpeg_consume_input (j_decompress_ptr cinfo);
|
1055
|
+
/* Return value is one of: */
|
1056
|
+
/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */
|
1057
|
+
#define JPEG_REACHED_SOS 1 /* Reached start of new scan */
|
1058
|
+
#define JPEG_REACHED_EOI 2 /* Reached end of image */
|
1059
|
+
#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */
|
1060
|
+
#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
|
1061
|
+
|
1062
|
+
/* Precalculate output dimensions for current decompression parameters. */
|
1063
|
+
#if JPEG_LIB_VERSION >= 80
|
1064
|
+
EXTERN(void) jpeg_core_output_dimensions (j_decompress_ptr cinfo);
|
1065
|
+
#endif
|
1066
|
+
EXTERN(void) jpeg_calc_output_dimensions (j_decompress_ptr cinfo);
|
1067
|
+
|
1068
|
+
/* Control saving of COM and APPn markers into marker_list. */
|
1069
|
+
EXTERN(void) jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
|
1070
|
+
unsigned int length_limit);
|
1071
|
+
|
1072
|
+
/* Install a special processing method for COM or APPn markers. */
|
1073
|
+
EXTERN(void) jpeg_set_marker_processor (j_decompress_ptr cinfo,
|
1074
|
+
int marker_code,
|
1075
|
+
jpeg_marker_parser_method routine);
|
1076
|
+
|
1077
|
+
/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
|
1078
|
+
EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients (j_decompress_ptr cinfo);
|
1079
|
+
EXTERN(void) jpeg_write_coefficients (j_compress_ptr cinfo,
|
1080
|
+
jvirt_barray_ptr * coef_arrays);
|
1081
|
+
EXTERN(void) jpeg_copy_critical_parameters (const j_decompress_ptr srcinfo,
|
1082
|
+
j_compress_ptr dstinfo);
|
1083
|
+
|
1084
|
+
/* If you choose to abort compression or decompression before completing
|
1085
|
+
* jpeg_finish_(de)compress, then you need to clean up to release memory,
|
1086
|
+
* temporary files, etc. You can just call jpeg_destroy_(de)compress
|
1087
|
+
* if you're done with the JPEG object, but if you want to clean it up and
|
1088
|
+
* reuse it, call this:
|
1089
|
+
*/
|
1090
|
+
EXTERN(void) jpeg_abort_compress (j_compress_ptr cinfo);
|
1091
|
+
EXTERN(void) jpeg_abort_decompress (j_decompress_ptr cinfo);
|
1092
|
+
|
1093
|
+
/* Generic versions of jpeg_abort and jpeg_destroy that work on either
|
1094
|
+
* flavor of JPEG object. These may be more convenient in some places.
|
1095
|
+
*/
|
1096
|
+
EXTERN(void) jpeg_abort (j_common_ptr cinfo);
|
1097
|
+
EXTERN(void) jpeg_destroy (j_common_ptr cinfo);
|
1098
|
+
|
1099
|
+
/* Default restart-marker-resync procedure for use by data source modules */
|
1100
|
+
EXTERN(boolean) jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired);
|
1101
|
+
|
1102
|
+
/* Accessor functions for extension parameters */
|
1103
|
+
EXTERN(boolean) jpeg_c_bool_param_supported (const j_compress_ptr cinfo,
|
1104
|
+
J_BOOLEAN_PARAM param);
|
1105
|
+
EXTERN(void) jpeg_c_set_bool_param (j_compress_ptr cinfo,
|
1106
|
+
J_BOOLEAN_PARAM param, boolean value);
|
1107
|
+
EXTERN(boolean) jpeg_c_get_bool_param (const j_compress_ptr cinfo,
|
1108
|
+
J_BOOLEAN_PARAM param);
|
1109
|
+
|
1110
|
+
EXTERN(boolean) jpeg_c_float_param_supported (const j_compress_ptr cinfo,
|
1111
|
+
J_FLOAT_PARAM param);
|
1112
|
+
EXTERN(void) jpeg_c_set_float_param (j_compress_ptr cinfo, J_FLOAT_PARAM param,
|
1113
|
+
float value);
|
1114
|
+
EXTERN(float) jpeg_c_get_float_param (const j_compress_ptr cinfo,
|
1115
|
+
J_FLOAT_PARAM param);
|
1116
|
+
|
1117
|
+
EXTERN(boolean) jpeg_c_int_param_supported (const j_compress_ptr cinfo,
|
1118
|
+
J_INT_PARAM param);
|
1119
|
+
EXTERN(void) jpeg_c_set_int_param (j_compress_ptr cinfo, J_INT_PARAM param,
|
1120
|
+
int value);
|
1121
|
+
EXTERN(int) jpeg_c_get_int_param (const j_compress_ptr cinfo, J_INT_PARAM param);
|
1122
|
+
|
1123
|
+
|
1124
|
+
/* These marker codes are exported since applications and data source modules
|
1125
|
+
* are likely to want to use them.
|
1126
|
+
*/
|
1127
|
+
|
1128
|
+
#define JPEG_RST0 0xD0 /* RST0 marker code */
|
1129
|
+
#define JPEG_EOI 0xD9 /* EOI marker code */
|
1130
|
+
#define JPEG_APP0 0xE0 /* APP0 marker code */
|
1131
|
+
#define JPEG_COM 0xFE /* COM marker code */
|
1132
|
+
|
1133
|
+
|
1134
|
+
/* If we have a brain-damaged compiler that emits warnings (or worse, errors)
|
1135
|
+
* for structure definitions that are never filled in, keep it quiet by
|
1136
|
+
* supplying dummy definitions for the various substructures.
|
1137
|
+
*/
|
1138
|
+
|
1139
|
+
#ifdef INCOMPLETE_TYPES_BROKEN
|
1140
|
+
#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */
|
1141
|
+
struct jvirt_sarray_control { long dummy; };
|
1142
|
+
struct jvirt_barray_control { long dummy; };
|
1143
|
+
struct jpeg_comp_master { long dummy; };
|
1144
|
+
struct jpeg_c_main_controller { long dummy; };
|
1145
|
+
struct jpeg_c_prep_controller { long dummy; };
|
1146
|
+
struct jpeg_c_coef_controller { long dummy; };
|
1147
|
+
struct jpeg_marker_writer { long dummy; };
|
1148
|
+
struct jpeg_color_converter { long dummy; };
|
1149
|
+
struct jpeg_downsampler { long dummy; };
|
1150
|
+
struct jpeg_forward_dct { long dummy; };
|
1151
|
+
struct jpeg_entropy_encoder { long dummy; };
|
1152
|
+
struct jpeg_decomp_master { long dummy; };
|
1153
|
+
struct jpeg_d_main_controller { long dummy; };
|
1154
|
+
struct jpeg_d_coef_controller { long dummy; };
|
1155
|
+
struct jpeg_d_post_controller { long dummy; };
|
1156
|
+
struct jpeg_input_controller { long dummy; };
|
1157
|
+
struct jpeg_marker_reader { long dummy; };
|
1158
|
+
struct jpeg_entropy_decoder { long dummy; };
|
1159
|
+
struct jpeg_inverse_dct { long dummy; };
|
1160
|
+
struct jpeg_upsampler { long dummy; };
|
1161
|
+
struct jpeg_color_deconverter { long dummy; };
|
1162
|
+
struct jpeg_color_quantizer { long dummy; };
|
1163
|
+
#endif /* JPEG_INTERNALS */
|
1164
|
+
#endif /* INCOMPLETE_TYPES_BROKEN */
|
1165
|
+
|
1166
|
+
|
1167
|
+
/*
|
1168
|
+
* The JPEG library modules define JPEG_INTERNALS before including this file.
|
1169
|
+
* The internal structure declarations are read only when that is true.
|
1170
|
+
* Applications using the library should not include jpegint.h, but may wish
|
1171
|
+
* to include jerror.h.
|
1172
|
+
*/
|
1173
|
+
|
1174
|
+
#ifdef JPEG_INTERNALS
|
1175
|
+
#include "jpegint.h" /* fetch private declarations */
|
1176
|
+
#include "jerror.h" /* fetch error codes too */
|
1177
|
+
#endif
|
1178
|
+
|
1179
|
+
#ifdef __cplusplus
|
1180
|
+
#ifndef DONT_USE_EXTERN_C
|
1181
|
+
}
|
1182
|
+
#endif
|
1183
|
+
#endif
|
1184
|
+
|
1185
|
+
#endif /* JPEGLIB_H */
|