[vlc-devel] commit: Export function to copy pixels between 2 plane_t structures. ( Antoine Cellerier )

git version control git at videolan.org
Sun Aug 24 15:57:40 CEST 2008


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Sun Aug 24 15:35:09 2008 +0200| [bd83a7c2c6407df668eee8e028cca62a081cd0e0] | committer: Antoine Cellerier 

Export function to copy pixels between 2 plane_t structures.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd83a7c2c6407df668eee8e028cca62a081cd0e0
---

 include/vlc_vout.h               |    1 +
 src/libvlccore.sym               |    1 +
 src/video_output/vout_pictures.c |   53 ++++++++++++++++++++------------------
 3 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 47fc3fd..74e0db1 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -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.
  */
 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.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 5790f97..05acc07 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -259,6 +259,7 @@ path_sanitize
 picture_CopyPixels
 picture_Delete
 picture_New
+plane_CopyPixels
 playlist_Add
 playlist_AddExt
 playlist_AddInput
diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index da603e7..f49bb57 100644
--- a/src/video_output/vout_pictures.c
+++ b/src/video_output/vout_pictures.c
@@ -1053,34 +1053,37 @@ void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src )
     int i;
 
     for( i = 0; i < p_src->i_planes ; 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 );
+        plane_CopyPixels( p_dst->p+i, p_src->p+i );
+}
 
-        if( p_src->p[i].i_pitch == p_dst->p[i].i_pitch )
-        {
-            /* There are margins, but with the same width : perfect ! */
-            vlc_memcpy( p_dst->p[i].p_pixels, p_src->p[i].p_pixels,
-                        p_src->p[i].i_pitch * i_height );
-        }
-        else
-        {
-            /* We need to proceed line by line */
-            uint8_t *p_in = p_src->p[i].p_pixels;
-            uint8_t *p_out = p_dst->p[i].p_pixels;
-            int i_line;
+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 );
 
-            assert( p_in );
-            assert( p_out );
+    if( p_src->i_pitch == p_dst->i_pitch )
+    {
+        /* There are margins, but with the same width : perfect ! */
+        vlc_memcpy( p_dst->p_pixels, p_src->p_pixels,
+                    p_src->i_pitch * i_height );
+    }
+    else
+    {
+        /* We need to proceed line by line */
+        uint8_t *p_in = p_src->p_pixels;
+        uint8_t *p_out = p_dst->p_pixels;
+        int i_line;
 
-            for( i_line = i_height; i_line--; )
-            {
-                vlc_memcpy( p_out, p_in, i_width );
-                p_in += p_src->p[i].i_pitch;
-                p_out += p_dst->p[i].i_pitch;
-            }
+        assert( p_in );
+        assert( p_out );
+
+        for( i_line = i_height; i_line--; )
+        {
+            vlc_memcpy( p_out, p_in, i_width );
+            p_in += p_src->i_pitch;
+            p_out += p_dst->i_pitch;
         }
     }
 }




More information about the vlc-devel mailing list