1 /*
2  * Copyright (c) 1999-2000 Image Power, Inc. and the University of
3  *   British Columbia.
4  * Copyright (c) 2001-2002 Michael David Adams.
5  * All rights reserved.
6  */
7 
8 /* __START_OF_JASPER_LICENSE__
9  *
10  * JasPer Software License
11  *
12  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
13  * ************************************
14  *
15  * GRANT:
16  *
17  * Permission is hereby granted, free of charge, to any person (the "User")
18  * obtaining a copy of this software and associated documentation, to deal
19  * in the JasPer Software without restriction, including without limitation
20  * the right to use, copy, modify, merge, publish, distribute, sublicense,
21  * and/or sell copies of the JasPer Software (in source and binary forms),
22  * and to permit persons to whom the JasPer Software is furnished to do so,
23  * provided further that the License Conditions below are met.
24  *
25  * License Conditions
26  * ******************
27  *
28  * A.  Redistributions of source code must retain the above copyright notice,
29  * and this list of conditions, and the following disclaimer.
30  *
31  * B.  Redistributions in binary form must reproduce the above copyright
32  * notice, and this list of conditions, and the following disclaimer in
33  * the documentation and/or other materials provided with the distribution.
34  *
35  * C.  Neither the name of Image Power, Inc. nor any other contributor
36  * (including, but not limited to, the University of British Columbia and
37  * Michael David Adams) may be used to endorse or promote products derived
38  * from this software without specific prior written permission.
39  *
40  * D.  User agrees that it shall not commence any action against Image Power,
41  * Inc., the University of British Columbia, Michael David Adams, or any
42  * other contributors (collectively "Licensors") for infringement of any
43  * intellectual property rights ("IPR") held by the User in respect of any
44  * technology that User owns or has a right to license or sublicense and
45  * which is an element required in order to claim compliance with ISO/IEC
46  * 15444-1 (i.e., JPEG-2000 Part 1).  "IPR" means all intellectual property
47  * rights worldwide arising under statutory or common law, and whether
48  * or not perfected, including, without limitation, all (i) patents and
49  * patent applications owned or licensable by User; (ii) rights associated
50  * with works of authorship including copyrights, copyright applications,
51  * copyright registrations, mask work rights, mask work applications,
52  * mask work registrations; (iii) rights relating to the protection of
53  * trade secrets and confidential information; (iv) any right analogous
54  * to those set forth in subsections (i), (ii), or (iii) and any other
55  * proprietary rights relating to intangible property (other than trademark,
56  * trade dress, or service mark rights); and (v) divisions, continuations,
57  * renewals, reissues and extensions of the foregoing (as and to the extent
58  * applicable) now existing, hereafter filed, issued or acquired.
59  *
60  * E.  If User commences an infringement action against any Licensor(s) then
61  * such Licensor(s) shall have the right to terminate User's license and
62  * all sublicenses that have been granted hereunder by User to other parties.
63  *
64  * F.  This software is for use only in hardware or software products that
65  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
66  * or right to this Software is granted for products that do not comply
67  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
68  * from the ISO.
69  *
70  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
71  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
72  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
73  * CONTRIBUTORS UNDER THIS LICENSE ON AN ``AS-IS'' BASIS, WITHOUT WARRANTY
74  * OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
75  * WARRANTIES THAT THE JASPER SOFTWARE IS FREE OF DEFECTS, IS MERCHANTABLE,
76  * IS FIT FOR A PARTICULAR PURPOSE OR IS NON-INFRINGING.  THOSE INTENDING
77  * TO USE THE JASPER SOFTWARE OR MODIFICATIONS THEREOF FOR USE IN HARDWARE
78  * OR SOFTWARE PRODUCTS ARE ADVISED THAT THEIR USE MAY INFRINGE EXISTING
79  * PATENTS, COPYRIGHTS, TRADEMARKS, OR OTHER INTELLECTUAL PROPERTY RIGHTS.
80  * THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE JASPER SOFTWARE
81  * IS WITH THE USER.  SHOULD ANY PART OF THE JASPER SOFTWARE PROVE DEFECTIVE
82  * IN ANY RESPECT, THE USER (AND NOT THE INITIAL DEVELOPERS, THE UNIVERSITY
83  * OF BRITISH COLUMBIA, IMAGE POWER, INC., MICHAEL DAVID ADAMS, OR ANY
84  * OTHER CONTRIBUTOR) SHALL ASSUME THE COST OF ANY NECESSARY SERVICING,
85  * REPAIR OR CORRECTION.  UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
86  * WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE
87  * INITIAL DEVELOPER, THE UNIVERSITY OF BRITISH COLUMBIA, IMAGE POWER, INC.,
88  * MICHAEL DAVID ADAMS, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF THE
89  * JASPER SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO
90  * THE USER OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
91  * CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION,
92  * DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR
93  * MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF
94  * SUCH PARTY HAD BEEN INFORMED, OR OUGHT TO HAVE KNOWN, OF THE POSSIBILITY
95  * OF SUCH DAMAGES.  THE JASPER SOFTWARE AND UNDERLYING TECHNOLOGY ARE NOT
96  * FAULT-TOLERANT AND ARE NOT DESIGNED, MANUFACTURED OR INTENDED FOR USE OR
97  * RESALE AS ON-LINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING
98  * FAIL-SAFE PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES,
99  * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT
100  * LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
101  * JASPER SOFTWARE OR UNDERLYING TECHNOLOGY OR PRODUCT COULD LEAD DIRECTLY
102  * TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE
103  * ("HIGH RISK ACTIVITIES").  LICENSOR SPECIFICALLY DISCLAIMS ANY EXPRESS
104  * OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.  USER WILL NOT
105  * KNOWINGLY USE, DISTRIBUTE OR RESELL THE JASPER SOFTWARE OR UNDERLYING
106  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
107  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
108  * NOTICE SPECIFIED IN THIS SECTION.
109  *
110  * __END_OF_JASPER_LICENSE__
111  */
112 
113 /*
114  * Image Class
115  *
116  * $Id$
117  */
118 
119 #ifndef JAS_IMAGE_H
120 #define JAS_IMAGE_H
121 
122 /******************************************************************************\
123 * Includes.
124 \******************************************************************************/
125 
126 #include "netpbm/pm_c_util.h"
127 #include <jasper/jas_stream.h>
128 #include <jasper/jas_seq.h>
129 
130 #ifdef __cplusplus
131 extern "C" {
132 #endif
133 
134 /******************************************************************************\
135 * Constants.
136 \******************************************************************************/
137 
138 /*
139  * Miscellaneous constants.
140  */
141 
142 /* The threshold at which image data is no longer stored in memory. */
143 #define JAS_IMAGE_INMEMTHRESH	(16 * 1024 * 1024)
144 
145 /*
146  * Color models.
147  */
148 
149 #define JAS_IMAGE_CS_UNKNOWN	0	/* Unknown */
150 #define	JAS_IMAGE_CS_GRAY	1	/* Standard Gray */
151 #define	JAS_IMAGE_CS_RGB	2	/* Standard RGB */
152 #define	JAS_IMAGE_CS_YCBCR	3	/* Standard YCC */
153 #if 0
154 #define	JAS_IMAGE_CM_ICC	4	/* ICC Profile */
155 #endif
156 /*
157  * Component types
158  */
159 
160 #define	JAS_IMAGE_CT_UNKNOWN	0x10000
161 #define	JAS_IMAGE_CT_COLOR(n)	((n) & 0x7fff)
162 #define	JAS_IMAGE_CT_OPACITY	0x08000
163 
164 #define	JAS_IMAGE_CT_RGB_R	0
165 #define	JAS_IMAGE_CT_RGB_G	1
166 #define	JAS_IMAGE_CT_RGB_B	2
167 
168 #define	JAS_IMAGE_CT_YCBCR_Y	0
169 #define	JAS_IMAGE_CT_YCBCR_CB	1
170 #define	JAS_IMAGE_CT_YCBCR_CR	2
171 
172 #define	JAS_IMAGE_CT_GRAY_Y	0
173 
174 /*****************************************************************************\
175 * Image class and supporting classes.
176 \*****************************************************************************/
177 
178 /* Image component class. */
179 
180 typedef struct {
181 
182 	uint_fast32_t tlx_;
183 	/* The x-coordinate of the top-left corner of the component. */
184 
185 	uint_fast32_t tly_;
186 	/* The y-coordinate of the top-left corner of the component. */
187 
188 	uint_fast32_t hstep_;
189 	/* The horizontal sampling period in units of the reference grid. */
190 
191 	uint_fast32_t vstep_;
192 	/* The vertical sampling period in units of the reference grid. */
193 
194 	uint_fast32_t width_;
195 	/* The component width in samples. */
196 
197 	uint_fast32_t height_;
198 	/* The component height in samples. */
199 
200 	uint_fast16_t prec_;
201 	/* The precision of the sample data (i.e., the number of bits per
202 	sample).  If the samples are signed values, this quantity
203 	includes the sign bit. */
204 
205 	uint_fast8_t sgnd_;
206 	/* The signedness of the sample data. */
207 
208 	jas_stream_t *stream_;
209 	/* The stream containing the component data. */
210 
211 	int cps_;
212 	/* The number of characters per sample in the stream. */
213 
214 	uint_fast32_t type_;
215 	/* The type of component (e.g., opacity, red, green, blue, luma). */
216 
217 } jas_image_cmpt_t;
218 
219 /* Image class. */
220 
221 typedef struct {
222 
223 	uint_fast32_t tlx_;
224 	/* The x-coordinate of the top-left corner of the image bounding box. */
225 
226 	uint_fast32_t tly_;
227 	/* The y-coordinate of the top-left corner of the image bounding box. */
228 
229 	uint_fast32_t brx_;
230 	/* The x-coordinate of the bottom-right corner of the image bounding
231 	  box (plus one). */
232 
233 	uint_fast32_t bry_;
234 	/* The y-coordinate of the bottom-right corner of the image bounding
235 	  box (plus one). */
236 
237 	uint_fast16_t numcmpts_;
238 	/* The number of components. */
239 
240 	uint_fast16_t maxcmpts_;
241 	/* The maximum number of components that this image can have (i.e., the
242 	  allocated size of the components array). */
243 
244 	jas_image_cmpt_t **cmpts_;
245 	/* Per-component information. */
246 
247 	int colorspace_;
248 	/* The color space used (e.g., RGB, YCbCr, gray).  This field is only
249 	of particular relevance in the case of a multi-component image. */
250 
251 	unsigned char *iccp_;
252 	/* ICC profile information. */
253 
254 	int iccplen_;
255 
256 	bool inmem_;
257 
258 } jas_image_t;
259 
260 /* Component parameters class. */
261 /* This data type exists solely/mainly for the purposes of the
262   jas_image_create function. */
263 
264 typedef struct {
265 
266 	uint_fast32_t tlx;
267 	/* The x-coordinate of the top-left corner of the component. */
268 
269 	uint_fast32_t tly;
270 	/* The y-coordinate of the top-left corner of the component. */
271 
272 	uint_fast32_t hstep;
273 	/* The horizontal sampling period in units of the reference grid. */
274 
275 	uint_fast32_t vstep;
276 	/* The vertical sampling period in units of the reference grid. */
277 
278 	uint_fast32_t width;
279 	/* The width of the component in samples. */
280 
281 	uint_fast32_t height;
282 	/* The height of the component in samples. */
283 
284 	uint_fast16_t prec;
285 	/* The precision of the component sample data. */
286 
287 	bool sgnd;
288 	/* The signedness of the component sample data. */
289 
290 } jas_image_cmptparm_t;
291 
292 /******************************************************************************\
293 * File format related classes.
294 \******************************************************************************/
295 
296 #define	JAS_IMAGE_MAXFMTS	32
297 /* The maximum number of image data formats we can handle. */
298 
299 /* Image format-dependent operations. */
300 
301 typedef struct {
302 
303 	jas_image_t *(*decode)(jas_stream_t *in, char *opts);
304 	/* Decode image data from a stream. */
305 
306 	int (*encode)(jas_image_t *image, jas_stream_t *out, char *opts);
307 	/* Encode image data to a stream. */
308 
309 	int (*validate)(jas_stream_t *in);
310 	/* Determine if stream data is in a particular format. */
311 
312 } jas_image_fmtops_t;
313 
314 /* Image format information. */
315 
316 typedef struct {
317 
318 	int id;
319 	/* The ID for this format. */
320 
321 	char *name;
322 	/* The name by which this format is identified. */
323 
324 	char *ext;
325 	/* The file name extension associated with this format. */
326 
327 	char *desc;
328 	/* A brief description of the format. */
329 
330 	jas_image_fmtops_t ops;
331 	/* The operations for this format. */
332 
333 } jas_image_fmtinfo_t;
334 
335 /******************************************************************************\
336 * Image operations.
337 \******************************************************************************/
338 
339 /* Create an image. */
340 jas_image_t *jas_image_create(uint_fast16_t numcmpts,
341   jas_image_cmptparm_t *cmptparms, int colorspace);
342 
343 /* Create an "empty" image. */
344 jas_image_t *jas_image_create0(void);
345 
346 /* Clone an image. */
347 jas_image_t *jas_image_copy(jas_image_t *image);
348 
349 /* Deallocate any resources associated with an image. */
350 void jas_image_destroy(jas_image_t *image);
351 
352 /* Get the width of the image in units of the image reference grid. */
353 #define jas_image_width(image) \
354 	((image)->brx_ - (image)->tlx_)
355 
356 /* Get the height of the image in units of the image reference grid. */
357 #define	jas_image_height(image) \
358 	((image)->bry_ - (image)->tly_)
359 
360 /* Get the x-coordinate of the top-left corner of the image bounding box
361   on the reference grid. */
362 #define jas_image_tlx(image) \
363 	((image)->tlx_)
364 
365 /* Get the y-coordinate of the top-left corner of the image bounding box
366   on the reference grid. */
367 #define jas_image_tly(image) \
368 	((image)->tly_)
369 
370 /* Get the x-coordinate of the bottom-right corner of the image bounding box
371   on the reference grid (plus one). */
372 #define jas_image_brx(image) \
373 	((image)->brx_)
374 
375 /* Get the y-coordinate of the bottom-right corner of the image bounding box
376   on the reference grid (plus one). */
377 #define jas_image_bry(image) \
378 	((image)->bry_)
379 
380 /* Get the number of image components. */
381 #define	jas_image_numcmpts(image) \
382 	((image)->numcmpts_)
383 
384 /* Get the color model used by the image. */
385 #define	jas_image_colorspace(image) \
386 	((image)->colorspace_)
387 
388 /* Set the color model for an image. */
389 #define jas_image_setcolorspace(image, colorspace) \
390 	((image)->colorspace_ = (colorspace))
391 
392 #define jas_image_cmpttype(image, cmptno) \
393 	((image)->cmpts_[(cmptno)]->type_)
394 #define jas_image_setcmpttype(image, cmptno, type) \
395 	((image)->cmpts_[(cmptno)]->type_ = (type))
396 
397 /* Get the width of a component. */
398 #define	jas_image_cmptwidth(image, cmptno) \
399 	((image)->cmpts_[cmptno]->width_)
400 
401 /* Get the height of a component. */
402 #define	jas_image_cmptheight(image, cmptno) \
403 	((image)->cmpts_[cmptno]->height_)
404 
405 /* Get the signedness of the sample data for a component. */
406 #define	jas_image_cmptsgnd(image, cmptno) \
407 	((image)->cmpts_[cmptno]->sgnd_)
408 
409 /* Get the precision of the sample data for a component. */
410 #define	jas_image_cmptprec(image, cmptno) \
411 	((image)->cmpts_[cmptno]->prec_)
412 
413 /* Get the horizontal subsampling factor for a component. */
414 #define	jas_image_cmpthstep(image, cmptno) \
415 	((image)->cmpts_[cmptno]->hstep_)
416 
417 /* Get the vertical subsampling factor for a component. */
418 #define	jas_image_cmptvstep(image, cmptno) \
419 	((image)->cmpts_[cmptno]->vstep_)
420 
421 /* Get the x-coordinate of the top-left corner of a component. */
422 #define	jas_image_cmpttlx(image, cmptno) \
423 	((image)->cmpts_[cmptno]->tlx_)
424 
425 /* Get the y-coordinate of the top-left corner of a component. */
426 #define	jas_image_cmpttly(image, cmptno) \
427 	((image)->cmpts_[cmptno]->tly_)
428 
429 /* Get the x-coordinate of the bottom-right corner of a component
430   (plus "one"). */
431 #define	jas_image_cmptbrx(image, cmptno) \
432 	((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
433 	  (image)->cmpts_[cmptno]->hstep_)
434 
435 /* Get the y-coordinate of the bottom-right corner of a component
436   (plus "one"). */
437 #define	jas_image_cmptbry(image, cmptno) \
438 	((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
439 	  (image)->cmpts_[cmptno]->vstep_)
440 
441 /* Get the raw size of an image (i.e., the nominal size of the image without
442   any compression. */
443 uint_fast32_t jas_image_rawsize(jas_image_t *image);
444 
445 /* Create an image from a stream in some specified format. */
446 jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, char *optstr);
447 
448 /* Write an image to a stream in a specified format. */
449 int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt,
450   char *optstr);
451 
452 /* Read a rectangular region of an image component. */
453 /* The position and size of the rectangular region to be read is specified
454 relative to the component's coordinate system. */
455 int jas_image_readcmpt(jas_image_t *image, uint_fast16_t cmptno,
456   uint_fast32_t x, uint_fast32_t y, uint_fast32_t width, uint_fast32_t height,
457   jas_matrix_t *data);
458 
459 /* Write a rectangular region of an image component. */
460 int jas_image_writecmpt(jas_image_t *image, uint_fast16_t cmptno,
461   uint_fast32_t x, uint_fast32_t y, uint_fast32_t width, uint_fast32_t height,
462   jas_matrix_t *data);
463 
464 /* Delete a component from an image. */
465 void jas_image_delcmpt(jas_image_t *image, uint_fast16_t cmptno);
466 
467 /* Add a component to an image. */
468 int jas_image_addcmpt(jas_image_t *image, uint_fast16_t cmptno,
469   jas_image_cmptparm_t *cmptparm);
470 
471 /* Copy a component from one image to another. */
472 int jas_image_copycmpt(jas_image_t *dstimage, int dstcmptno,
473   jas_image_t *srcimage, int srccmptno);
474 
475 #if 0
476 int_fast64_t jas_image_readcmpt1(jas_image_t *image, uint_fast16_t cmptno,
477   uint_fast32_t x, uint_fast32_t y);
478 #endif
479 
480 #define	JAS_IMAGE_CDT_GETSGND(dtype) (((dtype) >> 7) & 1)
481 #define	JAS_IMAGE_CDT_SETSGND(dtype) (((dtype) & 1) << 7)
482 #define	JAS_IMAGE_CDT_GETPREC(dtype) ((dtype) & 0x7f)
483 #define	JAS_IMAGE_CDT_SETPREC(dtype) ((dtype) & 0x7f)
484 
485 #define	jas_image_cmptdtype(image, cmptno) \
486 	(JAS_IMAGE_CDT_SETSGND((image)->cmpts_[cmptno]->sgnd_) | JAS_IMAGE_CDT_SETPREC((image)->cmpts_[cmptno]->prec_))
487 
488 void jas_image_dump(jas_image_t *image, FILE *out);
489 
490 int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
491   int_fast32_t *lutents, int dtype, int newcmptno);
492 
493 int jas_image_readcmptsample(jas_image_t *image, int cmptno, int x, int y);
494 void jas_image_writecmptsample(jas_image_t *image, int cmptno, int x, int y,
495   int_fast32_t v);
496 
497 int jas_image_getcmptbytype(jas_image_t *image, int ctype);
498 
499 /******************************************************************************\
500 * Image format-related operations.
501 \******************************************************************************/
502 
503 /* Clear the table of image formats. */
504 void jas_image_clearfmts(void);
505 
506 /* Add entry to table of image formats. */
507 int jas_image_addfmt(int id, const char *name, const char *ext,
508   const char *desc,
509   jas_image_fmtops_t *ops);
510 
511 /* Get the ID for the image format with the specified name. */
512 int jas_image_strtofmt(char *s);
513 
514 /* Get the name of the image format with the specified ID. */
515 char *jas_image_fmttostr(int fmt);
516 
517 /* Lookup image format information by the format ID. */
518 jas_image_fmtinfo_t *jas_image_lookupfmtbyid(int id);
519 
520 /* Lookup image format information by the format name. */
521 jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name);
522 
523 /* Guess the format of an image file based on its name. */
524 int jas_image_fmtfromname(char *filename);
525 
526 /* Get the format of image data in a stream. */
527 int jas_image_getfmt(jas_stream_t *in);
528 
529 /******************************************************************************\
530 * Image format-dependent operations.
531 \******************************************************************************/
532 
533 #if !defined(EXCLUDE_JPG_CAPABILITY)
534 /* Format-dependent operations for JPG capability. */
535 jas_image_t *jpg_decode(jas_stream_t *in, char *optstr);
536 int jpg_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
537 int jpg_validate(jas_stream_t *in);
538 #endif
539 
540 #if !defined(EXCLUDE_MIF_CAPABILITY)
541 /* Format-dependent operations for MIF capability. */
542 jas_image_t *mif_decode(jas_stream_t *in, char *optstr);
543 int mif_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
544 int mif_validate(jas_stream_t *in);
545 #endif
546 
547 #if !defined(EXCLUDE_PNM_CAPABILITY)
548 /* Format-dependent operations for PNM capability. */
549 jas_image_t *pnm_decode(jas_stream_t *in, char *optstr);
550 int pnm_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
551 int pnm_validate(jas_stream_t *in);
552 #endif
553 
554 #if !defined(EXCLUDE_RAS_CAPABILITY)
555 /* Format-dependent operations for Sun Rasterfile capability. */
556 jas_image_t *ras_decode(jas_stream_t *in, char *optstr);
557 int ras_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
558 int ras_validate(jas_stream_t *in);
559 #endif
560 
561 #if !defined(EXCLUDE_BMP_CAPABILITY)
562 /* Format-dependent operations for BMP capability. */
563 jas_image_t *bmp_decode(jas_stream_t *in, char *optstr);
564 int bmp_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
565 int bmp_validate(jas_stream_t *in);
566 #endif
567 
568 #if !defined(EXCLUDE_JP2_CAPABILITY)
569 /* Format-dependent operations for JP2 capability. */
570 jas_image_t *jp2_decode(jas_stream_t *in, char *optstr);
571 int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
572 int jp2_validate(jas_stream_t *in);
573 #endif
574 
575 #if !defined(EXCLUDE_JPC_CAPABILITY)
576 /* Format-dependent operations for JPEG-2000 code stream capability. */
577 jas_image_t *jpc_decode(jas_stream_t *in, char *optstr);
578 int jpc_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
579 int jpc_validate(jas_stream_t *in);
580 #endif
581 
582 #if !defined(EXCLUDE_PGX_CAPABILITY)
583 /* Format-dependent operations for PGX capability. */
584 jas_image_t *pgx_decode(jas_stream_t *in, char *optstr);
585 int pgx_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
586 int pgx_validate(jas_stream_t *in);
587 #endif
588 
589 #ifdef __cplusplus
590 }
591 #endif
592 
593 #endif
594