72 #include <jasper/jas_config.h>
74 #include <jasper/jas_icc.h>
80 typedef int jas_clrspc_t;
83 #define JAS_CMXFORM_OP_FWD 0
84 #define JAS_CMXFORM_OP_REV 1
85 #define JAS_CMXFORM_OP_PROOF 2
86 #define JAS_CMXFORM_OP_GAMUT 3
89 #define JAS_CMXFORM_INTENT_PER 0
90 #define JAS_CMXFORM_INTENT_RELCLR 1
91 #define JAS_CMXFORM_INTENT_ABSCLR 2
92 #define JAS_CMXFORM_INTENT_SAT 3
93 #define JAS_CMXFORM_NUMINTENTS 4
95 #define JAS_CMXFORM_OPTM_SPEED 0
96 #define JAS_CMXFORM_OPTM_SIZE 1
97 #define JAS_CMXFORM_OPTM_ACC 2
100 #define jas_clrspc_create(fam, mbr) (((fam) << 8) | (mbr))
101 #define jas_clrspc_fam(clrspc) ((clrspc) >> 8)
102 #define jas_clrspc_mbr(clrspc) ((clrspc) & 0xff)
103 #define jas_clrspc_isgeneric(clrspc) (!jas_clrspc_mbr(clrspc))
104 #define jas_clrspc_isunknown(clrspc) ((clrspc) & JAS_CLRSPC_UNKNOWNMASK)
106 #define JAS_CLRSPC_UNKNOWNMASK 0x4000
109 #define JAS_CLRSPC_FAM_UNKNOWN 0
110 #define JAS_CLRSPC_FAM_XYZ 1
111 #define JAS_CLRSPC_FAM_LAB 2
112 #define JAS_CLRSPC_FAM_GRAY 3
113 #define JAS_CLRSPC_FAM_RGB 4
114 #define JAS_CLRSPC_FAM_YCBCR 5
117 #define JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK
118 #define JAS_CLRSPC_CIEXYZ jas_clrspc_create(JAS_CLRSPC_FAM_XYZ, 1)
119 #define JAS_CLRSPC_CIELAB jas_clrspc_create(JAS_CLRSPC_FAM_LAB, 1)
120 #define JAS_CLRSPC_SGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 1)
121 #define JAS_CLRSPC_SRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 1)
122 #define JAS_CLRSPC_SYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 1)
125 #define JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0)
126 #define JAS_CLRSPC_GENGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 0)
127 #define JAS_CLRSPC_GENYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 0)
129 #define JAS_CLRSPC_CHANIND_YCBCR_Y 0
130 #define JAS_CLRSPC_CHANIND_YCBCR_CB 1
131 #define JAS_CLRSPC_CHANIND_YCBCR_CR 2
133 #define JAS_CLRSPC_CHANIND_RGB_R 0
134 #define JAS_CLRSPC_CHANIND_RGB_G 1
135 #define JAS_CLRSPC_CHANIND_RGB_B 2
137 #define JAS_CLRSPC_CHANIND_GRAY_Y 0
139 typedef double jas_cmreal_t;
141 struct jas_cmpxform_s;
153 jas_cmcmptfmt_t *cmptfmts;
157 void (*destroy)(
struct jas_cmpxform_s *pxform);
158 int (*apply)(
struct jas_cmpxform_s *pxform, jas_cmreal_t *in, jas_cmreal_t *out,
int cnt);
159 void (*dump)(
struct jas_cmpxform_s *pxform);
165 } jas_cmshapmatlut_t;
172 jas_cmshapmatlut_t luts[3];
173 jas_cmreal_t mat[3][4];
183 } jas_cmclrspcconv_t;
185 #define jas_align_t double
187 typedef struct jas_cmpxform_s {
189 jas_cmpxformops_t *ops;
194 jas_cmshapmat_t shapmat;
195 jas_cmshaplut_t shaplut;
196 jas_cmclrspcconv_t clrspcconv;
203 jas_cmpxform_t **pxforms;
209 jas_cmpxformseq_t *pxformseq;
212 #define JAS_CMPROF_TYPE_DEV 1
213 #define JAS_CMPROF_TYPE_CLRSPC 2
215 #define JAS_CMPROF_NUMPXFORMSEQS 13
222 jas_iccprof_t *iccprof;
223 jas_cmpxformseq_t *pxformseqs[JAS_CMPROF_NUMPXFORMSEQS];
227 typedef int_fast32_t jas_cmattrname_t;
228 typedef int_fast32_t jas_cmattrval_t;
229 typedef int_fast32_t jas_cmattrtype_t;
231 int jas_cmprof_load(jas_cmprof_t *prof, jas_stream_t *in,
int fmt);
233 int jas_cmprof_save(jas_cmprof_t *prof, jas_stream_t *out,
int fmt);
235 int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name,
void *val);
237 void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name);
240 jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof,
241 jas_cmprof_t *proofprof,
int op,
int intent,
int optimize);
243 void jas_cmxform_destroy(jas_cmxform_t *xform);
246 int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in,
247 jas_cmpixmap_t *out);
249 int jas_cxform_optimize(jas_cmxform_t *xform,
int optimize);
252 JAS_DLLEXPORT jas_cmprof_t *jas_cmprof_createfromiccprof(jas_iccprof_t *iccprof);
253 JAS_DLLEXPORT jas_cmprof_t *jas_cmprof_createfromclrspc(
int clrspc);
256 JAS_DLLEXPORT
void jas_cmprof_destroy(jas_cmprof_t *prof);
258 int jas_clrspc_numchans(
int clrspc);
259 jas_iccprof_t *jas_iccprof_createfromcmprof(jas_cmprof_t *prof);
261 #define jas_cmprof_clrspc(prof) ((prof)->clrspc)
262 JAS_DLLEXPORT jas_cmprof_t *jas_cmprof_copy(jas_cmprof_t *prof);