[vlc-commits] vout: epg: use macros and rgb colors

Francois Cartegnie git at videolan.org
Tue Jun 6 20:28:42 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 30 17:47:11 2017 +0200| [a0dfe65a24627cabe8bae677f74ac866a22c30a9] | committer: Francois Cartegnie

vout: epg: use macros and rgb colors

because no one can think in yuv

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a0dfe65a24627cabe8bae677f74ac866a22c30a9
---

 src/video_output/video_epg.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index cc552e6414..3134946ccc 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -40,6 +40,14 @@
 #define EPG_PROGRAM_SIZE 0.03
 #define EPG_TIME_SIZE 0.03
 
+#define RGB2YUV( R, G, B ) \
+    ((0.257 * R) + (0.504 * G) + (0.098 * B) + 16), \
+    (-(0.148 * R) - (0.291 * G) + (0.439 * B) + 128),\
+    ((0.439 * R) - (0.368 * G) - (0.071 * B) + 128)
+
+#define HEX2YUV( rgb ) \
+    RGB2YUV( (rgb >> 16), ((rgb & 0xFF00) >> 8), (rgb & 0xFF) )
+
 static subpicture_region_t * vout_OSDEpgSlider(int x, int y,
                                                int width, int height,
                                                float ratio)
@@ -48,10 +56,10 @@ static subpicture_region_t * vout_OSDEpgSlider(int x, int y,
     video_palette_t palette = {
         .i_entries = 4,
         .palette = {
-            [0] = { 0xff, 0x80, 0x80, 0x00 },
-            [1] = { 0x00, 0x80, 0x80, 0x00 },
-            [2] = { 0xff, 0x80, 0x80, 0xff },
-            [3] = { 0x00, 0x80, 0x80, 0xff },
+            [0] = { HEX2YUV(0xffffff), 0x00 }, /* Bar fill remain/background */
+            [1] = { HEX2YUV(0x000000), 0x00 },
+            [2] = { HEX2YUV(0xffffff), 0xff }, /* Bar fill */
+            [3] = { HEX2YUV(0x000000), 0xff }, /* Bar outline */
         },
     };
 



More information about the vlc-commits mailing list