diff options
Diffstat (limited to 'video/filter/vf_vdpaupp.c')
-rw-r--r-- | video/filter/vf_vdpaupp.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c index fe3a903558..b5434cdfbc 100644 --- a/video/filter/vf_vdpaupp.c +++ b/video/filter/vf_vdpaupp.c @@ -41,8 +41,9 @@ // processing on the final rendering process in the VO. struct opts { - int deint_enabled; - int interlaced_only; + bool deint_enabled; + bool interlaced_only; + int field_parity; struct mp_vdpau_mixer_opts opts; }; @@ -74,8 +75,7 @@ static void vf_vdpaupp_process(struct mp_filter *f) struct mp_image *mpi = mp_vdpau_mixed_frame_create(mp_refqueue_get_field(p->queue, 0)); - if (!mpi) - return; // OOM + MP_HANDLE_OOM(mpi); struct mp_vdpau_mixer_frame *frame = mp_vdpau_mixed_frame_get(mpi); if (!mp_refqueue_should_deint(p->queue)) { @@ -136,11 +136,11 @@ static struct mp_filter *vf_vdpaupp_create(struct mp_filter *parent, void *optio p->queue = mp_refqueue_alloc(f); - AVBufferRef *ref = mp_filter_load_hwdec_device(f, AV_HWDEVICE_TYPE_VDPAU); - if (!ref) + struct mp_hwdec_ctx *hwdec_ctx = + mp_filter_load_hwdec_device(f, IMGFMT_VDPAU); + if (!hwdec_ctx || !hwdec_ctx->av_device_ref) goto error; - p->ctx = mp_vdpau_get_ctx_from_av(ref); - av_buffer_unref(&ref); + p->ctx = mp_vdpau_get_ctx_from_av(hwdec_ctx->av_device_ref); if (!p->ctx) goto error; @@ -157,6 +157,8 @@ static struct mp_filter *vf_vdpaupp_create(struct mp_filter *parent, void *optio (p->opts->interlaced_only ? MP_MODE_INTERLACED_ONLY : 0) | (p->opts->opts.deint >= 2 ? MP_MODE_OUTPUT_FIELDS : 0)); + mp_refqueue_set_parity(p->queue, p->opts->field_parity); + mp_refqueue_add_in_format(p->queue, IMGFMT_VDPAU, 0); return f; @@ -168,19 +170,23 @@ error: #define OPT_BASE_STRUCT struct opts static const m_option_t vf_opts_fields[] = { - OPT_CHOICE("deint-mode", opts.deint, 0, - ({"first-field", 1}, - {"bob", 2}, - {"temporal", 3}, - {"temporal-spatial", 4}), - OPTDEF_INT(3)), - OPT_FLAG("deint", deint_enabled, 0), - OPT_FLAG("chroma-deint", opts.chroma_deint, 0, OPTDEF_INT(1)), - OPT_FLAG("pullup", opts.pullup, 0), - OPT_FLOATRANGE("denoise", opts.denoise, 0, 0, 1), - OPT_FLOATRANGE("sharpen", opts.sharpen, 0, -1, 1), - OPT_INTRANGE("hqscaling", opts.hqscaling, 0, 0, 9), - OPT_FLAG("interlaced-only", interlaced_only, 0), + {"deint-mode", OPT_CHOICE(opts.deint, + {"first-field", 1}, + {"bob", 2}, + {"temporal", 3}, + {"temporal-spatial", 4}), + OPTDEF_INT(3)}, + {"deint", OPT_BOOL(deint_enabled)}, + {"chroma-deint", OPT_BOOL(opts.chroma_deint), OPTDEF_INT(1)}, + {"pullup", OPT_BOOL(opts.pullup)}, + {"denoise", OPT_FLOAT(opts.denoise), M_RANGE(0, 1)}, + {"sharpen", OPT_FLOAT(opts.sharpen), M_RANGE(-1, 1)}, + {"hqscaling", OPT_INT(opts.hqscaling), M_RANGE(0, 9)}, + {"interlaced-only", OPT_BOOL(interlaced_only)}, + {"parity", OPT_CHOICE(field_parity, + {"tff", MP_FIELD_PARITY_TFF}, + {"bff", MP_FIELD_PARITY_BFF}, + {"auto", MP_FIELD_PARITY_AUTO})}, {0} }; @@ -189,6 +195,9 @@ const struct mp_user_filter_entry vf_vdpaupp = { .description = "vdpau postprocessing", .name = "vdpaupp", .priv_size = sizeof(OPT_BASE_STRUCT), + .priv_defaults = &(const OPT_BASE_STRUCT){ + .field_parity = MP_FIELD_PARITY_AUTO, + }, .options = vf_opts_fields, }, .create = vf_vdpaupp_create, |