====== YUV-to-RGB Conversion ====== DstMode.YUV2RGB treats source color as YCbCr/YUV and converts it to RGB in the blend unit. Normal blend and fog functions cannot be used at the same time. Set FogColor to ''(r,g,b) = (128,YUVBlack,128)''. The green byte becomes an unsigned YUV black-level value; 16 is the nominal MPEG value. YUVContrast is unsigned eight-bit and resets to 41. Raising YUVBlack darkens pixels; raising YUVContrast increases contrast. sY = (YUVContrast + 256) * (Y - YUVBlack) + 128 R = floor((sY + 407 * (Cr - 128)) / 255) G = floor((sY - 207 * (Cr - 128) - 100 * (Cb - 128)) / 255) B = floor((sY + 515 * (Cb - 128)) / 255) These are the equations printed in the specification, including the divisor 255. SrcFmt ''0xD'' supplies Y0CrY1Cb, with Y0 for even U and Y1 for odd U. SrcBGR swaps the chroma component placement. Other source formats map Cr to the red field, Y to green and Cb to blue when conversion is enabled. [[registers:pixel-engine:pixel_yuvcontrast|YUVContrast]] · [[registers:pixel-engine:pixel_fogcolor|FogColor / YUVBlack]] · [[video:capture|Video capture]] Source: [[https://verite.3d32.org/_media/source/v2200spec.pdf#page=37|Technical Spec, p.37]]