Skip to content

media: apple: ave: keep 6070 H.264 P pictures as references (split from #2375) - #3533

Merged
RyanTheTide merged 1 commit into
mainfrom
fix/ave-h264-p-references-20261129
Dec 2, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
fix/ave-h264-p-references-20261129

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

What: The H.264 references fix from commit 1 of #2375 (by Lucas Goossen), split into its own PR as the review suggested, without the rate-control and VUI changes. A nonzero Process timescale made AVE 6070 H.264 P slices non-reference pictures and left frame_num stuck at 1. H.264 now writes zero there (PTS stays in AVE_PROC_TIMESCALE), and the Start motion lambdas are set for full-pel search. The behaviour is selected by the command layout's h264_inter capability. HEVC and other layouts are unchanged.

Tested: Build and KUnit at this head: the arm64 Clang build (16 KiB pages) has no warnings, AVE KUnit passes 50/50 including the new ave_6070_h264_inter case, and strict checkpatch is clean. On the 11-22 base, the same commit took v4l2slh264dec decode of our encode from 4/120 to 120/120 frames in order, bit-exact against ffmpeg, on the M1 Pro and M2 (rows posted on #2375).

Risk: two-way · H.264 encode on Macs with the AVE 6070 command layout.

Not yet: a row at this exact head on the M1 Pro or M2 (encode a clip, decode it, check frame order). It goes in the next combined boot.

Details

The lambdas (64/256/64) are encoder quality weights, not hardware safety limits. The KUnit case checks both codecs with the capability on and off.

Evidence

Earlier rows: #2375 comments of 2026-11-22. Source item: REFMACS7.md:11.

Reapply the standalone H.264 fix from Lucas Goossen's first commit
in linux#2375 on main, without the rate-control and VUI changes.

A nonzero Process timescale makes P slices non-reference pictures
and leaves frame_num at 1. Write zero for H.264 while keeping PTS
in AVE_PROC_TIMESCALE. Set the Start motion lambdas for full-pel
search and inter/intra decisions to 64, 256 and 64 respectively.
These are encoder quality weights, not hardware safety limits.

Select the behavior with the command layout's h264_inter capability;
HEVC retains its timescale and other command layouts are unchanged.
The KUnit case checks both codecs with the capability on and off.


Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at a12ab26b

Blockers:

  1. Hosted CI at a12ab26b (20 jobs: apple-build, host-tests, pr-text, readiness, KUnit suites) is currently QUEUED; wait for green CI.
  2. Missing exact-head hardware encode+decode row at a12ab26b on an AVE 6070 Mac (M1 Pro or M2; prior 120/120 bit-exact rows were on #2375's 11-22 base; queued in Not yet:).

Checked: no Apple material, no AI attribution, preserves original author (Lucas Goossen) and human DCO Signed-off-by chain, selects behavior via command-layout capability ave_fw_layout.h264_inter (no chip/board if-gates, no new parameters, no hardcoded safety limits — motion lambdas 64/256/64 are encoder quality weights), HEVC and other command layouts are completely unchanged, ave_6070_h264_inter KUnit covers both H.264 and HEVC with h264_inter on and off (50/50 AVE KUnit PASS, arm64 Clang 16 KiB clean, checkpatch --strict clean), PR body has Tested: and Risk: two-way, branch is MERGEABLE against main.

Evidence
  • Inspected full diff (+123/-1 across abi.rst, ave-abi-test.c, ave-layout.c, ave-layout.h, ave-sess.c, ave-writer.c, ave.h):
    • ave-layout.c: enables .h264_inter = true and records Start offsets 0xff98/0xffa4/0xffa8 on ave_layout_6070_11_1.
    • ave-writer.c: writes 64, 256, 64 in ave_start_config() when p->h264_inter is set (H.264 branch only), and writes 0 to l->timescale in ave_build_process() when p->h264_inter && p->codec == AVE_CODEC_H264 while keeping AVE_PROC_TIMESCALE for HEVC and non-h264_inter layouts.
    • ave-abi-test.c: ave_6070_h264_inter() asserts both codecs with on = 0 and on = 1, verifying timescale, all three lambda words, and untouched h264_skip_mode / static_area_mask.
  • Code is clean; ready to approve and merge once CI is green and the exact-head M1 Pro / M2 encode+decode row passes at a12ab26b.

@github-actions github-actions Bot added area:media Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at a12ab26b: ready to merge

Check Detail
CI at head ok 19 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at a12ab26b
Conflicts ok none
PR text ok Risk: two-way · H.264 encode on Macs with the AVE 6070 command layout.

Areas: area:media
Merge: gh pr merge 3533 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at a12ab26b7472

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: no Apple material, no AI attribution, preserves original author (Lucas Goossen) and human DCO Signed-off-by chain, selects behavior via command-layout capability ave_fw_layout.h264_inter (no chip/board if-gates, no new parameters, no hardcoded safety limits — motion lambdas 64/256/64 are encoder quality weights), HEVC and other command layouts are completely unchanged, ave_6070_h264_inter KUnit covers both H.264 and HEVC with h264_inter on and off (50/50 AVE KUnit PASS, arm64 Clang 16 KiB clean, checkpatch --strict clean), PR body has Tested: and Risk: two-way, branch is MERGEABLE against main.

Follow-ups (not blocking): queued CI; AVE 6070 encode+decode row on M1 Pro/M2

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at a12ab26b7472. Only ave_layout_6070_11_1 sets h264_inter, and it fills all three lambda offsets. HEVC keeps AVE_PROC_TIMESCALE, the PTS still counts in it, and the KUnit case checks both values for both codecs. The commit differs from #2375's (rate control and VUI were split out), so the M1 Pro/M2 encode→decode frame-order row at this head is the remaining gate. I restarted the cancelled KUnit jobs.

@github-actions github-actions Bot removed ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware row at exact head a12ab26b: PASS (J316s, MacBook Pro 14" M1 Pro, T6000, AVE 6070)

  • A: saved 7.3.0-aurora-edge. B: one-shot 7.3.0-mrows3533 built from a12ab26b7472 (same config family as the fleet kernels), GRUB one-shot entry only; saved default unchanged.
  • Encode: 120 frames of 1280x720 NV12 (testsrc2) through the AVE V4L2 encoder (/dev/video14), Constant Quality (the only rate-control mode the 6070 exposes; VBR/CBR return EINVAL on both kernels), GOP 300, no B-frames. Decoded on another host with ffmpeg.
A (base) B (a12ab26b)
H.264 frames encoded / decoded 120 / 120, 0 decode errors 120 / 120, 0 decode errors
H.264 slices 1 IDR (nal_ref_idc 1) + 119 P, all 119 P with nal_ref_idc = 0 1 IDR + 119 P, all 119 P with nal_ref_idc != 0
H.264 stream size 1,943,260 B (P frames ~15.3 KB) 1,179,160 B (-39 %, P frames ~9.5 KB)
H.264 PSNR vs source 40.82 dB 41.22 dB
HEVC encode smoke 120/120, 1,434,648 B, sha256 696c2af6cda6... 120/120, byte-identical to A
dmesg err/crit delta, AVE/DART faults, failed units 0 / 0 / 0 0 / 0 / 0

So on A every P picture predicts from the IDR only (non-reference P, rising residual); with this PR the P pictures are marked as references and chained, the stream shrinks by about 39 % at slightly higher quality, and HEVC is unchanged. Restored afterwards: saved 7.3.0-aurora-edge, GRUB config byte-identical, test kernel removed, SELinux Enforcing, 0 failed units.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 2, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging at a12ab26b7472 (B2 merge train, 12-01 merge bar). Approval at this head: DjDeveloperr,aurora-silicon-review[bot]. Row: exact-head row comment 7347887764 at a12ab26. CI: linux train L24 (candidate fdfedd05e955 on main a76093e): Apple driver build pass + touched objs pass (kernel/sched/psi.o verified with CONFIG_PSI=y) + DTBs pass + 12/12 relevant KUnit suites pass (ane-boot 333, clpc 22, ane-pm 20, dcp-fabric 117, dcp-topology 235/236, dcp-display 220/221, ave 57, apple-dart 40, jpeg 15, isp 61, mt7932 98/99, asahi 567/571; avd-pm-test.c pre-existing Clang 22 warning on main) + host tests pass (apple-dcp 1/1, dcp 96/96, g17 329/329). Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 19a7066 into main Dec 2, 2026
46 of 58 checks passed
@RyanTheTide
RyanTheTide deleted the fix/ave-h264-p-references-20261129 branch December 2, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:media Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants