diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2018-01-22 15:20:29 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2018-01-22 15:20:29 +0000 |
commit | eb5d417375e1c7052aeb9f2532d34573bfd07f53 (patch) | |
tree | 38f254b734af60cdf6ec62d8e0c8db9c82f6f68e /xps/xpstiff.c | |
parent | f858f560061560cbd3670509206dfdd98fea4d07 (diff) | |
download | ghostpdl-eb5d417375e1c7052aeb9f2532d34573bfd07f53.tar.gz |
Feature - JPEG Pass through
This commit adds the capability for the PostScript and PDF interpreters
to pass JPEG compressed image data directly to a device (currently the
pdfwrite family of devices) as the original JPEG data.
This allows us to avoid the compression artefacts caused by decompressing
JPEG image data, and then applying JPEG compression again.
This works by having the JPEG decoder inquire (via spec_op) if the
current device would like the original uncompressed data. If so then it
instructs the JPEG stream decoder to call a routine which will use
more spec_ops to pass the uncompressed data to the device.
The interpreter still calls the image methods with the decompressed
data, its up to the device to ignore these calls while handling JPEG
pass-through.
We have to work this way in PostScript, as we must decompress the data
as it arrives in order to find the end of the DCT compressed data. In
addition, this allows the device to change its mind about accepting
compressed data directly if it discovers from the image data that it
is not suitable for preserving unchanged.
This approach does not work with the PXL and XPS interpreters. These
interpreters appear to completely decompress the JPEG data before
starting an image, unlike the PostScript and PDF interpreters where the
image methods are called as the stream is decopressed.
As a result this feature is disabled for these interpreters.
Diffstat (limited to 'xps/xpstiff.c')
-rw-r--r-- | xps/xpstiff.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/xps/xpstiff.c b/xps/xpstiff.c index 79aaed8a9..5c7d4e36e 100644 --- a/xps/xpstiff.c +++ b/xps/xpstiff.c @@ -383,6 +383,9 @@ xps_decode_tiff_jpeg(xps_context_t *ctx, xps_tiff_t *tiff, byte *rp, byte *rl, b jddp.templat = s_DCTD_template; jddp.memory = ctx->memory; jddp.scanline_buffer = NULL; + jddp.PassThrough = 0; + jddp.PassThroughfn = 0; + jddp.device = (void *)0; if ((code = gs_jpeg_create_decompress(&state)) < 0) return gs_throw(-1, "error in gs_jpeg_create_decompress"); |