Repository navigation
Description
Problem and requested behavior
Track the bitmap-history memory problem separately from its proposed implementation in #879 (the upstream counterpart of our downstream 0010-subtitle-bitmap-storage.patch).
Dense PGS / DVB / DVD subtitle history can retain substantial expanded pixel storage. We need to reduce that retention while preserving rendered pixels, alpha, crop, placement, forced flags, subtitle offsets and backward-seek reconstruction. The engine owns the retained images, so replacing only the host's visible view does not release that history.
The discussion in #879 established two different costs: compressed history helps retained-but-unsubmitted images, whereas presenting lazy PNG images directly through Core Animation can decode on main and retain expanded pixels. The maintainer selected a raw-RGBA cue-byte budget, released in 7.49.0. This issue tracks the remaining device acceptance and downstream patch exit criteria; it does not establish a regression in that budget.
Version and environment
- Current downstream baseline: AetherEngine 7.52.0,
db35d50e5c3d5b617551ca27ec7ef4a3d4e534e3; FFmpegBuild 3.11.0. - Custom host: Syncnext 1.205 (572), signed Debug build, physical Apple TV running tvOS 26.6.
- Source: 4K REMUX with HEVC Dolby Vision Profile 7 FEL, TrueHD Atmos rendered as APAC 7.1.4, and selected embedded PGS.
- The latest device run includes our full local integration patch set, including PNG backing. It is supplementary integration evidence, not a measurement of an unmodified 7.52.0 build or of PR perf(subtitles): retain bitmap images with deferred PNG backing #879's branch.
Evidence and its limits
The earlier matched ten-minute raw/PNG comparison and controlled Core Animation counterexample are recorded in PR #879's device report. That report distinguishes expanded layout, encoded bytes and measured process footprint, and records the direct-presentation regression.
On the current patched 7.52.0 integration, a fresh uninterrupted device observation recorded:
| Measurement | Result |
|---|---|
| Wall observation | 120.154 s |
| Renderer advancement | 120.250 s |
| Samples | 116 |
| Maximum retained bitmap images | 46 |
| Maximum images with known encoded backing | 46 |
| Maximum total encoded backing | 922,658 bytes |
| Sampled peak process physical footprint | 951.85 MiB |
| Reported memory-pressure events | 0 |
The process footprint includes the full FEL + object-audio pipeline. The encoded byte total is not app RAM or a memory bound. This short, single-mode run cannot establish a raw/PNG improvement, the raw budget's benefit, long-duration behavior, offset compatibility, or visible backward-seek reconstruction.
The full patched integration's focused tests previously passed (33 XCTest + 38 Swift Testing tests). The reporting-time rerun of HTTPDiscMIMERecognitionTests|SubtitleBitmapStorageTests|Issue628PGSOffMainDecodeTests also passed all 18 Swift Testing tests using the already-built test binary. Pixel/lifetime tests do not establish post-presentation process footprint.
Acceptance to resolve
- Compare the tagged upstream raw-RGBA budget against the existing ten-minute baseline on the same title/device with fixed build provenance and process-footprint sampling.
- Record the host's exposed subtitle-offset range and verify cues at its supported positive and negative offsets. The current upstream floor is 60 seconds; the protected floor and logical 64 MiB target are not a hard process-footprint cap.
- Seek backward by one or two minutes into an evicted region and verify actual packet-store/decode/presentation recovery at the landing, including visible PGS.
- Preserve pixel/alpha/geometry/forced semantics and check cancellation and track changes for the selected solution.
- If PNG backing remains under consideration, resolve its provider-layout/API contract and direct-Core-Animation decode/cache costs explicitly. perf(subtitles): retain bitmap images with deferred PNG backing #879 already documents those tradeoffs; it is not merge-ready acceptance of PNG as a general memory fix.
Related: #879 (existing implementation PR and maintainer decision), #921 (bitmap-sidecar packet storage/drain; a different retention surface).
No private media URL, credentials, full device logs, or copyrighted sample are included.
Activity
Merge fix/929-bitmap-budget-far-future: the bitmap budget evicts cues…
superuser404notfound commentedon Oct 30, 2026
Thanks for splitting this out with clear acceptance points. I ran the backward-seek part on the Mac with
aetherctl playagainst a synthetic PGS fixture, and it turned up one gap in the budget, now fixed onmain(6cf30ab, unreleased).Fixture. 300 s, one display set every 3 s with its clear 2 s later. The engine crops each image to its alpha bounding box, so a full-frame ODS with a one-line band costs only about 353 KB (1104x80) and never reaches the 64 MiB target on a short file. The fixture therefore carries a 1120x900 opaque block, about 4 MB of RGBA per cue. Each run plays 140 s, seeks back to 20 s and plays on.
What held on 7.52.0 + #879:
The gap. After the backward seek, the old position's floor and lead (cues from 84 s to 204 s) count as cues ahead of the new playhead, and the budget never evicts those. The retained images grew from 165 MB to 246 MB and stayed there until playback got back to them. On a dense track, every seek back therefore roughly doubles the retained images.
Fix (#929, f95b4c4). Under budget pressure, cues that start beyond playhead + 60 s drain lead + 15 s margin, and beyond the cursor's last decoded packet, are now evicted first, furthest first. The cursor has not reached them yet and decodes them again from the packet store when it gets there (the packet store evicts from behind only), and
insertCueSortedreplaces by start and geometry, so nothing is duplicated. History behind the playhead is evicted only after those cues, so host-offset history is never traded for them.Same fixture, release build, both arms run in parallel:
mallocMBat 150 s (first probe after the seek)physFootprintat 240 sphysFootprintlagsmalloc: it read 301 against 302 MB at 150 s in the two arms and separated only by 210 s. A footprint sample taken right after a seek will therefore understate the difference. The 117 MB left at 44.6 s is the protected part, the 60 s floor plus the lead, which on this fixture is above 64 MiB by design. As before, that target is not a cap.Four unit tests cover the new eviction order (
Issue929BitmapBudgetAheadTests), and the AE#879 suite is unchanged and green.What is still open from this issue, and needs your device and your host:
fix(subtitles): the bitmap budget evicts cues the drain has not reach…
superuser404notfound commentedon Oct 30, 2026
Released in 7.53.0 (4a82484).
qoli commentedon Nov 6, 2026
I ran a new ten-minute pair on the original 57.8 GB REMUX and the same physical Apple TV, now on tvOS 26.6.1. Both fresh processes used Syncnext 1.212 (579) in the app's signed Release configuration, SyncnextHybrid
efefa276, AetherEngine 7.56.0 (76ad51a7) and FFmpegBuild 3.12.1. Both included the current upstream bitmap budget and its rewind fix. The raw arm omitted downstream patch0010and the PNG arm included it. The playback route was native AVPlayer with P7-to-P8.1 conversion and the TrueHD-to-EAC3 bridge, audio stream 1, PGS stream 6, 1× playback and a 12.00 s forward-buffer preference.All 120 playback-clock samples per arm reported playing at 1×. MB is decimal and the footprint covers the entire process. A first PNG run had the playback information overlay enabled. The table uses the fresh overlay-off run to match the raw arm.
The older 7.47.0 Debug pair on this title measured 815.84 MB raw and 589.55 MB PNG at the sampled peaks. That pair supplies historical context across different engine and build versions. Earlier device comparison
After each measurement I sought back 120 s, from about 604.70 to 484.72 s. The pre-seek diagnostics showed 360 retained bitmap cues with the earliest at 521.146 s and zero covering the target. Both arms resumed video and rendered the PGS overlay in the landing region, captured on the TV by 491–493 s. In a separate diagnostic device run on the raw variant, PGS 6 → 5 → 6 mounted the selected track's image on every change, including an authored forced cue with its 1920×1080 canvas geometry. Switching again and stopping cleared both cue history and overlay. Forty focused raw-variant tests passed for pixel and alpha preservation, crop and placement, forced cues, seek landing and cancellation. The current Syncnext host uses a 0 s embedded-subtitle offset.
The raw seek and presentation checks passed. PNG history still reduced sampled peak footprint by 110.94 MB (19.7%) and the late-window median by 86.19 MB (17.0%) on this workload. I am leaving the downstream PNG retirement decision open with these results.
superuser404notfound commentedon Nov 6, 2026
Thanks for the matched Release pair and for running the seek and track-switch checks on the device. The 0 s offset answers the open question from my last comment, and it points straight at where most of the 111 MB comes from.
Where it comes from. The 64 MiB budget never touched two windows: 60 s of history behind the playhead (the floor that lets a host offset find its cue without a seek) and the drain's 60 s decode lead ahead of it. Both were sized for offsets up to +/-60 s. On a dense track those 120 s alone are well above 64 MiB, so the target never applied. Your pre-seek dump (360 retained cues, the earliest about 84 s behind) has that shape. A PNG history keeps the same cues, only compressed.
Change (ca8e3be, merged to
mainas d8f4c41, unreleased). A newAetherEngine.maximumSubtitleOffsetSecondslets the host declare the largest offset of either sign it applies to the overlay. Both bitmap edges follow it, never below 15 s (the backscan a seek re-decodes, and enough to cover a backward nudge under the 2.5 s jump threshold, which does not re-decode), and the lead never above 60 s. The default stays 60, so nothing changes until a host sets it. A host without an offset control, Syncnext today, sets 0.softwareSubtitleDelaySecondsis always covered, and text tracks are unaffected.Measured with
aetherctl playon a 300 s fixture: an opaque 1120x900 PGS image (about 4 MB of RGBA) every 3 s, 140 s of playback, a seek back to 20 s, then 80 s more. Release build, all three arms run in parallel:mallocMB, 120 s to 210 sphysFootprintat 150 s / 180 sWith a reach of 0 or 10, the protected part (15 s each side, about 40 MB here) fits under the budget, so the retained images now sit at the 64 MiB target. A second run at reach 0 with a forward nudge (30.6 s to 32 s) and a far forward seek to 200 s also missed no set. The nudge kept the cues it had already decoded, and the far seek dropped them.
On your title the retained total should fall to about the budget, unless 15 s each side of that track already exceeds it on its own. Comparing that against the 451 MB PNG run would settle whether PNG still pays for itself downstream. The decision is yours either way. If you rerun it, it needs only
engine.maximumSubtitleOffsetSeconds = 0before the load, with this commit or the release that carries it.superuser404notfound commentedon Nov 6, 2026
Released in 7.59.0 (b6b3ff7).
qoli commentedon Nov 9, 2026
I reran the ten-minute comparison on the same 57.8 GB 4K REMUX and physical Apple TV (tvOS 26.6.1). Both runs used signed Release builds of Syncnext 1.214 (581) with AetherEngine 7.61.1 (
5f225054) and FFmpegBuild 3.13.0 (9282e592). Both used native AVPlayer, Dolby Vision P7 → P8.1, the TrueHD bridge on audio stream 1, PGS stream 6, a 12 s forward buffer preference, and 1× playback with the playback information overlay off.Syncnext uses a fixed 0 s embedded subtitle offset. The raw RGBA arm omitted downstream patch
0010and setengine.maximumSubtitleOffsetSeconds = 0before load. The PNG arm kept0010and the default 60 s reach. The device logs confirmed0.0and60.0, respectively.All 120 playback clock samples in each run reported playing at 1×. Process physical footprint was sampled nominally every 5 s and is reported in decimal MB.
After each measurement I sought back 120 s, from 604.43 s to 484.43 s in the raw arm and from 603.40 s to 483.40 s in the PNG arm. Both targets were earlier than the earliest retained bitmap cue, and neither had a retained cue covering the target. The raw arm held 282 bitmap cues and about 63.98 MiB of estimated decoded image layout at that point. Video resumed and PGS stream 6 was visibly restored on the TV in both runs. The host logged a mounted PGS overlay at about 485.00 s in both. The raw configuration also passed 118 focused engine tests on macOS, including offset reach, rewind, track selection, and cancellation.
The 0 s raw configuration passed the backward-seek check. On this matched pair, PNG still lowered the sampled peak by 31.10 MB (6.7%) and the median over the last 120 s by 42.39 MB (9.5%). For context, the earlier 7.56.0 PNG run peaked at 451.05 MB. Earlier Release comparison
fix(subtitles): a declared offset reach drops the bitmap history behi…
superuser404notfound commentedon Nov 9, 2026
Thanks for the matched 7.61.1 pair. It shows where the rest of the gap comes from.
Where the 31 to 42 MB come from. At your seek point the raw arm held 282 cues and 63.98 MiB, so it sat exactly at the byte budget. With a reach of 0, only 15 s on each side of the playhead is protected. Everything else in those 64 MiB was history behind the floor, and that history is what your PNG patch stores compressed. That history does almost nothing:
.resetAndDecode).So it only ever saved a re-decode when a seek happened to land inside it.
Change (b1f922d on
main, unreleased). Once a host assignsmaximumSubtitleOffsetSeconds, bitmap cues that ended behindmax(reach, 15 s)are dropped immediately instead of being kept up to 64 MiB. A host that never sets it keeps the AE#879 budget unchanged. Text tracks are unaffected, andsoftwareSubtitleDelaySecondsis still covered.Same
aetherctl playfixture as before (300 s, an opaque 1120x900 PGS image of about 4 MB every 3 s, a seek back to 20 s at 140 s, Release build, arms run in parallel):mallocMBat 150 / 180 / 210 sphysFootprintat 150 / 180 sAfter the seek, the landing cue (18 s, covering 20.3 s) and every following set arrive exactly as on 7.61.1, all of them before their start times.
On your title the retained raw images should fall from about 64 MiB to the 30 s window, which is roughly what your PNG history saves today. Rerunning needs no host change beyond the
maximumSubtitleOffsetSeconds = 0you already set, just this commit or the release that carries it. The PNG decision stays yours.chore(release): prep 7.62.1 - version sweep, changelog folds #1015, #929
superuser404notfound commentedon Nov 10, 2026
Released in 7.62.1 (
b1f922de): once a host setsmaximumSubtitleOffsetSeconds, bitmap cues that ended more than max(reach, 15 s) behind the playhead are dropped at once instead of being kept up to the 64 MiB budget. Sodalite and AetherPlayer are bumped to it.