8 * Copyright (C) 1998, Thomas G. Lane.
9 * This file is part of the Independent JPEG Group's software.
10 * For conditions of distribution and use, see the accompanying README file.
12 * This file contains the control logic for the lossless JPEG decompressor.
15 #define JPEG_INTERNALS
21 #ifdef D_LOSSLESS_SUPPORTED
24 * Compute output image dimensions and related values.
28 calc_output_dimensions (j_decompress_ptr cinfo
)
30 /* Hardwire it to "no scaling" */
31 cinfo
->output_width
= cinfo
->image_width
;
32 cinfo
->output_height
= cinfo
->image_height
;
33 /* jdinput.c has already initialized codec_data_unit to 1,
34 * and has computed unscaled downsampled_width and downsampled_height.
40 * Initialize for an input processing pass.
44 start_input_pass (j_decompress_ptr cinfo
)
46 j_lossless_d_ptr losslsd
= (j_lossless_d_ptr
) cinfo
->codec
;
48 (*losslsd
->entropy_start_pass
) (cinfo
);
49 (*losslsd
->predict_start_pass
) (cinfo
);
50 (*losslsd
->scaler_start_pass
) (cinfo
);
51 (*losslsd
->diff_start_input_pass
) (cinfo
);
56 * Initialize the lossless decompression codec.
57 * This is called only once, during master selection.
61 jinit_lossless_d_codec(j_decompress_ptr cinfo
)
63 j_lossless_d_ptr losslsd
;
66 /* Create subobject in permanent pool */
67 losslsd
= (j_lossless_d_ptr
)
68 (*cinfo
->mem
->alloc_small
) ((j_common_ptr
) cinfo
, JPOOL_PERMANENT
,
69 SIZEOF(jpeg_lossless_d_codec
));
70 cinfo
->codec
= (struct jpeg_d_codec
*) losslsd
;
72 /* Initialize sub-modules */
73 /* Entropy decoding: either Huffman or arithmetic coding. */
74 if (cinfo
->arith_code
) {
75 ERREXIT(cinfo
, JERR_ARITH_NOTIMPL
);
77 jinit_lhuff_decoder(cinfo
);
81 jinit_undifferencer(cinfo
);
84 jinit_d_scaler(cinfo
);
86 use_c_buffer
= cinfo
->inputctl
->has_multiple_scans
|| cinfo
->buffered_image
;
87 jinit_d_diff_controller(cinfo
, use_c_buffer
);
89 /* Initialize method pointers.
91 * Note: consume_data, start_output_pass and decompress_data are
92 * assigned in jddiffct.c.
94 losslsd
->pub
.calc_output_dimensions
= calc_output_dimensions
;
95 losslsd
->pub
.start_input_pass
= start_input_pass
;
98 #endif /* D_LOSSLESS_SUPPORTED */