Commit dfa08f13 authored by Jean-Paul Saman's avatar Jean-Paul Saman

rawvideo: do not memcpy but use the block data pointer as picture data

Manual backport of commit-id: edcd9df100cf1e8daa502d257c6d9543a0e1c45d
parent 5983f314
...@@ -267,24 +267,42 @@ static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic ) ...@@ -267,24 +267,42 @@ static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic )
{ {
int i_plane; int i_plane;
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t *p_src = p_block->p_buffer;
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ ) if( p_pic->i_type == MEMORY_PICTURE )
{ {
int i_pitch = p_pic->p[i_plane].i_pitch; free( p_pic->p_data_orig );
int i_visible_pitch = p_pic->p[i_plane].i_visible_pitch; p_pic->p_data_orig = p_block;
int i_visible_lines = p_pic->p[i_plane].i_visible_lines;
uint8_t *p_dst = p_pic->p[i_plane].p_pixels; p_pic->p_data = p_block->p_buffer;
uint8_t *p_dst_end = p_dst+i_pitch*i_visible_lines;
/* Fill the p_pixels field for each plane */
if( p_sys->b_invert ) p_pic->p[0].p_pixels = p_pic->p_data;
for( p_dst_end -= i_pitch; p_dst <= p_dst_end; for( int i = 1; i < p_pic->i_planes; i++ )
p_dst_end -= i_pitch, p_src += i_visible_pitch ) p_pic->p[i].p_pixels = p_pic->p[i-1].p_pixels +
vlc_memcpy( p_dst_end, p_src, i_visible_pitch ); p_pic->p[i-1].i_lines * p_pic->p[i-1].i_pitch;
else }
for( ; p_dst < p_dst_end; else
p_dst += i_pitch, p_src += i_visible_pitch ) {
vlc_memcpy( p_dst, p_src, i_visible_pitch ); uint8_t *p_src = p_block->p_buffer;
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
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 )
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 );
}
block_Release( p_block );
} }
} }
...@@ -309,7 +327,6 @@ static picture_t *DecodeFrame( decoder_t *p_dec, block_t *p_block ) ...@@ -309,7 +327,6 @@ static picture_t *DecodeFrame( decoder_t *p_dec, block_t *p_block )
p_pic->date = date_Get( &p_sys->pts ); p_pic->date = date_Get( &p_sys->pts );
p_pic->b_progressive = true; p_pic->b_progressive = true;
block_Release( p_block );
return p_pic; return p_pic;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment