[2/2] d3d11va: add a Direct3D11 video decoder similar to DXVA2

Message ID BLU436-SMTP2230AF22A6E6ABC306A5CAD9AD00@phx.gbl
State New
Headers show

Commit Message

Steve Lhomme May 6, 2015, 11:38 a.m.
---
 configure                     | 32 +++++++++++++-
 libavcodec/Makefile           |  7 ++++
 libavcodec/allcodecs.c        |  5 +++
 libavcodec/d3d11va.c          | 24 +++++++++++
 libavcodec/d3d11va.h          | 98 +++++++++++++++++++++++++++++++++++++++++++
 libavcodec/d3d11va_h264.c     | 41 ++++++++++++++++++
 libavcodec/d3d11va_hevc.c     | 41 ++++++++++++++++++
 libavcodec/d3d11va_internal.h | 56 +++++++++++++++++++++++++
 libavcodec/d3d11va_mpeg2.c    | 41 ++++++++++++++++++
 libavcodec/d3d11va_vc1.c      | 54 ++++++++++++++++++++++++
 libavcodec/h264_slice.c       |  3 ++
 libavcodec/hevc.c             |  3 ++
 libavcodec/mpeg12dec.c        |  3 ++
 libavcodec/vc1dec.c           |  3 ++
 libavutil/pixdesc.c           |  6 +++
 libavutil/pixfmt.h            |  1 +
 16 files changed, 417 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/d3d11va.c
 create mode 100644 libavcodec/d3d11va.h
 create mode 100644 libavcodec/d3d11va_h264.c
 create mode 100644 libavcodec/d3d11va_hevc.c
 create mode 100644 libavcodec/d3d11va_internal.h
 create mode 100644 libavcodec/d3d11va_mpeg2.c
 create mode 100644 libavcodec/d3d11va_vc1.c

Comments

Steve Lhomme May 6, 2015, 11:43 a.m. | #1
Sending the patch to libav-devel

On Wed, May 6, 2015 at 1:38 PM, Steve Lhomme <robux4@videolabs.io> wrote:
> ---
>  configure                     | 32 +++++++++++++-
>  libavcodec/Makefile           |  7 ++++
>  libavcodec/allcodecs.c        |  5 +++
>  libavcodec/d3d11va.c          | 24 +++++++++++
>  libavcodec/d3d11va.h          | 98 +++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/d3d11va_h264.c     | 41 ++++++++++++++++++
>  libavcodec/d3d11va_hevc.c     | 41 ++++++++++++++++++
>  libavcodec/d3d11va_internal.h | 56 +++++++++++++++++++++++++
>  libavcodec/d3d11va_mpeg2.c    | 41 ++++++++++++++++++
>  libavcodec/d3d11va_vc1.c      | 54 ++++++++++++++++++++++++
>  libavcodec/h264_slice.c       |  3 ++
>  libavcodec/hevc.c             |  3 ++
>  libavcodec/mpeg12dec.c        |  3 ++
>  libavcodec/vc1dec.c           |  3 ++
>  libavutil/pixdesc.c           |  6 +++
>  libavutil/pixfmt.h            |  1 +
>  16 files changed, 417 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/d3d11va.c
>  create mode 100644 libavcodec/d3d11va.h
>  create mode 100644 libavcodec/d3d11va_h264.c
>  create mode 100644 libavcodec/d3d11va_hevc.c
>  create mode 100644 libavcodec/d3d11va_internal.h
>  create mode 100644 libavcodec/d3d11va_mpeg2.c
>  create mode 100644 libavcodec/d3d11va_vc1.c
>
> diff --git a/configure b/configure
> index f3e5154..591ef8b 100755
> --- a/configure
> +++ b/configure
> @@ -134,6 +134,7 @@ Component options:
>
>  Hardware accelerators:
>    --enable-dxva2           enable DXVA2 code
> +  --enable-d3d11va         enable D3D11VA code
>    --enable-vaapi           enable VAAPI code
>    --enable-vda             enable VDA code
>    --enable-vdpau           enable VDPAU code
> @@ -1207,6 +1208,7 @@ FEATURE_LIST="
>
>  HWACCEL_LIST="
>      dxva2
> +    d3d11va
>      vaapi
>      vda
>      vdpau
> @@ -1397,6 +1399,7 @@ HEADERS_LIST="
>      direct_h
>      dlfcn_h
>      dxva_h
> +    d3d11_h
>      gsm_h
>      io_h
>      mach_mach_time_h
> @@ -1552,6 +1555,8 @@ HAVE_LIST="
>      atomics_native
>      dos_paths
>      dxva2_lib
> +    d3d11_cobj
> +    d3d11va_lib
>      libc_msvcrt
>      libdc1394_1
>      libdc1394_2
> @@ -1966,6 +1971,7 @@ zmbv_encoder_deps="zlib"
>
>  # hardware accelerators
>  dxva2_deps="dxva2api_h"
> +d3d11va_deps="d3d11_h dxva_h"
>  vaapi_deps="va_va_h"
>  vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
>  vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
> @@ -1977,6 +1983,8 @@ h263_vdpau_hwaccel_deps="vdpau"
>  h263_vdpau_hwaccel_select="h263_decoder"
>  h264_dxva2_hwaccel_deps="dxva2"
>  h264_dxva2_hwaccel_select="h264_decoder"
> +h264_d3d11va_hwaccel_deps="d3d11va"
> +h264_d3d11va_hwaccel_select="h264_decoder"
>  h264_mmal_decoder_deps="mmal"
>  h264_mmal_hwaccel_deps="mmal"
>  h264_mmal_decoder_select="h264_decoder"
> @@ -1992,10 +2000,14 @@ h264_vdpau_hwaccel_deps="vdpau"
>  h264_vdpau_hwaccel_select="h264_decoder"
>  hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
>  hevc_dxva2_hwaccel_select="hevc_decoder"
> +hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
> +hevc_d3d11va_hwaccel_select="hevc_decoder"
>  mpeg1_vdpau_hwaccel_deps="vdpau"
>  mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
>  mpeg2_dxva2_hwaccel_deps="dxva2"
>  mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
> +mpeg2_d3d11va_hwaccel_deps="d3d11va"
> +mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
>  mpeg2_vaapi_hwaccel_deps="vaapi"
>  mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
>  mpeg2_vdpau_hwaccel_deps="vdpau"
> @@ -2006,11 +2018,14 @@ mpeg4_vdpau_hwaccel_deps="vdpau"
>  mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
>  vc1_dxva2_hwaccel_deps="dxva2"
>  vc1_dxva2_hwaccel_select="vc1_decoder"
> +vc1_d3d11va_hwaccel_deps="d3d11va"
> +vc1_d3d11va_hwaccel_select="vc1_decoder"
>  vc1_vaapi_hwaccel_deps="vaapi"
>  vc1_vaapi_hwaccel_select="vc1_decoder"
>  vc1_vdpau_hwaccel_deps="vdpau"
>  vc1_vdpau_hwaccel_select="vc1_decoder"
>  wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
> +wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
>  wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
>  wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
>
> @@ -2288,7 +2303,7 @@ enable swscale_alpha
>  enable valgrind_backtrace
>
>  # By default, enable only those hwaccels that have no external dependencies.
> -enable dxva2 vda vdpau
> +enable dxva2 d3d11va vda vdpau
>
>  # build settings
>  SHFLAGS='-shared -Wl,-soname,$$(@F)'
> @@ -4157,6 +4172,7 @@ check_header direct.h
>  check_header dlfcn.h
>  check_header dxva.h
>  check_header dxva2api.h
> +check_header d3d11.h
>  check_header io.h
>  check_header mach/mach_time.h
>  check_header malloc.h
> @@ -4182,6 +4198,7 @@ check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
>  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
>
>  check_type "windows.h dxva.h" "DXVA_PicParams_HEVC"
> +check_type "windows.h d3d11.h" "D3D11_VIDEO_DECODER_CONFIG"
>
>  if ! disabled w32threads && ! enabled pthreads; then
>      check_func_headers "windows.h process.h" _beginthreadex &&
> @@ -4371,6 +4388,15 @@ if enabled x11grab; then
>      require Xext X11/extensions/XShm.h XShmCreateImage -lXext
>      require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
>  fi
> +enabled d3d11_h &&
> +    check_cc <<EOF && enable d3d11_cobj
> +#define _WIN32_WINNT 0x0600
> +#define COBJMACROS
> +#include <windows.h>
> +#include <d3d11.h>
> +int main(void) { ID3D11VideoDecoder *o = NULL; ID3D11VideoDecoder_Release(o); return 0; }
> +EOF
> +
>
>  enabled vaapi && enabled xlib &&
>      check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
> @@ -4597,6 +4623,10 @@ enabled_all dxva2 CoTaskMemFree &&
>      prepend avconv_libs $($ldflags_filter "-lole32") &&
>      enable dxva2_lib
>
> +enabled_all d3d11va d3d11_cobj CoTaskMemFree &&
> +    prepend avconv_libs $($ldflags_filter "-lole32") &&
> +    enable d3d11va_lib
> +
>  ! enabled_any memalign posix_memalign aligned_malloc &&
>      enabled simd_align_16 && enable memalign_hack
>
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 66b3cbe..08e40c3 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -4,6 +4,7 @@ HEADERS = avcodec.h                                                     \
>            avfft.h                                                       \
>            dv_profile.h                                                  \
>            dxva2.h                                                       \
> +          d3d11va.h                                                     \
>            qsv.h                                                         \
>            vaapi.h                                                       \
>            vda.h                                                         \
> @@ -558,6 +559,7 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER)       += adpcmenc.o adpcm_data.o
>
>  # hardware accelerators
>  OBJS-$(CONFIG_DXVA2)                      += dxva.o
> +OBJS-$(CONFIG_D3D11VA)                    += d3d11va.o
>  OBJS-$(CONFIG_VAAPI)                      += vaapi.o
>  OBJS-$(CONFIG_VDA)                        += vda.o
>  OBJS-$(CONFIG_VDPAU)                      += vdpau.o
> @@ -565,17 +567,21 @@ OBJS-$(CONFIG_VDPAU)                      += vdpau.o
>  OBJS-$(CONFIG_H263_VAAPI_HWACCEL)         += vaapi_mpeg4.o
>  OBJS-$(CONFIG_H263_VDPAU_HWACCEL)         += vdpau_mpeg4.o
>  OBJS-$(CONFIG_H264_DXVA2_HWACCEL)         += dxva_h264.o
> +OBJS-$(CONFIG_H264_D3D11VA_HWACCEL)       += d3d11va_h264.o
>  OBJS-$(CONFIG_H264_VAAPI_HWACCEL)         += vaapi_h264.o
>  OBJS-$(CONFIG_H264_VDA_HWACCEL)           += vda_h264.o
>  OBJS-$(CONFIG_H264_VDPAU_HWACCEL)         += vdpau_h264.o
>  OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL)         += dxva_hevc.o
> +OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL)       += d3d11va_hevc.o
>  OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)        += vdpau_mpeg12.o
>  OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL)        += dxva_mpeg2.o
> +OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL)      += d3d11va_mpeg2.o
>  OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)        += vaapi_mpeg2.o
>  OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL)        += vdpau_mpeg12.o
>  OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL)        += vaapi_mpeg4.o
>  OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL)        += vdpau_mpeg4.o
>  OBJS-$(CONFIG_VC1_DXVA2_HWACCEL)          += dxva_vc1.o
> +OBJS-$(CONFIG_VC1_D3D11VA_HWACCEL)        += d3d11va_vc1.o
>  OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)          += vaapi_vc1.o
>  OBJS-$(CONFIG_VC1_VDPAU_HWACCEL)          += vdpau_vc1.o
>
> @@ -724,6 +730,7 @@ SKIPHEADERS                            += %_tablegen.h                  \
>                                            $(ARCH)/vp56_arith.h          \
>
>  SKIPHEADERS-$(CONFIG_DXVA2)            += dxva.h dxva_internal.h dxva2_internal.h
> +SKIPHEADERS-$(CONFIG_D3D11VA)          += d3d11va.h d3d11va_internal.h dxva2_internal.h
>  SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER)  += libschroedinger.h
>  SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
>  SKIPHEADERS-$(CONFIG_QSV)              += qsv.h qsv_internal.h
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index d2679ad..f42b1dd 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -77,6 +77,7 @@ void avcodec_register_all(void)
>      REGISTER_HWACCEL(H263_VAAPI,        h263_vaapi);
>      REGISTER_HWACCEL(H263_VDPAU,        h263_vdpau);
>      REGISTER_HWACCEL(H264_DXVA2,        h264_dxva2);
> +    REGISTER_HWACCEL(H264_D3D11VA,      h264_d3d11va);
>      REGISTER_HWACCEL(H264_MMAL,         h264_mmal);
>      REGISTER_HWACCEL(H264_QSV,          h264_qsv);
>      REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
> @@ -84,16 +85,20 @@ void avcodec_register_all(void)
>      REGISTER_HWACCEL(H264_VDA_OLD,      h264_vda_old);
>      REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
>      REGISTER_HWACCEL(HEVC_DXVA2,        hevc_dxva2);
> +    REGISTER_HWACCEL(HEVC_D3D11VA,      hevc_d3d11va);
>      REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
>      REGISTER_HWACCEL(MPEG2_DXVA2,       mpeg2_dxva2);
> +    REGISTER_HWACCEL(MPEG2_D3D11VA,     mpeg2_d3d11va);
>      REGISTER_HWACCEL(MPEG2_VAAPI,       mpeg2_vaapi);
>      REGISTER_HWACCEL(MPEG2_VDPAU,       mpeg2_vdpau);
>      REGISTER_HWACCEL(MPEG4_VAAPI,       mpeg4_vaapi);
>      REGISTER_HWACCEL(MPEG4_VDPAU,       mpeg4_vdpau);
>      REGISTER_HWACCEL(VC1_DXVA2,         vc1_dxva2);
> +    REGISTER_HWACCEL(VC1_D3D11VA,       vc1_d3d11va);
>      REGISTER_HWACCEL(VC1_VAAPI,         vc1_vaapi);
>      REGISTER_HWACCEL(VC1_VDPAU,         vc1_vdpau);
>      REGISTER_HWACCEL(WMV3_DXVA2,        wmv3_dxva2);
> +    REGISTER_HWACCEL(WMV3_D3D11VA,      wmv3_d3d11va);
>      REGISTER_HWACCEL(WMV3_VAAPI,        wmv3_vaapi);
>      REGISTER_HWACCEL(WMV3_VDPAU,        wmv3_vdpau);
>
> diff --git a/libavcodec/d3d11va.c b/libavcodec/d3d11va.c
> new file mode 100644
> index 0000000..9bbe420
> --- /dev/null
> +++ b/libavcodec/d3d11va.c
> @@ -0,0 +1,24 @@
> +/*
> + * Direct3D11 HW acceleration.
> + *
> + * copyright (c) 2010 Laurent Aimar
> + * copyright (c) 2015 Steve Lhomme
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +#include "d3d11va_internal.h"
> +#include "dxva2.c"
> diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
> new file mode 100644
> index 0000000..bb3af4d
> --- /dev/null
> +++ b/libavcodec/d3d11va.h
> @@ -0,0 +1,98 @@
> +/*
> + * Direct3D11 HW acceleration
> + *
> + * copyright (c) 2009 Laurent Aimar
> + * copyright (c) 2015 Steve Lhomme
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVCODEC_D3D11VA_H
> +#define AVCODEC_D3D11VA_H
> +
> +/**
> + * @file
> + * @ingroup lavc_codec_hwaccel_d3d11va
> + * Public libavcodec D3D11VA header.
> + */
> +
> +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
> +#undef _WIN32_WINNT
> +#define _WIN32_WINNT 0x0600
> +#endif
> +
> +#include <stdint.h>
> +#include <d3d11.h>
> +
> +/**
> + * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11
> + * @ingroup lavc_codec_hwaccel
> + *
> + * @{
> + */
> +
> +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards
> +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO    2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface
> +
> +/**
> + * This structure is used to provides the necessary configurations and data
> + * to the Direct3D11 Libav HWAccel implementation.
> + *
> + * The application must make it available as AVCodecContext.hwaccel_context.
> + */
> +struct d3d11va_context {
> +    /**
> +     * D3D11 decoder object
> +     */
> +    ID3D11VideoDecoder *decoder;
> +
> +    /**
> +      * D3D11 VideoContext
> +      */
> +    ID3D11VideoContext *video_context;
> +
> +    /**
> +     * D3D11 configuration used to create the decoder
> +     */
> +    D3D11_VIDEO_DECODER_CONFIG *cfg;
> +
> +    /**
> +     * The number of surface in the surface array
> +     */
> +    unsigned surface_count;
> +
> +    /**
> +     * The array of Direct3D surfaces used to create the decoder
> +     */
> +    ID3D11VideoDecoderOutputView **surface;
> +
> +    /**
> +     * A bit field configuring the workarounds needed for using the decoder
> +     */
> +    uint64_t workaround;
> +
> +    /**
> +     * Private to the Libav AVHWAccel implementation
> +     */
> +    unsigned report_id;
> +};
> +
> +/**
> + * @}
> + */
> +
> +#endif /* AVCODEC_D3D11VA_H */
> diff --git a/libavcodec/d3d11va_h264.c b/libavcodec/d3d11va_h264.c
> new file mode 100644
> index 0000000..3f5d108
> --- /dev/null
> +++ b/libavcodec/d3d11va_h264.c
> @@ -0,0 +1,41 @@
> +/*
> + * Direct3D11 H264 HW acceleration.
> + *
> + * copyright (c) 2009 Laurent Aimar
> + * copyright (c) 2015 Steve Lhomme
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "d3d11va_internal.h"
> +
> +#define dxva2_h264_start_frame   d3d11va_h264_start_frame
> +#define dxva2_h264_decode_slice  d3d11va_h264_decode_slice
> +#define dxva2_h264_end_frame     d3d11va_h264_end_frame
> +
> +#include "dxva2_h264.c"
> +
> +AVHWAccel ff_h264_d3d11va_hwaccel = {
> +    .name           = "h264_d3d11va",
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_H264,
> +    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
> +    .start_frame    = d3d11va_h264_start_frame,
> +    .decode_slice   = d3d11va_h264_decode_slice,
> +    .end_frame      = d3d11va_h264_end_frame,
> +    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
> +};
> diff --git a/libavcodec/d3d11va_hevc.c b/libavcodec/d3d11va_hevc.c
> new file mode 100644
> index 0000000..db041f1
> --- /dev/null
> +++ b/libavcodec/d3d11va_hevc.c
> @@ -0,0 +1,41 @@
> +/*
> + * Direct3D11 HEVC HW acceleration.
> + *
> + * copyright (c) 2014 - 2015 Hendrik Leppkes
> + * copyright (c) 2015 Steve Lhomme
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "d3d11va_internal.h"
> +
> +#define dxva2_hevc_start_frame   d3d11va_hevc_start_frame
> +#define dxva2_hevc_decode_slice  d3d11va_hevc_decode_slice
> +#define dxva2_hevc_end_frame     d3d11va_hevc_end_frame
> +
> +#include "dxva2_hevc.c"
> +
> +AVHWAccel ff_hevc_d3d11va_hwaccel = {
> +    .name           = "hevc_d3d11va",
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_HEVC,
> +    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
> +    .start_frame    = d3d11va_hevc_start_frame,
> +    .decode_slice   = d3d11va_hevc_decode_slice,
> +    .end_frame      = d3d11va_hevc_end_frame,
> +    .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
> +};
> diff --git a/libavcodec/d3d11va_internal.h b/libavcodec/d3d11va_internal.h
> new file mode 100644
> index 0000000..4ec592c
> --- /dev/null
> +++ b/libavcodec/d3d11va_internal.h
> @@ -0,0 +1,56 @@
> +/*
> + * Direct3D11 HW acceleration
> + *
> + * copyright (c) 2010 Laurent Aimar
> + * copyright (c) 2015 Steve Lhomme
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVCODEC_D3D11VA_INTERNAL_H
> +#define AVCODEC_D3D11VA_INTERNAL_H
> +
> +#define COBJMACROS
> +
> +#include "d3d11va.h"
> +#include <dxva.h>
> +
> +#define dxva_context                      d3d11va_context
> +#define dxva_surface_t                    ID3D11VideoDecoderOutputView
> +#define DECODER_BUFFER_DESC               D3D11_VIDEO_DECODER_BUFFER_DESC
> +#define DECODER_BUFFER_TYPE               D3D11_VIDEO_DECODER_BUFFER_TYPE
> +#define DECODER_GET_BUFFER(ctx,t,b,s)     ID3D11VideoContext_GetDecoderBuffer(ctx->video_context, ctx->decoder, t,s,b)
> +#define DECODER_SUBMIT_BUFFER(ctx,b,c)    ID3D11VideoContext_SubmitDecoderBuffers(ctx->video_context, ctx->decoder, c,b)
> +#define DECODER_RELEASE_BUFFER(ctx,t)     ID3D11VideoContext_ReleaseDecoderBuffer(ctx->video_context, ctx->decoder, t)
> +#define DECODER_BEGIN_FRAME(ctx,s)        ID3D11VideoContext_DecoderBeginFrame(ctx->video_context, ctx->decoder, s, 0, NULL)
> +#define DECODER_END_FRAME(ctx)            ID3D11VideoContext_DecoderEndFrame(ctx->video_context, ctx->decoder)
> +
> +#define DECODER_BUFTYPE_PICTURE_PARAMS    D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS
> +#define DECODER_BUFTYPE_QUANT_MATRIX      D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX
> +#define DECODER_BUFTYPE_BITSTREAM         D3D11_VIDEO_DECODER_BUFFER_BITSTREAM
> +#define DECODER_BUFTYPE_SLICE_CONTROL     D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL
> +
> +#define DECODER_BUFFER_DESC_SET_TYPE(dsc, type)   dsc->BufferType = type
> +
> +#define ff_dxva2_get_surface(f)                        ff_d3d11va_get_surface(f)
> +#define ff_dxva2_get_surface_index(c, f)               ff_d3d11va_get_surface_index(c, f)
> +#define ff_dxva2_commit_buffer(ctx,dc,d,t,p,ps,c)      ff_d3d11va_commit_buffer(ctx,dc,d,t,p,ps,c)
> +#define ff_dxva2_common_end_frame(ctx,f,p,ps,q,qs,cb)  ff_d3d11va_common_end_frame(ctx,f,p,ps,q,qs,cb)
> +
> +#include "dxva2_internal.h"
> +
> +#endif /* AVCODEC_D3D11VA_INTERNAL_H */
> diff --git a/libavcodec/d3d11va_mpeg2.c b/libavcodec/d3d11va_mpeg2.c
> new file mode 100644
> index 0000000..2e2510e
> --- /dev/null
> +++ b/libavcodec/d3d11va_mpeg2.c
> @@ -0,0 +1,41 @@
> +/*
> + * Direct3D11 MPEG-2 HW acceleration.
> + *
> + * copyright (c) 2010 Laurent Aimar
> + * copyright (c) 2015 Steve Lhomme
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "d3d11va_internal.h"
> +
> +#define dxva2_mpeg2_start_frame   d3d11va_mpeg2_start_frame
> +#define dxva2_mpeg2_decode_slice  d3d11va_mpeg2_decode_slice
> +#define dxva2_mpeg2_end_frame     d3d11va_mpeg2_end_frame
> +
> +#include "dxva2_mpeg2.c"
> +
> +AVHWAccel ff_mpeg2_d3d11va_hwaccel = {
> +    .name           = "mpeg2_d3d11va",
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_MPEG2VIDEO,
> +    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
> +    .start_frame    = d3d11va_mpeg2_start_frame,
> +    .decode_slice   = d3d11va_mpeg2_decode_slice,
> +    .end_frame      = d3d11va_mpeg2_end_frame,
> +    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
> +};
> diff --git a/libavcodec/d3d11va_vc1.c b/libavcodec/d3d11va_vc1.c
> new file mode 100644
> index 0000000..6a57dcb
> --- /dev/null
> +++ b/libavcodec/d3d11va_vc1.c
> @@ -0,0 +1,54 @@
> +/*
> + * Direct3D11 WMV3/VC-1 HW acceleration.
> + *
> + * copyright (c) 2010 Laurent Aimar
> + * copyright (c) 2015 Steve Lhomme
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "d3d11va_internal.h"
> +
> +#define dxva2_vc1_start_frame   d3d11va_vc1_start_frame
> +#define dxva2_vc1_decode_slice  d3d11va_vc1_decode_slice
> +#define dxva2_vc1_end_frame     d3d11va_vc1_end_frame
> +
> +#include "dxva2_vc1.c"
> +
> +#if CONFIG_WMV3_D3D11VA_HWACCEL
> +AVHWAccel ff_wmv3_d3d11va_hwaccel = {
> +    .name           = "wmv3_d3d11va",
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_WMV3,
> +    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
> +    .start_frame    = d3d11va_vc1_start_frame,
> +    .decode_slice   = d3d11va_vc1_decode_slice,
> +    .end_frame      = d3d11va_vc1_end_frame,
> +    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
> +};
> +#endif
> +
> +AVHWAccel ff_vc1_d3d11va_hwaccel = {
> +    .name           = "vc1_d3d11va",
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_VC1,
> +    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
> +    .start_frame    = d3d11va_vc1_start_frame,
> +    .decode_slice   = d3d11va_vc1_decode_slice,
> +    .end_frame      = d3d11va_vc1_end_frame,
> +    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
> +};
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index a250237..1cee634 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -861,6 +861,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h)
>  #if CONFIG_H264_DXVA2_HWACCEL
>              *fmt++ = AV_PIX_FMT_DXVA2_VLD;
>  #endif
> +#if CONFIG_H264_D3D11VA_HWACCEL
> +            *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
> +#endif
>  #if CONFIG_H264_VAAPI_HWACCEL
>              *fmt++ = AV_PIX_FMT_VAAPI_VLD;
>  #endif
> diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
> index 4c06fb8..a6ee773 100644
> --- a/libavcodec/hevc.c
> +++ b/libavcodec/hevc.c
> @@ -446,6 +446,9 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
>  #if CONFIG_HEVC_DXVA2_HWACCEL
>          *fmt++ = AV_PIX_FMT_DXVA2_VLD;
>  #endif
> +#if CONFIG_HEVC_D3D11VA_HWACCEL
> +        *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
> +#endif
>      }
>
>      *fmt++ = sps->pix_fmt;
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 6ed151a..e8eaa86 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1175,6 +1175,9 @@ static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = {
>  #if CONFIG_MPEG2_DXVA2_HWACCEL
>      AV_PIX_FMT_DXVA2_VLD,
>  #endif
> +#if CONFIG_MPEG2_D3D11VA_HWACCEL
> +    AV_PIX_FMT_D3D11VA_VLD,
> +#endif
>  #if CONFIG_MPEG2_VAAPI_HWACCEL
>      AV_PIX_FMT_VAAPI_VLD,
>  #endif
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index 0d578cd..b027d08 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -954,6 +954,9 @@ static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = {
>  #if CONFIG_VC1_DXVA2_HWACCEL
>      AV_PIX_FMT_DXVA2_VLD,
>  #endif
> +#if CONFIG_VC1_D3D11VA_HWACCEL
> +    AV_PIX_FMT_D3D11VA_VLD,
> +#endif
>  #if CONFIG_VC1_VAAPI_HWACCEL
>      AV_PIX_FMT_VAAPI_VLD,
>  #endif
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index ea432f9..6a4f35d 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -1339,6 +1339,12 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>          .log2_chroma_h = 1,
>          .flags = AV_PIX_FMT_FLAG_HWACCEL,
>      },
> +    [AV_PIX_FMT_D3D11VA_VLD] = {
> +        .name = "d3d11va_vld",
> +        .log2_chroma_w = 1,
> +        .log2_chroma_h = 1,
> +        .flags = AV_PIX_FMT_FLAG_HWACCEL,
> +    },
>      [AV_PIX_FMT_YA8] = {
>          .name = "ya8",
>          .nb_components = 2,
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index e21100f..4e1367e 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -136,6 +136,7 @@ enum AVPixelFormat {
>      AV_PIX_FMT_VDPAU_MPEG4,  ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
>  #endif
>      AV_PIX_FMT_DXVA2_VLD,    ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
> +    AV_PIX_FMT_D3D11VA_VLD,  ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
>
>      AV_PIX_FMT_RGB444LE,  ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
>      AV_PIX_FMT_RGB444BE,  ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
> --
> 2.4.0
>
> _______________________________________________
> libav-stable mailing list
> libav-stable@libav.org
> https://lists.libav.org/mailman/listinfo/libav-stable

Patch

diff --git a/configure b/configure
index f3e5154..591ef8b 100755
--- a/configure
+++ b/configure
@@ -134,6 +134,7 @@  Component options:
 
 Hardware accelerators:
   --enable-dxva2           enable DXVA2 code
+  --enable-d3d11va         enable D3D11VA code
   --enable-vaapi           enable VAAPI code
   --enable-vda             enable VDA code
   --enable-vdpau           enable VDPAU code
@@ -1207,6 +1208,7 @@  FEATURE_LIST="
 
 HWACCEL_LIST="
     dxva2
+    d3d11va
     vaapi
     vda
     vdpau
@@ -1397,6 +1399,7 @@  HEADERS_LIST="
     direct_h
     dlfcn_h
     dxva_h
+    d3d11_h
     gsm_h
     io_h
     mach_mach_time_h
@@ -1552,6 +1555,8 @@  HAVE_LIST="
     atomics_native
     dos_paths
     dxva2_lib
+    d3d11_cobj
+    d3d11va_lib
     libc_msvcrt
     libdc1394_1
     libdc1394_2
@@ -1966,6 +1971,7 @@  zmbv_encoder_deps="zlib"
 
 # hardware accelerators
 dxva2_deps="dxva2api_h"
+d3d11va_deps="d3d11_h dxva_h"
 vaapi_deps="va_va_h"
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
@@ -1977,6 +1983,8 @@  h263_vdpau_hwaccel_deps="vdpau"
 h263_vdpau_hwaccel_select="h263_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
+h264_d3d11va_hwaccel_deps="d3d11va"
+h264_d3d11va_hwaccel_select="h264_decoder"
 h264_mmal_decoder_deps="mmal"
 h264_mmal_hwaccel_deps="mmal"
 h264_mmal_decoder_select="h264_decoder"
@@ -1992,10 +2000,14 @@  h264_vdpau_hwaccel_deps="vdpau"
 h264_vdpau_hwaccel_select="h264_decoder"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
 hevc_dxva2_hwaccel_select="hevc_decoder"
+hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
+hevc_d3d11va_hwaccel_select="hevc_decoder"
 mpeg1_vdpau_hwaccel_deps="vdpau"
 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
 mpeg2_dxva2_hwaccel_deps="dxva2"
 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
+mpeg2_d3d11va_hwaccel_deps="d3d11va"
+mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
 mpeg2_vaapi_hwaccel_deps="vaapi"
 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
 mpeg2_vdpau_hwaccel_deps="vdpau"
@@ -2006,11 +2018,14 @@  mpeg4_vdpau_hwaccel_deps="vdpau"
 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
 vc1_dxva2_hwaccel_deps="dxva2"
 vc1_dxva2_hwaccel_select="vc1_decoder"
+vc1_d3d11va_hwaccel_deps="d3d11va"
+vc1_d3d11va_hwaccel_select="vc1_decoder"
 vc1_vaapi_hwaccel_deps="vaapi"
 vc1_vaapi_hwaccel_select="vc1_decoder"
 vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
+wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
 
@@ -2288,7 +2303,7 @@  enable swscale_alpha
 enable valgrind_backtrace
 
 # By default, enable only those hwaccels that have no external dependencies.
-enable dxva2 vda vdpau
+enable dxva2 d3d11va vda vdpau
 
 # build settings
 SHFLAGS='-shared -Wl,-soname,$$(@F)'
@@ -4157,6 +4172,7 @@  check_header direct.h
 check_header dlfcn.h
 check_header dxva.h
 check_header dxva2api.h
+check_header d3d11.h
 check_header io.h
 check_header mach/mach_time.h
 check_header malloc.h
@@ -4182,6 +4198,7 @@  check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
 
 check_type "windows.h dxva.h" "DXVA_PicParams_HEVC"
+check_type "windows.h d3d11.h" "D3D11_VIDEO_DECODER_CONFIG"
 
 if ! disabled w32threads && ! enabled pthreads; then
     check_func_headers "windows.h process.h" _beginthreadex &&
@@ -4371,6 +4388,15 @@  if enabled x11grab; then
     require Xext X11/extensions/XShm.h XShmCreateImage -lXext
     require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
 fi
+enabled d3d11_h &&
+    check_cc <<EOF && enable d3d11_cobj
+#define _WIN32_WINNT 0x0600
+#define COBJMACROS
+#include <windows.h>
+#include <d3d11.h>
+int main(void) { ID3D11VideoDecoder *o = NULL; ID3D11VideoDecoder_Release(o); return 0; }
+EOF
+
 
 enabled vaapi && enabled xlib &&
     check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
@@ -4597,6 +4623,10 @@  enabled_all dxva2 CoTaskMemFree &&
     prepend avconv_libs $($ldflags_filter "-lole32") &&
     enable dxva2_lib
 
+enabled_all d3d11va d3d11_cobj CoTaskMemFree &&
+    prepend avconv_libs $($ldflags_filter "-lole32") &&
+    enable d3d11va_lib
+
 ! enabled_any memalign posix_memalign aligned_malloc &&
     enabled simd_align_16 && enable memalign_hack
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 66b3cbe..08e40c3 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -4,6 +4,7 @@  HEADERS = avcodec.h                                                     \
           avfft.h                                                       \
           dv_profile.h                                                  \
           dxva2.h                                                       \
+          d3d11va.h                                                     \
           qsv.h                                                         \
           vaapi.h                                                       \
           vda.h                                                         \
@@ -558,6 +559,7 @@  OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER)       += adpcmenc.o adpcm_data.o
 
 # hardware accelerators
 OBJS-$(CONFIG_DXVA2)                      += dxva.o
+OBJS-$(CONFIG_D3D11VA)                    += d3d11va.o
 OBJS-$(CONFIG_VAAPI)                      += vaapi.o
 OBJS-$(CONFIG_VDA)                        += vda.o
 OBJS-$(CONFIG_VDPAU)                      += vdpau.o
@@ -565,17 +567,21 @@  OBJS-$(CONFIG_VDPAU)                      += vdpau.o
 OBJS-$(CONFIG_H263_VAAPI_HWACCEL)         += vaapi_mpeg4.o
 OBJS-$(CONFIG_H263_VDPAU_HWACCEL)         += vdpau_mpeg4.o
 OBJS-$(CONFIG_H264_DXVA2_HWACCEL)         += dxva_h264.o
+OBJS-$(CONFIG_H264_D3D11VA_HWACCEL)       += d3d11va_h264.o
 OBJS-$(CONFIG_H264_VAAPI_HWACCEL)         += vaapi_h264.o
 OBJS-$(CONFIG_H264_VDA_HWACCEL)           += vda_h264.o
 OBJS-$(CONFIG_H264_VDPAU_HWACCEL)         += vdpau_h264.o
 OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL)         += dxva_hevc.o
+OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL)       += d3d11va_hevc.o
 OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)        += vdpau_mpeg12.o
 OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL)        += dxva_mpeg2.o
+OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL)      += d3d11va_mpeg2.o
 OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)        += vaapi_mpeg2.o
 OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL)        += vdpau_mpeg12.o
 OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL)        += vaapi_mpeg4.o
 OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL)        += vdpau_mpeg4.o
 OBJS-$(CONFIG_VC1_DXVA2_HWACCEL)          += dxva_vc1.o
+OBJS-$(CONFIG_VC1_D3D11VA_HWACCEL)        += d3d11va_vc1.o
 OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)          += vaapi_vc1.o
 OBJS-$(CONFIG_VC1_VDPAU_HWACCEL)          += vdpau_vc1.o
 
@@ -724,6 +730,7 @@  SKIPHEADERS                            += %_tablegen.h                  \
                                           $(ARCH)/vp56_arith.h          \
 
 SKIPHEADERS-$(CONFIG_DXVA2)            += dxva.h dxva_internal.h dxva2_internal.h
+SKIPHEADERS-$(CONFIG_D3D11VA)          += d3d11va.h d3d11va_internal.h dxva2_internal.h
 SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER)  += libschroedinger.h
 SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
 SKIPHEADERS-$(CONFIG_QSV)              += qsv.h qsv_internal.h
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d2679ad..f42b1dd 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -77,6 +77,7 @@  void avcodec_register_all(void)
     REGISTER_HWACCEL(H263_VAAPI,        h263_vaapi);
     REGISTER_HWACCEL(H263_VDPAU,        h263_vdpau);
     REGISTER_HWACCEL(H264_DXVA2,        h264_dxva2);
+    REGISTER_HWACCEL(H264_D3D11VA,      h264_d3d11va);
     REGISTER_HWACCEL(H264_MMAL,         h264_mmal);
     REGISTER_HWACCEL(H264_QSV,          h264_qsv);
     REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
@@ -84,16 +85,20 @@  void avcodec_register_all(void)
     REGISTER_HWACCEL(H264_VDA_OLD,      h264_vda_old);
     REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
     REGISTER_HWACCEL(HEVC_DXVA2,        hevc_dxva2);
+    REGISTER_HWACCEL(HEVC_D3D11VA,      hevc_d3d11va);
     REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
     REGISTER_HWACCEL(MPEG2_DXVA2,       mpeg2_dxva2);
+    REGISTER_HWACCEL(MPEG2_D3D11VA,     mpeg2_d3d11va);
     REGISTER_HWACCEL(MPEG2_VAAPI,       mpeg2_vaapi);
     REGISTER_HWACCEL(MPEG2_VDPAU,       mpeg2_vdpau);
     REGISTER_HWACCEL(MPEG4_VAAPI,       mpeg4_vaapi);
     REGISTER_HWACCEL(MPEG4_VDPAU,       mpeg4_vdpau);
     REGISTER_HWACCEL(VC1_DXVA2,         vc1_dxva2);
+    REGISTER_HWACCEL(VC1_D3D11VA,       vc1_d3d11va);
     REGISTER_HWACCEL(VC1_VAAPI,         vc1_vaapi);
     REGISTER_HWACCEL(VC1_VDPAU,         vc1_vdpau);
     REGISTER_HWACCEL(WMV3_DXVA2,        wmv3_dxva2);
+    REGISTER_HWACCEL(WMV3_D3D11VA,      wmv3_d3d11va);
     REGISTER_HWACCEL(WMV3_VAAPI,        wmv3_vaapi);
     REGISTER_HWACCEL(WMV3_VDPAU,        wmv3_vdpau);
 
diff --git a/libavcodec/d3d11va.c b/libavcodec/d3d11va.c
new file mode 100644
index 0000000..9bbe420
--- /dev/null
+++ b/libavcodec/d3d11va.c
@@ -0,0 +1,24 @@ 
+/*
+ * Direct3D11 HW acceleration.
+ *
+ * copyright (c) 2010 Laurent Aimar
+ * copyright (c) 2015 Steve Lhomme
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "d3d11va_internal.h"
+#include "dxva2.c"
diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
new file mode 100644
index 0000000..bb3af4d
--- /dev/null
+++ b/libavcodec/d3d11va.h
@@ -0,0 +1,98 @@ 
+/*
+ * Direct3D11 HW acceleration
+ *
+ * copyright (c) 2009 Laurent Aimar
+ * copyright (c) 2015 Steve Lhomme
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_D3D11VA_H
+#define AVCODEC_D3D11VA_H
+
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_d3d11va
+ * Public libavcodec D3D11VA header.
+ */
+
+#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+#endif
+
+#include <stdint.h>
+#include <d3d11.h>
+
+/**
+ * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11
+ * @ingroup lavc_codec_hwaccel
+ *
+ * @{
+ */
+
+#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards
+#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO    2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface
+
+/**
+ * This structure is used to provides the necessary configurations and data
+ * to the Direct3D11 Libav HWAccel implementation.
+ *
+ * The application must make it available as AVCodecContext.hwaccel_context.
+ */
+struct d3d11va_context {
+    /**
+     * D3D11 decoder object
+     */
+    ID3D11VideoDecoder *decoder;
+
+    /**
+      * D3D11 VideoContext
+      */
+    ID3D11VideoContext *video_context;
+
+    /**
+     * D3D11 configuration used to create the decoder
+     */
+    D3D11_VIDEO_DECODER_CONFIG *cfg;
+
+    /**
+     * The number of surface in the surface array
+     */
+    unsigned surface_count;
+
+    /**
+     * The array of Direct3D surfaces used to create the decoder
+     */
+    ID3D11VideoDecoderOutputView **surface;
+
+    /**
+     * A bit field configuring the workarounds needed for using the decoder
+     */
+    uint64_t workaround;
+
+    /**
+     * Private to the Libav AVHWAccel implementation
+     */
+    unsigned report_id;
+};
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_D3D11VA_H */
diff --git a/libavcodec/d3d11va_h264.c b/libavcodec/d3d11va_h264.c
new file mode 100644
index 0000000..3f5d108
--- /dev/null
+++ b/libavcodec/d3d11va_h264.c
@@ -0,0 +1,41 @@ 
+/*
+ * Direct3D11 H264 HW acceleration.
+ *
+ * copyright (c) 2009 Laurent Aimar
+ * copyright (c) 2015 Steve Lhomme
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "d3d11va_internal.h"
+
+#define dxva2_h264_start_frame   d3d11va_h264_start_frame
+#define dxva2_h264_decode_slice  d3d11va_h264_decode_slice
+#define dxva2_h264_end_frame     d3d11va_h264_end_frame
+
+#include "dxva2_h264.c"
+
+AVHWAccel ff_h264_d3d11va_hwaccel = {
+    .name           = "h264_d3d11va",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_H264,
+    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
+    .start_frame    = d3d11va_h264_start_frame,
+    .decode_slice   = d3d11va_h264_decode_slice,
+    .end_frame      = d3d11va_h264_end_frame,
+    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
+};
diff --git a/libavcodec/d3d11va_hevc.c b/libavcodec/d3d11va_hevc.c
new file mode 100644
index 0000000..db041f1
--- /dev/null
+++ b/libavcodec/d3d11va_hevc.c
@@ -0,0 +1,41 @@ 
+/*
+ * Direct3D11 HEVC HW acceleration.
+ *
+ * copyright (c) 2014 - 2015 Hendrik Leppkes
+ * copyright (c) 2015 Steve Lhomme
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "d3d11va_internal.h"
+
+#define dxva2_hevc_start_frame   d3d11va_hevc_start_frame
+#define dxva2_hevc_decode_slice  d3d11va_hevc_decode_slice
+#define dxva2_hevc_end_frame     d3d11va_hevc_end_frame
+
+#include "dxva2_hevc.c"
+
+AVHWAccel ff_hevc_d3d11va_hwaccel = {
+    .name           = "hevc_d3d11va",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_HEVC,
+    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
+    .start_frame    = d3d11va_hevc_start_frame,
+    .decode_slice   = d3d11va_hevc_decode_slice,
+    .end_frame      = d3d11va_hevc_end_frame,
+    .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
+};
diff --git a/libavcodec/d3d11va_internal.h b/libavcodec/d3d11va_internal.h
new file mode 100644
index 0000000..4ec592c
--- /dev/null
+++ b/libavcodec/d3d11va_internal.h
@@ -0,0 +1,56 @@ 
+/*
+ * Direct3D11 HW acceleration
+ *
+ * copyright (c) 2010 Laurent Aimar
+ * copyright (c) 2015 Steve Lhomme
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_D3D11VA_INTERNAL_H
+#define AVCODEC_D3D11VA_INTERNAL_H
+
+#define COBJMACROS
+
+#include "d3d11va.h"
+#include <dxva.h>
+
+#define dxva_context                      d3d11va_context
+#define dxva_surface_t                    ID3D11VideoDecoderOutputView
+#define DECODER_BUFFER_DESC               D3D11_VIDEO_DECODER_BUFFER_DESC
+#define DECODER_BUFFER_TYPE               D3D11_VIDEO_DECODER_BUFFER_TYPE
+#define DECODER_GET_BUFFER(ctx,t,b,s)     ID3D11VideoContext_GetDecoderBuffer(ctx->video_context, ctx->decoder, t,s,b)
+#define DECODER_SUBMIT_BUFFER(ctx,b,c)    ID3D11VideoContext_SubmitDecoderBuffers(ctx->video_context, ctx->decoder, c,b)
+#define DECODER_RELEASE_BUFFER(ctx,t)     ID3D11VideoContext_ReleaseDecoderBuffer(ctx->video_context, ctx->decoder, t)
+#define DECODER_BEGIN_FRAME(ctx,s)        ID3D11VideoContext_DecoderBeginFrame(ctx->video_context, ctx->decoder, s, 0, NULL)
+#define DECODER_END_FRAME(ctx)            ID3D11VideoContext_DecoderEndFrame(ctx->video_context, ctx->decoder)
+
+#define DECODER_BUFTYPE_PICTURE_PARAMS    D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS
+#define DECODER_BUFTYPE_QUANT_MATRIX      D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX
+#define DECODER_BUFTYPE_BITSTREAM         D3D11_VIDEO_DECODER_BUFFER_BITSTREAM
+#define DECODER_BUFTYPE_SLICE_CONTROL     D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL
+
+#define DECODER_BUFFER_DESC_SET_TYPE(dsc, type)   dsc->BufferType = type
+
+#define ff_dxva2_get_surface(f)                        ff_d3d11va_get_surface(f)
+#define ff_dxva2_get_surface_index(c, f)               ff_d3d11va_get_surface_index(c, f)
+#define ff_dxva2_commit_buffer(ctx,dc,d,t,p,ps,c)      ff_d3d11va_commit_buffer(ctx,dc,d,t,p,ps,c)
+#define ff_dxva2_common_end_frame(ctx,f,p,ps,q,qs,cb)  ff_d3d11va_common_end_frame(ctx,f,p,ps,q,qs,cb)
+
+#include "dxva2_internal.h"
+
+#endif /* AVCODEC_D3D11VA_INTERNAL_H */
diff --git a/libavcodec/d3d11va_mpeg2.c b/libavcodec/d3d11va_mpeg2.c
new file mode 100644
index 0000000..2e2510e
--- /dev/null
+++ b/libavcodec/d3d11va_mpeg2.c
@@ -0,0 +1,41 @@ 
+/*
+ * Direct3D11 MPEG-2 HW acceleration.
+ *
+ * copyright (c) 2010 Laurent Aimar
+ * copyright (c) 2015 Steve Lhomme
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "d3d11va_internal.h"
+
+#define dxva2_mpeg2_start_frame   d3d11va_mpeg2_start_frame
+#define dxva2_mpeg2_decode_slice  d3d11va_mpeg2_decode_slice
+#define dxva2_mpeg2_end_frame     d3d11va_mpeg2_end_frame
+
+#include "dxva2_mpeg2.c"
+
+AVHWAccel ff_mpeg2_d3d11va_hwaccel = {
+    .name           = "mpeg2_d3d11va",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_MPEG2VIDEO,
+    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
+    .start_frame    = d3d11va_mpeg2_start_frame,
+    .decode_slice   = d3d11va_mpeg2_decode_slice,
+    .end_frame      = d3d11va_mpeg2_end_frame,
+    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
+};
diff --git a/libavcodec/d3d11va_vc1.c b/libavcodec/d3d11va_vc1.c
new file mode 100644
index 0000000..6a57dcb
--- /dev/null
+++ b/libavcodec/d3d11va_vc1.c
@@ -0,0 +1,54 @@ 
+/*
+ * Direct3D11 WMV3/VC-1 HW acceleration.
+ *
+ * copyright (c) 2010 Laurent Aimar
+ * copyright (c) 2015 Steve Lhomme
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "d3d11va_internal.h"
+
+#define dxva2_vc1_start_frame   d3d11va_vc1_start_frame
+#define dxva2_vc1_decode_slice  d3d11va_vc1_decode_slice
+#define dxva2_vc1_end_frame     d3d11va_vc1_end_frame
+
+#include "dxva2_vc1.c"
+
+#if CONFIG_WMV3_D3D11VA_HWACCEL
+AVHWAccel ff_wmv3_d3d11va_hwaccel = {
+    .name           = "wmv3_d3d11va",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_WMV3,
+    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
+    .start_frame    = d3d11va_vc1_start_frame,
+    .decode_slice   = d3d11va_vc1_decode_slice,
+    .end_frame      = d3d11va_vc1_end_frame,
+    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
+};
+#endif
+
+AVHWAccel ff_vc1_d3d11va_hwaccel = {
+    .name           = "vc1_d3d11va",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_VC1,
+    .pix_fmt        = AV_PIX_FMT_D3D11VA_VLD,
+    .start_frame    = d3d11va_vc1_start_frame,
+    .decode_slice   = d3d11va_vc1_decode_slice,
+    .end_frame      = d3d11va_vc1_end_frame,
+    .frame_priv_data_size = sizeof(struct dxva2_picture_context),
+};
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index a250237..1cee634 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -861,6 +861,9 @@  static enum AVPixelFormat get_pixel_format(H264Context *h)
 #if CONFIG_H264_DXVA2_HWACCEL
             *fmt++ = AV_PIX_FMT_DXVA2_VLD;
 #endif
+#if CONFIG_H264_D3D11VA_HWACCEL
+            *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+#endif
 #if CONFIG_H264_VAAPI_HWACCEL
             *fmt++ = AV_PIX_FMT_VAAPI_VLD;
 #endif
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 4c06fb8..a6ee773 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -446,6 +446,9 @@  static int set_sps(HEVCContext *s, const HEVCSPS *sps)
 #if CONFIG_HEVC_DXVA2_HWACCEL
         *fmt++ = AV_PIX_FMT_DXVA2_VLD;
 #endif
+#if CONFIG_HEVC_D3D11VA_HWACCEL
+        *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+#endif
     }
 
     *fmt++ = sps->pix_fmt;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 6ed151a..e8eaa86 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1175,6 +1175,9 @@  static const enum AVPixelFormat mpeg12_hwaccel_pixfmt_list_420[] = {
 #if CONFIG_MPEG2_DXVA2_HWACCEL
     AV_PIX_FMT_DXVA2_VLD,
 #endif
+#if CONFIG_MPEG2_D3D11VA_HWACCEL
+    AV_PIX_FMT_D3D11VA_VLD,
+#endif
 #if CONFIG_MPEG2_VAAPI_HWACCEL
     AV_PIX_FMT_VAAPI_VLD,
 #endif
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 0d578cd..b027d08 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -954,6 +954,9 @@  static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = {
 #if CONFIG_VC1_DXVA2_HWACCEL
     AV_PIX_FMT_DXVA2_VLD,
 #endif
+#if CONFIG_VC1_D3D11VA_HWACCEL
+    AV_PIX_FMT_D3D11VA_VLD,
+#endif
 #if CONFIG_VC1_VAAPI_HWACCEL
     AV_PIX_FMT_VAAPI_VLD,
 #endif
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index ea432f9..6a4f35d 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1339,6 +1339,12 @@  const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .log2_chroma_h = 1,
         .flags = AV_PIX_FMT_FLAG_HWACCEL,
     },
+    [AV_PIX_FMT_D3D11VA_VLD] = {
+        .name = "d3d11va_vld",
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 1,
+        .flags = AV_PIX_FMT_FLAG_HWACCEL,
+    },
     [AV_PIX_FMT_YA8] = {
         .name = "ya8",
         .nb_components = 2,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index e21100f..4e1367e 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -136,6 +136,7 @@  enum AVPixelFormat {
     AV_PIX_FMT_VDPAU_MPEG4,  ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
 #endif
     AV_PIX_FMT_DXVA2_VLD,    ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
+    AV_PIX_FMT_D3D11VA_VLD,  ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
 
     AV_PIX_FMT_RGB444LE,  ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
     AV_PIX_FMT_RGB444BE,  ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0