OFFIS DCMTK  Version 3.6.0
jlossls16.h
1 /*
2  * jlossls.h
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 include file contains common declarations for the lossless JPEG
9  * codec modules.
10  */
11 
12 #ifndef JLOSSLS_H
13 #define JLOSSLS_H
14 
15 
16 /*
17  * Table H.1: Predictors for lossless coding.
18  */
19 
20 #define PREDICTOR1 Ra
21 #define PREDICTOR2 Rb
22 #define PREDICTOR3 Rc
23 #define PREDICTOR4 (int) ((IJG_INT32) Ra + (IJG_INT32) Rb - (IJG_INT32) Rc)
24 #define PREDICTOR5 (int) ((IJG_INT32) Ra + RIGHT_SHIFT((IJG_INT32) Rb - (IJG_INT32) Rc, 1))
25 #define PREDICTOR6 (int) ((IJG_INT32) Rb + RIGHT_SHIFT((IJG_INT32) Ra - (IJG_INT32) Rc, 1))
26 #define PREDICTOR7 (int) RIGHT_SHIFT((IJG_INT32) Ra + (IJG_INT32) Rb, 1)
27 
28 /* This is an incorrect predictor that causes an overflow for images with 16 bits/pixel.
29  * There is a known implementation of JPEG lossless that creates such incorrect images,
30  * and we need this predictor to be able to correctly decode such incorrect images.
31  */
32 #define PREDICTOR6A (int) ((INT16) Rb + RIGHT_SHIFT((INT16) Ra - (INT16) Rc, 1))
33 
34 
35 typedef JMETHOD(void, predict_difference_method_ptr,
36  (j_compress_ptr cinfo, int ci,
37  JSAMPROW input_buf, JSAMPROW prev_row,
38  JDIFFROW diff_buf, JDIMENSION width));
39 
40 typedef JMETHOD(void, scaler_method_ptr,
41  (j_compress_ptr cinfo, int ci,
42  JSAMPROW input_buf, JSAMPROW output_buf,
43  JDIMENSION width));
44 
45 /* Lossless-specific compression codec (compressor proper) */
46 typedef struct {
47  struct jpeg_c_codec pub; /* public fields */
48 
49 
50  /* Difference buffer control */
51  JMETHOD(void, diff_start_pass, (j_compress_ptr cinfo,
52  J_BUF_MODE pass_mode));
53 
54  /* Pointer to data which is private to diff controller */
55  void *diff_private;
56 
57 
58  /* Entropy encoding */
59  JMETHOD(JDIMENSION, entropy_encode_mcus, (j_compress_ptr cinfo,
60  JDIFFIMAGE diff_buf,
61  JDIMENSION MCU_row_num,
62  JDIMENSION MCU_col_num,
63  JDIMENSION nMCU));
64 
65  /* Pointer to data which is private to entropy module */
66  void *entropy_private;
67 
68 
69  /* Prediction, differencing */
70  JMETHOD(void, predict_start_pass, (j_compress_ptr cinfo));
71 
72  /* It is useful to allow each component to have a separate diff method. */
73  predict_difference_method_ptr predict_difference[MAX_COMPONENTS];
74 
75  /* Pointer to data which is private to predictor module */
76  void *pred_private;
77 
78  /* Sample scaling */
79  JMETHOD(void, scaler_start_pass, (j_compress_ptr cinfo));
80  JMETHOD(void, scaler_scale, (j_compress_ptr cinfo,
81  JSAMPROW input_buf, JSAMPROW output_buf,
82  JDIMENSION width));
83 
84  /* Pointer to data which is private to scaler module */
85  void *scaler_private;
86 
88 
90 
91 
92 typedef JMETHOD(void, predict_undifference_method_ptr,
93  (j_decompress_ptr cinfo, int comp_index,
94  JDIFFROW diff_buf, JDIFFROW prev_row,
95  JDIFFROW undiff_buf, JDIMENSION width));
96 
97 /* Lossless-specific decompression codec (decompressor proper) */
98 typedef struct {
99  struct jpeg_d_codec pub; /* public fields */
100 
101 
102  /* Difference buffer control */
103  JMETHOD(void, diff_start_input_pass, (j_decompress_ptr cinfo));
104 
105  /* Pointer to data which is private to diff controller */
106  void *diff_private;
107 
108 
109  /* Entropy decoding */
110  JMETHOD(void, entropy_start_pass, (j_decompress_ptr cinfo));
111  JMETHOD(boolean, entropy_process_restart, (j_decompress_ptr cinfo));
112  JMETHOD(JDIMENSION, entropy_decode_mcus, (j_decompress_ptr cinfo,
113  JDIFFIMAGE diff_buf,
114  JDIMENSION MCU_row_num,
115  JDIMENSION MCU_col_num,
116  JDIMENSION nMCU));
117 
118  /* Pointer to data which is private to entropy module */
119  void *entropy_private;
120 
121 
122  /* Prediction, undifferencing */
123  JMETHOD(void, predict_start_pass, (j_decompress_ptr cinfo));
124  JMETHOD(void, predict_process_restart, (j_decompress_ptr cinfo));
125 
126  /* It is useful to allow each component to have a separate undiff method. */
127  predict_undifference_method_ptr predict_undifference[MAX_COMPONENTS];
128 
129  /* Pointer to data which is private to predictor module */
130  void *pred_private;
131 
132  /* Sample scaling */
133  JMETHOD(void, scaler_start_pass, (j_decompress_ptr cinfo));
134  JMETHOD(void, scaler_scale, (j_decompress_ptr cinfo,
135  JDIFFROW diff_buf, JSAMPROW output_buf,
136  JDIMENSION width));
137 
138  /* Pointer to data which is private to scaler module */
139  void *scaler_private;
140 
142 
144 
145 
146 /* Compression module initialization routines */
147 EXTERN(void) jinit_lossless_c_codec JPP((j_compress_ptr cinfo));
148 EXTERN(void) jinit_lhuff_encoder JPP((j_compress_ptr cinfo));
149 EXTERN(void) jinit_differencer JPP((j_compress_ptr cinfo));
150 EXTERN(void) jinit_c_scaler JPP((j_compress_ptr cinfo));
151 /* Decompression module initialization routines */
152 EXTERN(void) jinit_lossless_d_codec JPP((j_decompress_ptr cinfo));
153 EXTERN(void) jinit_lhuff_decoder JPP((j_decompress_ptr cinfo));
154 EXTERN(void) jinit_undifferencer JPP((j_decompress_ptr cinfo));
155 EXTERN(void) jinit_d_scaler JPP((j_decompress_ptr cinfo));
156 
157 #endif /* JLOSSLS_H */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2