Go to the documentation of this file.
75 #include <jasper/jas_config.h>
104 JAS_CMXFORM_OP_FWD = 0,
105 JAS_CMXFORM_OP_REV = 1,
106 JAS_CMXFORM_OP_PROOF = 2,
107 JAS_CMXFORM_OP_GAMUT = 3,
115 JAS_CMXFORM_INTENT_PER = 0,
116 JAS_CMXFORM_INTENT_RELCLR = 1,
117 JAS_CMXFORM_INTENT_ABSCLR = 2,
118 JAS_CMXFORM_INTENT_SAT = 3,
125 #define JAS_CMXFORM_NUMINTENTS 4
132 JAS_CMXFORM_OPTM_SPEED = 0,
133 JAS_CMXFORM_OPTM_SIZE = 1,
134 JAS_CMXFORM_OPTM_ACC = 2,
141 #define jas_clrspc_create(fam, mbr) (((fam) << 8) | (mbr))
148 #define jas_clrspc_fam(clrspc) ((clrspc) >> 8)
154 #define jas_clrspc_mbr(clrspc) ((clrspc) & 0xff)
160 #define jas_clrspc_isgeneric(clrspc) (!jas_clrspc_mbr(clrspc))
166 #define jas_clrspc_isunknown(clrspc) ((clrspc) & JAS_CLRSPC_UNKNOWNMASK)
168 #define JAS_CLRSPC_UNKNOWNMASK 0x4000
173 #define JAS_CLRSPC_FAM_UNKNOWN 0
174 #define JAS_CLRSPC_FAM_XYZ 1
175 #define JAS_CLRSPC_FAM_LAB 2
176 #define JAS_CLRSPC_FAM_GRAY 3
177 #define JAS_CLRSPC_FAM_RGB 4
178 #define JAS_CLRSPC_FAM_YCBCR 5
183 #define JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK
184 #define JAS_CLRSPC_CIEXYZ jas_clrspc_create(JAS_CLRSPC_FAM_XYZ, 1)
185 #define JAS_CLRSPC_CIELAB jas_clrspc_create(JAS_CLRSPC_FAM_LAB, 1)
186 #define JAS_CLRSPC_SGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 1)
187 #define JAS_CLRSPC_SRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 1)
188 #define JAS_CLRSPC_SYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 1)
193 #define JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0)
194 #define JAS_CLRSPC_GENGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 0)
195 #define JAS_CLRSPC_GENYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 0)
197 #define JAS_CLRSPC_CHANIND_YCBCR_Y 0
198 #define JAS_CLRSPC_CHANIND_YCBCR_CB 1
199 #define JAS_CLRSPC_CHANIND_YCBCR_CR 2
201 #define JAS_CLRSPC_CHANIND_RGB_R 0
202 #define JAS_CLRSPC_CHANIND_RGB_G 1
203 #define JAS_CLRSPC_CHANIND_RGB_B 2
205 #define JAS_CLRSPC_CHANIND_GRAY_Y 0
292 unsigned numoutchans;
317 unsigned numoutchans;
321 #define JAS_CMPROF_TYPE_DEV 1
322 #define JAS_CMPROF_TYPE_CLRSPC 2
324 #define JAS_CMPROF_NUMPXFORMSEQS 13
333 unsigned numrefchans;
334 jas_iccprof_t *iccprof;
343 typedef int_fast32_t jas_cmattrname_t;
344 typedef int_fast32_t jas_cmattrval_t;
345 typedef int_fast32_t jas_cmattrtype_t;
351 int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name,
void *val);
353 void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name);
489 #define jas_cmprof_clrspc(prof) ((prof)->clrspc)
JasPer Initialization/Cleanup Code.
Tag-value parser type.
Definition: jas_tvp.h:108
const char * jas_tvparser_gettag(const jas_tvparser_t *tvp)
Get the tag name for the current tag-value pair.
Definition: jas_tvp.c:198
JAS_EXPORT void jas_conf_set_allocator(jas_allocator_t *allocator)
Set the memory allocator to be used by the library.
Definition: jas_init.c:425
jas_iccprof_t * jas_iccprof_copy(const jas_iccprof_t *prof)
Create a copy of an ICC profile.
Definition: jas_icc.c:291
JAS_EXPORT int jas_logwarnf(const char *fmt,...)
Generate a warning log message.
Definition: jas_debug.c:131
jas_cmxform_optm_t
Transform optimization.
Definition: jas_cm.h:131
#define JAS_OPT_HASARG
Definition: jas_getopt.h:94
jas_cmxform_op_t
Transform operations.
Definition: jas_cm.h:103
#define JAS_CMXFORM_NUMINTENTS
Number of rendering intents.
Definition: jas_cm.h:125
JAS_EXPORT void jas_cleanup()
Perform any clean up for the JasPer library.
Definition: jas_init.c:822
JAS_EXPORT void jas_std_allocator_init(jas_std_allocator_t *allocator)
Initialize a memory allocator that uses malloc and related functions for managing memory.
Definition: jas_malloc.c:262
jas_stream_t * jas_stream_fdopen(int fd, const char *mode)
Open a file descriptor as a stream.
Definition: jas_stream.c:521
JAS_EXPORT int jas_logerrorf(const char *fmt,...)
Generate an error log message.
Definition: jas_debug.c:119
void jas_iccprof_destroy(jas_iccprof_t *prof)
Destroy an ICC profile.
Definition: jas_icc.c:314
JAS_EXPORT void jas_conf_set_max_mem_usage(size_t max_mem)
Set the maximum amount of memory that can be used by the library (assuming the allocator wrapper is n...
Definition: jas_init.c:445
JAS_EXPORT void jas_conf_clear()
Configure the JasPer library with the default configuration settings.
Definition: jas_init.c:397
jas_cmprof_t * jas_cmprof_createfromclrspc(jas_clrspc_t clrspc)
Create a color-management profile from a color space.
Definition: jas_cm.c:169
int jas_stream_copy(jas_stream_t *out, jas_stream_t *in, ssize_t n)
Copy data from one stream to another.
Definition: jas_stream.c:1100
unsigned jas_clrspc_numchans(jas_clrspc_t clrspc)
Get the number of channels associated with a particular color space.
Definition: jas_cm.c:1388
static size_t jas_get_dec_default_max_samples(void)
Get the default maximum number of samples that a decoder is permitted to process.
Definition: jas_init.h:456
The standard library allocator (i.e., a wrapper for malloc and friends).
Definition: jas_malloc.h:143
int jas_image_strtofmt(const char *name)
Get the ID for the image format with the specified name.
Definition: jas_image.c:835
void * jas_realloc2(void *ptr, size_t num_elements, size_t element_size)
Resize a block of allocated memory (with overflow checking).
Definition: jas_malloc.c:231
Shaper matrix look-up table (LUT).
Definition: jas_cm.h:249
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 int jas_cleanup_library()
Perform clean up for the JasPer library.
Definition: jas_init.c:636
JAS_EXPORT int jas_cleanup_thread()
Perform per-thread cleanup for the JasPer library.
Definition: jas_init.c:757
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
Tag information type.
Definition: jas_tvp.h:94
JAS_EXPORT int jas_eprintf(const char *fmt,...)
Print formatted text for the standard error stream (i.e., stderr).
Definition: jas_debug.c:96
Shaper matrix.
Definition: jas_cm.h:258
size_t jas_get_total_mem_size()
Get the total amount of memory available on the system.
Definition: jas_malloc.c:627
int jas_cmxform_apply(const jas_cmxform_t *xform, const jas_cmpixmap_t *in, jas_cmpixmap_t *out)
Apply a transform to data.
Definition: jas_cm.c:540
Command line option type.
Definition: jas_getopt.h:104
I/O stream object.
Definition: jas_stream.h:206
int jas_tvparser_next(jas_tvparser_t *tvp)
Get the next tag-value pair.
Definition: jas_tvp.c:122
const jas_taginfo_t * jas_taginfos_lookup(const jas_taginfo_t *taginfos, const char *name)
Lookup a tag by name.
Definition: jas_tvp.c:214
void * jas_alloc2(size_t num_elements, size_t element_size)
Allocate array (with overflow checking).
Definition: jas_malloc.c:212
#define jas_clrspc_isgeneric(clrspc)
Test if a color space is generic.
Definition: jas_cm.h:160
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numcols(const jas_matrix_t *matrix)
Get the number of columns in a matrix.
Definition: jas_seq.h:196
void jas_set_max_mem_usage(size_t max_mem)
Set the maximum memory usage allowed by the allocator wrapper.
Definition: jas_malloc.c:355
jas_cmprof_t * jas_cmprof_copy(const jas_cmprof_t *prof)
Copy a color-management profile.
Definition: jas_cm.c:395
Component format.
Definition: jas_cm.h:218
JAS_EXPORT void jas_conf_set_debug_level(int debug_level)
Set the initial debug level for the library.
Definition: jas_init.c:439
jas_stream_t * jas_stream_memopen(char *buf, size_t bufsize)
Open a memory buffer as a stream.
Definition: jas_stream.c:203
JAS_EXPORT int jas_init()
Configure and initialize the JasPer library using the default configuration settings.
Definition: jas_init.c:807
struct jas_cmpxform_s jas_cmpxform_t
Transform class.
static JAS_ATTRIBUTE_PURE jas_matind_t jas_matrix_numrows(const jas_matrix_t *matrix)
Get the number of rows in a matrix.
Definition: jas_seq.h:187
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
const jas_taginfo_t * jas_taginfo_nonull(const jas_taginfo_t *taginfo)
Ensure a nonnull taginfo pointer.
Definition: jas_tvp.c:230
jas_matrix_t * jas_matrix_create(jas_matind_t numrows, jas_matind_t numcols)
Create a matrix with the specified dimensions.
Definition: jas_seq.c:102
jas_stream_t * jas_stream_fopen(const char *filename, const char *mode)
Open a file as a stream.
Definition: jas_stream.c:283
JAS_EXPORT void * jas_malloc(size_t size)
Allocate memory.
Definition: jas_malloc.c:136
size_t jas_stream_write(jas_stream_t *stream, const void *buf, size_t cnt)
Write characters from a buffer to a stream.
Definition: jas_stream.c:719
void jas_cmprof_destroy(jas_cmprof_t *prof)
Destroy a color-management profile.
Definition: jas_cm.c:381
#define jas_image_cmptwidth(image, cmptno)
Get the width of a component.
Definition: jas_image.h:437
Pixmap (i.e., multicomponent) format.
Definition: jas_cm.h:230
unsigned jas_stream_peek(jas_stream_t *stream, void *buf, size_t cnt)
Attempt to retrieve one or more pending characters of input from a stream into a buffer without actua...
Definition: jas_stream.c:703
const char * jas_image_fmttostr(int fmt)
Get the name of the image format with the specified ID.
Definition: jas_image.c:844
#define jas_image_setclrspc(image, clrspc)
Set the color model for an image.
Definition: jas_image.h:426
#define jas_image_width(image)
Get the width of the image in units of the image reference grid.
Definition: jas_image.h:374
JAS_EXPORT int jas_image_getnumfmts(void)
Get the number of image format table entries.
Definition: jas_image.c:730
jas_image_t * jas_image_create0()
Create an "empty" image.
Definition: jas_image.c:201
JasPer Debugging-Related Functionality.
JAS_EXPORT int jas_init_thread()
Perform per-thread initialization for the JasPer library.
Definition: jas_init.c:696
double jas_cmreal_t
Definition: jas_cm.h:210
#define jas_clrspc_fam(clrspc)
Get the family of a color space.
Definition: jas_cm.h:148
int jas_image_getfmt(jas_stream_t *in)
Get the format of image data in a stream.
Definition: jas_image.c:853
int jas_stream_close(jas_stream_t *stream)
Close a stream.
Definition: jas_stream.c:591
int jas_getopt(int argc, char **argv, const jas_opt_t *opts)
Get the next option.
Definition: jas_getopt.c:107
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
#define jas_image_numcmpts(image)
Get the number of image components.
Definition: jas_image.h:414
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 void jas_free(void *ptr)
Free memory.
Definition: jas_malloc.c:186
const JAS_EXPORT jas_image_fmtinfo_t * jas_image_getfmtbyind(int index)
Get a image format entry by its table index.
Definition: jas_image.c:722
#define JAS_CLRSPC_GENRGB
Generic color spaces.
Definition: jas_cm.h:193
int enabled
Definition: jas_image.h:332
jas_cmxform_intent_t
Rendering intents.
Definition: jas_cm.h:114
static JAS_ATTRIBUTE_PURE jas_seqent_t jas_matrix_get(const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j)
Get a matrix element.
Definition: jas_seq.h:226
#define JAS_UNUSED(x)
Indicate that a variable may be unused (in order to avoid a compiler warning).
Definition: jas_compiler.h:145
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
int jas_stream_flush(jas_stream_t *stream)
Flush any pending output to a stream.
Definition: jas_stream.c:973
jas_tvparser_t * jas_tvparser_create(const char *s)
Create a tag-value parser for the specified string.
Definition: jas_tvp.c:93
jas_iccprof_t * jas_iccprof_createfromcmprof(const jas_cmprof_t *prof)
Create a ICC profile from a CM profile.
Definition: jas_cm.c:1403
JAS_EXPORT int jas_init_library()
Initialize the JasPer library with the current configuration settings.
Definition: jas_init.c:475
void jas_image_clearfmts()
Clear the table of image formats.
Definition: jas_image.c:755
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:1175
Image class.
Definition: jas_image.h:215
jas_cmxform_t * jas_cmxform_create(const jas_cmprof_t *inprof, const jas_cmprof_t *outprof, const jas_cmprof_t *prfprof, jas_cmxform_op_t op, jas_cmxform_intent_t intent, jas_cmxform_optm_t optimize)
Create a transform from a CM profile.
Definition: jas_cm.c:425
void jas_image_destroy(jas_image_t *image)
Deallocate any resources associated with an image.
Definition: jas_image.c:304
#define jas_image_cmptprec(image, cmptno)
Get the precision of the sample data for a component.
Definition: jas_image.h:455
const char * jas_tvparser_getval(const jas_tvparser_t *tvp)
Get the value for the current tag-value pair.
Definition: jas_tvp.c:204
#define jas_image_height(image)
Get the height of the image in units of the image reference grid.
Definition: jas_image.h:380
const char * jas_optarg
The current option argument.
Definition: jas_getopt.c:89
Image format information.
Definition: jas_image.h:314
JAS_EXPORT int jas_image_setfmtenable(int index, int enabled)
Get the number of image format table entries.
Definition: jas_image.c:737
static void jas_matrix_set(jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j, jas_seqent_t v)
Set a matrix element.
Definition: jas_seq.h:236
unsigned jas_clrspc_t
Color space.
Definition: jas_cm.h:97
Color space conversion.
Definition: jas_cm.h:279
jas_iccprof_t * jas_iccprof_createfromclrspc(unsigned clrspc)
Create an ICC profile from a color space.
Definition: jas_icc.c:1882
void jas_matrix_destroy(jas_matrix_t *matrix)
Destroy a matrix.
Definition: jas_seq.c:162
jas_cmprof_t * jas_cmprof_createfromiccprof(const jas_iccprof_t *iccprof)
Create a color-management profile from an ICC profile.
Definition: jas_cm.c:287
Shaper look-up table (LUT).
Definition: jas_cm.h:271
int jas_iccprof_gethdr(const jas_iccprof_t *prof, jas_icchdr_t *hdr)
Get the header for an ICC profile.
Definition: jas_icc.c:665
Component parameters class.
Definition: jas_image.h:258
JAS_EXPORT int jas_setdbglevel(int dbglevel)
Set the library debug level.
Definition: jas_debug.c:83
Matrix type.
Definition: jas_seq.h:129
void jas_tvparser_destroy(jas_tvparser_t *tvp)
Destroy a tag-value parser.
Definition: jas_tvp.c:109
JAS_EXPORT void jas_conf_set_vlogmsgf(jas_vlogmsgf_t *func)
Set the function used by the library to output error, warning, and informational messages.
void jas_cmxform_destroy(jas_cmxform_t *xform)
Destroy a transform.
Definition: jas_cm.c:649
char * name
Definition: jas_image.h:320
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_iccattrval_t * jas_iccprof_getattr(const jas_iccprof_t *prof, jas_iccattrname_t name)
Get an attribute of an ICC profile.
Definition: jas_icc.c:623
void jas_iccattrval_destroy(jas_iccattrval_t *attrval)
Destroy an ICC profile attribute.
Definition: jas_icc.c:962
#define jas_image_cmptheight(image, cmptno)
Get the height of a component.
Definition: jas_image.h:443
JAS_EXPORT int jas_vlogmsgf_discard(jas_logtype_t type, const char *fmt, va_list ap)
Output a log message to nowhere (i.e., discard the message).
Definition: jas_debug.c:218