In the previous post I argued that 8-bits with an sRGB color profile is still not enough precision for typical LDR display. There are a lot of factors that determine whether you see banding or not such as dithering/noise and the contrast ratio of your monitor.
But there is a lot of wiggle room for defining what an LDR display/camera is. And there is even more room for arguing what an HDR display/camera is. Is it 2 stops better than LDR? Is it 5 stops better than LDR. Is it 15 stops? We can argue over how much range an HDR display/camera should have to be called “HDR”, but first I think it’s important that we nail down what an LDR display is. I think the following definition (which I’m making up) is fair:
An LDR display/camera is a device that can accurately display/capture an 8-bit sRGB image/scene.
By far the most common display that we see is an 8-bit sRGB display, and the most common cameras are 8-bit sRGB. So to me, it’s a fair definition. That should leave most of you with two questions:
- What exactly is an “sRGB” display?
- Does a typical RAW file have more range than an LDR camera?
First, let’s talk about gamma. Check out this image:
The left and right sides are alternating lines of white and black. If you stand back and squint the left and right sides should look like a solid gray color about equal to the middle-bottom square. On an 8-bit display, black is the color (0,0,0) and white is the color (255,255,255). If you have never heard of gamma before, you would think that the middle-bottom square is the color (127,127,127). The rest of you know that the bottom square is the color (187,187,187).
As you can see, the value that is linearly half-way between white and black is 187, not 127. This happens because our displays are designed to be perceptually linear, and the human eye has more precision in the blacks.
(By the way, if the lines on the left or the right seem like they are yellow-ish, then you need to calibrate your monitor.)
You may have heard of this thing called a “gamma curve”. We would expect that if you displayed the value 200 to your monitor that it would emit 2x as many photons as if you displayed the value 100. In reality, 200 is about 4.6x brighter.
Let’s check out the gradient image.
Perceptually the value in the middle looks about half way between black and white. That value in the middle is about 20% as bright as white. Btw, your monitor’s output curve isn’t truly perceptually linear. Most studies have shown that humans percieve 18% brightness as “half”. That’s why you always hear about “18% grey”. The red stripe shows where the linear middle-point is. I.e. the color that shows the average number of photons between black and white.
As you increase the value that you send to the screen, the actual intensity goes up according to this curve. The red curve is the sRGB curve. The black dotted line is a a gamma of 2.2. The blue line is the slope of the sRGB curve in log-log space. If you don’t understand the blue line, that’s ok. We’ll just be talking about the red one. Btw, I got this image from wikipedia.
Being a gamma curve, the black dotted line is just the formula f(x)=pow(x,2.2). The sRGB curve has two parts. It starts with a linear section (the toe) with a slope of 1/12.92. And the second part has a power of 2.4. The two curves look the same on a graph, but the sRGB curve is much brighter in the blacks than the gamma 2.2 curve.
Here’s where things get interesting. Suppose that we have a linear curve with a slope of 1.0, and it has 256 output values. How many input values (at even steps) would you need to have coverage of every output value? Well, 256 of course.
Now let’s think about that sRGB curve. The toe has a slope of 1/12.92. So if we want a linear curve that matches all 256 output values then how many values do we need? Well, we would need 12.92*256 = 3307.52, which we can round up to 3308. Thus, we would need 3308 linear values to represent the same precision as the 8-bit sRGB curve.
Most digital SLRs store their RAWs as 12-bit linear. That means it has 2^12=4096 unique values. And since we only need 3308, a 12-bit linear curve is enough precision to represent an 8-bit sRGB curve. If we want to be a bit more precise we can observe that 2^11.69=3308. So a perfect 12-bit linear image has 12-11.65 = 0.31 more stops of dynamic range than an 8-bit sRGB image. And cameras are perfect, right?
Reasons why cameras lose dynamic range.
- All cameras have at least a little noise, so you can’t really trust the very bottom of your 12-bit input range.
- The three sensors don’t actually show you the direct RGB image. Rather, there is a linear transformation to your output space.
- Your camera tries to store enough range for all possible white balance values. Once you choose your white balance you will maximize one channel but have to clamp the other two.
- Many RAW formats don’t even use all possible values that 12-bits gives them. For exmaple, some Fuji cameras only use the range 256-4096.
- This one is a little bit out there, but you could argue that you lose range from vignetting. If the pixel at the corner of your sensor is 50% as bright as the pixel in the middle then the pixel at the corner has lost a full stop of dynamic range in the blacks.
But all hope is not lost. There are several other reasons why cameras actually have more dynamic range.
Reasons why cameras have more dynamic range.
- Most digital cameras don’t have “true” linear curve. Rather they have a little bit of a toe at the bottom end. This ends up giving your more range in your bottom end.
- You gain range from downsizing your image. If you are not displaying your image at full resolution then you gain precision (especially in your blacks) from downsizing the image.
- You also gain range at the bottom end back from noise reduction. If you go for agressive noise reduction techniques you are basically trading detail for less noise and more dynamic range.
That’s where we stand. In practice I’ve found that I can salvage an extra half-stop or so by tweaking a RAW file as opposed to just using an 8-bit sRGB image with no tweaking, and most people that I’ve talked to seem to have the same experience. So these are my conclusions.
The Three Rules of LDR Cameras and Displays:
Now that we’ve gone over what I consider an LDR display to be, the next post will go over how much range various HDR-ish cameras actually give you.