Repository navigation
media: apple: ave: 26B123: per-frame bit rate and forced keyframes - #3827
Conversation
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed the 26B123 H.264 and HEVC Process fields, the counted-layout rate conversion, and passing the submitted picture's bit rate to CBR fill. The J616C report covers both engines and both codecs at this head. Before merging, run hosted Apple build, AVE KUnit and host tests, and cover a second generation, including the changed live VBR behavior on 9003.78.0.
|
The hosted AVE KUnit run found a regression at Keep the existing 9003 Process limit for this 26B123 change, or update the 9003 contract with a live VBR run that demonstrates the intended behavior on that firmware. |
Add the 26B123 Process command offsets for dynamic rate control and forced keyframes (bitrate, limits, limit_bytes, limit_secs, force_key, and force_type) for both H.264 and HEVC, matching the 9003.78.0 field offsets relative to fps_int and the 0xffffffff picture-management sentinel. Scale per-frame VBR limit_bytes to bits/s on counted layouts (matching Start) and recompute it when bitrate changes mid-stream; track the per-slot requested bit rate so CBR filler stays aligned with live bit-rate updates. Add KUnit and host-harness coverage for 26B123 forced keyframes and mid-stream bit-rate changes. Tested on MacBook Pro 16" M4 Max (J616C / T6041, macOS 27.2 26B123) on both ave0 and ave1: 1280x720 30 fps VBR no-B-frames H.264 and HEVC forced keyframes via FFmpeg VA-API (frames 0, 15, 45, 75) and direct V4L2-M2M (frames 25, 75) emit decodable IDR NAL units, and mid-stream V4L2_CID_MPEG_VIDEO_BITRATE updates (2M -> 10M -> 500k) scale encoded frame sizes up and down with clean ffmpeg decode and zero DART or firmware errors. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
8db6a90 to
30fca3e
Compare
|
Updated head to |
There was a problem hiding this comment.
The new guard keeps the 9003.78.0 VBR limit unchanged and preserves the 26B123 behavior exercised on J616C. The hosted AVE KUnit run now passes. The PR description still describes the superseded 9003 VBR behavior. Host tests and second-generation hardware coverage remain open.
Update at 30fca3e80569. Apple build, AVE KUnit and host tests passed. The J413 result covers live bit-rate changes and forced keyframes in H.264 and HEVC, in both VBR and CBR. All four streams decoded 120/120 frames with zero AVE, DART or firmware faults.
For the second AVE generation, refresh the J616C test at this head with the same H.264 and HEVC live-rate sequence in CBR. The earlier J616C run covered VBR on 8db6a90b1561. The current 9003.78.0 packet-byte regression test passes.
|
Row: Direct V4L2-M2M (
|
|
Row: Direct V4L2-M2M encode, using the same stream as the J413 row:
Health on the PR kernel: Controls on the saved kernels, same harness, without this PR:
Harness and bitstreams: |
What
Add the macOS 27.2 (
26B123) Process command offsets for mid-stream rate control and forced keyframes (.bitrate,.limits,.limit_bytes,.limit_secs,.force_key,.force_type) for both H.264 (0x1338..0x1370,0x29d8) and HEVC (+0x7a8:0x1ae0..0x1b18,0x3180), matching the9003.78.0spacing relative tofps_intand the0xffffffffpicture-management sentinel.Without these offsets,
ave_build_process()returns-EOPNOTSUPP(-95) on any mid-streamV4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAMEorV4L2_CID_MPEG_VIDEO_BITRATEupdate, blocking real-time encoders (WebRTC/screen share) on26B123firmware.Also fix two mid-stream rate-control bugs in
ave_build_process()/ave_sess_cbr_fill():limit_bytesby* 8on counted layouts (bits/s, matchingave_start_config()) and recalculate it whenbitratechanges mid-stream so raising VBR bitrate is not capped by the start-time 2x peak.bitrateinave_cmd_process()soave_sess_cbr_fill()tracks live CBR bit-rate updates.ave_layout_26a428(dyn_rc = 0) unchanged until verified on M5 hardware.ave_26b123_process_dyn_rc) and host-harness (tests/test.c) coverage for both codecs.Tested
At
30fca3e8056936fa44ab4c033b4c4e877bbd7849, J413 (M2, T8112) and J615 (M3, T8122) both passed on AVE firmware26B123. Direct V4L2-M2M encoding delivered keyframes at frames 0, 25 and 75 and tracked live bit-rate changes in H.264 and HEVC, in both VBR and CBR. Every stream decoded 120/120 frames, with zero AVE, DART or firmware faults. J413 results, J615 results.At
30fca3e8056936fa44ab4c033b4c4e877bbd7849, hosted Apple build, AVE KUnit (includingave_9003_byte_equality), and host tests passed.Earlier commit
8db6a90b1561d3caba3e1a3a94405ae393c32d0eexercised the same 26B123 VBR and forced-keyframe behavior:tools/asahi/run-host-tests.py --only ave): 11/11 passed (ASan + UBSan), including new H.264 and HEVC26B123forced-keyframe and mid-stream bitrate byte assertions.W=1 KCFLAGS="-Werror"clean ondrivers/media/platform/apple/ave/and arm64 KUnit (drivers/media/platform/apple/ave/.kunitconfig) compiled clean.8db6a90b1561(MacBook Pro 16" M4 Max, J616C / T6041, macOS 27.226B123, tested on bothave0/dev/video14andave1/dev/video15):h264_vaapiandhevc_vaapi, 1280x720, 30 fps, VBR, no B-frames, dmabuf zero-copy) with-force_key_frames 'expr:eq(n,15)+eq(n,45)+eq(n,75)': exact keyframes[0 15 45 75]verified viaffprobe, cleanffmpegdecode.1280x720, 30 fps, VBR, no B-frames) on bothave0andave1: forced keyframes at frames 25 and 75 emitV4L2_BUF_FLAG_KEYFRAME+ Annex-B IDR NAL units; liveV4L2_CID_MPEG_VIDEO_BITRATEupdates (2M -> 10M -> 500k) scale steady-state output (H.264: 1820 -> 2505 -> 678 kbps,HEVC: 2036 -> 2615 -> 651 kbps, forced IDR size jumping to 64-70 KB at 10M), cleanffmpegdecode, 0-95errors, 0 DART/firmware faults.Risk
Risk: two-way · The rate-control offsets are enabled for
26B123.9003.78.0retains its existing VBR limit and byte units. CBR filler now uses each submitted picture’s bit rate.Not yet
26A428keepsdyn_rc = 0.26B123SoCs (T8132 and T8103).