summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-02 23:03:40 +0200
committerwm4 <wm4@nowhere>2019-10-02 23:13:26 +0200
commit8c58375dbd968fff22c9ef5a473c456657c5fc78 (patch)
tree6f22faae1bb409b3efabff89334cab2cad3e2946
parent9b55009e8f6e81bdc19172b4469b58646464dc80 (diff)
downloadmpv-8c58375dbd968fff22c9ef5a473c456657c5fc78.tar.bz2
mpv-8c58375dbd968fff22c9ef5a473c456657c5fc78.tar.xz
f_auto_filters: use f_autoconvert for hw download
Instead of using custom code. Now if only f_lavfi knew what formats FFmpeg's vf_yadif accepts, this could look much nicer, and wouldn't require the additional converter filter setup.
-rw-r--r--filters/f_auto_filters.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/filters/f_auto_filters.c b/filters/f_auto_filters.c
index b94cfabf29..d0bab83d2c 100644
--- a/filters/f_auto_filters.c
+++ b/filters/f_auto_filters.c
@@ -8,6 +8,7 @@
#include "video/mp_image_pool.h"
#include "f_auto_filters.h"
+#include "f_autoconvert.h"
#include "f_hwtransfer.h"
#include "f_swscale.h"
#include "f_utils.h"
@@ -79,32 +80,30 @@ static void deint_process(struct mp_filter *f)
p->sub.filter =
mp_create_user_filter(f, MP_OUTPUT_CHAIN_VIDEO, "yadif_cuda", args);
} else {
- int sw_format = img->imgfmt;
-
- if (img->hwctx)
- sw_format = mp_image_hw_download_get_sw_format(img);
-
- if (mp_sws_supports_input(sw_format)) {
- struct mp_filter *subf = mp_bidir_dummy_filter_create(f);
- struct mp_filter *filters[2] = {0};
-
- if (sw_format != img->imgfmt) {
- struct mp_hwdownload *hwd = mp_hwdownload_create(subf);
- filters[0] = hwd->f;
+ struct mp_filter *subf = mp_bidir_dummy_filter_create(f);
+ struct mp_filter *filters[2] = {0};
+
+ struct mp_autoconvert *ac = mp_autoconvert_create(subf);
+ if (ac) {
+ filters[0] = ac->f;
+ // We know vf_yadif does not support hw inputs.
+ mp_autoconvert_add_all_sw_imgfmts(ac);
+
+ if (!mp_autoconvert_probe_input_video(ac, img)) {
+ MP_ERR(f, "no deinterlace filter available for format %s\n",
+ mp_imgfmt_to_name(img->imgfmt));
+ talloc_free(subf);
+ mp_subfilter_continue(&p->sub);
+ return;
}
+ }
- char *args[] = {"mode", "send_field", NULL};
- filters[1] =
- mp_create_user_filter(subf, MP_OUTPUT_CHAIN_VIDEO, "yadif", args);
+ char *args[] = {"mode", "send_field", NULL};
+ filters[1] =
+ mp_create_user_filter(subf, MP_OUTPUT_CHAIN_VIDEO, "yadif", args);
- mp_chain_filters(subf->ppins[0], subf->ppins[1], filters, 2);
- p->sub.filter = subf;
- } else {
- MP_ERR(f, "no deinterlace filter available for format %s\n",
- mp_imgfmt_to_name(img->imgfmt));
- mp_subfilter_continue(&p->sub);
- return;
- }
+ mp_chain_filters(subf->ppins[0], subf->ppins[1], filters, 2);
+ p->sub.filter = subf;
}
if (!p->sub.filter)