71#include <jasper/jas_config.h>
79typedef unsigned jas_clrspc_t;
83 JAS_CMXFORM_OP_FWD = 0,
84 JAS_CMXFORM_OP_REV = 1,
85 JAS_CMXFORM_OP_PROOF = 2,
86 JAS_CMXFORM_OP_GAMUT = 3,
91 JAS_CMXFORM_INTENT_PER = 0,
92 JAS_CMXFORM_INTENT_RELCLR = 1,
93 JAS_CMXFORM_INTENT_ABSCLR = 2,
94 JAS_CMXFORM_INTENT_SAT = 3,
95} jas_cmxform_intent_t;
97#define JAS_CMXFORM_NUMINTENTS 4
100 JAS_CMXFORM_OPTM_SPEED = 0,
101 JAS_CMXFORM_OPTM_SIZE = 1,
102 JAS_CMXFORM_OPTM_ACC = 2,
106#define jas_clrspc_create(fam, mbr) (((fam) << 8) | (mbr))
107#define jas_clrspc_fam(clrspc) ((clrspc) >> 8)
108#define jas_clrspc_mbr(clrspc) ((clrspc) & 0xff)
109#define jas_clrspc_isgeneric(clrspc) (!jas_clrspc_mbr(clrspc))
110#define jas_clrspc_isunknown(clrspc) ((clrspc) & JAS_CLRSPC_UNKNOWNMASK)
112#define JAS_CLRSPC_UNKNOWNMASK 0x4000
115#define JAS_CLRSPC_FAM_UNKNOWN 0
116#define JAS_CLRSPC_FAM_XYZ 1
117#define JAS_CLRSPC_FAM_LAB 2
118#define JAS_CLRSPC_FAM_GRAY 3
119#define JAS_CLRSPC_FAM_RGB 4
120#define JAS_CLRSPC_FAM_YCBCR 5
123#define JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK
124#define JAS_CLRSPC_CIEXYZ jas_clrspc_create(JAS_CLRSPC_FAM_XYZ, 1)
125#define JAS_CLRSPC_CIELAB jas_clrspc_create(JAS_CLRSPC_FAM_LAB, 1)
126#define JAS_CLRSPC_SGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 1)
127#define JAS_CLRSPC_SRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 1)
128#define JAS_CLRSPC_SYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 1)
131#define JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0)
132#define JAS_CLRSPC_GENGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 0)
133#define JAS_CLRSPC_GENYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 0)
135#define JAS_CLRSPC_CHANIND_YCBCR_Y 0
136#define JAS_CLRSPC_CHANIND_YCBCR_CB 1
137#define JAS_CLRSPC_CHANIND_YCBCR_CR 2
139#define JAS_CLRSPC_CHANIND_RGB_R 0
140#define JAS_CLRSPC_CHANIND_RGB_G 1
141#define JAS_CLRSPC_CHANIND_RGB_B 2
143#define JAS_CLRSPC_CHANIND_GRAY_Y 0
145typedef double jas_cmreal_t;
147struct jas_cmpxform_s;
159 jas_cmcmptfmt_t *cmptfmts;
163 void (*destroy)(
struct jas_cmpxform_s *pxform);
164 int (*apply)(
const struct jas_cmpxform_s *pxform,
const jas_cmreal_t *in, jas_cmreal_t *out,
unsigned cnt);
165 void (*dump)(
struct jas_cmpxform_s *pxform);
178 jas_cmshapmatlut_t luts[3];
179 jas_cmreal_t mat[3][4];
191#define jas_align_t double
193typedef struct jas_cmpxform_s {
195 const jas_cmpxformops_t *ops;
197 unsigned numoutchans;
200 jas_cmshapmat_t shapmat;
201 jas_cmshaplut_t shaplut;
202 jas_cmclrspcconv_t clrspcconv;
209 jas_cmpxform_t **pxforms;
214 unsigned numoutchans;
215 jas_cmpxformseq_t *pxformseq;
218#define JAS_CMPROF_TYPE_DEV 1
219#define JAS_CMPROF_TYPE_CLRSPC 2
221#define JAS_CMPROF_NUMPXFORMSEQS 13
227 unsigned numrefchans;
228 jas_iccprof_t *iccprof;
229 jas_cmpxformseq_t *pxformseqs[JAS_CMPROF_NUMPXFORMSEQS];
233typedef int_fast32_t jas_cmattrname_t;
234typedef int_fast32_t jas_cmattrval_t;
235typedef int_fast32_t jas_cmattrtype_t;
237int jas_cmprof_load(jas_cmprof_t *prof, jas_stream_t *in,
unsigned fmt);
239int jas_cmprof_save(jas_cmprof_t *prof, jas_stream_t *out,
unsigned fmt);
241int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name,
void *val);
243void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name);
246JAS_DLLEXPORT jas_cmxform_t *jas_cmxform_create(
const jas_cmprof_t *inprof,
const jas_cmprof_t *outprof,
247 const jas_cmprof_t *proofprof, jas_cmxform_op_t op, jas_cmxform_intent_t intent, jas_cmxform_optm_t optimize);
249JAS_DLLEXPORT
void jas_cmxform_destroy(jas_cmxform_t *xform);
252JAS_DLLEXPORT
int jas_cmxform_apply(
const jas_cmxform_t *xform,
const jas_cmpixmap_t *in,
253 jas_cmpixmap_t *out);
256JAS_DLLEXPORT jas_cmprof_t *jas_cmprof_createfromiccprof(
const jas_iccprof_t *iccprof);
257JAS_DLLEXPORT jas_cmprof_t *jas_cmprof_createfromclrspc(jas_clrspc_t clrspc);
260JAS_DLLEXPORT
void jas_cmprof_destroy(jas_cmprof_t *prof);
262unsigned jas_clrspc_numchans(jas_clrspc_t clrspc);
263JAS_DLLEXPORT jas_iccprof_t *jas_iccprof_createfromcmprof(
const jas_cmprof_t *prof);
265#define jas_cmprof_clrspc(prof) ((prof)->clrspc)
266JAS_DLLEXPORT jas_cmprof_t *jas_cmprof_copy(
const jas_cmprof_t *prof);