[i-g-t V6 28/41] lib/igt_color: add BT2020/BT709 transfer functions
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Wed Apr 24 10:26:36 UTC 2024
From: Harry Wentland <harry.wentland at amd.com>
BT.709 and BT.2020 transfer functions are identical, the
only difference beind that BT.2020 is defined with a higher
precision for 10 and 12 bpc encodings.
These transfer functions are defined as OETFs, not EOTFs,
so we create functions for them as OETF and its inverse.
Signed-off-by: Harry Wentland <harry.wentland at amd.com>
---
lib/igt_color.c | 10 ++++++++++
lib/igt_color.h | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/lib/igt_color.c b/lib/igt_color.c
index 0926385f4..ec8b27d1e 100644
--- a/lib/igt_color.c
+++ b/lib/igt_color.c
@@ -107,6 +107,16 @@ void igt_color_srgb_inv_eotf(igt_pixel_t *pixel)
igt_color_inv_tf(pixel, &srgb_eotf);
}
+void igt_color_bt2020_inv_oetf(igt_pixel_t *pixel)
+{
+ igt_color_tf(pixel, &bt2020_inv_oetf);
+}
+
+void igt_color_bt2020_oetf(igt_pixel_t *pixel)
+{
+ igt_color_inv_tf(pixel, &bt2020_inv_oetf);
+}
+
void igt_color_pq_eotf(igt_pixel_t *pixel)
{
tf_pq(pixel, &pq_eotf);
diff --git a/lib/igt_color.h b/lib/igt_color.h
index a97383fab..813bd19ba 100644
--- a/lib/igt_color.h
+++ b/lib/igt_color.h
@@ -25,6 +25,7 @@ struct igt_color_tf_pq {
const struct igt_color_tf srgb_eotf = {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0};
+const struct igt_color_tf bt2020_inv_oetf = {(float)(1/0.45f), (float)(1/1.0993f), (float)(0.0993f/1.0993f), (float)(1/4.5f), (float)(0.081), 0, 0};
const struct igt_color_tf_pq pq_eotf = {-107/128.0f, 1.0f, 32/2523.0f, 2413/128.0f, -2392/128.0f, 8192/1305.0f };
@@ -117,6 +118,9 @@ void igt_color_pq_eotf(igt_pixel_t *pixel);
void igt_color_pq_125_inv_eotf(igt_pixel_t *pixel);
void igt_color_pq_125_eotf(igt_pixel_t *pixel);
+void igt_color_bt2020_inv_oetf(igt_pixel_t *pixel);
+void igt_color_bt2020_oetf(igt_pixel_t *pixel);
+
void igt_color_ctm_3x4_50_desat(igt_pixel_t *pixel);
void igt_color_ctm_3x4_overdrive(igt_pixel_t *pixel);
void igt_color_ctm_3x4_oversaturate(igt_pixel_t *pixel);
--
2.43.2
More information about the Intel-gfx-trybot
mailing list