Log in

View Full Version : Relation between pixel format and bit depth?


binba
9th June 2010, 00:18
Pixel formats and chroma subsampling have never been the easiest topics, but I'm particularly confused with how bit depths are mentioned. I see these often to the format, e.g. "IYUV (12bpp)".

Instead of questions, here's my current understanding, tell me how far I am from the target:


Pixel formats are about pixels, not bits, and so are actually separate from bit depth.


A pixel format defines (among a few other things) a sample size (e.g. 2 pixels) and how many values will represent it.
4:4:4 would use a sample size of 1 pixel, and 3 values per sample (Y, U, V).
4:2:2 is a sample size of 2 pixels, with 4 values per sample.


The bits describe the word length of each value, so the "bpp" of subsampled clips is a derived, indirect measurement:
bits per pixel = [value word length in bits] x [values per sample] / [sample size in pixels]


I was just confused to see pixel formats paired with bits. I thought any subsampling can be done at 8bit, 10bit, 16bit or whatever.

Blue_MiSfit
9th June 2010, 00:33
I think you're correct :)

GodofaGap
9th June 2010, 07:40
You are little bit confused with terms IMO.

A pixel format defines both the sampling structure as well as the bitlength. 4:4:4 is not a pixel format. A pixel is a discrete digital object with a fixed size, and 4:4:4 alone does not define the size of the samples in the digital world. YV12 is a pixel format that uses 4:2:0 sampling where each sample is 8 bits long. YUY2 is a pixel format that uses 4:2:2 sampling where each sample is 8 bits long. For ease of calculation these formats average out at 12 bpp and 16 bpp. Furthermore, a pixel format also describes how the samples in a frame are structured. YV12 is a planar format, YUY2 is a packed format.

With subsampling not the bitlength is meant, but that Chroma has a smaller resolution than Luma (which is the case for both 4:2:0 and 4:2:2).

binba
9th June 2010, 18:04
Thanks, GodofaGap. I'm aware that a pixel format is "YUY2", not "4:1:1". Having it separate from bit depth was kinda my own (irrelevant) wishful thinking.

I can see how average bpp is useful in the compression world, to apply towards your bandwidth budget. In post production the main concern is about color correction precision and banding; so 8-bit means 256 values in any one channel, 10-bit means 1024. But in pixel formats, 12bpp does not equal 4096 values to work with. Hence the confusion and this post. Guess it comes down to bpp vs. bpc.

1. What is a 'sample', really? E.g. in 4:2:2, is a sample 2 pixels? 1 pixel? one measurement (Y of pixel #1)?

2. Let's say I want 4:2:2 subsampling at 16-bit precision, someone needs to define a distinct FourCC code for any such case? (Is there one?)

3. Are you aware of any such a reference list? FourCC.org is a good source but not systematically organized, it's geared towards a "what's that FourCC?" lookup. I'm looking for the other way around, what's the FourCC for this subsampling, this order, these bits..

GodofaGap
9th June 2010, 20:54
1. What is a 'sample', really? E.g. in 4:2:2, is a sample 2 pixels? 1 pixel? one measurement (Y of pixel #1)?
There is more than one meaning of the world sample in digital video. In this case you are probably looking for the "one measurement" definition yes.

2. Let's say I want 4:2:2 subsampling at 16-bit precision, someone needs to define a distinct FourCC code for any such case? (Is there one?)
Yes, it will need to get its own fourcc. If multiple formats for one fourcc are used, compatibility problems arise. Imagine having to use the same fourcc for Theora and MPEG4 ASP.

A rather know problem here is interlaced YV12. YV12 is actually defined as a progressive format, but some programs (e.g. Avisynth) have stuffed the format to also handle interlaced content. This causes other programs (like VirtualDub) to show the video incorrectly.

3. Are you aware of any such a reference list? FourCC.org is a good source but not systematically organized, it's geared towards a "what's that FourCC?" lookup. I'm looking for the other way around, what's the FourCC for this subsampling, this order, these bits..
No, sorry.

Boolsheet
9th June 2010, 21:29
Microsofts recommends some FourCCs (http://msdn.microsoft.com/en-us/library/bb970578(v=VS.85).aspx) for 10 and 16 bit yuv formats. I wonder if they are even used in any applications.

foxyshadis
10th June 2010, 04:01
Nobody uses P*** for planar, not even Microsoft. That would make too much sense. It's not a bad set of values, though, and it would make sense for avisynth to use it as it breaks into high-dynamic processing.

Binba, the bpp values you're talking about aren't at all useful in the compression world. When encoders talk about bpp, they mean the (height x width) / filesize. Chroma isn't counted at all, it's just an outdated way of describing the approximate compression quality.

Gavino
10th June 2010, 11:38
When encoders talk about bpp, they mean the (height x width) / filesize.
More correctly, filesize / (height x width x frames)