<html><head></head><body><div class="gmail_quote">Le 26 juin 2017 19:20:11 GMT+02:00, Steve Lhomme <robux4@videolabs.io> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">---<br /> modules/video_filter/deinterlace/deinterlace.c | 57 +++++++++++++++-----------<br /> 1 file changed, 32 insertions(+), 25 deletions(-)<br /><br />diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c<br />index 00194eb59d..2be5422c3a 100644<br />--- a/modules/video_filter/deinterlace/deinterlace.c<br />+++ b/modules/video_filter/deinterlace/deinterlace.c<br />@@ -279,6 +279,37 @@ static void GetOutputFormat( filter_t *p_filter,<br /> <br /> #define DEINTERLACE_DST_SIZE 3<br /> <br />+static mtime_t GetFieldDuration( metadata_history_t meta[static METADATA_SIZE],<br />+ picture_t *p_pic )<br />+{<br />+ mtime_t i_field_dur = 0;<br />+<br />+ /* Calculate one field duration. */<br />+ int i = 0;<br />+ int iend = METADATA_SIZE-1;<br />+ /* Find oldest valid logged date.<br />+ The current input frame doesn't count. */<br />+ for( ; i < iend; i++ )<br />+ if( meta[i].pi_date > VLC_TS_INVALID )<br />+ break;<br />+ if( i < iend )<br />+ {<br />+ /* Count how many fields the valid history entries<br />+ (except the new frame) represent. */<br />+ int i_fields_total = 0;<br />+ for( int j = i ; j < iend; j++ )<br />+ i_fields_total += meta[j].pi_nb_fields;<br />+ /* One field took this long. */<br />+ i_field_dur = (p_pic->date - meta[i].pi_date) / i_fields_total;<br />+ }<br />+ /* Note that we default to field duration 0 if it could not be<br />+ determined. This behaves the same as the old code - leaving the<br />+ extra output frame dates the same as p_pic->date if the last cached<br />+ date was not valid.<br />+ */<br />+ return i_field_dur;<br />+}<br />+<br /> /* This is the filter function. See Open(). */<br /> picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> {<br />@@ -356,7 +387,6 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> <br /> /* For framerate doublers, determine field duration and allocate<br /> output frames. */<br />- mtime_t i_field_dur = 0;<br /> int i_double_rate_alloc_end = 0; /* One past last for allocated output<br /> frames in p_dst[]. Used only for<br /> framerate doublers. Will be inited<br />@@ -364,30 +394,6 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> PTS logic needs the result. */<br /> if( p_sys->b_double_rate )<br /> {<br />- /* Calculate one field duration. */<br />- int i = 0;<br />- int iend = METADATA_SIZE-1;<br />- /* Find oldest valid logged date.<br />- The current input frame doesn't count. */<br />- for( ; i < iend; i++ )<br />- if( p_sys->meta[i].pi_date > VLC_TS_INVALID )<br />- break;<br />- if( i < iend )<br />- {<br />- /* Count how many fields the valid history entries<br />- (except the new frame) represent. */<br />- int i_fields_total = 0;<br />- for( int j = i ; j < iend; j++ )<br />- i_fields_total += p_sys->meta[j].pi_nb_fields;<br />- /* One field took this long. */<br />- i_field_dur = (p_pic->date - p_sys->meta[i].pi_date) / i_fields_total;<br />- }<br />- /* Note that we default to field duration 0 if it could not be<br />- determined. This behaves the same as the old code - leaving the<br />- extra output frame dates the same as p_pic->date if the last cached<br />- date was not valid.<br />- */<br />-<br /> i_double_rate_alloc_end = i_nb_fields;<br /> if( i_nb_fields > DEINTERLACE_DST_SIZE )<br /> {<br />@@ -518,6 +524,7 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> <br /> if( p_sys->b_double_rate )<br /> {<br />+ mtime_t i_field_dur = GetFieldDuration( p_sys->meta, p_pic );<br /> /* Processing all actually allocated output frames. */<br /> for( int i = 1; i < i_double_rate_alloc_end; ++i )<br /> {</pre></blockquote></div><br clear="all">Probably ok<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>