summaryrefslogtreecommitdiff
path: root/jdinput.c
diff options
context:
space:
mode:
authorDRC <information@libjpeg-turbo.org>2016-02-19 18:32:10 -0600
committerMatt Sarett <msarett@google.com>2016-02-22 12:41:17 -0500
commit0ef076fb7b326dc201b4ab3bd30fefd4e35ad1c4 (patch)
tree25418d0a0c4af0db25df96f084bf62fc9ab103ff /jdinput.c
parent83a8b415ea3dfa7b5c584c4239dd39b56f2bf6e0 (diff)
libjpeg API: Partial scanline decompression
This, in combination with the existing jpeg_skip_scanlines() function, provides the ability to crop the image both horizontally and vertically while decompressing (certain restrictions apply-- see libjpeg.txt.) This also cleans up the documentation of the line skipping feature and removes the "strip decompression" feature from djpeg, since the new cropping feature is a superset of it. Refer to #34 for discussion. Closes #34 Cherry picked from upstream: https://github.com/libjpeg-turbo/libjpeg-turbo/commit/3ab68cf563f6edc2608c085f5c8b2d5d5c61157e BUG:27290496 Change-Id: Id11312fa43959531bc6bea04ebb657c6e1140363
Diffstat (limited to 'jdinput.c')
-rw-r--r--jdinput.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/jdinput.c b/jdinput.c
index 6f4ea7b..25ed3f1 100644
--- a/jdinput.c
+++ b/jdinput.c
@@ -4,8 +4,10 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, D. R. Commander.
- * For conditions of distribution and use, see the accompanying README file.
+ * Copyright (C) 2010, 2016, D. R. Commander.
+ * Copyright (C) 2015, Google, Inc.
+ * For conditions of distribution and use, see the accompanying README.ijg
+ * file.
*
* This file contains input control logic for the JPEG decompressor.
* These routines are concerned with controlling the decompressor's input
@@ -104,6 +106,11 @@ initial_setup (j_decompress_ptr cinfo)
compptr->height_in_blocks = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
(long) (cinfo->max_v_samp_factor * DCTSIZE));
+ /* Set the first and last MCU columns to decompress from multi-scan images.
+ * By default, decompress all of the MCU columns.
+ */
+ cinfo->master->first_MCU_col[ci] = 0;
+ cinfo->master->last_MCU_col[ci] = compptr->width_in_blocks - 1;
/* downsampled_width and downsampled_height will also be overridden by
* jdmaster.c if we are doing full decompression. The transcoder library
* doesn't use these values, but the calling application might.