Repository navigation
Conversation
Keep authored subtitle history lossless while avoiding expanded RGBA storage for every retained cue. Document the drawing contract and encoded backing accounting, with pixel, provider lifetime and subtitle regressions.
qoli
marked this pull request as ready for review
October 25, 2026 18:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Retained bitmap subtitle history keeps every cropped cue expanded to RGBA. A previous ten-minute downstream PGS observation retained 2,185 images with approximately 289 MB of expanded image layout, including historical cues needed for subtitle offsets and backward seeks.
Retain each cropped bitmap through a lossless PNG-backed ImageIO provider and expand pixels when drawn. PNG encoding stays on the existing subtitle decode worker. This trades encoding/redraw work for smaller retained image backing without shortening cue history.
What changed
SubtitleImage.encodedBackingBytesfor known compressed backing; document that it excludes framework overhead and temporary drawing pixels.CGImagedrawing contract: callers must not assume a particular raw provider layout.Test plan
Apple Silicon Mac14,14, macOS 27.0.1 (26A434), Xcode 27.1 (27A9275), Swift 6.4. Based on upstream
370b0e4dcc6fb49fca1b6999b075616d3442cb04; only the two subtitle production files, two test files and two documentation files are changed.swift build: passed.LIBDISPATCH_COOPERATIVE_POOL_STRICT=1focused subtitle regression: 28 tests in 5 suites passed.python3 Scripts/check-doc-links.pyand diff whitespace checks: passed.Issue220SoftwareDecoderDrainTests.decodesFixtureFrames:counter.value >= packets - 16failed.HLSLocalServerSlowPeerTests.lanPeersLeaveLoopbackSlots: exceeded its existing 120-second time limit.An isolated rerun of those two suites also reproduced both failures (12 tests in 2 suites). The failing tests and their production implementations are outside this diff. Their cause is not established by these runs, so this PR remains a draft rather than claiming a green full suite.
Tests use generated RGBA/palette images and the existing synthetic PGS fixtures, including independent primary/secondary palettes, clear/reselection and cached seek reconstruction. All four dependency versions and SHAs match upstream's checked-in
Package.resolved; local official Git mirrors were used to avoid repeated downloads. Platform/all-traits CI and new physical-device playback or process-footprint measurements were not run locally.Checklist
CHANGELOG.mdupdated