Commit baced9d2 authored by Ilkka Ollakka's avatar Ilkka Ollakka

x264: avoid one memcpy

parent 70439ea3
......@@ -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;
......
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