• Home
  • Raw
  • Download

Lines Matching refs:JPEG

1 USING THE IJG JPEG LIBRARY
3 This file was part of the Independent JPEG Group's software:
11 This file describes how to use the IJG JPEG library within an application
15 JPEG library. Also see jpeglib.h (the include file to be used by application
46 Progressive JPEG support
69 The IJG JPEG library provides C code to read and write JPEG-compressed image
76 JPEG standard but is necessary for typical applications of JPEG. These
77 functions preprocess the image before JPEG compression or postprocess it after
84 A wide range of quality vs. speed tradeoffs are possible in JPEG processing,
90 low-quality modes may not meet the JPEG standard's accuracy requirements;
94 the ISO JPEG standard; most baseline, extended-sequential, and progressive
95 JPEG processes are supported. (Our subset includes all features now in common
98 * Lossless JPEG
105 By itself, the library handles only interchange JPEG datastreams --- in
107 surrounding code to process interchange or abbreviated JPEG datastreams that
109 used by the free LIBTIFF library to support JPEG compression in TIFF.)
115 The rough outline of a JPEG compression operation is:
117 Allocate and initialize a JPEG compression object
124 Release the JPEG compression object
126 A JPEG compression object holds parameters and working state for the JPEG
130 same parameter settings for a sequence of images. Re-use of a JPEG object
131 also has important implications for processing abbreviated JPEG datastreams,
141 Similarly, the rough outline of a JPEG decompression operation is:
143 Allocate and initialize a JPEG decompression object
151 Release the JPEG decompression object
165 by calling jpeg_abort(); or, if you do not need to retain the JPEG object,
168 JPEG compression and decompression objects are two separate struct types.
172 The JPEG library has no static variables: all state is in the compression
174 compression and decompression operations concurrently, using multiple JPEG
189 image data format that the JPEG library expects or returns.
198 programs don't work with grayscale JPEG files.
200 There is no provision for colormapped input. JPEG files are always full-color
203 JPEG often doesn't work very well with source data that has been colormapped,
204 because of dithering noise. This is discussed in more detail in the JPEG FAQ
236 except that colormapped output is supported. (Again, a JPEG file is never
245 (ie, at most 256 colors for an 8-bit JPEG library).
251 Here we revisit the JPEG compression outline given in the overview.
253 1. Allocate and initialize a JPEG compression object.
255 A JPEG compression object is a "struct jpeg_compress_struct". (It also has
259 whole JPEG compression sequence. Otherwise it can be static or allocated
262 You will also need a structure representing a JPEG error handler. The part
267 handler. The default error handler will print JPEG error/warning messages
271 the JPEG object's "err" field, and then call jpeg_create_compress() to
272 initialize the rest of the JPEG object.
289 As previously mentioned, the JPEG library delivers compressed data to a
322 fields in the JPEG object (cinfo structure):
329 The image dimensions are, hopefully, obvious. JPEG supports image dimensions
336 JPEG has a large number of compression parameters that determine how the
365 storage, and emit the first few bytes of the JPEG datastream header.
371 The "TRUE" parameter ensures that a complete JPEG interchange datastream
376 Once you have called jpeg_start_compress(), you may not alter any JPEG
377 parameters or other fields of the JPEG object until you have completed
390 Image data should be written in top-to-bottom scanline order. The JPEG spec
395 the JPEG library's virtual array mechanism to invert the data efficiently.
399 in the next_scanline field of the JPEG object. Usually you can just use
435 jpeg_finish_compress() also releases working memory associated with the JPEG
455 After completing a compression cycle, you may dispose of the JPEG object
459 If you do not change any JPEG parameters, the new datastream will be written
466 7. Release the JPEG compression object.
468 When you are done with a JPEG compression object, destroy it by calling
491 * If you don't need the JPEG object any more, just call
496 * If you want to re-use the JPEG object, call jpeg_abort_compress(), or call
505 jpeg_destroy() and jpeg_abort() are the only safe calls to make on a JPEG
514 Here we revisit the JPEG decompression outline given in the overview.
516 1. Allocate and initialize a JPEG decompression object.
536 As previously mentioned, the JPEG library reads compressed data from a "data
562 jpeg_finish_decompress(). If you wish to read a series of JPEG images from
564 jpeg_finish_decompress() sequence without reinitializing either the JPEG
577 info have been stored in the JPEG object. The application may wish to
584 * Abbreviated JPEG files are to be processed --- see the section on
586 interchange JPEG files need not be concerned with this case either.
589 image dimensions and other header info for a JPEG file. In that case,
590 call jpeg_destroy() when you are done with the JPEG object, or call
626 to complete. With a single-scan (non progressive) JPEG file and default
631 scaling, are available in the JPEG object; so is the selected colormap, if
649 Note: if you are using the JPEG library's internal memory manager to allocate
669 out the image in bottom-to-top order, you can use the JPEG library's virtual
674 in the output_scanline field of the JPEG object. Usually you can just use
696 with the JPEG object to be released.
709 After completing a decompression cycle, you may dispose of the JPEG object as
715 8. Release the JPEG decompression object.
717 When you are done with a JPEG decompression object, destroy it by calling
729 jpeg_destroy() if you don't need the JPEG object any more, or
738 that wish to view only a portion of a large JPEG image without decompressing
748 multiple rows in the JPEG image.
764 particular vertical offset in the JPEG image in order to decode a subset of the
770 1) JPEG decompression occurs in blocks, so if jpeg_skip_scanlines() is
787 only a portion of each row in the JPEG image. It must be called after
822 Applications using the JPEG library should include the header file jpeglib.h
828 If the application needs to refer to individual JPEG library error codes, also
832 installing the JPEG header files in a system directory, you will want to
835 The most convenient way to include the JPEG code into your executable program
842 While you can build the JPEG library as a shared library if the whim strikes
853 It may be worth pointing out that the core JPEG library does not actually
867 This section describes all the optional parameters you can set for JPEG
870 of the JPEG standard; if you don't know what a parameter is for, it's best
872 more info about JPEG.
875 all the parameters; that way your code is more likely to work with future JPEG
883 This routine sets all JPEG parameters to reasonable defaults, using
889 Sets the JPEG file's colorspace (field jpeg_color_space) as specified,
897 Selects an appropriate JPEG colorspace based on cinfo->in_color_space,
900 just the colorspace-dependent JPEG parameters.
903 Constructs JPEG quantization tables appropriate for the indicated
909 entries are constrained to the range 1..255 for full JPEG baseline
948 the basic table to be given in JPEG zigzag order. If you need to
954 Generates a default scan script for writing a progressive-JPEG file.
957 the JPEG color space is set correctly before calling this routine.
995 The JPEG color space and corresponding number of components; see
1011 To emit restart markers in the JPEG file, set one of these nonzero.
1017 NOTE: the overhead of restart markers is higher in grayscale JPEG
1025 single-scan sequential JPEG file. If not NULL, scan_info points to
1027 compressor will then write a JPEG file having one scan for each scan
1029 progressive JPEG files. The library checks that the scan array
1030 defines a valid JPEG scan sequence. (jpeg_simple_progression creates
1031 a suitable scan definition array for progressive JPEG.) This is
1032 discussed further under "Progressive JPEG support".
1041 jpeg_set_colorspace() set this TRUE if a JFIF-legal JPEG color space
1061 jpeg_set_colorspace() set this TRUE if JPEG color space RGB, CMYK,
1065 default behavior ensures that the JPEG file's color space can be
1081 Note that the q_scale_factor[] values use "linear" scales, so JPEG
1107 JPEG sample tables by jpeg_set_defaults(). If you need to allocate
1115 The actual dimensions of the JPEG image that will be written to the file are
1128 JPEG color space, *not* the source image color space. A suitably large
1133 The one-byte identifier code to be recorded in the JPEG file for
1140 be 1..4 according to the JPEG standard. Note that larger sampling
1165 parameter selection, since all of the JPEG internal parameters are
1175 The following fields in the JPEG object are set by jpeg_read_header() and
1191 The JPEG color space, unfortunately, is something of a guess since the JPEG
1258 CAUTION: if the JPEG library creates its own colormap, the storage
1277 SIMD extensions.) If the JPEG image was compressed using a quality
1287 actually produce a more lossy output image than if the JPEG image had
1302 progressive JPEG files; if FALSE, not. Default is TRUE. Early
1321 JPEG library's memory manager to allocate output buffer space, because you
1348 The JPEG standard itself is "color blind" and doesn't specify any particular
1351 existing de-facto JPEG file format standards specify YCbCr or grayscale data
1356 The JPEG library can handle the most common colorspace conversions (namely
1363 in_color_space. This is transformed to the JPEG file's color space given
1364 by jpeg_color_space. jpeg_set_defaults() chooses a reasonable JPEG color
1376 indicate the color space of the JPEG file. It is important to ensure that
1377 these are written correctly, or omitted if the JPEG file's color space is not
1380 properly, so long as it is told the truth about the JPEG color space.
1392 For decompression, the JPEG file's color space is given in jpeg_color_space,
1396 guess. If you know the JPEG file's color space for certain, you can override
1416 CAUTION: it appears that Adobe Photoshop writes inverted data in CMYK JPEG
1422 Photoshop versions prior to 3.0 write EPS files containing JPEG-encoded CMYK
1423 data in the same inverted-YCCK representation used in bare JPEG files, but
1426 EPS/JPEG files, and will omit the PS-level inversion. (But the data
1427 polarity used in bare JPEG files will not change in 3.0.) In either case,
1428 the JPEG library must not invert the data itself, or else Ghostscript would
1435 When the default error handler is used, any error detected inside the JPEG
1442 The JPEG library never writes any message directly; it always goes through
1451 You may, if you wish, simply replace the entire JPEG error handling module
1458 All of the error handling routines will receive a pointer to the JPEG object
1463 additional data which is not known to the JPEG library or the standard error
1464 handler. The most convenient way to do this is to embed either the JPEG
1469 JPEG object, which the application can also use to find related data.
1481 clean up the JPEG object with jpeg_abort() or jpeg_destroy().
1484 Actual output of any JPEG message. Override this to send messages
1501 Only error_exit() and emit_message() are called from the rest of the JPEG
1507 JPEG library code. You could replace the message texts (for instance, with
1537 The JPEG compression library sends its compressed data to a "destination
1604 the JPEG compression object. This can be done in-line in your setup code if
1680 pointers, and insert a pointer to the struct into the "src" field of the JPEG
1692 Some applications need to use the JPEG library as an incremental memory-to-
1710 that it has done nothing. Upon seeing this, the JPEG library suspends
1713 JPEG library again.
1742 The compressor does not allow suspension while it is trying to write JPEG
1811 The decompressor does not attempt to suspend within standard JPEG markers;
1814 longest standard marker in the file. Standard JPEG markers should normally
1847 If the JPEG library has not moved the pointer/count forward in the current
1864 Progressive JPEG support
1867 Progressive JPEG rearranges the stored data into a series of scans of
1868 increasing quality. In situations where a JPEG file is transmitted across a
1872 identical to that of a regular (sequential) JPEG file of the same quality
1873 setting. Progressive JPEG files are often slightly smaller than equivalent
1874 sequential JPEG files, but the possibility of incremental display is the main
1875 reason for using progressive JPEG.
1877 The IJG encoder library generates progressive JPEG files when given a
1879 Creation of progressive JPEG files is otherwise transparent to the encoder.
1880 Progressive JPEG files can also be read transparently by the decoder library.
1888 Each displayed scan requires about as much work to decode as a full JPEG
1903 To create a progressive JPEG file (or a multiple-scan sequential JPEG file),
1918 mode when creating a progressive JPEG file, because the default Huffman
1940 This mode is typically used for incremental display of progressive JPEG files,
1941 but it can be used with any JPEG file. Each scan of a progressive JPEG file
2015 routine can be called at any time after initializing the JPEG object. It
2033 This is discussed further under "I/O suspension", above. (Note: the JPEG
2036 same JPEG object in another thread.)
2187 This setting is relevant only when decoding a progressive JPEG image.
2263 for all JPEG images, even single-scan ones. This will work, but it is
2268 maximum performance on baseline JPEG files, you should use buffered-image
2278 possible. If the JPEG memory manager has to use a temporary file, you will
2302 A JPEG compression or decompression object can be reused to process multiple
2305 feature. Rather, reuse of an object provides support for abbreviated JPEG
2309 A JPEG file normally contains several hundred bytes worth of quantization
2312 The JPEG standard therefore permits tables to be omitted. The standard
2313 defines three classes of JPEG datastreams:
2315 the image. These are the usual kind of JPEG file.
2334 The JPEG library provides support for reading and writing any combination of
2372 create JPEG compression object
2373 set JPEG parameters
2381 Since the JPEG parameters are not altered between writing the table file and
2394 a JPEG decompression object to read the specification file, then copying the
2439 create JPEG decompression object
2461 without releasing/recreating the JPEG object or the data source module.
2479 Some applications may need to insert or extract special data in the JPEG
2480 datastream. The JPEG standard provides marker types "COM" (comment) and
2506 selected JPEG colorspace is grayscale or YCbCr, or an Adobe APP14 marker if
2509 Adobe markers and will set the JPEG colorspace properly when one is found.
2584 within the JPEG file includes it. (Hence the maximum data length is really
2639 Some applications need to supply already-downsampled image data to the JPEG
2653 in the JPEG file (please read the earlier section on Special color spaces)
2654 and downsampled to the sampling factors specified in the JPEG parameters.
2655 You must supply the data in the format used internally by the JPEG library,
2762 It is possible to read or write the contents of a JPEG file as raw DCT
2764 transcoding between different JPEG file formats. Other possible applications
2765 include lossless cropping of a JPEG image, lossless reassembly of a
2766 multi-strip or multi-tile TIFF/JPEG file into a single JPEG datastream, etc.
2768 To read the contents of a JPEG file as DCT coefficients, open the file and do
2773 descriptors. Each virtual array can be accessed directly using the JPEG
2776 for simple transcoding to a different JPEG file format, the array list can
2780 normal array order (not JPEG zigzag order). The block arrays contain only
2806 To write the contents of a JPEG file as DCT coefficients, you must provide
2808 block arrays read from an input JPEG file by jpeg_read_coefficients(), or
2809 allocate virtual arrays from the JPEG compression object and fill them
2830 When writing raw DCT coefficients, it is crucial that the JPEG quantization
2832 resulting file will be invalid. For transcoding from an existing JPEG file,
2837 JPEG input file --- that is, it should be awaiting jpeg_finish_decompress().
2842 emitting abbreviated JPEG files by accident. If you really want to emit an
2843 abbreviated JPEG file, call jpeg_suppress_tables(), or set the tables'
2851 Some applications may need to regain control from the JPEG library every so
2878 make sure it will live as long as the JPEG object does. Allocating from the
2879 JPEG memory manager with lifetime JPOOL_PERMANENT will work nicely.) You
2898 depends on the number of scans in the JPEG file, which isn't always known in
2918 This section covers some key facts about the JPEG library's built-in memory
2927 Some data is allocated "permanently" and will not be freed until the JPEG
2933 Use JPOOL_PERMANENT to get storage that lasts as long as the JPEG object.
2948 after creating the JPEG object. (Of course, there is still a minimum size for
2968 JPEG process), and operating mode (application-selected options).
2978 3. A full-image DCT coefficient buffer is needed to decode a multi-scan JPEG
2988 The above figures are valid for 8-bit JPEG data precision and a machine with
2989 32-bit ints. For 12-bit JPEG data, double the size of the strip buffers and
3014 The JPEG standard provides for both the baseline 8-bit DCT process and
3015 a 12-bit DCT process. The IJG code supports 12-bit lossy JPEG if you define
3033 by MAX_COMPONENTS. The JPEG standard allows up to 255 components, but we
3061 The JPEG library has been written to be extremely portable; the sample
3091 The JPEG library proper does not assume ASCII representation of characters.
3096 The JPEG library does not rely heavily on the C library. In particular, C