PR #21399 opened by Edison Ling (edisonling)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21399
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21399.patch

 - switch from `D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT` to 
`D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT1` support structure if AV1 codec is 
part of FFmpeg configuration
 - otherwise continue using `D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT`
 - this adds `.SubregionFrameEncodingData.pTilesPartition_AV1 = 
ctx->subregions_layout.pTilesPartition_AV1` to the structure when AV1 is 
supported


>From 9323c2d65b565266eded7c3cfd2be44acfbca016 Mon Sep 17 00:00:00 2001
From: "Ling, Edison" <[email protected]>
Date: Tue, 6 Jan 2026 14:05:17 -0500
Subject: [PATCH] avcodec/d3d12va_encode: Bug fix for D3D12 AV1 encoder support
 structure

 - switch from `D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT` to 
`D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT1` support structure if AV1 codec is 
part of FFmpeg configuration
 - otherwise continue using `D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT`
 - this adds `.SubregionFrameEncodingData.pTilesPartition_AV1 = 
ctx->subregions_layout.pTilesPartition_AV1` to the structure when AV1 is 
supported
---
 libavcodec/d3d12va_encode.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c
index de95518be5..d230507c1b 100644
--- a/libavcodec/d3d12va_encode.c
+++ b/libavcodec/d3d12va_encode.c
@@ -1191,7 +1191,28 @@ static int 
d3d12va_encode_init_motion_estimation_precision(AVCodecContext *avctx
         default:
             av_assert0(0);
     }
+#if CONFIG_AV1_D3D12VA_ENCODER
+    D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT1 support = {
+        .NodeIndex                                      = 0,
+        .Codec                                          = 
ctx->codec->d3d12_codec,
+        .InputFormat                                    = hwctx->format,
+        .RateControl                                    = ctx->rc,
+        .IntraRefresh                                   = 
D3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE_NONE,
+        .SubregionFrameEncoding                         = 
D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_FULL_FRAME,
+        .ResolutionsListCount                           = 1,
+        .pResolutionList                                = &ctx->resolution,
+        .CodecGopSequence                               = ctx->gop,
+        .MaxReferenceFramesInDPB                        = MAX_DPB_SIZE - 1,
+        .CodecConfiguration                             = ctx->codec_conf,
+        .SuggestedProfile                               = profile,
+        .SuggestedLevel                                 = level,
+        .pResolutionDependentSupport                    = &ctx->res_limits,
+        .SubregionFrameEncodingData.pTilesPartition_AV1 = 
ctx->subregions_layout.pTilesPartition_AV1,
+    };
 
+    hr = ID3D12VideoDevice3_CheckFeatureSupport(ctx->video_device3, 
D3D12_FEATURE_VIDEO_ENCODER_SUPPORT1,
+                                                &support, sizeof(support));
+#else
     D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT support = {
         .NodeIndex                   = 0,
         .Codec                       = ctx->codec->d3d12_codec,
@@ -1211,6 +1232,7 @@ static int 
d3d12va_encode_init_motion_estimation_precision(AVCodecContext *avctx
 
     hr = ID3D12VideoDevice3_CheckFeatureSupport(ctx->video_device3, 
D3D12_FEATURE_VIDEO_ENCODER_SUPPORT,
                                                 &support, sizeof(support));
+#endif
     if (FAILED(hr)) {
         av_log(avctx, AV_LOG_ERROR, "Failed to check encoder support for 
motion estimation.\n");
         return AVERROR(EINVAL);
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to