From patchwork Tue Dec 5 06:46:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Tong1" X-Patchwork-Id: 44912 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp145972pzc; Mon, 4 Dec 2023 22:52:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/wVmra34h4t1lZiqg0Q9NJrj8aiazDaS9DbDX47TFrQqph1xyVBOoVFADKg/sxJlVtS9q X-Received: by 2002:a17:906:2c3:b0:a19:a1ba:da6f with SMTP id 3-20020a17090602c300b00a19a1bada6fmr3483421ejk.150.1701759177252; Mon, 04 Dec 2023 22:52:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701759177; cv=none; d=google.com; s=arc-20160816; b=lpDti6h51ECfQd8MnbY+az2njidxfVM1a8D/JhPyYgg3TblbSDpdHh7izVhlBMmGqw lUv3BaE2pts2NsvX0oRhDbfJqK9Bgtz8k6EO6sIfI3UyMwZONYXdsLMEuHMYvmYDWGii TIJ8aM7vi0mADeyYt4oGrN8gJ3xXqfhBU6lS+ktAhlhQw8+WB1J1SxdyX0ro4eaycW3W vBFb4ZyWCHZ3IwH/Hn1fV8BT7xcHJUpLibw1fi5uYFFZVFTmj+UCPMf6fYZyMZTnIKVI my325cx3mIDmbaVk10+KSv1+ckyIRosnXLl6ZbiR8x/x4kPmnYRoojI7fznBe3ylCfeu 3qKQ== 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=Q8WPzFbo3KotIj9RVnRkNjpdultR+5Zg/Hb1M65Cf94=; fh=9GN8hc/WTnabikg2VxPLeDN+i3R37IqYi/LhxNANmV0=; b=U/Oq4tIn1ALHLLN2mDOQ4b0oQj88dHamZD+kokE1NfZZ1w/k4WzPABhSNgF4wgZ/gd wB9ul/MDMntoBBLF/G0ovn+hb+wfV/5zKyFBdfBquZfMknsTj1lcfM0Gz6uQt0SMgGq/ 0XurA0c7WeY1ZKeJke4xbPLcsD/DeEyJJS11g+20OWtw4KOmjsMNcGCGfqX17eDjGeZa MfmjgFbOaSb2kLqo+H6Mnd5s+I7JGy1e2/M++Z1eJ4sq32yVUgGA1rnRlFIxspYuKDE1 dubYI4yK2LmMYjYjQ7BwbNmMFveP4fWc22ZUdVUct9L3tnjbKRnEzBoJuPmKFaWFGOTt GB8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=XawlR31B; 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 bz2-20020a1709070aa200b00a1bbb2fc09dsi857798ejc.541.2023.12.04.22.52.56; Mon, 04 Dec 2023 22:52:57 -0800 (PST) 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=XawlR31B; 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 470DB68CF34; Tue, 5 Dec 2023 08:51:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 061C268CEB1 for ; Tue, 5 Dec 2023 08:51:37 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701759103; x=1733295103; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/w+upb28vv87x6wFi9aVqyrVoRfke55jA5rEsVKo6UQ=; b=XawlR31B/SFi09sge/+zKtKhIXkEF3VzgGjfd1H0tNeneQ9A+/45xOwO t3t85gvklstELgKPIWXaGx7EDkKXGM6cWPsFGjK6gw9vjFTIuJzPG4hPp lgvfZ5oxLxC4ibSSuReGZmf6sjxYqFkamwQETYOIQOKclnTABieO+er74 vSo0VeIwLFzlJwwgzze7Xhr6vcjdRjwEY1Ff6YPt/cCkDfZDvMbyPvNqu zjn+2oLrefXxGPxABMr2R3B9hSAHE1R5EhK6pF5Cq/stUkJ2R0WYhwc5g WCXA0Yp1wJW3GPFo+Jv1WVi5yCOZqZHpYLBYnGCO3qZsWI53w8t+CkjUy g==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="391012394" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="391012394" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 22:51:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="799853646" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="799853646" Received: from desktop-qn7n0nf.sh.intel.com (HELO localhost.localdomain) ([10.239.160.66]) by orsmga008.jf.intel.com with ESMTP; 04 Dec 2023 22:51:28 -0800 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Tue, 5 Dec 2023 14:46:49 +0800 Message-ID: <20231205065034.1621-7-tong1.wu@intel.com> X-Mailer: git-send-email 2.41.0.windows.1 In-Reply-To: <20231205065034.1621-1-tong1.wu@intel.com> References: <20231205065034.1621-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v12 7/9] avcodec: add D3D12VA hardware accelerated VC1 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: Tong Wu , Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: vQAA0r8Vqmna From: Wu Jianhua The command below is how to enable d3d12va: ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4 Signed-off-by: Wu Jianhua Signed-off-by: Tong Wu --- configure | 3 + libavcodec/Makefile | 1 + libavcodec/d3d12va_vc1.c | 214 ++++++++++++++++++++++++++++++++++++ libavcodec/dxva2_internal.h | 4 + libavcodec/dxva2_vc1.c | 15 +-- libavcodec/hwaccels.h | 2 + libavcodec/vc1dec.c | 9 ++ 7 files changed, 241 insertions(+), 7 deletions(-) create mode 100644 libavcodec/d3d12va_vc1.c diff --git a/configure b/configure index 7981833ec3..4b8545ace2 100755 --- a/configure +++ b/configure @@ -3156,6 +3156,8 @@ vc1_d3d11va_hwaccel_deps="d3d11va" vc1_d3d11va_hwaccel_select="vc1_decoder" vc1_d3d11va2_hwaccel_deps="d3d11va" vc1_d3d11va2_hwaccel_select="vc1_decoder" +vc1_d3d12va_hwaccel_deps="d3d12va" +vc1_d3d12va_hwaccel_select="vc1_decoder" vc1_dxva2_hwaccel_deps="dxva2" vc1_dxva2_hwaccel_select="vc1_decoder" vc1_nvdec_hwaccel_deps="nvdec" @@ -3186,6 +3188,7 @@ vp9_videotoolbox_hwaccel_deps="videotoolbox" vp9_videotoolbox_hwaccel_select="vp9_decoder" wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel" wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel" +wmv3_d3d12va_hwaccel_select="vc1_d3d12va_hwaccel" wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel" wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 889f844031..5dd5ea68a6 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1039,6 +1039,7 @@ OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL) += vdpau_mpeg4.o OBJS-$(CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o OBJS-$(CONFIG_VC1_D3D11VA_HWACCEL) += dxva2_vc1.o OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o +OBJS-$(CONFIG_VC1_D3D12VA_HWACCEL) += dxva2_vc1.o d3d12va_vc1.o OBJS-$(CONFIG_VC1_NVDEC_HWACCEL) += nvdec_vc1.o OBJS-$(CONFIG_VC1_QSV_HWACCEL) += qsvdec.o OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o diff --git a/libavcodec/d3d12va_vc1.c b/libavcodec/d3d12va_vc1.c new file mode 100644 index 0000000000..3d15abd1f1 --- /dev/null +++ b/libavcodec/d3d12va_vc1.c @@ -0,0 +1,214 @@ +/* + * Direct3D12 WMV3/VC-1 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 "vc1.h" +#include "vc1data.h" +#include "d3d12va_decode.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; + unsigned slice_count; + DXVA_SliceInfo slices[MAX_SLICES]; + const uint8_t *bitstream; + unsigned bitstream_size; +} D3D12DecodePictureContext; + +static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +{ + const VC1Context *v = avctx->priv_data; + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + D3D12DecodePictureContext *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + + if (!ctx) + return -1; + + av_assert0(ctx_pic); + + ctx->used_mask = 0; + + ff_dxva2_vc1_fill_picture_parameters(avctx, (AVDXVAContext *)ctx, &ctx_pic->pp); + 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_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) +{ + const VC1Context *v = avctx->priv_data; + D3D12DecodePictureContext *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + + if (ctx_pic->slice_count >= MAX_SLICES) { + return AVERROR(ERANGE); + } + + if (avctx->codec_id == AV_CODEC_ID_VC1 && + size >= 4 && IS_MARKER(AV_RB32(buffer))) { + buffer += 4; + size -= 4; + } + + if (!ctx_pic->bitstream) + ctx_pic->bitstream = buffer; + ctx_pic->bitstream_size += size; + + ff_dxva2_vc1_fill_slice(avctx, &ctx_pic->slices[ctx_pic->slice_count++], + buffer - ctx_pic->bitstream, 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 VC1Context *v = avctx->priv_data; + const MpegEncContext *s = &v->s; + D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + D3D12_VIDEO_DECODE_FRAME_ARGUMENT *args = &input_args->FrameArguments[input_args->NumFrameArguments++]; + + const unsigned mb_count = s->mb_width * (s->mb_height >> v->field_mode); + uint8_t *mapped_data, *mapped_ptr; + + static const uint8_t start_code[] = { 0, 0, 1, 0x0d }; + + 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 (int i = 0; i < ctx_pic->slice_count; i++) { + DXVA_SliceInfo *slice = &ctx_pic->slices[i]; + unsigned position = slice->dwSliceDataLocation; + unsigned size = slice->dwSliceBitsInBuffer / 8; + + slice->dwSliceDataLocation = mapped_ptr - mapped_data; + if (i < ctx_pic->slice_count - 1) + slice->wNumberMBsInSlice = slice[1].wNumberMBsInSlice - slice[0].wNumberMBsInSlice; + else + slice->wNumberMBsInSlice = mb_count - slice[0].wNumberMBsInSlice; + + if (avctx->codec_id == AV_CODEC_ID_VC1) { + memcpy(mapped_ptr, start_code, sizeof(start_code)); + if (i == 0 && v->second_field) + mapped_ptr[3] = 0x0c; + else if (i > 0) + mapped_ptr[3] = 0x0b; + + mapped_ptr += sizeof(start_code); + slice->dwSliceBitsInBuffer += sizeof(start_code) * 8; + } + + memcpy(mapped_ptr, &ctx_pic->bitstream[position], size); + mapped_ptr += size; + } + + ID3D12Resource_Unmap(buffer, 0, NULL); + + 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 = mapped_ptr - mapped_data, + }; + + return 0; +} + +static int d3d12va_vc1_end_frame(AVCodecContext *avctx) +{ + const VC1Context *v = avctx->priv_data; + D3D12DecodePictureContext *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + + if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) + return -1; + + return ff_d3d12va_common_end_frame(avctx, v->s.current_picture_ptr->f, + &ctx_pic->pp, sizeof(ctx_pic->pp), + NULL, 0, + update_input_arguments); +} + +static int d3d12va_vc1_decode_init(AVCodecContext *avctx) +{ + D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); + ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_VC1; + + ctx->max_num_ref = 3; + + return ff_d3d12va_decode_init(avctx); +} + +#if CONFIG_WMV3_D3D12VA_HWACCEL +const FFHWAccel ff_wmv3_d3d12va_hwaccel = { + .p.name = "wmv3_d3d12va", + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_WMV3, + .p.pix_fmt = AV_PIX_FMT_D3D12, + .init = d3d12va_vc1_decode_init, + .uninit = ff_d3d12va_decode_uninit, + .start_frame = d3d12va_vc1_start_frame, + .decode_slice = d3d12va_vc1_decode_slice, + .end_frame = d3d12va_vc1_end_frame, + .frame_params = ff_d3d12va_common_frame_params, + .frame_priv_data_size = sizeof(D3D12DecodePictureContext), + .priv_data_size = sizeof(D3D12VADecodeContext), +}; +#endif + +#if CONFIG_VC1_D3D12VA_HWACCEL +const FFHWAccel ff_vc1_d3d12va_hwaccel = { + .p.name = "vc1_d3d12va", + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_VC1, + .p.pix_fmt = AV_PIX_FMT_D3D12, + .init = d3d12va_vc1_decode_init, + .uninit = ff_d3d12va_decode_uninit, + .start_frame = d3d12va_vc1_start_frame, + .decode_slice = d3d12va_vc1_decode_slice, + .end_frame = d3d12va_vc1_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 46a359aec6..224a867ebc 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -187,4 +187,8 @@ void ff_dxva2_mpeg2_fill_quantization_matrices(AVCodecContext *avctx, AVDXVACont void ff_dxva2_mpeg2_fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, const uint8_t *buffer, unsigned size); +void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PictureParameters *pp); + +void ff_dxva2_vc1_fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size); + #endif /* AVCODEC_DXVA2_INTERNAL_H */ diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index 8ee23feabf..2b1b3f97ea 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -40,10 +40,11 @@ struct dxva2_picture_context { unsigned bitstream_size; }; -static void fill_picture_parameters(AVCodecContext *avctx, - AVDXVAContext *ctx, const VC1Context *v, +void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, + AVDXVAContext *ctx, DXVA_PictureParameters *pp) { + const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; const Picture *current_picture = s->current_picture_ptr; int intcomp = 0; @@ -57,8 +58,6 @@ static void fill_picture_parameters(AVCodecContext *avctx, } memset(pp, 0, sizeof(*pp)); - pp->wDecodedPictureIndex = - pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, current_picture->f, 1); if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type) pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_picture.f, 0); else @@ -67,6 +66,8 @@ static void fill_picture_parameters(AVCodecContext *avctx, pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_picture.f, 0); else pp->wBackwardRefPictureIndex = 0xffff; + pp->wDecodedPictureIndex = + pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, current_picture->f, 1); if (v->profile == PROFILE_ADVANCED) { /* It is the cropped width/height -1 of the frame */ pp->wPicWidthInMBminus1 = avctx->width - 1; @@ -163,7 +164,7 @@ static void fill_picture_parameters(AVCodecContext *avctx, pp->bBitstreamConcealmentMethod = 0; } -static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, +void ff_dxva2_vc1_fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size) { const VC1Context *v = avctx->priv_data; @@ -322,7 +323,7 @@ static int dxva2_vc1_start_frame(AVCodecContext *avctx, return -1; assert(ctx_pic); - fill_picture_parameters(avctx, ctx, v, &ctx_pic->pp); + ff_dxva2_vc1_fill_picture_parameters(avctx, ctx, &ctx_pic->pp); ctx_pic->slice_count = 0; ctx_pic->bitstream_size = 0; @@ -356,7 +357,7 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, ctx_pic->bitstream_size += size; position = buffer - ctx_pic->bitstream; - fill_slice(avctx, &ctx_pic->slice[ctx_pic->slice_count++], position, size); + ff_dxva2_vc1_fill_slice(avctx, &ctx_pic->slice[ctx_pic->slice_count++], position, size); return 0; } diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h index 927314c5e3..5171e4c7d7 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h @@ -67,6 +67,7 @@ extern const struct FFHWAccel ff_mpeg4_videotoolbox_hwaccel; extern const struct FFHWAccel ff_prores_videotoolbox_hwaccel; extern const struct FFHWAccel ff_vc1_d3d11va_hwaccel; extern const struct FFHWAccel ff_vc1_d3d11va2_hwaccel; +extern const struct FFHWAccel ff_vc1_d3d12va_hwaccel; extern const struct FFHWAccel ff_vc1_dxva2_hwaccel; extern const struct FFHWAccel ff_vc1_nvdec_hwaccel; extern const struct FFHWAccel ff_vc1_vaapi_hwaccel; @@ -83,6 +84,7 @@ extern const struct FFHWAccel ff_vp9_vdpau_hwaccel; extern const struct FFHWAccel ff_vp9_videotoolbox_hwaccel; extern const struct FFHWAccel ff_wmv3_d3d11va_hwaccel; extern const struct FFHWAccel ff_wmv3_d3d11va2_hwaccel; +extern const struct FFHWAccel ff_wmv3_d3d12va_hwaccel; extern const struct FFHWAccel ff_wmv3_dxva2_hwaccel; extern const struct FFHWAccel ff_wmv3_nvdec_hwaccel; extern const struct FFHWAccel ff_wmv3_vaapi_hwaccel; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 871944d781..6eff2ec04c 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1373,6 +1373,9 @@ static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = { AV_PIX_FMT_D3D11VA_VLD, AV_PIX_FMT_D3D11, #endif +#if CONFIG_VC1_D3D12VA_HWACCEL + AV_PIX_FMT_D3D12, +#endif #if CONFIG_VC1_NVDEC_HWACCEL AV_PIX_FMT_CUDA, #endif @@ -1408,6 +1411,9 @@ const FFCodec ff_vc1_decoder = { #if CONFIG_VC1_D3D11VA2_HWACCEL HWACCEL_D3D11VA2(vc1), #endif +#if CONFIG_VC1_D3D12VA_HWACCEL + HWACCEL_D3D12VA(vc1), +#endif #if CONFIG_VC1_NVDEC_HWACCEL HWACCEL_NVDEC(vc1), #endif @@ -1445,6 +1451,9 @@ const FFCodec ff_wmv3_decoder = { #if CONFIG_WMV3_D3D11VA2_HWACCEL HWACCEL_D3D11VA2(wmv3), #endif +#if CONFIG_WMV3_D3D12VA_HWACCEL + HWACCEL_D3D12VA(wmv3), +#endif #if CONFIG_WMV3_NVDEC_HWACCEL HWACCEL_NVDEC(wmv3), #endif