by kragen · 5y ago · 0 comments
There are various problems in XVideo that make it hard to use for general application display, but the fact that this was a thing they included in it makes me think that a substantial number of video cards have included YUV decoding capability in hardware since the previous millennium.
while not standard, writing a shader to decode is not hard(admittedly if you know shaders)
The time I spent dealing with video decode/encode was not pleasurable but interesting.
The really hard part is the actual encoding/decoding algorhtims
Ah, the old "Step 2: Draw the rest of the owl" scenario.
Carmack is giving an extremely simplified version of the world as it exists today. Your hardware can already use YUV formats, maybe it is even outputting YUV because you chose a resolution and bit depth that forced it to for bandwidth or clock constraints. Complex apps like browsers that do their own compositing can already choose to use YCbCr formats when supported for textures.
Namely, VK_KHR_sampler_ycbcr_conversion. I'm actually not sure if other APIs provide the equivalent yet, the HW capability is pretty recent...
[1] https://developer.android.com/reference/android/graphics/Col...
GL_EXT_YUV_target is close, but it doesn't transparently include the specific step of YUV -> RGB conversion, just the sampling multiple planes + upsampling for chroma (and convenience functions for shader conversion.) (I think? actually not certain, since I can't find definition of how chroma is upsampled)
Well, I guess Vulkan's isn't completely transparent, since the conversion sampler has additional restrictions as to how it can be used. But at least with it shaders can be written to not care whether the source is RGB or not.
You are correct, and you can find details on that by reading the card documentation (as far as it is available). That was in particular the case when cards had a fixed-function rendering pipeline.
With the advent of more general purpose cores on the GPU for the rendering pipeline, YUV decoding has been offloaded to them.
https://wiki.mamedev.org/index.php/Driver:Apple_II (which had no RGB at all)
https://old.reddit.com/r/OpenEmu/comments/hhxnry/sharing_my_... (showing Sonic, among others, though I'm not sure if this is really about NTSC artifacting or just dithering)
http://forum.arcadecontrols.com/index.php/topic,152465.msg15...
https://emulation.gametechwiki.com/index.php/NTSC_Filters
So, there are some exceptions, including a few extremely popular platforms, but certainly you are correct that emulating the majority of game platforms does not need NTSC artifacting.