From patchwork Wed May 31 03:07:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Tong1" X-Patchwork-Id: 41903 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51c:b0:10c:5e6f:955f with SMTP id gm28csp2945754pzb; Tue, 30 May 2023 20:12:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Pu1xkxV7KDclo36LM/ilmvf/4Ik4+sui0g4C1b7QKe0DUscgXl+WR/4QBKdSF/Vbyy71J X-Received: by 2002:a17:907:7da5:b0:966:4d75:4a44 with SMTP id oz37-20020a1709077da500b009664d754a44mr3653378ejc.24.1685502760085; Tue, 30 May 2023 20:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685502760; cv=none; d=google.com; s=arc-20160816; b=tDrnn0si180mpT+D26AZn3Jzq62u4h/dG7qoLsmx15H+wlYjn/Jsr1pA6VVK4IAH06 jGpK8MkaF7SmV0j2NseETPNqeDzLqbaT/mH+0QWAJmkGG9zz+LtFAbsVCJp0t6xE3KXx F2fJKGaz9plztOp1jsvqk9PxQsiteTcwVI964ooAPa3tAU8VqCrH58FY5Zl4Gs5SVlwG 4fMbBfqBhRm/vnRelHYAw8okH+W69k+TQl6UA59kAPbh5LLL5msojYPpqpr4iZrWHyE5 9x2Rmv1beUNfaOp0JC3LWPNOjJcK1n+joR6LTUCz9K2VNocPbHz2BzOBAaI3VJCT6UJK 11ZA== 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=/DiukAwAvDWwUcUU1zsJn2o/zkS5ytgwBgpgBTdX2uM=; b=hCyv08kXG93DAze5TBbQbPi4UEz3fr4Oyi+Bcxasa2SM8ThF9C6/b7vJEL6g5MmCMt moHC8YhSeQna6Cck+A5eMTIc3uFI95xJvRTDS4Y7LF5HNgYUFxPR55XcuamGz9aDKfyn +gJ+pZu/KnII1P08B62rZJKIm1J2Eo8zi8CG8DSSLC5+6uY+EeqqTyAd4/wocmHzPgT7 xRrtnGXVgszaPzRAjSCr+Pvgj9J+l8lg22em7pzykZkNkYD6OJh1EK7e5ZYxuqPkTlSN qOrPdZbhlFI7PEoTVGbDGFKF1fhLUFtuspsQT42hd8AkCaQlOVkx0ZrCwuFEUI/QF/b2 meFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=kHvPWWUk; 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 gv45-20020a1709072bed00b0096f57e4f65csi2474692ejc.308.2023.05.30.20.12.39; Tue, 30 May 2023 20:12:40 -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=kHvPWWUk; 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 719F468C264; Wed, 31 May 2023 06:11:48 +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 DE75168C21E for ; Wed, 31 May 2023 06:11:41 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685502707; x=1717038707; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wb6A30AsoXRY6GrNlM1l7iaO6c6qLD5ox+mnIlcsp9A=; b=kHvPWWUk6bLXdDAoKOzHoiNRK2RDcsCwmSUEQQ9NPTugVFw7vwFDRBRj fQl2Ky38ep7LpH4GbhTZ8ADR0q/XNTEPhGXFm1XYiTKVrBA/OTRiUh6TP OPnT630slb5Gw88VQ9bH0JsRrXboGy+HQHRBXi6vC3Y9e+sA1jJn3WLys R4JbkcM5bwBGnOD2CsONX91UmMY7mo86WzCZT0tn2NTkRRhYKEQEovtwH RnBchZSdDdR7sClLaXQpu53Y77/IkIUS8ByvaZMWOevKNgl45RGBqnMT2 ShsKiCq3KrDEmTnWusJ7ZeXc8xQD9t7I7VSg1zIBTreM8fdWk+M7xLHX2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="441478881" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="441478881" 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:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="771825801" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="771825801" 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:35 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Wed, 31 May 2023 11:07:19 +0800 Message-Id: <20230531030722.1307-6-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 6/9] avcodec: add D3D12VA hardware accelerated MPEG-2 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: h8Y6kWecgS5G 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_mpeg2.c | 191 ++++++++++++++++++++++++++++++++++++ libavcodec/dxva2_internal.h | 8 ++ libavcodec/dxva2_mpeg2.c | 18 ++-- libavcodec/hwaccels.h | 1 + libavcodec/mpeg12dec.c | 6 ++ 7 files changed, 218 insertions(+), 9 deletions(-) create mode 100644 libavcodec/d3d12va_mpeg2.c diff --git a/configure b/configure index 1d05c898fb..9f8c535f5c 100755 --- a/configure +++ b/configure @@ -3081,6 +3081,8 @@ mpeg2_d3d11va_hwaccel_deps="d3d11va" mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder" mpeg2_d3d11va2_hwaccel_deps="d3d11va" mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder" +mpeg2_d3d12va_hwaccel_deps="d3d12va" +mpeg2_d3d12va_hwaccel_select="mpeg2video_decoder" mpeg2_dxva2_hwaccel_deps="dxva2" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" mpeg2_nvdec_hwaccel_deps="nvdec" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d2940aad4c..98d4ff814d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1018,6 +1018,7 @@ OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o +OBJS-$(CONFIG_MPEG2_D3D12VA_HWACCEL) += dxva2_mpeg2.o d3d12va_mpeg2.o OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL) += nvdec_mpeg12.o OBJS-$(CONFIG_MPEG2_QSV_HWACCEL) += qsvdec.o OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o diff --git a/libavcodec/d3d12va_mpeg2.c b/libavcodec/d3d12va_mpeg2.c new file mode 100644 index 0000000000..3f93a417c6 --- /dev/null +++ b/libavcodec/d3d12va_mpeg2.c @@ -0,0 +1,191 @@ +/* + * Direct3D12 MPEG-2 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 "mpegutils.h" +#include "mpegvideodec.h" +#include "d3d12va.h" +#include "dxva2_internal.h" + +#define MAX_SLICES 1024 +#define INVALID_REF 0xffff + +#define REF_RESOURCE(index) if (index != INVALID_REF) { \ + ctx->ref_resources[index] = frames_hwctx->texture_infos[index].texture; \ +} + +typedef struct D3D12DecodePictureContext { + DXVA_PictureParameters pp; + DXVA_QmatrixData qm; + unsigned slice_count; + DXVA_SliceInfo slices[MAX_SLICES]; + const uint8_t *bitstream; + unsigned bitstream_size; +} D3D12DecodePictureContext; + +static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +{ + const MpegEncContext *s = avctx->priv_data; + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + DXVA_QmatrixData *qm = &ctx_pic->qm; + + if (!ctx) + return -1; + + av_assert0(ctx_pic); + + ff_dxva2_mpeg2_fill_picture_parameters(avctx, (AVDXVAContext *)ctx, &ctx_pic->pp); + ff_dxva2_mpeg2_fill_quantization_matrices(avctx, (AVDXVAContext *)ctx, &ctx_pic->qm); + + // Post processing operations are not supported in D3D12 Video + ctx_pic->pp.wDeblockedPictureIndex = INVALID_REF; + + ctx_pic->bitstream = NULL; + ctx_pic->bitstream_size = 0; + ctx_pic->slice_count = 0; + + return 0; +} + +static int d3d12va_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +{ + const MpegEncContext *s = avctx->priv_data; + D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + + int is_field = s->picture_structure != PICT_FRAME; + + if (ctx_pic->slice_count >= MAX_SLICES) { + return AVERROR(ERANGE); + } + + if (!ctx_pic->bitstream) + ctx_pic->bitstream = buffer; + ctx_pic->bitstream_size += size; + + ff_dxva2_mpeg2_fill_slice(avctx, &ctx_pic->slices[ctx_pic->slice_count++], + buffer - ctx_pic->bitstream, buffer, size); + + return 0; +} + +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 MpegEncContext *s = avctx->priv_data; + D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + + const int is_field = s->picture_structure != PICT_FRAME; + const unsigned mb_count = s->mb_width * (s->mb_height >> is_field); + + int i; + uint8_t *mapped_data = NULL; + D3D12_VIDEO_DECODE_FRAME_ARGUMENT *args = &input_args->FrameArguments[input_args->NumFrameArguments++]; + + D3D12_RANGE range = { + .Begin = 0, + .End = ctx_pic->bitstream_size, + }; + + if (FAILED(ID3D12Resource_Map(buffer, 0, &range, &mapped_data))) { + av_log(avctx, AV_LOG_ERROR, "Failed to map D3D12 Buffer resource!\n"); + return AVERROR(EINVAL); + } + + for (i = 0; i < ctx_pic->slice_count; i++) { + DXVA_SliceInfo *slice = &ctx_pic->slices[i]; + + if (i < ctx_pic->slice_count - 1) + slice->wNumberMBsInSlice = slice[1].wNumberMBsInSlice - slice[0].wNumberMBsInSlice; + else + slice->wNumberMBsInSlice = mb_count - slice[0].wNumberMBsInSlice; + } + + memcpy(mapped_data, ctx_pic->bitstream, ctx_pic->bitstream_size); + + ID3D12Resource_Unmap(buffer, 0, &range); + + args->Type = D3D12_VIDEO_DECODE_ARGUMENT_TYPE_SLICE_CONTROL; + args->Size = sizeof(DXVA_SliceInfo) * ctx_pic->slice_count; + args->pData = ctx_pic->slices; + + input_args->CompressedBitstream = (D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM){ + .pBuffer = buffer, + .Offset = 0, + .Size = ctx_pic->bitstream_size, + }; + + REF_RESOURCE(ctx_pic->pp.wDecodedPictureIndex ) + REF_RESOURCE(ctx_pic->pp.wForwardRefPictureIndex ) + REF_RESOURCE(ctx_pic->pp.wBackwardRefPictureIndex) + + return 0; +} + +static int d3d12va_mpeg2_end_frame(AVCodecContext *avctx) +{ + int ret; + MpegEncContext *s = avctx->priv_data; + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + + if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) + return -1; + + ret = ff_d3d12va_common_end_frame(avctx, s->current_picture_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), + &ctx_pic->qm, sizeof(ctx_pic->qm), update_input_arguments); + if (!ret) + ff_mpeg_draw_horiz_band(s, 0, avctx->height); + + return ret; +} + +static int d3d12va_mpeg2_decode_init(AVCodecContext *avctx) +{ + const MpegEncContext *s = avctx->priv_data; + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + + ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_MPEG2; + + return ff_d3d12va_decode_init(avctx); +} + +#if CONFIG_MPEG2_D3D12VA_HWACCEL +const AVHWAccel ff_mpeg2_d3d12va_hwaccel = { + .name = "mpeg2_d3d12va", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_MPEG2VIDEO, + .pix_fmt = AV_PIX_FMT_D3D12, + .init = d3d12va_mpeg2_decode_init, + .uninit = ff_d3d12va_decode_uninit, + .start_frame = d3d12va_mpeg2_start_frame, + .decode_slice = d3d12va_mpeg2_decode_slice, + .end_frame = d3d12va_mpeg2_end_frame, + .frame_params = ff_d3d12va_common_frame_params, + .frame_priv_data_size = sizeof(D3D12DecodePictureContext), + .priv_data_size = sizeof(D3D12VADecodeContext), +}; +#endif diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index 0084e837b7..b3daa7476f 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -182,4 +182,12 @@ int ff_dxva2_vp9_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACont int ff_dxva2_av1_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_AV1 *pp); #endif +#if CONFIG_MPEG2_D3D12VA_HWACCEL +void ff_dxva2_mpeg2_fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PictureParameters *pp); + +void ff_dxva2_mpeg2_fill_quantization_matrices(AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_QmatrixData *qm); + +void ff_dxva2_mpeg2_fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, const uint8_t *buffer, unsigned size); +#endif + #endif /* AVCODEC_DXVA2_INTERNAL_H */ diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index 1989c588dc..2e8e545113 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -39,11 +39,11 @@ struct dxva2_picture_context { unsigned bitstream_size; }; -static void fill_picture_parameters(AVCodecContext *avctx, +void ff_dxva2_mpeg2_fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, - const struct MpegEncContext *s, DXVA_PictureParameters *pp) { + const struct MpegEncContext *s = avctx->priv_data; const Picture *current_picture = s->current_picture_ptr; int is_field = s->picture_structure != PICT_FRAME; @@ -105,11 +105,11 @@ static void fill_picture_parameters(AVCodecContext *avctx, pp->bBitstreamConcealmentMethod = 0; } -static void fill_quantization_matrices(AVCodecContext *avctx, +void ff_dxva2_mpeg2_fill_quantization_matrices(AVCodecContext *avctx, AVDXVAContext *ctx, - const struct MpegEncContext *s, DXVA_QmatrixData *qm) { + const struct MpegEncContext *s = avctx->priv_data; int i; for (i = 0; i < 4; i++) qm->bNewQmatrix[i] = 1; @@ -122,12 +122,12 @@ static void fill_quantization_matrices(AVCodecContext *avctx, } } -static void fill_slice(AVCodecContext *avctx, - const struct MpegEncContext *s, +void ff_dxva2_mpeg2_fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, const uint8_t *buffer, unsigned size) { + const struct MpegEncContext *s = avctx->priv_data; int is_field = s->picture_structure != PICT_FRAME; GetBitContext gb; @@ -265,8 +265,8 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx, return -1; assert(ctx_pic); - fill_picture_parameters(avctx, ctx, s, &ctx_pic->pp); - fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm); + ff_dxva2_mpeg2_fill_picture_parameters(avctx, ctx, &ctx_pic->pp); + ff_dxva2_mpeg2_fill_quantization_matrices(avctx, ctx, &ctx_pic->qm); ctx_pic->slice_count = 0; ctx_pic->bitstream_size = 0; @@ -292,7 +292,7 @@ static int dxva2_mpeg2_decode_slice(AVCodecContext *avctx, ctx_pic->bitstream_size += size; position = buffer - ctx_pic->bitstream; - fill_slice(avctx, s, &ctx_pic->slice[ctx_pic->slice_count++], position, + ff_dxva2_mpeg2_fill_slice(avctx, &ctx_pic->slice[ctx_pic->slice_count++], position, buffer, size); return 0; } diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h index 517e70d5c4..7443eaa5d8 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h @@ -56,6 +56,7 @@ extern const AVHWAccel ff_mpeg1_vdpau_hwaccel; extern const AVHWAccel ff_mpeg1_videotoolbox_hwaccel; extern const AVHWAccel ff_mpeg2_d3d11va_hwaccel; extern const AVHWAccel ff_mpeg2_d3d11va2_hwaccel; +extern const AVHWAccel ff_mpeg2_d3d12va_hwaccel; extern const AVHWAccel ff_mpeg2_nvdec_hwaccel; extern const AVHWAccel ff_mpeg2_dxva2_hwaccel; extern const AVHWAccel ff_mpeg2_vaapi_hwaccel; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 27c862ffb2..2ceec3f9f0 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1129,6 +1129,9 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = { AV_PIX_FMT_D3D11VA_VLD, AV_PIX_FMT_D3D11, #endif +#if CONFIG_MPEG2_D3D12VA_HWACCEL + AV_PIX_FMT_D3D12, +#endif #if CONFIG_MPEG2_VAAPI_HWACCEL AV_PIX_FMT_VAAPI, #endif @@ -2922,6 +2925,9 @@ const FFCodec ff_mpeg2video_decoder = { #if CONFIG_MPEG2_D3D11VA2_HWACCEL HWACCEL_D3D11VA2(mpeg2), #endif +#if CONFIG_MPEG2_D3D12VA_HWACCEL + HWACCEL_D3D12VA(mpeg2), +#endif #if CONFIG_MPEG2_NVDEC_HWACCEL HWACCEL_NVDEC(mpeg2), #endif