[gs-cvs] rev 9559 - branches/icc_work/base
mvrhel at ghostscript.com
mvrhel at ghostscript.com
Sun Mar 15 20:35:32 PDT 2009
Author: mvrhel
Date: 2009-03-15 20:35:32 -0700 (Sun, 15 Mar 2009)
New Revision: 9559
Modified:
branches/icc_work/base/gsicc_littlecms.c
branches/icc_work/base/gsiccmanage.c
branches/icc_work/base/gsiccmanage.h
Log:
Addition of code to use softproofing in littleCMS and to detect presence of it in the cached links.
Modified: branches/icc_work/base/gsicc_littlecms.c
===================================================================
--- branches/icc_work/base/gsicc_littlecms.c 2009-03-15 22:42:53 UTC (rev 9558)
+++ branches/icc_work/base/gsicc_littlecms.c 2009-03-16 03:35:32 UTC (rev 9559)
@@ -30,7 +30,17 @@
{
+
+
+
+
+
+
+
+
+
+
}
/* Transform a single color.
@@ -60,7 +70,7 @@
gsicc_rendering_param_t *rendering_params)
{
- cmsHPROFILE lcms_srchandle, lscms_deshandle;
+ cmsHPROFILE lcms_srchandle, lcms_deshandle;
cmsHTRANSFORM lcms_link;
DWORD src_data_type,des_data_type;
icColorSpaceSignature src_color_space,des_color_space;
@@ -75,12 +85,12 @@
streams. */
lcms_srchandle = cmsOpenProfileFromMem(input_buf,input_size);
- lscms_deshandle = cmsOpenProfileFromMem(output_buf,output_size);
+ lcms_deshandle = cmsOpenProfileFromMem(output_buf,output_size);
/* Get the data types */
src_color_space = cmsGetColorSpace(lcms_srchandle);
- des_color_space = cmsGetColorSpace(lscms_deshandle);
+ des_color_space = cmsGetColorSpace(lcms_deshandle);
src_nChannels = _cmsChannelsOf(src_color_space);
des_nChannels = _cmsChannelsOf(des_color_space);
@@ -92,16 +102,78 @@
/* TODO: Make intent variable */
- lcms_link = cmsCreateTransform(lcms_srchandle, src_data_type, lscms_deshandle, des_data_type, INTENT_PERCEPTUAL, cmsFLAGS_LOWRESPRECALC);
+ lcms_link = cmsCreateTransform(lcms_srchandle, src_data_type, lcms_deshandle, des_data_type,
+ INTENT_PERCEPTUAL, cmsFLAGS_LOWRESPRECALC);
/* Close the profile handles. We need to think about if we want to cache these. */
cmsCloseProfile(lcms_srchandle);
- cmsCloseProfile(lscms_deshandle);
+ cmsCloseProfile(lcms_deshandle);
return(0);
}
+
+
+/* Get the link from the CMS, but include proofing.
+ We need to note
+ that as an option in the rendering params. If we are doing
+ transparency, that would only occur at the top of the stack
+TODO: Add error checking */
+
+int
+gscms_get_link_proof(gsicc_link_t *icclink, gsicc_colorspace_t *input_colorspace,
+ gsicc_colorspace_t *output_colorspace, gsicc_colorspace_t *proof_colorspace,
+ gsicc_rendering_param_t *rendering_params)
+{
+
+ cmsHPROFILE lcms_srchandle, lcms_deshandle, lcms_proofhandle;
+ cmsHTRANSFORM lcms_link;
+ DWORD src_data_type,des_data_type;
+ icColorSpaceSignature src_color_space,des_color_space;
+ int src_nChannels,des_nChannels;
+ void* input_buf = input_colorspace->ProfileData->ProfileRawBuf;
+ void* output_buf = output_colorspace->ProfileData->ProfileRawBuf;
+ void* proof_buf = proof_colorspace->ProfileData->ProfileRawBuf;
+ int input_size = input_colorspace->ProfileData->iccheader.size;
+ int output_size = output_colorspace->ProfileData->iccheader.size;
+ int proof_size = proof_colorspace->ProfileData->iccheader.size;
+
+/* At this stage we have the ICC profiles as buffers.
+ we may later change some of this to deal with
+ streams. */
+
+ lcms_srchandle = cmsOpenProfileFromMem(input_buf,input_size);
+ lcms_deshandle = cmsOpenProfileFromMem(output_buf,output_size);
+ lcms_proofhandle = cmsOpenProfileFromMem(proof_buf,proof_size);
+
+
+/* Get the data types */
+
+ src_color_space = cmsGetColorSpace(lcms_srchandle);
+ des_color_space = cmsGetColorSpace(lcms_deshandle);
+
+ src_nChannels = _cmsChannelsOf(src_color_space);
+ des_nChannels = _cmsChannelsOf(des_color_space);
+
+ src_data_type= (CHANNELS_SH(src_nChannels)|BYTES_SH(rendering_params->input_subpixbytesize));
+ des_data_type= (CHANNELS_SH(des_nChannels)|BYTES_SH(rendering_params->output_subpixbytesize));
+
+/* Create the link. Note the gamut check alarm */
+
+ lcms_link = cmsCreateProofingTransform(lcms_srchandle, src_data_type, lcms_deshandle, des_data_type,
+ lcms_proofhandle,INTENT_PERCEPTUAL, INTENT_ABSOLUTE_COLORIMETRIC, cmsFLAGS_GAMUTCHECK | cmsFLAGS_SOFTPROOFING );
+
+/* Close the profile handles. We need to think about if we want to cache these. */
+
+ cmsCloseProfile(lcms_srchandle);
+ cmsCloseProfile(lcms_deshandle);
+ cmsCloseProfile(lcms_proofhandle);
+
+return(0);
+}
+
+
/* Get the CIELAB value and if present the device value
for the device name. Supply the named color profile.
Note that this need not be an ICC named color profile
@@ -133,6 +205,8 @@
gscms_release_link(gsicc_link_t *icclink)
{
+ if (icclink->LinkHandle !=NULL )
+ cmsDeleteTransform(icclink->LinkHandle);
}
Modified: branches/icc_work/base/gsiccmanage.c
===================================================================
--- branches/icc_work/base/gsiccmanage.c 2009-03-15 22:42:53 UTC (rev 9558)
+++ branches/icc_work/base/gsiccmanage.c 2009-03-16 03:35:32 UTC (rev 9559)
@@ -394,7 +394,7 @@
}
static gsicc_link_t*
-FindCacheLink(int64_t hashcode,gsicc_link_cache_t *icc_cache)
+FindCacheLink(int64_t hashcode,gsicc_link_cache_t *icc_cache, bool includes_proof)
{
gsicc_link_t *curr_pos1,*curr_pos2;
@@ -407,7 +407,7 @@
while (curr_pos1 != NULL ){
- if (curr_pos1->LinkHashCode == hashcode){
+ if (curr_pos1->LinkHashCode == hashcode && includes_proof == curr_pos1->includes_softproof){
return(curr_pos1);
@@ -419,7 +419,7 @@
while (curr_pos2 != NULL ){
- if (curr_pos2->LinkHashCode == hashcode){
+ if (curr_pos2->LinkHashCode == hashcode && includes_proof == curr_pos2->includes_softproof){
return(curr_pos2);
@@ -511,7 +511,7 @@
gsicc_link_t*
gsicc_get_link(gs_imager_state * pis, gsicc_colorspace_t *input_colorspace,
gsicc_colorspace_t *output_colorspace,
- gsicc_rendering_param_t *rendering_params, gs_memory_t *memory)
+ gsicc_rendering_param_t *rendering_params, gs_memory_t *memory, bool include_softproof)
{
int64_t hashcode;
@@ -525,9 +525,9 @@
hashcode = gsicc_compute_hash(input_colorspace, output_colorspace, rendering_params);
- /* Check the cache for a hit */
+ /* Check the cache for a hit. Need to check if softproofing was used */
- link = FindCacheLink(hashcode,icc_cache);
+ link = FindCacheLink(hashcode,icc_cache,include_softproof);
/* Got a hit, update the reference count, return link */
Modified: branches/icc_work/base/gsiccmanage.h
===================================================================
--- branches/icc_work/base/gsiccmanage.h 2009-03-15 22:42:53 UTC (rev 9558)
+++ branches/icc_work/base/gsiccmanage.h 2009-03-16 03:35:32 UTC (rev 9559)
@@ -157,6 +157,7 @@
int ref_count;
gsicc_link_t *NextLink;
gsicc_link_t *PrevLink;
+ bool includes_softproof;
} gsicc_link_t;
More information about the gs-cvs
mailing list