diff options
author | wm4 <wm4@nowhere> | 2018-02-12 18:44:46 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-02-13 17:45:29 -0800 |
commit | 4107a8be6ccd843378414704e69225168e3494f9 (patch) | |
tree | 94408f8ea65db801e060ca695f0fd867ba39652b /video/filter | |
parent | 6b2b2b75b9f27af3d0e8b115cca75de8903d36a4 (diff) | |
download | mpv-4107a8be6ccd843378414704e69225168e3494f9.tar.bz2 mpv-4107a8be6ccd843378414704e69225168e3494f9.tar.xz |
vf_vavpp: select best quality deinterlacing algorithm by default
This switches the default away from "bob" to the best algorithm reported
as supported by the driver. This is convenient for users, and there is
no reason to use something worse by default.
Untested.
Diffstat (limited to 'video/filter')
-rw-r--r-- | video/filter/vf_vavpp.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c index 598997ca24..8c41ba8734 100644 --- a/video/filter/vf_vavpp.c +++ b/video/filter/vf_vavpp.c @@ -86,6 +86,7 @@ static void add_surfaces(struct priv *p, struct surface_refs *refs, int dir) } // The array items must match with the "deint" suboption values. +// They're also sorted by quality. static const int deint_algorithm[] = { [0] = VAProcDeinterlacingNone, [1] = VAProcDeinterlacingBob, // first-field, special-cased @@ -376,13 +377,26 @@ static bool initialize(struct mp_filter *vf) buffers[i] = VA_INVALID_ID; for (int i = 0; i < num_filters; i++) { if (filters[i] == VAProcFilterDeinterlacing) { - if (p->opts->deint_type < 1) - continue; VAProcFilterCapDeinterlacing caps[VAProcDeinterlacingCount]; int num = va_query_filter_caps(vf, VAProcFilterDeinterlacing, caps, VAProcDeinterlacingCount); if (!num) continue; + if (p->opts->deint_type < 0) { + for (int n = MP_ARRAY_SIZE(deint_algorithm) - 1; n > 0; n--) { + for (int x = 0; x < num; x++) { + if (caps[x].type == deint_algorithm[n]) { + p->opts->deint_type = n; + MP_VERBOSE(vf, "Selected deinterlacing algorithm: " + "%d\n", deint_algorithm[n]); + goto found; + } + } + } + found: ; + } + if (p->opts->deint_type <= 0) + continue; VAProcDeinterlacingType algorithm = deint_algorithm[p->opts->deint_type]; for (int n=0; n < num; n++) { // find the algorithm @@ -398,6 +412,8 @@ static bool initialize(struct mp_filter *vf) MP_WARN(vf, "Selected deinterlacing algorithm not supported.\n"); } // check other filters } + if (p->opts->deint_type < 0) + p->opts->deint_type = 0; p->num_buffers = 0; if (buffers[VAProcFilterDeinterlacing] != VA_INVALID_ID) p->buffers[p->num_buffers++] = buffers[VAProcFilterDeinterlacing]; @@ -456,8 +472,9 @@ error: #define OPT_BASE_STRUCT struct opts static const m_option_t vf_opts_fields[] = { OPT_CHOICE("deint", deint_type, 0, - // The values must match with deint_algorithm[]. - ({"no", 0}, + // The values >=0 must match with deint_algorithm[]. + ({"auto", -1}, + {"no", 0}, {"first-field", 1}, {"bob", 2}, {"weave", 3}, @@ -474,7 +491,7 @@ const struct mp_user_filter_entry vf_vavpp = { .name = "vavpp", .priv_size = sizeof(OPT_BASE_STRUCT), .priv_defaults = &(const OPT_BASE_STRUCT){ - .deint_type = 2, + .deint_type = -1, .interlaced_only = 0, .reversal_bug = 1, }, |