This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 5dbf1dccadd51718a4553879d1eaf6fd9ee962b0
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Mon Jun 22 13:08:37 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Tue Jul 28 08:39:15 2026 +0000

    avcodec/dxva2: map 4:2:0 12-bit to P012 surfaces
    
    Select P012 as the D3D11VA/DXVA2 frames sw_format for YUV420P12 content
    and map it to DXGI_FORMAT_P016, so 12-bit 4:2:0 hardware decoding can
    allocate a usable surface.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavcodec/dxva2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index a282e6c0c7..da9b0bc834 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -458,6 +458,7 @@ static DXGI_FORMAT d3d11va_map_sw_to_hw_format(enum 
AVPixelFormat pix_fmt)
     switch (pix_fmt) {
     case AV_PIX_FMT_NV12:       return DXGI_FORMAT_NV12;
     case AV_PIX_FMT_P010:       return DXGI_FORMAT_P010;
+    case AV_PIX_FMT_P012:       return DXGI_FORMAT_P016;
     case AV_PIX_FMT_YUV420P:    return DXGI_FORMAT_420_OPAQUE;
     default:                    return DXGI_FORMAT_UNKNOWN;
     }
@@ -627,8 +628,11 @@ int ff_dxva2_common_frame_params(AVCodecContext *avctx,
     else
         num_surfaces += 2;
 
-    frames_ctx->sw_format = avctx->sw_pix_fmt == AV_PIX_FMT_YUV420P10 ?
-                            AV_PIX_FMT_P010 : AV_PIX_FMT_NV12;
+    switch (avctx->sw_pix_fmt) {
+    case AV_PIX_FMT_YUV420P10: frames_ctx->sw_format = AV_PIX_FMT_P010; break;
+    case AV_PIX_FMT_YUV420P12: frames_ctx->sw_format = AV_PIX_FMT_P012; break;
+    default:                   frames_ctx->sw_format = AV_PIX_FMT_NV12; break;
+    }
     frames_ctx->width = FFALIGN(avctx->coded_width, surface_alignment);
     frames_ctx->height = FFALIGN(avctx->coded_height, surface_alignment);
     frames_ctx->initial_pool_size = num_surfaces;

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

Reply via email to