Skip to content

media: apple: ave: speed over quality for HEVC Main 10 too - #1239

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
media/ave-m10-speed
Nov 8, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
media/ave-m10-speed

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Follow-up to #1228. The speed-over-quality control (Prioritize Speed Over Quality) now covers HEVC Main 10 as well as Main. Main 10 had been left out only because it had not been measured. The control stays off by default, and with it off every command is byte-identical to before.

Main 10 responds to the same Start word (3 to 5) as Main. It encodes 1.6-1.8 times faster, its pictures stay intact (PSNR follows the normal curve), and the bit-rate cost is lower than for 8-bit: +7.2% BD-rate against +12.4%.

Method

Same bench and procedure as #1228: 16 OUTPUT buffers (8 for 4K P010, which is all the encoder's DMA window holds at that size), VBR 4 Mb/s, GOP 30, 3 runs per row. Each variant gets a fresh boot, because the AVE firmware cannot be reloaded within one. Test = this driver as a module, swapped in right after boot. Stock = the fleet kernel's own module after a reboot to the default. For quality, the 150-frame mandel input was converted to P010 (ffmpeg, p010le) and coded at 1/2/4/8 Mb/s. PSNR-Y is computed at 10 bits against that P010 source after a software decode, and BD-rate uses a piecewise-cubic fit on log-rate. The same script gives +12.42% on #1228's 8-bit rows, matching that PR's number.

Results (fps, 3 runs)

Mac row stock this PR, off this PR, speed
J616s (fleet36) HEVC Main 10 1080p 215.8/214.7/214.7 214.6/214.7/215.6 344.6/346.1/347.1 (1.61x)
J616s HEVC Main 10 4K 58.3/58.2/58.1 58.2/58.2/58.2 104.3/105.4/105.3 (1.81x)
J616s HEVC Main 10 1080p, B-frames 218.2/218.2/218.0 218.0/218.1/217.3 351.9/355.9/353.9
J616s HEVC Main 1080p (as in #1228) 216.1/215.6/215.8 215.7/215.7/216.5 370.2/372.5/369.7
Neo (fleet36) HEVC Main 10 1080p 161.3/168.0/168.0 167.6/168.0/167.6 269.4/269.0/270.3 (1.61x)
Neo HEVC Main 10 4K 42.5/45.9/46.0 45.8/45.8/45.9 82.3/81.7/82.6 (1.79x)
Neo HEVC Main 10 1080p, B-frames 166.5/165.6/166.6 272.5/274.0/273.3
Neo HEVC Main 1080p (as in #1228) 161.2/168.6/167.8 168.5/167.7/168.2 286.2/285.0/286.8

The first run of each stock boot was slower on rows the driver does not touch (Main 10 at 161.3 vs 168.0 later, Main at 161.2). That is warm-up after boot, not this change.

Main 10 quality (Neo, mandel P010):

Mb/s quality: kb/s, PSNR-Y speed: kb/s, PSNR-Y
1 1034.1, 30.37 dB 1036.8, 30.37 dB
2 2032.5, 31.33 dB 2042.7, 31.42 dB
4 4052.7, 32.72 dB 4035.4, 32.48 dB
8 8093.9, 34.61 dB 8108.6, 33.83 dB

BD-rate, speed against quality: +7.2%.

macOS 10-bit speed-mode numbers: not measured. No macOS boot of the J616s was free tonight. On macOS the speed property is per codec (HEVC), not per bit depth.

Quality mode unchanged

Bitstreams from this PR with the control off are bit-identical to the stock module's. On the Neo that is 7/7 files: Main 10 at 1/2/4/8 Mb/s, Main at 1/4 Mb/s and H.264 at 4 Mb/s. On the J616s it is also 7/7. Speed-mode Main 10 bitstreams are bit-identical between the J616s and the Neo, so the BD-rate above holds for both Macs. Host tests --compare-baseline against integration/aurora: 288 sessions / 1440 commands byte-identical.

Checks

  • v4l2-compliance 48/48. 0 DART faults, 0 AVC denials and 0 AVE errors in every boot. SELinux enforcing.
  • KUnit apple-ave-abi 10/10. ave_9003_speed now also covers Main 10: speed mode changes only Start +0x320 (3 to 5) and no Process word, with and without B-frames.
  • checkpatch.pl --strict clean. W=1 module build clean.

Note on constant-quality HEVC (from #1228)

macOS 27.0's HEVC CQ output sets weighted_pred_flag and lists_modification_present_flag in the PPS. In all 145 P slices, though, it signals no weights and no list modification, so those flags change nothing. The remaining +0.7% BD-rate gap is down to encoder decisions in macOS 27's newer firmware. It is being followed up separately; nothing in this PR touches CQ.

🤖 Generated with Claude Code

The speed-over-quality control was limited to 8-bit HEVC because Main 10
had not been measured. Main 10 behaves like Main: the same Start word
(3 -> 5) makes it 1.6-1.8 times faster, its pictures stay intact, and
the bit-rate cost is lower than for 8-bit (+7.2% BD-rate PSNR-Y
against +12.4%). Apply the control to Main 10 as well. It still applies
only to HEVC above 1280x720.

With the control off, every command is byte-identical to before.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide
RyanTheTide marked this pull request as ready for review November 8, 2026 15:31
@RyanTheTide
RyanTheTide merged commit ce75900 into integration/aurora Nov 8, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the media/ave-m10-speed branch November 8, 2026 15:31
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.

1 participant