Repository navigation
media: apple: ave: 26A428: encode HEVC Main 10 (on #2218) - #2547
Conversation
|
Thanks for the Main 10 work and the PSNR table. The KUnit case that checks the Start words against the 8-bit one is a nice touch. One thing to change before merge. Main 10 is switched on by a per-variant flag described as "verified on this variant's hardware":
We select behaviour by a hardware or firmware property, not by the list of machines it was tested on. Your own reasoning is about the counted (26A428) firmware layout: its Start maps every bit-depth word. T6050 runs that same layout. So could We can run AVE no-regression rows on the encoders we have (A18 Pro, M4 Pro). |
1738b10 to
7395b50
Compare
|
@RyanTheTide done. Both flags are gone, and both checks now key on the layout. New heads: #2218
Checks:
|
|
Thanks, this resolves our point. Both checks now follow the layout: We'll run no-regression rows on our A18 Pro and M4 Pro (9003 layout): 8-bit HEVC and H.264 encode, plus P010 to HEVC Main 10, base vs head, output compared byte for byte. A J714s row from someone with an M5 Pro would cover the newly reached T6050. |
7395b50 to
bcbfe49
Compare
bcbfe49 to
1fa8c98
Compare
|
Rebased on the new #2218. The commit message no longer describes the macOS driver's command building or its buffer sizing. One consequence of the rebase: integration's 26B123 layout is |
|
Thanks for the rebase and the reworded commit message. With 26B123 now Assisted-by: LLM (Claude:Opus 5.5) |
1fa8c98 to
eb867da
Compare
|
Rebased on #2218's new head: @RyanTheTide noted on the Main 10 row for 26B123 (now counted): one P010 → Main 10 row on a J815 on the 27.2 encoder firmware is owed on this head. |
|
Re-review of eb867da (the Main 10 commit on top of #2218): no blockers. The earlier point stays resolved: A correction to our last comment: the 26B123 layout is the one Optional: Rows:
Assisted-by: LLM (Claude:Opus 5.5) |
eb867da to
103d274
Compare
|
@RyanTheTide thanks for the correction: 26B123 is the M3/M4 27.2 layout, and the M5's 27.2 build stays on 26A428. The commit message already says so, and it notes that M3/M4 contexts now start on HEVC as on 9003, so I've left it as is. Your J713/J615 GStreamer Optional point done in Still owed by me: the J815 row on this head, the three P010 → HEVC Main 10 encodes from the table. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist review at head 103d2744ca5b (stacked on #2218 at 0b40dfa119be).
Code & Correctness
0 code, policy, attribution, naming, or CI blockers found across the full 4-commit diff (3 commits from #2218 + the Main 10 commit 103d2744):
- Main 10 enablement (
103d2744):ave_main10_supported()(ave-v4l2.c) cleanly keys on layout capability (ave->layout->counted || ave->layout->kind == AVE_LAYOUT_9003) with thecountedrefusal removed inave_sess_params()(ave-sess.c) and no per-chip/variant flags. Verified againstave-layout.candave-writer.c: bothave_layout_26a428andave_layout_26b123map every bit-depth-dependent Start field (flag_8bit,geometry_depth,min_qp/min_qp2,bit_depth,hevc_profile_{a,b},hevc_compat_{a,b},hevc_8bit_{a,b},hevc_depth_{luma,chroma}). Theave_26a428_hevc_main10KUnit case covers bothave_layout_26a428andave_layout_26b123. - Stacked #2218 commits (
1b9d7bbc,dc863249,0b40dfa1): The Annex-B/RBSP B-frame slice scanner (ave_rbsp_*,ave_hevc_pps_extra_bits,ave_slice_is_b,ave_au_is_b,ave_au_bframe) enforces buffer/shift bounds (zeros > 31,sizeof(r->b) == 24,room >= (hevc ? 3 : 2)), matches H.264 Table 7-6 and H.265 §§7.3.2.3.1 & 7.3.6.1, clearss->bframebefore error returns inave_sess_output(), and scans key frames to track PPSnum_extra_slice_header_bits. Thefps_int_copyandlow_delayfields are cleanly parameterized inAVE_LAYOUT_26A428_FIELDSwithave_26b123_layoutverifying both remain 0 on26B123.
Pre-PR Checklist (§1–§6)
- §1 No model gating: Pass (keyed on layout properties, no chip/board gates).
- §2 Production-ready, no hacks: Pass.
- §3 Safety: Pass.
- §4 Clean-room & attribution: Pass. All 4 commits carry human author/committer (
Nick <[email protected]>) and humanSigned-off-by:only, with zero AI trailers; PR body discloses agent assistance. Clean-room verified (rests on own captures/traces and KUnit tests). - §5 Evidence (Holding):
host-testsCI is green (COMPLETED/SUCCESS), but live-head (103d2744) hardware proof is still pending:- J815 (M5,
26A428): the three P010 -> HEVC Main 10 encodes + regression run (0 SELinux denials, 0 failed units, 0 new kernel errors) on head103d2744. - Newly reached
26B123(M3 J615 / M4 J713): P010 -> HEVC Main 10 encode + GStreamerv4l2h264enccheck confirming the new default HEVC coded format does not regress H.264 pipelines. 9003no-regression rows (A18 Pro / M4 Pro) and optionally T6050 (J714s) for26A428.
- J815 (M5,
- §6 Naming: Pass.
Holding approval only for the §5 live-head hardware rows above (and for base PR #2218 to merge first).
Assisted-by: LLM (Gemini 4 Neon)
The firmware reorders the pictures of a B-frame session itself, so the driver does not know a coded picture's type when it hands the buffer out, and every picture that is not a key frame was flagged as a P frame. Read the slice type of the access unit's first slice instead: a few bytes of its slice header, with emulation-prevention bytes removed. HEVC needs the PPS's num_extra_slice_header_bits to reach slice_type, so the session remembers it from the last PPS it saw. Key frames are scanned too: they carry the parameter sets. Anything the reader does not expect leaves the picture flagged as a P frame, as before, and so does a buffer that comes back with an error: the flag is cleared before anything else is read. A KUnit case feeds a PPS with two extra bits, then a B slice that reads as I without them. The reader, built in user space, agrees with ffprobe's picture types on every access unit of x264 (two slices per picture) and x265 streams with 3 B-frames. On the MacBook Air 15" M5 (J815), with ffmpeg's v4l2m2m encoders and -bf 3, the buffers flagged B match the B pictures in the streams exactly: 27 and 30 of 60 (H.264), 43 and 44 of 60 (HEVC). Signed-off-by: Nick <[email protected]>
… low-delay word macOS 27.2.1 on the M5 (T8142) writes the integer frame rate a second time at Start +0x320c (60 at 60 fps), and for an HEVC session without B-frames 3 at Process +0xce4, the same low-delay word the 9003 layout (ave_layout_9003_78_0) has at +0xcf8. Write both on the 26A428 layout. The 26B123 layout shares 26A428's fields through one macro, which now takes the two offsets. 26B123 passes 0 for both, so it writes neither: its 60 fps and no-B sessions were run without them, and nothing has traced its commands at those settings. At 30 fps the second rate is the 0x1e the 26A428 Start ledger already holds, and the low-delay word only applies to HEVC without B-frames, which this layout does not run yet, so qualified sessions on every chip send the same commands as before. The 26B123 KUnit case still checks that the two layouts agree on every other field. Signed-off-by: Nick <[email protected]>
…rames The 26A428 layout runs only 30 fps sessions with B-frames (or H.264 Baseline and intra-only ones): those are the ones its command ledger was qualified with. We traced the Start and Process commands macOS 27.2.1 sends on the M5 (T8142) for 60 fps sessions and sessions without B-frames, and compared them with what the driver sends for the same settings. With the two words the previous commit adds, they match, apart from words that also differ on a qualified 30 fps session with B-frames. Set any_gop on the layout, as the 26B123 layout has it, so the refusal no longer applies to it. The flag is on the layout, so the M5 Pro and Max (T6050) firmware on the same layout gets it too. Only the M5 has encoded with it so far. Tested on the MacBook Air 15" M5 (J815), firmware 26B123 (the macOS 27.2 stub's, on the 26A428 layout), on two boots: 30 encode cases (H.264 Baseline/Main/High and HEVC Main; 30 and 60 fps; with and without B-frames; VBR and CBR; 640x360 to 2560x1440), every stream decoding to the expected frame count, PSNR 27-42 dB against the source. Signed-off-by: Nick <[email protected]>
The counted (26A428) layout refused HEVC Main 10, so on the M5 S_FMT turned P010 into NV12 and a Main 10 profile failed at STREAMON. The layout's Start maps every word the 9003 Main 10 capture changes with bit depth: the 8-bit flag (0x35e8), the QP floors, the bit depth (0x37c0), both profile/compat groups and the SPS luma/chroma depth. A KUnit case builds a Main 10 Start on 26A428 and on 26B123 and checks those words against the 8-bit one. The encodes below ran with the driver's existing 10-bit DPB and coded buffer sizes. Lift the refusal for the layout, and list P010 for HEVC with Main 10 in the profile menu there. Whether Main 10 can be encoded follows from what the layout's Start maps, not from the chip, so it goes for every firmware on the 26A428 layout; only the M5 (T8142) has encoded with it so far, and the M5 Pro and Max (T6050) use the same layout. The 26B123 layout (the M3 and M4 with macOS 27.2) has the same Start, so it gets Main 10 too, with no Main 10 row there yet. As on 9003, a new context then starts on HEVC, so a client probing the raw formats first sees P010; clients that set the coded format are unaffected. Tested on a MacBook Air 15" M5 (J815, macOS 27.2 26B123 firmware): v4l2-ctl P010 -> HEVC at 30 fps with B-frames, the decoded stream compared with the input: - 1280x720, 30 frames: Main 10, 4:2:0 10-bit, PSNR 46.5 dB, 269 fps; - 1920x1080, 120 frames: PSNR 38.2 dB, 243 fps (86 B pictures); - 3840x2160, 60 frames: PSNR 35.2 dB, 65 fps; and no DART faults or timeouts. NV12 to HEVC Main (41.7 dB) and H.264 High (40.8 dB) at 1080p in the same run are unchanged. Signed-off-by: Nick <[email protected]>
103d274 to
8613fb3
Compare
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
@DjDeveloperr updated to J815 row at this head (in the body): P010 → HEVC Main 10 with 3 B-frames, every stream Still owed: 26B123 (M3/M4) Main 10 and the GStreamer H.264 check, plus the 9003 no-regression rows. |
|
Verdict: FINISH, then merge at Blockers: none in the code. Dj's checklist review found no code, policy or gating blockers: Main 10 is keyed on the layout ( Still needed: the rows your Not yet lists. We'll run them in our lab: 26B123 Main 10 encode and the GStreamer |
|
8613fb3 J615 (M3 Air 15", T8122, macOS 27.2 26B123 counted layout) + J616s (M4 Pro, 9003) + Neo (J700, A18 Pro, 9003) PASS: batched on main 7f00dc6 (0 merge-tree diffs), default cmdline; J615 26B123 exposes P010 (vs NV12-only on stock fleet85) and encodes 60-frame HEVC Main 10 (yuv420p10le, 42 B / 15 P / 3 I) via v4l2-ctl at 1280x720 (209.9 fps, avg PSNR 39.92 dB, Y 41.29 dB) and 1920x1080 (143.6 fps, Y 41.14 dB), plus NV12 H.264/HEVC 60/60 and GStreamer v4l2h264enc 1080p 60/60; J616s and Neo 9003 no-regression H.264/HEVC/P010 (191.2 / 260.2 fps, Main 10 yuv420p10le 60/60) + GStreamer v4l2h264enc 1080p 60/60 ok; 0 AVE/DART errors, 0 failed units, Enforcing, 0 new AVC, 0 new kernel errors; stock defaults restored. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 8613fb37d28b. The rows from your Not yet are in: 26B123 Main 10 on J615 (M3 Air), and 9003 no-regression on J616s (M4 Pro) and the Neo (A18 Pro). Independent software decode verified the saved streams at 60/60 each, including HEVC Main 10 yuv420p10le and GStreamer H.264. Dj's checklist review found no code blockers.
The merge-base changed after approval.
|
Merged into main. Thank you! It merged on the hardware rows at this head and a non-author review. |
What: HEVC Main 10 (P010 in) on the counted 26A428/26B123 layouts, keyed on the layout instead of the chip. Stacked on #2218: its three commits come first and drop out once it merges; the new commit is the last one.
Tested: J815 (MacBook Air 15" M5) at
8613fb37d28b:v4l2-ctlP010 → HEVC Main 10 with 3 B-frames at 12 Mb/s on a high-motion clip, every streamMain 10, yuv420p10leat the right frame count: 720p 37.3 dB 278 fps, 1080p 32.8 dB 238 fps, 2160p 34.5 dB 61 fps. Regression at boot: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors.Risk: two-way door. AVE HEVC encode on 26A428 (M5, M5 Pro/Max) and 26B123 (M3/M4 27.2): P010 appears in their format list and a new context starts on HEVC, as on 9003. The 9003 chips take the same path as before.
Not yet: 26B123 (M3 J615 / M4 J713) Main 10 encode plus a GStreamer
v4l2h264enccheck; 9003 no-regression rows (A18 Pro / M4 Pro); optionally T6050 (J714s).Details
The counted (26A428) layout refused Main 10, so on the M5 S_FMT turned P010 into NV12 and a Main 10 profile failed at STREAMON.
Why the layout can do it: its Start already maps every word the 9003 Main 10 capture changes with bit depth: the 8-bit flag (0x35e8), the QP floors, the bit depth (0x37c0), both profile/compat groups and the SPS luma/chroma depth. A KUnit case,
ave_26a428_hevc_main10, builds a Main 10 Start on 26A428 and 26B123 and checks those words against the 8-bit one.The change: Main 10 is admitted for the layout. It lifts the refusal in the session setup, and
ave_main10_supported()becomes "9003 or counted", so P010 is listed for HEVC and Main 10 appears in the profile menu. As on 9003, a new context starts on HEVC, so a client that probes raw formats first (GStreamer) sees P010; clients that set the coded format are unaffected.Changed on this head: rebased onto
mainwith #2218's rebased commits. No AI attribution in the body or the commits.Evidence
J815, macOS 27.2 stub, this head merged with the other J815 PRs into one test kernel on
main2943fff. Source: parkjoy (high motion) as P010, padded to the driver'ssizeimage(16-row aligned);hevc_profile=2,video_b_frames=3, 12 Mb/s. PSNR against the tight source frames.The earlier rows in this PR (46.5/38.2/35.2 dB) used a different source, so the numbers aren't comparable. #2218's 8-bit encode set (30/30) ran on the same kernel.