[vlc-devel] [PATCH 07/19] fps: implement draining of extra pictures
Steve Lhomme
robux4 at ycbcr.xyz
Wed Oct 14 09:30:55 CEST 2020
On 2020-10-13 18:29, Rémi Denis-Courmont wrote:
> Le tiistaina 13. lokakuuta 2020, 16.51.50 EEST Steve Lhomme a écrit :
>> We no longer return pictures chained using vlc_picture_chain_AppendChain().
>>
>> p_previous_pic is the picture being filtered.
>>
>> drain_pic holds a reference on the picture that was previously returned and
>> is released once all the draining for that picture is done.
>> ---
>> modules/video_filter/fps.c | 22 +++++++++++++---------
>> 1 file changed, 13 insertions(+), 9 deletions(-)
>>
>> diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
>> index 64dd1c1fdc4..418fd9aee9a 100644
>> --- a/modules/video_filter/fps.c
>> +++ b/modules/video_filter/fps.c
>> @@ -110,24 +110,28 @@ static picture_t *Filter( filter_t *p_filter,
>> picture_t *p_picture) date_Increment( &p_sys->next_output_pts, 1 );
>>
>> picture_t *last_pic = p_sys->p_previous_pic;
>> + p_sys->p_previous_pic = p_picture;
>> + return last_pic;
>> +}
>> +
>> +static picture_t *Drain( filter_t *p_filter )
>> +{
>> + filter_sys_t *p_sys = p_filter->p_sys;
>> + picture_t *p_picture = p_sys->p_previous_pic;
>> +
>> /* Duplicating pictures are not that effective and framerate increase
>> should be avoided, it's only here as filter should work in that
>> direction too*/ - while( unlikely( (date_Get( &p_sys->next_output_pts )
>> + p_sys->i_output_frame_interval ) < p_picture->date ) ) + if( unlikely(
>> (date_Get( &p_sys->next_output_pts ) + p_sys->i_output_frame_interval ) <
>> p_picture->date ) ) {
>> picture_t *p_tmp = NULL;
>> p_tmp = picture_NewFromFormat( &p_filter->fmt_out.video );
>>
>> picture_Copy( p_tmp, p_sys->p_previous_pic);
>> p_tmp->date = date_Get( &p_sys->next_output_pts );
>> -
>> - vlc_picture_chain_AppendChain( last_pic, p_tmp );
>> - last_pic = p_tmp;
>> date_Increment( &p_sys->next_output_pts, 1 );
>> + return p_tmp;
>> }
>> -
>> - last_pic = p_sys->p_previous_pic;
>> - p_sys->p_previous_pic = p_picture;
>> - return last_pic;
>> + return NULL;
>> }
>
> That does not seem right. If the rate is actually increased, filter_video would
> presumably have to inject pictures occasionally, not just drain_video.
In increasing framerate, the (previous) source picture is always sent
with the adjusted PTS and extra picture(s) based on the same picture
with (an) extra tick. In filter+drain separated, the secondary pictures
must only be produced during the drain.
There is a system in the filter that actually sends the previous picture
and keep the new picture for the next run. There is a problem in my
implementation as it uses the "new previous_pic" in the drain when it
should be using the previous one.
>>
>> static void Close( filter_t *p_filter )
>> @@ -153,7 +157,7 @@ static void Flush( filter_t *p_filter )
>>
>> static const struct vlc_filter_operations filter_ops =
>> {
>> - .filter_video = Filter, .close = Close,
>> + .filter_video = Filter, .drain_video = Drain, .close = Close,
>> .flush = Flush,
>> };
>
>
> --
> レミ・デニ-クールモン
> http://www.remlab.net/
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list