vf_d3d11vpp: add video processor selection

Unfortunately completely useless. I still don't know how to force a
video processor to use a specific algorithm, if it's even possible.
This commit is contained in:
wm4 2016-07-15 19:48:58 +02:00
parent 831fc4f012
commit 358932a109
2 changed files with 26 additions and 5 deletions

View File

@ -821,6 +821,12 @@ Available filters are:
Whether deinterlacing is enabled (default: no). Whether deinterlacing is enabled (default: no).
``interlaced-only=<yes|no>`` ``interlaced-only=<yes|no>``
If ``yes`` (default), only deinterlace frames marked as interlaced. If ``yes`` (default), only deinterlace frames marked as interlaced.
``mode=<blend|bob|adaptive|mocomp|ivctc|none>``
Tries to select a video processor with the given processing capability.
If a video processor supports multiple capabilities, it is not clear
which algorithm is actually selected. ``none`` always falls back. On
most if not all hardware, this option will probably do nothing, because
a video processor usually supports all modes or none.
``buffer=<num>`` ``buffer=<num>``
Buffer ``<num>`` frames in the filter chain. This filter is probably pretty Buffer ``<num>`` frames in the filter chain. This filter is probably pretty

View File

@ -29,7 +29,12 @@
#include "video/mp_image_pool.h" #include "video/mp_image_pool.h"
// missing in MinGW // missing in MinGW
#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND 0x1
#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB 0x2 #define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB 0x2
#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE 0x4
#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION 0x8
#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE 0x10
#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION 0x20
struct vf_priv_s { struct vf_priv_s {
ID3D11Device *vo_dev; ID3D11Device *vo_dev;
@ -57,6 +62,7 @@ struct vf_priv_s {
int deint_enabled; int deint_enabled;
int interlaced_only; int interlaced_only;
int mode;
}; };
static void release_tex(void *arg) static void release_tex(void *arg)
@ -159,8 +165,8 @@ static int recreate_video_proc(struct vf_instance *vf)
if (FAILED(hr)) if (FAILED(hr))
goto fail; goto fail;
MP_VERBOSE(vf, "Found %d rate conversion caps.\n", MP_VERBOSE(vf, "Found %d rate conversion caps. Looking for caps=0x%x.\n",
(int)caps.RateConversionCapsCount); (int)caps.RateConversionCapsCount, p->mode);
int rindex = -1; int rindex = -1;
for (int n = 0; n < caps.RateConversionCapsCount; n++) { for (int n = 0; n < caps.RateConversionCapsCount; n++) {
@ -170,8 +176,7 @@ static int recreate_video_proc(struct vf_instance *vf)
if (FAILED(hr)) if (FAILED(hr))
goto fail; goto fail;
MP_VERBOSE(vf, " - %d: 0x%08x\n", n, (unsigned)rcaps.ProcessorCaps); MP_VERBOSE(vf, " - %d: 0x%08x\n", n, (unsigned)rcaps.ProcessorCaps);
if (rcaps.ProcessorCaps & D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB) if (rcaps.ProcessorCaps & p->mode) {
{
MP_VERBOSE(vf, " (matching)\n"); MP_VERBOSE(vf, " (matching)\n");
if (rindex < 0) if (rindex < 0)
rindex = n; rindex = n;
@ -179,10 +184,12 @@ static int recreate_video_proc(struct vf_instance *vf)
} }
if (rindex < 0) { if (rindex < 0) {
MP_WARN(vf, "No video deinterlacing processor found.\n"); MP_WARN(vf, "No fitting video processor found, picking #0.\n");
rindex = 0; rindex = 0;
} }
// TOOD: so, how do we select which rate conversion mode the processor uses?
hr = ID3D11VideoDevice_CreateVideoProcessor(p->video_dev, p->vp_enum, rindex, hr = ID3D11VideoDevice_CreateVideoProcessor(p->video_dev, p->vp_enum, rindex,
&p->video_proc); &p->video_proc);
if (FAILED(hr)) { if (FAILED(hr)) {
@ -518,6 +525,13 @@ fail:
static const m_option_t vf_opts_fields[] = { static const m_option_t vf_opts_fields[] = {
OPT_FLAG("deint", deint_enabled, 0), OPT_FLAG("deint", deint_enabled, 0),
OPT_FLAG("interlaced-only", interlaced_only, 0), OPT_FLAG("interlaced-only", interlaced_only, 0),
OPT_CHOICE("mode", mode, 0,
({"blend", D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND},
{"bob", D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB},
{"adaptive", D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE},
{"mocomp", D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION},
{"ivctc", D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE},
{"none", 0})),
{0} {0}
}; };
@ -530,6 +544,7 @@ const vf_info_t vf_info_d3d11vpp = {
.priv_defaults = &(const struct vf_priv_s) { .priv_defaults = &(const struct vf_priv_s) {
.deint_enabled = 1, .deint_enabled = 1,
.interlaced_only = 1, .interlaced_only = 1,
.mode = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB,
}, },
.options = vf_opts_fields, .options = vf_opts_fields,
}; };