My Project: jas_image.h Source File

My Project 2.0.19 |

jas_image.h
1 /*
2 * Copyright (c) 1999-2000 Image Power, Inc. and the University of
3 * British Columbia.
4 * Copyright (c) 2001-2003 Michael David Adams.
5 * All rights reserved.
6 */
7
8 /* __START_OF_JASPER_LICENSE__
9 *
10 * JasPer License Version 2.0
11 *
12 * Copyright (c) 2001-2006 Michael David Adams
13 * Copyright (c) 1999-2000 Image Power, Inc.
14 * Copyright (c) 1999-2000 The University of British Columbia
15 *
16 * All rights reserved.
17 *
18 * Permission is hereby granted, free of charge, to any person (the
19 * "User") obtaining a copy of this software and associated documentation
20 * files (the "Software"), to deal in the Software without restriction,
21 * including without limitation the rights to use, copy, modify, merge,
22 * publish, distribute, and/or sell copies of the Software, and to permit
23 * persons to whom the Software is furnished to do so, subject to the
24 * following conditions:
25 *
26 * 1. The above copyright notices and this permission notice (which
27 * includes the disclaimer below) shall be included in all copies or
28 * substantial portions of the Software.
29 *
30 * 2. The name of a copyright holder shall not be used to endorse or
31 * promote products derived from the Software without specific prior
32 * written permission.
33 *
34 * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
35 * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
36 * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
37 * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
39 * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
40 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
41 * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
42 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
43 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
44 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
45 * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
46 * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
47 * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
48 * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
49 * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
50 * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
51 * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
52 * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
53 * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
54 * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
55 * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
56 * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
57 * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
58 * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
59 * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
60 *
61 * __END_OF_JASPER_LICENSE__
62 */
63
64 /*
65 * Image Class
66 *
67 * $Id$
68 */
69
70 #ifndef JAS_IMAGE_H
71 #define JAS_IMAGE_H
72
73 /******************************************************************************\
74 * Includes.
75 \******************************************************************************/
76
77 /* The configuration header file should be included first. */
78 #include <jasper/jas_config.h>
79
80 #include <jasper/jas_stream.h>
81 #include <jasper/jas_types.h>
82 #include <jasper/jas_seq.h> /* IWYU pragma: export */
83 #include <jasper/jas_cm.h> /* IWYU pragma: export */
84 #include <stdio.h>
85
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89
90 /******************************************************************************\
91 * Constants.
92 \******************************************************************************/
93
94 /*
95 * Miscellaneous constants.
96 */
97
98 /* Basic units */
99 #define JAS_IMAGE_KIBI (JAS_CAST(size_t, 1024))
100 #define JAS_IMAGE_MEBI (JAS_IMAGE_KIBI * JAS_IMAGE_KIBI)
101
102 /* The threshold at which image data is no longer stored in memory. */
103 #define JAS_IMAGE_INMEMTHRESH (256 * JAS_IMAGE_MEBI)
104
105 /*
106 * Component types
107 */
108
109 #define JAS_IMAGE_CT_UNKNOWN 0x10000
110 #define JAS_IMAGE_CT_COLOR(n) ((n) & 0x7fff)
111 #define JAS_IMAGE_CT_OPACITY 0x08000
112
113 #define JAS_IMAGE_CT_RGB_R 0
114 #define JAS_IMAGE_CT_RGB_G 1
115 #define JAS_IMAGE_CT_RGB_B 2
116
117 #define JAS_IMAGE_CT_YCBCR_Y 0
118 #define JAS_IMAGE_CT_YCBCR_CB 1
119 #define JAS_IMAGE_CT_YCBCR_CR 2
120
121 #define JAS_IMAGE_CT_GRAY_Y 0
122
123 /******************************************************************************\
124 * Simple types.
125 \******************************************************************************/
126
127 /* Image coordinate. */
128 typedef int_fast32_t jas_image_coord_t;
129 #define JAS_IMAGE_COORD_MAX INT_FAST32_MAX
130 #define JAS_IMAGE_COORD_MIN INT_FAST32_MIN
131
132 /* Color space (e.g., RGB, YCbCr). */
133 typedef int_fast16_t jas_image_colorspc_t;
134
135 /* Component type (e.g., color, opacity). */
136 typedef int_fast32_t jas_image_cmpttype_t;
137
138 /* Component sample data format (e.g., real/integer, signedness, precision). */
139 typedef int_fast16_t jas_image_smpltype_t;
140
141 /******************************************************************************\
142 * Image class and supporting classes.
143 \******************************************************************************/
144
145 /* Image component class. */
146
147 typedef struct {
148
149 jas_image_coord_t tlx_;
150 /* The x-coordinate of the top-left corner of the component. */
151
152 jas_image_coord_t tly_;
153 /* The y-coordinate of the top-left corner of the component. */
154
155 jas_image_coord_t hstep_;
156 /* The horizontal sampling period in units of the reference grid. */
157
158 jas_image_coord_t vstep_;
159 /* The vertical sampling period in units of the reference grid. */
160
161 jas_image_coord_t width_;
162 /* The component width in samples. */
163
164 jas_image_coord_t height_;
165 /* The component height in samples. */
166
167 #ifdef FIX_ME
168 int smpltype_;
169 #else
170 int prec_;
171 /* The precision of the sample data (i.e., the number of bits per
172 sample). If the samples are signed values, this quantity
173 includes the sign bit. */
174
175 int sgnd_;
176 /* The signedness of the sample data. */
177 #endif
178
179 jas_stream_t *stream_;
180 /* The stream containing the component data. */
181
182 int cps_;
183 /* The number of characters per sample in the stream. */
184
185 jas_image_cmpttype_t type_;
186 /* The type of component (e.g., opacity, red, green, blue, luma). */
187
188 } jas_image_cmpt_t;
189
190 /* Image class. */
191
192 typedef struct {
193
194 jas_image_coord_t tlx_;
195 /* The x-coordinate of the top-left corner of the image bounding box. */
196
197 jas_image_coord_t tly_;
198 /* The y-coordinate of the top-left corner of the image bounding box. */
199
200 jas_image_coord_t brx_;
201 /* The x-coordinate of the bottom-right corner of the image bounding
202 box (plus one). */
203
204 jas_image_coord_t bry_;
205 /* The y-coordinate of the bottom-right corner of the image bounding
206 box (plus one). */
207
208 unsigned numcmpts_;
209 /* The number of components. */
210
211 unsigned maxcmpts_;
212 /* The maximum number of components that this image can have (i.e., the
213 allocated size of the components array). */
214
215 jas_image_cmpt_t **cmpts_;
216 /* Per-component information. */
217
218 jas_clrspc_t clrspc_;
219
220 jas_cmprof_t *cmprof_;
221
222 // bool inmem_;
223
224 } jas_image_t;
225
226 /* Component parameters class. */
227 /* This data type exists solely/mainly for the purposes of the
228 jas_image_create function. */
229
230 typedef struct {
231
232 jas_image_coord_t tlx;
233 /* The x-coordinate of the top-left corner of the component. */
234
235 jas_image_coord_t tly;
236 /* The y-coordinate of the top-left corner of the component. */
237
238 jas_image_coord_t hstep;
239 /* The horizontal sampling period in units of the reference grid. */
240
241 jas_image_coord_t vstep;
242 /* The vertical sampling period in units of the reference grid. */
243
244 jas_image_coord_t width;
245 /* The width of the component in samples. */
246
247 jas_image_coord_t height;
248 /* The height of the component in samples. */
249
250 #ifdef FIX_ME
251 int smpltype;
252 #else
253 int prec;
254 /* The precision of the component sample data. */
255
256 int sgnd;
257 /* The signedness of the component sample data. */
258 #endif
259
260 } jas_image_cmptparm_t;
261
262 /******************************************************************************\
263 * File format related classes.
264 \******************************************************************************/
265
266 #define JAS_IMAGE_MAXFMTS 32
267 /* The maximum number of image data formats supported. */
268
269 /* Image format-dependent operations. */
270
271 typedef struct {
272
273 jas_image_t *(*decode)(jas_stream_t *in, const char *opts);
274 /* Decode image data from a stream. */
275
276 int (*encode)(jas_image_t *image, jas_stream_t *out, const char *opts);
277 /* Encode image data to a stream. */
278
279 int (*validate)(jas_stream_t *in);
280 /* Determine if stream data is in a particular format. */
281
282 } jas_image_fmtops_t;
283
284 /* Image format information. */
285
286 typedef struct {
287
288 int id;
289 /* The ID for this format. */
290
291 char *name;
292 /* The name by which this format is identified. */
293
294 char *ext;
295 /* The file name extension associated with this format. */
296
297 char *desc;
298 /* A brief description of the format. */
299
300 jas_image_fmtops_t ops;
301 /* The operations for this format. */
302
303 } jas_image_fmtinfo_t;
304
305 /******************************************************************************\
306 * Image operations.
307 \******************************************************************************/
308
309 /* Create an image. */
310 JAS_DLLEXPORT jas_image_t *jas_image_create(unsigned numcmpts,
311 const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc);
312
313 /* Create an "empty" image. */
314 JAS_DLLEXPORT jas_image_t *jas_image_create0(void);
315
316 /* Clone an image. */
317 JAS_DLLEXPORT jas_image_t *jas_image_copy(jas_image_t *image);
318
319 /* Deallocate any resources associated with an image. */
320 JAS_DLLEXPORT void jas_image_destroy(jas_image_t *image);
321
322 /* Get the width of the image in units of the image reference grid. */
323 #define jas_image_width(image) \
324 ((image)->brx_ - (image)->tlx_)
325
326 /* Get the height of the image in units of the image reference grid. */
327 #define jas_image_height(image) \
328 ((image)->bry_ - (image)->tly_)
329
330 /* Get the x-coordinate of the top-left corner of the image bounding box
331 on the reference grid. */
332 #define jas_image_tlx(image) \
333 ((image)->tlx_)
334
335 /* Get the y-coordinate of the top-left corner of the image bounding box
336 on the reference grid. */
337 #define jas_image_tly(image) \
338 ((image)->tly_)
339
340 /* Get the x-coordinate of the bottom-right corner of the image bounding box
341 on the reference grid (plus one). */
342 #define jas_image_brx(image) \
343 ((image)->brx_)
344
345 /* Get the y-coordinate of the bottom-right corner of the image bounding box
346 on the reference grid (plus one). */
347 #define jas_image_bry(image) \
348 ((image)->bry_)
349
350 /* Get the number of image components. */
351 #define jas_image_numcmpts(image) \
352 ((image)->numcmpts_)
353
354 /* Get the color model used by the image. */
355 #define jas_image_clrspc(image) \
356 ((image)->clrspc_)
357
358 /* Set the color model for an image. */
359 #define jas_image_setclrspc(image, clrspc) \
360 ((image)->clrspc_ = (clrspc))
361
362 #define jas_image_cmpttype(image, cmptno) \
363 ((image)->cmpts_[(cmptno)]->type_)
364 #define jas_image_setcmpttype(image, cmptno, type) \
365 ((image)->cmpts_[(cmptno)]->type_ = (type))
366
367 /* Get the width of a component. */
368 #define jas_image_cmptwidth(image, cmptno) \
369 ((image)->cmpts_[cmptno]->width_)
370
371 /* Get the height of a component. */
372 #define jas_image_cmptheight(image, cmptno) \
373 ((image)->cmpts_[cmptno]->height_)
374
375 /* Get the signedness of the sample data for a component. */
376 #define jas_image_cmptsgnd(image, cmptno) \
377 ((image)->cmpts_[cmptno]->sgnd_)
378
379 /* Get the precision of the sample data for a component. */
380 #define jas_image_cmptprec(image, cmptno) \
381 ((image)->cmpts_[cmptno]->prec_)
382
383 /* Get the horizontal subsampling factor for a component. */
384 #define jas_image_cmpthstep(image, cmptno) \
385 ((image)->cmpts_[cmptno]->hstep_)
386
387 /* Get the vertical subsampling factor for a component. */
388 #define jas_image_cmptvstep(image, cmptno) \
389 ((image)->cmpts_[cmptno]->vstep_)
390
391 /* Get the x-coordinate of the top-left corner of a component. */
392 #define jas_image_cmpttlx(image, cmptno) \
393 ((image)->cmpts_[cmptno]->tlx_)
394
395 /* Get the y-coordinate of the top-left corner of a component. */
396 #define jas_image_cmpttly(image, cmptno) \
397 ((image)->cmpts_[cmptno]->tly_)
398
399 /* Get the x-coordinate of the bottom-right corner of a component
400 (plus "one"). */
401 #define jas_image_cmptbrx(image, cmptno) \
402 ((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
403 (image)->cmpts_[cmptno]->hstep_)
404
405 /* Get the y-coordinate of the bottom-right corner of a component
406 (plus "one"). */
407 #define jas_image_cmptbry(image, cmptno) \
408 ((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
409 (image)->cmpts_[cmptno]->vstep_)
410
411 // Test if all components are specified at the same positions in space. */
412 JAS_ATTRIBUTE_PURE
413 JAS_DLLEXPORT bool jas_image_cmpt_domains_same(const jas_image_t *image);
414
415 /* Get the raw size of an image (i.e., the nominal size of the image without
416 any compression. */
417 JAS_ATTRIBUTE_PURE
418 JAS_DLLEXPORT uint_fast32_t jas_image_rawsize(const jas_image_t *image);
419
420 /* Create an image from a stream in some specified format. */
421 JAS_DLLEXPORT jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, const char *optstr);
422
423 /* Write an image to a stream in a specified format. */
424 JAS_DLLEXPORT int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt,
425 const char *optstr);
426
427 /* Read a rectangular region of an image component. */
428 /* The position and size of the rectangular region to be read is specified
429 relative to the component's coordinate system. */
430 JAS_DLLEXPORT int jas_image_readcmpt(jas_image_t *image, unsigned cmptno, jas_image_coord_t x,
431 jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
432 jas_matrix_t *data);
433
434 /* Write a rectangular region of an image component. */
435 JAS_DLLEXPORT int jas_image_writecmpt(jas_image_t *image, unsigned cmptno, jas_image_coord_t x,
436 jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
437 const jas_matrix_t *data);
438
439 /* Delete a component from an image. */
440 JAS_DLLEXPORT void jas_image_delcmpt(jas_image_t *image, unsigned cmptno);
441
442 /* Add a component to an image. */
443 JAS_DLLEXPORT int jas_image_addcmpt(jas_image_t *image, int cmptno,
444 const jas_image_cmptparm_t *cmptparm);
445
446 /* Copy a component from one image to another. */
447 JAS_DLLEXPORT int jas_image_copycmpt(jas_image_t *dstimage, unsigned dstcmptno,
448 jas_image_t *srcimage, unsigned srccmptno);
449
450 JAS_ATTRIBUTE_CONST
451 static inline bool JAS_IMAGE_CDT_GETSGND(uint_least8_t dtype)
452 {
453 return (dtype >> 7) & 1;
454 }
455
456 JAS_ATTRIBUTE_CONST
457 static inline uint_least8_t JAS_IMAGE_CDT_SETSGND(bool sgnd)
458 {
459 return (uint_least8_t)sgnd << 7;
460 }
461
462 JAS_ATTRIBUTE_CONST
463 static inline uint_least8_t JAS_IMAGE_CDT_GETPREC(uint_least8_t dtype)
464 {
465 return dtype & 0x7f;
466 }
467
468 JAS_ATTRIBUTE_CONST
469 static inline uint_least8_t JAS_IMAGE_CDT_SETPREC(uint_least8_t dtype)
470 {
471 return dtype & 0x7f;
472 }
473
474 JAS_ATTRIBUTE_PURE
475 static inline uint_least8_t jas_image_cmptdtype(const jas_image_t *image, unsigned cmptno)
476 {
477 return JAS_IMAGE_CDT_SETSGND(image->cmpts_[cmptno]->sgnd_) |
478 JAS_IMAGE_CDT_SETPREC(image->cmpts_[cmptno]->prec_);
479 }
480
481 JAS_DLLEXPORT int jas_image_depalettize(jas_image_t *image, unsigned cmptno, unsigned numlutents,
482 const int_fast32_t *lutents, int dtype, unsigned newcmptno);
483
484 JAS_DLLEXPORT int jas_image_readcmptsample(jas_image_t *image, unsigned cmptno, int x, int y);
485 JAS_DLLEXPORT void jas_image_writecmptsample(jas_image_t *image, unsigned cmptno, int x, int y,
486 int_fast32_t v);
487
488 JAS_ATTRIBUTE_PURE
489 JAS_DLLEXPORT int jas_image_getcmptbytype(const jas_image_t *image, int ctype);
490
491 /******************************************************************************\
492 * Image format-related operations.
493 \******************************************************************************/
494
495 /* Clear the table of image formats. */
496 JAS_DLLEXPORT void jas_image_clearfmts(void);
497
498 /* Add entry to table of image formats. */
499 JAS_DLLEXPORT int jas_image_addfmt(int id, const char *name, const char *ext, const char *desc,
500 const jas_image_fmtops_t *ops);
501
502 /* Get the ID for the image format with the specified name. */
503 JAS_ATTRIBUTE_PURE
504 JAS_DLLEXPORT int jas_image_strtofmt(const char *s);
505
506 /* Get the name of the image format with the specified ID. */
507 JAS_ATTRIBUTE_CONST
508 JAS_DLLEXPORT const char *jas_image_fmttostr(int fmt);
509
510 /* Lookup image format information by the format ID. */
511 JAS_ATTRIBUTE_CONST
512 JAS_DLLEXPORT const jas_image_fmtinfo_t *jas_image_lookupfmtbyid(int id);
513
514 /* Lookup image format information by the format name. */
515 JAS_ATTRIBUTE_PURE
516 JAS_DLLEXPORT const jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name);
517
518 /* Guess the format of an image file based on its name. */
519 JAS_ATTRIBUTE_PURE
520 JAS_DLLEXPORT int jas_image_fmtfromname(const char *filename);
521
522 /* Get the format of image data in a stream. */
523 JAS_ATTRIBUTE_PURE
524 JAS_DLLEXPORT int jas_image_getfmt(jas_stream_t *in);
525
526
527 #define jas_image_cmprof(image) ((image)->cmprof_)
528 JAS_ATTRIBUTE_PURE
529 int jas_image_ishomosamp(const jas_image_t *image);
530 int jas_image_sampcmpt(jas_image_t *image, unsigned cmptno, unsigned newcmptno,
531 jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs,
532 jas_image_coord_t vs, int sgnd, int prec);
533 int jas_image_writecmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x,
534 jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
535 const long *buf);
536 int jas_image_readcmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x,
537 jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
538 long *buf);
539
540 #define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof)
541 JAS_DLLEXPORT jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof,
542 int intent);
543 void jas_image_dump(jas_image_t *image, FILE *out);
544
545 /******************************************************************************\
546 * Image format-dependent operations.
547 \******************************************************************************/
548
549 #if !defined(EXCLUDE_JPG_SUPPORT)
550 /* Format-dependent operations for JPG support. */
551 jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr);
552 int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
553 int jpg_validate(jas_stream_t *in);
554 #endif
555
556 #if !defined(EXCLUDE_MIF_SUPPORT)
557 /* Format-dependent operations for MIF support. */
558 jas_image_t *mif_decode(jas_stream_t *in, const char *optstr);
559 int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
560 int mif_validate(jas_stream_t *in);
561 #endif
562
563 #if !defined(EXCLUDE_PNM_SUPPORT)
564 /* Format-dependent operations for PNM support. */
565 jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr);
566 int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
567 int pnm_validate(jas_stream_t *in);
568 #endif
569
570 #if !defined(EXCLUDE_RAS_SUPPORT)
571 /* Format-dependent operations for Sun Rasterfile support. */
572 jas_image_t *ras_decode(jas_stream_t *in, const char *optstr);
573 int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
574 int ras_validate(jas_stream_t *in);
575 #endif
576
577 #if !defined(EXCLUDE_BMP_SUPPORT)
578 /* Format-dependent operations for BMP support. */
579 jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr);
580 int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
581 int bmp_validate(jas_stream_t *in);
582 #endif
583
584 #if !defined(EXCLUDE_JP2_SUPPORT)
585 /* Format-dependent operations for JP2 support. */
586 jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr);
587 int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
588 int jp2_validate(jas_stream_t *in);
589 #endif
590
591 #if !defined(EXCLUDE_JPC_SUPPORT)
592 /* Format-dependent operations for JPEG-2000 code stream support. */
593 jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr);
594 int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
595 int jpc_validate(jas_stream_t *in);
596 #endif
597
598 #if !defined(EXCLUDE_PGX_SUPPORT)
599 /* Format-dependent operations for PGX support. */
600 jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr);
601 int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
602 int pgx_validate(jas_stream_t *in);
603 #endif
604
605 #ifdef __cplusplus
606 }
607 #endif
608
609 #endif