Skip to content

media: apple: avd: VP9: one segmentation map per stream, shared by the banks - #2195

Open
m0d16l14n1 wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/avd-vp9-shared-seg
Open

m0d16l14n1 wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/avd-vp9-shared-seg

Conversation

@m0d16l14n1

Copy link
Copy Markdown
Contributor

The VP9 segmentation map carries over from frame to frame: a frame with temporal map prediction, or one that keeps the map without updating it, reads the map the frame before it left. With the queued transport the two banks alternate, and each had its own seg buffer, so a frame read the map of the frame before last. Every stream with segmentation decoded wrong from its first non-key frame.

Change: one seg buffer per stream, used by both banks.

Tested on J815 (MacBook Air 15" M5), with frame-by-frame MD5 against libavcodec, full decode plus a seek:

  • Before: libvpx aq-mode 2 (complexity) and 3 (cyclic refresh) at 720p and 1080p, and a 360p screen-content clip, went wrong from frame 1–3.
  • After: all bit-exact.
  • The rest of the set: 59 of 59 PASS in a 67-stream H.264/HEVC/VP9/AV1 set, which also runs three decodes at once. The other 8 are 10-bit and interlaced streams the driver doesn't expose.
  • The single-bank transport also decoded these streams correctly, which is what pointed at the bank swap.

checkpatch --strict is clean, and the change builds with W=1 on integration/aurora.

Part of the J815 bring-up; board results are summarised in #135.

🤖 Generated with Claude Code

…e banks

The segmentation map is state that runs from frame to frame: a frame
with temporal map prediction, or one that keeps the map without
updating it, reads the map the frame before it left. With the queued
transport (two banks, alternating) each bank had its own seg buffer, so
a frame read the map of the frame before last. Every stream with
segmentation then decoded wrong from its first non-key frame on.

Keep one seg buffer per stream and point both banks at it.

Tested on J815 (MacBook Air 15" M5), frame-by-frame MD5 against
libavcodec, full decode and a seek into the stream:
- before: libvpx aq-mode 2 (complexity) and 3 (cyclic refresh) at
  720p and 1080p, and a 360p screen-content clip, wrong from frame 1-3;
- after: all of them bit-exact, with the rest of a 67-stream H.264,
  HEVC, VP9 and AV1 set (59 of 59 PASS; the other 8 are 10-bit and
  interlaced streams the driver does not expose). The single-bank
  transport also decoded them right, which pointed at the bank swap.

Signed-off-by: Nick <nekreshen@yandex.ru>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Nick <nekreshen@yandex.ru>
@gig3m

gig3m commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Same bug and same fix on a J813 (MacBook Air 13" M5). The AVD runs the open-queue transport here (using open-queue transport (7 frames in flight)). Decoding went through VA-API (libva-v4l2-request, ffmpeg -hwaccel vaapi), and the frame MD5s were compared with libavcodec's software decode of the same file.

Test streams, made with libvpx-vp9 from testsrc2, realtime:

Stream Without this PR With this PR
720p, aq-mode 3, 90 frames 82 wrong, from frame 9 0 wrong
1080p, aq-mode 2, 120 frames not run 0 wrong
720p, aq-mode 0 (no segmentation), 90 frames 0 wrong 0 wrong

"Without" is my kernel on #2135's merged head 408e27268fd6. "With" is the same kernel with this commit picked on top, which rebuilt only apple-avd.ko. The aq-mode 3 stream also decoded bit-exact after each of four deep sleeps (with #2193) on that kernel.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants