1use libc::FILE;
4pub type OPJ_BYTE = u8;
5
6pub const OPJ_TRUE: u32 = 1;
7pub const OPJ_FALSE: u32 = 0;
8pub const OPJ_HAVE_STDINT_H: u32 = 1;
9pub const OPJ_VERSION_MAJOR: u32 = 2;
10pub const OPJ_VERSION_MINOR: u32 = 5;
11pub const OPJ_VERSION_BUILD: u32 = 2;
12pub const OPJ_PATH_LEN: u32 = 4096;
13pub const OPJ_J2K_MAXRLVLS: u32 = 33;
14pub const OPJ_J2K_MAXBANDS: u32 = 97;
15pub const OPJ_J2K_DEFAULT_NB_SEGS: u32 = 10;
16pub const OPJ_J2K_STREAM_CHUNK_SIZE: u32 = 1048576;
17pub const OPJ_J2K_DEFAULT_HEADER_SIZE: u32 = 1000;
18pub const OPJ_J2K_MCC_DEFAULT_NB_RECORDS: u32 = 10;
19pub const OPJ_J2K_MCT_DEFAULT_NB_RECORDS: u32 = 10;
20pub const OPJ_IMG_INFO: u32 = 1;
21pub const OPJ_J2K_MH_INFO: u32 = 2;
22pub const OPJ_J2K_TH_INFO: u32 = 4;
23pub const OPJ_J2K_TCH_INFO: u32 = 8;
24pub const OPJ_J2K_MH_IND: u32 = 16;
25pub const OPJ_J2K_TH_IND: u32 = 32;
26pub const OPJ_JP2_INFO: u32 = 128;
27pub const OPJ_JP2_IND: u32 = 256;
28pub const OPJ_PROFILE_NONE: u32 = 0;
29pub const OPJ_PROFILE_0: u32 = 1;
30pub const OPJ_PROFILE_1: u32 = 2;
31pub const OPJ_PROFILE_PART2: u32 = 32768;
32pub const OPJ_PROFILE_CINEMA_2K: u32 = 3;
33pub const OPJ_PROFILE_CINEMA_4K: u32 = 4;
34pub const OPJ_PROFILE_CINEMA_S2K: u32 = 5;
35pub const OPJ_PROFILE_CINEMA_S4K: u32 = 6;
36pub const OPJ_PROFILE_CINEMA_LTS: u32 = 7;
37pub const OPJ_PROFILE_BC_SINGLE: u32 = 256;
38pub const OPJ_PROFILE_BC_MULTI: u32 = 512;
39pub const OPJ_PROFILE_BC_MULTI_R: u32 = 768;
40pub const OPJ_PROFILE_IMF_2K: u32 = 1024;
41pub const OPJ_PROFILE_IMF_4K: u32 = 1280;
42pub const OPJ_PROFILE_IMF_8K: u32 = 1536;
43pub const OPJ_PROFILE_IMF_2K_R: u32 = 1792;
44pub const OPJ_PROFILE_IMF_4K_R: u32 = 2048;
45pub const OPJ_PROFILE_IMF_8K_R: u32 = 2304;
46pub const OPJ_EXTENSION_NONE: u32 = 0;
47pub const OPJ_EXTENSION_MCT: u32 = 256;
48pub const OPJ_IMF_MAINLEVEL_MAX: u32 = 11;
49pub const OPJ_IMF_MAINLEVEL_1_MSAMPLESEC: u32 = 65;
50pub const OPJ_IMF_MAINLEVEL_2_MSAMPLESEC: u32 = 130;
51pub const OPJ_IMF_MAINLEVEL_3_MSAMPLESEC: u32 = 195;
52pub const OPJ_IMF_MAINLEVEL_4_MSAMPLESEC: u32 = 260;
53pub const OPJ_IMF_MAINLEVEL_5_MSAMPLESEC: u32 = 520;
54pub const OPJ_IMF_MAINLEVEL_6_MSAMPLESEC: u32 = 1200;
55pub const OPJ_IMF_MAINLEVEL_7_MSAMPLESEC: u32 = 2400;
56pub const OPJ_IMF_MAINLEVEL_8_MSAMPLESEC: u32 = 4800;
57pub const OPJ_IMF_MAINLEVEL_9_MSAMPLESEC: u32 = 9600;
58pub const OPJ_IMF_MAINLEVEL_10_MSAMPLESEC: u32 = 19200;
59pub const OPJ_IMF_MAINLEVEL_11_MSAMPLESEC: u32 = 38400;
60pub const OPJ_IMF_SUBLEVEL_1_MBITSSEC: u32 = 200;
61pub const OPJ_IMF_SUBLEVEL_2_MBITSSEC: u32 = 400;
62pub const OPJ_IMF_SUBLEVEL_3_MBITSSEC: u32 = 800;
63pub const OPJ_IMF_SUBLEVEL_4_MBITSSEC: u32 = 1600;
64pub const OPJ_IMF_SUBLEVEL_5_MBITSSEC: u32 = 3200;
65pub const OPJ_IMF_SUBLEVEL_6_MBITSSEC: u32 = 6400;
66pub const OPJ_IMF_SUBLEVEL_7_MBITSSEC: u32 = 12800;
67pub const OPJ_IMF_SUBLEVEL_8_MBITSSEC: u32 = 25600;
68pub const OPJ_IMF_SUBLEVEL_9_MBITSSEC: u32 = 51200;
69pub const OPJ_CINEMA_24_CS: u32 = 1302083;
70pub const OPJ_CINEMA_48_CS: u32 = 651041;
71pub const OPJ_CINEMA_24_COMP: u32 = 1041666;
72pub const OPJ_CINEMA_48_COMP: u32 = 520833;
73pub const OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG: u32 = 1;
74pub const OPJ_DPARAMETERS_DUMP_FLAG: u32 = 2;
75pub const OPJ_STREAM_READ: u32 = 1;
76pub const OPJ_STREAM_WRITE: u32 = 0;
77pub type OPJ_BOOL = ::std::os::raw::c_int;
78pub type OPJ_CHAR = ::std::os::raw::c_char;
79pub type OPJ_FLOAT32 = f32;
80pub type OPJ_UINT16 = u16;
81pub type OPJ_INT32 = i32;
82pub type OPJ_UINT32 = u32;
83pub type OPJ_UINT64 = u64;
84pub type OPJ_OFF_T = i64;
85pub type OPJ_SIZE_T = usize;
86#[repr(u32)]
87#[doc = "DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead\nRsiz Capabilities"]
88#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
89pub enum RSIZ_CAPABILITIES {
90 OPJ_STD_RSIZ = 0,
91 #[doc = "Standard JPEG2000 profile"]
92 OPJ_CINEMA2K = 3,
93 #[doc = "Profile name for a 2K image"]
94 OPJ_CINEMA4K = 4,
95 #[doc = "Profile name for a 4K image"]
96 OPJ_MCT = 33024,
97}
98#[doc = "DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead\nRsiz Capabilities"]
99pub use self::RSIZ_CAPABILITIES as OPJ_RSIZ_CAPABILITIES;
100#[repr(u32)]
101#[doc = "DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead\nDigital cinema operation mode"]
102#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
103pub enum CINEMA_MODE {
104 OPJ_OFF = 0,
105 #[doc = "Not Digital Cinema"]
106 OPJ_CINEMA2K_24 = 1,
107 #[doc = "2K Digital Cinema at 24 fps"]
108 OPJ_CINEMA2K_48 = 2,
109 #[doc = "2K Digital Cinema at 48 fps"]
110 OPJ_CINEMA4K_24 = 3,
111}
112#[doc = "DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead\nDigital cinema operation mode"]
113pub use self::CINEMA_MODE as OPJ_CINEMA_MODE;
114#[repr(i32)]
115#[doc = "Progression order"]
116#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
117pub enum PROG_ORDER {
118 #[doc = "place-holder"]
119 OPJ_PROG_UNKNOWN = -1,
120 #[doc = "layer-resolution-component-precinct order"]
121 OPJ_LRCP = 0,
122 #[doc = "resolution-layer-component-precinct order"]
123 OPJ_RLCP = 1,
124 #[doc = "resolution-precinct-component-layer order"]
125 OPJ_RPCL = 2,
126 #[doc = "precinct-component-resolution-layer order"]
127 OPJ_PCRL = 3,
128 #[doc = "component-precinct-resolution-layer order"]
129 OPJ_CPRL = 4,
130}
131#[doc = "Progression order"]
132pub use self::PROG_ORDER as OPJ_PROG_ORDER;
133#[repr(i32)]
134#[doc = "Supported image color spaces"]
135#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
136pub enum COLOR_SPACE {
137 #[doc = "not supported by the library"]
138 OPJ_CLRSPC_UNKNOWN = -1,
139 #[doc = "not specified in the codestream"]
140 OPJ_CLRSPC_UNSPECIFIED = 0,
141 #[doc = "sRGB"]
142 OPJ_CLRSPC_SRGB = 1,
143 #[doc = "grayscale"]
144 OPJ_CLRSPC_GRAY = 2,
145 #[doc = "YUV"]
146 OPJ_CLRSPC_SYCC = 3,
147 #[doc = "e-YCC"]
148 OPJ_CLRSPC_EYCC = 4,
149 #[doc = "CMYK"]
150 OPJ_CLRSPC_CMYK = 5,
151}
152#[doc = "Supported image color spaces"]
153pub use self::COLOR_SPACE as OPJ_COLOR_SPACE;
154#[repr(i32)]
155#[doc = "Supported codec"]
156#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
157pub enum CODEC_FORMAT {
158 #[doc = "place-holder"]
159 OPJ_CODEC_UNKNOWN = -1,
160 #[doc = "JPEG-2000 codestream : read/write"]
161 OPJ_CODEC_J2K = 0,
162 #[doc = "JPT-stream (JPEG 2000, JPIP) : read only"]
163 OPJ_CODEC_JPT = 1,
164 #[doc = "JP2 file format : read/write"]
165 OPJ_CODEC_JP2 = 2,
166 #[doc = "JPP-stream (JPEG 2000, JPIP) : to be coded"]
167 OPJ_CODEC_JPP = 3,
168 #[doc = "JPX file format (JPEG 2000 Part-2) : to be coded"]
169 OPJ_CODEC_JPX = 4,
170}
171#[doc = "Supported codec"]
172pub use self::CODEC_FORMAT as OPJ_CODEC_FORMAT;
173#[doc = "Callback function prototype for events\n\n# Arguments\n\n* `msg` - Event message\n* `client_data` - Client object where will be return the event message"]
174pub type opj_msg_callback = ::std::option::Option<
175 unsafe extern "C" fn(
176 msg: *const ::std::os::raw::c_char,
177 client_data: *mut ::std::os::raw::c_void,
178 ),
179>;
180#[doc = "Progression order changes\n"]
181#[repr(C)]
182#[derive(Debug, Copy, Clone)]
183pub struct opj_poc {
184 #[doc = "Resolution num start, Component num start, given by POC"]
185 pub resno0: OPJ_UINT32,
186 #[doc = "Resolution num start, Component num start, given by POC"]
187 pub compno0: OPJ_UINT32,
188 #[doc = "Layer num end,Resolution num end, Component num end, given by POC"]
189 pub layno1: OPJ_UINT32,
190 #[doc = "Layer num end,Resolution num end, Component num end, given by POC"]
191 pub resno1: OPJ_UINT32,
192 #[doc = "Layer num end,Resolution num end, Component num end, given by POC"]
193 pub compno1: OPJ_UINT32,
194 #[doc = "Layer num start,Precinct num start, Precinct num end"]
195 pub layno0: OPJ_UINT32,
196 #[doc = "Layer num start,Precinct num start, Precinct num end"]
197 pub precno0: OPJ_UINT32,
198 #[doc = "Layer num start,Precinct num start, Precinct num end"]
199 pub precno1: OPJ_UINT32,
200 #[doc = "Progression order enum"]
201 pub prg1: OPJ_PROG_ORDER,
202 #[doc = "Progression order enum"]
203 pub prg: OPJ_PROG_ORDER,
204 #[doc = "Progression order string"]
205 pub progorder: [OPJ_CHAR; 5usize],
206 #[doc = "Tile number (starting at 1)"]
207 pub tile: OPJ_UINT32,
208 #[doc = "Start and end values for Tile width and height"]
209 pub tx0: OPJ_INT32,
210 #[doc = "Start and end values for Tile width and height"]
211 pub tx1: OPJ_INT32,
212 #[doc = "Start and end values for Tile width and height"]
213 pub ty0: OPJ_INT32,
214 #[doc = "Start and end values for Tile width and height"]
215 pub ty1: OPJ_INT32,
216 #[doc = "Start value, initialised in pi_initialise_encode"]
217 pub layS: OPJ_UINT32,
218 #[doc = "Start value, initialised in pi_initialise_encode"]
219 pub resS: OPJ_UINT32,
220 #[doc = "Start value, initialised in pi_initialise_encode"]
221 pub compS: OPJ_UINT32,
222 #[doc = "Start value, initialised in pi_initialise_encode"]
223 pub prcS: OPJ_UINT32,
224 #[doc = "End value, initialised in pi_initialise_encode"]
225 pub layE: OPJ_UINT32,
226 #[doc = "End value, initialised in pi_initialise_encode"]
227 pub resE: OPJ_UINT32,
228 #[doc = "End value, initialised in pi_initialise_encode"]
229 pub compE: OPJ_UINT32,
230 #[doc = "End value, initialised in pi_initialise_encode"]
231 pub prcE: OPJ_UINT32,
232 #[doc = "Start and end values of Tile width and height, initialised in pi_initialise_encode"]
233 pub txS: OPJ_UINT32,
234 #[doc = "Start and end values of Tile width and height, initialised in pi_initialise_encode"]
235 pub txE: OPJ_UINT32,
236 #[doc = "Start and end values of Tile width and height, initialised in pi_initialise_encode"]
237 pub tyS: OPJ_UINT32,
238 #[doc = "Start and end values of Tile width and height, initialised in pi_initialise_encode"]
239 pub tyE: OPJ_UINT32,
240 #[doc = "Start and end values of Tile width and height, initialised in pi_initialise_encode"]
241 pub dx: OPJ_UINT32,
242 #[doc = "Start and end values of Tile width and height, initialised in pi_initialise_encode"]
243 pub dy: OPJ_UINT32,
244 #[doc = "Temporary values for Tile parts, initialised in pi_create_encode"]
245 pub lay_t: OPJ_UINT32,
246 #[doc = "Temporary values for Tile parts, initialised in pi_create_encode"]
247 pub res_t: OPJ_UINT32,
248 #[doc = "Temporary values for Tile parts, initialised in pi_create_encode"]
249 pub comp_t: OPJ_UINT32,
250 #[doc = "Temporary values for Tile parts, initialised in pi_create_encode"]
251 pub prc_t: OPJ_UINT32,
252 #[doc = "Temporary values for Tile parts, initialised in pi_create_encode"]
253 pub tx0_t: OPJ_UINT32,
254 #[doc = "Temporary values for Tile parts, initialised in pi_create_encode"]
255 pub ty0_t: OPJ_UINT32,
256}
257#[doc = "Progression order changes\n"]
258pub type opj_poc_t = opj_poc;
259#[doc = "Compression parameters"]
260#[repr(C)]
261#[derive(Debug, Copy, Clone)]
262pub struct opj_cparameters {
263 #[doc = "size of tile: tile_size_on = false (not in argument) or = true (in argument)"]
264 pub tile_size_on: OPJ_BOOL,
265 #[doc = "XTOsiz"]
266 pub cp_tx0: ::std::os::raw::c_int,
267 #[doc = "YTOsiz"]
268 pub cp_ty0: ::std::os::raw::c_int,
269 #[doc = "XTsiz"]
270 pub cp_tdx: ::std::os::raw::c_int,
271 #[doc = "YTsiz"]
272 pub cp_tdy: ::std::os::raw::c_int,
273 #[doc = "allocation by rate/distortion"]
274 pub cp_disto_alloc: ::std::os::raw::c_int,
275 #[doc = "allocation by fixed layer"]
276 pub cp_fixed_alloc: ::std::os::raw::c_int,
277 #[doc = "allocation by fixed quality (PSNR)"]
278 pub cp_fixed_quality: ::std::os::raw::c_int,
279 #[doc = "fixed layer"]
280 pub cp_matrice: *mut ::std::os::raw::c_int,
281 #[doc = "comment for coding"]
282 pub cp_comment: *mut ::std::os::raw::c_char,
283 #[doc = "csty : coding style"]
284 pub csty: ::std::os::raw::c_int,
285 #[doc = "progression order (default OPJ_LRCP)"]
286 pub prog_order: OPJ_PROG_ORDER,
287 #[doc = "progression order changes"]
288 pub POC: [opj_poc_t; 32usize],
289 #[doc = "number of progression order changes (POC), default to 0"]
290 pub numpocs: OPJ_UINT32,
291 #[doc = "number of layers"]
292 pub tcp_numlayers: ::std::os::raw::c_int,
293 #[doc = "rates of layers - might be subsequently limited by the max_cs_size field.\nShould be decreasing. 1 can be\nused as last value to indicate the last layer is lossless."]
294 pub tcp_rates: [f32; 100usize],
295 #[doc = "different psnr for successive layers. Should be increasing. 0 can be\nused as last value to indicate the last layer is lossless."]
296 pub tcp_distoratio: [f32; 100usize],
297 #[doc = "number of resolutions"]
298 pub numresolution: ::std::os::raw::c_int,
299 #[doc = "initial code block width, default to 64"]
300 pub cblockw_init: ::std::os::raw::c_int,
301 #[doc = "initial code block height, default to 64"]
302 pub cblockh_init: ::std::os::raw::c_int,
303 #[doc = "mode switch (cblk_style)"]
304 pub mode: ::std::os::raw::c_int,
305 #[doc = "1 : use the irreversible DWT 9-7, 0 : use lossless compression (default)"]
306 pub irreversible: ::std::os::raw::c_int,
307 #[doc = "region of interest: affected component in [0..3], -1 means no ROI"]
308 pub roi_compno: ::std::os::raw::c_int,
309 #[doc = "region of interest: upshift value"]
310 pub roi_shift: ::std::os::raw::c_int,
311 pub res_spec: ::std::os::raw::c_int,
312 #[doc = "initial precinct width"]
313 pub prcw_init: [::std::os::raw::c_int; 33usize],
314 #[doc = "initial precinct height"]
315 pub prch_init: [::std::os::raw::c_int; 33usize],
316 #[doc = "input file name"]
317 pub infile: [::std::os::raw::c_char; 4096usize],
318 #[doc = "output file name"]
319 pub outfile: [::std::os::raw::c_char; 4096usize],
320 #[doc = "DEPRECATED. Index generation is now handled with the opj_encode_with_info() function. Set to NULL"]
321 pub index_on: ::std::os::raw::c_int,
322 #[doc = "DEPRECATED. Index generation is now handled with the opj_encode_with_info() function. Set to NULL"]
323 pub index: [::std::os::raw::c_char; 4096usize],
324 #[doc = "subimage encoding: origin image offset in x direction"]
325 pub image_offset_x0: ::std::os::raw::c_int,
326 #[doc = "subimage encoding: origin image offset in y direction"]
327 pub image_offset_y0: ::std::os::raw::c_int,
328 #[doc = "subsampling value for dx"]
329 pub subsampling_dx: ::std::os::raw::c_int,
330 #[doc = "subsampling value for dy"]
331 pub subsampling_dy: ::std::os::raw::c_int,
332 #[doc = "input file format 0: PGX, 1: PxM, 2: BMP 3:TIF"]
333 pub decod_format: ::std::os::raw::c_int,
334 #[doc = "output file format 0: J2K, 1: JP2, 2: JPT"]
335 pub cod_format: ::std::os::raw::c_int,
336 #[doc = "enables writing of EPC in MH, thus activating JPWL"]
337 pub jpwl_epc_on: OPJ_BOOL,
338 #[doc = "error protection method for MH (0,1,16,32,37-128)"]
339 pub jpwl_hprot_MH: ::std::os::raw::c_int,
340 #[doc = "tile number of header protection specification (>=0)"]
341 pub jpwl_hprot_TPH_tileno: [::std::os::raw::c_int; 16usize],
342 #[doc = "error protection methods for TPHs (0,1,16,32,37-128)"]
343 pub jpwl_hprot_TPH: [::std::os::raw::c_int; 16usize],
344 #[doc = "tile number of packet protection specification (>=0)"]
345 pub jpwl_pprot_tileno: [::std::os::raw::c_int; 16usize],
346 #[doc = "packet number of packet protection specification (>=0)"]
347 pub jpwl_pprot_packno: [::std::os::raw::c_int; 16usize],
348 #[doc = "error protection methods for packets (0,1,16,32,37-128)"]
349 pub jpwl_pprot: [::std::os::raw::c_int; 16usize],
350 #[doc = "enables writing of ESD, (0=no/1/2 bytes)"]
351 pub jpwl_sens_size: ::std::os::raw::c_int,
352 #[doc = "sensitivity addressing size (0=auto/2/4 bytes)"]
353 pub jpwl_sens_addr: ::std::os::raw::c_int,
354 #[doc = "sensitivity range (0-3)"]
355 pub jpwl_sens_range: ::std::os::raw::c_int,
356 #[doc = "sensitivity method for MH (-1=no,0-7)"]
357 pub jpwl_sens_MH: ::std::os::raw::c_int,
358 #[doc = "tile number of sensitivity specification (>=0)"]
359 pub jpwl_sens_TPH_tileno: [::std::os::raw::c_int; 16usize],
360 #[doc = "sensitivity methods for TPHs (-1=no,0-7)"]
361 pub jpwl_sens_TPH: [::std::os::raw::c_int; 16usize],
362 #[doc = "DEPRECATED: use RSIZ, OPJ_PROFILE_* and MAX_COMP_SIZE instead\nDigital Cinema compliance 0-not compliant, 1-compliant"]
363 pub cp_cinema: OPJ_CINEMA_MODE,
364 #[doc = "Maximum size (in bytes) for each component.\nIf == 0, component size limitation is not considered"]
365 pub max_comp_size: ::std::os::raw::c_int,
366 #[doc = "DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead\nProfile name"]
367 pub cp_rsiz: OPJ_RSIZ_CAPABILITIES,
368 #[doc = "Tile part generation"]
369 pub tp_on: ::std::os::raw::c_char,
370 #[doc = "Flag for Tile part generation"]
371 pub tp_flag: ::std::os::raw::c_char,
372 #[doc = "MCT (multiple component transform)"]
373 pub tcp_mct: ::std::os::raw::c_char,
374 #[doc = "Enable JPIP indexing"]
375 pub jpip_on: OPJ_BOOL,
376 #[doc = "Naive implementation of MCT restricted to a single reversible array based\nencoding without offset concerning all the components."]
377 pub mct_data: *mut ::std::os::raw::c_void,
378 #[doc = "Maximum size (in bytes) for the whole codestream.\nIf == 0, codestream size limitation is not considered\nIf it does not comply with tcp_rates, max_cs_size prevails\nand a warning is issued."]
379 pub max_cs_size: ::std::os::raw::c_int,
380 #[doc = "RSIZ value\nTo be used to combine OPJ_PROFILE_*, OPJ_EXTENSION_* and (sub)levels values."]
381 pub rsiz: OPJ_UINT16,
382}
383#[doc = "Compression parameters"]
384pub type opj_cparameters_t = opj_cparameters;
385#[doc = "Decompression parameters"]
386#[repr(C)]
387#[derive(Debug, Copy, Clone)]
388pub struct opj_dparameters {
389 #[doc = "Set the number of highest resolution levels to be discarded.\nThe image resolution is effectively divided by 2 to the power of the number of discarded levels.\nThe reduce factor is limited by the smallest total number of decomposition levels among tiles.\nif != 0, then original dimension divided by 2^(reduce);\nif == 0 or not used, image is decoded to the full resolution"]
390 pub cp_reduce: OPJ_UINT32,
391 #[doc = "Set the maximum number of quality layers to decode.\nIf there are less quality layers than the specified number, all the quality layers are decoded.\nif != 0, then only the first \"layer\" layers are decoded;\nif == 0 or not used, all the quality layers are decoded"]
392 pub cp_layer: OPJ_UINT32,
393 #[doc = "input file name"]
394 pub infile: [::std::os::raw::c_char; 4096usize],
395 #[doc = "output file name"]
396 pub outfile: [::std::os::raw::c_char; 4096usize],
397 #[doc = "input file format 0: J2K, 1: JP2, 2: JPT"]
398 pub decod_format: ::std::os::raw::c_int,
399 #[doc = "output file format 0: PGX, 1: PxM, 2: BMP"]
400 pub cod_format: ::std::os::raw::c_int,
401 #[doc = "Decoding area left boundary"]
402 pub DA_x0: OPJ_UINT32,
403 #[doc = "Decoding area right boundary"]
404 pub DA_x1: OPJ_UINT32,
405 #[doc = "Decoding area up boundary"]
406 pub DA_y0: OPJ_UINT32,
407 #[doc = "Decoding area bottom boundary"]
408 pub DA_y1: OPJ_UINT32,
409 #[doc = "Verbose mode"]
410 pub m_verbose: OPJ_BOOL,
411 #[doc = "tile number of the decoded tile"]
412 pub tile_index: OPJ_UINT32,
413 #[doc = "Nb of tile to decode"]
414 pub nb_tile_to_decode: OPJ_UINT32,
415 #[doc = "activates the JPWL correction capabilities"]
416 pub jpwl_correct: OPJ_BOOL,
417 #[doc = "expected number of components"]
418 pub jpwl_exp_comps: ::std::os::raw::c_int,
419 #[doc = "maximum number of tiles"]
420 pub jpwl_max_tiles: ::std::os::raw::c_int,
421 pub flags: ::std::os::raw::c_uint,
422}
423#[doc = "Decompression parameters"]
424pub type opj_dparameters_t = opj_dparameters;
425#[doc = "JPEG2000 codec V2."]
426pub type opj_codec_t = *mut ::std::os::raw::c_void;
427pub type opj_stream_read_fn = ::std::option::Option<
428 unsafe extern "C" fn(
429 p_buffer: *mut ::std::os::raw::c_void,
430 p_nb_bytes: OPJ_SIZE_T,
431 p_user_data: *mut ::std::os::raw::c_void,
432 ) -> OPJ_SIZE_T,
433>;
434pub type opj_stream_write_fn = ::std::option::Option<
435 unsafe extern "C" fn(
436 p_buffer: *mut ::std::os::raw::c_void,
437 p_nb_bytes: OPJ_SIZE_T,
438 p_user_data: *mut ::std::os::raw::c_void,
439 ) -> OPJ_SIZE_T,
440>;
441pub type opj_stream_skip_fn = ::std::option::Option<
442 unsafe extern "C" fn(
443 p_nb_bytes: OPJ_OFF_T,
444 p_user_data: *mut ::std::os::raw::c_void,
445 ) -> OPJ_OFF_T,
446>;
447pub type opj_stream_seek_fn = ::std::option::Option<
448 unsafe extern "C" fn(
449 p_nb_bytes: OPJ_OFF_T,
450 p_user_data: *mut ::std::os::raw::c_void,
451 ) -> OPJ_BOOL,
452>;
453pub type opj_stream_free_user_data_fn =
454 ::std::option::Option<unsafe extern "C" fn(p_user_data: *mut ::std::os::raw::c_void)>;
455pub type opj_stream_t = *mut ::std::os::raw::c_void;
456#[doc = "Defines a single image component"]
457#[repr(C)]
458#[derive(Debug, Copy, Clone)]
459pub struct opj_image_comp {
460 #[doc = "XRsiz: horizontal separation of a sample of ith component with respect to the reference grid"]
461 pub dx: OPJ_UINT32,
462 #[doc = "YRsiz: vertical separation of a sample of ith component with respect to the reference grid"]
463 pub dy: OPJ_UINT32,
464 #[doc = "data width"]
465 pub w: OPJ_UINT32,
466 #[doc = "data height"]
467 pub h: OPJ_UINT32,
468 #[doc = "x component offset compared to the whole image"]
469 pub x0: OPJ_UINT32,
470 #[doc = "y component offset compared to the whole image"]
471 pub y0: OPJ_UINT32,
472 #[doc = "precision: number of bits per component per pixel"]
473 pub prec: OPJ_UINT32,
474 #[doc = "obsolete: use prec instead"]
475 pub bpp: OPJ_UINT32,
476 #[doc = "signed (1) / unsigned (0)"]
477 pub sgnd: OPJ_UINT32,
478 #[doc = "number of decoded resolution"]
479 pub resno_decoded: OPJ_UINT32,
480 #[doc = "number of division by 2 of the out image compared to the original size of image"]
481 pub factor: OPJ_UINT32,
482 #[doc = "image component data"]
483 pub data: *mut OPJ_INT32,
484 #[doc = "alpha channel"]
485 pub alpha: OPJ_UINT16,
486}
487#[doc = "Defines a single image component"]
488pub type opj_image_comp_t = opj_image_comp;
489#[doc = "Defines image data and characteristics"]
490#[repr(C)]
491#[derive(Debug, Copy, Clone)]
492pub struct opj_image {
493 #[doc = "XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area"]
494 pub x0: OPJ_UINT32,
495 #[doc = "YOsiz: vertical offset from the origin of the reference grid to the top side of the image area"]
496 pub y0: OPJ_UINT32,
497 #[doc = "Xsiz: width of the reference grid"]
498 pub x1: OPJ_UINT32,
499 #[doc = "Ysiz: height of the reference grid"]
500 pub y1: OPJ_UINT32,
501 #[doc = "number of components in the image"]
502 pub numcomps: OPJ_UINT32,
503 #[doc = "color space: sRGB, Greyscale or YUV"]
504 pub color_space: OPJ_COLOR_SPACE,
505 #[doc = "image components"]
506 pub comps: *mut opj_image_comp_t,
507 #[doc = "'restricted' ICC profile"]
508 pub icc_profile_buf: *mut OPJ_BYTE,
509 #[doc = "size of ICC profile"]
510 pub icc_profile_len: OPJ_UINT32,
511}
512#[doc = "Defines image data and characteristics"]
513pub type opj_image_t = opj_image;
514#[doc = "Component parameters structure used by the opj_image_create function"]
515#[repr(C)]
516#[derive(Debug, Copy, Clone)]
517pub struct opj_image_comptparm {
518 #[doc = "XRsiz: horizontal separation of a sample of ith component with respect to the reference grid"]
519 pub dx: OPJ_UINT32,
520 #[doc = "YRsiz: vertical separation of a sample of ith component with respect to the reference grid"]
521 pub dy: OPJ_UINT32,
522 #[doc = "data width"]
523 pub w: OPJ_UINT32,
524 #[doc = "data height"]
525 pub h: OPJ_UINT32,
526 #[doc = "x component offset compared to the whole image"]
527 pub x0: OPJ_UINT32,
528 #[doc = "y component offset compared to the whole image"]
529 pub y0: OPJ_UINT32,
530 #[doc = "precision: number of bits per component per pixel"]
531 pub prec: OPJ_UINT32,
532 #[doc = "obsolete: use prec instead"]
533 pub bpp: OPJ_UINT32,
534 #[doc = "signed (1) / unsigned (0)"]
535 pub sgnd: OPJ_UINT32,
536}
537#[doc = "Component parameters structure used by the opj_image_create function"]
538pub type opj_image_cmptparm_t = opj_image_comptparm;
539#[doc = "Index structure : Information concerning a packet inside tile"]
540#[repr(C)]
541#[derive(Debug, Copy, Clone)]
542pub struct opj_packet_info {
543 #[doc = "packet start position (including SOP marker if it exists)"]
544 pub start_pos: OPJ_OFF_T,
545 #[doc = "end of packet header position (including EPH marker if it exists)"]
546 pub end_ph_pos: OPJ_OFF_T,
547 #[doc = "packet end position"]
548 pub end_pos: OPJ_OFF_T,
549 #[doc = "packet distortion"]
550 pub disto: f64,
551}
552#[doc = "Index structure : Information concerning a packet inside tile"]
553pub type opj_packet_info_t = opj_packet_info;
554#[doc = "Marker structure"]
555#[repr(C)]
556#[derive(Debug, Copy, Clone)]
557pub struct opj_marker_info {
558 #[doc = "marker type"]
559 pub type_: ::std::os::raw::c_ushort,
560 #[doc = "position in codestream"]
561 pub pos: OPJ_OFF_T,
562 #[doc = "length, marker val included"]
563 pub len: ::std::os::raw::c_int,
564}
565#[doc = "Marker structure"]
566pub type opj_marker_info_t = opj_marker_info;
567#[doc = "Index structure : Information concerning tile-parts"]
568#[repr(C)]
569#[derive(Debug, Copy, Clone)]
570pub struct opj_tp_info {
571 #[doc = "start position of tile part"]
572 pub tp_start_pos: ::std::os::raw::c_int,
573 #[doc = "end position of tile part header"]
574 pub tp_end_header: ::std::os::raw::c_int,
575 #[doc = "end position of tile part"]
576 pub tp_end_pos: ::std::os::raw::c_int,
577 #[doc = "start packet of tile part"]
578 pub tp_start_pack: ::std::os::raw::c_int,
579 #[doc = "number of packets of tile part"]
580 pub tp_numpacks: ::std::os::raw::c_int,
581}
582#[doc = "Index structure : Information concerning tile-parts"]
583pub type opj_tp_info_t = opj_tp_info;
584#[doc = "Index structure : information regarding tiles"]
585#[repr(C)]
586#[derive(Debug, Copy, Clone)]
587pub struct opj_tile_info {
588 #[doc = "value of thresh for each layer by tile cfr. Marcela"]
589 pub thresh: *mut f64,
590 #[doc = "number of tile"]
591 pub tileno: ::std::os::raw::c_int,
592 #[doc = "start position"]
593 pub start_pos: ::std::os::raw::c_int,
594 #[doc = "end position of the header"]
595 pub end_header: ::std::os::raw::c_int,
596 #[doc = "end position"]
597 pub end_pos: ::std::os::raw::c_int,
598 #[doc = "precinct number for each resolution level (width)"]
599 pub pw: [::std::os::raw::c_int; 33usize],
600 #[doc = "precinct number for each resolution level (height)"]
601 pub ph: [::std::os::raw::c_int; 33usize],
602 #[doc = "precinct size (in power of 2), in X for each resolution level"]
603 pub pdx: [::std::os::raw::c_int; 33usize],
604 #[doc = "precinct size (in power of 2), in Y for each resolution level"]
605 pub pdy: [::std::os::raw::c_int; 33usize],
606 #[doc = "information concerning packets inside tile"]
607 pub packet: *mut opj_packet_info_t,
608 #[doc = "number of pixels of the tile"]
609 pub numpix: ::std::os::raw::c_int,
610 #[doc = "distortion of the tile"]
611 pub distotile: f64,
612 #[doc = "number of markers"]
613 pub marknum: ::std::os::raw::c_int,
614 #[doc = "list of markers"]
615 pub marker: *mut opj_marker_info_t,
616 #[doc = "actual size of markers array"]
617 pub maxmarknum: ::std::os::raw::c_int,
618 #[doc = "number of tile parts"]
619 pub num_tps: ::std::os::raw::c_int,
620 #[doc = "information concerning tile parts"]
621 pub tp: *mut opj_tp_info_t,
622}
623#[doc = "Index structure : information regarding tiles"]
624pub type opj_tile_info_t = opj_tile_info;
625#[doc = "Index structure of the codestream"]
626#[repr(C)]
627#[derive(Debug, Copy, Clone)]
628pub struct opj_codestream_info {
629 #[doc = "maximum distortion reduction on the whole image (add for Marcela)"]
630 pub D_max: f64,
631 #[doc = "packet number"]
632 pub packno: ::std::os::raw::c_int,
633 #[doc = "writing the packet in the index with t2_encode_packets"]
634 pub index_write: ::std::os::raw::c_int,
635 #[doc = "image width"]
636 pub image_w: ::std::os::raw::c_int,
637 #[doc = "image height"]
638 pub image_h: ::std::os::raw::c_int,
639 #[doc = "progression order"]
640 pub prog: OPJ_PROG_ORDER,
641 #[doc = "tile size in x"]
642 pub tile_x: ::std::os::raw::c_int,
643 #[doc = "tile size in y"]
644 pub tile_y: ::std::os::raw::c_int,
645 pub tile_Ox: ::std::os::raw::c_int,
646 pub tile_Oy: ::std::os::raw::c_int,
647 #[doc = "number of tiles in X"]
648 pub tw: ::std::os::raw::c_int,
649 #[doc = "number of tiles in Y"]
650 pub th: ::std::os::raw::c_int,
651 #[doc = "component numbers"]
652 pub numcomps: ::std::os::raw::c_int,
653 #[doc = "number of layer"]
654 pub numlayers: ::std::os::raw::c_int,
655 #[doc = "number of decomposition for each component"]
656 pub numdecompos: *mut ::std::os::raw::c_int,
657 #[doc = "number of markers"]
658 pub marknum: ::std::os::raw::c_int,
659 #[doc = "list of markers"]
660 pub marker: *mut opj_marker_info_t,
661 #[doc = "actual size of markers array"]
662 pub maxmarknum: ::std::os::raw::c_int,
663 #[doc = "main header position"]
664 pub main_head_start: ::std::os::raw::c_int,
665 #[doc = "main header position"]
666 pub main_head_end: ::std::os::raw::c_int,
667 #[doc = "codestream's size"]
668 pub codestream_size: ::std::os::raw::c_int,
669 #[doc = "information regarding tiles inside image"]
670 pub tile: *mut opj_tile_info_t,
671}
672#[doc = "Index structure of the codestream"]
673pub type opj_codestream_info_t = opj_codestream_info;
674#[doc = "Tile-component coding parameters information"]
675#[repr(C)]
676#[derive(Debug, Copy, Clone)]
677pub struct opj_tccp_info {
678 #[doc = "component index"]
679 pub compno: OPJ_UINT32,
680 #[doc = "coding style"]
681 pub csty: OPJ_UINT32,
682 #[doc = "number of resolutions"]
683 pub numresolutions: OPJ_UINT32,
684 #[doc = "log2 of code-blocks width"]
685 pub cblkw: OPJ_UINT32,
686 #[doc = "log2 of code-blocks height"]
687 pub cblkh: OPJ_UINT32,
688 #[doc = "code-block coding style"]
689 pub cblksty: OPJ_UINT32,
690 #[doc = "discrete wavelet transform identifier: 0 = 9-7 irreversible, 1 = 5-3 reversible"]
691 pub qmfbid: OPJ_UINT32,
692 #[doc = "quantisation style"]
693 pub qntsty: OPJ_UINT32,
694 #[doc = "stepsizes used for quantization"]
695 pub stepsizes_mant: [OPJ_UINT32; 97usize],
696 #[doc = "stepsizes used for quantization"]
697 pub stepsizes_expn: [OPJ_UINT32; 97usize],
698 #[doc = "number of guard bits"]
699 pub numgbits: OPJ_UINT32,
700 #[doc = "Region Of Interest shift"]
701 pub roishift: OPJ_INT32,
702 #[doc = "precinct width"]
703 pub prcw: [OPJ_UINT32; 33usize],
704 #[doc = "precinct height"]
705 pub prch: [OPJ_UINT32; 33usize],
706}
707#[doc = "Tile-component coding parameters information"]
708pub type opj_tccp_info_t = opj_tccp_info;
709#[doc = "Tile coding parameters information"]
710#[repr(C)]
711#[derive(Debug, Copy, Clone)]
712pub struct opj_tile_v2_info {
713 #[doc = "number (index) of tile"]
714 pub tileno: ::std::os::raw::c_int,
715 #[doc = "coding style"]
716 pub csty: OPJ_UINT32,
717 #[doc = "progression order"]
718 pub prg: OPJ_PROG_ORDER,
719 #[doc = "number of layers"]
720 pub numlayers: OPJ_UINT32,
721 #[doc = "multi-component transform identifier"]
722 pub mct: OPJ_UINT32,
723 #[doc = "information concerning tile component parameters"]
724 pub tccp_info: *mut opj_tccp_info_t,
725}
726#[doc = "Tile coding parameters information"]
727pub type opj_tile_info_v2_t = opj_tile_v2_info;
728#[doc = "Information structure about the codestream (FIXME should be expand and enhance)"]
729#[repr(C)]
730#[derive(Debug, Copy, Clone)]
731pub struct opj_codestream_info_v2 {
732 #[doc = "tile origin in x = XTOsiz"]
733 pub tx0: OPJ_UINT32,
734 #[doc = "tile origin in y = YTOsiz"]
735 pub ty0: OPJ_UINT32,
736 #[doc = "tile size in x = XTsiz"]
737 pub tdx: OPJ_UINT32,
738 #[doc = "tile size in y = YTsiz"]
739 pub tdy: OPJ_UINT32,
740 #[doc = "number of tiles in X"]
741 pub tw: OPJ_UINT32,
742 #[doc = "number of tiles in Y"]
743 pub th: OPJ_UINT32,
744 #[doc = "number of components"]
745 pub nbcomps: OPJ_UINT32,
746 #[doc = "Default information regarding tiles inside image"]
747 pub m_default_tile_info: opj_tile_info_v2_t,
748 #[doc = "information regarding tiles inside image"]
749 pub tile_info: *mut opj_tile_info_v2_t,
750}
751#[doc = "Information structure about the codestream (FIXME should be expand and enhance)"]
752pub type opj_codestream_info_v2_t = opj_codestream_info_v2;
753#[doc = "Index structure about a tile part"]
754#[repr(C)]
755#[derive(Debug, Copy, Clone)]
756pub struct opj_tp_index {
757 #[doc = "start position"]
758 pub start_pos: OPJ_OFF_T,
759 #[doc = "end position of the header"]
760 pub end_header: OPJ_OFF_T,
761 #[doc = "end position"]
762 pub end_pos: OPJ_OFF_T,
763}
764#[doc = "Index structure about a tile part"]
765pub type opj_tp_index_t = opj_tp_index;
766#[doc = "Index structure about a tile"]
767#[repr(C)]
768#[derive(Debug, Copy, Clone)]
769pub struct opj_tile_index {
770 #[doc = "tile index"]
771 pub tileno: OPJ_UINT32,
772 #[doc = "number of tile parts"]
773 pub nb_tps: OPJ_UINT32,
774 #[doc = "current nb of tile part (allocated)"]
775 pub current_nb_tps: OPJ_UINT32,
776 #[doc = "current tile-part index"]
777 pub current_tpsno: OPJ_UINT32,
778 #[doc = "information concerning tile parts"]
779 pub tp_index: *mut opj_tp_index_t,
780 #[doc = "number of markers"]
781 pub marknum: OPJ_UINT32,
782 #[doc = "list of markers"]
783 pub marker: *mut opj_marker_info_t,
784 #[doc = "actual size of markers array"]
785 pub maxmarknum: OPJ_UINT32,
786 #[doc = "packet number"]
787 pub nb_packet: OPJ_UINT32,
788 #[doc = "information concerning packets inside tile"]
789 pub packet_index: *mut opj_packet_info_t,
790}
791#[doc = "Index structure about a tile"]
792pub type opj_tile_index_t = opj_tile_index;
793#[doc = "Index structure of the codestream (FIXME should be expand and enhance)"]
794#[repr(C)]
795#[derive(Debug, Copy, Clone)]
796pub struct opj_codestream_index {
797 #[doc = "main header start position (SOC position)"]
798 pub main_head_start: OPJ_OFF_T,
799 #[doc = "main header end position (first SOT position)"]
800 pub main_head_end: OPJ_OFF_T,
801 #[doc = "codestream's size"]
802 pub codestream_size: OPJ_UINT64,
803 #[doc = "number of markers"]
804 pub marknum: OPJ_UINT32,
805 #[doc = "list of markers"]
806 pub marker: *mut opj_marker_info_t,
807 #[doc = "actual size of markers array"]
808 pub maxmarknum: OPJ_UINT32,
809 pub nb_of_tiles: OPJ_UINT32,
810 pub tile_index: *mut opj_tile_index_t,
811}
812#[doc = "Index structure of the codestream (FIXME should be expand and enhance)"]
813pub type opj_codestream_index_t = opj_codestream_index;
814#[doc = "Info structure of the JP2 file\nEXPERIMENTAL FOR THE MOMENT"]
815#[repr(C)]
816#[derive(Debug, Copy, Clone)]
817pub struct opj_jp2_metadata {
818 pub not_used: OPJ_INT32,
819}
820#[doc = "Info structure of the JP2 file\nEXPERIMENTAL FOR THE MOMENT"]
821pub type opj_jp2_metadata_t = opj_jp2_metadata;
822#[doc = "Index structure of the JP2 file\nEXPERIMENTAL FOR THE MOMENT"]
823#[repr(C)]
824#[derive(Debug, Copy, Clone)]
825pub struct opj_jp2_index {
826 pub not_used: OPJ_INT32,
827}
828#[doc = "Index structure of the JP2 file\nEXPERIMENTAL FOR THE MOMENT"]
829pub type opj_jp2_index_t = opj_jp2_index;
830extern "C" {
831 pub fn opj_version() -> *const ::std::os::raw::c_char;
832}
833extern "C" {
834 #[doc = "Create an image\n\n# Arguments\n\n* `numcmpts` - number of components\n* `cmptparms` - components parameters\n* `clrspc` - image color space\n\n# Returns\n\nreturns a new image structure if successful, returns NULL otherwise"]
835 pub fn opj_image_create(
836 numcmpts: OPJ_UINT32,
837 cmptparms: *mut opj_image_cmptparm_t,
838 clrspc: OPJ_COLOR_SPACE,
839 ) -> *mut opj_image_t;
840}
841extern "C" {
842 #[doc = "Deallocate any resources associated with an image\n\n# Arguments\n\n* `image` - image to be destroyed"]
843 pub fn opj_image_destroy(image: *mut opj_image_t);
844}
845extern "C" {
846 #[doc = "Creates an image without allocating memory for the image (used in the new version of the library).\n\n# Arguments\n\n* `numcmpts` - the number of components\n* `cmptparms` - the components parameters\n* `clrspc` - the image color space\n\n# Returns\n\na new image structure if successful, NULL otherwise."]
847 pub fn opj_image_tile_create(
848 numcmpts: OPJ_UINT32,
849 cmptparms: *mut opj_image_cmptparm_t,
850 clrspc: OPJ_COLOR_SPACE,
851 ) -> *mut opj_image_t;
852}
853extern "C" {
854 #[doc = "Allocator for opj_image_t->comps[].data\nTo be paired with opj_image_data_free.\n\n# Arguments\n\n* `size` - number of bytes to allocate\n\n# Returns\n\na new pointer if successful, NULL otherwise.\n> **Since** 2.2.0"]
855 pub fn opj_image_data_alloc(size: OPJ_SIZE_T) -> *mut ::std::os::raw::c_void;
856}
857extern "C" {
858 #[doc = "Destructor for opj_image_t->comps[].data\nTo be paired with opj_image_data_alloc.\n\n# Arguments\n\n* `ptr` - Pointer to free\n> **Since** 2.2.0"]
859 pub fn opj_image_data_free(ptr: *mut ::std::os::raw::c_void);
860}
861extern "C" {
862 #[doc = "Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream.\n\n# Arguments\n\n* `p_is_input` - if set to true then the stream will be an input stream, an output stream else.\n\n# Returns\n\na stream object."]
863 pub fn opj_stream_default_create(p_is_input: OPJ_BOOL) -> *mut opj_stream_t;
864}
865extern "C" {
866 #[doc = "Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream.\n\n# Arguments\n\n* `p_buffer_size` - FIXME DOC\n* `p_is_input` - if set to true then the stream will be an input stream, an output stream else.\n\n# Returns\n\na stream object."]
867 pub fn opj_stream_create(p_buffer_size: OPJ_SIZE_T, p_is_input: OPJ_BOOL) -> *mut opj_stream_t;
868}
869extern "C" {
870 #[doc = "Destroys a stream created by opj_create_stream. This function does NOT close the abstract stream. If needed the user must\nclose its own implementation of the stream.\n\n# Arguments\n\n* `p_stream` - the stream to destroy."]
871 pub fn opj_stream_destroy(p_stream: *mut opj_stream_t);
872}
873extern "C" {
874 #[doc = "Sets the given function to be used as a read function.\n\n# Arguments\n\n* `p_stream` - the stream to modify\n* `p_function` - the function to use a read function."]
875 pub fn opj_stream_set_read_function(
876 p_stream: *mut opj_stream_t,
877 p_function: opj_stream_read_fn,
878 );
879}
880extern "C" {
881 #[doc = "Sets the given function to be used as a write function.\n\n# Arguments\n\n* `p_stream` - the stream to modify\n* `p_function` - the function to use a write function."]
882 pub fn opj_stream_set_write_function(
883 p_stream: *mut opj_stream_t,
884 p_function: opj_stream_write_fn,
885 );
886}
887extern "C" {
888 #[doc = "Sets the given function to be used as a skip function.\n\n# Arguments\n\n* `p_stream` - the stream to modify\n* `p_function` - the function to use a skip function."]
889 pub fn opj_stream_set_skip_function(
890 p_stream: *mut opj_stream_t,
891 p_function: opj_stream_skip_fn,
892 );
893}
894extern "C" {
895 #[doc = "Sets the given function to be used as a seek function, the stream is then seekable,\nusing SEEK_SET behavior.\n\n# Arguments\n\n* `p_stream` - the stream to modify\n* `p_function` - the function to use a skip function."]
896 pub fn opj_stream_set_seek_function(
897 p_stream: *mut opj_stream_t,
898 p_function: opj_stream_seek_fn,
899 );
900}
901extern "C" {
902 #[doc = "Sets the given data to be used as a user data for the stream.\n\n# Arguments\n\n* `p_stream` - the stream to modify\n* `p_data` - the data to set.\n* `p_function` - the function to free p_data when opj_stream_destroy() is called."]
903 pub fn opj_stream_set_user_data(
904 p_stream: *mut opj_stream_t,
905 p_data: *mut ::std::os::raw::c_void,
906 p_function: opj_stream_free_user_data_fn,
907 );
908}
909extern "C" {
910 #[doc = "Sets the length of the user data for the stream.\n\n# Arguments\n\n* `p_stream` - the stream to modify\n* `data_length` - length of the user_data."]
911 pub fn opj_stream_set_user_data_length(p_stream: *mut opj_stream_t, data_length: OPJ_UINT64);
912}
913extern "C" {
914 #[doc = "Create a stream from a file identified with its filename with default parameters (helper function)\n\n# Arguments\n\n* `fname` - the filename of the file to stream\n* `p_is_read_stream` - whether the stream is a read stream (true) or not (false)"]
915 pub fn opj_stream_create_default_file_stream(
916 fname: *const ::std::os::raw::c_char,
917 p_is_read_stream: OPJ_BOOL,
918 ) -> *mut opj_stream_t;
919}
920extern "C" {
921 #[doc = "Create a stream from a file identified with its filename with a specific buffer size\n\n# Arguments\n\n* `fname` - the filename of the file to stream\n* `p_buffer_size` - size of the chunk used to stream\n* `p_is_read_stream` - whether the stream is a read stream (true) or not (false)"]
922 pub fn opj_stream_create_file_stream(
923 fname: *const ::std::os::raw::c_char,
924 p_buffer_size: OPJ_SIZE_T,
925 p_is_read_stream: OPJ_BOOL,
926 ) -> *mut opj_stream_t;
927}
928extern "C" {
929 #[doc = "Set the info handler use by openjpeg.\n\n# Arguments\n\n* `p_codec` - the codec previously initialise\n* `p_callback` - the callback function which will be used\n* `p_user_data` - client object where will be returned the message"]
930 pub fn opj_set_info_handler(
931 p_codec: *mut opj_codec_t,
932 p_callback: opj_msg_callback,
933 p_user_data: *mut ::std::os::raw::c_void,
934 ) -> OPJ_BOOL;
935}
936extern "C" {
937 #[doc = "Set the warning handler use by openjpeg.\n\n# Arguments\n\n* `p_codec` - the codec previously initialise\n* `p_callback` - the callback function which will be used\n* `p_user_data` - client object where will be returned the message"]
938 pub fn opj_set_warning_handler(
939 p_codec: *mut opj_codec_t,
940 p_callback: opj_msg_callback,
941 p_user_data: *mut ::std::os::raw::c_void,
942 ) -> OPJ_BOOL;
943}
944extern "C" {
945 #[doc = "Set the error handler use by openjpeg.\n\n# Arguments\n\n* `p_codec` - the codec previously initialise\n* `p_callback` - the callback function which will be used\n* `p_user_data` - client object where will be returned the message"]
946 pub fn opj_set_error_handler(
947 p_codec: *mut opj_codec_t,
948 p_callback: opj_msg_callback,
949 p_user_data: *mut ::std::os::raw::c_void,
950 ) -> OPJ_BOOL;
951}
952extern "C" {
953 #[doc = "Creates a J2K/JP2 decompression structure\n\n# Arguments\n\n* `format` - Decoder to select\n\n# Returns\n\nReturns a handle to a decompressor if successful, returns NULL otherwise"]
954 pub fn opj_create_decompress(format: OPJ_CODEC_FORMAT) -> *mut opj_codec_t;
955}
956extern "C" {
957 #[doc = "Destroy a decompressor handle\n\n# Arguments\n\n* `p_codec` - decompressor handle to destroy"]
958 pub fn opj_destroy_codec(p_codec: *mut opj_codec_t);
959}
960extern "C" {
961 #[doc = "Read after the codestream if necessary\n\n# Arguments\n\n* `p_codec` - the JPEG2000 codec to read.\n* `p_stream` - the JPEG2000 stream."]
962 pub fn opj_end_decompress(p_codec: *mut opj_codec_t, p_stream: *mut opj_stream_t) -> OPJ_BOOL;
963}
964extern "C" {
965 #[doc = "Set decoding parameters to default values\n\n# Arguments\n\n* `parameters` - Decompression parameters"]
966 pub fn opj_set_default_decoder_parameters(parameters: *mut opj_dparameters_t);
967}
968extern "C" {
969 #[doc = "Setup the decoder with decompression parameters provided by the user and with the message handler\nprovided by the user.\n\n# Arguments\n\n* `p_codec` - decompressor handler\n* `parameters` - decompression parameters\n\n# Returns\n\ntrue if the decoder is correctly set"]
970 pub fn opj_setup_decoder(
971 p_codec: *mut opj_codec_t,
972 parameters: *mut opj_dparameters_t,
973 ) -> OPJ_BOOL;
974}
975extern "C" {
976 #[doc = "Set strict decoding parameter for this decoder.\nIf strict decoding is enabled, partial bit streams will fail to decode, and\nthe check for invalid TPSOT values added in https://github.com/uclouvain/openjpeg/pull/514\nwill be disabled.\nIf strict decoding is disabled, the decoder will decode partial\nbitstreams as much as possible without erroring, and the TPSOT fixing logic\nwill be enabled.\n\n# Arguments\n\n* `p_codec` - decompressor handler\n* `strict` - OPJ_TRUE to enable strict decoding, OPJ_FALSE to disable\n\n# Returns\n\ntrue if the decoder is correctly set"]
977 pub fn opj_decoder_set_strict_mode(p_codec: *mut opj_codec_t, strict: OPJ_BOOL) -> OPJ_BOOL;
978}
979extern "C" {
980 #[doc = "Allocates worker threads for the compressor/decompressor.\nBy default, only the main thread is used. If this function is not used,\nbut the OPJ_NUM_THREADS environment variable is set, its value will be\nused to initialize the number of threads. The value can be either an integer\nnumber, or \"ALL_CPUS\". If OPJ_NUM_THREADS is set and this function is called,\nthis function will override the behaviour of the environment variable.\nThis function must be called after opj_setup_decoder() and\nbefore opj_read_header() for the decoding side, or after opj_setup_encoder()\nand before opj_start_compress() for the encoding side.\n\n# Arguments\n\n* `p_codec` - decompressor or compressor handler\n* `num_threads` - number of threads.\n\n# Returns\n\nOPJ_TRUE if the function is successful."]
981 pub fn opj_codec_set_threads(
982 p_codec: *mut opj_codec_t,
983 num_threads: ::std::os::raw::c_int,
984 ) -> OPJ_BOOL;
985}
986extern "C" {
987 #[doc = "Decodes an image header.\n\n# Arguments\n\n* `p_stream` - the jpeg2000 stream.\n* `p_codec` - the jpeg2000 codec to read.\n* `p_image` - the image structure initialized with the characteristics of encoded image.\n\n# Returns\n\ntrue if the main header of the codestream and the JP2 header is correctly read."]
988 pub fn opj_read_header(
989 p_stream: *mut opj_stream_t,
990 p_codec: *mut opj_codec_t,
991 p_image: *mut *mut opj_image_t,
992 ) -> OPJ_BOOL;
993}
994extern "C" {
995 #[doc = "Restrict the number of components to decode.\nThis function should be called after opj_read_header().\nThis function enables to restrict the set of decoded components to the\nspecified indices.\nNote that the current implementation (apply_color_transforms == OPJ_FALSE)\nis such that neither the multi-component transform at codestream level,\nnor JP2 channel transformations will be applied.\nConsequently the indices are relative to the codestream.\nNote: opj_decode_tile_data() should not be used together with opj_set_decoded_components().\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec to read.\n* `numcomps` - Size of the comps_indices array.\n* `comps_indices` - Array of numcomps values representing the indices\nof the components to decode (relative to the\ncodestream, starting at 0)\n* `apply_color_transforms` - Whether multi-component transform at codestream level\nor JP2 channel transformations should be applied.\nCurrently this parameter should be set to OPJ_FALSE.\nSetting it to OPJ_TRUE will result in an error.\n\n# Returns\n\nOPJ_TRUE in case of success."]
996 pub fn opj_set_decoded_components(
997 p_codec: *mut opj_codec_t,
998 numcomps: OPJ_UINT32,
999 comps_indices: *const OPJ_UINT32,
1000 apply_color_transforms: OPJ_BOOL,
1001 ) -> OPJ_BOOL;
1002}
1003extern "C" {
1004 #[doc = "Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading.\nThe coordinates passed to this function should be expressed in the reference grid,\nthat is to say at the highest resolution level, even if requesting the image at lower\nresolution levels.\nGenerally opj_set_decode_area() should be followed by opj_decode(), and the\ncodec cannot be re-used.\nIn the particular case of an image made of a single tile, several sequences of\ncalls to opoj_set_decode_area() and opj_decode() are allowed, and will bring\nperformance improvements when reading an image by chunks.\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n* `p_image` - the decoded image previously set by opj_read_header\n* `p_start_x` - the left position of the rectangle to decode (in image coordinates).\n* `p_end_x` - the right position of the rectangle to decode (in image coordinates).\n* `p_start_y` - the up position of the rectangle to decode (in image coordinates).\n* `p_end_y` - the bottom position of the rectangle to decode (in image coordinates).\n\n# Returns\n\ntrue if the area could be set."]
1005 pub fn opj_set_decode_area(
1006 p_codec: *mut opj_codec_t,
1007 p_image: *mut opj_image_t,
1008 p_start_x: OPJ_INT32,
1009 p_start_y: OPJ_INT32,
1010 p_end_x: OPJ_INT32,
1011 p_end_y: OPJ_INT32,
1012 ) -> OPJ_BOOL;
1013}
1014extern "C" {
1015 #[doc = "Decode an image from a JPEG-2000 codestream\n\n# Arguments\n\n* `p_decompressor` - decompressor handle\n* `p_stream` - Input buffer stream\n* `p_image` - the decoded image\n\n# Returns\n\ntrue if success, otherwise false"]
1016 pub fn opj_decode(
1017 p_decompressor: *mut opj_codec_t,
1018 p_stream: *mut opj_stream_t,
1019 p_image: *mut opj_image_t,
1020 ) -> OPJ_BOOL;
1021}
1022extern "C" {
1023 #[doc = "Get the decoded tile from the codec\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n* `p_stream` - input stream\n* `p_image` - output image\n* `tile_index` - index of the tile which will be decode\n\n# Returns\n\ntrue if success, otherwise false"]
1024 pub fn opj_get_decoded_tile(
1025 p_codec: *mut opj_codec_t,
1026 p_stream: *mut opj_stream_t,
1027 p_image: *mut opj_image_t,
1028 tile_index: OPJ_UINT32,
1029 ) -> OPJ_BOOL;
1030}
1031extern "C" {
1032 #[doc = "Set the resolution factor of the decoded image\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n* `res_factor` - resolution factor to set\n\n# Returns\n\ntrue if success, otherwise false"]
1033 pub fn opj_set_decoded_resolution_factor(
1034 p_codec: *mut opj_codec_t,
1035 res_factor: OPJ_UINT32,
1036 ) -> OPJ_BOOL;
1037}
1038extern "C" {
1039 #[doc = "Writes a tile with the given data.\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n* `p_tile_index` - the index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence.\n* `p_data` - pointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, then ... NO INTERLEAVING should be set.\n* `p_data_size` - this value os used to make sure the data being written is correct. The size must be equal to the sum for each component of\ntile_width * tile_height * component_size. component_size can be 1,2 or 4 bytes, depending on the precision of the given component.\n* `p_stream` - the stream to write data to.\n\n# Returns\n\ntrue if the data could be written."]
1040 pub fn opj_write_tile(
1041 p_codec: *mut opj_codec_t,
1042 p_tile_index: OPJ_UINT32,
1043 p_data: *mut OPJ_BYTE,
1044 p_data_size: OPJ_UINT32,
1045 p_stream: *mut opj_stream_t,
1046 ) -> OPJ_BOOL;
1047}
1048extern "C" {
1049 #[doc = "Reads a tile header. This function is compulsory and allows one to know the size of the tile that will be decoded.\nThe user may need to refer to the image got by opj_read_header to understand the size being taken by the tile.\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n* `p_tile_index` - pointer to a value that will hold the index of the tile being decoded, in case of success.\n* `p_data_size` - pointer to a value that will hold the maximum size of the decoded data, in case of success. In case\nof truncated codestreams, the actual number of bytes decoded may be lower. The computation of the size is the same\nas depicted in opj_write_tile.\n* `p_tile_x0` - pointer to a value that will hold the x0 pos of the tile (in the image).\n* `p_tile_y0` - pointer to a value that will hold the y0 pos of the tile (in the image).\n* `p_tile_x1` - pointer to a value that will hold the x1 pos of the tile (in the image).\n* `p_tile_y1` - pointer to a value that will hold the y1 pos of the tile (in the image).\n* `p_nb_comps` - pointer to a value that will hold the number of components in the tile.\n* `p_should_go_on` - pointer to a boolean that will hold the fact that the decoding should go on. In case the\ncodestream is over at the time of the call, the value will be set to false. The user should then stop\nthe decoding.\n* `p_stream` - the stream to decode.\n\n# Returns\n\ntrue if the tile header could be decoded. In case the decoding should end, the returned value is still true.\nreturning false may be the result of a shortage of memory or an internal error."]
1050 pub fn opj_read_tile_header(
1051 p_codec: *mut opj_codec_t,
1052 p_stream: *mut opj_stream_t,
1053 p_tile_index: *mut OPJ_UINT32,
1054 p_data_size: *mut OPJ_UINT32,
1055 p_tile_x0: *mut OPJ_INT32,
1056 p_tile_y0: *mut OPJ_INT32,
1057 p_tile_x1: *mut OPJ_INT32,
1058 p_tile_y1: *mut OPJ_INT32,
1059 p_nb_comps: *mut OPJ_UINT32,
1060 p_should_go_on: *mut OPJ_BOOL,
1061 ) -> OPJ_BOOL;
1062}
1063extern "C" {
1064 #[doc = "Reads a tile data. This function is compulsory and allows one to decode tile data. opj_read_tile_header should be called before.\nThe user may need to refer to the image got by opj_read_header to understand the size being taken by the tile.\nNote: opj_decode_tile_data() should not be used together with opj_set_decoded_components().\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n* `p_tile_index` - the index of the tile being decoded, this should be the value set by opj_read_tile_header.\n* `p_data` - pointer to a memory block that will hold the decoded data.\n* `p_data_size` - size of p_data. p_data_size should be bigger or equal to the value set by opj_read_tile_header.\n* `p_stream` - the stream to decode.\n\n# Returns\n\ntrue if the data could be decoded."]
1065 pub fn opj_decode_tile_data(
1066 p_codec: *mut opj_codec_t,
1067 p_tile_index: OPJ_UINT32,
1068 p_data: *mut OPJ_BYTE,
1069 p_data_size: OPJ_UINT32,
1070 p_stream: *mut opj_stream_t,
1071 ) -> OPJ_BOOL;
1072}
1073extern "C" {
1074 #[doc = "Creates a J2K/JP2 compression structure\n\n# Arguments\n\n* `format` - Coder to select\n\n# Returns\n\nReturns a handle to a compressor if successful, returns NULL otherwise"]
1075 pub fn opj_create_compress(format: OPJ_CODEC_FORMAT) -> *mut opj_codec_t;
1076}
1077extern "C" {
1078 #[doc = "Set encoding parameters to default values, that means :\n<ul>\n<li>Lossless\n<li>1 tile\n<li>Size of precinct : 2^15 x 2^15 (means 1 precinct)\n<li>Size of code-block : 64 x 64\n<li>Number of resolutions: 6\n<li>No SOP marker in the codestream\n<li>No EPH marker in the codestream\n<li>No sub-sampling in x or y direction\n<li>No mode switch activated\n<li>Progression order: LRCP\n<li>No index file\n<li>No ROI upshifted\n<li>No offset of the origin of the image\n<li>No offset of the origin of the tiles\n<li>Reversible DWT 5-3\n</ul>\n\n# Arguments\n\n* `parameters` - Compression parameters"]
1079 pub fn opj_set_default_encoder_parameters(parameters: *mut opj_cparameters_t);
1080}
1081extern "C" {
1082 #[doc = "Setup the encoder parameters using the current image and using user parameters.\n\n# Arguments\n\n* `p_codec` - Compressor handle\n* `parameters` - Compression parameters\n* `image` - Input filled image"]
1083 pub fn opj_setup_encoder(
1084 p_codec: *mut opj_codec_t,
1085 parameters: *mut opj_cparameters_t,
1086 image: *mut opj_image_t,
1087 ) -> OPJ_BOOL;
1088}
1089extern "C" {
1090 #[doc = "Specify extra options for the encoder.\nThis may be called after opj_setup_encoder() and before opj_start_compress()\nThis is the way to add new options in a fully ABI compatible way, without\nextending the opj_cparameters_t structure.\nCurrently supported options are:\n<ul>\n<li>PLT=YES/NO. Defaults to NO. If set to YES, PLT marker segments,\nindicating the length of each packet in the tile-part header, will be\nwritten. Since 2.4.0</li>\n<li>TLM=YES/NO. Defaults to NO (except for Cinema and IMF profiles).\nIf set to YES, TLM marker segments, indicating the length of each\ntile-part part will be written. Since 2.4.0</li>\n<li>GUARD_BITS=value. Number of guard bits in [0,7] range. Default value is 2.\n1 may be used sometimes (like in SMPTE DCP Bv2.1 Application Profile for 2K images).\nSince 2.5.0</li>\n</ul>\n\n# Arguments\n\n* `p_codec` - Compressor handle\n* `p_options` - Compression options. This should be a NULL terminated\narray of strings. Each string is of the form KEY=VALUE.\n\n# Returns\n\nOPJ_TRUE in case of success.\n> **Since** 2.4.0"]
1091 pub fn opj_encoder_set_extra_options(
1092 p_codec: *mut opj_codec_t,
1093 p_options: *const *const ::std::os::raw::c_char,
1094 ) -> OPJ_BOOL;
1095}
1096extern "C" {
1097 #[doc = "Start to compress the current image.\n\n# Arguments\n\n* `p_codec` - Compressor handle\n* `p_image` - Input filled image\n* `p_stream` - Input stgream"]
1098 pub fn opj_start_compress(
1099 p_codec: *mut opj_codec_t,
1100 p_image: *mut opj_image_t,
1101 p_stream: *mut opj_stream_t,
1102 ) -> OPJ_BOOL;
1103}
1104extern "C" {
1105 #[doc = "End to compress the current image.\n\n# Arguments\n\n* `p_codec` - Compressor handle\n* `p_stream` - Input stgream"]
1106 pub fn opj_end_compress(p_codec: *mut opj_codec_t, p_stream: *mut opj_stream_t) -> OPJ_BOOL;
1107}
1108extern "C" {
1109 #[doc = "Encode an image into a JPEG-2000 codestream\n\n# Arguments\n\n* `p_codec` - compressor handle\n* `p_stream` - Output buffer stream\n\n# Returns\n\nReturns true if successful, returns false otherwise"]
1110 pub fn opj_encode(p_codec: *mut opj_codec_t, p_stream: *mut opj_stream_t) -> OPJ_BOOL;
1111}
1112extern "C" {
1113 #[doc = "Destroy Codestream information after compression or decompression\n\n# Arguments\n\n* `cstr_info` - Codestream information structure"]
1114 pub fn opj_destroy_cstr_info(cstr_info: *mut *mut opj_codestream_info_v2_t);
1115}
1116extern "C" {
1117 #[doc = "Dump the codec information into the output stream\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n* `info_flag` - type of information dump.\n* `output_stream` - output stream where dump the information gotten from the codec.\n"]
1118 pub fn opj_dump_codec(
1119 p_codec: *mut opj_codec_t,
1120 info_flag: OPJ_INT32,
1121 output_stream: *mut FILE,
1122 );
1123}
1124extern "C" {
1125 #[doc = "Get the codestream information from the codec\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n\n# Returns\n\na pointer to a codestream information structure.\n"]
1126 pub fn opj_get_cstr_info(p_codec: *mut opj_codec_t) -> *mut opj_codestream_info_v2_t;
1127}
1128extern "C" {
1129 #[doc = "Get the codestream index from the codec\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n\n# Returns\n\na pointer to a codestream index structure.\n"]
1130 pub fn opj_get_cstr_index(p_codec: *mut opj_codec_t) -> *mut opj_codestream_index_t;
1131}
1132extern "C" {
1133 pub fn opj_destroy_cstr_index(p_cstr_index: *mut *mut opj_codestream_index_t);
1134}
1135extern "C" {
1136 #[doc = "Get the JP2 file information from the codec FIXME\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n\n# Returns\n\na pointer to a JP2 metadata structure.\n"]
1137 pub fn opj_get_jp2_metadata(p_codec: *mut opj_codec_t) -> *mut opj_jp2_metadata_t;
1138}
1139extern "C" {
1140 #[doc = "Get the JP2 file index from the codec FIXME\n\n# Arguments\n\n* `p_codec` - the jpeg2000 codec.\n\n# Returns\n\na pointer to a JP2 index structure.\n"]
1141 pub fn opj_get_jp2_index(p_codec: *mut opj_codec_t) -> *mut opj_jp2_index_t;
1142}
1143extern "C" {
1144 #[doc = "Sets the MCT matrix to use.\n\n# Arguments\n\n* `parameters` - the parameters to change.\n* `pEncodingMatrix` - the encoding matrix.\n* `p_dc_shift` - the dc shift coefficients to use.\n* `pNbComp` - the number of components of the image.\n\n# Returns\n\ntrue if the parameters could be set."]
1145 pub fn opj_set_MCT(
1146 parameters: *mut opj_cparameters_t,
1147 pEncodingMatrix: *mut OPJ_FLOAT32,
1148 p_dc_shift: *mut OPJ_INT32,
1149 pNbComp: OPJ_UINT32,
1150 ) -> OPJ_BOOL;
1151}
1152extern "C" {
1153 #[doc = "Returns if the library is built with thread support.\nOPJ_TRUE if mutex, condition, thread, thread pool are available."]
1154 pub fn opj_has_thread_support() -> OPJ_BOOL;
1155}
1156extern "C" {
1157 #[doc = "Return the number of virtual CPUs"]
1158 pub fn opj_get_num_cpus() -> ::std::os::raw::c_int;
1159}