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 | |
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.
-rw-r--r-- | DOCS/interface-changes.rst | 1 | ||||
-rw-r--r-- | DOCS/man/vf.rst | 6 | ||||
-rw-r--r-- | video/filter/vf_vavpp.c | 27 |
3 files changed, 28 insertions, 6 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index c0ec882719..e18fec4c1d 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -75,6 +75,7 @@ Interface changes - make --deinterlace=yes always deinterlace, instead of trying to check certain unreliable video metadata. Also flip the defaults of all builtin HW deinterlace filters to always deinterlace. + - change vf_vavpp default to use the best deinterlace algorithm by default --- mpv 0.28.0 --- - rename --hwdec=mediacodec option to mediacodec-copy, to reflect conventions followed by other hardware video decoding APIs diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst index 17df70f920..d979337e42 100644 --- a/DOCS/man/vf.rst +++ b/DOCS/man/vf.rst @@ -478,10 +478,14 @@ Available mpv-only filters are: no Don't perform deinterlacing. + auto + Select the best quality deinterlacing algorithm (default). This + goes by the order of the options as documented, with + ``motion-compensated`` being considered best quality. first-field Show only first field. bob - bob deinterlacing (default). + bob deinterlacing. weave, motion-adaptive, motion-compensated Advanced deinterlacing algorithms. Whether these actually work depends on the GPU hardware, the GPU drivers, driver bugs, and 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, }, |