diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-04-11 17:17:52 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-05-13 19:57:39 +0200 |
commit | 5258c012febdfba0ef56ad8ce6f7cb003611c47b (patch) | |
tree | 6507121926e212b9e8116737491677e6b13a5797 /video/decode | |
parent | 5b085fd8b172648a03244d6546d130144b7870bf (diff) | |
download | mpv-5258c012febdfba0ef56ad8ce6f7cb003611c47b.tar.bz2 mpv-5258c012febdfba0ef56ad8ce6f7cb003611c47b.tar.xz |
vda: add support for nv12 image formats
The hardware always decodes to nv12 so using this image format causes less cpu
usage than uyvy (which we are currently using, since Apple examples and other
free software use that). The reduction in cpu usage can add up to quite a bit,
especially for 4k or high fps video.
This needs an accompaning commit in libavcodec.
Diffstat (limited to 'video/decode')
-rw-r--r-- | video/decode/vda.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/video/decode/vda.c b/video/decode/vda.c index 6e54479c98..cc2c7b0795 100644 --- a/video/decode/vda.c +++ b/video/decode/vda.c @@ -31,7 +31,8 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, const char *decoder) { hwdec_request_api(info, "vda"); - + if (!info || !info->hwctx) + return HWDEC_ERR_NO_CTX; if (mp_codec_to_av_codec_id(decoder) != AV_CODEC_ID_H264) return HWDEC_ERR_NO_CODEC; return 0; @@ -76,7 +77,14 @@ static void print_vda_error(struct mp_log *log, int lev, char *message, static int init_decoder(struct lavc_ctx *ctx, int fmt, int w, int h) { av_vda_default_free(ctx->avctx); +#if HAVE_VDA_DEFAULT_INIT2 + AVVDAContext *vdactx = av_vda_alloc_context(); + vdactx->cv_pix_fmt_type = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; + int err = av_vda_default_init2(ctx->avctx, vdactx); +#else int err = av_vda_default_init(ctx->avctx); +#endif + if (err < 0) { print_vda_error(ctx->log, MSGL_ERR, "failed to init VDA decoder", err); return -1; |