summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_vavpp.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/filter/vf_vavpp.c')
-rw-r--r--video/filter/vf_vavpp.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c
index 4e39affd41..54648e124c 100644
--- a/video/filter/vf_vavpp.c
+++ b/video/filter/vf_vavpp.c
@@ -71,6 +71,16 @@ static const struct vf_priv_s vf_priv_default = {
.deint_type = 2,
};
+// The array items must match with the "deint" suboption values.
+static const int deint_algorithm[] = {
+ [0] = VAProcDeinterlacingNone,
+ [1] = VAProcDeinterlacingNone, // first-field, special-cased
+ [2] = VAProcDeinterlacingBob,
+ [3] = VAProcDeinterlacingWeave,
+ [4] = VAProcDeinterlacingMotionAdaptive,
+ [5] = VAProcDeinterlacingMotionCompensated,
+};
+
static inline void realloc_refs(struct surface_refs *refs, int num)
{
if (refs->num_allocated < num) {
@@ -192,7 +202,8 @@ static int process(struct vf_instance *vf, struct mp_image *in,
if (!*out1) // cannot render
return 0;
mp_image_copy_attributes(*out1, in);
- if (field == VA_FRAME_PICTURE || p->deint_type < 2) // first-field only
+ // first-field only
+ if (field == VA_FRAME_PICTURE || (p->do_deint && p->deint_type < 2))
return 1;
const double add = (in->pts - p->prev_pts)*0.5;
if (p->prev_pts == MP_NOPTS_VALUE || add <= 0.0 || add > 0.5) // no pts, skip it
@@ -353,15 +364,15 @@ static bool initialize(struct vf_instance *vf)
buffers[i] = VA_INVALID_ID;
for (int i=0; i<num_filters; ++i) {
if (filters[i] == VAProcFilterDeinterlacing) {
- if (!p->deint_type)
+ if (p->deint_type < 2)
continue;
VAProcFilterCapDeinterlacing caps[VAProcDeinterlacingCount];
int num = va_query_filter_caps(vf, VAProcFilterDeinterlacing, caps,
VAProcDeinterlacingCount);
if (!num)
continue;
- VAProcDeinterlacingType algorithm = VAProcDeinterlacingBob;
- for (int n=0; n < num; n++) { // find Bob
+ VAProcDeinterlacingType algorithm = deint_algorithm[p->deint_type];
+ for (int n=0; n < num; n++) { // find the algorithm
if (caps[n].type != algorithm)
continue;
VAProcFilterParameterBufferDeinterlacing param;
@@ -370,13 +381,13 @@ static bool initialize(struct vf_instance *vf)
buffers[VAProcFilterDeinterlacing] =
va_create_filter_buffer(vf, sizeof(param), 1, &param);
}
+ if (buffers[VAProcFilterDeinterlacing] == VA_INVALID_ID)
+ MP_WARN(vf, "Selected deinterlacing algorithm not supported.\n");
} // check other filters
}
p->num_buffers = 0;
if (buffers[VAProcFilterDeinterlacing] != VA_INVALID_ID)
p->buffers[p->num_buffers++] = buffers[VAProcFilterDeinterlacing];
- else
- p->deint_type = 0;
p->do_deint = !!p->deint_type;
// next filters: p->buffers[p->num_buffers++] = buffers[next_filter];
return true;
@@ -407,9 +418,13 @@ static int vf_open(vf_instance_t *vf)
#define OPT_BASE_STRUCT struct vf_priv_s
static const m_option_t vf_opts_fields[] = {
OPT_CHOICE("deint", deint_type, 0,
+ // The values must match with deint_algorithm[].
({"no", 0},
{"first-field", 1},
- {"bob", 2})),
+ {"bob", 2},
+ {"weave", 3},
+ {"motion-adaptive", 4},
+ {"motion-compensated", 5})),
{0}
};