77 #include <jasper/jas_config.h>
103 #define JAS_IMAGE_KIBI (JAS_CAST(size_t, 1024))
104 #define JAS_IMAGE_MEBI (JAS_IMAGE_KIBI * JAS_IMAGE_KIBI)
107 #define JAS_IMAGE_INMEMTHRESH (256 * JAS_IMAGE_MEBI)
113 #define JAS_IMAGE_CT_UNKNOWN 0x10000
114 #define JAS_IMAGE_CT_COLOR(n) ((n) & 0x7fff)
115 #define JAS_IMAGE_CT_OPACITY 0x08000
117 #define JAS_IMAGE_CT_RGB_R 0
118 #define JAS_IMAGE_CT_RGB_G 1
119 #define JAS_IMAGE_CT_RGB_B 2
121 #define JAS_IMAGE_CT_YCBCR_Y 0
122 #define JAS_IMAGE_CT_YCBCR_CB 1
123 #define JAS_IMAGE_CT_YCBCR_CR 2
125 #define JAS_IMAGE_CT_GRAY_Y 0
135 #define JAS_IMAGE_COORD_MAX INT_FAST32_MAX
136 #define JAS_IMAGE_COORD_MIN INT_FAST32_MIN
293 #define JAS_IMAGE_MAXFMTS 32
374 #define jas_image_width(image) \
375 ((image)->brx_ - (image)->tlx_)
380 #define jas_image_height(image) \
381 ((image)->bry_ - (image)->tly_)
387 #define jas_image_tlx(image) \
394 #define jas_image_tly(image) \
401 #define jas_image_brx(image) \
408 #define jas_image_bry(image) \
414 #define jas_image_numcmpts(image) \
420 #define jas_image_clrspc(image) \
426 #define jas_image_setclrspc(image, clrspc) \
427 ((image)->clrspc_ = (clrspc))
429 #define jas_image_cmpttype(image, cmptno) \
430 ((image)->cmpts_[(cmptno)]->type_)
431 #define jas_image_setcmpttype(image, cmptno, type) \
432 ((image)->cmpts_[(cmptno)]->type_ = (type))
437 #define jas_image_cmptwidth(image, cmptno) \
438 ((image)->cmpts_[cmptno]->width_)
443 #define jas_image_cmptheight(image, cmptno) \
444 ((image)->cmpts_[cmptno]->height_)
449 #define jas_image_cmptsgnd(image, cmptno) \
450 ((image)->cmpts_[cmptno]->sgnd_)
455 #define jas_image_cmptprec(image, cmptno) \
456 ((image)->cmpts_[cmptno]->prec_)
461 #define jas_image_cmpthstep(image, cmptno) \
462 ((image)->cmpts_[cmptno]->hstep_)
467 #define jas_image_cmptvstep(image, cmptno) \
468 ((image)->cmpts_[cmptno]->vstep_)
473 #define jas_image_cmpttlx(image, cmptno) \
474 ((image)->cmpts_[cmptno]->tlx_)
479 #define jas_image_cmpttly(image, cmptno) \
480 ((image)->cmpts_[cmptno]->tly_)
486 #define jas_image_cmptbrx(image, cmptno) \
487 ((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
488 (image)->cmpts_[cmptno]->hstep_)
494 #define jas_image_cmptbry(image, cmptno) \
495 ((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
496 (image)->cmpts_[cmptno]->vstep_)
567 static inline bool JAS_IMAGE_CDT_GETSGND(uint_least8_t dtype)
569 return (dtype >> 7) & 1;
573 static inline uint_least8_t JAS_IMAGE_CDT_SETSGND(
bool sgnd)
575 return (uint_least8_t)sgnd << 7;
579 static inline uint_least8_t JAS_IMAGE_CDT_GETPREC(uint_least8_t dtype)
585 static inline uint_least8_t JAS_IMAGE_CDT_SETPREC(uint_least8_t dtype)
591 static inline uint_least8_t jas_image_cmptdtype(
const jas_image_t *image,
594 return JAS_IMAGE_CDT_SETSGND(image->cmpts_[cmptno]->sgnd_) |
595 JAS_IMAGE_CDT_SETPREC(image->cmpts_[cmptno]->prec_);
603 unsigned numlutents,
const int_fast32_t *lutents,
unsigned dtype,
618 unsigned x,
unsigned y, int_fast32_t v);
637 #if defined(JAS_FOR_INTERNAL_USE_ONLY)
639 size_t *image_numfmts);
656 int jas_image_delfmtbyid(
int id);
672 int jas_image_getfmtindbyname(
const char* name);
682 #if defined(JAS_FOR_INTERNAL_USE_ONLY)
684 size_t *image_numfmts,
int id,
const char *name,
const char *ext,
736 #define jas_image_cmprof(image) ((image)->cmprof_)
773 #define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof)
792 #if defined(JAS_INCLUDE_JPG_CODEC)
802 #if defined(JAS_INCLUDE_HEIC_CODEC)
812 #if defined(JAS_INCLUDE_MIF_CODEC)
822 #if defined(JAS_INCLUDE_PNM_CODEC)
832 #if defined(JAS_INCLUDE_RAS_CODEC)
842 #if defined(JAS_INCLUDE_BMP_CODEC)
852 #if defined(JAS_INCLUDE_JP2_CODEC)
862 #if defined(JAS_INCLUDE_JPC_CODEC)
872 #if defined(JAS_INCLUDE_PGX_CODEC)
unsigned jas_clrspc_t
Color space.
Definition: jas_cm.h:97
jas_cmxform_intent_t
Rendering intents.
Definition: jas_cm.h:114
JAS_EXPORT 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:1081
JAS_EXPORT 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:1134
JAS_ATTRIBUTE_CONST JAS_EXPORT const char * jas_image_fmttostr(int fmt)
Get the name of the image format with the specified ID.
Definition: jas_image.c:844
JAS_EXPORT 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:485
JAS_EXPORT void jas_image_destroy(jas_image_t *image)
Deallocate any resources associated with an image.
Definition: jas_image.c:304
int_fast32_t jas_image_coord_t
Image coordinate.
Definition: jas_image.h:134
JAS_EXPORT void jas_image_delcmpt(jas_image_t *image, unsigned cmptno)
Delete a component from an image.
Definition: jas_image.c:932
JAS_EXPORT 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:1576
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_strtofmt(const char *s)
Get the ID for the image format with the specified name.
Definition: jas_image.c:835
JAS_EXPORT 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:947
JAS_EXPORT 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:1177
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_getfmt(jas_stream_t *in)
Get the format of image data in a stream.
Definition: jas_image.c:853
JAS_EXPORT int jas_image_dump(jas_image_t *image, FILE *out)
Dump the information for an image (for debugging).
Definition: jas_image.c:1104
JAS_ATTRIBUTE_PURE JAS_EXPORT 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:918
JAS_EXPORT 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:1199
JAS_EXPORT 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:806
JAS_ATTRIBUTE_PURE JAS_EXPORT 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:1222
JAS_ATTRIBUTE_PURE JAS_EXPORT 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:901
JAS_EXPORT jas_image_t * jas_image_create0(void)
Create an "empty" image.
Definition: jas_image.c:201
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_fmtfromname(const char *filename)
Guess the format of an image file based on its name.
Definition: jas_image.c:875
JAS_EXPORT 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:469
JAS_EXPORT const jas_image_fmtinfo_t * jas_image_getfmtbyind(int index)
Get a image format entry by its table index.
Definition: jas_image.c:722
JAS_EXPORT 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:126
int_fast32_t jas_image_cmpttype_t
Component type (e.g., color, opacity).
Definition: jas_image.h:146
JAS_EXPORT jas_image_t * jas_image_copy(jas_image_t *image)
Clone an image.
Definition: jas_image.c:223
JAS_EXPORT 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:1315
JAS_EXPORT void jas_image_clearfmts(void)
Clear the table of image formats.
Definition: jas_image.c:755
JAS_EXPORT 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:588
int_fast16_t jas_image_smpltype_t
Component sample data format (e.g., real/integer, signedness, precision).
Definition: jas_image.h:152
JAS_EXPORT 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:1238
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_image_fmtinfo_t * jas_image_lookupfmtbyname(const char *name)
Lookup image format information by the format name.
Definition: jas_image.c:993
JAS_EXPORT 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:420
JAS_EXPORT int jas_image_getnumfmts(void)
Get the number of image format table entries.
Definition: jas_image.c:730
int_fast16_t jas_image_colorspc_t
Color space (e.g., RGB, YCbCr).
Definition: jas_image.h:141
JAS_EXPORT 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:1277
JAS_ATTRIBUTE_CONST JAS_EXPORT const jas_image_fmtinfo_t * jas_image_lookupfmtbyid(int id)
Lookup image format information by the format ID.
Definition: jas_image.c:978
JAS_EXPORT int jas_image_setfmtenable(int index, int enabled)
Get the number of image format table entries.
Definition: jas_image.c:737
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_ishomosamp(const jas_image_t *image)
Test if the sampling of the image is homogeneous.
Definition: jas_image.c:1418
Image component class.
Definition: jas_image.h:168
Component parameters class.
Definition: jas_image.h:258
Image format information.
Definition: jas_image.h:314
char * desc
Definition: jas_image.h:335
int id
Definition: jas_image.h:317
jas_image_fmtops_t ops
Definition: jas_image.h:338
char * name
Definition: jas_image.h:320
char ** exts
Definition: jas_image.h:327
int enabled
Definition: jas_image.h:332
Image format-dependent operations.
Definition: jas_image.h:298
Image class.
Definition: jas_image.h:215
Matrix type.
Definition: jas_seq.h:117
I/O stream object.
Definition: jas_stream.h:206