From c2997aa7deb6a400a91977651bc09ed8183b57c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 30 Aug 2024 23:06:01 +0200 Subject: [PATCH] vf_d3d11vpp: add output format selection --- DOCS/man/vf.rst | 7 +++++++ video/filter/vf_d3d11vpp.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst index 68c7837996..150b180f3d 100644 --- a/DOCS/man/vf.rst +++ b/DOCS/man/vf.rst @@ -691,6 +691,13 @@ Available mpv-only filters are: with hardware decoding. Software frames are automatically uploaded to hardware for processing. + ``format`` + Convert to the selected image format, e.g., nv12, p010, etc. (default: don't change). + Format names can be queried with ``--vf=d3d11vpp=format=help``. + Note that only a limited subset is supported, and actual support depends + on your hardware. Normally, this shouldn't be changed unless some + processing only works with a specific format, in which case it can be + selected here. ``deint=`` Whether deinterlacing is enabled (default: no). ``scale`` diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c index b30d1d3011..8a149950e6 100644 --- a/video/filter/vf_d3d11vpp.c +++ b/video/filter/vf_d3d11vpp.c @@ -79,6 +79,7 @@ struct opts { bool interlaced_only; int mode; int field_parity; + int format; }; struct priv { @@ -467,6 +468,9 @@ static void vf_d3d11vpp_process(struct mp_filter *vf) p->out_params.crop.y0 = lrintf(p->opts->scale * p->out_params.crop.y0); p->out_params.crop.y1 = lrintf(p->opts->scale * p->out_params.crop.y1); + if (p->opts->format) + p->out_params.hw_subfmt = p->opts->format; + p->require_filtering = p->params.hw_subfmt != p->out_params.hw_subfmt || p->params.w != p->out_params.w || p->params.h != p->out_params.h; @@ -599,6 +603,7 @@ fail: #define OPT_BASE_STRUCT struct opts static const m_option_t vf_opts_fields[] = { + {"format", OPT_IMAGEFORMAT(format)}, {"deint", OPT_BOOL(deint_enabled)}, {"scale", OPT_FLOAT(scale)}, {"scaling-mode", OPT_CHOICE(scaling_mode,