Vixen
02b45cc4
csharp
public readonly record struct VideoColourCoefficients

The six numbers that take YUV to RGB, for whoever is doing the arithmetic.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A record rather than a branch in a loop, because the same six numbers are wanted in two places that cannot share code: VideoColourConversion uses them on the CPU, and a material that samples the three planes uses them in a shader constant block. Deriving them twice is how the two paths end up disagreeing by a hair and only on limited-range BT.601.

Chroma is taken as sample − 128 in every case, so the offset that varies is luma's alone. The scales already carry the 255/219 and 255/224 that limited range needs.

Fields and properties (6)

  • public float LumaOffset

    Subtracted from luma before anything else — 16 for limited range, 0 for full.

  • public float LumaScale

    What the offset luma is multiplied by.

  • public float RedV

    V's contribution to red.

  • public float GreenU

    U's contribution to green. Negative.

  • public float GreenV

    V's contribution to green. Negative.

  • public float BlueU

    U's contribution to blue.

Methods (2)

  • public VideoColourCoefficients(float LumaOffset, float LumaScale, float RedV, float GreenU, float GreenV, float BlueU)

    The six numbers that take YUV to RGB, for whoever is doing the arithmetic.

  • public static VideoColourCoefficients For(VideoColourMatrix matrix, VideoColourRange range)

    Works out the coefficients for a matrix and a range.

Used by (5)

  • VideoColourConversionVixen.Video
  • VideoConstantsVixen.Video.Rendering
  • VideoConstantsTestsVixen.Video.Rendering.Tests
  • VideoTextureVixen.Video
  • VideoTextureTestsVixen.Video.Tests