[vlc-commits] deinterlace: assume the field duration from the output framerate
Steve Lhomme
git at videolan.org
Sat Jul 1 19:23:52 CEST 2017
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Tue Jun 27 14:53:17 2017 +0200| [eb2cf8c1a2689369a356d4b5dfbd8db4275a3509] | committer: Jean-Baptiste Kempf
deinterlace: assume the field duration from the output framerate
If we don't have the field/frame history
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb2cf8c1a2689369a356d4b5dfbd8db4275a3509
---
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
More information about the vlc-commits
mailing list