[vlc-commits] [Git][videolan/vlc][master] 11 commits: fourcc: clarify RGB(A) (non-HDR) formats

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Mon Jun 6 17:58:10 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
5696bc01 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
fourcc: clarify RGB(A) (non-HDR) formats

- - - - -
e5cbfe68 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
fourcc: define ABGR

- - - - -
267e3548 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
invert: reject ABGR

- - - - -
64171059 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
yuvp: add ABGR

- - - - -
b2cc43dc by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
avcodec: add ABGR

- - - - -
e98eb924 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
smem: add BGRA and ABGR

- - - - -
b1cb4411 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
freetype: add ABGR

- - - - -
a42609ca by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
swscale: add ABGR

- - - - -
052492a5 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
scale: add BGRA

- - - - -
c6a3c197 by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
drm: add BGRA

- - - - -
736f43bc by Rémi Denis-Courmont at 2022-06-06T17:43:23+00:00
xcb/render: add BGRA

- - - - -


15 changed files:

- include/vlc_fourcc.h
- modules/codec/avcodec/chroma.c
- modules/codec/avcodec/fourcc.c
- modules/stream_out/smem.c
- modules/text_renderer/freetype/freetype.c
- modules/video_chroma/swscale.c
- modules/video_chroma/yuvp.c
- modules/video_filter/invert.c
- modules/video_filter/scale.c
- modules/video_output/drm/fourcc.c
- modules/video_output/xcb/render.c
- src/misc/es_format.c
- src/misc/fourcc.c
- src/misc/fourcc_list.h
- src/video_output/vout_subpictures.c


Changes:

=====================================
include/vlc_fourcc.h
=====================================
@@ -338,28 +338,31 @@
 /* Packed YUV 4:4:4 V:U:Y:A */
 #define VLC_CODEC_VUYA            VLC_FOURCC('V','U','Y','A')
 
-/* RGB */
+/* RGB / RGBA */
 
 /* Palettized RGB with palette element R:G:B */
 #define VLC_CODEC_RGBP            VLC_FOURCC('R','G','B','P')
-/* 8 bits RGB */
+/* 8-bit RGB (using explicit masks) */
 #define VLC_CODEC_RGB8            VLC_FOURCC('R','G','B','8')
-/* 12 bits RGB padded to 16 bits */
+/* 12-bit RGB padded to 16 bits (using explicit masks) */
 #define VLC_CODEC_RGB12           VLC_FOURCC('R','V','1','2')
-/* 15 bits RGB padded to 16 bits */
+/* 15-bit RGB padded to 16 bits (using explicit masks) */
 #define VLC_CODEC_RGB15           VLC_FOURCC('R','V','1','5')
-/* 16 bits RGB */
+/* 16-bit RGB (using explit masks) */
 #define VLC_CODEC_RGB16           VLC_FOURCC('R','V','1','6')
-/* 24 bits RGB */
+/* 24-bit RGB (using explicit masks) */
 #define VLC_CODEC_RGB24           VLC_FOURCC('R','V','2','4')
-/* 24 bits RGB padded to 32 bits */
+/* 24-bit RGB padded to 32 bits (using explicit masks) */
 #define VLC_CODEC_RGB32           VLC_FOURCC('R','V','3','2')
-/* 32 bits RGBA */
+
+/* 32-bit RGBA, in memory address order: "RGBA" */
 #define VLC_CODEC_RGBA            VLC_FOURCC('R','G','B','A')
-/* 32 bits ARGB */
+/* 32-bit ARGB, in memory address order: "ARGB" */
 #define VLC_CODEC_ARGB            VLC_FOURCC('A','R','G','B')
-/* 32 bits BGRA */
+/* 32-bit ARGB, in memory address order: "BGRA" */
 #define VLC_CODEC_BGRA            VLC_FOURCC('B','G','R','A')
+/* 32-bit RGBA, in memory address order: "ABGR" */
+#define VLC_CODEC_ABGR            VLC_FOURCC('A','B','G','R')
 /* 32 bits BGRA 10:10:10:2 */
 #define VLC_CODEC_RGBA10          VLC_FOURCC('R','G','A','0')
 /* 64 bits RGBA */


=====================================
modules/codec/avcodec/chroma.c
=====================================
@@ -166,6 +166,7 @@ static const struct
     {VLC_CODEC_RGBA, AV_PIX_FMT_RGBA, 0, 0, 0 },
     {VLC_CODEC_ARGB, AV_PIX_FMT_ARGB, 0, 0, 0 },
     {VLC_CODEC_BGRA, AV_PIX_FMT_BGRA, 0, 0, 0 },
+    {VLC_CODEC_ABGR, AV_PIX_FMT_ABGR, 0, 0, 0 },
     {VLC_CODEC_GREY, AV_PIX_FMT_GRAY8, 0, 0, 0},
 #ifdef AV_PIX_FMT_GRAY10
     {VLC_CODEC_GREY_10L, AV_PIX_FMT_GRAY10LE, 0, 0, 0},


=====================================
modules/codec/avcodec/fourcc.c
=====================================
@@ -67,6 +67,7 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
     { VLC_CODEC_RGB8, AV_CODEC_ID_RAWVIDEO },
     { VLC_CODEC_RGBA, AV_CODEC_ID_RAWVIDEO },
     { VLC_CODEC_ARGB, AV_CODEC_ID_RAWVIDEO },
+    { VLC_CODEC_ABGR, AV_CODEC_ID_RAWVIDEO },
     { VLC_CODEC_DIV1, AV_CODEC_ID_MSMPEG4V1 },
     { VLC_CODEC_DIV2, AV_CODEC_ID_MSMPEG4V2 },
     { VLC_CODEC_DIV3, AV_CODEC_ID_MSMPEG4V3 },


=====================================
modules/stream_out/smem.c
=====================================
@@ -288,6 +288,8 @@ static void *AddVideo( sout_stream_t *p_stream, const es_format_t *p_fmt )
         case VLC_CODEC_RGB32:
         case VLC_CODEC_RGBA:
         case VLC_CODEC_ARGB:
+        case VLC_CODEC_BGRA:
+        case VLC_CODEC_ABGR:
             i_bits_per_pixel = 32;
             break;
         case VLC_CODEC_I444:


=====================================
modules/text_renderer/freetype/freetype.c
=====================================
@@ -1166,10 +1166,11 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
                                  *p_chroma,
                                  &p_region_out->fmt,
                                  drawfuncs[DRAW_RGBA] );
-            else if( *p_chroma == VLC_CODEC_ARGB )
+            else if( *p_chroma == VLC_CODEC_ARGB
+                  || *p_chroma == VLC_CODEC_ABGR)
                 rv = RenderAXYZ( p_filter, p_region_out, text_block.p_laid,
                                  &regionbbox, &paddedbbox, &bbox,
-                                 VLC_CODEC_ARGB,
+                                 *p_chroma,
                                  &p_region_out->fmt,
                                  drawfuncs[DRAW_ARGB] );
 


=====================================
modules/video_chroma/swscale.c
=====================================
@@ -297,6 +297,10 @@ static void FixParameters( enum AVPixelFormat *pi_fmt, bool *pb_has_a, bool *pb_
         *pi_fmt = AV_PIX_FMT_RGB32;
         *pb_has_a = true;
         break;
+    case VLC_CODEC_ABGR:
+        *pi_fmt = AV_PIX_FMT_RGB32_1;
+        *pb_has_a = true;
+        break;
     case VLC_CODEC_YV12:
         *pi_fmt = AV_PIX_FMT_YUV420P;
         *pb_swap_uv = true;
@@ -702,7 +706,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         /* We extract the A plane to rescale it, and then we reinject it. */
         if( p_fmti->i_chroma == VLC_CODEC_RGBA || p_fmti->i_chroma == VLC_CODEC_BGRA )
             ExtractA( p_sys->p_src_a, p_src, OFFSET_A );
-        else if( p_fmti->i_chroma == VLC_CODEC_ARGB )
+        else if( p_fmti->i_chroma == VLC_CODEC_ARGB || p_fmti->i_chroma == VLC_CODEC_ABGR )
             ExtractA( p_sys->p_src_a, p_src, 0 );
         else
             plane_CopyPixels( p_sys->p_src_a->p, p_src->p+A_PLANE );
@@ -711,7 +715,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
                  p_fmti->i_visible_height, 1, false, false );
         if( p_fmto->i_chroma == VLC_CODEC_RGBA || p_fmto->i_chroma == VLC_CODEC_BGRA )
             InjectA( p_dst, p_sys->p_dst_a, OFFSET_A );
-        else if( p_fmto->i_chroma == VLC_CODEC_ARGB )
+        else if( p_fmto->i_chroma == VLC_CODEC_ARGB || p_fmto->i_chroma == VLC_CODEC_ABGR )
             InjectA( p_dst, p_sys->p_dst_a, 0 );
         else
             plane_CopyPixels( p_dst->p+A_PLANE, p_sys->p_dst_a->p );
@@ -721,7 +725,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         /* We inject a complete opaque alpha plane */
         if( p_fmto->i_chroma == VLC_CODEC_RGBA || p_fmto->i_chroma == VLC_CODEC_BGRA )
             FillA( &p_dst->p[0], OFFSET_A );
-        else if( p_fmto->i_chroma == VLC_CODEC_ARGB )
+        else if( p_fmto->i_chroma == VLC_CODEC_ARGB || p_fmto->i_chroma == VLC_CODEC_ABGR )
             FillA( &p_dst->p[0], 0 );
         else
             FillA( &p_dst->p[A_PLANE], 0 );


=====================================
modules/video_chroma/yuvp.c
=====================================
@@ -65,7 +65,8 @@ static int Open( filter_t *p_filter )
         ( p_filter->fmt_out.video.i_chroma != VLC_CODEC_YUVA &&
           p_filter->fmt_out.video.i_chroma != VLC_CODEC_RGBA &&
           p_filter->fmt_out.video.i_chroma != VLC_CODEC_ARGB &&
-          p_filter->fmt_out.video.i_chroma != VLC_CODEC_BGRA ) ||
+          p_filter->fmt_out.video.i_chroma != VLC_CODEC_BGRA &&
+          p_filter->fmt_out.video.i_chroma != VLC_CODEC_ABGR) ||
         p_filter->fmt_in.video.i_width  != p_filter->fmt_out.video.i_width ||
         p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height ||
         p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
@@ -129,6 +130,7 @@ static void Convert( filter_t *p_filter, picture_t *p_source,
             case VLC_CODEC_ARGB: r = 1, g = 2, b = 3, a = 0; break;
             case VLC_CODEC_RGBA: r = 0, g = 1, b = 2, a = 3; break;
             case VLC_CODEC_BGRA: r = 2, g = 1, b = 0, a = 3; break;
+            case VLC_CODEC_ABGR: r = 3, g = 2, b = 1, a = 0; break;
             default:
                 vlc_assert_unreachable();
         }


=====================================
modules/video_filter/invert.c
=====================================
@@ -62,7 +62,7 @@ static int Create( filter_t *p_filter )
 
     if( fourcc == VLC_CODEC_YUVP || fourcc == VLC_CODEC_RGBP
      || fourcc == VLC_CODEC_RGBA || fourcc == VLC_CODEC_ARGB
-     || fourcc == VLC_CODEC_BGRA )
+     || fourcc == VLC_CODEC_BGRA || fourcc == VLC_CODEC_ABGR )
         return VLC_EGENERIC;
 
     const vlc_chroma_description_t *p_chroma =


=====================================
modules/video_filter/scale.c
=====================================
@@ -60,7 +60,8 @@ static int OpenFilter( filter_t *p_filter )
           p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGB32 &&
           p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGBA &&
           p_filter->fmt_in.video.i_chroma != VLC_CODEC_ARGB &&
-          p_filter->fmt_in.video.i_chroma != VLC_CODEC_BGRA ) ||
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_BGRA &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_ABGR ) ||
         p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma )
     {
         return VLC_EGENERIC;
@@ -92,6 +93,7 @@ static void Filter( filter_t *p_filter, picture_t *p_pic, picture_t *p_pic_dst )
     if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGBA &&
         p_filter->fmt_in.video.i_chroma != VLC_CODEC_ARGB &&
         p_filter->fmt_in.video.i_chroma != VLC_CODEC_BGRA &&
+        p_filter->fmt_in.video.i_chroma != VLC_CODEC_ABGR &&
         p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGB32 )
     {
         for( int i_plane = 0; i_plane < p_pic_dst->i_planes; i_plane++ )


=====================================
modules/video_output/drm/fourcc.c
=====================================
@@ -177,6 +177,7 @@ static const struct {
     { DRM_FORMAT_ARGB8888, VLC_CODEC_BGRA },
     { DRM_FORMAT_ABGR8888, VLC_CODEC_RGBA },
     { DRM_FORMAT_BGRA8888, VLC_CODEC_ARGB },
+    { DRM_FORMAT_RGBA8888, VLC_CODEC_ABGR },
 #ifndef WORDS_BIGENDIAN
     { DRM_FORMAT_ABGR2101010, VLC_CODEC_RGBA10 },
 #endif


=====================================
modules/video_output/xcb/render.c
=====================================
@@ -445,6 +445,9 @@ static vlc_fourcc_t ParseFormat(const xcb_setup_t *setup,
                 if (d->red_shift == 16 && d->green_shift == 8
                  && d->blue_shift == 0)
                     return VLC_CODEC_ARGB;
+                if (d->red_shift == 0 && d->green_shift == 8
+                 && d->blue_shift == 16)
+                    return VLC_CODEC_ABGR;
 #else
                 if (d->red_shift == 0 && d->green_shift == 8
                  && d->blue_shift == 16)
@@ -455,6 +458,9 @@ static vlc_fourcc_t ParseFormat(const xcb_setup_t *setup,
                 if (d->red_shift == 8 && d->green_shift == 16
                  && d->blue_shift == 24)
                     return VLC_CODEC_ARGB;
+                if (d->red_shift == 24 && d->green_shift == 16
+                 && d->blue_shift == 8)
+                    return VLC_CODEC_ABGR;
 #endif
             }
             break;


=====================================
src/misc/es_format.c
=====================================
@@ -141,6 +141,7 @@ void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma,
     case VLC_CODEC_RGBA:
     case VLC_CODEC_ARGB:
     case VLC_CODEC_BGRA:
+    case VLC_CODEC_ABGR:
         p_fmt->i_bits_per_pixel = 32;
         break;
     case VLC_CODEC_RGB24:


=====================================
src/misc/fourcc.c
=====================================
@@ -804,7 +804,8 @@ static const struct
     { { VLC_CODEC_RGB24, 0 },                  PACKED_FMT(3, 24) },
     { { VLC_CODEC_RGB32, 0 },                  PACKED_FMT(4, 24) },
     { { VLC_CODEC_RGBA, VLC_CODEC_ARGB,
-        VLC_CODEC_BGRA, VLC_CODEC_RGBA10 },    PACKED_FMT(4, 32) },
+        VLC_CODEC_BGRA, VLC_CODEC_ABGR },      PACKED_FMT(4, 32) },
+    { { VLC_CODEC_RGBA10 },                    PACKED_FMT(4, 32) },
     { { VLC_CODEC_RGBA64, 0 },                 PACKED_FMT(8, 64) },
     { { VLC_CODEC_VUYA, VLC_CODEC_Y210,
         VLC_CODEC_Y410, 0 },                   PACKED_FMT(4, 32) },


=====================================
src/misc/fourcc_list.h
=====================================
@@ -820,6 +820,7 @@ static const staticentry_t p_list_video[] = {
         A("AV32"),
     B(VLC_CODEC_BGRA, "32 bits BGRA"),
         A("BGRA"),
+    B(VLC_CODEC_ABGR, "32 bits ABGR"),
     B(VLC_CODEC_RGBA10, "32 bits RGB 10bits A 2bits"),
         A("RGA0"),
     B(VLC_CODEC_RGBA64, "64 bits RGBA"),


=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -1930,6 +1930,7 @@ subpicture_t *spu_Render(spu_t *spu,
         VLC_CODEC_RGBA,
         VLC_CODEC_ARGB,
         VLC_CODEC_BGRA,
+        VLC_CODEC_ABGR,
         VLC_CODEC_YUVP,
         0,
     };
@@ -1937,6 +1938,7 @@ subpicture_t *spu_Render(spu_t *spu,
         VLC_CODEC_RGBA,
         VLC_CODEC_ARGB,
         VLC_CODEC_BGRA,
+        VLC_CODEC_ABGR,
         VLC_CODEC_YUVA,
         VLC_CODEC_YUVP,
         0,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d843c0681cacccbf71af70ef054228c58e1d4d93...736f43bc75c5f3c5529cacb822911087313de9d7

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