diff options
author | Aaron Gable <agable@chromium.org> | 2015-08-03 09:34:32 -0700 |
---|---|---|
committer | Aaron Gable <agable@chromium.org> | 2015-08-03 09:34:32 -0700 |
commit | c9c8755c326b42c8d0dc938ec3f0d1d648bd361a (patch) | |
tree | 7ebff33dec9b7cc37d65746e0d89f32cb74d141e /jdarith.c | |
parent | 7a6ab4e9ce76b07ac406a20700eb97b7dd6d05f5 (diff) |
Add jpeg_skip_scanlines() API to libjpeg-turbo
jpeg_skip_scanlines() API, a subset decoding optimization
aimed at Android, was submitted upstream r1582. Pull that
change, and sundry fixes, into the Chromium repo.
This new API is targetted at Android devices, not Chrome,
and should have no affect on JPEG decode behavior or perf
of Chrome.
Chrome uses suspending data source JPEG decoding, and the
new API does not support such sources. Adding support for
suspending data sources is a future TODO, should the need
arise (refer to skbug.com/4036).
BUG=515694
BUG=468914
patch from issue 256280043 at patchset 50001 (http://crrev.com/256280043#ps50001)
R=agable@chromium.org
Review URL: https://codereview.chromium.org/1271803002 .
Diffstat (limited to 'jdarith.c')
-rw-r--r-- | jdarith.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,8 +1,10 @@ /* * jdarith.c * + * This file is part of the Independent JPEG Group's software: * Developed 1997-2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * libjpeg-turbo Modifications: + * Copyright (C) 2015, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains portable arithmetic entropy decoding routines for JPEG @@ -514,7 +516,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) /* Outer loop handles each block in the MCU */ for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - block = MCU_data[blkn]; + block = MCU_data ? MCU_data[blkn] : NULL; ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; @@ -561,7 +563,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) entropy->last_dc_val[ci] += v; } - (*block)[0] = (JCOEF) entropy->last_dc_val[ci]; + if (block) + (*block)[0] = (JCOEF) entropy->last_dc_val[ci]; /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */ @@ -605,7 +608,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) while (m >>= 1) if (arith_decode(cinfo, st)) v |= m; v += 1; if (sign) v = -v; - (*block)[jpeg_natural_order[k]] = (JCOEF) v; + if (block) + (*block)[jpeg_natural_order[k]] = (JCOEF) v; } } |