mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
render/color: add wlr_color_transfer_function_get_default_luminance()
This commit is contained in:
parent
50537e2e6f
commit
10b8880fc7
3 changed files with 33 additions and 0 deletions
|
|
@ -56,4 +56,10 @@ void wlr_color_primaries_from_named(struct wlr_color_primaries *out,
|
||||||
*/
|
*/
|
||||||
void wlr_color_primaries_to_xyz(const struct wlr_color_primaries *primaries, float matrix[static 9]);
|
void wlr_color_primaries_to_xyz(const struct wlr_color_primaries *primaries, float matrix[static 9]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default luminances for a transfer function.
|
||||||
|
*/
|
||||||
|
void wlr_color_transfer_function_get_default_luminance(enum wlr_color_transfer_function tf,
|
||||||
|
struct wlr_color_luminances *lum);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,13 @@ struct wlr_color_primaries {
|
||||||
struct wlr_color_cie1931_xy red, green, blue, white;
|
struct wlr_color_cie1931_xy red, green, blue, white;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Luminance range and reference white luminance level, in cd/m².
|
||||||
|
*/
|
||||||
|
struct wlr_color_luminances {
|
||||||
|
float min, max, reference;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A color transformation formula, which maps a linear color space with
|
* A color transformation formula, which maps a linear color space with
|
||||||
* sRGB primaries to an output color space.
|
* sRGB primaries to an output color space.
|
||||||
|
|
|
||||||
|
|
@ -128,3 +128,23 @@ void wlr_color_primaries_to_xyz(const struct wlr_color_primaries *primaries, flo
|
||||||
};
|
};
|
||||||
memcpy(matrix, result, sizeof(result));
|
memcpy(matrix, result, sizeof(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_color_transfer_function_get_default_luminance(enum wlr_color_transfer_function tf,
|
||||||
|
struct wlr_color_luminances *lum) {
|
||||||
|
switch (tf) {
|
||||||
|
case WLR_COLOR_TRANSFER_FUNCTION_ST2084_PQ:
|
||||||
|
*lum = (struct wlr_color_luminances){
|
||||||
|
.min = 0.005,
|
||||||
|
.max = 10000,
|
||||||
|
.reference = 203,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*lum = (struct wlr_color_luminances){
|
||||||
|
.min = 0.2,
|
||||||
|
.max = 80,
|
||||||
|
.reference = 80,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue