Log /lin encoding in RAW

lumpyramy

Member
Sorry my English is bad, I’m Belgian. I have to say I’m new to all this , log etc. I’m in a Film school in Belgium.

Often on forums and informations about Log encoding I see that it allows to allocate more code value in the range of shadows by giving the equal number of values in each stop of dynamic range. I think I understand the principles of Log Vs Lin. The fact is linear encoding gives too much code values to the highlight where the eye is not able to see the tiny changes in brightness in the higher stops.

But I’m not sure, I understand everything. If the ADC in most of the sensor is working in 16bit linear, so the 10 th stop under full well capcity has just 64 code value. I could do 12 bit log and have about 300 values per stop (I know, It’s not exactly equal but it’s to make the point) but I’m wasting many values since the 64 values I got is all I can get, right?

Is that possible to have an ADC that quantizes the analog signal directly in log, would it be better?

I red a lot on this forum and on websites but I’m not sure I’m understanding it all. I am not an engineer or anything, I am just curious of understanding the process, If someone could enlighten me?
 
An log ADC is possible but not easy and has other problems (noise, I think) so basically nobody uses them (yet).

Most cameras use 14-bit linear ADCs, but there are 12-bit and 16-bit linear ADCs out tthere too. And the sensors that Blackmagic uses have two sets of 11-bit linear ADCs with different analog gain, which are then mixed into a single 22-bit signal.

Also, zero is hardly ever zero on the ADCs. Complete darkness can be read, for example, as a value of 250-300 on a 12-bit linear ADC (that goes from 0 to 4096). It's not a single value because of noise.

When you go from 14-bit linear to 10-bit log, you don't necessarily use a standard log function. You can set a black point (300 will be 0), a range on which you move linearly (300-500 will be 0-200) and then a range over which you start going progressively towards log (500-4096 goes to 200-1024).

For example, this is the light response function of my a7S using slog2. If it was purely a log function, it would be straight from top to bottom, with no curvature anywhere.
waveform_slog2_big.jpg


The loss you talk about in the shadows would be there if you used a purely log function, and may be there in the curves implemented by some manufacturers, but it is very small compared with that you are getting in the highlights. Half the values of a linear scale go to the brightest stop of light. Any log losses in the shadows are tiny compared to that.
 
raw log lin

raw log lin

An log ADC is possible but not easy and has other problems (noise, I think) so basically nobody uses them (yet).

Most cameras use 14-bit linear ADCs, but there are 12-bit and 16-bit linear ADCs out tthere too. And the sensors that Blackmagic uses have two sets of 11-bit linear ADCs with different analog gain, which are then mixed into a single 22-bit signal.

Also, zero is hardly ever zero on the ADCs. Complete darkness can be read, for example, as a value of 250-300 on a 12-bit linear ADC (that goes from 0 to 4096). It's not a single value because of noise.

When you go from 14-bit linear to 10-bit log, you don't necessarily use a standard log function. You can set a black point (300 will be 0), a range on which you move linearly (300-500 will be 0-200) and then a range over which you start going progressively towards log (500-4096 goes to 200-1024).

For example, this is the light response function of my a7S using slog2. If it was purely a log function, it would be straight from top to bottom, with no curvature anywhere.
waveform_slog2_big.jpg


The loss you talk about in the shadows would be there if you used a purely log function, and may be there in the curves implemented by some manufacturers, but it is very small compared with that you are getting in the highlights. Half the values of a linear scale go to the brightest stop of light. Any log losses in the shadows are tiny compared to that.

So log encoding is Just a way to save some Space by reducing the resolution in highlight. But i can't get more shades That i already had in the linear quantization in 16bit, right?

And when on a waveform I seE That the signal won't go to zero it's because black is mapped higher to encode shadows with more stops? For exemple if i put black at 2 the stop over will have Just two code values (2 to 4) but if the black is set to 300 then it will have 300 cv (300 to 600). (not sure i am cclear clear). But this reasoning can be done in Adc directly ? Or only after when the signal is already digital?
 
The adc just does a straight linear voltage to code value conversion. A log gamma 1 encode from 16 bit to 12 bit would redistribute the 16 bit linear values into equal code steps per stop of light for 12 bit output, but does not apply a value curve like S-log or other value compression schemes do. But the maximum data resolution at any point can't exceed the 16 bit value.
I think people get overly concerned about insignificant bits at the bottom and top of the scale for the most part. The sensor analog gain and ADC are calibrated so that analog clipping occurs before digital clipping at the top and the analog noise floor is higher than digital clipping at the bottom. We deliver in display referenced video codecs that are all gamma 1 encoded, equal code values per stop distribution. For 10 bit REC709 HD video black floor is at 64 and white clip is at 940 out of 0-1023 values. Code values that fall outside of those levels are simply rendered as black with no detail or white with no detail on a TV. There is no visual information there. To preserve important shadow or highlight details, broader dynamic range camera data has to be compressed in some fashion to fit between 64 and 940. We do this looking at a reference monitor of some kind when we adjust the camera settings or in post when we grade the image.
All photographic systems are analog systems. We don't watch code numbers we capture and watch light. Our eyes do not resolve very bright or very dark details well either.
Digital encoding is just a numeric scale of one kind or another applied to analog light values. It gives us a useful means of storing and manipulating visual information in ways that would not be possible otherwise.

On my Digital Bolex that writes a 12 bit DNG linear raw file from a 16 bit first stage ADC, analog black clip is at 8 and analog white clip is at 4035. Depending on ISO setting the analog noise floor can bounce around a black level code of 16-20 unprocessed. Digital clipping is never recorded.
 
Last edited:
On my Digital Bolex that writes a 12 bit DNG linear raw file from a 16 bit first stage ADC, analog black clip is at 8 and analog white clip is at 4035. Depending on ISO setting the analog noise floor can bounce around a black level code of 16-20 unprocessed. Digital clipping is never recorded.

When you say Analog black clip, what does it mean? Because you are already in digital when there is the conversion in 12 bit. The digital bolex has analog gain?
 
When you say Analog black clip, what does it mean? Because you are already in digital when there is the conversion in 12 bit. The digital bolex has analog gain?

Yes it is an analog CCD sensor that puts out linear analog voltage in response to light. There is a two stage analog gain circuit that calibrates the sensor response for noise and ISO. A separate AD processor board does the digital conversion and processing to digital output. Digital clipping is not allowed in any video camera. They are calibrated so that the analog response of the sensor reaches minimum and maximum voltage states at some code value above 1 and below 4095 for 12 bit raw. This is true of CMOS digital output sensors too. The Analog gain and AD circuitry are just built into the sensor chip itself. There is no analog or digital processing circuitry built into the CCD sensor. Everything is done off chip with discrete circuits. The CMOS BMPCC for instance is a single board SOC camera. The Digital Bolex has 6 separate circuit boards. It even has two separate firmware loads, one for the analog processor board and one for the digital boards.
 
Back
Top