Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Change #286104

Category ffmpeg
Changed by Marcin Krycki <m.kryckiohnoyoudont@gmail.com>
Changed at Wed 14 Oct 2026 23:08:47
Repository https://git.ffmpeg.org/ffmpeg.git
Project ffmpeg
Branch master
Revision bed45b6f2f6d8a33673d0835ef03063d7f14b19d

Comments

avcodec/amfenc: make encoder statistics feedback opt-in
Commit 87b7e578ec ("avcodec/amfenc: add encoder average QP stats") enables
AMF_VIDEO_ENCODER_*_STATISTICS_FEEDBACK on every submitted surface. The AMF
property defaults to false and asking the encoder to collect per-frame
statistics is not free: the hardware has to gather the average QP over all
CTBs of every picture.

On a Radeon RX 9070 XT (Navi48, VCN5) driven through the open source
Mesa/RADV Vulkan backend the cost is roughly 48% additional wall time per
frame, for a bit identical bitstream. Measured with a minimal build
(--enable-amf, AMF headers v1.5.2), 1080p23.976, 4353 frames, hevc_amf,
-rc cqp -qp_i 24 -qp_p 24, software decode. Median of repeated runs on an
otherwise idle machine:

  n8.1.2                     -quality speed      9.27 s   469.6 fps
  n9.0.1                     -quality speed     13.78 s   315.9 fps
  n9.0.1 + this patch        -quality speed      9.27 s   469.6 fps
  n9.0.1 + this patch, -qp_stats 1              13.78 s   315.9 fps

  n8.1.2                     -quality quality   16.29 s   267.2 fps
  n9.0.1                     -quality quality   24.05 s   181.0 fps
  n9.0.1 + this patch        -quality quality   16.29 s   267.2 fps
  n9.0.1 + this patch, -qp_stats 1              23.80 s   182.9 fps

The SHA256 of the encoded video stream is identical across all runs, with
and without the feedback enabled. Per-process DRM fdinfo shows the VCN
encode engine going from 69% to 92% busy at the quality preset once the
feedback is disabled - the engine was being starved, not doing more work.

Other encoders that call ff_encode_add_stats_side_data() (libx264, libx265,
libsvtav1, ...) get the quantiser for free from data they already have, so
reporting it unconditionally costs them nothing. That is not the case here,
which is why this is made opt-in rather than always on.

Add a qp_stats AVOption, defaulting to false, restoring pre-9.0 throughput
by default. Users who want the average QP reported in the ffmpeg CLI
progress line, or as AV_PKT_DATA_QUALITY_STATS side data, can enable it
with -qp_stats 1.

Changed files