Skip to content

Add scaler API for YCbCr range - #156

Merged
Themaister merged 1 commit into
Themaister:masterfrom
bscubed:scaler-ycbcr-range
Oct 7, 2026
Merged

Themaister merged 1 commit into
Themaister:masterfrom
bscubed:scaler-ycbcr-range

Conversation

@bscubed

@bscubed bscubed commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds VideoScaler::set_ycbcr_range() so callers can get limited (narrow) range YCbCr out of the scaler, next to the existing set_ycbcr_chroma_midpoint(). Full range stays the default, so existing output is unchanged.

For VK_SAMPLER_YCBCR_RANGE_ITU_NARROW at bit depth n, the luma row is scaled by 219 * 2^(n-8) / (2^n - 1) with offset 16 * 2^(n-8) / (2^n - 1), and the chroma rows by 224 * 2^(n-8) / (2^n - 1). The chroma midpoint still comes from set_ycbcr_chroma_midpoint(). Only the UBO matrix changes, so the scaler shader (and pyrowave's pre-generated slangmosh_scaler.hpp) is untouched.

Needed for Themaister/pyrowave#25 and Themaister/pyrowave#24.

@Themaister Themaister left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Painful that limited YCbCr needs to be supported, but at least it doesn't have to touch the shaders.

@Themaister
Themaister merged commit fb178c8 into Themaister:master Oct 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants