vaapipostproc: reset deinterlacer state when there is a discontinuity.

Reset deinterlacer state, i.e. past reference frames used for advanced
deinterlacing, when there is some discontinuity detected in the course
of processing source buffers.

This fixes support for advanced deinterlacing when a seek occurred.

https://bugzilla.gnome.org/show_bug.cgi?id=720375

[fixed type of pts_diff variable, fetch previous buffer PTS from the
 history buffer, reduce heuristic for detecting discontinuity]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Zhao, Halley 2013-12-12 10:01:13 +08:00 committed by Gwenole Beauchesne
parent b3401dbb29
commit faefd62e9b

View file

@ -513,6 +513,20 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
deint_changed = deint != ds->deint;
if (deint_changed || (ds->num_surfaces > 0 && tff != ds->tff))
ds_reset(ds);
deint_method = postproc->deinterlace_method;
deint_refs = deint_method_is_advanced(deint_method);
if (deint_refs) {
GstBuffer * const prev_buf = ds_get_buffer(ds, 0);
GstClockTime prev_pts, pts = GST_BUFFER_TIMESTAMP(inbuf);
/* Reset deinterlacing state when there is a discontinuity */
if (prev_buf && (prev_pts = GST_BUFFER_TIMESTAMP(prev_buf)) != pts) {
const GstClockTimeDiff pts_diff = GST_CLOCK_DIFF(prev_pts, pts);
if (pts_diff < 0 || pts_diff > postproc->field_duration * 2)
ds_reset(ds);
}
}
ds->deint = deint;
ds->tff = tff;
@ -520,8 +534,6 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
~GST_VAAPI_PICTURE_STRUCTURE_MASK;
/* First field */
deint_method = postproc->deinterlace_method;
deint_refs = deint_method_is_advanced(deint_method);
if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_DEINTERLACE) {
fieldbuf = create_output_buffer(postproc);
if (!fieldbuf)