[vlc-commits] [Git][videolan/vlc][master] 5 commits: vlc_fourcc: add defines for host endianness 15-bit and 16-bit chromas

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Oct 3 17:37:39 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1ea223df by Steve Lhomme at 2023-10-03T17:19:46+00:00
vlc_fourcc: add defines for host endianness 15-bit and 16-bit chromas

They are the chromas that should normally be used.

- - - - -
7732b554 by Steve Lhomme at 2023-10-03T17:19:46+00:00
kva: initialize i_chroma_shift to 0

So we don't have to do it most of the time.

- - - - -
fd67b8b5 by Steve Lhomme at 2023-10-03T17:19:46+00:00
kva: add support for RGB565 variants

We have to match the RGB mask from sys->kvac.

We assume the buffers depend on endianness, given OS/2 supports Big-Endian
and Little-Endian.

- - - - -
ba843e97 by Steve Lhomme at 2023-10-03T17:19:46+00:00
kva: add support for RGB555 variants

We have to match the RGB mask from sys->kvac.

We assume the buffers depend on endianness, given OS/2 supports Big-Endian
and Little-Endian.

- - - - -
fc6e7432 by Steve Lhomme at 2023-10-03T17:19:46+00:00
kva: don't map to RGB formats that require a mask

We have plenty of RGB chromas, if we can't use one without a mask, we
won't be able to convert anything to that chroma anyway.

- - - - -


2 changed files:

- include/vlc_fourcc.h
- modules/video_output/kva.c


Changes:

=====================================
include/vlc_fourcc.h
=====================================
@@ -371,6 +371,18 @@
 /* 16-bit BGR Little-Endian: "g3R5 B5G3" */
 #define VLC_CODEC_BGR565LE          VLC_FOURCC('B','L','1','6')
 
+#ifdef WORDS_BIGENDIAN
+/* 16-bit RGB with host endianness */
+#define VLC_CODEC_RGB565    VLC_CODEC_RGB565BE
+/* 16-bit BGR with host endianness */
+#define VLC_CODEC_BGR565    VLC_CODEC_BGR565BE
+#else
+/* 16-bit RGB with host endianness */
+#define VLC_CODEC_RGB565    VLC_CODEC_RGB565LE
+/* 16-bit BGR with host endianness */
+#define VLC_CODEC_BGR565    VLC_CODEC_BGR565LE
+#endif
+
 /* 15-bit RGB Big-Endian: "0R5G5B5" */
 #define VLC_CODEC_RGB555BE          VLC_FOURCC('R','B','1','5')
 /* 15-bit RGB Little-Endian: "g3B5 0R5G2" */
@@ -380,6 +392,19 @@
 /* 15-bit BGR Little-Endian: "g3R5 0B5G2" */
 #define VLC_CODEC_BGR555LE          VLC_FOURCC('B','L','1','5')
 
+#ifdef WORDS_BIGENDIAN
+/* 15-bit RGB with host endianness */
+#define VLC_CODEC_RGB555    VLC_CODEC_RGB555BE
+/* 15-bit BGR with host endianness */
+#define VLC_CODEC_BGR555    VLC_CODEC_BGR565BE
+#else
+/* 15-bit RGB with host endianness */
+#define VLC_CODEC_RGB555    VLC_CODEC_RGB555LE
+/* 15-bit BGR with host endianness */
+#define VLC_CODEC_BGR555    VLC_CODEC_BGR555LE
+#endif
+
+
 /* 8-bit RGB "R3G3B2" */
 #define VLC_CODEC_RGB332           VLC_FOURCC('R','3','3','2')
 /* 8-bit RGB "R2G3B3" */


=====================================
modules/video_output/kva.c
=====================================
@@ -451,8 +451,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
     const vlc_fourcc_t *fallback;
     bool b_hw_accel = 0;
     FOURCC i_kva_fourcc;
-    bool use_masks = true;
-    int i_chroma_shift;
+    int i_chroma_shift = 0;
     int w, h;
 
     msg_Dbg( vd, "render chroma = %4.4s", ( const char * )&fmt->i_chroma );
@@ -475,7 +474,6 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                 case VLC_CODEC_YUYV:
                     b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_YUY2;
                     i_kva_fourcc = FOURCC_Y422;
-                    i_chroma_shift = 0;
                     break;
 
                 case VLC_CODEC_YV9:
@@ -484,16 +482,46 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                     i_chroma_shift = 2;
                     break;
 
-                case VLC_CODEC_RGB16:
-                    b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_BGR16;
-                    i_kva_fourcc = FOURCC_R565;
-                    i_chroma_shift = 0;
+                case VLC_CODEC_RGB565:
+                    if (sys->kvac.ulInputFormatFlags & KVAF_BGR16 &&
+                        sys->kvac.ulRMask == 0xf800 &&
+                        sys->kvac.ulGMask == 0x07e0 &&
+                        sys->kvac.ulBMask == 0x001f)
+                    {
+                        b_hw_accel = true;
+                        i_kva_fourcc = FOURCC_R565;
+                    }
+                    break;
+                case VLC_CODEC_BGR565:
+                    if (sys->kvac.ulInputFormatFlags & KVAF_BGR16 &&
+                        sys->kvac.ulRMask == 0x001f &&
+                        sys->kvac.ulGMask == 0x07e0 &&
+                        sys->kvac.ulBMask == 0xf800)
+                    {
+                        b_hw_accel = true;
+                        i_kva_fourcc = FOURCC_R565;
+                    }
                     break;
 
-                case VLC_CODEC_RGB15:
-                    b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_BGR15;
-                    i_kva_fourcc = FOURCC_R555;
-                    i_chroma_shift = 0;
+                case VLC_CODEC_RGB555:
+                    if (sys->kvac.ulInputFormatFlags & KVAF_BGR16 &&
+                        sys->kvac.ulRMask == 0x7c00 &&
+                        sys->kvac.ulGMask == 0x03e0 &&
+                        sys->kvac.ulBMask == 0x001f)
+                    {
+                        b_hw_accel = true;
+                        i_kva_fourcc = FOURCC_R555;
+                    }
+                    break;
+                case VLC_CODEC_BGR555:
+                    if (sys->kvac.ulInputFormatFlags & KVAF_BGR16 &&
+                        sys->kvac.ulRMask == 0x001f &&
+                        sys->kvac.ulGMask == 0x03e0 &&
+                        sys->kvac.ulBMask == 0x7c00)
+                    {
+                        b_hw_accel = true;
+                        i_kva_fourcc = FOURCC_R555;
+                    }
                     break;
 
                 case VLC_CODEC_XRGB:
@@ -503,9 +531,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                         sys->kvac.ulBMask == 0x000000ff)
                     {
                         b_hw_accel = true;
-                        use_masks = false;
                         i_kva_fourcc = FOURCC_BGR4;
-                        i_chroma_shift = 0;
                     }
                     break;
                 case VLC_CODEC_XBGR:
@@ -515,9 +541,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                         sys->kvac.ulBMask == 0x00ff0000)
                     {
                         b_hw_accel = true;
-                        use_masks = false;
                         i_kva_fourcc = FOURCC_BGR4;
-                        i_chroma_shift = 0;
                     }
                     break;
                 case VLC_CODEC_RGBX:
@@ -527,9 +551,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                         sys->kvac.ulBMask == 0x0000ff00)
                     {
                         b_hw_accel = true;
-                        use_masks = false;
                         i_kva_fourcc = FOURCC_BGR4;
-                        i_chroma_shift = 0;
                     }
                     break;
                 case VLC_CODEC_BGRX:
@@ -539,9 +561,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                         sys->kvac.ulBMask == 0xff000000)
                     {
                         b_hw_accel = true;
-                        use_masks = false;
                         i_kva_fourcc = FOURCC_BGR4;
-                        i_chroma_shift = 0;
                     }
                     break;
 
@@ -552,9 +572,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                         sys->kvac.ulBMask == 0x0000ff)
                     {
                         b_hw_accel = true;
-                        use_masks = false;
                         i_kva_fourcc = FOURCC_BGR3;
-                        i_chroma_shift = 0;
                     }
                     break;
                 case VLC_CODEC_BGR24:
@@ -564,9 +582,7 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                         sys->kvac.ulBMask == 0xff0000)
                     {
                         b_hw_accel = true;
-                        use_masks = false;
                         i_kva_fourcc = FOURCC_BGR3;
-                        i_chroma_shift = 0;
                     }
                     break;
             }
@@ -586,19 +602,9 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
         return VLC_EGENERIC;
     }
 
-    /* Set the RGB masks */
-    if (use_masks)
-    {
-        fmt->i_rmask = sys->kvac.ulRMask;
-        fmt->i_gmask = sys->kvac.ulGMask;
-        fmt->i_bmask = sys->kvac.ulBMask;
-    }
-    else
-    {
-        fmt->i_rmask = 0;
-        fmt->i_gmask = 0;
-        fmt->i_bmask = 0;
-    }
+    fmt->i_rmask = 0;
+    fmt->i_gmask = 0;
+    fmt->i_bmask = 0;
 
     msg_Dbg( vd, "output chroma = %4.4s", ( const char * )&fmt->i_chroma );
     msg_Dbg( vd, "KVA chroma = %4.4s", ( const char * )&i_kva_fourcc );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c9f3ee973c65de5b5586c11cfec93c1e944e2d75...fc6e7432d8e00e73fcacc5b99c1ad71aa3ce55f1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c9f3ee973c65de5b5586c11cfec93c1e944e2d75...fc6e7432d8e00e73fcacc5b99c1ad71aa3ce55f1
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