]> Creatis software - gdcm.git/blob - src/gdcmjpeg/jdlossls.c
Fix mistypings
[gdcm.git] / src / gdcmjpeg / jdlossls.c
1 /*
2  * jdlossls.c
3  *
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.
7  *
8  * This file contains the control logic for the lossless JPEG decompressor.
9  */
10
11 #define JPEG_INTERNALS
12 #include "jinclude.h"
13 #include "jpeglib.h"
14 #include "jlossls.h"
15
16
17 #ifdef D_LOSSLESS_SUPPORTED
18
19 /*
20  * Compute output image dimensions and related values.
21  */
22
23 METHODDEF(void)
24 calc_output_dimensions (j_decompress_ptr cinfo)
25 {
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.
31    */
32 }
33
34
35 /*
36  * Initialize for an input processing pass.
37  */
38
39 METHODDEF(void)
40 start_input_pass (j_decompress_ptr cinfo)
41 {
42   j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
43
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);
48 }
49
50
51 /*
52  * Initialize the lossless decompression codec.
53  * This is called only once, during master selection.
54  */
55
56 GLOBAL(void) 
57 jinit_lossless_d_codec(j_decompress_ptr cinfo)
58 {
59   j_lossless_d_ptr losslsd;
60   boolean use_c_buffer;
61
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;
67
68   /* Initialize sub-modules */
69   /* Entropy decoding: either Huffman or arithmetic coding. */
70   if (cinfo->arith_code) {
71     jinit_arith_decoder(cinfo);
72   } else {
73     jinit_lhuff_decoder(cinfo);
74   }
75
76   /* Undifferencer */
77   jinit_undifferencer(cinfo);
78
79   /* Scaler */
80   jinit_d_scaler(cinfo);
81
82   use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
83   jinit_d_diff_controller(cinfo, use_c_buffer);
84
85   /* Initialize method pointers.
86    *
87    * Note: consume_data, start_output_pass and decompress_data are
88    * assigned in jddiffct.c.
89    */
90   losslsd->pub.calc_output_dimensions = calc_output_dimensions;
91   losslsd->pub.start_input_pass = start_input_pass;
92 }
93
94 #endif /* D_LOSSLESS_SUPPORTED */