summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-25 21:53:25 +0200
committerwm4 <wm4@nowhere>2016-05-25 23:51:24 +0200
commit68191fdca7c3e76d619998f612a66dd028885baa (patch)
tree3118c41507ab3987a1a593e6fe8f7dd3d22491ef /video
parent5353571de07c5f2545d697cce286651178df9108 (diff)
downloadmpv-68191fdca7c3e76d619998f612a66dd028885baa.tar.bz2
mpv-68191fdca7c3e76d619998f612a66dd028885baa.tar.xz
vf_vavpp: simplify update_pipeline() usage
Calling this right at start of filter_ext() also fixes a small regression from previous commit. The change in reference surfaces due to the first update_pipeline() with deinterlacing enabled changed behavior of mp_refqueue_next() and mp_refqueue_has_output(). Since update_pipeline() was called between those, the frame output logic got inconsistent, and the first deinterlaced frame was duplicated from the previous non-deinterlaced frame. Also reset the number of ref-frames when switching back to non-deint mode.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_vavpp.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c
index b62724f357..7dc6680ad0 100644
--- a/video/filter/vf_vavpp.c
+++ b/video/filter/vf_vavpp.c
@@ -103,39 +103,43 @@ static void flush_frames(struct vf_instance *vf)
mp_refqueue_flush(p->queue);
}
-static bool update_pipeline(struct vf_instance *vf, bool deint)
+static void update_pipeline(struct vf_instance *vf)
{
struct vf_priv_s *p = vf->priv;
VABufferID *filters = p->buffers;
int num_filters = p->num_buffers;
- if (p->deint_type && !deint) {
+ if (p->deint_type && !p->do_deint) {
filters++;
num_filters--;
}
if (filters == p->pipe.filters && num_filters == p->pipe.num_filters)
- return true;
+ return; /* cached state is correct */
p->pipe.forward.num_surfaces = p->pipe.backward.num_surfaces = 0;
p->pipe.num_input_colors = p->pipe.num_output_colors = 0;
p->pipe.num_filters = 0;
p->pipe.filters = NULL;
if (!num_filters)
- return false;
- VAProcPipelineCaps caps;
- caps.input_color_standards = p->pipe.input_colors;
- caps.output_color_standards = p->pipe.output_colors;
- caps.num_input_color_standards = VAProcColorStandardCount;
- caps.num_output_color_standards = VAProcColorStandardCount;
+ goto nodeint;
+ VAProcPipelineCaps caps = {
+ .input_color_standards = p->pipe.input_colors,
+ .output_color_standards = p->pipe.output_colors,
+ .num_input_color_standards = VAProcColorStandardCount,
+ .num_output_color_standards = VAProcColorStandardCount,
+ };
VAStatus status = vaQueryVideoProcPipelineCaps(p->display, p->context,
filters, num_filters, &caps);
if (!check_error(vf, status, "vaQueryVideoProcPipelineCaps()"))
- return false;
+ goto nodeint;
p->pipe.filters = filters;
p->pipe.num_filters = num_filters;
p->pipe.num_input_colors = caps.num_input_color_standards;
p->pipe.num_output_colors = caps.num_output_color_standards;
mp_refqueue_set_refs(p->queue, caps.num_backward_references,
caps.num_forward_references);
- return true;
+ return;
+
+nodeint:
+ mp_refqueue_set_refs(p->queue, 0, 0);
}
static inline int get_deint_field(struct vf_priv_s *p, int i,
@@ -236,8 +240,7 @@ static void output_frames(struct vf_instance *vf)
struct mp_image *in = mp_refqueue_get(p->queue, 0);
- bool deint = p->do_deint && p->deint_type > 0;
- if (!update_pipeline(vf, deint) || !p->pipe.filters) { // no filtering
+ if (!p->pipe.num_filters) { // no filtering
vf_add_output_frame(vf, mp_image_new_ref(in));
return;
}
@@ -287,6 +290,8 @@ static int filter_ext(struct vf_instance *vf, struct mp_image *in)
{
struct vf_priv_s *p = vf->priv;
+ update_pipeline(vf);
+
if (in && in->imgfmt != IMGFMT_VAAPI) {
struct mp_image *tmp = upload(vf, in);
talloc_free(in);