[vlc-devel] commit: x264: avoid one memcpy (Ilkka Ollakka )
git version control
git at videolan.org
Wed Dec 23 21:29:16 CET 2009
vlc | branch: master | Ilkka Ollakka <ileoo at iki.fi> | Sun Dec 20 16:51:00 2009 +0200| [baced9d2b5707f5728d80e18c5d40a1742a59a19] | committer: Ilkka Ollakka
x264: avoid one memcpy
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=baced9d2b5707f5728d80e18c5d40a1742a59a19
---
modules/codec/x264.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index e03bb4f..66892d0 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -1216,15 +1216,20 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
if( !i_nal ) return NULL;
+
+ /* Get size of block we need */
for( i = 0, i_out = 0; i < i_nal; i++ )
- {
- memcpy( p_sys->p_buffer + i_out, nal[i].p_payload, nal[i].i_payload );
i_out += nal[i].i_payload;
- }
p_block = block_New( p_enc, i_out );
if( !p_block ) return NULL;
- memcpy( p_block->p_buffer, p_sys->p_buffer, i_out );
+
+ /* copy encoded data directly to block, instead taking via p_sys->p_buffer */
+ for( i = 0, i_out = 0; i < i_nal; i++ )
+ {
+ memcpy( p_block->p_buffer + i_out, nal[i].p_payload, nal[i].i_payload );
+ i_out += nal[i].i_payload;
+ }
if( pic.i_type == X264_TYPE_IDR || pic.i_type == X264_TYPE_I )
p_block->i_flags |= BLOCK_FLAG_TYPE_I;
More information about the vlc-devel
mailing list