Fix Retina JPEG scaling for stream-video - #85
Merged
Conversation
Signed-off-by: EuanTop <euan@mail.bnu.edu.cn>
EuanTop
force-pushed
the
fix/retina-jpeg-scaling
branch
from
July 29, 2026 08:45
306794f to
8f3d0bb
Compare
Contributor
|
LGTM! Thank you for this. |
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
Fixes #83.
This updates JPEG frame scaling to produce the requested output pixel dimensions regardless of the host display backing scale. Previously, the macOS
NSImage.lockFocus()path could render through the Retina backing scale, so--scale 0.5could still emit frames at the original Retina-sized dimensions.The new path decodes to
CGImage, computes exact scaled dimensions, draws into an explicitly sizedCGContext, and encodes the result withCGImageDestination.Changes
Validation
make buildswift test --filter VideoFrameProcessingTestsgit diff --check--scale 1.0:1206x2622--scale 0.5:602x1310