summaryrefslogtreecommitdiffstats
path: root/video/filter/refqueue.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-27 17:01:36 +0200
committerwm4 <wm4@nowhere>2016-05-27 17:03:00 +0200
commit9f42760538f02699945803f4a98b4dd8c4202774 (patch)
treec8cb4c04f42b17bf63e37f77871eac3fc2687715 /video/filter/refqueue.c
parentf8df0528b5b43bb148ceeb16732c96254e48c43e (diff)
downloadmpv-9f42760538f02699945803f4a98b4dd8c4202774.tar.bz2
mpv-9f42760538f02699945803f4a98b4dd8c4202774.tar.xz
vf_vdpaupp: use refqueue helper
This makes vf_vdpaupp use the deinterlacer helper code already used by vf_vavpp. I nice side-effect is that this also removes some traces of code originating from vo_vdpau.c, so we can switch it to LGPL. Extend the refqueue helper with a deint setting. If not set, mp_refqueue_should_deint() always returns false, which slightly simplifies vf_vdpaupp. It's of no consequence to vf_vavpp (other than it has to set it to get expected behavior).
Diffstat (limited to 'video/filter/refqueue.c')
-rw-r--r--video/filter/refqueue.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/video/filter/refqueue.c b/video/filter/refqueue.c
index 8ca0e28f91..aea535cbb6 100644
--- a/video/filter/refqueue.c
+++ b/video/filter/refqueue.c
@@ -67,7 +67,7 @@ void mp_refqueue_set_mode(struct mp_refqueue *q, int flags)
// Whether the current frame should be deinterlaced.
bool mp_refqueue_should_deint(struct mp_refqueue *q)
{
- if (!mp_refqueue_has_output(q))
+ if (!mp_refqueue_has_output(q) || !(q->flags & MP_MODE_DEINT))
return false;
return (q->queue[q->pos]->fields & MP_IMGFIELD_INTERLACED) ||
@@ -146,8 +146,7 @@ static bool output_next_field(struct mp_refqueue *q)
return false;
if (!(q->flags & MP_MODE_OUTPUT_FIELDS))
return false;
- if (!(q->queue[q->pos]->fields & MP_IMGFIELD_INTERLACED) &&
- (q->flags & MP_MODE_INTERLACED_ONLY))
+ if (!mp_refqueue_should_deint(q))
return false;
assert(q->pos >= 0);
@@ -211,3 +210,15 @@ struct mp_image *mp_refqueue_get(struct mp_refqueue *q, int pos)
int i = q->pos - pos;
return i >= 0 && i < q->num_queue ? q->queue[i] : NULL;
}
+
+// Same as mp_refqueue_get(), but return the frame which contains a field
+// relative to the current field's position.
+struct mp_image *mp_refqueue_get_field(struct mp_refqueue *q, int pos)
+{
+ // If the current field is the second field (conceptually), then pos=1
+ // needs to get the next frame. Similarly, pos=-1 needs to get the current
+ // frame, so round towards negative infinity.
+ int round = mp_refqueue_top_field_first(q) != mp_refqueue_is_top_field(q);
+ int frame = (pos < 0 ? pos - (1 - round) : pos + round) / 2;
+ return mp_refqueue_get(q, frame);
+}