Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
feada68e by François Cartegnie at 2026-01-15T09:23:53+00:00
codec: avcodec: fix mask mappings for 32 bits RGB
The macros can not handle alpha channel properly,
as it does not only requires reassigning channels
but shifting.
Mapping to/from RGB32 also loses alpha information.
We can not rely on AV native macros for this and
need to declare chroma with fixed alpha position
Could also modify the macro to add left or right
shifts parameters and even less readable for 2 chromas.
(cherry picked from commit 081a0e62a0d68a62fd5fe96407eaa15cb4cf367c) (edited)
edited:
- VLC 3.0 doesn't have VLC_CODEC_ABGR
- - - - -
1 changed file:
- modules/codec/avcodec/chroma.c
Changes:
=====================================
modules/codec/avcodec/chroma.c
=====================================
@@ -142,13 +142,12 @@ static const struct
VLC_RGB( VLC_CODEC_RGB15, AV_PIX_FMT_RGB555, AV_PIX_FMT_BGR555, 0x7c00,
0x03e0, 0x001f )
VLC_RGB( VLC_CODEC_RGB16, AV_PIX_FMT_RGB565, AV_PIX_FMT_BGR565, 0xf800,
0x07e0, 0x001f )
VLC_RGB( VLC_CODEC_RGB24, AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, 0xff0000,
0x00ff00, 0x0000ff )
+ VLC_RGB( VLC_CODEC_RGB32, AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR, 0x00ff0000,
0x0000ff00, 0x000000ff)
+ VLC_RGB( VLC_CODEC_RGB32, AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0, 0xff000000,
0x00ff0000, 0x0000ff00)
- VLC_RGB( VLC_CODEC_RGB32, AV_PIX_FMT_RGB32, AV_PIX_FMT_BGR32, 0x00ff0000,
0x0000ff00, 0x000000ff )
- VLC_RGB( VLC_CODEC_RGB32, AV_PIX_FMT_RGB32_1, AV_PIX_FMT_BGR32_1,
0xff000000, 0x00ff0000, 0x0000ff00 )
-
-#ifdef AV_PIX_FMT_0BGR32
- VLC_RGB( VLC_CODEC_RGB32, AV_PIX_FMT_0BGR32, AV_PIX_FMT_0RGB32,
0x000000ff, 0x0000ff00, 0x00ff0000 )
-#endif
+ {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 },
#if (LIBAVUTIL_VERSION_MICRO == 0 || LIBAVUTIL_VERSION_CHECK( 55, 0, 100 ) )
#ifdef WORDS_BIGENDIAN
@@ -158,9 +157,6 @@ static const struct
#endif /* !WORDS_BIGENDIAN */
#endif
- {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_GREY, AV_PIX_FMT_GRAY8, 0, 0, 0},
#ifdef AV_PIX_FMT_GRAY10
{VLC_CODEC_GREY_10L, AV_PIX_FMT_GRAY10LE, 0, 0, 0},
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/commit/feada68ef67ff6d94e39e7b63ffdef3203aa5563
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/commit/feada68ef67ff6d94e39e7b63ffdef3203aa5563
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits