JasPer  2.0.33
jas_image.h
Go to the documentation of this file.
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 
69 #ifndef JAS_IMAGE_H
70 #define JAS_IMAGE_H
71 
72 /******************************************************************************\
73 * Includes.
74 \******************************************************************************/
75 
76 /* The configuration header file should be included first. */
77 #include <jasper/jas_config.h>
78 
79 #include <jasper/jas_stream.h>
80 #include <jasper/jas_types.h>
81 #include <jasper/jas_seq.h> /* IWYU pragma: export */
82 #include <jasper/jas_cm.h> /* IWYU pragma: export */
83 #include <stdio.h>
84 
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
88 
94 /******************************************************************************\
95 * Constants.
96 \******************************************************************************/
97 
98 /*
99  * Miscellaneous constants.
100  */
101 
102 /* Basic units */
103 #define JAS_IMAGE_KIBI (JAS_CAST(size_t, 1024))
104 #define JAS_IMAGE_MEBI (JAS_IMAGE_KIBI * JAS_IMAGE_KIBI)
105 
106 /* The threshold at which image data is no longer stored in memory. */
107 #define JAS_IMAGE_INMEMTHRESH (256 * JAS_IMAGE_MEBI)
108 
109 /*
110  * Component types
111  */
112 
113 #define JAS_IMAGE_CT_UNKNOWN 0x10000
114 #define JAS_IMAGE_CT_COLOR(n) ((n) & 0x7fff)
115 #define JAS_IMAGE_CT_OPACITY 0x08000
116 
117 #define JAS_IMAGE_CT_RGB_R 0
118 #define JAS_IMAGE_CT_RGB_G 1
119 #define JAS_IMAGE_CT_RGB_B 2
120 
121 #define JAS_IMAGE_CT_YCBCR_Y 0
122 #define JAS_IMAGE_CT_YCBCR_CB 1
123 #define JAS_IMAGE_CT_YCBCR_CR 2
124 
125 #define JAS_IMAGE_CT_GRAY_Y 0
126 
127 /******************************************************************************\
128 * Simple types.
129 \******************************************************************************/
130 
133 typedef int_fast32_t jas_image_coord_t;
134 #define JAS_IMAGE_COORD_MAX INT_FAST32_MAX
135 #define JAS_IMAGE_COORD_MIN INT_FAST32_MIN
136 
140 typedef int_fast16_t jas_image_colorspc_t;
141 
145 typedef int_fast32_t jas_image_cmpttype_t;
146 
151 typedef int_fast16_t jas_image_smpltype_t;
152 
153 /******************************************************************************\
154 * Image class and supporting classes.
155 \******************************************************************************/
156 
160 typedef struct {
161 
162  jas_image_coord_t tlx_;
163  /* The x-coordinate of the top-left corner of the component. */
164 
165  jas_image_coord_t tly_;
166  /* The y-coordinate of the top-left corner of the component. */
167 
168  jas_image_coord_t hstep_;
169  /* The horizontal sampling period in units of the reference grid. */
170 
171  jas_image_coord_t vstep_;
172  /* The vertical sampling period in units of the reference grid. */
173 
174  jas_image_coord_t width_;
175  /* The component width in samples. */
176 
177  jas_image_coord_t height_;
178  /* The component height in samples. */
179 
180  unsigned prec_;
181  /* The precision of the sample data (i.e., the number of bits per
182  sample). If the samples are signed values, this quantity
183  includes the sign bit. */
184 
185  int sgnd_;
186  /* The signedness of the sample data. */
187 
188  jas_stream_t *stream_;
189  /* The stream containing the component data. */
190 
191  unsigned cps_;
192  /* The number of characters per sample in the stream. */
193 
194  jas_image_cmpttype_t type_;
195  /* The type of component (e.g., opacity, red, green, blue, luma). */
196 
198 
202 typedef struct {
203 
204  jas_image_coord_t tlx_;
205  /* The x-coordinate of the top-left corner of the image bounding box. */
206 
207  jas_image_coord_t tly_;
208  /* The y-coordinate of the top-left corner of the image bounding box. */
209 
210  jas_image_coord_t brx_;
211  /* The x-coordinate of the bottom-right corner of the image bounding
212  box (plus one). */
213 
214  jas_image_coord_t bry_;
215  /* The y-coordinate of the bottom-right corner of the image bounding
216  box (plus one). */
217 
218  unsigned numcmpts_;
219  /* The number of components. */
220 
221  unsigned maxcmpts_;
222  /* The maximum number of components that this image can have (i.e., the
223  allocated size of the components array). */
224 
225  jas_image_cmpt_t **cmpts_;
226  /* Per-component information. */
227 
228  jas_clrspc_t clrspc_;
229 
230  jas_cmprof_t *cmprof_;
231 
232 // bool inmem_;
233 
234 } jas_image_t;
235 
243 typedef struct {
244 
245  jas_image_coord_t tlx;
246  /* The x-coordinate of the top-left corner of the component. */
247 
248  jas_image_coord_t tly;
249  /* The y-coordinate of the top-left corner of the component. */
250 
251  jas_image_coord_t hstep;
252  /* The horizontal sampling period in units of the reference grid. */
253 
254  jas_image_coord_t vstep;
255  /* The vertical sampling period in units of the reference grid. */
256 
257  jas_image_coord_t width;
258  /* The width of the component in samples. */
259 
260  jas_image_coord_t height;
261  /* The height of the component in samples. */
262 
263  unsigned prec;
264  /* The precision of the component sample data. */
265 
266  int sgnd;
267  /* The signedness of the component sample data. */
268 
270 
271 /******************************************************************************\
272 * File format related classes.
273 \******************************************************************************/
274 
278 #define JAS_IMAGE_MAXFMTS 32
279 
283 typedef struct {
284 
285  jas_image_t *(*decode)(jas_stream_t *in, const char *opts);
286  /* Decode image data from a stream. */
287 
288  int (*encode)(jas_image_t *image, jas_stream_t *out, const char *opts);
289  /* Encode image data to a stream. */
290 
291  int (*validate)(jas_stream_t *in);
292  /* Determine if stream data is in a particular format. */
293 
295 
299 typedef struct {
300 
301  int id;
302  /* The ID for this format. */
303 
304  char *name;
305  /* The name by which this format is identified. */
306 
307  char *ext;
308  /* The file name extension associated with this format. */
309 
310  char *desc;
311  /* A brief description of the format. */
312 
313  jas_image_fmtops_t ops;
314  /* The operations for this format. */
315 
317 
318 /******************************************************************************\
319 * Image operations.
320 \******************************************************************************/
321 
325 JAS_DLLEXPORT jas_image_t *jas_image_create(unsigned numcmpts,
326  const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc);
327 
331 JAS_DLLEXPORT jas_image_t *jas_image_create0(void);
332 
336 JAS_DLLEXPORT jas_image_t *jas_image_copy(jas_image_t *image);
337 
341 JAS_DLLEXPORT void jas_image_destroy(jas_image_t *image);
342 
346 #define jas_image_width(image) \
347  ((image)->brx_ - (image)->tlx_)
348 
352 #define jas_image_height(image) \
353  ((image)->bry_ - (image)->tly_)
354 
359 #define jas_image_tlx(image) \
360  ((image)->tlx_)
361 
366 #define jas_image_tly(image) \
367  ((image)->tly_)
368 
373 #define jas_image_brx(image) \
374  ((image)->brx_)
375 
380 #define jas_image_bry(image) \
381  ((image)->bry_)
382 
386 #define jas_image_numcmpts(image) \
387  ((image)->numcmpts_)
388 
392 #define jas_image_clrspc(image) \
393  ((image)->clrspc_)
394 
398 #define jas_image_setclrspc(image, clrspc) \
399  ((image)->clrspc_ = (clrspc))
400 
401 #define jas_image_cmpttype(image, cmptno) \
402  ((image)->cmpts_[(cmptno)]->type_)
403 #define jas_image_setcmpttype(image, cmptno, type) \
404  ((image)->cmpts_[(cmptno)]->type_ = (type))
405 
409 #define jas_image_cmptwidth(image, cmptno) \
410  ((image)->cmpts_[cmptno]->width_)
411 
415 #define jas_image_cmptheight(image, cmptno) \
416  ((image)->cmpts_[cmptno]->height_)
417 
421 #define jas_image_cmptsgnd(image, cmptno) \
422  ((image)->cmpts_[cmptno]->sgnd_)
423 
427 #define jas_image_cmptprec(image, cmptno) \
428  ((image)->cmpts_[cmptno]->prec_)
429 
433 #define jas_image_cmpthstep(image, cmptno) \
434  ((image)->cmpts_[cmptno]->hstep_)
435 
439 #define jas_image_cmptvstep(image, cmptno) \
440  ((image)->cmpts_[cmptno]->vstep_)
441 
445 #define jas_image_cmpttlx(image, cmptno) \
446  ((image)->cmpts_[cmptno]->tlx_)
447 
451 #define jas_image_cmpttly(image, cmptno) \
452  ((image)->cmpts_[cmptno]->tly_)
453 
458 #define jas_image_cmptbrx(image, cmptno) \
459  ((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
460  (image)->cmpts_[cmptno]->hstep_)
461 
466 #define jas_image_cmptbry(image, cmptno) \
467  ((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
468  (image)->cmpts_[cmptno]->vstep_)
469 
473 JAS_ATTRIBUTE_PURE
474 JAS_DLLEXPORT bool jas_image_cmpt_domains_same(const jas_image_t *image);
475 
480 JAS_ATTRIBUTE_PURE
481 JAS_DLLEXPORT
482 uint_fast32_t jas_image_rawsize(const jas_image_t *image);
483 
487 JAS_DLLEXPORT
488 jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, const char *optstr);
489 
493 JAS_DLLEXPORT
494 int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt,
495  const char *optstr);
496 
504 JAS_DLLEXPORT
505 int jas_image_readcmpt(jas_image_t *image, unsigned cmptno,
507  jas_image_coord_t height, jas_matrix_t *data);
508 
512 JAS_DLLEXPORT
513 int jas_image_writecmpt(jas_image_t *image, unsigned cmptno,
515  jas_image_coord_t height, const jas_matrix_t *data);
516 
520 JAS_DLLEXPORT void jas_image_delcmpt(jas_image_t *image, unsigned cmptno);
521 
525 JAS_DLLEXPORT int jas_image_addcmpt(jas_image_t *image, int cmptno,
526  const jas_image_cmptparm_t *cmptparm);
527 
531 JAS_DLLEXPORT int jas_image_copycmpt(jas_image_t *dstimage, unsigned dstcmptno,
532  jas_image_t *srcimage, unsigned srccmptno);
533 
534 JAS_ATTRIBUTE_CONST
535 static inline bool JAS_IMAGE_CDT_GETSGND(uint_least8_t dtype)
536 {
537  return (dtype >> 7) & 1;
538 }
539 
540 JAS_ATTRIBUTE_CONST
541 static inline uint_least8_t JAS_IMAGE_CDT_SETSGND(bool sgnd)
542 {
543  return (uint_least8_t)sgnd << 7;
544 }
545 
546 JAS_ATTRIBUTE_CONST
547 static inline uint_least8_t JAS_IMAGE_CDT_GETPREC(uint_least8_t dtype)
548 {
549  return dtype & 0x7f;
550 }
551 
552 JAS_ATTRIBUTE_CONST
553 static inline uint_least8_t JAS_IMAGE_CDT_SETPREC(uint_least8_t dtype)
554 {
555  return dtype & 0x7f;
556 }
557 
558 JAS_ATTRIBUTE_PURE
559 static inline uint_least8_t jas_image_cmptdtype(const jas_image_t *image, unsigned cmptno)
560 {
561  return JAS_IMAGE_CDT_SETSGND(image->cmpts_[cmptno]->sgnd_) |
562  JAS_IMAGE_CDT_SETPREC(image->cmpts_[cmptno]->prec_);
563 }
564 
568 JAS_DLLEXPORT
569 int jas_image_depalettize(jas_image_t *image, unsigned cmptno,
570  unsigned numlutents, const int_fast32_t *lutents, unsigned dtype,
571  unsigned newcmptno);
572 
576 JAS_DLLEXPORT
577 int jas_image_readcmptsample(jas_image_t *image, unsigned cmptno, unsigned x,
578  unsigned y);
579 
583 JAS_DLLEXPORT
584 void jas_image_writecmptsample(jas_image_t *image, unsigned cmptno,
585  unsigned x, unsigned y, int_fast32_t v);
586 
590 JAS_ATTRIBUTE_PURE
591 JAS_DLLEXPORT
593 
594 /******************************************************************************\
595 * Image format-related operations.
596 \******************************************************************************/
597 
601 JAS_DLLEXPORT
602 void jas_image_clearfmts(void);
603 
607 JAS_DLLEXPORT
608 int jas_image_addfmt(int id, const char *name, const char *ext,
609  const char *desc, const jas_image_fmtops_t *ops);
610 
614 JAS_ATTRIBUTE_PURE
615 JAS_DLLEXPORT
616 int jas_image_strtofmt(const char *s);
617 
621 JAS_ATTRIBUTE_CONST
622 JAS_DLLEXPORT
623 const char *jas_image_fmttostr(int fmt);
624 
628 JAS_ATTRIBUTE_CONST
629 JAS_DLLEXPORT
631 
635 JAS_ATTRIBUTE_PURE
636 JAS_DLLEXPORT
637 const jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name);
638 
642 JAS_ATTRIBUTE_PURE
643 JAS_DLLEXPORT
644 int jas_image_fmtfromname(const char *filename);
645 
649 JAS_ATTRIBUTE_PURE
650 JAS_DLLEXPORT
651 int jas_image_getfmt(jas_stream_t *in);
652 
653 
657 #define jas_image_cmprof(image) ((image)->cmprof_)
658 
662 JAS_ATTRIBUTE_PURE
663 JAS_DLLEXPORT
664 int jas_image_ishomosamp(const jas_image_t *image);
665 
669 JAS_DLLEXPORT
670 int jas_image_sampcmpt(jas_image_t *image, unsigned cmptno, unsigned newcmptno,
672  jas_image_coord_t vs, int sgnd, unsigned prec);
673 
677 JAS_DLLEXPORT int jas_image_writecmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x,
679  const long *buf);
680 
684 JAS_DLLEXPORT
685 int jas_image_readcmpt2(jas_image_t *image, unsigned cmptno,
687  jas_image_coord_t height, long *buf);
688 
692 #define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof)
693 
697 JAS_DLLEXPORT jas_image_t *jas_image_chclrspc(jas_image_t *image, const jas_cmprof_t *outprof,
698  jas_cmxform_intent_t intent);
699 
703 JAS_DLLEXPORT void jas_image_dump(jas_image_t *image, FILE *out);
704 
705 /******************************************************************************\
706 * Image format-dependent operations.
707 \******************************************************************************/
708 
709 #if defined(JAS_INCLUDE_JPG_CODEC)
710 /* Format-dependent operations for JPG support. */
711 JAS_DLLEXPORT jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr);
712 JAS_DLLEXPORT int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
713 JAS_DLLEXPORT int jpg_validate(jas_stream_t *in);
714 #endif
715 
716 #if defined(JAS_INCLUDE_MIF_CODEC)
717 /* Format-dependent operations for MIF support. */
718 JAS_DLLEXPORT jas_image_t *mif_decode(jas_stream_t *in, const char *optstr);
719 JAS_DLLEXPORT int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
720 JAS_DLLEXPORT int mif_validate(jas_stream_t *in);
721 #endif
722 
723 #if defined(JAS_INCLUDE_PNM_CODEC)
724 /* Format-dependent operations for PNM support. */
725 JAS_DLLEXPORT jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr);
726 JAS_DLLEXPORT int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
727 JAS_DLLEXPORT int pnm_validate(jas_stream_t *in);
728 #endif
729 
730 #if defined(JAS_INCLUDE_RAS_CODEC)
731 /* Format-dependent operations for Sun Rasterfile support. */
732 JAS_DLLEXPORT jas_image_t *ras_decode(jas_stream_t *in, const char *optstr);
733 JAS_DLLEXPORT int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
734 JAS_DLLEXPORT int ras_validate(jas_stream_t *in);
735 #endif
736 
737 #if defined(JAS_INCLUDE_BMP_CODEC)
738 /* Format-dependent operations for BMP support. */
739 JAS_DLLEXPORT jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr);
740 JAS_DLLEXPORT int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
741 JAS_DLLEXPORT int bmp_validate(jas_stream_t *in);
742 #endif
743 
744 #if defined(JAS_INCLUDE_JP2_CODEC)
745 /* Format-dependent operations for JP2 support. */
746 JAS_DLLEXPORT jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr);
747 JAS_DLLEXPORT int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
748 JAS_DLLEXPORT int jp2_validate(jas_stream_t *in);
749 #endif
750 
751 #if defined(JAS_INCLUDE_JPC_CODEC)
752 /* Format-dependent operations for JPEG-2000 code stream support. */
753 JAS_DLLEXPORT jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr);
754 JAS_DLLEXPORT int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
755 JAS_DLLEXPORT int jpc_validate(jas_stream_t *in);
756 #endif
757 
758 #if defined(JAS_INCLUDE_PGX_CODEC)
759 /* Format-dependent operations for PGX support. */
760 JAS_DLLEXPORT jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr);
761 JAS_DLLEXPORT int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
762 JAS_DLLEXPORT int pgx_validate(jas_stream_t *in);
763 #endif
764 
769 #ifdef __cplusplus
770 }
771 #endif
772 
773 #endif
jas_image_destroy
void jas_image_destroy(jas_image_t *image)
Deallocate any resources associated with an image.
Definition: jas_image.c:303
jas_image_copycmpt
int jas_image_copycmpt(jas_image_t *dstimage, unsigned dstcmptno, jas_image_t *srcimage, unsigned srccmptno)
Copy a component from one image to another.
Definition: jas_image.c:974
jas_image_create0
jas_image_t * jas_image_create0()
Create an "empty" image.
Definition: jas_image.c:202
jas_image_chclrspc
jas_image_t * jas_image_chclrspc(jas_image_t *image, const jas_cmprof_t *outprof, jas_cmxform_intent_t intent)
Change the color space for an image.
Definition: jas_image.c:1458
jas_image_delcmpt
void jas_image_delcmpt(jas_image_t *image, unsigned cmptno)
Delete a component from an image.
Definition: jas_image.c:830
jas_stream_putc
#define jas_stream_putc(stream, c)
jas_stream_putc Write a character to a stream.
Definition: jas_stream.h:551
jas_image_smpltype_t
int_fast16_t jas_image_smpltype_t
Component sample data format (e.g., real/integer, signedness, precision).
Definition: jas_image.h:151
jas_image_cmptprec
#define jas_image_cmptprec(image, cmptno)
Get the precision of the sample data for a component.
Definition: jas_image.h:427
jas_malloc.h
JasPer Memory Allocator.
JAS_IMAGE_MAXFMTS
#define JAS_IMAGE_MAXFMTS
The maximum number of image data formats supported.
Definition: jas_image.h:278
jas_image_cmprof
#define jas_image_cmprof(image)
Get the color management profile of an image.
Definition: jas_image.h:657
jas_image_coord_t
int_fast32_t jas_image_coord_t
Image coordinate.
Definition: jas_image.h:133
jas_image_lookupfmtbyname
const jas_image_fmtinfo_t * jas_image_lookupfmtbyname(const char *name)
Lookup image format information by the format name.
Definition: jas_image.c:889
jas_image_cmpt_t
Image component class.
Definition: jas_image.h:160
jas_stream_read
unsigned jas_stream_read(jas_stream_t *stream, void *buf, unsigned cnt)
Read characters from a stream into a buffer.
Definition: jas_stream.c:670
jas_image_numcmpts
#define jas_image_numcmpts(image)
Get the number of image components.
Definition: jas_image.h:386
jas_stream_close
int jas_stream_close(jas_stream_t *stream)
Close a stream.
Definition: jas_stream.c:610
jas_image_cmptvstep
#define jas_image_cmptvstep(image, cmptno)
Get the vertical subsampling factor for a component.
Definition: jas_image.h:439
jas_image_readcmpt
int jas_image_readcmpt(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, jas_matrix_t *data)
Read a rectangular region of an image component.
Definition: jas_image.c:470
jas_image_depalettize
int jas_image_depalettize(jas_image_t *image, unsigned cmptno, unsigned numlutents, const int_fast32_t *lutents, unsigned dtype, unsigned newcmptno)
Depalettize an image.
Definition: jas_image.c:1025
jas_image_addcmpt
int jas_image_addcmpt(jas_image_t *image, int cmptno, const jas_image_cmptparm_t *cmptparm)
Add a component to an image.
Definition: jas_image.c:845
jas_image_getfmt
int jas_image_getfmt(jas_stream_t *in)
Get the format of image data in a stream.
Definition: jas_image.c:753
jas_image_cmpthstep
#define jas_image_cmpthstep(image, cmptno)
Get the horizontal subsampling factor for a component.
Definition: jas_image.h:433
jas_image_cmptheight
#define jas_image_cmptheight(image, cmptno)
Get the height of a component.
Definition: jas_image.h:415
jas_image_colorspc_t
int_fast16_t jas_image_colorspc_t
Color space (e.g., RGB, YCbCr).
Definition: jas_image.h:140
jas_image_ishomosamp
int jas_image_ishomosamp(const jas_image_t *image)
???
Definition: jas_image.c:1308
jas_image_readcmptsample
int jas_image_readcmptsample(jas_image_t *image, unsigned cmptno, unsigned x, unsigned y)
Read a component sample for an image.
Definition: jas_image.c:1067
jas_image_strtofmt
int jas_image_strtofmt(const char *name)
Get the ID for the image format with the specified name.
Definition: jas_image.c:735
jas_stream_rewind
int jas_stream_rewind(jas_stream_t *stream)
Seek to the beginning of a stream.
Definition: jas_stream.c:885
jas_stream_memopen2
jas_stream_t * jas_stream_memopen2(char *buf, size_t bufsize)
Definition: jas_stream.c:189
jas_image_copy
jas_image_t * jas_image_copy(jas_image_t *image)
Clone an image.
Definition: jas_image.c:224
jas_image_sampcmpt
int jas_image_sampcmpt(jas_image_t *image, unsigned cmptno, unsigned newcmptno, jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, jas_image_coord_t vs, int sgnd, unsigned prec)
???
Definition: jas_image.c:1211
jas_image_writecmpt
int jas_image_writecmpt(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const jas_matrix_t *data)
Write a rectangular region of an image component.
Definition: jas_image.c:570
jas_stream_memopen
jas_stream_t * jas_stream_memopen(char *buf, int bufsize)
Open a memory buffer as a stream.
Definition: jas_stream.c:276
jas_image_fmttostr
const char * jas_image_fmttostr(int fmt)
Get the name of the image format with the specified ID.
Definition: jas_image.c:744
jas_image_setclrspc
#define jas_image_setclrspc(image, clrspc)
Set the color model for an image.
Definition: jas_image.h:398
jas_stream_getc
#define jas_stream_getc(stream)
jas_stream_getc Read a character from a stream.
Definition: jas_stream.h:540
jas_seq.h
Sequence/Matrix Library.
jas_debug.h
JasPer Debugging-Related Functionality.
jas_image_cmptwidth
#define jas_image_cmptwidth(image, cmptno)
Get the width of a component.
Definition: jas_image.h:409
jas_image_rawsize
uint_fast32_t jas_image_rawsize(const jas_image_t *image)
Get the raw size of an image (i.e., the nominal size of the image without any compression.
Definition: jas_image.c:816
jas_image_addfmt
int jas_image_addfmt(int id, const char *name, const char *ext, const char *desc, const jas_image_fmtops_t *ops)
Add entry to table of image formats.
Definition: jas_image.c:687
jas_image_create
jas_image_t * jas_image_create(unsigned numcmpts, const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc)
Create an image.
Definition: jas_image.c:127
jas_image_fmtops_t
Image format-dependent operations.
Definition: jas_image.h:283
jas_image_cmpttype_t
int_fast32_t jas_image_cmpttype_t
Component type (e.g., color, opacity).
Definition: jas_image.h:145
jas_stream_seek
long jas_stream_seek(jas_stream_t *stream, long offset, int origin)
Set the current position within the stream.
Definition: jas_stream.c:891
jas_image_cmptsgnd
#define jas_image_cmptsgnd(image, cmptno)
Get the signedness of the sample data for a component.
Definition: jas_image.h:421
jas_types.h
Primitive Types.
jas_stream.h
I/O Stream Class.
jas_image_encode
int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt, const char *optstr)
Write an image to a stream in a specified format.
Definition: jas_image.c:454
jas_image_lookupfmtbyid
const jas_image_fmtinfo_t * jas_image_lookupfmtbyid(int id)
Lookup image format information by the format ID.
Definition: jas_image.c:876
jas_string.h
String Library.
jas_image_readcmpt2
int jas_image_readcmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, long *buf)
Read sample data in a component of an image.
Definition: jas_image.c:1142
jas_cm.h
JasPer Color Management.
jas_stream_write
unsigned jas_stream_write(jas_stream_t *stream, const void *buf, unsigned cnt)
Write characters from a buffer to a stream.
Definition: jas_stream.c:735
jas_image_clearfmts
void jas_image_clearfmts()
Clear the table of image formats.
Definition: jas_image.c:666
jas_image_decode
jas_image_t * jas_image_decode(jas_stream_t *in, int fmt, const char *optstr)
Create an image from a stream in some specified format.
Definition: jas_image.c:416
jas_stream_copy
int jas_stream_copy(jas_stream_t *out, jas_stream_t *in, int n)
Copy data from one stream to another.
Definition: jas_stream.c:1129
jas_image_clrspc
#define jas_image_clrspc(image)
Get the color model used by the image.
Definition: jas_image.h:392
jas_image_writecmpt2
int jas_image_writecmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const long *buf)
Write sample data in a component of an image.
Definition: jas_image.c:1177
jas_image_t
Image class.
Definition: jas_image.h:202
jas_math.h
Math-Related Code.
jas_image_writecmptsample
void jas_image_writecmptsample(jas_image_t *image, unsigned cmptno, unsigned x, unsigned y, int_fast32_t v)
Write a component sample for an image.
Definition: jas_image.c:1089
jas_image_fmtinfo_t
Image format information.
Definition: jas_image.h:299
jas_stream_tmpfile
jas_stream_t * jas_stream_tmpfile()
Open a temporary file as a stream.
Definition: jas_stream.c:490
jas_image_fmtfromname
int jas_image_fmtfromname(const char *name)
Guess the format of an image file based on its name.
Definition: jas_image.c:774
jas_image.h
JasPer Image Class.
jas_image_setcmprof
#define jas_image_setcmprof(image, cmprof)
Set the color management profile for an image.
Definition: jas_image.h:692
jas_image_getcmptbytype
int jas_image_getcmptbytype(const jas_image_t *image, jas_image_cmpttype_t ctype)
Get an image component by its type.
Definition: jas_image.c:1112
jas_image_cmptparm_t
Component parameters class.
Definition: jas_image.h:243
jas_image_cmpt_domains_same
bool jas_image_cmpt_domains_same(const jas_image_t *image)
Test if all components are specified at the same positions in space.
Definition: jas_image.c:799
jas_image_dump
void jas_image_dump(jas_image_t *image, FILE *out)
Dump the information for an image (for debugging).
Definition: jas_image.c:997