[vlc-commits] mux/avi: compute RGB shifts from masks
Rémi Denis-Courmont
git at videolan.org
Mon Dec 17 18:46:14 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 17 19:22:46 2018 +0200| [731675f477483ace7055608bc004c16835754454] | committer: Rémi Denis-Courmont
mux/avi: compute RGB shifts from masks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=731675f477483ace7055608bc004c16835754454
---
modules/mux/avi.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/modules/mux/avi.c b/modules/mux/avi.c
index d84347447f..0f96468738 100644
--- a/modules/mux/avi.c
+++ b/modules/mux/avi.c
@@ -484,15 +484,19 @@ static int PrepareSamples( const avi_stream_t *p_stream,
(p_fmt->video.i_bmask != 0xFF0000 ||
p_fmt->video.i_rmask != 0x0000FF) )
{
+ unsigned rshift = ctz(p_fmt->video.i_rmask);
+ unsigned gshift = ctz(p_fmt->video.i_gmask);
+ unsigned bshift = ctz(p_fmt->video.i_bmask);
+
uint8_t *p_data = (*pp_block)->p_buffer;
for( size_t i=0; i<(*pp_block)->i_buffer / 3; i++ )
{
uint8_t *p = &p_data[i*3];
/* reorder as BGR using shift value (done by FixRGB) */
uint32_t v = (p[0] << 16) | (p[1] << 8) | p[2];
- p[0] = (v & p_fmt->video.i_bmask) >> p_fmt->video.i_lbshift;
- p[1] = (v & p_fmt->video.i_gmask) >> p_fmt->video.i_lgshift;
- p[2] = (v & p_fmt->video.i_rmask) >> p_fmt->video.i_lrshift;
+ p[0] = (v & p_fmt->video.i_bmask) >> bshift;
+ p[1] = (v & p_fmt->video.i_gmask) >> gshift;
+ p[2] = (v & p_fmt->video.i_rmask) >> rshift;
}
}
More information about the vlc-commits
mailing list