4 * Copyright (C) 1998, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
8 * This file contains the control logic for the lossless JPEG decompressor.
11 #define JPEG_INTERNALS
17 #ifdef D_LOSSLESS_SUPPORTED
20 * Compute output image dimensions and related values.
24 calc_output_dimensions (j_decompress_ptr cinfo)
26 /* Hardwire it to "no scaling" */
27 cinfo->output_width = cinfo->image_width;
28 cinfo->output_height = cinfo->image_height;
29 /* jdinput.c has already initialized codec_data_unit to 1,
30 * and has computed unscaled downsampled_width and downsampled_height.
36 * Initialize for an input processing pass.
40 start_input_pass (j_decompress_ptr cinfo)
42 j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
44 (*losslsd->entropy_start_pass) (cinfo);
45 (*losslsd->predict_start_pass) (cinfo);
46 (*losslsd->scaler_start_pass) (cinfo);
47 (*losslsd->diff_start_input_pass) (cinfo);
52 * Initialize the lossless decompression codec.
53 * This is called only once, during master selection.
57 jinit_lossless_d_codec(j_decompress_ptr cinfo)
59 j_lossless_d_ptr losslsd;
62 /* Create subobject in permanent pool */
63 losslsd = (j_lossless_d_ptr)
64 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
65 SIZEOF(jpeg_lossless_d_codec));
66 cinfo->codec = (struct jpeg_d_codec *) losslsd;
68 /* Initialize sub-modules */
69 /* Entropy decoding: either Huffman or arithmetic coding. */
70 if (cinfo->arith_code) {
71 jinit_arith_decoder(cinfo);
73 jinit_lhuff_decoder(cinfo);
77 jinit_undifferencer(cinfo);
80 jinit_d_scaler(cinfo);
82 use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
83 jinit_d_diff_controller(cinfo, use_c_buffer);
85 /* Initialize method pointers.
87 * Note: consume_data, start_output_pass and decompress_data are
88 * assigned in jddiffct.c.
90 losslsd->pub.calc_output_dimensions = calc_output_dimensions;
91 losslsd->pub.start_input_pass = start_input_pass;
94 #endif /* D_LOSSLESS_SUPPORTED */