*
* JasPer License Version 2.0
*
+ * Copyright (c) 2001-2006 Michael David Adams
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
- * Copyright (c) 2001-2003 Michael David Adams
*
* All rights reserved.
*
/*
* Color Management
*
- * $Id: jas_cm.c,v 1.1 2007/01/15 16:09:23 vp153 Exp $
+ * $Id: jas_cm.c,v 1.2 2008/05/26 09:40:52 vp153 Exp $
*/
#include <jasper/jas_config.h>
goto error;
if (!(prof = jas_cmprof_createfromiccprof(iccprof)))
goto error;
-#if 0
jas_iccprof_destroy(iccprof);
-#else
- prof->iccprof = iccprof;
-#endif
+ iccprof = 0;
if (!jas_clrspc_isgeneric(clrspc))
prof->clrspc = clrspc;
break;
jas_cmpxformseq_t *fwdpxformseq;
jas_cmpxformseq_t *revpxformseq;
+ prof = 0;
+ fwdpxformseq = 0;
+ revpxformseq = 0;
+
if (!(prof = jas_cmprof_create()))
goto error;
jas_iccprof_gethdr(iccprof, &icchdr);
#endif
return prof;
+
error:
+ if (fwdpxformseq) {
+ jas_cmpxformseq_destroy(fwdpxformseq);
+ }
+ if (revpxformseq) {
+ jas_cmpxformseq_destroy(revpxformseq);
+ }
+ if (prof) {
+ jas_cmprof_destroy(prof);
+ }
+
return 0;
}
}
#if 0
for (i=0;i<lut->size;++i)
- fprintf(stderr, "lut[%d]=%f ", i, lut->data[i]);
+ jas_eprintf("lut[%d]=%f ", i, lut->data[i]);
for (i=0;i<invlut->size;++i)
- fprintf(stderr, "invlut[%d]=%f ", i, invlut->data[i]);
+ jas_eprintf("invlut[%d]=%f ", i, invlut->data[i]);
#endif
return 0;
}
- in[0][1] * (in[1][0] * in[2][2] - in[1][2] * in[2][0])
+ in[0][2] * (in[1][0] * in[2][1] - in[1][1] * in[2][0]);
#if 0
-fprintf(stderr, "delta=%f\n", d);
+jas_eprintf("delta=%f\n", d);
#endif
if (JAS_ABS(d) < 1e-6)
return -1;
out[1][3] = -in[1][3];
out[2][3] = -in[2][3];
#if 0
-fprintf(stderr, "[ %f %f %f %f ]\n[ %f %f %f %f ]\n[ %f %f %f %f ]\n",
+jas_eprintf("[ %f %f %f %f ]\n[ %f %f %f %f ]\n[ %f %f %f %f ]\n",
in[0][0], in[0][1], in[0][2], in[0][3],
in[1][0], in[1][1], in[1][2], in[1][3],
in[2][0], in[2][1], in[2][2], in[2][3]);
-fprintf(stderr, "[ %f %f %f %f ]\n[ %f %f %f %f ]\n[ %f %f %f %f ]\n",
+jas_eprintf("[ %f %f %f %f ]\n[ %f %f %f %f ]\n[ %f %f %f %f ]\n",
out[0][0], out[0][1], out[0][2], out[0][3],
out[1][0], out[1][1], out[1][2], out[1][3],
out[2][0], out[2][1], out[2][2], out[2][3]);
jas_cmpxformseq_t *pxformseq;
jas_cmreal_t mat[3][4];
jas_cmshapmatlut_t lut;
- jas_cmshapmatlut_init(&lut);
+
+ pxform = 0;
+ pxformseq = 0;
for (i = 0; i < 3; ++i) {
trcs[i] = 0;
cols[i] = 0;
}
+ jas_cmshapmatlut_init(&lut);
+
if (!(trcs[0] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_REDTRC)) ||
!(trcs[1] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_GRNTRC)) ||
!(trcs[2] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_BLUTRC)) ||
jas_cmpxform_destroy(pxform);
*retpxformseq = pxformseq;
return 0;
+
error:
+
+ for (i = 0; i < 3; ++i) {
+ if (trcs[i]) {
+ jas_iccattrval_destroy(trcs[i]);
+ }
+ if (cols[i]) {
+ jas_iccattrval_destroy(cols[i]);
+ }
+ }
+ if (pxformseq) {
+ jas_cmpxformseq_destroy(pxformseq);
+ }
+ if (pxform) {
+ jas_cmpxform_destroy(pxform);
+ }
+
return -1;
}