[vlc-devel] [PATCH 11/15] video_filter:deinterlace: assume the field duration from the output framerate
Steve Lhomme
robux4 at videolabs.io
Fri Jun 30 14:20:04 CEST 2017
If we don't have the field/frame history
---
modules/video_filter/deinterlace/common.c | 6 ++++--
modules/video_filter/deinterlace/common.h | 5 +++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/video_filter/deinterlace/common.c b/modules/video_filter/deinterlace/common.c
index ec558d0ded..a1b68dc869 100644
--- a/modules/video_filter/deinterlace/common.c
+++ b/modules/video_filter/deinterlace/common.c
@@ -52,7 +52,7 @@ void FlushDeinterlacing(struct deinterlace_ctx *p_context)
}
mtime_t GetFieldDuration(const struct deinterlace_ctx *p_context,
- const picture_t *p_pic )
+ const video_format_t *fmt, const picture_t *p_pic )
{
mtime_t i_field_dur = 0;
@@ -74,6 +74,8 @@ mtime_t GetFieldDuration(const struct deinterlace_ctx *p_context,
/* One field took this long. */
i_field_dur = (p_pic->date - p_context->meta[i].pi_date) / i_fields_total;
}
+ else if (fmt->i_frame_rate_base)
+ i_field_dur = CLOCK_FREQ * fmt->i_frame_rate_base / fmt->i_frame_rate;
/* Note that we default to field duration 0 if it could not be
determined. This behaves the same as the old code - leaving the
@@ -276,7 +278,7 @@ picture_t *DoDeinterlacing( filter_t *p_filter,
if( p_context->b_double_rate )
{
- mtime_t i_field_dur = GetFieldDuration( p_context, p_pic );
+ mtime_t i_field_dur = GetFieldDuration( p_context, &p_filter->fmt_out.video, p_pic );
/* Processing all actually allocated output frames. */
for( int i = 1; i < i_double_rate_alloc_end; ++i )
{
diff --git a/modules/video_filter/deinterlace/common.h b/modules/video_filter/deinterlace/common.h
index 4f28d361e0..a8e3de430a 100644
--- a/modules/video_filter/deinterlace/common.h
+++ b/modules/video_filter/deinterlace/common.h
@@ -90,12 +90,13 @@ struct deinterlace_ctx
#define DEINTERLACE_DST_SIZE 3
/**
- * @brief Get the field duration based on the previous fields
+ * @brief Get the field duration based on the previous fields or the frame rate
+ * @param fmt output format of the deinterlacer with the frame rate
* @param p_pic the picture which field we want the duration
* @return the duration of the field or 0 if there's no known framerate
*/
mtime_t GetFieldDuration( const struct deinterlace_ctx *,
- const picture_t *p_pic );
+ const video_format_t *fmt, const picture_t *p_pic );
/**
* @brief Get the output video_format_t configured for the deinterlacer
--
2.12.1
More information about the vlc-devel
mailing list