[vlc-devel] [PATCH] yuvp: Work around alpha being ignored when scaling

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Feb 15 11:36:01 CET 2017


This is a not-so-great fix for #15983
When swscale will scale the subpicture, it will ignore the alpha
component when interpolation is performed.
In the case of dvbsub, this often causes the filling color to be rendered as
green on the edges of region subparts.
---
 modules/video_chroma/yuvp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/video_chroma/yuvp.c b/modules/video_chroma/yuvp.c
index af66d6a7bd..ea702f5cc8 100644
--- a/modules/video_chroma/yuvp.c
+++ b/modules/video_chroma/yuvp.c
@@ -155,6 +155,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         const uint8_t a = p_filter->fmt_out.video.i_chroma == VLC_CODEC_ARGB ? 0 : 3;
         for( int i = 0; i < p_yuvp->i_entries; i++ )
         {
+            if( p_yuvp->palette[i][3] == 0 )
+            {
+                memset( rgbp.palette[i], 0, sizeof( rgbp.palette[i] ) );
+                continue;
+            }
             Yuv2Rgb( &rgbp.palette[i][r], &rgbp.palette[i][g], &rgbp.palette[i][b],
                      p_yuvp->palette[i][0], p_yuvp->palette[i][1], p_yuvp->palette[i][2] );
             rgbp.palette[i][a] = p_yuvp->palette[i][3];
-- 
2.11.0



More information about the vlc-devel mailing list