Quoting Mark Thompson (2016-08-02 23:24:52)
> Moves much of the setup logic for VAAPI decoding into lavc; the user
> now need only provide the hw_frames_ctx.
>
> Also deprecates struct vaapi_context and installed header vaapi.h
> which contains it, while continuing to support it in the new code.
> ---
> I've ducked the interlacing problem by allowing the picture structure to be
> reused. I don't think there is a better way to fix it (it really is the same
> picture, we just render twice to it).
>
> Still wondering whether we want an "ignore capabilities" flag somehow.
>
> Tested with i965 (Skylake) and mesa/gallium (Bonaire).
>
> doc/APIchanges | 3 +
> libavcodec/Makefile | 5 +-
> libavcodec/vaapi_decode.c | 602
> ++++++++++++++++++++++++++++++++++++++++++++++
> libavcodec/vaapi_decode.h | 97 ++++++++
> libavcodec/version.h | 5 +-
> 5 files changed, 709 insertions(+), 3 deletions(-)
> create mode 100644 libavcodec/vaapi_decode.c
> create mode 100644 libavcodec/vaapi_decode.h
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 1b65c4b..74f65f2 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil: 2015-08-28
>
> API changes, most recent first:
>
> +2016-xx-xx - xxxxxxx - lavc 59.26.0 - vaapi.h
> + Deprecate struct vaapi_context and the vaapi.h installed header.
> +
> 2016-07-20 - xxxxxxx - lavu 55.20.0 - cpu.h
> Add AV_CPU_FLAG_SSSE3SLOW.
>
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 8eb7d36..4d04d6a 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -610,7 +610,7 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o
> adpcm_data.o
> # hardware accelerators
> OBJS-$(CONFIG_D3D11VA) += dxva2.o
> OBJS-$(CONFIG_DXVA2) += dxva2.o
> -OBJS-$(CONFIG_VAAPI) += vaapi.o
> +OBJS-$(CONFIG_VAAPI) += vaapi.o vaapi_decode.o
> OBJS-$(CONFIG_VDA) += vda.o
> OBJS-$(CONFIG_VDPAU) += vdpau.o
>
> @@ -777,7 +777,8 @@ SKIPHEADERS-$(CONFIG_NVENC) += nvenc.h
> SKIPHEADERS-$(CONFIG_QSV) += qsv.h qsv_internal.h
> SKIPHEADERS-$(CONFIG_QSVDEC) += qsvdec.h
> SKIPHEADERS-$(CONFIG_QSVENC) += qsvenc.h
> -SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_encode.h vaapi_internal.h
> +SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_encode.h \
> + vaapi_internal.h
> SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_internal.h
> SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
>
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> new file mode 100644
> index 0000000..0ccdff3
> --- /dev/null
> +++ b/libavcodec/vaapi_decode.c
> +int ff_vaapi_decode_init(AVCodecContext *avctx)
> +{
> + VAAPIDecodeContext *ctx = avctx->internal->hwaccel_priv_data;
> + VAStatus vas;
> + int err;
> +
> + ctx->va_config = VA_INVALID_ID;
> + ctx->va_context = VA_INVALID_ID;
> +
> +#if FF_API_VAAPI_CONTEXT
> + if (avctx->hwaccel_context) {
> + static int warned = 0;
Please no new global state. I prefer warning on each init.
> + if (!warned) {
> + av_log(avctx, AV_LOG_WARNING, "Using deprecated struct "
> + "vaapi_context in decode.\n");
> + warned = 1;
> + }
> +
> + ctx->have_old_context = 1;
> + ctx->old_context = avctx->hwaccel_context;
> +
> + ctx->hwctx = av_malloc(sizeof(*ctx->hwctx));
I'd prefer it if you just called av_hwdevice_ctx_alloc() here, lavc
shouldn't use sizeof() on lavu structs.
Also, there's the potential problem with destroying mapped buffers
mentioned on IRC.
--
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel