color-lcms: introduce cmlcms_category, EOTF and INV EOTF

1. The cmlcms_category is used to identify the purpose of transform:
   - CMLCMS_CATEGORY_INPUT_TO_BLEND
   - CMLCMS_CATEGORY_BLEND_TO_OUTPUT
   - CMLCMS_CATEGORY_INPUT_TO_OUTPUT

2. Added following fields to cmlcms_color_profile:

   - output_eotf - If the profile does support being an output profile and it
     is used as an output then this field represents a light linearizing
     transfer function and it can not be null. The field is null only if
     the profile is not  usable as an output profile. The field is set when
     cmlcms_color_profile  is created.

   - vcgt - VCGT tag cached from output profile, it could be null if not exist

   - output_inv_eotf_vcgt - if the profile does support being an output profile and it
     is used as an output then this field represents a concatenation of inverse
     EOTF + VCGT, if the tag exists and it can not be null.

3. Added field cmsHTRANSFORM to cmlcms_color_transform.
   It is used to store LCMS optimized pipeline.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
dev
Vitaly Prosyak 3 years ago
parent 93c6180c71
commit 494ff5b23b
  1. 65
      libweston/color-lcms/color-lcms.h
  2. 3
      libweston/color-lcms/color-profile.c

@ -59,6 +59,58 @@ struct cmlcms_color_profile {
cmsHPROFILE profile;
struct cmlcms_md5_sum md5sum;
/**
* If the profile does support being an output profile and it is used as an
* output then this field represents a light linearizing transfer function
* and it can not be null. The field is null only if the profile is not
* usable as an output profile. The field is set when cmlcms_color_profile
* is created.
*/
cmsToneCurve *output_eotf[3];
/**
* If the profile does support being an output profile and it is used as an
* output then this field represents a concatenation of inverse EOTF + VCGT,
* if the tag exists and it can not be null.
* VCGT is part of monitor calibration which means: even though we must
* apply VCGT in the compositor, we pretend that it happens inside the
* monitor. This is how the classic color management and ICC profiles work.
* The ICC profile (ignoring the VCGT tag) characterizes the output which
* is VCGT + monitor behavior. The field is null only if the profile is not
* usable as an output profile. The field is set when cmlcms_color_profile
* is created.
*/
cmsToneCurve *output_inv_eotf_vcgt[3];
/**
* VCGT tag cached from output profile, it could be null if not exist
*/
cmsToneCurve *vcgt[3];
};
/**
* Type of LCMS transforms
*/
enum cmlcms_category {
/**
* Uses combination of input profile with output profile, but
* without INV EOTF or with additional EOTF in the transform pipeline
* inputblend = input profile + output profile + output EOTF
*/
CMLCMS_CATEGORY_INPUT_TO_BLEND = 0,
/**
* Uses INV EOTF only concatenated with VCGT tag if present
* blendoutput = output inverse EOTF + VCGT
*/
CMLCMS_CATEGORY_BLEND_TO_OUTPUT,
/**
* Transform uses input profile and output profile as is
* inputoutput = input profile + output profile + VCGT
*/
CMLCMS_CATEGORY_INPUT_TO_OUTPUT,
};
static inline struct cmlcms_color_profile *
@ -100,8 +152,19 @@ struct cmlcms_color_transform {
struct cmlcms_color_transform_search_param search_key;
/* for EOTF types */
/* for EOTF types It would be deprecated */
cmsToneCurve *curve;
/**
* 3D LUT color mapping part of the transformation, if needed.
* For category CMLCMS_CATEGORY_INPUT_TO_OUTPUT it includes pre-curve and
* post-curve.
* For category CMLCMS_CATEGORY_INPUT_TO_BLEND it includes pre-curve.
* For category CMLCMS_CATEGORY_BLEND_TO_OUTPUT and when identity it is
* not used
*/
cmsHTRANSFORM cmap_3dlut;
};
static inline struct cmlcms_color_transform *

@ -106,6 +106,9 @@ static void
cmlcms_color_profile_destroy(struct cmlcms_color_profile *cprof)
{
wl_list_remove(&cprof->link);
cmsFreeToneCurveTriple(cprof->vcgt);
cmsFreeToneCurveTriple(cprof->output_eotf);
cmsFreeToneCurveTriple(cprof->output_inv_eotf_vcgt);
cmsCloseProfile(cprof->profile);
free(cprof->base.description);
free(cprof);

Loading…
Cancel
Save