This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 00d3417b71 avcodec/d3d12va_encode: Add H264 entropy coder parameter
support
00d3417b71 is described below
commit 00d3417b716e9dabcbf6a00aea08384f91b9cbb0
Author: Ling, Edison <[email protected]>
AuthorDate: Fri Jan 9 16:49:33 2026 -0500
Commit: Tong Wu <[email protected]>
CommitDate: Thu Feb 26 02:19:21 2026 +0000
avcodec/d3d12va_encode: Add H264 entropy coder parameter support
Add parameter `coder` for users to select entropy coding in D3D12 H264
encoding.
Named constants `cabac` (1) and `cavlc` (0) are supported.
Default is CABAC (1). If the driver does not support CABAC, a warning is
logged and encoding falls back to CAVLC.
Usage:
CABAC (default): `-coder cabac` or `-coder 1`
CAVLC: `-coder cavlc` or `-coder 0`
Sample command line:
```
ffmpeg -hwaccel d3d12va -hwaccel_output_format d3d12 -i input.mp4 -c:v
h264_d3d12va -coder cavlc -y output.mp4
```
---
libavcodec/d3d12va_encode_h264.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/libavcodec/d3d12va_encode_h264.c b/libavcodec/d3d12va_encode_h264.c
index bd15856f0e..dd745c6895 100644
--- a/libavcodec/d3d12va_encode_h264.c
+++ b/libavcodec/d3d12va_encode_h264.c
@@ -294,11 +294,6 @@ static int
d3d12va_encode_h264_get_encoder_caps(AVCodecContext *avctx)
config->ConfigurationFlags =
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_NONE;
- if (h264_caps.SupportFlags &
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_CABAC_ENCODING_SUPPORT)
{
- config->ConfigurationFlags |=
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_ENABLE_CABAC_ENCODING;
- 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)
{
@@ -316,6 +311,16 @@ static int
d3d12va_encode_h264_get_encoder_caps(AVCodecContext *avctx)
}
}
+ // Entropy coder configuration
+ if (priv->unit_opts.cabac) {
+ if (h264_caps.SupportFlags &
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_CABAC_ENCODING_SUPPORT)
{
+ config->ConfigurationFlags |=
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_ENABLE_CABAC_ENCODING;
+ } else {
+ av_log(avctx, AV_LOG_WARNING, "CABAC entropy coding is not
supported by the driver, falling back to CAVLC.\n");
+ priv->unit_opts.cabac = 0;
+ }
+ }
+
base_ctx->surface_width = FFALIGN(avctx->width, 16);
base_ctx->surface_height = FFALIGN(avctx->height, 16);
@@ -643,6 +648,11 @@ static const AVOption d3d12va_encode_h264_options[] = {
{ "deblock", "Deblocking filter mode",
OFFSET(deblock), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, FLAGS },
+ { "coder", "Entropy coder type",
+ OFFSET(unit_opts.cabac), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS,
"coder" },
+ { "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX,
FLAGS, "coder" },
+ { "cabac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX,
FLAGS, "coder" },
+
{ NULL },
};
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]