vf_d3d11vpp: add output format selection

This commit is contained in:
Kacper Michajłow
2024-08-30 23:06:01 +02:00
parent c4d85fc0c4
commit c2997aa7de
2 changed files with 12 additions and 0 deletions

View File

@@ -691,6 +691,13 @@ Available mpv-only filters are:
with hardware decoding. Software frames are automatically uploaded to hardware with hardware decoding. Software frames are automatically uploaded to hardware
for processing. 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=<yes|no>`` ``deint=<yes|no>``
Whether deinterlacing is enabled (default: no). Whether deinterlacing is enabled (default: no).
``scale`` ``scale``

View File

@@ -79,6 +79,7 @@ struct opts {
bool interlaced_only; bool interlaced_only;
int mode; int mode;
int field_parity; int field_parity;
int format;
}; };
struct priv { 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.y0 = lrintf(p->opts->scale * p->out_params.crop.y0);
p->out_params.crop.y1 = lrintf(p->opts->scale * p->out_params.crop.y1); 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->require_filtering = p->params.hw_subfmt != p->out_params.hw_subfmt ||
p->params.w != p->out_params.w || p->params.w != p->out_params.w ||
p->params.h != p->out_params.h; p->params.h != p->out_params.h;
@@ -599,6 +603,7 @@ fail:
#define OPT_BASE_STRUCT struct opts #define OPT_BASE_STRUCT struct opts
static const m_option_t vf_opts_fields[] = { static const m_option_t vf_opts_fields[] = {
{"format", OPT_IMAGEFORMAT(format)},
{"deint", OPT_BOOL(deint_enabled)}, {"deint", OPT_BOOL(deint_enabled)},
{"scale", OPT_FLOAT(scale)}, {"scale", OPT_FLOAT(scale)},
{"scaling-mode", OPT_CHOICE(scaling_mode, {"scaling-mode", OPT_CHOICE(scaling_mode,