<html><head></head><body><div class="gmail_quote">Le 26 juin 2017 19:20:10 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 | 36 ++++++++++++--------------<br /> modules/video_filter/deinterlace/deinterlace.h | 8 +++---<br /> 2 files changed, 20 insertions(+), 24 deletions(-)<br /><br />diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c<br />index c87d9d6b2c..00194eb59d 100644<br />--- a/modules/video_filter/deinterlace/deinterlace.c<br />+++ b/modules/video_filter/deinterlace/deinterlace.c<br />@@ -316,15 +316,11 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> <br /> /* Slide the metadata history. */<br /> for( int i = 1; i < METADATA_SIZE; i++ )<br />- {<br />- p_sys->meta.pi_date[i-1] = p_sys->meta.pi_date[i];<br />- p_sys->meta.pi_nb_fields[i-1] = p_sys->meta.pi_nb_fields[i];<br />- p_sys->meta.pb_top_field_first[i-1] = p_sys->meta.pb_top_field_first[i];<br />- }<br />+ p_sys->meta[i-1] = p_sys->meta[i];<br /> /* The last element corresponds to the current input frame. */<br />- p_sys->meta.pi_date[METADATA_SIZE-1] = p_pic->date;<br />- p_sys->meta.pi_nb_fields[METADATA_SIZE-1] = p_pic->i_nb_fields;<br />- p_sys->meta.pb_top_field_first[METADATA_SIZE-1] = p_pic->b_top_field_first;<br />+ p_sys->meta[METADATA_SIZE-1].pi_date = p_pic->date;<br />+ p_sys->meta[METADATA_SIZE-1].pi_nb_fields = p_pic->i_nb_fields;<br />+ p_sys->meta[METADATA_SIZE-1].pb_top_field_first = p_pic->b_top_field_first;<br /> <br /> /* Remember the frame offset that we should use for this frame.<br /> The value in p_sys will be updated to reflect the correct value<br />@@ -338,8 +334,8 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> if( i_frame_offset != CUSTOM_PTS )<br /> {<br /> /* Pick the correct values from the history. */<br />- b_top_field_first = p_sys->meta.pb_top_field_first[i_meta_idx];<br />- i_nb_fields = p_sys->meta.pi_nb_fields[i_meta_idx];<br />+ b_top_field_first = p_sys->meta[i_meta_idx].pb_top_field_first;<br />+ i_nb_fields = p_sys->meta[i_meta_idx].pi_nb_fields;<br /> }<br /> else<br /> {<br />@@ -374,7 +370,7 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> /* Find oldest valid logged date.<br /> The current input frame doesn't count. */<br /> for( ; i < iend; i++ )<br />- if( p_sys->meta.pi_date[i] > VLC_TS_INVALID )<br />+ if( p_sys->meta[i].pi_date > VLC_TS_INVALID )<br /> break;<br /> if( i < iend )<br /> {<br />@@ -382,9 +378,9 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<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.pi_nb_fields[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.pi_date[i]) / i_fields_total;<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 />@@ -512,7 +508,7 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> assert( i_frame_offset <= METADATA_SIZE || i_frame_offset == CUSTOM_PTS );<br /> if( i_frame_offset != CUSTOM_PTS )<br /> {<br />- mtime_t i_base_pts = p_sys->meta.pi_date[i_meta_idx];<br />+ mtime_t i_base_pts = p_sys->meta[i_meta_idx].pi_date;<br /> <br /> /* Note: in the usual case (i_frame_offset = 0 and<br /> b_double_rate = false), this effectively does nothing.<br />@@ -568,9 +564,9 @@ void Flush( filter_t *p_filter )<br /> <br /> for( int i = 0; i < METADATA_SIZE; i++ )<br /> {<br />- p_sys->meta.pi_date[i] = VLC_TS_INVALID;<br />- p_sys->meta.pi_nb_fields[i] = 2;<br />- p_sys->meta.pb_top_field_first[i] = true;<br />+ p_sys->meta[i].pi_date = VLC_TS_INVALID;<br />+ p_sys->meta[i].pi_nb_fields = 2;<br />+ p_sys->meta[i].pb_top_field_first = true;<br /> }<br /> p_sys->i_frame_offset = 0; /* reset to default value (first frame after<br /> flush cannot have offset) */<br />@@ -653,9 +649,9 @@ notsupp:<br /> <br /> for( int i = 0; i < METADATA_SIZE; i++ )<br /> {<br />- p_sys->meta.pi_date[i] = VLC_TS_INVALID;<br />- p_sys->meta.pi_nb_fields[i] = 2;<br />- p_sys->meta.pb_top_field_first[i] = true;<br />+ p_sys->meta[i].pi_date = VLC_TS_INVALID;<br />+ p_sys->meta[i].pi_nb_fields = 2;<br />+ p_sys->meta[i].pb_top_field_first = true;<br /> }<br /> p_sys->i_frame_offset = 0; /* start with default value (first-ever frame<br /> cannot have offset) */<br />diff --git a/modules/video_filter/deinterlace/deinterlace.h b/modules/video_filter/deinterlace/deinterlace.h<br />index 618db45e7c..93ae1d255b 100644<br />--- a/modules/video_filter/deinterlace/deinterlace.h<br />+++ b/modules/video_filter/deinterlace/deinterlace.h<br />@@ -77,9 +77,9 @@ typedef enum { DEINTERLACE_DISCARD, DEINTERLACE_MEAN, DEINTERLACE_BLEND,<br /> * @see Deinterlace()<br /> */<br /> typedef struct {<br />- mtime_t pi_date[METADATA_SIZE];<br />- int pi_nb_fields[METADATA_SIZE];<br />- bool pb_top_field_first[METADATA_SIZE];<br />+ mtime_t pi_date;<br />+ int pi_nb_fields;<br />+ bool pb_top_field_first;<br /> } metadata_history_t;<br /> <br /> #define HISTORY_SIZE (3)<br />@@ -109,7 +109,7 @@ struct filter_sys_t<br /> * Metadata history (PTS, nb_fields, TFF). Used for framerate doublers.<br /> * @see metadata_history_t<br /> */<br />- metadata_history_t meta;<br />+ metadata_history_t meta[METADATA_SIZE];<br /> <br /> /** Output frame timing / framerate doubler control<br /> (see extra documentation in deinterlace.h) */</pre></blockquote></div><br clear="all">LGTM.<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>