1 #pragma once 2 3 #include <cstdint> 4 5 namespace kms 6 { 7 struct YUV; 8 9 enum class YUVType { 10 BT601_Lim = 0, 11 BT601_Full, 12 BT709_Lim, 13 BT709_Full, 14 MAX, 15 }; 16 17 struct RGB 18 { 19 RGB(); 20 RGB(uint8_t r, uint8_t g, uint8_t b); 21 RGB(uint8_t a, uint8_t r, uint8_t g, uint8_t b); 22 RGB(uint32_t argb); 23 24 uint32_t rgb888() const; 25 uint32_t bgr888() const; 26 uint32_t argb8888() const; 27 uint32_t abgr8888() const; 28 uint16_t rgb565() const; 29 uint16_t bgr565() const; 30 YUV yuv(YUVType type = YUVType::BT601_Lim) const; 31 32 uint8_t b; 33 uint8_t g; 34 uint8_t r; 35 uint8_t a; 36 }; 37 38 struct YUV 39 { 40 YUV(); 41 YUV(uint8_t y, uint8_t u, uint8_t v); 42 YUV(const RGB& rgb, YUVType type = YUVType::BT601_Lim); 43 44 uint8_t v; 45 uint8_t u; 46 uint8_t y; 47 uint8_t a; 48 }; 49 } 50