Commit bd83a7c2 authored by Antoine Cellerier's avatar Antoine Cellerier

Export function to copy pixels between 2 plane_t structures.

parent b6255f25
...@@ -176,6 +176,7 @@ static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_ ...@@ -176,6 +176,7 @@ static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_
* only the compatible(smaller) part will be copied. * only the compatible(smaller) part will be copied.
*/ */
VLC_EXPORT( void, picture_CopyPixels, ( picture_t *p_dst, const picture_t *p_src ) ); VLC_EXPORT( void, picture_CopyPixels, ( picture_t *p_dst, const picture_t *p_src ) );
VLC_EXPORT( void, plane_CopyPixels, ( plane_t *p_dst, const plane_t *p_src ) );
/** /**
* This function will copy both picture dynamic properties and pixels. * This function will copy both picture dynamic properties and pixels.
......
...@@ -259,6 +259,7 @@ path_sanitize ...@@ -259,6 +259,7 @@ path_sanitize
picture_CopyPixels picture_CopyPixels
picture_Delete picture_Delete
picture_New picture_New
plane_CopyPixels
playlist_Add playlist_Add
playlist_AddExt playlist_AddExt
playlist_AddInput playlist_AddInput
......
...@@ -1053,23 +1053,27 @@ void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src ) ...@@ -1053,23 +1053,27 @@ void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src )
int i; int i;
for( i = 0; i < p_src->i_planes ; i++ ) for( i = 0; i < p_src->i_planes ; i++ )
{ plane_CopyPixels( p_dst->p+i, p_src->p+i );
const unsigned i_width = __MIN( p_dst->p[i].i_visible_pitch, }
p_src->p[i].i_visible_pitch );
const unsigned i_height = __MIN( p_dst->p[i].i_visible_lines,
p_src->p[i].i_visible_lines );
if( p_src->p[i].i_pitch == p_dst->p[i].i_pitch ) void plane_CopyPixels( plane_t *p_dst, const plane_t *p_src )
{
const unsigned i_width = __MIN( p_dst->i_visible_pitch,
p_src->i_visible_pitch );
const unsigned i_height = __MIN( p_dst->i_visible_lines,
p_src->i_visible_lines );
if( p_src->i_pitch == p_dst->i_pitch )
{ {
/* There are margins, but with the same width : perfect ! */ /* There are margins, but with the same width : perfect ! */
vlc_memcpy( p_dst->p[i].p_pixels, p_src->p[i].p_pixels, vlc_memcpy( p_dst->p_pixels, p_src->p_pixels,
p_src->p[i].i_pitch * i_height ); p_src->i_pitch * i_height );
} }
else else
{ {
/* We need to proceed line by line */ /* We need to proceed line by line */
uint8_t *p_in = p_src->p[i].p_pixels; uint8_t *p_in = p_src->p_pixels;
uint8_t *p_out = p_dst->p[i].p_pixels; uint8_t *p_out = p_dst->p_pixels;
int i_line; int i_line;
assert( p_in ); assert( p_in );
...@@ -1078,9 +1082,8 @@ void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src ) ...@@ -1078,9 +1082,8 @@ void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src )
for( i_line = i_height; i_line--; ) for( i_line = i_height; i_line--; )
{ {
vlc_memcpy( p_out, p_in, i_width ); vlc_memcpy( p_out, p_in, i_width );
p_in += p_src->p[i].i_pitch; p_in += p_src->i_pitch;
p_out += p_dst->p[i].i_pitch; p_out += p_dst->i_pitch;
}
} }
} }
} }
......
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