Release Notes
Open Source Used In AsyncOS 8.8 for Cisco Web Security Appliances
93
just call "jpeg_suppress_tables(&cinfo, TRUE)" after constructing all the
tables. If you want to emit some but not all tables, you'll need to set the
individual sent_table fields directly.
To create an abbreviated image, you must also call jpeg_start_compress()
with a second parameter of FALSE, not TRUE. Otherwise jpeg_start_compress()
will force all the sent_table fields to FALSE. (This is a safety feature to
prevent abbreviated images from being created accidentally.)
To create a tables-only file, perform the same parameter setup that you
normally would, but instead of calling jpeg_start_compress() and so on, call
jpeg_write_tables(&cinfo). This will write an abbreviated datastream
containing only SOI, DQT and/or DHT markers, and EOI. All the quantization
and Huffman tables that are currently defined in the compression object will
be emitted unless their sent_tables flag is already TRUE, and then all the
sent_tables flags will be set TRUE.
A sure-fire way to create matching tables-only and abbreviated image files
is to proceed as follows:
create JPEG compression object
set JPEG parameters
set destination to tables-only file
jpeg_write_tables(&cinfo);
set destination to image file
jpeg_start_compress(&cinfo, FALSE);
write data...
jpeg_finish_compress(&cinfo);
Since the JPEG parameters are not altered between writing the table file and
the abbreviated image file, the same tables are sure to be used. Of course,
you can repeat the jpeg_start_compress() ... jpeg_finish_compress() sequence
many times to produce many abbreviated image files matching the table file.
You cannot suppress output of the computed Huffman tables when Huffman
optimization is selected. (If you could, there'd be no way to decode the
image...) Generally, you don't want to set optimize_coding = TRUE when
you are trying to produce abbreviated files.
In some cases you might want to compress an image using tables which are
not stored in the application, but are defined in an interchange or
tables-only file readable by the application. This can be done by setting up
a JPEG decompression object to read the specification file, then copying the
tables into your compression object. See jpeg_copy_critical_parameters()
for an example of copying quantization tables.
To read abbreviated image files, you simply need to load the proper tables