Repository navigation
v2.1.2 — the real KI-1 fix: B-frame H.264 in hardware, seeks included
Hotfix with a confession and a milestone in the same breath: the real root cause of the B-frame ghosting is found and fixed, and B-frame H.264 now decodes in hardware — including through seeks.
The bug v2.1.1 shipped (and every version before it)
The driver synthesises H.264 parameter sets, and its PPS hardcoded num_ref_idx_default_active = 1 as a "conservative default". Real encoders use higher values (broadcast content: 4; typical x264: 2), and slices rely on that default exactly when the decoder's reference buffer fills — about half a second in. Result: every I-frame perfect, then the picture drifts into ghosting. It also masqueraded as a seek-only bug for a day of investigation.
v2.1.1's "correct from start" claim was measured on verification windows too short to catch this — it is wrong beyond the first GOP, and we're saying so plainly. If you saw ghosting or "flicker" on H.264 with any version of this driver, it was this.
The fix
The driver now learns the true defaults from the stream itself — any slice that doesn't override them states them — and re-emits a corrected PPS once. Additionally, the decoder is configured to emit pictures in decode order (MPP_DEC_SET_IMMEDIATE_OUT), which ends the reorder stall that used to push B-frame streams to software after seeks.
Net result: H.264 with B-frames decodes in hardware, pixel-identical to software reference, from start AND through seeks — broadcast-style and open-GOP content both.
Verification (all on the release binary)
Frame-by-frame pixel comparison against software decode, at the new minimum depths this bug taught us (48 frames standard, 144-frame long runs for B-frame content):
- broadcast-style H.264 (refs=4): 0.0/255 across 144 frames, seek cases 0.0
- open-GOP H.264: 0.0/255 across 144 frames, seek cases 0.0, hardware held through seeks
- H.264 no-B control, HEVC 8-bit, HEVC Main10, VP9 Profile 2: all matching
The verification tool itself was upgraded (three-signal hardware proof: hwdec-current + fallback markers + frames-assigned, so a software run can never masquerade as a hardware pass): tools/hevc-ladder.sh.
Install
sudo apt install ./rockchip-vaapi-driver_2.1.2_arm64.debWorks on any existing image with this driver family — no kernel change required. Requires a BSP kernel exposing /dev/mpp_service.
Root cause found by the project's Pi-side engineering (hybrid-stream bisection: swap synthesised parameter sets against the encoder's own around identical slices, let ffmpeg judge — ten minutes, no theorising). Method and diagnostic tools are in tools/.