* [FFmpeg-devel] [PATCH] avcodec/d3d12va_encode: Add H.264 deblock filter parameter support (PR #21284)
@ 2025-12-23 19:26 Edison Ling via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Edison Ling via ffmpeg-devel @ 2025-12-23 19:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Edison Ling
PR #21284 opened by Edison Ling (edisonling)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21284
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21284.patch
add parameter `deblock` for users to explicitly enable/disable deblocking filter in d3d12 H264 encoding
usage:
-deblock enable or -deblock 1
-deblock disable or -deblock 0
-deblock auto or -deblock -1
sample command line:
```
.\ffmpeg.exe -hwaccel d3d12va -hwaccel_output_format d3d12 -i input.mp4 -c:v h264_d3d12va -deblock enable -y output.mp4
```
>From 39cbe07bb593330babde5e45b167d383b05bb9e7 Mon Sep 17 00:00:00 2001
From: "Ling, Edison" <Edison.Ling+amdeng@amd.com>
Date: Mon, 22 Dec 2025 17:56:18 -0500
Subject: [PATCH] avcodec/d3d12va_encode: Add H264 deblock filter parameter
support
add parameter `deblock` for users to explicitly enable/disable deblocking filter in d3d12 H264 encoding
usage:
-deblock enable or -deblock 1
-deblock disable or -deblock 0
-deblock auto or -deblock -1
sample command line:
```
.\ffmpeg.exe -hwaccel d3d12va -hwaccel_output_format d3d12 -i input.mp4 -c:v h264_d3d12va -deblock enable -y output.mp4
```
---
libavcodec/d3d12va_encode_h264.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/libavcodec/d3d12va_encode_h264.c b/libavcodec/d3d12va_encode_h264.c
index bcf5a326e5..75c49f9c5d 100644
--- a/libavcodec/d3d12va_encode_h264.c
+++ b/libavcodec/d3d12va_encode_h264.c
@@ -44,6 +44,7 @@ typedef struct D3D12VAEncodeH264Context {
int qp;
int profile;
int level;
+ int deblock;
int idr_pic_id;
// Writer structures.
@@ -274,6 +275,23 @@ static int d3d12va_encode_h264_get_encoder_caps(AVCodecContext *avctx)
priv->unit_opts.cabac = 1;
}
+ // Deblocking filter configuration
+ if (priv->deblock == 1) {
+ if (h264_caps.DisableDeblockingFilterSupportedModes & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_FLAG_0_ALL_LUMA_CHROMA_SLICE_BLOCK_EDGES_ALWAYS_FILTERED) {
+ config->DisableDeblockingFilterConfig = D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_0_ALL_LUMA_CHROMA_SLICE_BLOCK_EDGES_ALWAYS_FILTERED;
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Requested deblocking filter enable mode not supported by driver.\n");
+ return AVERROR(ENOTSUP);
+ }
+ } else if (priv->deblock == 0) {
+ if (h264_caps.DisableDeblockingFilterSupportedModes & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_FLAG_1_DISABLE_ALL_SLICE_BLOCK_EDGES) {
+ config->DisableDeblockingFilterConfig = D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_1_DISABLE_ALL_SLICE_BLOCK_EDGES;
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Requested deblocking filter disable mode not supported by driver.\n");
+ return AVERROR(ENOTSUP);
+ }
+ }
+
base_ctx->surface_width = FFALIGN(avctx->width, 16);
base_ctx->surface_height = FFALIGN(avctx->height, 16);
@@ -591,6 +609,12 @@ static const AVOption d3d12va_encode_h264_options[] = {
{ LEVEL("6.2", 62) },
#undef LEVEL
+ { "deblock", "Deblocking filter mode",
+ OFFSET(deblock), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, FLAGS, .unit = "deblock" },
+ { "auto", "Driver default", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, FLAGS, .unit = "deblock" },
+ { "disable", "Disable deblocking filter", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, .unit = "deblock" },
+ { "enable", "Enable deblocking filter", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, .unit = "deblock" },
+
{ NULL },
};
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-23 19:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-23 19:26 [FFmpeg-devel] [PATCH] avcodec/d3d12va_encode: Add H.264 deblock filter parameter support (PR #21284) Edison Ling via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git