[vlc-devel] [PATCH] Fixing avi with raw video padding issue

Gal Vinograd bl3nderb at aol.com
Sun Nov 3 02:33:14 CET 2013


this patch fix the padding issue with playing avi files with raw video codec. according to the specification every raw line of video should be padded to multiples of 4.
here are the faulty files:
http://speedy.sh/x9bVq/test-odd253-rgb-highspeed.avi
http://speedy.sh/54jA8/test-odd253-8b-highspeed.avi

reffering to Remi Denis-Courmont comments

reffering to Rémi Denis-Courmont comments (2nd)
---
 modules/codec/rawvideo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index f2db545..06fa9ec 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -292,13 +292,14 @@ static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic )
     {
         int i_pitch = p_pic->p[i_plane].i_pitch;
         int i_visible_pitch = p_sys->planes[i_plane].i_visible_pitch;
+        int i_padded_visible_pitch = i_visible_pitch + 4 - (i_visible_pitch % 4);
         int i_visible_lines = p_sys->planes[i_plane].i_visible_lines;
         uint8_t *p_dst = p_pic->p[i_plane].p_pixels;
         uint8_t *p_dst_end = p_dst+i_pitch*i_visible_lines;
 
         if( p_sys->b_invert )
             for( p_dst_end -= i_pitch; p_dst <= p_dst_end;
-                 p_dst_end -= i_pitch, p_src += i_visible_pitch )
+                 p_dst_end -= i_pitch, p_src += i_padded_visible_pitch )
                 memcpy( p_dst_end, p_src, i_visible_pitch );
         else
             for( ; p_dst < p_dst_end;
-- 
1.8.3.2




More information about the vlc-devel mailing list