Welcome to our community

Be a part of something great, join today!

  • Hey all, just changed over the backend after 15 years I figured time to give it a bit of an update, its probably gonna be a bit weird for most of you and i am sure there is a few bugs to work out but it should kinda work the same as before... hopefully :)

Gaining from Gain

Peter Moretti

Well-known member
Joined
Apr 20, 2008
Messages
1,595
Reaction score
0
Points
36
I realize that the idea of adding gain goes against the ethos of avoiding all baked-in image adjustments. And yet, there is obviously a logic to why almost all other digital cameras do some form of image adjustment pre-compression.

And perhaps gain is the one that should not be thrown out w/ the bathwater, so to speak. It seems like it might be easier/better to separate valuable image detail from noise by applying gain in the camera instead of increasing "setup," "lift" or "brightness" in post.

I say this b/c the camera has some idea of what the sensor's noise looks like, so perhaps there's a way to apply gain to what the camera identifies as "image" and not as "probably noise." Also gain would be added pre-compression, which I would think would yield a better result than adding it post compression.

I realize this would be philosophical break, but it might yield a better image.

I imagine something along the lines of a "virtual T-stop." Kind of similar to digital zooming used in some cameras; they don't really change focal length, they just crop and magnify. Well this would not open the lens any wider, nor change the DoF. But it would brighten the image as if the lens were opened up more.

It would also be nice to control the shape of the gain curve. In one case you may want to apply gain only to the shadow detail. In another case, you may want to boost the image across the entire range.

*ducks*
 
The problem is that when you add gain, you amplify the noise too plus add the noise of the gain amplifier to the mix. Nothing for free. For any given sensor there is an optimum point that will maximize SN ratio and DR. Either side of that you lose.
 
For every stop of gain you add above optimum, you loose a stop of detail in the highlights and trade quantization noise for more analogue noise at the bottom end. It's really a no-win situation.

Graeme
 
Graeme, but if the gain could be selectively applied, let's say to just the bottom end, you won't lose a stop, correct?

Also, I realize that to separate out noise from image detail may be asking for way too much. But there are noise filters that do a pretty good job of this in post, e.g. NeatVideo. I would think it would be possible to make an improved noise filter in-camera b/c the camera itself has some sense of what the sensor's noise pattern looks like. This might make it possilbe to suppress noise while adding gain.
 
Then it wouldn't be gain - it would be something else.

NR algorithms don't work on the RAW though - they need an RGB image as input.

Graeme
 
Well then make something else! LOL!, J/K.

Thanks for all your help.
 
"Something else" by definition will make the data non-linear. Given that colorimetry necessitates linear data, the non-linearity must be utterly accurate so that it can be totally reversed out, and not add noise in the process or you're back to where you came from.

Graeme
 
Neat does two things. It applies a wavelett based algorithm to reduce spacial noise and it looks forward and backwards through frames to filter out noise temporally. You would need to hold multiple frames in buffer and process them in real-time to keep up with a sensor. That means one more chip and significant added $$ for something that can be done just as well on a computer offline.
 
yeah, you say THAT now, just to pull something out of your sleeve LATER ... :-D

Thanks for the FLUT, Graeme. It's full of stars!

Will monstro have MLUT?
 
there is obviously a logic to why almost all other digital cameras do some form of image adjustment pre-compression. [...] It seems like it might be easier/better to separate valuable image detail from noise by applying gain in the camera instead of increasing "setup," "lift" or "brightness" in post.

First of all, many of the ISO setting changes in other digital cameras are implented with digital gain of the raw file.

Downside of applying digital gain to raw files in-camera:

  • Clipped highlights
  • Larger files
  • Increased quantization error (for non-integer gain)
  • Slightly increased processing requirements.

Benefits of applying digital gain to raw files in-camera:

  • None whatsoever.

This proves that the firmware in other digital cameras was written by idiots or monkeys (perhaps gorillas -- jury still out on that).

With that out of the way, we can address the more interesting and nuanced case of analog gain. There are only three reasons to use analog gain:

  • Because you could not eliminate quantization error.
  • Because you could not eliminate late stage read noise.
  • Because you are an idiot.

We can cross the first one off the list because the read noise in almost every raw digital camera is always much higher than needed to completely suppress quantization error. Perhaps if people were still using 10-bit ADC, then it would be a valid reason, but they're not. For most other raw digital cameras, the use of analog gain is a mix of the other two reasons.

Ideally, the late stage read noise (e.g. self-noise of the ADC) would be reduced to a level that it does not contribute to the total read noise at all. Then there is no reason to ever use analog gain. But in most other cameras, that is not achieved (probably for good reason).

The next best thing is to offer the ability to eleminiate the contribution of late stage read noise by feeding the late stage electronics with a stronger signal. This is why sound engineers can use gain to reduce the self-noise added by a cheap audio ADC (at the cost of headroom).

For example, here are two images with the exact same exposure and brightness, one that uses digital gain and the other that uses analog gain:

IMG_7278_500_raw_therapee_crop.png


IMG_7281_500_raw_therapee_crop.png


The late-stage read noise in these 5D2 shots is so bad that you have to feed the ADC with a stronger signal (and cip highlights) to get rid of it. Ideally it wouldn't have that noise in the first place, but being able to get rid of it with analog gain is the next best thing.

If other cameras stopped there, it would be great. Unfortunately, they continue using analog gain even when there is no longer any contribution to read noise by the late stage electronics. That is when firmware programmed to use analog gain is braindamaged.

So, there are four types of in-camera gain that can be applied to a raw file:

  • Idiot gain
  • Metadata gain
  • Numpty analog gain
  • Useful analog gain

  • Idiot gain is digital amplification applied to the raw file in-camera.
  • Metadata gain is the only one that the RED ONE uses: the data from the sensor is left as-is until post.
  • Numpty analog gain is when there is no quantization or read noise benefit.
  • Useful analog gain is the acceptable compromise for cameras that could not get the late stage read noise low enough.

My guess is that the RED camera designers are smart, and they tested the option of offering user-controllable analog gain and they found that there was no improvement in noise. This would be becase the late-stage read noise (e.g. ADC) is very low or the early stage read noise (e.g. pixel) is very high. Either way, the result is that there would be no benefit to having analog gain on RED ONE.

Most other raw digital cameras offer a mix of all four types of gain. For example, on my 5D2:

  • Idiot gain at f/2.8 or faster f-numbers (compensation for sensor angle of response).
  • ISO 50: metadata gain
  • ISO 100: no gain
  • ISO 125: idiot gain
  • ISO 160: idiot gain
  • ISO 200: very useful analog gain
  • ISO 250: useful analog gain and idiot gain
  • ISO 320+HTP: useful analog gain, idiot gain, and metadata gain.
  • ISO 400: medium useful analog gain
  • [...]
  • ISO 800: kinda useful analog gain
  • ISO 1600: slightly useful analog gain
  • ISO 3200: numpty analog gain
  • ISO 6400: idiot gain
  • ISO 12800: idiot gain
  • ISO 25600: idiot gain

All of the settings that use idiot gain should of course use metadata gain instead, but they don't. ISO 25,600 actually clips four stops of highlights compared to ISO 1600 with the same exposure, yet when brightness is equalized it has the exact same noise level (SNR). The only metadata gain on my camera is ISO 50. HTP is like the ugly stepbrother of metadata gain: it only does 1 stop max.

What I'd like to see is for other camera manufacturers to get rid of idiot gain and start offering separate controls for metadata and analog gain. Then I could set analog gain to 400 and metadata gain to 25,600. Or analog gain to 400 and metadata gain to 200.
 
The problem is that when you add gain, you amplify the noise too plus add the noise of the gain amplifier to the mix.

Not so. I've personally measured dozens of DSLRS and none of them have more noise with analog gain than with digital gain. It's always the same or less. The reason for this is that the system noise is already dominated by other noise sources -- increases in the self-noise of the gain amplifier at higher gain settings are always too small to increase total system noise. That's why it is always the same as digital gain (or less, such as the case when other noise sources in the system such as the ADC are reduced with analog gain).

Nothing for free. For any given sensor there is an optimum point that will maximize SN ratio and DR. Either side of that you lose.

That is not correct either. In many cameras, the late stage electronics (e.g. ADC) contribute significant read noise to the system. If you are concerned about the SNR of certain tonal levels in very low light, the optimum point will be that which reduces the read noise to the lowest level, which may be a four stop increase in analog gain (as in the case of all Canon DSLRs going back to the 20D). When light is not ample with those cameras, you have to optimize for SNR *or* dynamic range: no one setting will give both.
 
Back
Top