[vlc-commits] video_filter: wave: fix YUV10/RGB black pixel

Thomas Guillem git at videolan.org
Fri Mar 16 16:08:24 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 16 09:05:42 2018 +0100| [64abb0250ed5cd7f258176c25688f2bc298031d7] | committer: Thomas Guillem

video_filter: wave: fix YUV10/RGB black pixel

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64abb0250ed5cd7f258176c25688f2bc298031d7
---

 modules/video_filter/wave.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/modules/video_filter/wave.c b/modules/video_filter/wave.c
index 8fce37128b..c3ba3921b1 100644
--- a/modules/video_filter/wave.c
+++ b/modules/video_filter/wave.c
@@ -140,7 +140,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     {
         int i_num_lines, i_visible_pitch, i_pixel_pitch, i_offset,
             i_visible_pixels;
-        uint8_t black_pixel;
+        uint16_t black_pixel;
         uint8_t *p_in, *p_out;
 
         p_in = p_pic->p[i_index].p_pixels;
@@ -149,17 +149,26 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         i_num_lines = p_pic->p[i_index].i_visible_lines;
         i_visible_pitch = p_pic->p[i_index].i_visible_pitch;
         i_pixel_pitch = p_pic->p[i_index].i_pixel_pitch;
+
         switch( p_filter->fmt_in.video.i_chroma )
         {
+            CASE_PLANAR_YUV10
+                black_pixel = ( p_pic->i_planes > 1 && i_index == Y_PLANE ) ? 0x00
+                                                                            : 0x200;
+                break;
             CASE_PACKED_YUV_422
                 // Quick hack to fix u/v inversion occuring with 2 byte pixel pitch
                 i_pixel_pitch *= 2;
+                /* fallthrough */
+            CASE_PLANAR_YUV
+                black_pixel = ( p_pic->i_planes > 1 && i_index == Y_PLANE ) ? 0x00
+                                                                            : 0x80;
                 break;
+            default:
+                black_pixel = 0x00;
         }
-        i_visible_pixels = i_visible_pitch/i_pixel_pitch;
 
-        black_pixel = ( p_pic->i_planes > 1 && i_index == Y_PLANE ) ? 0x00
-                                                                    : 0x80;
+        i_visible_pixels = i_visible_pitch/i_pixel_pitch;
 
         /* Ok, we do 3 times the sin() calculation for each line. So what ? */
         for( int i_line = 0 ; i_line < i_num_lines ; i_line++ )
@@ -172,22 +181,32 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
             if( i_offset )
             {
+                void *p_black_out;
                 if( i_offset < 0 )
                 {
                     memcpy( p_out, p_in - i_offset,
                                 i_visible_pitch + i_offset );
                     p_in += p_pic->p[i_index].i_pitch;
                     p_out += p_outpic->p[i_index].i_pitch;
-                    memset( p_out + i_offset, black_pixel, -i_offset );
+                    p_black_out = &p_out[i_offset];
+                    i_offset = -i_offset;
                 }
                 else
                 {
                     memcpy( p_out + i_offset, p_in,
                                 i_visible_pitch - i_offset );
-                    memset( p_out, black_pixel, i_offset );
+                    p_black_out = p_out;
                     p_in += p_pic->p[i_index].i_pitch;
                     p_out += p_outpic->p[i_index].i_pitch;
                 }
+                if (black_pixel > 0xFF)
+                {
+                    uint16_t *p_out16 = p_black_out;
+                    for (int x = 0; x < i_offset; x += 2)
+                        *p_out16++ = black_pixel;
+                }
+                else
+                    memset( p_black_out, black_pixel, i_offset );
             }
             else
             {



More information about the vlc-commits mailing list