diff options
Diffstat (limited to 'video/filter/vf_vdpaupp.c')
-rw-r--r-- | video/filter/vf_vdpaupp.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c index 2f485bdbad..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; @@ -174,13 +176,17 @@ static const m_option_t vf_opts_fields[] = { {"temporal", 3}, {"temporal-spatial", 4}), OPTDEF_INT(3)}, - {"deint", OPT_FLAG(deint_enabled)}, - {"chroma-deint", OPT_FLAG(opts.chroma_deint), OPTDEF_INT(1)}, - {"pullup", OPT_FLAG(opts.pullup)}, + {"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_FLAG(interlaced_only)}, + {"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, |