1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4
5#[doc = " <summary>\n The operation completed without errors.\n </summary>"]
8pub const charls_jpegls_errc_success: charls_jpegls_errc = 0;
9#[doc = " <summary>\n This error is returned when one of the arguments is invalid and no specific reason is available.\n </summary>"]
10pub const charls_jpegls_errc_invalid_argument: charls_jpegls_errc = 1;
11#[doc = " <summary>\n This error is returned when the JPEG stream contains a parameter value that is not supported by this implementation.\n </summary>"]
12pub const charls_jpegls_errc_parameter_value_not_supported: charls_jpegls_errc = 2;
13#[doc = " <summary>\n The destination buffer is too small to hold all the output.\n </summary>"]
14pub const charls_jpegls_errc_destination_buffer_too_small: charls_jpegls_errc = 3;
15#[doc = " <summary>\n The source buffer is too small, more input data was expected.\n </summary>"]
16pub const charls_jpegls_errc_source_buffer_too_small: charls_jpegls_errc = 4;
17#[doc = " <summary>\n This error is returned when the encoded bit stream contains a general structural problem.\n </summary>"]
18pub const charls_jpegls_errc_invalid_encoded_data: charls_jpegls_errc = 5;
19#[doc = " <summary>\n Too much compressed data.The decoding process is ready but the input buffer still contains encoded data.\n </summary>"]
20pub const charls_jpegls_errc_too_much_encoded_data: charls_jpegls_errc = 6;
21#[doc = " <summary>\n This error is returned when a method call is invalid for the current state.\n </summary>"]
22pub const charls_jpegls_errc_invalid_operation: charls_jpegls_errc = 7;
23#[doc = " <summary>\n The bit depth for transformation is not supported.\n </summary>"]
24pub const charls_jpegls_errc_bit_depth_for_transform_not_supported: charls_jpegls_errc = 8;
25#[doc = " <summary>\n The color transform is not supported.\n </summary>"]
26pub const charls_jpegls_errc_color_transform_not_supported: charls_jpegls_errc = 9;
27#[doc = " <summary>\n This error is returned when an encoded frame is found that is not encoded with the JPEG-LS algorithm.\n </summary>"]
28pub const charls_jpegls_errc_encoding_not_supported: charls_jpegls_errc = 10;
29#[doc = " <summary>\n This error is returned when an unknown JPEG marker code is found in the encoded bit stream.\n </summary>"]
30pub const charls_jpegls_errc_unknown_jpeg_marker_found: charls_jpegls_errc = 11;
31#[doc = " <summary>\n This error is returned when the algorithm expect a 0xFF code (indicates start of a JPEG marker) but none was found.\n </summary>"]
32pub const charls_jpegls_errc_jpeg_marker_start_byte_not_found: charls_jpegls_errc = 12;
33#[doc = " <summary>\n This error is returned when the implementation could not allocate memory for its internal buffers.\n </summary>"]
34pub const charls_jpegls_errc_not_enough_memory: charls_jpegls_errc = 13;
35#[doc = " <summary>\n This error is returned when the implementation encountered a failure it did not expect. No guarantees can be given\n for the state after this error.\n </summary>"]
36pub const charls_jpegls_errc_unexpected_failure: charls_jpegls_errc = 14;
37#[doc = " <summary>\n This error is returned when the first JPEG marker is not the SOI marker.\n </summary>"]
38pub const charls_jpegls_errc_start_of_image_marker_not_found: charls_jpegls_errc = 15;
39#[doc = " <summary>\n This error is returned when a JPEG marker is found that is not valid for the current state.\n </summary>"]
40pub const charls_jpegls_errc_unexpected_marker_found: charls_jpegls_errc = 16;
41#[doc = " <summary>\n This error is returned when the segment size of a marker segment is invalid.\n </summary>"]
42pub const charls_jpegls_errc_invalid_marker_segment_size: charls_jpegls_errc = 17;
43#[doc = " <summary>\n This error is returned when the stream contains more then one SOI marker.\n </summary>"]
44pub const charls_jpegls_errc_duplicate_start_of_image_marker: charls_jpegls_errc = 18;
45#[doc = " <summary>\n This error is returned when the stream contains more then one SOF marker.\n </summary>"]
46pub const charls_jpegls_errc_duplicate_start_of_frame_marker: charls_jpegls_errc = 19;
47#[doc = " <summary>\n This error is returned when the stream contains duplicate component identifiers in the SOF segment.\n </summary>"]
48pub const charls_jpegls_errc_duplicate_component_id_in_sof_segment: charls_jpegls_errc = 20;
49#[doc = " <summary>\n This error is returned when the stream contains an unexpected EOI marker.\n </summary>"]
50pub const charls_jpegls_errc_unexpected_end_of_image_marker: charls_jpegls_errc = 21;
51#[doc = " <summary>\n This error is returned when the stream contains an invalid type parameter in the JPEG-LS segment.\n </summary>"]
52pub const charls_jpegls_errc_invalid_jpegls_preset_parameter_type: charls_jpegls_errc = 22;
53#[doc = " <summary>\n This error is returned when the stream contains an unsupported type parameter in the JPEG-LS segment.\n </summary>"]
54pub const charls_jpegls_errc_jpegls_preset_extended_parameter_type_not_supported:
55charls_jpegls_errc = 23;
56#[doc = " <summary>\n This error is returned when the stream contains a SPIFF header but not an SPIFF end-of-directory entry.\n </summary>"]
57pub const charls_jpegls_errc_missing_end_of_spiff_directory: charls_jpegls_errc = 24;
58#[doc = " <summary>\n This error is returned when a restart marker is found outside the encoded entropy data.\n </summary>"]
59pub const charls_jpegls_errc_unexpected_restart_marker: charls_jpegls_errc = 25;
60#[doc = " <summary>\n This error is returned when an expected restart marker is not found. It may indicate data corruption in the JPEG-LS\n byte stream.\n </summary>"]
61pub const charls_jpegls_errc_restart_marker_not_found: charls_jpegls_errc = 26;
62#[doc = " <summary>\n This error is returned when a callback function returns a non zero value.\n </summary>"]
63pub const charls_jpegls_errc_callback_failed: charls_jpegls_errc = 27;
64#[doc = " <summary>\n This error is returned when the End of Image (EOI) marker could not be found.\n </summary>"]
65pub const charls_jpegls_errc_end_of_image_marker_not_found: charls_jpegls_errc = 28;
66#[doc = " <summary>\n This error is returned when the SPIFF header is invalid.\n </summary>"]
67pub const charls_jpegls_errc_invalid_spiff_header: charls_jpegls_errc = 29;
68#[doc = " <summary>\n The argument for the width parameter is outside the range [1, 65535].\n </summary>"]
69pub const charls_jpegls_errc_invalid_argument_width: charls_jpegls_errc = 100;
70#[doc = " <summary>\n The argument for the height parameter is outside the range [1, 65535].\n </summary>"]
71pub const charls_jpegls_errc_invalid_argument_height: charls_jpegls_errc = 101;
72#[doc = " <summary>\n The argument for the component count parameter is outside the range [1, 255].\n </summary>"]
73pub const charls_jpegls_errc_invalid_argument_component_count: charls_jpegls_errc = 102;
74#[doc = " <summary>\n The argument for the bit per sample parameter is outside the range [2, 16].\n </summary>"]
75pub const charls_jpegls_errc_invalid_argument_bits_per_sample: charls_jpegls_errc = 103;
76#[doc = " <summary>\n The argument for the interleave mode is not (None, Sample, Line) or invalid in combination with component count.\n </summary>"]
77pub const charls_jpegls_errc_invalid_argument_interleave_mode: charls_jpegls_errc = 104;
78#[doc = " <summary>\n The argument for the near lossless parameter is outside the range [0, 255].\n </summary>"]
79pub const charls_jpegls_errc_invalid_argument_near_lossless: charls_jpegls_errc = 105;
80#[doc = " <summary>\n The argument for the JPEG-LS preset coding parameters is not valid, see ISO/IEC 14495-1,\n C.2.4.1.1, Table C.1 for the ranges of valid values.\n </summary>"]
81pub const charls_jpegls_errc_invalid_argument_jpegls_pc_parameters: charls_jpegls_errc = 106;
82#[doc = " <summary>\n The argument for the size parameter is outside the valid range.\n </summary>"]
83pub const charls_jpegls_errc_invalid_argument_size: charls_jpegls_errc = 110;
84#[doc = " <summary>\n The argument for the color component is not (None, Hp1, Hp2, Hp3) or invalid in combination with component count.\n </summary>"]
85pub const charls_jpegls_errc_invalid_argument_color_transformation: charls_jpegls_errc = 111;
86#[doc = " <summary>\n The stride argument does not match with the frame info and buffer size.\n </summary>"]
87pub const charls_jpegls_errc_invalid_argument_stride: charls_jpegls_errc = 112;
88#[doc = " <summary>\n The encoding options argument has an invalid value.\n </summary>"]
89pub const charls_jpegls_errc_invalid_argument_encoding_options: charls_jpegls_errc = 113;
90#[doc = " <summary>\n This error is returned when the stream contains a width parameter defined more then once or in an incompatible way.\n </summary>"]
91pub const charls_jpegls_errc_invalid_parameter_width: charls_jpegls_errc = 200;
92#[doc = " <summary>\n This error is returned when the stream contains a height parameter defined more then once in an incompatible way.\n </summary>"]
93pub const charls_jpegls_errc_invalid_parameter_height: charls_jpegls_errc = 201;
94#[doc = " <summary>\n This error is returned when the stream contains a component count parameter outside the range [1,255] for SOF or\n [1,4] for SOS.\n </summary>"]
95pub const charls_jpegls_errc_invalid_parameter_component_count: charls_jpegls_errc = 202;
96#[doc = " <summary>\n This error is returned when the stream contains a bits per sample (sample precision) parameter outside the range\n [2,16]\n </summary>"]
97pub const charls_jpegls_errc_invalid_parameter_bits_per_sample: charls_jpegls_errc = 203;
98#[doc = " <summary>\n This error is returned when the stream contains an interleave mode (ILV) parameter outside the range [0, 2]\n </summary>"]
99pub const charls_jpegls_errc_invalid_parameter_interleave_mode: charls_jpegls_errc = 204;
100#[doc = " <summary>\n This error is returned when the stream contains a near-lossless (NEAR) parameter outside the range [0, min(255,\n MAXVAL/2)]\n </summary>"]
101pub const charls_jpegls_errc_invalid_parameter_near_lossless: charls_jpegls_errc = 205;
102#[doc = " <summary>\n This error is returned when the stream contains an invalid JPEG-LS preset parameters segment.\n </summary>"]
103pub const charls_jpegls_errc_invalid_parameter_jpegls_preset_parameters: charls_jpegls_errc = 206;
104#[doc = " <summary>\n Defines the result values that are returned by the CharLS API functions.\n </summary>"]
105pub type charls_jpegls_errc = ::std::os::raw::c_int;
106#[doc = " <summary>\n The data is encoded and stored as component for component: RRRGGGBBB.\n </summary>"]
107pub const charls_interleave_mode_none: charls_interleave_mode = 0;
108#[doc = " <summary>\n The interleave mode is by line. A full line of each component is encoded before moving to the next line.\n </summary>"]
109pub const charls_interleave_mode_line: charls_interleave_mode = 1;
110#[doc = " <summary>\n The data is encoded and stored by sample. For RGB color images this is the format like RGBRGBRGB.\n </summary>"]
111pub const charls_interleave_mode_sample: charls_interleave_mode = 2;
112#[doc = " <summary>\n Defines the interleave modes for multi-component (color) pixel data.\n </summary>"]
113pub type charls_interleave_mode = ::std::os::raw::c_int;
114#[doc = " <summary>\n No special encoding option is defined.\n </summary>"]
115pub const charls_encoding_options_private_encoding_options_none:
116charls_encoding_options_private_encoding_options = 0;
117#[doc = " <summary>\n Ensures that the generated encoded data has an even size by adding\n an extra 0xFF byte to the End Of Image (EOI) marker.\n DICOM requires that data is always even. This can be done by adding a zero padding byte\n after the encoded data or with this option.\n This option is not default enabled.\n </summary>"]
118pub const charls_encoding_options_private_encoding_options_even_destination_size:
119charls_encoding_options_private_encoding_options = 1;
120#[doc = " <summary>\n Add a comment (COM) segment with the content: \"charls [version-number]\" to the encoded data.\n Storing the used encoder version can be helpful for long term archival of images.\n This option is not default enabled.\n </summary>"]
121pub const charls_encoding_options_private_encoding_options_include_version_number:
122charls_encoding_options_private_encoding_options = 2;
123#[doc = " <summary>\n Writes explicitly the default JPEG-LS preset coding parameters when the\n bits per sample is larger then 12 bits.\n The Java Advanced Imaging (JAI) JPEG-LS codec has a defect that causes it to use invalid\n preset coding parameters for these types of images.\n Most users of this codec are aware of this problem and have implemented a work-around.\n This option is default enabled. Will not be default enabled in the next major version upgrade.\n </summary>"]
124pub const charls_encoding_options_private_encoding_options_include_pc_parameters_jai:
125charls_encoding_options_private_encoding_options = 4;
126#[doc = " <summary>\n Defines options that can be enabled during the encoding process.\n These options can be combined.\n </summary>"]
127pub type charls_encoding_options_private_encoding_options = ::std::os::raw::c_uint;
128#[doc = " <summary>\n Defines options that can be enabled during the encoding process.\n These options can be combined.\n </summary>"]
129pub use self::charls_encoding_options_private_encoding_options as charls_encoding_options;
130#[doc = " <summary>\n No profile identified.\n This is the only valid option for JPEG-LS encoded images.\n </summary>"]
131pub const charls_spiff_profile_id_none: charls_spiff_profile_id = 0;
132#[doc = " <summary>\n Continuous-tone base profile (JPEG)\n </summary>"]
133pub const charls_spiff_profile_id_continuous_tone_base: charls_spiff_profile_id = 1;
134#[doc = " <summary>\n Continuous-tone progressive profile\n </summary>"]
135pub const charls_spiff_profile_id_continuous_tone_progressive: charls_spiff_profile_id = 2;
136#[doc = " <summary>\n Bi-level facsimile profile (MH, MR, MMR, JBIG)\n </summary>"]
137pub const charls_spiff_profile_id_bi_level_facsimile: charls_spiff_profile_id = 3;
138#[doc = " <summary>\n Continuous-tone facsimile profile (JPEG)\n </summary>"]
139pub const charls_spiff_profile_id_continuous_tone_facsimile: charls_spiff_profile_id = 4;
140#[doc = " <summary>\n Defines the Application profile identifier options that can be used in a SPIFF header v2, as defined in ISO/IEC 10918-3,\n F.1.2\n </summary>"]
141pub type charls_spiff_profile_id = i32;
142#[doc = " <summary>\n Bi-level image. Each image sample is one bit: 0 = white and 1 = black.\n This option is not valid for JPEG-LS encoded images.\n </summary>"]
143pub const charls_spiff_color_space_bi_level_black: charls_spiff_color_space = 0;
144#[doc = " <summary>\n The color space is based on recommendation ITU-R BT.709.\n </summary>"]
145pub const charls_spiff_color_space_ycbcr_itu_bt_709_video: charls_spiff_color_space = 1;
146#[doc = " <summary>\n Color space interpretation of the coded sample is none of the other options.\n </summary>"]
147pub const charls_spiff_color_space_none: charls_spiff_color_space = 2;
148#[doc = " <summary>\n The color space is based on recommendation ITU-R BT.601-1. (RGB).\n </summary>"]
149pub const charls_spiff_color_space_ycbcr_itu_bt_601_1_rgb: charls_spiff_color_space = 3;
150#[doc = " <summary>\n The color space is based on recommendation ITU-R BT.601-1. (video).\n </summary>"]
151pub const charls_spiff_color_space_ycbcr_itu_bt_601_1_video: charls_spiff_color_space = 4;
152#[doc = " <summary>\n Grayscale – This is a single component sample with interpretation as grayscale value, 0 is minimum, 2bps -1 is\n maximum.\n </summary>"]
153pub const charls_spiff_color_space_grayscale: charls_spiff_color_space = 8;
154#[doc = " <summary>\n This is the color encoding method used in the Photo CD™ system.\n </summary>"]
155pub const charls_spiff_color_space_photo_ycc: charls_spiff_color_space = 9;
156#[doc = " <summary>\n The encoded data consists of samples of (uncalibrated) R, G and B.\n </summary>"]
157pub const charls_spiff_color_space_rgb: charls_spiff_color_space = 10;
158#[doc = " <summary>\n The encoded data consists of samples of Cyan, Magenta and Yellow samples.\n </summary>"]
159pub const charls_spiff_color_space_cmy: charls_spiff_color_space = 11;
160#[doc = " <summary>\n The encoded data consists of samples of Cyan, Magenta, Yellow and Black samples.\n </summary>"]
161pub const charls_spiff_color_space_cmyk: charls_spiff_color_space = 12;
162#[doc = " <summary>\n Transformed CMYK type data (same as Adobe PostScript)\n </summary>"]
163pub const charls_spiff_color_space_ycck: charls_spiff_color_space = 13;
164#[doc = " <summary>\n The CIE 1976 (L* a* b*) color space.\n </summary>"]
165pub const charls_spiff_color_space_cie_lab: charls_spiff_color_space = 14;
166#[doc = " <summary>\n Bi-level image. Each image sample is one bit: 1 = white and 0 = black.\n This option is not valid for JPEG-LS encoded images.\n </summary>"]
167pub const charls_spiff_color_space_bi_level_white: charls_spiff_color_space = 15;
168#[doc = " <summary>\n Defines the color space options that can be used in a SPIFF header v2, as defined in ISO/IEC 10918-3, F.2.1.1\n </summary>"]
169pub type charls_spiff_color_space = i32;
170#[doc = " <summary>\n Picture data is stored in component interleaved format, encoded at BPS per sample.\n </summary>"]
171pub const charls_spiff_compression_type_uncompressed: charls_spiff_compression_type = 0;
172#[doc = " <summary>\n Recommendation T.4, the basic algorithm commonly known as MH (Modified Huffman), only allowed for bi-level images.\n </summary>"]
173pub const charls_spiff_compression_type_modified_huffman: charls_spiff_compression_type = 1;
174#[doc = " <summary>\n Recommendation T.4, commonly known as MR (Modified READ), only allowed for bi-level images.\n </summary>"]
175pub const charls_spiff_compression_type_modified_read: charls_spiff_compression_type = 2;
176#[doc = " <summary>\n Recommendation T .6, commonly known as MMR (Modified Modified READ), only allowed for bi-level images.\n </summary>"]
177pub const charls_spiff_compression_type_modified_modified_read: charls_spiff_compression_type = 3;
178#[doc = " <summary>\n ISO/IEC 11544, commonly known as JBIG, only allowed for bi-level images.\n </summary>"]
179pub const charls_spiff_compression_type_jbig: charls_spiff_compression_type = 4;
180#[doc = " <summary>\n ISO/IEC 10918-1 or ISO/IEC 10918-3, commonly known as JPEG.\n </summary>"]
181pub const charls_spiff_compression_type_jpeg: charls_spiff_compression_type = 5;
182#[doc = " <summary>\n ISO/IEC 14495-1 or ISO/IEC 14495-2, commonly known as JPEG-LS. (extension defined in ISO/IEC 14495-1).\n This is the only valid option for JPEG-LS encoded images.\n </summary>"]
183pub const charls_spiff_compression_type_jpeg_ls: charls_spiff_compression_type = 6;
184#[doc = " <summary>\n Defines the compression options that can be used in a SPIFF header v2, as defined in ISO/IEC 10918-3, F.2.1\n </summary>"]
185pub type charls_spiff_compression_type = i32;
186#[doc = " <summary>\n VRES and HRES are to be interpreted as aspect ratio.\n </summary>\n <remark>\n If vertical or horizontal resolutions are not known, use this option and set VRES and HRES\n both to 1 to indicate that pixels in the image should be assumed to be square.\n </remark>"]
187pub const charls_spiff_resolution_units_aspect_ratio: charls_spiff_resolution_units = 0;
188#[doc = " <summary>\n Units of dots/samples per inch\n </summary>"]
189pub const charls_spiff_resolution_units_dots_per_inch: charls_spiff_resolution_units = 1;
190#[doc = " <summary>\n Units of dots/samples per centimeter.\n </summary>"]
191pub const charls_spiff_resolution_units_dots_per_centimeter: charls_spiff_resolution_units = 2;
192#[doc = " <summary>\n Defines the resolution units for the VRES and HRES parameters, as defined in ISO/IEC 10918-3, F.2.1\n </summary>"]
193pub type charls_spiff_resolution_units = i32;
194#[doc = " <summary>\n Defines the information that can be stored in a SPIFF header as defined in ISO/IEC 10918-3, Annex F\n </summary>\n <remark>\n The type I.8 is an unsigned 8 bit integer, the type I.32 is an 32 bit unsigned integer in the file header itself.\n The type is indicated by the symbol “F.” are 4-byte parameters in “fixed point” notation.\n The 16 most significant bits are essentially the same as a parameter of type I.16 and indicate the integer\n part of this number.\n The 16 least significant bits are essentially the same as an I.16 parameter and contain an unsigned integer that,\n when divided by 65536, represents the fractional part of the fixed point number.\n </remark>"]
195#[repr(C)]
196pub struct charls_spiff_header {
197 pub profile_id: charls_spiff_profile_id,
198 pub component_count: i32,
199 pub height: u32,
200 pub width: u32,
201 pub color_space: charls_spiff_color_space,
202 pub bits_per_sample: i32,
203 pub compression_type: charls_spiff_compression_type,
204 pub resolution_units: charls_spiff_resolution_units,
205 pub vertical_resolution: u32,
206 pub horizontal_resolution: u32,
207}
208#[test]
209fn bindgen_test_layout_charls_spiff_header() {
210 const UNINIT: ::std::mem::MaybeUninit<charls_spiff_header> = ::std::mem::MaybeUninit::uninit();
211 let ptr = UNINIT.as_ptr();
212 assert_eq!(
213 ::std::mem::size_of::<charls_spiff_header>(),
214 40usize,
215 concat!("Size of: ", stringify!(charls_spiff_header))
216 );
217 assert_eq!(
218 ::std::mem::align_of::<charls_spiff_header>(),
219 4usize,
220 concat!("Alignment of ", stringify!(charls_spiff_header))
221 );
222 assert_eq!(
223 unsafe { ::std::ptr::addr_of!((*ptr).profile_id) as usize - ptr as usize },
224 0usize,
225 concat!(
226 "Offset of field: ",
227 stringify!(charls_spiff_header),
228 "::",
229 stringify!(profile_id)
230 )
231 );
232 assert_eq!(
233 unsafe { ::std::ptr::addr_of!((*ptr).component_count) as usize - ptr as usize },
234 4usize,
235 concat!(
236 "Offset of field: ",
237 stringify!(charls_spiff_header),
238 "::",
239 stringify!(component_count)
240 )
241 );
242 assert_eq!(
243 unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
244 8usize,
245 concat!(
246 "Offset of field: ",
247 stringify!(charls_spiff_header),
248 "::",
249 stringify!(height)
250 )
251 );
252 assert_eq!(
253 unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize },
254 12usize,
255 concat!(
256 "Offset of field: ",
257 stringify!(charls_spiff_header),
258 "::",
259 stringify!(width)
260 )
261 );
262 assert_eq!(
263 unsafe { ::std::ptr::addr_of!((*ptr).color_space) as usize - ptr as usize },
264 16usize,
265 concat!(
266 "Offset of field: ",
267 stringify!(charls_spiff_header),
268 "::",
269 stringify!(color_space)
270 )
271 );
272 assert_eq!(
273 unsafe { ::std::ptr::addr_of!((*ptr).bits_per_sample) as usize - ptr as usize },
274 20usize,
275 concat!(
276 "Offset of field: ",
277 stringify!(charls_spiff_header),
278 "::",
279 stringify!(bits_per_sample)
280 )
281 );
282 assert_eq!(
283 unsafe { ::std::ptr::addr_of!((*ptr).compression_type) as usize - ptr as usize },
284 24usize,
285 concat!(
286 "Offset of field: ",
287 stringify!(charls_spiff_header),
288 "::",
289 stringify!(compression_type)
290 )
291 );
292 assert_eq!(
293 unsafe { ::std::ptr::addr_of!((*ptr).resolution_units) as usize - ptr as usize },
294 28usize,
295 concat!(
296 "Offset of field: ",
297 stringify!(charls_spiff_header),
298 "::",
299 stringify!(resolution_units)
300 )
301 );
302 assert_eq!(
303 unsafe { ::std::ptr::addr_of!((*ptr).vertical_resolution) as usize - ptr as usize },
304 32usize,
305 concat!(
306 "Offset of field: ",
307 stringify!(charls_spiff_header),
308 "::",
309 stringify!(vertical_resolution)
310 )
311 );
312 assert_eq!(
313 unsafe { ::std::ptr::addr_of!((*ptr).horizontal_resolution) as usize - ptr as usize },
314 36usize,
315 concat!(
316 "Offset of field: ",
317 stringify!(charls_spiff_header),
318 "::",
319 stringify!(horizontal_resolution)
320 )
321 );
322}
323#[doc = " <summary>\n Defines the information that can be stored in a JPEG-LS Frame marker segment that applies to all scans.\n </summary>\n <remark>\n The JPEG-LS also allow to store sub-sampling information in a JPEG-LS Frame marker segment.\n CharLS does not support JPEG-LS images that contain sub-sampled scans.\n </remark>"]
324#[repr(C)]
325#[derive(Debug, Copy, Clone)]
326pub struct charls_frame_info {
327 #[doc = " <summary>\n Width of the image, range [1, 65535].\n </summary>"]
328 pub width: u32,
329 #[doc = " <summary>\n Height of the image, range [1, 65535].\n </summary>"]
330 pub height: u32,
331 #[doc = " <summary>\n Number of bits per sample, range [2, 16]\n </summary>"]
332 pub bits_per_sample: i32,
333 #[doc = " <summary>\n Number of components contained in the frame, range [1, 255]\n </summary>"]
334 pub component_count: i32,
335}
336#[test]
337fn bindgen_test_layout_charls_frame_info() {
338 const UNINIT: ::std::mem::MaybeUninit<charls_frame_info> = ::std::mem::MaybeUninit::uninit();
339 let ptr = UNINIT.as_ptr();
340 assert_eq!(
341 ::std::mem::size_of::<charls_frame_info>(),
342 16usize,
343 concat!("Size of: ", stringify!(charls_frame_info))
344 );
345 assert_eq!(
346 ::std::mem::align_of::<charls_frame_info>(),
347 4usize,
348 concat!("Alignment of ", stringify!(charls_frame_info))
349 );
350 assert_eq!(
351 unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize },
352 0usize,
353 concat!(
354 "Offset of field: ",
355 stringify!(charls_frame_info),
356 "::",
357 stringify!(width)
358 )
359 );
360 assert_eq!(
361 unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
362 4usize,
363 concat!(
364 "Offset of field: ",
365 stringify!(charls_frame_info),
366 "::",
367 stringify!(height)
368 )
369 );
370 assert_eq!(
371 unsafe { ::std::ptr::addr_of!((*ptr).bits_per_sample) as usize - ptr as usize },
372 8usize,
373 concat!(
374 "Offset of field: ",
375 stringify!(charls_frame_info),
376 "::",
377 stringify!(bits_per_sample)
378 )
379 );
380 assert_eq!(
381 unsafe { ::std::ptr::addr_of!((*ptr).component_count) as usize - ptr as usize },
382 12usize,
383 concat!(
384 "Offset of field: ",
385 stringify!(charls_frame_info),
386 "::",
387 stringify!(component_count)
388 )
389 );
390}
391#[doc = " <summary>\n Defines the JPEG-LS preset coding parameters as defined in ISO/IEC 14495-1, C.2.4.1.1.\n JPEG-LS defines a default set of parameters, but custom parameters can be used.\n When used these parameters are written into the encoded bit stream as they are needed for the decoding process.\n </summary>"]
392#[repr(C)]
393#[derive(Debug, Copy, Clone)]
394pub struct charls_jpegls_pc_parameters {
395 #[doc = " <summary>\n Maximum possible value for any image sample in a scan.\n This must be greater than or equal to the actual maximum value for the components in a scan.\n </summary>"]
396 pub maximum_sample_value: i32,
397 #[doc = " <summary>\n First quantization threshold value for the local gradients.\n </summary>"]
398 pub threshold1: i32,
399 #[doc = " <summary>\n Second quantization threshold value for the local gradients.\n </summary>"]
400 pub threshold2: i32,
401 #[doc = " <summary>\n Third quantization threshold value for the local gradients.\n </summary>"]
402 pub threshold3: i32,
403 #[doc = " <summary>\n Value at which the counters A, B, and N are halved.\n </summary>"]
404 pub reset_value: i32,
405}
406#[test]
407fn bindgen_test_layout_charls_jpegls_pc_parameters() {
408 const UNINIT: ::std::mem::MaybeUninit<charls_jpegls_pc_parameters> =
409 ::std::mem::MaybeUninit::uninit();
410 let ptr = UNINIT.as_ptr();
411 assert_eq!(
412 ::std::mem::size_of::<charls_jpegls_pc_parameters>(),
413 20usize,
414 concat!("Size of: ", stringify!(charls_jpegls_pc_parameters))
415 );
416 assert_eq!(
417 ::std::mem::align_of::<charls_jpegls_pc_parameters>(),
418 4usize,
419 concat!("Alignment of ", stringify!(charls_jpegls_pc_parameters))
420 );
421 assert_eq!(
422 unsafe { ::std::ptr::addr_of!((*ptr).maximum_sample_value) as usize - ptr as usize },
423 0usize,
424 concat!(
425 "Offset of field: ",
426 stringify!(charls_jpegls_pc_parameters),
427 "::",
428 stringify!(maximum_sample_value)
429 )
430 );
431 assert_eq!(
432 unsafe { ::std::ptr::addr_of!((*ptr).threshold1) as usize - ptr as usize },
433 4usize,
434 concat!(
435 "Offset of field: ",
436 stringify!(charls_jpegls_pc_parameters),
437 "::",
438 stringify!(threshold1)
439 )
440 );
441 assert_eq!(
442 unsafe { ::std::ptr::addr_of!((*ptr).threshold2) as usize - ptr as usize },
443 8usize,
444 concat!(
445 "Offset of field: ",
446 stringify!(charls_jpegls_pc_parameters),
447 "::",
448 stringify!(threshold2)
449 )
450 );
451 assert_eq!(
452 unsafe { ::std::ptr::addr_of!((*ptr).threshold3) as usize - ptr as usize },
453 12usize,
454 concat!(
455 "Offset of field: ",
456 stringify!(charls_jpegls_pc_parameters),
457 "::",
458 stringify!(threshold3)
459 )
460 );
461 assert_eq!(
462 unsafe { ::std::ptr::addr_of!((*ptr).reset_value) as usize - ptr as usize },
463 16usize,
464 concat!(
465 "Offset of field: ",
466 stringify!(charls_jpegls_pc_parameters),
467 "::",
468 stringify!(reset_value)
469 )
470 );
471}
472extern "C" {
473 pub fn charls_get_error_message(
474 error_value: charls_jpegls_errc,
475 ) -> *const ::std::os::raw::c_char;
476}
477#[repr(C)]
478#[derive(Debug, Copy, Clone)]
479pub struct charls_jpegls_decoder {
480 _unused: [u8; 0],
481}
482extern "C" {
483 #[doc = " <summary>\n Creates a JPEG-LS decoder instance, when finished with the instance destroy it with the function\n charls_jpegls_decoder_destroy.\n </summary>\n <returns>A reference to a new created decoder instance, or a null pointer when the creation fails.</returns>"]
484 pub fn charls_jpegls_decoder_create() -> *mut charls_jpegls_decoder;
485}
486extern "C" {
487 #[doc = " <summary>\n Destroys a JPEG-LS decoder instance created with charls_jpegls_decoder_create and releases all internal resources\n attached to it.\n </summary>\n <param name=\"decoder\">Instance to destroy. If a null pointer is passed as argument, no action occurs.</param>"]
488 pub fn charls_jpegls_decoder_destroy(decoder: *const charls_jpegls_decoder);
489}
490extern "C" {
491 #[doc = " <summary>\n Set the reference to a source buffer that contains the encoded JPEG-LS byte stream data.\n This buffer needs to remain valid until the buffer is fully decoded.\n </summary>\n <param name=\"decoder\">Reference to the decoder instance.</param>\n <param name=\"source_buffer\">Reference to the start of the source buffer.</param>\n <param name=\"source_size_bytes\">Size of the source buffer in bytes.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
492 pub fn charls_jpegls_decoder_set_source_buffer(
493 decoder: *mut charls_jpegls_decoder,
494 source_buffer: *const ::std::os::raw::c_void,
495 source_size_bytes: usize,
496 ) -> charls_jpegls_errc;
497}
498extern "C" {
499 #[doc = " <summary>\n Tries to read the SPIFF header from the source buffer.\n If a SPIFF header exists its content will be put into the spiff_header parameter and header_found will be set to 1.\n Call charls_jpegls_decoder_read_header to read the normal JPEG header afterwards.\n </summary>\n <param name=\"decoder\">Reference to the decoder instance.</param>\n <param name=\"spiff_header\">Output argument, will hold the SPIFF header when one could be found.</param>\n <param name=\"header_found\">Output argument, will hold 1 if a SPIFF header could be found, otherwise 0.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
500 pub fn charls_jpegls_decoder_read_spiff_header(
501 decoder: *mut charls_jpegls_decoder,
502 spiff_header: *mut charls_spiff_header,
503 header_found: *mut i32,
504 ) -> charls_jpegls_errc;
505}
506extern "C" {
507 #[doc = " <summary>\n Reads the JPEG-LS header from the JPEG byte stream. After this function is called frame info can be retrieved.\n </summary>\n <param name=\"decoder\">Reference to the decoder instance.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
508 pub fn charls_jpegls_decoder_read_header(
509 decoder: *mut charls_jpegls_decoder,
510 ) -> charls_jpegls_errc;
511}
512extern "C" {
513 #[doc = " <summary>\n Returns information about the frame stored in the JPEG-LS byte stream.\n </summary>\n <remarks>\n Function should be called after calling the function charls_jpegls_decoder_read_header.\n </remarks>\n <param name=\"decoder\">Reference to the decoder instance.</param>\n <param name=\"frame_info\">Output argument, will hold the frame info when the function returns.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
514 pub fn charls_jpegls_decoder_get_frame_info(
515 decoder: *const charls_jpegls_decoder,
516 frame_info: *mut charls_frame_info,
517 ) -> charls_jpegls_errc;
518}
519extern "C" {
520 #[doc = " <summary>\n Returns the size required for the destination buffer in bytes to hold the decoded pixel data.\n </summary>\n <remarks>\n Function should be called after calling the function charls_jpegls_decoder_read_header.\n </remarks>\n <param name=\"decoder\">Reference to the decoder instance.</param>\n <param name=\"stride\">Number of bytes to the next line in the buffer, when zero, decoder will compute it.</param>\n <param name=\"destination_size_bytes\">Output argument, will hold the required size when the function returns.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
521 pub fn charls_jpegls_decoder_get_destination_size(
522 decoder: *const charls_jpegls_decoder,
523 stride: u32,
524 destination_size_bytes: *mut usize,
525 ) -> charls_jpegls_errc;
526}
527extern "C" {
528 #[doc = " <summary>\n Will decode the JPEG-LS byte stream from the source buffer into the destination buffer.\n </summary>\n <remarks>\n Function should be called after calling the function charls_jpegls_decoder_read_header.\n </remarks>\n <param name=\"decoder\">Reference to the decoder instance.</param>\n <param name=\"destination_buffer\">Byte array that holds the encoded bytes when the function returns.</param>\n <param name=\"destination_size_bytes\">\n Length of the array in bytes. If the array is too small the function will return an error.\n </param>\n <param name=\"stride\">\n Number of bytes to the next line in the buffer, when zero, decoder will compute it.\n </param> <returns>The result of the operation: success or a failure code.</returns>"]
529 pub fn charls_jpegls_decoder_decode_to_buffer(
530 decoder: *mut charls_jpegls_decoder,
531 destination_buffer: *mut ::std::os::raw::c_void,
532 destination_size_bytes: usize,
533 stride: u32,
534 ) -> charls_jpegls_errc;
535}
536#[repr(C)]
537#[derive(Debug, Copy, Clone)]
538pub struct charls_jpegls_encoder {
539 _unused: [u8; 0],
540}
541extern "C" {
542 #[doc = " <summary>\n Creates a JPEG-LS encoder instance, when finished with the instance destroy it with the function\n charls_jpegls_encoder_destroy.\n </summary>\n <returns>A reference to a new created encoder instance, or a null pointer when the creation fails.</returns>"]
543 pub fn charls_jpegls_encoder_create() -> *mut charls_jpegls_encoder;
544}
545extern "C" {
546 #[doc = " <summary>\n Destroys a JPEG-LS encoder instance created with charls_jpegls_encoder_create and releases all internal resources\n attached to it.\n </summary>\n <param name=\"encoder\">Instance to destroy. If a null pointer is passed as argument, no action occurs.</param>"]
547 pub fn charls_jpegls_encoder_destroy(encoder: *const charls_jpegls_encoder);
548}
549extern "C" {
550 #[doc = " <summary>\n Configures the frame that needs to be encoded. This information will be written to the Start of Frame segment.\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"frame_info\">Information about the frame that needs to be encoded.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
551 pub fn charls_jpegls_encoder_set_frame_info(
552 encoder: *mut charls_jpegls_encoder,
553 frame_info: *const charls_frame_info,
554 ) -> charls_jpegls_errc;
555}
556extern "C" {
557 #[doc = " <summary>\n Configures the NEAR parameter the encoder should use. A value of 0 means lossless, 0 is also the default.\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"near_lossless\">Value of the NEAR parameter.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
558 pub fn charls_jpegls_encoder_set_near_lossless(
559 encoder: *mut charls_jpegls_encoder,
560 near_lossless: i32,
561 ) -> charls_jpegls_errc;
562}
563extern "C" {
564 #[doc = " <summary>\n Configures the encoding options the encoder should use. Default is charls_encoding_options::include_pc_parameters_jai\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"encoding_options\">Options to use.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
565 pub fn charls_jpegls_encoder_set_encoding_options(
566 encoder: *mut charls_jpegls_encoder,
567 encoding_options: charls_encoding_options,
568 ) -> charls_jpegls_errc;
569}
570extern "C" {
571 #[doc = " <summary>\n Configures the interleave mode the encoder should use. The default is none.\n The encoder expects the input buffer in the same format as the interleave mode.\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"interleave_mode\">Value of the interleave mode.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
572 pub fn charls_jpegls_encoder_set_interleave_mode(
573 encoder: *mut charls_jpegls_encoder,
574 interleave_mode: charls_interleave_mode,
575 ) -> charls_jpegls_errc;
576}
577extern "C" {
578 #[doc = " <summary>\n Configures the preset coding parameters the encoder should use.\n If not set the encoder will use the default preset coding parameters as defined by the JPEG-LS standard.\n Only when the coding parameters are different than the default parameters or when `include_pc_parameters_jai` is set,\n they will be written to the JPEG-LS stream during the encode phase.\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"preset_coding_parameters\">Reference to the preset coding parameters.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
579 pub fn charls_jpegls_encoder_set_preset_coding_parameters(
580 encoder: *mut charls_jpegls_encoder,
581 preset_coding_parameters: *const charls_jpegls_pc_parameters,
582 ) -> charls_jpegls_errc;
583}
584extern "C" {
585 #[doc = " <summary>\n Returns the size in bytes, that the encoder expects are needed to hold the encoded image.\n </summary>\n <remarks>\n Size for dynamic extras like SPIFF entries and other tables are not included in this size.\n </remarks>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"size_in_bytes\">Reference to the size that will be set when the functions returns.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
586 pub fn charls_jpegls_encoder_get_estimated_destination_size(
587 encoder: *const charls_jpegls_encoder,
588 size_in_bytes: *mut usize,
589 ) -> charls_jpegls_errc;
590}
591extern "C" {
592 #[doc = " <summary>\n Set the reference to the destination buffer that will contain the encoded JPEG-LS byte stream data after encoding.\n This buffer needs to remain valid during the encoding process.\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"destination_buffer\">Reference to the start of the destination buffer.</param>\n <param name=\"destination_size_bytes\">Size of the destination buffer in bytes.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
593 pub fn charls_jpegls_encoder_set_destination_buffer(
594 encoder: *mut charls_jpegls_encoder,
595 destination_buffer: *mut ::std::os::raw::c_void,
596 destination_size_bytes: usize,
597 ) -> charls_jpegls_errc;
598}
599extern "C" {
600 #[doc = " <summary>\n Encodes the passed buffer with the source image data to the destination.\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"source_buffer\">Byte array that holds the image data that needs to be encoded.</param>\n <param name=\"source_size_bytes\">Length of the array in bytes.</param>\n <param name=\"stride\">\n The number of bytes from one row of pixels in memory to the next row of pixels in memory.\n Stride is sometimes called pitch. If padding bytes are present, the stride is wider than the width of the image.\n </param>\n <returns>The result of the operation: success or a failure code.</returns>"]
601 pub fn charls_jpegls_encoder_encode_from_buffer(
602 encoder: *mut charls_jpegls_encoder,
603 source_buffer: *const ::std::os::raw::c_void,
604 source_size_bytes: usize,
605 stride: u32,
606 ) -> charls_jpegls_errc;
607}
608extern "C" {
609 #[doc = " <summary>\n Returns the size in bytes, that are written to the destination.\n </summary>\n <param name=\"encoder\">Reference to the encoder instance.</param>\n <param name=\"bytes_written\">Reference to the size that will be set when the functions returns.</param>\n <returns>The result of the operation: success or a failure code.</returns>"]
610 pub fn charls_jpegls_encoder_get_bytes_written(
611 encoder: *const charls_jpegls_encoder,
612 bytes_written: *mut usize,
613 ) -> charls_jpegls_errc;
614}