[vlc-commits] [Git][videolan/vlc][master] 2 commits: fourcc: document the format of the palettes

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jun 29 13:27:01 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
94517a9b by Steve Lhomme at 2024-06-29T13:12:31+00:00
fourcc: document the format of the palettes

The palette values are 4-byte packed RGBA (or packed YUVA).

- - - - -
0c40c342 by Steve Lhomme at 2024-06-29T13:12:31+00:00
Copy/Compare 4-byte buffers in one call

- - - - -


5 changed files:

- include/vlc_fourcc.h
- modules/codec/cvdsub.c
- modules/codec/svcdsub.c
- src/misc/fourcc_list.h
- src/video_output/vout_subpictures.c


Changes:

=====================================
include/vlc_fourcc.h
=====================================
@@ -260,7 +260,7 @@
 #define VLC_CODEC_I444_16L        VLC_FOURCC('I','4','F','L')
 #define VLC_CODEC_I444_16B        VLC_FOURCC('I','4','F','B')
 
-/* Palettized YUV with palette element Y:U:V:A */
+/* Palettized YUV with palette 8-bit Y:U:V:A in memory order */
 #define VLC_CODEC_YUVP            VLC_FOURCC('Y','U','V','P')
 
 /* Planar YUV 4:4:4 Y:U:V:A */
@@ -334,7 +334,7 @@
 
 /* RGB / RGBA */
 
-/* Palettized RGB with palette element R:G:B */
+/* Palettized 8-bit RGB with palette element 8-bit R:G:B:A in memory order */
 #define VLC_CODEC_RGBP            VLC_FOURCC('R','G','B','P')
 
 /* 32-bit RGB, in memory address order: "XRGB" ignoring the x component */


=====================================
modules/codec/cvdsub.c
=====================================
@@ -530,12 +530,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
     fmt.p_palette = &palette;
     fmt.p_palette->i_entries = 4;
     for( i = 0; i < fmt.p_palette->i_entries; i++ )
-    {
-        fmt.p_palette->palette[i][0] = p_sys->p_palette[i][0];
-        fmt.p_palette->palette[i][1] = p_sys->p_palette[i][1];
-        fmt.p_palette->palette[i][2] = p_sys->p_palette[i][2];
-        fmt.p_palette->palette[i][3] = p_sys->p_palette[i][3];
-    }
+        memcpy( fmt.p_palette->palette[i], p_sys->p_palette[i], 4 );
 
     p_region = subpicture_region_New( &fmt );
     if( !p_region )


=====================================
modules/codec/svcdsub.c
=====================================
@@ -479,12 +479,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
     fmt.p_palette = &palette;
     fmt.p_palette->i_entries = 4;
     for( i = 0; i < fmt.p_palette->i_entries; i++ )
-    {
-        fmt.p_palette->palette[i][0] = p_sys->p_palette[i][0];
-        fmt.p_palette->palette[i][1] = p_sys->p_palette[i][1];
-        fmt.p_palette->palette[i][2] = p_sys->p_palette[i][2];
-        fmt.p_palette->palette[i][3] = p_sys->p_palette[i][3];
-    }
+        memcpy( fmt.p_palette->palette[i], p_sys->p_palette[i], 4);
 
     p_region = subpicture_region_New( &fmt );
     fmt.p_palette = NULL;


=====================================
src/misc/fourcc_list.h
=====================================
@@ -801,7 +801,7 @@ static const staticentry_t p_list_video[] = {
     B(VLC_CODEC_YUVA_444_12L, "Planar YUV 4:4:4 Y:U:V:A 12bits LE"),
     B(VLC_CODEC_YUVA_444_12B, "Planar YUV 4:4:4 Y:U:V:A 12bits BE"),
 
-    B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B"),
+    B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B:A"),
         A("RGBP"),
 
     B(VLC_CODEC_RGB233, "8 bits RGB 2:3:3"),


=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -1061,16 +1061,14 @@ static struct subpicture_region_rendered *SpuRenderRegion(spu_t *spu,
         new_palette.i_entries = 4;
         for (int i = 0; i < 4; i++)
         {
-            for (int j = 0; j < 4; j++)
-                new_palette.palette[i][j] = sys->palette.palette[i][j];
+            memcpy(new_palette.palette[i], &sys->palette.palette[i], 4);
             b_opaque |= (new_palette.palette[i][3] > 0x00);
         }
 
         if (old_palette->i_entries == new_palette.i_entries) {
             for (int i = 0; i < old_palette->i_entries; i++)
             {
-                for (int j = 0; j < 4; j++)
-                    changed_palette |= old_palette->palette[i][j] != new_palette.palette[i][j];
+                changed_palette |= memcmp(old_palette->palette[i], new_palette.palette[i], 4);
                 b_old_opaque |= (old_palette->palette[i][3] > 0x00);
             }
         } else {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9f9c466bc14c1dcd75564c7cd18d031ea9e76325...0c40c342e31da4409e0225c18af166321a00e29a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9f9c466bc14c1dcd75564c7cd18d031ea9e76325...0c40c342e31da4409e0225c18af166321a00e29a
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