Skip to content
Snippets Groups Projects

Color management architecture: color profiles

Merged Pekka Paalanen requested to merge pq/weston:mr/color-output into main
8 files
+ 464
0
Compare changes
  • Side-by-side
  • Inline
Files
8
  • 2bd657d9
    Roughly speaking, a color profile describes the color space of content
    or an output. Under the hood, the description includes one or more ways
    to map colors between the profile space and some standard profile
    connecting space (PCS).
    
    This object is not called a color space. A color space has a unique
    definition, while a color profile may contain multiple different
    mappings depending on render intent. Some of these mappings may be
    subjective, with an artistic touch.
    
    When a source color profile and a destination color profile are combined
    under a specific render intent, they produce a color transformation.
    Color transformations are already preresented by weston_color_transform.
    
    This patch adds the basic API for color profile objects. Everything
    worthwhile of these objects is implemented in the color managers:
    color-noop never creates these, and in color-lcms they are basically a
    container for cmsHPROFILE, the Little CMS object for color profiles.
    Color profile objects will not be interpreted outside of the color
    managers, unlike color transformations.
    
    For a start, the color manager API has one function to create color
    profiles: from ICC profile data. More creation functions for other
    sources will be added later. ICC profiles have various types which
    raises enum weston_color_profile_kind. Output profiles have different
    requirements from content profiles.
    
    The API has errmsg return parameter for error messages. These are not
    simply weston_log()'d, because CM&HDR protocol will allow clients to
    trigger errors and the protocol handles that gracefully. Therefore
    instead of flooding the compositor logs, the error messages will
    probably need to be relayed back to clients.
    
    Color-lcms is expected to create a cmsHPROFILE for all kinds of color
    profiles, not just for those created from ICC profile data. Hence,
    color-lcms will fingerprint color profiles by the MD5 hash which Little
    CMS computes for us. The fingerprint is used for de-duplication: instead
    of creating copies, reference existing color profiles.
    
    This code is very much based on Sebastian Wick's earlier work on Weston
    color management, but structured and named differently.
    
    Co-authored-by: default avatarSebastian Wick <sebastian@sebastianwick.net>
    Signed-off-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
@@ -79,6 +79,7 @@ struct linux_dmabuf_buffer;
struct weston_recorder;
struct weston_pointer_constraint;
struct ro_anonymous_file;
struct weston_color_profile;
struct weston_color_transform;
enum weston_keyboard_modifier {
@@ -2125,6 +2126,27 @@ void
weston_timeline_refresh_subscription_objects(struct weston_compositor *wc,
void *object);
/** Type of color profile object */
enum weston_color_profile_kind {
/** Usable for content. */
WESTON_COLOR_PROFILE_KIND_INPUT = 0x01,
/** Usable for displays. */
WESTON_COLOR_PROFILE_KIND_OUTPUT = 0x02,
/** Usable for both. */
WESTON_COLOR_PROFILE_KIND_INPUT_OUTPUT = 0x03, /* INPUT | OUTPUT */
};
struct weston_color_profile *
weston_color_profile_ref(struct weston_color_profile *cprof);
void
weston_color_profile_unref(struct weston_color_profile *cprof);
const char *
weston_color_profile_get_description(struct weston_color_profile *cprof);
#ifdef __cplusplus
}
#endif
Loading