[vlc-commits] [Git][videolan/vlc][master] 7 commits: screen/xcb: replace VLC_CODEC_RGB16 with VLC_CODEC_RGB565

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Oct 6 09:58:42 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a0670492 by Steve Lhomme at 2023-10-06T09:42:29+00:00
screen/xcb: replace VLC_CODEC_RGB16 with VLC_CODEC_RGB565

This is the format once the mask will be " fixed" depending on endianness.

- - - - -
eb14275a by Steve Lhomme at 2023-10-06T09:42:29+00:00
screen/xcb: replace VLC_CODEC_RGB15 with RGB555

This is the format once the mask will be " fixed" depending on endianness.

- - - - -
55b48796 by Steve Lhomme at 2023-10-06T09:42:29+00:00
vout/xcb: don't use the mask by default

We only use true for RBG15 and RGB16.

- - - - -
c91c0f17 by Steve Lhomme at 2023-10-06T09:42:29+00:00
vout/xcb: remap 16-bit RGB to common masks locally

- - - - -
26a857f8 by Steve Lhomme at 2023-10-06T09:42:29+00:00
vout/xcb: remap 15-bit RGB to common masks locally

- - - - -
2eb4843b by Steve Lhomme at 2023-10-06T09:42:29+00:00
vout/xcb: don't map unknown 15/16-bit RGB masks

Similar to d307f9d6912540bb0d77d0e3782a56d939749629.

- - - - -
f9125307 by Steve Lhomme at 2023-10-06T09:42:29+00:00
vout/xcb: allow non-native endian 15/16-bit masks

We can map all of them to the proper endianness.

- - - - -


2 changed files:

- modules/access/screen/xcb.c
- modules/video_output/xcb/pictures.c


Changes:

=====================================
modules/access/screen/xcb.c
=====================================
@@ -541,11 +541,11 @@ static es_out_id_t *InitES (demux_t *demux, uint_fast16_t width,
                 break;
             case 16:
                 if (fmt->bits_per_pixel == 16)
-                    chroma = VLC_CODEC_RGB16;
+                    chroma = VLC_CODEC_RGB565;
                 break;
             case 15:
                 if (fmt->bits_per_pixel == 16)
-                    chroma = VLC_CODEC_RGB15;
+                    chroma = VLC_CODEC_RGB555;
                 break;
             case 8: /* XXX: screw grey scale! */
                 if (fmt->bits_per_pixel == 8)


=====================================
modules/video_output/xcb/pictures.c
=====================================
@@ -96,13 +96,6 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
     if (unlikely(fmt == NULL))
         return false;
 
-    /* Byte sex is a non-issue for 8-bits. It can be worked around with
-     * RGB masks for 24-bits. Too bad for 15-bits and 16-bits. */
-    if (fmt->bits_per_pixel == 16 && setup->image_byte_order != ORDER)
-        return false;
-
-    bool use_masks = true;
-
     /* Check that VLC supports the pixel format. */
     switch (fmt->depth)
     {
@@ -118,7 +111,6 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
                     vt->blue_mask  == 0x000000ff)
                 {
                     f->i_chroma = VLC_CODEC_XRGB;
-                    use_masks = false;
                 }
                 else
                 if (vt->red_mask   == 0x000000ff &&
@@ -126,7 +118,6 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
                     vt->blue_mask  == 0x00ff0000)
                 {
                     f->i_chroma = VLC_CODEC_XBGR;
-                    use_masks = false;
                 }
                 else
                 if (vt->red_mask   == 0xff000000 &&
@@ -134,7 +125,6 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
                     vt->blue_mask  == 0x0000ff00)
                 {
                     f->i_chroma = VLC_CODEC_RGBX;
-                    use_masks = false;
                 }
                 else
                 if (vt->red_mask   == 0x0000ff00 &&
@@ -142,7 +132,6 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
                     vt->blue_mask  == 0xff000000)
                 {
                     f->i_chroma = VLC_CODEC_BGRX;
-                    use_masks = false;
                 }
                 else
                     return false;
@@ -154,7 +143,6 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
                     vt->blue_mask  == 0x0000ff)
                 {
                     f->i_chroma = VLC_CODEC_RGB24;
-                    use_masks = false;
                 }
                 else
                 if (vt->red_mask   == 0x0000ff &&
@@ -162,7 +150,6 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
                     vt->blue_mask  == 0xff0000)
                 {
                     f->i_chroma = VLC_CODEC_BGR24;
-                    use_masks = false;
                 }
                 else
                     return false;
@@ -173,17 +160,48 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
         case 16:
             if (fmt->bits_per_pixel != 16)
                 return false;
-            f->i_chroma = VLC_CODEC_RGB16;
+            if (vt->red_mask   == 0xf800 &&
+                vt->green_mask == 0x07e0 &&
+                vt->blue_mask  == 0x001f)
+            {
+                f->i_chroma = setup->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST ?
+                              VLC_CODEC_RGB565BE : VLC_CODEC_RGB565LE;
+            }
+            else
+            if (vt->red_mask   == 0x001f &&
+                vt->green_mask == 0x07e0 &&
+                vt->blue_mask  == 0xf800)
+            {
+                f->i_chroma = setup->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST ?
+                              VLC_CODEC_BGR565BE : VLC_CODEC_BGR565LE;
+            }
+            else
+                return false;
             break;
         case 15:
             if (fmt->bits_per_pixel != 16)
                 return false;
-            f->i_chroma = VLC_CODEC_RGB15;
+            if (vt->red_mask   == 0x7c00 &&
+                vt->green_mask == 0x03e0 &&
+                vt->blue_mask  == 0x001f)
+            {
+                f->i_chroma = setup->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST ?
+                              VLC_CODEC_RGB555BE : VLC_CODEC_RGB555LE;
+            }
+            else
+            if (vt->red_mask   == 0x001f &&
+                vt->green_mask == 0x03e0 &&
+                vt->blue_mask  == 0x7c00)
+            {
+                f->i_chroma = setup->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST ?
+                              VLC_CODEC_BGR555BE : VLC_CODEC_BGR555LE;
+            }
+            else
+                return false;
             break;
         case 8:
             if (fmt->bits_per_pixel != 8)
                 return false;
-            use_masks = false;
             if (vt->_class == XCB_VISUAL_CLASS_TRUE_COLOR)
                 f->i_chroma = VLC_CODEC_RGB233;
             else
@@ -193,18 +211,9 @@ bool vlc_xcb_VisualToFormat(const xcb_setup_t *setup, uint_fast8_t depth,
             vlc_assert_unreachable();
     }
 
-    if (use_masks)
-    {
-        f->i_rmask = vt->red_mask;
-        f->i_gmask = vt->green_mask;
-        f->i_bmask = vt->blue_mask;
-    }
-    else
-    {
-        f->i_rmask = 0;
-        f->i_gmask = 0;
-        f->i_bmask = 0;
-    }
+    f->i_rmask = 0;
+    f->i_gmask = 0;
+    f->i_bmask = 0;
     return true;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b6afedd0fbf7f84f5fd4a4cb2ba943bdaf7dfaa8...f912530730b714e7122cd0002fcac11deb872594

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b6afedd0fbf7f84f5fd4a4cb2ba943bdaf7dfaa8...f912530730b714e7122cd0002fcac11deb872594
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list