[vlc-commits] [Git][videolan/vlc][master] 4 commits: blend: keep the 16-bit mask locally
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Oct 4 17:10:13 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
0b050357 by Steve Lhomme at 2023-10-04T16:46:45+00:00
blend: keep the 16-bit mask locally
This will be needed to hardcode some masks.
- - - - -
6dd55215 by Steve Lhomme at 2023-10-04T16:46:45+00:00
blend: split the mask reading in convertRgbToRgbSmall
Don't use the mask directly as some chromas may no have a mask.
- - - - -
7e1cdbc3 by Steve Lhomme at 2023-10-04T16:46:45+00:00
blend: support common RGB16 chromas
- - - - -
554a6eb9 by Steve Lhomme at 2023-10-04T16:46:45+00:00
blend: support common RGB15 chromas
- - - - -
1 changed file:
- modules/video_filter/blend.cpp
Changes:
=====================================
modules/video_filter/blend.cpp
=====================================
@@ -331,21 +331,53 @@ private:
class CPictureRGB16 : public CPicture {
private:
+ uint32_t rmask, gmask, bmask;
unsigned rshift, gshift, bshift;
public:
CPictureRGB16(const CPicture &cfg) : CPicture(cfg)
{
data = CPicture::getLine<1>(0);
- rshift = vlc_ctz(fmt->i_rmask);
- gshift = vlc_ctz(fmt->i_gmask);
- bshift = vlc_ctz(fmt->i_bmask);
+ switch (fmt->i_chroma)
+ {
+ case VLC_CODEC_RGB565:
+ rmask = 0xf800;
+ gmask = 0x07e0;
+ bmask = 0x001f;
+ break;
+ case VLC_CODEC_BGR565:
+ bmask = 0xf800;
+ gmask = 0x07e0;
+ rmask = 0x001f;
+ break;
+ case VLC_CODEC_RGB555:
+ rmask = 0x7c00;
+ gmask = 0x03e0;
+ bmask = 0x001f;
+ break;
+ case VLC_CODEC_BGR555:
+ bmask = 0x7c00;
+ gmask = 0x03e0;
+ rmask = 0x001f;
+ break;
+ case VLC_CODEC_RGB16:
+ case VLC_CODEC_RGB15:
+ rmask = fmt->i_rmask;
+ gmask = fmt->i_gmask;
+ bmask = fmt->i_bmask;
+ break;
+ default:
+ vlc_assert_unreachable();
+ }
+ rshift = vlc_ctz(rmask);
+ gshift = vlc_ctz(gmask);
+ bshift = vlc_ctz(bmask);
}
void get(CPixel *px, unsigned dx, bool = true) const
{
const uint16_t data = *getPointer(dx);
- px->i = (data & fmt->i_rmask) >> rshift;
- px->j = (data & fmt->i_gmask) >> gshift;
- px->k = (data & fmt->i_bmask) >> bshift;
+ px->i = (data & rmask) >> rshift;
+ px->j = (data & gmask) >> gshift;
+ px->k = (data & bmask) >> bshift;
}
void merge(unsigned dx, const CPixel &spx, unsigned a, bool full)
{
@@ -459,9 +491,41 @@ struct convertYuv8ToRgb {
struct convertRgbToRgbSmall {
convertRgbToRgbSmall(const video_format_t *dst, const video_format_t *)
{
- rshift = 8 - vlc_popcount(dst->i_rmask);
- bshift = 8 - vlc_popcount(dst->i_bmask);
- gshift = 8 - vlc_popcount(dst->i_gmask);
+ uint32_t rmask, gmask, bmask;
+ switch (dst->i_chroma)
+ {
+ case VLC_CODEC_RGB565:
+ rmask = 0xf800;
+ gmask = 0x07e0;
+ bmask = 0x001f;
+ break;
+ case VLC_CODEC_BGR565:
+ bmask = 0xf800;
+ gmask = 0x07e0;
+ rmask = 0x001f;
+ break;
+ case VLC_CODEC_RGB555:
+ rmask = 0x7c00;
+ gmask = 0x03e0;
+ bmask = 0x001f;
+ break;
+ case VLC_CODEC_BGR555:
+ bmask = 0x7c00;
+ gmask = 0x03e0;
+ rmask = 0x001f;
+ break;
+ case VLC_CODEC_RGB16:
+ case VLC_CODEC_RGB15:
+ rmask = dst->i_rmask;
+ gmask = dst->i_gmask;
+ bmask = dst->i_bmask;
+ break;
+ default:
+ vlc_assert_unreachable();
+ }
+ rshift = 8 - vlc_popcount(rmask);
+ bshift = 8 - vlc_popcount(bmask);
+ gshift = 8 - vlc_popcount(gmask);
}
void operator()(CPixel &p)
{
@@ -575,7 +639,11 @@ static const struct {
{ csp, VLC_CODEC_YUVP, Blend<picture, CPictureYUVP, compose<cvt, convertYuvpToYuva8> > }
RGB(VLC_CODEC_RGB15, CPictureRGB16, convertRgbToRgbSmall),
+ RGB(VLC_CODEC_RGB555, CPictureRGB16, convertRgbToRgbSmall),
+ RGB(VLC_CODEC_BGR555, CPictureRGB16, convertRgbToRgbSmall),
RGB(VLC_CODEC_RGB16, CPictureRGB16, convertRgbToRgbSmall),
+ RGB(VLC_CODEC_RGB565, CPictureRGB16, convertRgbToRgbSmall),
+ RGB(VLC_CODEC_BGR565, CPictureRGB16, convertRgbToRgbSmall),
RGB(VLC_CODEC_RGB24, CPictureRGB24, convertNone),
RGB(VLC_CODEC_BGR24, CPictureRGB24, convertNone),
RGB(VLC_CODEC_RGBA, CPictureRGBA, convertNone),
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/77f57b0592d9c5702db01f1e8acf772f6607c568...554a6eb9c4d7e5afdfe0b5f5427130cf0e2c4dd6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/77f57b0592d9c5702db01f1e8acf772f6607c568...554a6eb9c4d7e5afdfe0b5f5427130cf0e2c4dd6
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