From 7adbef59143af49fb153812d1d0368522e70dcaf Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 9 May 2017 17:37:15 +0300 Subject: Add different YCbCr encodings. --- kms++util/inc/kms++util/color.h | 12 ++++++++++-- kms++util/inc/kms++util/kms++util.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'kms++util/inc') diff --git a/kms++util/inc/kms++util/color.h b/kms++util/inc/kms++util/color.h index ba2ed25..f378433 100644 --- a/kms++util/inc/kms++util/color.h +++ b/kms++util/inc/kms++util/color.h @@ -6,6 +6,14 @@ namespace kms { struct YUV; +enum class YUVType { + BT601_Lim = 0, + BT601_Full, + BT709_Lim, + BT709_Full, + MAX, +}; + struct RGB { RGB(); @@ -19,7 +27,7 @@ struct RGB uint32_t abgr8888() const; uint16_t rgb565() const; uint16_t bgr565() const; - YUV yuv() const; + YUV yuv(YUVType type = YUVType::BT601_Lim) const; uint8_t b; uint8_t g; @@ -31,7 +39,7 @@ struct YUV { YUV(); YUV(uint8_t y, uint8_t u, uint8_t v); - YUV(const RGB& rgb); + YUV(const RGB& rgb, YUVType type = YUVType::BT601_Lim); uint8_t v; uint8_t u; diff --git a/kms++util/inc/kms++util/kms++util.h b/kms++util/inc/kms++util/kms++util.h index c1e3c8c..d45497e 100644 --- a/kms++util/inc/kms++util/kms++util.h +++ b/kms++util/inc/kms++util/kms++util.h @@ -26,7 +26,7 @@ void draw_text(IMappedFramebuffer& buf, uint32_t x, uint32_t y, const std::strin void draw_color_bar(IMappedFramebuffer& buf, int old_xpos, int xpos, int width); -void draw_test_pattern(IMappedFramebuffer &fb); +void draw_test_pattern(IMappedFramebuffer &fb, YUVType yuvt = YUVType::BT601_Lim); } #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -- cgit v1.2.3