Module color.ycbcr
Explicit YCbCr values and conversion to encoded and linear-light sRGB.
YCbCr is a value-level color representation. This module deliberately does not own image planes, chroma upsampling, byte decoding, or codec metadata. Samples are normalized code values in the nominal domain [0, 1]; callers must select the matrix, range, and bit-depth policy explicitly.
Full range uses Y in [0, 1] and Cb/Cr centered at 0.5. Video range uses the legal code interval scaled to the selected bit depth. Extended values are preserved by scalar conversion.
toSRgb returns encoded (nonlinear) sRGB and performs no clipping, rounding,
or quantization. toSRgbClamped is the explicit clipping operation for
callers that need [0, 1] output. toLinearSRgb applies the existing sRGB
transfer decode. NaN and infinity are propagated by scalar IEEE arithmetic.
Functions
| Name | Description |
|---|---|
toLinearSRgb(value)
|
Converts explicit YCbCr samples to linear-light sRGB. |
toNormalizedYCbCr(value)
|
Decodes integer YCbCr code values into normalized scalar samples. |
toQuantizedYCbCr(value)
|
Quantizes normalized YCbCr samples to the policy's 8--16 bit code values. |
toSRgb(value)
|
Converts explicit YCbCr samples to encoded sRGB. |
toSRgbClamped(value)
|
Converts to encoded sRGB and explicitly clips finite components to [0, 1]. |
toYCbCr(value)
|
Converts encoded sRGB to normalized YCbCr samples under Policy.
|
toYCbCr(value)
|
Converts linear-light sRGB to normalized YCbCr using the sRGB transfer curve. |
Structs
| Name | Description |
|---|---|
QuantizedYCbCr
|
Packed three-channel code values for a YCbCr policy. |
YCbCr
|
Policy contract: |
YCbCrPolicy
|
Explicit conversion policy. No policy is inferred from the samples. |
Enums
| Name | Description |
|---|---|
YCbCrMatrix
|
Matrix coefficients used by a YCbCr policy. |
YCbCrQuantizationError
|
Errors returned when normalized YCbCr values are quantized to code values. |
YCbCrRange
|
Interpretation of normalized YCbCr code values. |
Aliases
| Name | Type | Description |
|---|---|---|
Bt601Full
|
YCbCrPolicy!(0,0,8)
|
Common explicit policies. |