From patchwork Wed May 31 03:07:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Tong1" X-Patchwork-Id: 41900 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51c:b0:10c:5e6f:955f with SMTP id gm28csp2945545pzb; Tue, 30 May 2023 20:12:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5XRRLnjDvFuFLKyu7XUEp/4/hKehRSQOlcsyUS3BqUdM67fqAeEcqcAPe3haOgB36yiNuT X-Received: by 2002:a17:907:868c:b0:967:4bc7:38c0 with SMTP id qa12-20020a170907868c00b009674bc738c0mr3964651ejc.9.1685502730324; Tue, 30 May 2023 20:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685502730; cv=none; d=google.com; s=arc-20160816; b=m4aibxiH+2FU2y9IP8hCFimA56cPgTdtD+omaH7HALclUa53difH/rPSt2uWi0ygpE +u1wWMhlMcxrBCapu346qc6plXdD4F0yz9Vx7izBqR/iMcc/qarglQLc7cPXBNy/0vWC NOirBjtOLNfr0GtOyD89mjB2np6PkDo51tkGyTX31WndxDmVnr4CsdHtOrDY9ngbpTPf lixSVGIP2uU6IfyGsqaChbQCxT/F4122Z2dOuRUvGPA+X8QyFJwNEJaEXOWwvtrCVfr2 GQMCa766jlDQqNVMmr4HSwchZS5ClTwtr6rZCsO3DH/D5fhgyxsc3flZ86AdY3K6xTVT JZaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=NqWkEjoPEfDaJLgXt5F5A6CmcXekaxeRkB1sundS0X4=; b=t02rwtSeyN3QaNN/QieNFVgBag0Zo0UlXv4mdCVuvHKkpkqFPEKDkI19JbJWkeCxSs wN8B9yLaILYOsT43nJWOFzcmU0pDYRLTTB1bjccWZJEkTvXXcdWi5kfzPpdIuOWJXQzA n2J50w6UFwQ49AZsI6Dgo5/ZQU+gyrirO/paI2eIR8qXQt0qrmaucYg+zDW3GpsNLLA2 7WyhL3B8L3iiycR4WZOfDeFALaKJ1OW9S48zNQNkZTNZ0l6XAg922E0uPtQLGZhcUBMk 56ZoJwTFPVq4Z7i6P8bRl971IGPJqrxNprC/d8GskYvNw7VAcB5P+V4mEokN2s8D7Q+p SpgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=L6kgDu4f; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id zk19-20020a17090733d300b00956f9b9ee73si9617901ejb.938.2023.05.30.20.12.10; Tue, 30 May 2023 20:12:10 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=L6kgDu4f; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 64B1068C21C; Wed, 31 May 2023 06:11:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A283168C20A for ; Wed, 31 May 2023 06:11:35 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685502700; x=1717038700; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9FM5mJcvsSBV6lMK5uc/ORVRvtAxXS5N6pO1es4ypEk=; b=L6kgDu4fY/lZW9ThFEkYv5w6iXtyBfrX/jDvzEv9LcfH9OrnNAD7Wrw8 YxuzyzXCYkFEnaqBye120nYCyKxM1szMF0ArYH3ek6loGnKH/bEecsu96 k0LD4myDrmMF9ZnJ/MSV+AHukjUbaDZE79rx0w9uLKWjDLvlDX26EV5Jt A4DzdcBLHdcy2EOwxZKeeHwYGGStDkMBx+WeP8HX54MAQK82ds+7JXWD9 WwE17Ga71ce6Q9CC3R5qM1hSpX76aWATLD5T5CP/nT7B14ru2MLyc5055 xNd476oraAqzBYjhP8CA4bktQ/h5BP/G/Eq87atW7pw/dNgS+isRstZ++ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="441478868" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="441478868" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 20:11:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="771825791" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="771825791" Received: from desktop-qn7n0nf.sh.intel.com (HELO localhost.localdomain) ([10.239.160.59]) by fmsmga008.fm.intel.com with ESMTP; 30 May 2023 20:11:31 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Wed, 31 May 2023 11:07:16 +0800 Message-Id: <20230531030722.1307-3-tong1.wu@intel.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20230531030722.1307-1-tong1.wu@intel.com> References: <20230531030722.1307-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/9] avcodec: add D3D12VA hardware accelerated HEVC decoding X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: av9fFzdsb4CO From: Wu Jianhua The command below is how to enable d3d12va: ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4 Signed-off-by: Wu Jianhua --- configure | 2 + libavcodec/Makefile | 1 + libavcodec/d3d12va_hevc.c | 211 ++++++++++++++++++++++++++++++++++++ libavcodec/dxva2_hevc.c | 10 +- libavcodec/dxva2_internal.h | 6 + libavcodec/hevcdec.c | 10 ++ libavcodec/hwaccels.h | 1 + 7 files changed, 237 insertions(+), 4 deletions(-) create mode 100644 libavcodec/d3d12va_hevc.c diff --git a/configure b/configure index f5dad4653f..3d25e5fdea 100755 --- a/configure +++ b/configure @@ -3051,6 +3051,8 @@ hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" hevc_d3d11va_hwaccel_select="hevc_decoder" hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" hevc_d3d11va2_hwaccel_select="hevc_decoder" +hevc_d3d12va_hwaccel_deps="d3d12va DXVA_PicParams_HEVC" +hevc_d3d12va_hwaccel_select="hevc_decoder" hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_nvdec_hwaccel_deps="nvdec" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ae143d8821..6cc28f2fd0 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1004,6 +1004,7 @@ OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o OBJS-$(CONFIG_H264_VULKAN_HWACCEL) += vulkan_decode.o vulkan_h264.o OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o +OBJS-$(CONFIG_HEVC_D3D12VA_HWACCEL) += dxva2_hevc.o d3d12va_hevc.o OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o diff --git a/libavcodec/d3d12va_hevc.c b/libavcodec/d3d12va_hevc.c new file mode 100644 index 0000000000..1d94831e01 --- /dev/null +++ b/libavcodec/d3d12va_hevc.c @@ -0,0 +1,211 @@ +/* + * Direct3D 12 HEVC HW acceleration + * + * copyright (c) 2022-2023 Wu Jianhua + * + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config_components.h" + +#include "libavutil/avassert.h" +#include "libavutil/hwcontext_d3d12va_internal.h" +#include "hevc_data.h" +#include "hevcdec.h" +#include "dxva2_internal.h" +#include "d3d12va.h" +#include + +#define MAX_SLICES 256 + +typedef struct HEVCDecodePictureContext { + DXVA_PicParams_HEVC pp; + DXVA_Qmatrix_HEVC qm; + unsigned slice_count; + DXVA_Slice_HEVC_Short slice_short[MAX_SLICES]; + const uint8_t *bitstream; + unsigned bitstream_size; +} HEVCDecodePictureContext; + +static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, unsigned size) +{ + memset(slice, 0, sizeof(*slice)); + slice->BSNALunitDataLocation = position; + slice->SliceBytesInBuffer = size; + slice->wBadSliceChopping = 0; +} + +static int d3d12va_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +{ + const HEVCContext *h = avctx->priv_data; + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + HEVCDecodePictureContext *ctx_pic = h->ref->hwaccel_picture_private; + + if (!ctx) + return -1; + + av_assert0(ctx_pic); + + ff_dxva2_hevc_fill_picture_parameters(avctx, (AVDXVAContext *)ctx, &ctx_pic->pp); + + ff_dxva2_hevc_fill_scaling_lists(avctx, (AVDXVAContext *)ctx, &ctx_pic->qm); + + ctx_pic->slice_count = 0; + ctx_pic->bitstream_size = 0; + ctx_pic->bitstream = NULL; + + return 0; +} + +static int d3d12va_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +{ + const HEVCContext *h = avctx->priv_data; + const HEVCFrame *current_picture = h->ref; + HEVCDecodePictureContext *ctx_pic = current_picture->hwaccel_picture_private; + unsigned position; + + if (ctx_pic->slice_count >= MAX_SLICES) + return AVERROR(ERANGE); + + if (!ctx_pic->bitstream) + ctx_pic->bitstream = buffer; + ctx_pic->bitstream_size += size; + + position = buffer - ctx_pic->bitstream; + fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count], position, size); + ctx_pic->slice_count++; + + return 0; +} + +#define START_CODE 65536 +#define START_CODE_SIZE 3 +static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *input_args, ID3D12Resource *buffer) +{ + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + AVHWFramesContext *frames_ctx = D3D12VA_FRAMES_CONTEXT(avctx); + AVD3D12VAFramesContext *frames_hwctx = frames_ctx->hwctx; + + const HEVCContext *h = avctx->priv_data; + const HEVCFrame *current_picture = h->ref; + HEVCDecodePictureContext *ctx_pic = current_picture->hwaccel_picture_private; + + int i, index; + uint8_t *mapped_data, *mapped_ptr; + DXVA_Slice_HEVC_Short *slice; + D3D12_VIDEO_DECODE_FRAME_ARGUMENT *args; + + if (FAILED(ID3D12Resource_Map(buffer, 0, NULL, &mapped_data))) { + av_log(avctx, AV_LOG_ERROR, "Failed to map D3D12 Buffer resource!\n"); + return AVERROR(EINVAL); + } + + mapped_ptr = mapped_data; + for (i = 0; i < ctx_pic->slice_count; i++) { + UINT position, size; + slice = &ctx_pic->slice_short[i]; + + position = slice->BSNALunitDataLocation; + size = slice->SliceBytesInBuffer; + + slice->SliceBytesInBuffer += START_CODE_SIZE; + slice->BSNALunitDataLocation = mapped_ptr - mapped_data; + + *(uint32_t *)mapped_ptr = START_CODE; + mapped_ptr += START_CODE_SIZE; + + memcpy(mapped_ptr, &ctx_pic->bitstream[position], size); + mapped_ptr += size; + } + + ID3D12Resource_Unmap(buffer, 0, NULL); + + input_args->CompressedBitstream = (D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM){ + .pBuffer = buffer, + .Offset = 0, + .Size = mapped_ptr - mapped_data, + }; + + args = &input_args->FrameArguments[input_args->NumFrameArguments++]; + args->Type = D3D12_VIDEO_DECODE_ARGUMENT_TYPE_SLICE_CONTROL; + args->Size = sizeof(DXVA_Slice_HEVC_Short) * ctx_pic->slice_count; + args->pData = ctx_pic->slice_short; + + index = ctx_pic->pp.CurrPic.Index7Bits; + ctx->ref_resources[index] = frames_hwctx->texture_infos[index].texture; + for (i = 0; i < FF_ARRAY_ELEMS(ctx_pic->pp.RefPicList); i++) { + index = ctx_pic->pp.RefPicList[i].Index7Bits; + if (index != 0x7f) + ctx->ref_resources[index] = frames_hwctx->texture_infos[index].texture; + } + + return 0; +} + +static int d3d12va_hevc_end_frame(AVCodecContext *avctx) +{ + HEVCContext *h = avctx->priv_data; + HEVCDecodePictureContext *ctx_pic = h->ref->hwaccel_picture_private; + + int scale = ctx_pic->pp.dwCodingParamToolFlags & 1; + + if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) + return -1; + + return ff_d3d12va_common_end_frame(avctx, h->ref->frame, &ctx_pic->pp, sizeof(ctx_pic->pp), + scale ? &ctx_pic->qm : NULL, scale ? sizeof(ctx_pic->qm) : 0, update_input_arguments); +} + +static int d3d12va_hevc_decode_init(AVCodecContext *avctx) +{ + HEVCContext *h = avctx->priv_data; + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + + switch (avctx->profile) { + case FF_PROFILE_HEVC_MAIN_10: + ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN10; + break; + + case FF_PROFILE_HEVC_MAIN_STILL_PICTURE: + av_log(avctx, AV_LOG_ERROR, "D3D12 doesn't support PROFILE_HEVC_MAIN_STILL_PICTURE!\n"); + return AVERROR(EINVAL); + + case FF_PROFILE_HEVC_MAIN: + default: + ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN; + break; + }; + + return ff_d3d12va_decode_init(avctx); +} + +#if CONFIG_HEVC_D3D12VA_HWACCEL +const AVHWAccel ff_hevc_d3d12va_hwaccel = { + .name = "hevc_d3d12va", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_HEVC, + .pix_fmt = AV_PIX_FMT_D3D12, + .init = d3d12va_hevc_decode_init, + .uninit = ff_d3d12va_decode_uninit, + .start_frame = d3d12va_hevc_start_frame, + .decode_slice = d3d12va_hevc_decode_slice, + .end_frame = d3d12va_hevc_end_frame, + .frame_params = ff_d3d12va_common_frame_params, + .frame_priv_data_size = sizeof(HEVCDecodePictureContext), + .priv_data_size = sizeof(D3D12VADecodeContext), +}; +#endif diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c index 6b239d9917..2b8c0e2a9a 100644 --- a/libavcodec/dxva2_hevc.c +++ b/libavcodec/dxva2_hevc.c @@ -56,9 +56,10 @@ static int get_refpic_index(const DXVA_PicParams_HEVC *pp, int surface_index) return 0xff; } -static void fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, const HEVCContext *h, +void ff_dxva2_hevc_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_HEVC *pp) { + const HEVCContext *h = avctx->priv_data; const HEVCFrame *current_picture = h->ref; const HEVCSPS *sps = h->ps.sps; const HEVCPPS *pps = h->ps.pps; @@ -199,8 +200,9 @@ static void fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext * pp->StatusReportFeedbackNumber = 1 + DXVA_CONTEXT_REPORT_ID(avctx, ctx)++; } -static void fill_scaling_lists(AVDXVAContext *ctx, const HEVCContext *h, DXVA_Qmatrix_HEVC *qm) +void ff_dxva2_hevc_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_HEVC *qm) { + const HEVCContext *h = avctx->priv_data; unsigned i, j, pos; const ScalingList *sl = h->ps.pps->scaling_list_data_present_flag ? &h->ps.pps->scaling_list : &h->ps.sps->scaling_list; @@ -368,10 +370,10 @@ static int dxva2_hevc_start_frame(AVCodecContext *avctx, av_assert0(ctx_pic); /* Fill up DXVA_PicParams_HEVC */ - fill_picture_parameters(avctx, ctx, h, &ctx_pic->pp); + ff_dxva2_hevc_fill_picture_parameters(avctx, ctx, &ctx_pic->pp); /* Fill up DXVA_Qmatrix_HEVC */ - fill_scaling_lists(ctx, h, &ctx_pic->qm); + ff_dxva2_hevc_fill_scaling_lists(avctx, ctx, &ctx_pic->qm); ctx_pic->slice_count = 0; ctx_pic->bitstream_size = 0; diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index 03f4003c67..f6106d80da 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -168,4 +168,10 @@ void ff_dxva2_h264_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACo void ff_dxva2_h264_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_H264 *qm); #endif +#if CONFIG_HEVC_D3D12VA_HWACCEL +void ff_dxva2_hevc_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_HEVC *pp); + +void ff_dxva2_hevc_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_HEVC *qm); +#endif + #endif /* AVCODEC_DXVA2_INTERNAL_H */ diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index eee77ec4db..f515725aa7 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -402,6 +402,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) { #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \ CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \ + CONFIG_HEVC_D3D12VA_HWACCEL + \ CONFIG_HEVC_NVDEC_HWACCEL + \ CONFIG_HEVC_VAAPI_HWACCEL + \ CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \ @@ -419,6 +420,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) *fmt++ = AV_PIX_FMT_D3D11VA_VLD; *fmt++ = AV_PIX_FMT_D3D11; #endif +#if CONFIG_HEVC_D3D12VA_HWACCEL + *fmt++ = AV_PIX_FMT_D3D12; +#endif #if CONFIG_HEVC_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif @@ -443,6 +447,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) *fmt++ = AV_PIX_FMT_D3D11VA_VLD; *fmt++ = AV_PIX_FMT_D3D11; #endif +#if CONFIG_HEVC_D3D12VA_HWACCEL + *fmt++ = AV_PIX_FMT_D3D12; +#endif #if CONFIG_HEVC_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif @@ -3778,6 +3785,9 @@ const FFCodec ff_hevc_decoder = { #if CONFIG_HEVC_D3D11VA2_HWACCEL HWACCEL_D3D11VA2(hevc), #endif +#if CONFIG_HEVC_D3D12VA_HWACCEL + HWACCEL_D3D12VA(hevc), +#endif #if CONFIG_HEVC_NVDEC_HWACCEL HWACCEL_NVDEC(hevc), #endif diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h index be54604b81..70e115f78a 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h @@ -41,6 +41,7 @@ extern const AVHWAccel ff_h264_videotoolbox_hwaccel; extern const AVHWAccel ff_h264_vulkan_hwaccel; extern const AVHWAccel ff_hevc_d3d11va_hwaccel; extern const AVHWAccel ff_hevc_d3d11va2_hwaccel; +extern const AVHWAccel ff_hevc_d3d12va_hwaccel; extern const AVHWAccel ff_hevc_dxva2_hwaccel; extern const AVHWAccel ff_hevc_nvdec_hwaccel; extern const AVHWAccel ff_hevc_vaapi_hwaccel;