PR #25934 opened by witaly-iwanow URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25934 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25934.patch
Fixes #25928. >From 52aa4d67561ad2c25bf8c8f7f230c7f6828db5c6 Mon Sep 17 00:00:00 2001 From: Vitaly Ivanov <[email protected]> Date: Wed, 11 Nov 2026 15:48:44 +0700 Subject: [PATCH] avcodec/d3d12va_encode_h264: enable 8x8 transform for High profiles ff_hw_base_encode_init_params_h264() sets transform_8x8_mode_flag in the PPS for High profiles, but the encoder was never configured with USE_ADAPTIVE_8x8_TRANSFORM, so drivers encoded without it and the output did not match its PPS. Enable it when the driver supports it and derive the PPS flag from the configuration. Fixes #25928. Signed-off-by: Vitaly Ivanov <[email protected]> --- libavcodec/d3d12va_encode_h264.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavcodec/d3d12va_encode_h264.c b/libavcodec/d3d12va_encode_h264.c index 55ed2490647..c65c18863a3 100644 --- a/libavcodec/d3d12va_encode_h264.c +++ b/libavcodec/d3d12va_encode_h264.c @@ -260,6 +260,8 @@ static int d3d12va_encode_h264_init_sequence_params(AVCodecContext *avctx) ctx->gop.pH264GroupOfPictures->log2_max_frame_num_minus4 = sps->log2_max_frame_num_minus4; pps->deblocking_filter_control_present_flag = 1; pps->constrained_intra_pred_flag = priv->constrained_intra_pred; + pps->transform_8x8_mode_flag = !!(ctx->codec_conf.pH264Config->ConfigurationFlags & + D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_USE_ADAPTIVE_8x8_TRANSFORM); return 0; } @@ -333,6 +335,16 @@ static int d3d12va_encode_h264_get_encoder_caps(AVCodecContext *avctx) } } + // 8x8 transform, which the PPS signals for High profiles + if (ctx->profile->av_profile == AV_PROFILE_H264_HIGH || + ctx->profile->av_profile == AV_PROFILE_H264_HIGH_10) { + if (h264_caps.SupportFlags & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_ADAPTIVE_8x8_TRANSFORM_ENCODING_SUPPORT) { + config->ConfigurationFlags |= D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_USE_ADAPTIVE_8x8_TRANSFORM; + } else { + av_log(avctx, AV_LOG_WARNING, "Adaptive 8x8 transform is not supported by the driver, disabling.\n"); + } + } + base_ctx->surface_width = FFALIGN(avctx->width, 16); base_ctx->surface_height = FFALIGN(avctx->height, 16); -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
