Re: [PATCH RFC 00/11] media: h264: Stateless encode core follow-ups: parameter sets, POC type 2, CBR and VBR

From: Arun Iyengar

Date: Fri Nov 13 2026 - 09:42:36 EST


> Maybe next time just share a summary email with different findings
> and ideas for improvements on the active series, instead of patches?

Will do, sorry for the noise. I'll drop this RFC. Findings on v1, in
case they still apply to your v2:

1. rbsp_update(): the SPS/PPS change check is inverted, so the parameter
sets are written for every picture.
2. SPS and PPS are written with nal_ref_idc 0; H.264 7.4.1 forbids that.
3. Only pic_order_cnt_type 0 is accepted. Hardware that writes the slice
header itself (Hantro H1, Rockchip VEPU1/VEPU2) has no
pic_order_cnt_lsb there and needs type 2.
4. state_commit() publishes the encode params before rc_step() sets
slice_qp_delta, so userspace reads the value from before rate control.
5. CBR on a VEPU2 (1080p60, 2-16 Mbit/s): bitrate off by -8.3% to +2.3%,
and the first P picture after an IDR up to 20 times the median P
size. Causes: the P target is 0.8 times the average left in the
budget, a size ratio of 0.8-1.25 changes no QP, and I and P keep
separate QP histories. A model after Rockchip MPP's frame-level
control (one QP state, size targets from a GOP plan with the
measured I/P ratio, error spread over 8 pictures) gave +0.3% to
+2.3% and at most 1.4 times.

Arun