Saturday, January 29, 2011

Why Your Computer Looks Horrible Through TV Out

In Episode 3 of Increase Your Nerdiness, we discussed color subsampling. (Click on the Podcast tab for more information and episodes.) The visuals really weren't fair to my audio listeners, so this blog entry presents a summary and key images.

Unlike in RGB, YUV / YPbPr colorspaces sample color at a lower resolution than brightness. You've encountered YUV in JPEG images, DVD's, Blu-Rays, DV, HDV, YouTube videos, and broadcast television. Y is the luma channel, and the Pb / Pr channels make up the chroma information. RGB color is used in your computer monitor to display this webpage, and also in Photoshop, GIMP, and PNG files.

Text compared in RGB and YUV colorspaces
You wouldn't notice with black and white text, but color subsampling can be apparent on the edges of colored fonts. In this image, you see text in full RGB on the left, and a colorspace called 4:2:0 or YV12 on the right. In YV12 color information is sampled in blocks of 4x4. This means that four neighboring pixels share the same color! Let's zoom in really close to see some of the artifacts created:
Artifacts created by YV12 subsampling

On the left is an overscaled letter x from the word 'text' as you'd see it in 4:2:0 - on a DVD for example. On the right is the same letter, but with a grid superimposed to illustrate the borders of these 4x4 blocks. This should help you to look very carefully to see that the blue color bleeds outside what should be the borders of the character. Thankfully we don't watch TV 32 times closer than intended!

When the switch was made from black and white to color TV, viewers without color sets would simply view the Y (luma) channel. The two chroma channels were added, and would indicate the difference between Y and Blue (Pb), and the difference between Y and Red (Pr). Since Blue and Red are measured by how different they are from Y, their combined difference from Y is how Green is figured out! Weird, but true.

So the next time you plug in component cables, you'll know the green one is Y / luma, and the Blue and Red ones are Pb and Pr. Color subsampling is one of the reasons your computer looks trashy when viewed with a video out cable. (Resizing is another big factor). One more thing: If YPbPr is a mouthful, "Yipper" is an easier acceptable nickname.

No comments: