[vlc-commits] [Git][videolan/vlc][master] 4 commits: i420_rgb: replace RGB2PIXEL(0, 0, 0) with 0
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Oct 5 08:59:46 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
d9780971 by Steve Lhomme at 2023-10-05T08:38:13+00:00
i420_rgb: replace RGB2PIXEL(0,0,0) with 0
It's clearer to signify the value is 0 (black). We could also use a define
for black.
All the filling of read, green and blue to 0 might be equivalent to a
big memset().
RGB2PIXEL() is only used when shifting is needed.
- - - - -
ba73bb1e by Steve Lhomme at 2023-10-05T08:38:13+00:00
i420_rgb: fix RGB2PIXEL for 32-bit/24-bit RGB chromas
The right shift values are initialized to 0 as these chromas use a whole
octet per color.
- - - - -
e9096068 by Steve Lhomme at 2023-10-05T08:38:13+00:00
i420_rgb: map VLC_CODEC_RGB565 like VLC_CODEC_RGB16
- - - - -
8137f1b1 by Steve Lhomme at 2023-10-05T08:38:13+00:00
i420_rgb: map VLC_CODEC_RGB555 like VLC_CODEC_RGB15
- - - - -
1 changed file:
- modules/video_chroma/i420_rgb.c
Changes:
=====================================
modules/video_chroma/i420_rgb.c
=====================================
@@ -111,6 +111,16 @@ static int Activate( filter_t *p_filter )
switch( p_filter->fmt_out.video.i_chroma )
{
#ifndef PLUGIN_PLAIN
+ case VLC_CODEC_RGB565:
+ /* R5G6B5 pixel format */
+ msg_Dbg(p_filter, "RGB pixel format is R5G6B5");
+ p_filter->ops = &I420_R5G6B5_ops;
+ break;
+ case VLC_CODEC_RGB555:
+ /* R5G5B5 pixel format */
+ msg_Dbg(p_filter, "RGB pixel format is R5G5B5");
+ p_filter->ops = &I420_R5G5B5_ops;
+ break;
case VLC_CODEC_RGB15:
case VLC_CODEC_RGB16:
/* If we don't have support for the bitmasks, bail out */
@@ -161,6 +171,10 @@ static int Activate( filter_t *p_filter )
break;
case VLC_CODEC_RGB15:
case VLC_CODEC_RGB16:
+ case VLC_CODEC_RGB565:
+ case VLC_CODEC_BGR565:
+ case VLC_CODEC_RGB555:
+ case VLC_CODEC_BGR555:
p_filter->ops = &I420_RGB16_ops;
break;
case VLC_CODEC_XRGB:
@@ -197,6 +211,14 @@ static int Activate( filter_t *p_filter )
#endif
case VLC_CODEC_RGB15:
case VLC_CODEC_RGB16:
+ case VLC_CODEC_RGB565BE:
+ case VLC_CODEC_BGR565BE:
+ case VLC_CODEC_RGB565LE:
+ case VLC_CODEC_BGR565LE:
+ case VLC_CODEC_RGB555BE:
+ case VLC_CODEC_BGR555BE:
+ case VLC_CODEC_RGB555LE:
+ case VLC_CODEC_BGR555LE:
p_sys->i_bytespp = 2;
break;
case VLC_CODEC_XRGB:
@@ -268,15 +290,71 @@ static void Deactivate( filter_t *p_filter )
static void SetYUV( filter_t *p_filter, const video_format_t *vfmt )
{
filter_sys_t *p_sys = p_filter->p_sys;
- unsigned i_lrshift = ctz(vfmt->i_rmask);
- unsigned i_lgshift = ctz(vfmt->i_gmask);
- unsigned i_lbshift = ctz(vfmt->i_bmask);
- unsigned i_rrshift = 8 - vlc_popcount(vfmt->i_rmask);
- unsigned i_rgshift = 8 - vlc_popcount(vfmt->i_gmask);
- unsigned i_rbshift = 8 - vlc_popcount(vfmt->i_bmask);
+ unsigned i_lrshift, i_lgshift, i_lbshift;
+ unsigned i_rrshift = 0;
+ unsigned i_rgshift = 0;
+ unsigned i_rbshift = 0;
switch (p_filter->fmt_out.video.i_chroma)
{
+ case VLC_CODEC_XRGB:
+ case VLC_CODEC_RGB24:
+ i_lrshift = 16;
+ i_lgshift = 8;
+ i_lbshift = 0;
+ break;
+ case VLC_CODEC_XBGR:
+ case VLC_CODEC_BGR24:
+ i_lbshift = 16;
+ i_lgshift = 8;
+ i_lrshift = 0;
+ break;
+ case VLC_CODEC_RGBX:
+ i_lrshift = 24;
+ i_lgshift = 16;
+ i_lbshift = 8;
+ break;
+ case VLC_CODEC_BGRX:
+ i_lbshift = 24;
+ i_lgshift = 16;
+ i_lrshift = 8;
+ break;
+ case VLC_CODEC_RGB565BE:
+ case VLC_CODEC_RGB565LE:
+ i_lrshift = 11;
+ i_lgshift = 6;
+ i_lbshift = 0;
+ i_rrshift = 3;
+ i_rgshift = 2;
+ i_rbshift = 3;
+ break;
+ case VLC_CODEC_BGR565BE:
+ case VLC_CODEC_BGR565LE:
+ i_lbshift = 11;
+ i_lgshift = 6;
+ i_lrshift = 0;
+ i_rbshift = 3;
+ i_rgshift = 2;
+ i_rrshift = 3;
+ break;
+ case VLC_CODEC_RGB555BE:
+ case VLC_CODEC_RGB555LE:
+ i_lrshift = 10;
+ i_lgshift = 5;
+ i_lbshift = 0;
+ i_rrshift = 3;
+ i_rgshift = 3;
+ i_rbshift = 3;
+ break;
+ case VLC_CODEC_BGR555BE:
+ case VLC_CODEC_BGR555LE:
+ i_lbshift = 10;
+ i_lgshift = 5;
+ i_lrshift = 0;
+ i_rbshift = 3;
+ i_rgshift = 3;
+ i_rrshift = 3;
+ break;
case VLC_CODEC_RGB233:
i_lrshift = 6;
i_lgshift = 3;
@@ -302,6 +380,12 @@ static void SetYUV( filter_t *p_filter, const video_format_t *vfmt )
i_rbshift = 6;
break;
default:
+ i_lrshift = ctz(vfmt->i_rmask);
+ i_lgshift = ctz(vfmt->i_gmask);
+ i_lbshift = ctz(vfmt->i_bmask);
+ i_rrshift = 8 - vlc_popcount(vfmt->i_rmask);
+ i_rgshift = 8 - vlc_popcount(vfmt->i_gmask);
+ i_rbshift = 8 - vlc_popcount(vfmt->i_bmask);
break;
}
@@ -321,20 +405,28 @@ static void SetYUV( filter_t *p_filter, const video_format_t *vfmt )
case VLC_CODEC_RGB15:
case VLC_CODEC_RGB16:
+ case VLC_CODEC_RGB565BE:
+ case VLC_CODEC_BGR565BE:
+ case VLC_CODEC_RGB565LE:
+ case VLC_CODEC_BGR565LE:
+ case VLC_CODEC_RGB555BE:
+ case VLC_CODEC_BGR555BE:
+ case VLC_CODEC_RGB555LE:
+ case VLC_CODEC_BGR555LE:
p_sys->p_rgb16 = (uint16_t *)p_sys->p_base;
for( unsigned i_index = 0; i_index < RED_MARGIN; i_index++ )
{
- p_sys->p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( 0, 0, 0 );
+ p_sys->p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = 0;
p_sys->p_rgb16[RED_OFFSET + 256 + i_index] = RGB2PIXEL( 255, 0, 0 );
}
for( unsigned i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
- p_sys->p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( 0, 0, 0 );
+ p_sys->p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = 0;
p_sys->p_rgb16[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( 0, 255, 0 );
}
for( unsigned i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
- p_sys->p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( 0, 0, 0 );
+ p_sys->p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = 0;
p_sys->p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( 0, 0, 255 );
}
for( unsigned i_index = 0; i_index < 256; i_index++ )
@@ -354,17 +446,17 @@ static void SetYUV( filter_t *p_filter, const video_format_t *vfmt )
p_sys->p_rgb32 = (uint32_t *)p_sys->p_base;
for( unsigned i_index = 0; i_index < RED_MARGIN; i_index++ )
{
- p_sys->p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( 0, 0, 0 );
+ p_sys->p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = 0;
p_sys->p_rgb32[RED_OFFSET + 256 + i_index] = RGB2PIXEL( 255, 0, 0 );
}
for( unsigned i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
- p_sys->p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( 0, 0, 0 );
+ p_sys->p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = 0;
p_sys->p_rgb32[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( 0, 255, 0 );
}
for( unsigned i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
- p_sys->p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( 0, 0, 0 );
+ p_sys->p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = 0;
p_sys->p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( 0, 0, 255 );
}
for( unsigned i_index = 0; i_index < 256; i_index++ )
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0fadbab6a6084ad9df19015dfce8efaba8fd3013...8137f1b179a5264f472e7b2bded7773525cd6d6a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0fadbab6a6084ad9df19015dfce8efaba8fd3013...8137f1b179a5264f472e7b2bded7773525cd6d6a
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