[vlc-devel] [PATCH 1/2] image converter: prepare for using multithreaded encoder

Rafaël Carré funman at videolan.org
Wed May 29 23:00:52 CEST 2013


Le 29/05/2013 18:55, Rémi Denis-Courmont a écrit :
> Maybe I am being stupid, but I would expect a code comment. In any case, I 
> fail to recognize the logic/rationale.

I agree a comment should be added.

The rationale is to flush the encoder output, as the first call to
pf_encode_video did not return a picture.

See libavcodec/ff_thread_video_encode_frame.c in FFmpeg :
    *pkt = *(AVPacket*)(task.outdata);

It is weird that this is needed for intra-only encoders (with no
lookahead) especially when we're encoding a single picture so help from
FFmpeg developers is welcome.

> Le mardi 28 mai 2013 12:30:55, Rafaël Carré a écrit :
>> ---
>>  src/misc/image.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/src/misc/image.c b/src/misc/image.c
>> index 2ce3f9c..6d2a6a0 100644
>> --- a/src/misc/image.c
>> +++ b/src/misc/image.c
>> @@ -345,6 +345,8 @@ static block_t *ImageWrite( image_handler_t *p_image,
>> picture_t *p_pic, {
>>              p_block = p_image->p_enc->pf_encode_video( p_image->p_enc,
>>                                                         p_tmp_pic );
>> +            if (!p_block)
>> +                p_block = p_image->p_enc->pf_encode_video( p_image->p_enc,
>> NULL ); p_image->p_filter->pf_video_buffer_del( p_image->p_filter,
>> p_tmp_pic );
>>          }
>> @@ -354,6 +356,8 @@ static block_t *ImageWrite( image_handler_t *p_image,
>> picture_t *p_pic, else
>>      {
>>          p_block = p_image->p_enc->pf_encode_video( p_image->p_enc, p_pic
>> ); +        if (!p_block)
>> +            p_block = p_image->p_enc->pf_encode_video( p_image->p_enc,
>> NULL ); }
>>
>>      if( !p_block )
> 




More information about the vlc-devel mailing list