]> git.saurik.com Git - wxWidgets.git/blob - src/tiff/contrib/ojpeg/jdhuff_add.c
export wxSettableHeaderColumn from DLL
[wxWidgets.git] / src / tiff / contrib / ojpeg / jdhuff_add.c
1 /*
2 * BEWARE OF KLUDGE: This subroutine is a hack for decoding illegal JPEG-in-
3 * TIFF encapsulations produced by Microsoft's Wang Imaging
4 * for Windows application with the public-domain TIFF Library. Based upon an
5 * examination of selected output files, this program apparently divides a JPEG
6 * bit-stream into consecutive horizontal TIFF "strips", such that the JPEG
7 * encoder's/decoder's DC coefficients for each image component are reset before
8 * each "strip". Moreover, a "strip" is not necessarily encoded in a multiple
9 * of 8 bits, so one must sometimes discard 1-7 bits at the end of each "strip"
10 * for alignment to the next input-Byte storage boundary. IJG JPEG Library
11 * decoder state is not normally exposed to client applications, so this sub-
12 * routine provides the TIFF Library with a "hook" to make these corrections.
13 * It should be called after "jpeg_start_decompress()" and before
14 * "jpeg_finish_decompress()", just before decoding each "strip" using
15 * "jpeg_read_raw_data()" or "jpeg_read_scanlines()".
16 *
17 * This kludge is not sanctioned or supported by the Independent JPEG Group, and
18 * future changes to the IJG JPEG Library might invalidate it. Do not send bug
19 * reports about this code to IJG developers. Instead, contact the author for
20 * advice: Scott B. Marovich <marovich@hpl.hp.com>, Hewlett-Packard Labs, 6/01.
21 */
22 GLOBAL(void)
23 jpeg_reset_huff_decode (register j_decompress_ptr cinfo,register float *refbw)
24 { register huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
25 register int ci = 0;
26
27 /* Re-initialize DC predictions */
28 do entropy->saved.last_dc_val[ci] = -refbw[ci << 1];
29 while (++ci < cinfo->comps_in_scan);
30 /* Discard encoded input bits, up to the next Byte boundary */
31 entropy->bitstate.bits_left &= ~7;
32 }