[vlc-devel] commit: Fix the rawvideo codec when visible_pitch != pitch. ( And simplify code) This should fix partial screen captures using non multiple of 16 values. ( Antoine Cellerier )
git version control
git at videolan.org
Mon May 26 15:10:11 CEST 2008
vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Mon May 26 15:11:43 2008 +0200| [121f9617f801728fc45c68853c92587f98629c01]
Fix the rawvideo codec when visible_pitch != pitch. (And simplify code) This should fix partial screen captures using non multiple of 16 values.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=121f9617f801728fc45c68853c92587f98629c01
---
modules/codec/rawvideo.c | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index 30e05b3..9c5c548 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -257,29 +257,26 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
*****************************************************************************/
static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic )
{
- uint8_t *p_src, *p_dst;
- int i_plane, i_line, i_width;
+ int i_plane;
decoder_sys_t *p_sys = p_dec->p_sys;
-
- p_src = p_block->p_buffer;
+ uint8_t *p_src = p_block->p_buffer;
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
- p_dst = p_pic->p[i_plane].p_pixels;
- i_width = p_pic->p[i_plane].i_pitch;
-
- if( p_sys->b_invert )
- p_src += (i_width * (p_pic->p[i_plane].i_visible_lines - 1));
-
- for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ )
- {
- vlc_memcpy( p_dst, p_src, i_width );
- p_src += p_sys->b_invert ? -i_width : i_width;
- p_dst += i_width;
- }
+ int i_pitch = p_pic->p[i_plane].i_pitch;
+ int i_visible_pitch = p_pic->p[i_plane].i_visible_pitch;
+ int i_visible_lines = p_pic->p[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 )
- p_src += (i_width * (p_pic->p[i_plane].i_visible_lines + 1));
+ for( p_dst_end -= i_pitch; p_dst <= p_dst_end;
+ p_dst_end -= i_pitch, p_src += i_visible_pitch )
+ vlc_memcpy( p_dst_end, p_src, i_visible_pitch );
+ else
+ for( ; p_dst < p_dst_end;
+ p_dst += i_pitch, p_src += i_visible_pitch )
+ vlc_memcpy( p_dst, p_src, i_visible_pitch );
}
}
More information about the vlc-devel
mailing list