feat: Support 10-bit YUV, and properly handle colorspaces (YCbCr transform matrix)#3710
Merged
wcandillon merged 3 commits intoShopify:mainfrom Feb 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds proper support for 10-bit YUV video formats and implements correct colorspace handling by reading the YCbCr transform matrix from CVPixelBuffer metadata. Previously, the code made assumptions about colorspace based solely on pixel format, which resulted in incorrect colors (yellow/purple-ish pixels) for 10-bit YUV content.
Changes:
- Refactored colorspace detection to read the actual YCbCr matrix from CVPixelBuffer attachments (
kCVImageBufferYCbCrMatrixKey) - Added support for 422 and 444 chroma subsampling variants (8-bit and 10-bit)
- Improved Metal pixel format detection with explicit format handling instead of heuristics
- Enhanced validation and error messages for plane index bounds checking
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/skia/apple/SkiaCVPixelBufferUtils.h | Updated imports from CoreMedia to CoreVideo, changed getColorspace to accept CVPixelBufferRef instead of OSType, added helper method signatures |
| packages/skia/apple/SkiaCVPixelBufferUtils.mm | Implemented colorspace matrix reading from buffer metadata, added 422/444 format support, refactored Metal pixel format detection with explicit handling, improved validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
wcandillon
approved these changes
Feb 18, 2026
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.
We had support for 10-bit YUV, but it rendered wrong colors (yellow/purple-ish pixels).
This PR fixes this by actually getting the color transform matrix from the buffer (which is stored as
kCVImageBufferYCbCrMatrixKey), which tells us the Skia Color Space to use (SkYUVColorSpace);This is now safe, since before we just kinda assumed colorspace based on format, now we actually know the transform function.
Before
After