UYVY in Max, what standard is used to display/convert to RGB?

diablodale's icon

What formulas or standards does Max use for any needed UYVY -> RGB conversions in objects like jit.window, jit.pwindow, jit.gl.videoplane, etc.?

I ask this because in today's world of HD (720p or higher) resolutions, often the encoding is actually not UYVY (or YUY2) and is instead YCbCr using the BT.709 standard. The latter is the HDTV standard for anything HD (720p+). This newer standard has material changes in formulae from UYVY (old school YUV or BT.601).

I understand that I can always write my own shader and convert the data myself. I also understand that the shaders distributed w/ Max in the Cycling '74\jitter-shaders\color folder are based on the non-HD standard of BT.601 with studio-swing.

diablodale's icon

All YUV, AYUV, and UYVY functionality in Max (YUV ecosystem) expects a YCbCr 4:2:2 datastream that is UYVY encoded to be BT.601 studio swing for all resolutions. I learned this when I spoke with the Max support team.

Cycling74 has no plans at this time to support another colorspace or encoding. Max has ARGB and BT.601 studio swing. Therefore, to use BT.601 full swing or any form of BT.709 (the standard in HD video) with the Max YUV ecosystem, custom code/patching must be done to render with the best fidelity. http://en.wikipedia.org/wiki/YCbCr

If your YUV video stream is anything other than BT.601 studio swing and you use Max's YUV ecosystem, you will loose fidelity/data. Why? Studio swing uses only 220 of the possible 256 values in the YUV encoding. Even if custom code converts from full swing -> studio swing for the ecosystem, there is a narrowing of data. 35 steps out of the 256 possible are no longer used causing a loss of 14% of data. This may lead to slight banding.

Using the incorrect BT.601/709 or studio/full swing will also result in various color and/or luminance skews. For example, it might be more/less saturated, red shifts to yellow/magenta, or blue shifting to cyan. http://avisynth.nl/index.php/Colorimetry#How_can_I_see_if_the_correct_standard_is_used_upon_playback.3F

It is possible to convert from one colorspace to another. However, it is computationally expensive. One can't create an accurate single BT.709->BT.601 conversion matrix due to the 4:2:2 encoding. The chroma would need to be subsampled, interpolated, and then the color transformed. Or, one could convert to intermediate RGB while being careful not to have chroma creep. Alternatively, one could ignore some of the inaccuracies and still create a single conversion matrix. Technically, all these conversion options can be done with varying computational expense.