Changeset 121f9617f801728fc45c68853c92587f98629c01

Show
Ignore:
Timestamp:
26/05/08 15:11:43 (5 months ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1211807503 +0200
git-parent:

[3c810a5543257b87078822429e554e23bf45643d]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1211807503 +0200
Message:

Fix the rawvideo codec when visible_pitch != pitch. (And simplify code) This should fix partial screen captures using non multiple of 16 values.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/codec/rawvideo.c

    r4e8ff11 r121f961  
    258258static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic ) 
    259259{ 
    260     uint8_t *p_src, *p_dst; 
    261     int i_plane, i_line, i_width; 
     260    int i_plane; 
    262261    decoder_sys_t *p_sys = p_dec->p_sys; 
    263  
    264     p_src = p_block->p_buffer; 
     262    uint8_t *p_src = p_block->p_buffer; 
    265263 
    266264    for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ ) 
    267265    { 
    268         p_dst = p_pic->p[i_plane].p_pixels; 
    269         i_width = p_pic->p[i_plane].i_pitch; 
     266        int i_pitch = p_pic->p[i_plane].i_pitch; 
     267        int i_visible_pitch = p_pic->p[i_plane].i_visible_pitch; 
     268        int i_visible_lines = p_pic->p[i_plane].i_visible_lines; 
     269        uint8_t *p_dst = p_pic->p[i_plane].p_pixels; 
     270        uint8_t *p_dst_end = p_dst+i_pitch*i_visible_lines; 
    270271 
    271272        if( p_sys->b_invert ) 
    272             p_src += (i_width * (p_pic->p[i_plane].i_visible_lines - 1)); 
    273  
    274         for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ ) 
    275         { 
    276             vlc_memcpy( p_dst, p_src, i_width ); 
    277             p_src += p_sys->b_invert ? -i_width : i_width; 
    278             p_dst += i_width; 
    279         } 
    280  
    281         if( p_sys->b_invert ) 
    282             p_src += (i_width * (p_pic->p[i_plane].i_visible_lines + 1)); 
     273            for( p_dst_end -= i_pitch; p_dst <= p_dst_end; 
     274                 p_dst_end -= i_pitch, p_src += i_visible_pitch ) 
     275                vlc_memcpy( p_dst_end, p_src, i_visible_pitch ); 
     276        else 
     277            for( ; p_dst < p_dst_end; 
     278                 p_dst += i_pitch, p_src += i_visible_pitch ) 
     279                vlc_memcpy( p_dst, p_src, i_visible_pitch ); 
    283280    } 
    284281}