[vlc-commits] [Git][videolan/vlc][master] 2 commits: svg: fix chroma mapping on Big-Endian

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Sep 7 18:11:05 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1eb2a5b0 by Steve Lhomme at 2023-09-07T17:52:30+00:00
svg: fix chroma mapping on Big-Endian

The documentation [1] for CAIRO_FORMAT_ARGB32 says:
"alpha in the upper 8 bits, then red, then green, then blue. The 32-bit
quantities are stored native-endian."

So this is ARGB on Big-Endian and BGRA on Little-Endian.

[1] https://www.cairographics.org/manual-1.0.2/cairo-Image-Surfaces.html

- - - - -
399bd1cb by Steve Lhomme at 2023-09-07T17:52:30+00:00
svg: don't set a mask for VLC_CODEC_BGRA

- - - - -


1 changed file:

- modules/codec/svg.c


Changes:

=====================================
modules/codec/svg.c
=====================================
@@ -107,7 +107,11 @@ static int OpenDecoder( vlc_object_t *p_this )
 #endif
 
     /* Set output properties */
+#ifdef WORDS_BIGENDIAN
+    p_dec->fmt_out.i_codec = VLC_CODEC_ARGB;
+#else
     p_dec->fmt_out.i_codec = VLC_CODEC_BGRA;
+#endif
 
     /* Set callbacks */
     p_dec->pf_decode = DecodeBlock;
@@ -177,17 +181,20 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
     }
 
     p_dec->fmt_out.i_codec =
+#ifdef WORDS_BIGENDIAN
+    p_dec->fmt_out.video.i_chroma = VLC_CODEC_ARGB;
+#else
     p_dec->fmt_out.video.i_chroma = VLC_CODEC_BGRA;
+#endif
     p_dec->fmt_out.video.i_width  = i_width;
     p_dec->fmt_out.video.i_height = i_height;
     p_dec->fmt_out.video.i_visible_width  = i_width;
     p_dec->fmt_out.video.i_visible_height = i_height;
     p_dec->fmt_out.video.i_sar_num = 1;
     p_dec->fmt_out.video.i_sar_den = 1;
-    p_dec->fmt_out.video.i_rmask = 0x80800000; /* Since librsvg v1.0 */
-    p_dec->fmt_out.video.i_gmask = 0x0000ff00;
-    p_dec->fmt_out.video.i_bmask = 0x000000ff;
-    video_format_FixRgb(&p_dec->fmt_out.video);
+    p_dec->fmt_out.video.i_rmask = 0;
+    p_dec->fmt_out.video.i_gmask = 0;
+    p_dec->fmt_out.video.i_bmask = 0;
 
     /* Get a new picture */
     if( decoder_UpdateVideoFormat( p_dec ) )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/22a3d9d20fcfc46a0d88c5ca8daffb72236ce43a...399bd1cb729b4d8d90e960eb423e2bb7edf5aa9c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/22a3d9d20fcfc46a0d88c5ca8daffb72236ce43a...399bd1cb729b4d8d90e960eb423e2bb7edf5aa9c
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