Sign in to follow this  

Color Accuracy of TV

This topic is 4809 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm designing some embedded hardware (in my head right now), and part of the device will need to output a color signal to a TV. I know how to do this (or at least, where to get the info on doing it), but what I'm not sure is how I should store colors in the frame buffer. In case it matters, the resolution I'm going for is 640*480. Since I'm designing the hardware myself, I can store the components of each pixel in any way I want with any size I want. I'm thinking that YUV is probably the best format to store the components in since that is essentially how the TV gets the color info (luminance plus chroma), but how much precision should I store for each component? I can do any anything from 1 bit color to about 32 bits/color (due to timing and memory constraints), but I'm thinking 32 bits/color has more precision that most TVs do (especially since it'd be >=10bits per component, more than most PC gfx cards use - 12bits Y, 10 bits each for U&V). Am I correct that YUV is probably the best color format to store a TV framebuffer in? About how many bits should be stored per component to be able to represent the full accuracy that the TV can reproduce?

Share this post


Link to post
Share on other sites
Low-end professional hardware does 8-bit YCrYCb. High-end professional hardware does 10-bit YCrYCb. Note that those are pixel-pairs, not pixels... so 32 bit per pair(16 per pixel), or 40 bit per pair (20 per pixel). I'm sure there's super-duper-professional stuff that goes beyond 40 bits too, but the DTV spec only allowed for 8 or 10 bit per component. Using more is useful for mixing before you get to encoding the image in the standard format.

One device I worked with only needed limited color selection to draw overlays, and used an 8 bit palette. 0 was transparent (take image from live video feed), 1-255 did a look up for YCrYCb. Technically, if you dithered the pixels, ie: (1,2,1,2) you'd get neither color 1, nor color 2, but this wasn't ever really an issue.

8 bit per component is fine unless you're doing real images, or gradients.

Share this post


Link to post
Share on other sites
I'm not sure what you're calling 'low end professional hardware', but I'm talking about an average TV(connected via standard RCA cables to the device) and nothing like high definition displays or monitors connected via VGA or anything like that.

Share this post


Link to post
Share on other sites
If you look up Gamecube homebrew development then you'll find the format it uses for its output. I remember it does a trick by storing a colour per pixel pair but seperate brightness values, because of the effective range you'll get out of a TV.

Share this post


Link to post
Share on other sites
What I am referring to are Digital TV standards, and the processing equipment for them. DTV NTSC is pretty much exactly like analog NTSC except digital. I think normal NTSC is 640x480, while digital is 720x480... the digital still has horizontal and vertical blanking areas like regular NTSC.

Many TV station's video equipment uses DTV to process everything, then as a final step, convert to analog NTSC to broadcast. A good digital video producton switcher will use 10 bit per component. If it uses 8 bit per component, some small local networks might use it, but large networks won't take it seriously. Thus, low-end and high-end professional equipment.

If you just want to output some boxes and text, etc., you can use pretty much whatever you want. If you want to output gradients or full images, you'll need more bits. If professional equipment uses 10, then 10 is all you need for maximum quality. If you don't need fine color control, it's probably easier to use 8 bit and pack everything in a 32 bit word instead of dealing with odd sized memory chips, or mulitple memory chips, or multiple memory fetches.

Only you know what you require, I'm just pointing out the top end of usefulness.

Share this post


Link to post
Share on other sites
My goal project is a gaming console, so I could get away with as few as 6 bits per color. That would be more colors than the NES, and even the SNES only had 256 colors (well, it used palette of 256 to look up 15 bit colors). I'll figure out how much resolution I need exactly once I decide on exactly what I want to do. I just wanted to have some upper bounds.

I'm not sure if I'm misunderstanding the information I'm reading or what, but I'm not sure what you're talking about 'Namethatnobodyelsetook' with the pixel pairs. I thought that the TV signal consisted of Y, Cr, and Cb for each 'picture element'(I realize the signal is virtually continuous horizontally, but it makes it easier to talk about pixels), so how does storing only four components for pixel pairs work. Is it simply a trick to reduce the amount of information stored (since our eyes are most sensitive to intensity anyways?)
Could you expand on the usual format for storing tv picture information?

Share this post


Link to post
Share on other sites
Hey, if you're going to be building a game console (marvellous idea, by the way, good luck with it!) I reckon the graphics should be hardware-accelerated-raytracing based. :) Especially since consoles are generally played on a TV, hence resolution is low but the image quality is important. Plus it would just be cool. :)

Share this post


Link to post
Share on other sites
On a TV, Y (luma) changes at twice the rate of Cr and Cb (chroma). "They" excuse this because our eyes are more senstitive to luma.

YCrYCb represents a pixel pair. In digital, it is stored in this form. In analog you'll have seperate signals, but Y will changes at twice the rate or Cr and Cb. Each signal will have the same sampling frequency as a pixel pair requires two luma values, and two chroma values. If you've played with TV signals, you may have noticed that a thin vertical lines may appear to toggle between "reddish" and "bluish" as you move it horizontally. You cannot produce a specific color on an individual pixel.

So, an NTSC signal of 640x480, is actually 320pairs x 480. In many cases you can think of it as 640x480 and ignore the color artifacts. You'll have to see if that works for you... or just go with 320.

Also, be aware of interlacing issues. You can smooth things with a filter in hardware, or leave it up to the game developer to ease interlacing flicker. Basically, if you have a black background, and a 1 pixel tall white horizontal line (or other highly contrasting colors), you'll get intense flickering. If the line is thicker, it'll still flicker, but only on the top and bottom edges... wherever a large change occurs over 1 pixel vertical.

edit: As to the details of how this appears on a TV, ie:

YCrY'Cb YCrY'Cb YCrY'Cb

In the third pixel (first half of pair 2), when we get YCr, does the TV display YCr of 2 and Cb left over from 1? Or do we get the color of pair 2, but with two lumas? Unforunately, I'm not sure, I never did see that mentioned specifically in the spec, though it may be in there somewhere.

Also be aware of signal ranges. The minimum values for Y in digital is 0x40, and maximum is like 0xDF. In analog, I'm not sure what the signals are, but it still does retain this "feature". I know it's still there in analog, as many studio devices can output "superblack", which is a black < 0x40. Not all CrCb values are valid, and which are valid changes depending on the value of Y. It's all very odd and in dire need of replacement.

Share this post


Link to post
Share on other sites
Here's some information sources that can help. It did for me.

FourCC
WikiPedia

What I'd suggest is either the 4:4:4 YUV format, or a 4:2:2 format. You can get away with 4:2:2 since the human eye is much more perceptive when it comes to changes in luminance than it is to changes in chroma.

I think what Namethatnobodyelsetook is talking about is a packed 4:2:2 format that's known as YUY2 (or YUNV, V422 or YUYV). You can read more about them on the first link.

Good luck with your project!

Share this post


Link to post
Share on other sites
From DEVLiN's post, in the Wikipedia link, I see that, on screen, the two pixels share the same color, and just alter luma. Thanks DEVLiN. And yes, I was referring to 4:2:2. I'm pretty sure 99% of video equipment uses 4:2:2. I'd forgotten that 4:4:4 was even an option!

Share this post


Link to post
Share on other sites
Quote:
Original post by fractoid
Hey, if you're going to be building a game console (marvellous idea, by the way, good luck with it!) I reckon the graphics should be hardware-accelerated-raytracing based. :) Especially since consoles are generally played on a TV, hence resolution is low but the image quality is important. Plus it would just be cool. :)
I was thinking more like sprites than any kind of 3d. Sure 3d is great, but the thing that started this was me enjoying my NES(via an emulator) and SNES(via the console) games again. Also, I'm just starting this kind of thing and I'm betting a simple 2d system would be much easier than anything fancy 3d (though maybe I could do something like realtime high quality raytracing as a masters project or something like that).

Everybody else: Thanks for the info!

Share this post


Link to post
Share on other sites
If you're on for the nostalgic feel, use a 320 horizontal resolution. That way each horizontal pair will get both the same color and luma, and there'll be no flicker.

If you really want to work with the 640 resolution, you'd better setup some sort of filter. I remember neither the PSOne nor the Sega Saturn had flicker filtering for their high res modes (used on menus, most of the time - but Virtua Fighter 2 ran at full resolution, I'm sure of it), and thus flickered a lot. Same goes to 75% of the PS2 games (flicker filtering is handled by the software). Dreamcast and Gamecube (maybe X-box too) blend odd and even horizontal lines together to avoid flickering.

Share this post


Link to post
Share on other sites
Quote:
Original post by M3d10n
If you're on for the nostalgic feel, use a 320 horizontal resolution. That way each horizontal pair will get both the same color and luma, and there'll be no flicker.

If you really want to work with the 640 resolution, you'd better setup some sort of filter. [...]
Yeah, you're probably right, but it'd be nice to be able to improve on the oldschool feel some =-)

Share this post


Link to post
Share on other sites

This topic is 4809 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this