Velocity Reviews > dynamic range and A/D conversion

# dynamic range and A/D conversion

David J Taylor
Guest
Posts: n/a

 09-22-2006
bugbear wrote:
[]
> Even if all the encoders were linear, surely there's a simple
> interplay between dynamic range and accuracy?
>
> A single bit (potential values 0 and 1!) can encode
> a massive dynamic range (e.g. 10 f-stops worth).
> It just won't have much accuracy within that range
>
> The same logic applies to 8 bit versus 12 bit.
>
> There's no reason they shouldn't have the same dynamic range,
> with different accuracy.
>
> Of course, one could use 8bit to have the same accuracy
> as 12 bit, but a smaller range.
>
> Or any compromise between these 2 extremes.
>
> (non-linear encoding improves perceievd accuracy,
> since (IIRC) the eye is a log (ish) device,
> but I believe this is a separable issue)
>
> BugBear

Yes, if you talk about different encoding choices, there are many
different possibilities. That's why I suggested that you needed a
definition of dynamic range to discuss this in a quantitative way.

I don't think that you should ignore any of the components of the vision
chain, in particular the characteristics of the display device and the
human eye, when choosing an optimum encoding for a given number of bits on
the storage or transmission channel.

Cheers,
David

Guest
Posts: n/a

 09-23-2006
David J Taylor wrote:

> Johannes,
> If the digitising is only eight bits linear, then a lot of dynamic range
> will be lost. As one f/stop is half the light, full scale on 8 bits is
> 256, 1 stop down is 128 and so forth, 2 stops is 64, so the total range is
> only 8 stops. There is no tonal contrast in the lowest level, it is
> either on or off, so the dynamic range may be considered as well less than
> 8 stops *depending how you define dynamic range).

Well, thatīs kind of interesting.
I always thought the tonal values stay the same after a/d conversion
and theyīre only spread out on a smaller strap. Isnīt it the case
that, when doing a/d conversion with 8 bit or whatever bit width, the
lowest level holds the darkest tonal level that the image contains and
the highest level the brightest and that only the sampling is
closer/smaller? What you imply is a lowest level as total black and a
highest as total white. Is that really so?

> With the JPEG images, a non-linear encoding is used so that the digital
> value is more nearly the square-root of the light level: 1, sqrt (0.5),
> sqrt (0.25), i.e. 255, 181, 128 etc., so that there is a greater dynamic
> range possible, at the expense of a less accurate representation of a
> particular light level (in the highlights).

Maybe I havenīt recognized any loss due to that gamma conversion.

Greetings!

David J Taylor
Guest
Posts: n/a

 09-23-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> David J Taylor wrote:
>
>> Johannes,
>> If the digitising is only eight bits linear, then a lot of dynamic
>> range will be lost. As one f/stop is half the light, full scale on
>> 8 bits is 256, 1 stop down is 128 and so forth, 2 stops is 64, so
>> the total range is only 8 stops. There is no tonal contrast in the
>> lowest level, it is either on or off, so the dynamic range may be
>> considered as well less than 8 stops *depending how you define
>> dynamic range).

>
> Well, thatīs kind of interesting.
> I always thought the tonal values stay the same after a/d conversion
> and theyīre only spread out on a smaller strap. Isnīt it the case
> that, when doing a/d conversion with 8 bit or whatever bit width, the
> lowest level holds the darkest tonal level that the image contains and
> the highest level the brightest and that only the sampling is
> closer/smaller? What you imply is a lowest level as total black and a
> highest as total white. Is that really so?
>
>> With the JPEG images, a non-linear encoding is used so that the
>> digital value is more nearly the square-root of the light level: 1,
>> sqrt (0.5), sqrt (0.25), i.e. 255, 181, 128 etc., so that there is a
>> greater dynamic range possible, at the expense of a less accurate
>> representation of a particular light level (in the highlights).

>
> Maybe I havenīt recognized any loss due to that gamma conversion.
>
> Greetings!

The ADC should linearly convert light levels from the sensor to digital
values, yes, and the accuracy depends on the number of bits. However
general photographic usage talks in terms of "stops" which are not a
linear scale, but a logarithmic one (corresponding more closely to how the
eye responds to light). Alternatively, you could look on it as a
percantage accuracy. With a linear conversion, the quantisation step
expressed as a fraction of the signal in a 256-level signal is 1/256 at
the white end, but "100%" at the black end (1/1). With a gamma-corrected
JPEG, the percentage steps are more equal across the whole range.

Does that help?

David

Guest
Posts: n/a

 09-24-2006

David J Taylor schrieb:
> The ADC should linearly convert light levels from the sensor to digital
> values, yes, and the accuracy depends on the number of bits. However
> general photographic usage talks in terms of "stops" which are not a
> linear scale, but a logarithmic one (corresponding more closely to how the
> eye responds to light). Alternatively, you could look on it as a
> percantage accuracy. With a linear conversion, the quantisation step
> expressed as a fraction of the signal in a 256-level signal is 1/256 at
> the white end, but "100%" at the black end (1/1). With a gamma-corrected
> JPEG, the percentage steps are more equal across the whole range.
> Does that help?

Not really because I still do not see why it should compress the
dynamic range in the picture. In a 256-level signal the spot at 1/256
represents the brightest part of the image and 1/1 the darkest. The
logarithmic range in between can well be 10 stops, itīs only that I
have just 8 different values to represent them. But: The spot at 1/256
is still 10 stops brighter than at 1/1 or am I on the totally wrong
track here?

Greetings!

David J Taylor
Guest
Posts: n/a

 09-24-2006
(E-Mail Removed) wrote:
> David J Taylor schrieb:
>> The ADC should linearly convert light levels from the sensor to
>> digital values, yes, and the accuracy depends on the number of bits.
>> However general photographic usage talks in terms of "stops" which
>> are not a linear scale, but a logarithmic one (corresponding more
>> closely to how the eye responds to light). Alternatively, you could
>> look on it as a percantage accuracy. With a linear conversion, the
>> quantisation step expressed as a fraction of the signal in a
>> 256-level signal is 1/256 at the white end, but "100%" at the black
>> end (1/1). With a gamma-corrected JPEG, the percentage steps are
>> more equal across the whole range.
>> Does that help?

>
> Not really because I still do not see why it should compress the
> dynamic range in the picture. In a 256-level signal the spot at 1/256
> represents the brightest part of the image and 1/1 the darkest. The
> logarithmic range in between can well be 10 stops, itīs only that I
> have just 8 different values to represent them. But: The spot at 1/256
> is still 10 stops brighter than at 1/1 or am I on the totally wrong
> track here?
>
> Greetings!

Tony,

If you have a linear ADC, the spot with digital value 255 is 255 times
brighter than the spot with digital value 1. As a stop is a factor of 2
in light-level, an 8-bit linear representation will have a maximum range
of 8 stops (255 to 128, to 64, to 32, to 16, to 8, to 4, to 2, to 1), but
at the lowest recordable brightness level, the digital value is either on
or off, i.e. there is no "tonal range" at 8 stops down from the maximum
brightness. In a typical camera, a 12-bit linear convertor is used, which
provides a 12-stop range (if you accept zero tonal range at the lowest
brightness level).

[I am ignoring non-linearity, dark current, readout noise etc.]

Once you start encoding the data - either for a RAW file or for JPEG, you
can do various tricks to represent 12-bit linear data with fewer bits, by
some sort of algorithm chosen so that the eye cannot see the brightness
errors which result from using the algorithm.

Any closer?

David

Floyd L. Davidson
Guest
Posts: n/a

 09-24-2006
(E-Mail Removed) wrote:
>David J Taylor schrieb:
>> The ADC should linearly convert light levels from the sensor to digital
>> values, yes, and the accuracy depends on the number of bits. However
>> general photographic usage talks in terms of "stops" which are not a
>> linear scale, but a logarithmic one (corresponding more closely to how the
>> eye responds to light). Alternatively, you could look on it as a
>> percantage accuracy. With a linear conversion, the quantisation step
>> expressed as a fraction of the signal in a 256-level signal is 1/256 at
>> the white end, but "100%" at the black end (1/1). With a gamma-corrected
>> JPEG, the percentage steps are more equal across the whole range.
>> Does that help?

>
>Not really because I still do not see why it should compress the
>dynamic range in the picture. In a 256-level signal the spot at 1/256
>represents the brightest part of the image and 1/1 the darkest. The
>logarithmic range in between can well be 10 stops, itīs only that I
>have just 8 different values to represent them. But: The spot at 1/256
>is still 10 stops brighter than at 1/1 or am I on the totally wrong
>track here?

With a "linear" conversion, the number of bits determines the
ratio of the maximum level to the minimum level that can be
recorded, and that is of course the dynamic range.

Your statement is true for what is called a "non-linear" A-D
conversion. The 8-bit representation used by JPEG is an example
of exactly that. The non-linear transfer function determines
the "dynamic range".

A significant point to remember though, is that "dynamic range"
does not necessarily equate to the same thing as "useful dynamic
range". Hence while it is true that JPEG technically can record
a greater dynamic range in 8 bits that a linear 12 bit file can,
there is a very significant difference between them, and the
_useful_ dynamic range of the 12 bit linear file is greater.

Here is a chart showing the "normalized" values for 12 bit linear
data:

| Number of | |
| Levels | |
Fstop | 12 bit | Normalized Pixel |
Range | Linear | value |
------|------------|------------------|
1 | 2048 | 1.0 |
2 | 1024 | 0.5 |
3 | 512 | 0.25 |
4 | 256 | 0.125 |
5 | 128 | 0.0625 |
6 | 64 | 0.03125 |
7 | 32 | 0.015625 |
8 | 16 | 0.007812 |
9 | 8 | 0.003906 |
10 | 4 | 0.001953 |
11 | 2 | 0.0009765 |
12 | 1 | 0.0004883 |

The brightest level would be 1.0, represented by a binary value
of 1111 1111 1111. Half that brightness would be 0.5,
represented by a binary value of 0111 1111 1111. One quarter of
the maximum brightness, 0.25, would be represented by 0011 1111
1111.

The range above 0.5 all the way to 1.0 is divided into 0111 1111
1111 equal parts, which in decimal is 2048 levels. Hence the
accuracy with which a brightness value in the highest f/stop can
be recorded is extremely good. (Probably more than 10 or 20
times better than the eye can distinquish, and hence using 2048
levels to represent only a 1 f/stop range is a real waste.)

Down at the 9th f/stop, the range is divided into 0000 0000 0111
values (decimal , which is not particularly very good accuracy.

As it happens, 8 levels in an entire f/stop is just about the
minimum that is useful. Fewer than that and the image will
appear to be "posterized".

Hence even though a 12 bit file technically has a dynamic range
of 12 f/stops, the actualy useful dynamic range is about 9
f/stops.

However, with JPEG the increments are not linear (and there is
no waste of 2048 values just for 1 f/stop), and instead a "gamma
correction" curve is applied (basically that is a lookup table
which quantizes a larger number of values into a smaller number,
in a non-linear way). Here is the same chart as above, with
some extra columns showing JPEG data too:

+------- 12 bit linear -------+ +----------- 8 bit JPEG ------------+
/ \/ \
| No. Levels | Normalized Pixel | 8 bit | No. Levels |
Fstop | 12 bit | value | Gam.Cor. | 8 Bit JPEG |
Range | Linear | Linear * Gam.Cor. | Value | Gamma Corr |
------|------------|-------------*--------------|----------|------------|
1 | 2048 | 1.0 * 1.0 | 255 | 69 |
2 | 1024 | 0.5 * 0.72974 | 186 | 50 |
3 | 512 | 0.25 * 0.53252 | 136 | 37 |
4 | 256 | 0.125 * 0.38860 | 99 | 27 |
5 | 128 | 0.0625 * 0.28358 | 72 | 20 |
6 | 64 | 0.03125 * 0.20694 | 53 | 14 |
7 | 32 | 0.015625 * 0.15101 | 38 | 10 |
8 | 16 | 0.007812 * 0.11020 | 28 | 8 |
9 | 8 | 0.003906 * 0.08042 | 21 | 6 |
10 | 4 | 0.001953 * 0.05868 | 15 | 4 |
11 | 2 | 0.0009765 * 0.04282 | 11 | 3 |
12 | 1 | 0.0004883 * 0.03125 | 8 | 2 |
13 | | 0.0002415 * 0.02269 | 6 | 2 |
14 | | 0.0001207 * 0.01656 | 4 | 1 |
15 | | 0.0000604 * 0.01208 | 3 | 1 |
16 | | 0.0000302 * 0.00882 | 2 | 0 |
17 | | 0.0000151 * 0.06434 | 2 | 1 |
18 | | 0.0000075 * 0.00470 | 1 | 1 |
19 | | 0.0000038 * 0.00343 | 1 | 0 |

Some want to claim that the above means that 8 bit gamma
corrected JPEG data can represent a dynamic range of 19 f/stops!
Technically that appears to be true, but obviously none of the
f/stops below the 8th one are of any usefulness, since those all
have fewer than 8 values per fstop.

For all practical purposes, the lowest 15 values in a 12 bit
linear file are of no significance and the lowest 21 values in a
JPEG file are equally useless. A 12-bit linear file can retain
a 9 f/stop dynamic range. A JPEG gamma correctd file can retain
8 f/stops of dynamic range.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>

Guest
Posts: n/a

 09-24-2006
David J Taylor wrote:

> Tony,
> If you have a linear ADC, the spot with digital value 255 is 255 times
> brighter than the spot with digital value 1. As a stop is a factor of 2
> in light-level, an 8-bit linear representation will have a maximum range
> of 8 stops (255 to 128, to 64, to 32, to 16, to 8, to 4, to 2, to 1), but
> at the lowest recordable brightness level, the digital value is either on
> or off, i.e. there is no "tonal range" at 8 stops down from the maximum
> brightness. In a typical camera, a 12-bit linear convertor is used, which
> provides a 12-stop range (if you accept zero tonal range at the lowest
> brightness level).
> [I am ignoring non-linearity, dark current, readout noise etc.]
> Once you start encoding the data - either for a RAW file or for JPEG, you
> can do various tricks to represent 12-bit linear data with fewer bits, by
> some sort of algorithm chosen so that the eye cannot see the brightness
> errors which result from using the algorithm.

Ah, so the maximum contrast ratio that a 8 bit encoded image can hold
is 256:1 or 8 stops. If the sources ratio is higher tonal values are
cut and I loose shadow details?!

David J Taylor
Guest
Posts: n/a

 09-24-2006
(E-Mail Removed) wrote:
[]
> Ah, so the maximum contrast ratio that a 8 bit encoded image can hold
> is 256:1 or 8 stops. If the sources ratio is higher tonal values are
> cut and I loose shadow details?!
>

Yes, if the encoding is linear.

If (as in all camera JPEGs) the encoding is not linear (typically it is
gamma corrected) the dynamic range (or number of f/stops) would be
greater.

David

prep@prep.synonet.com
Guest
Posts: n/a

 09-24-2006
"Johannes" <(E-Mail Removed)> writes:

> David J Taylor schrieb:

>> You might find these articles and their references interesting reading:
>> http://www.clarkvision.com/imagedeta...nge/index.html
>> http://www.clarkvision.com/imagedeta...gnal.to.noise/

> Thanks for the reference but my english is not good enough for this
> kind of technical matter. My question is, to be more precise, if I
> loose dynamic range when the information containing, say, 12 stops
> of range is digitized by a converter that uses only 8 bit.

You have two factors, the max and min of the range, and the number
of levels between them.

If you had a 1 bit converter, it is on or off. It does not tell you
the range from off to on, it could be a dim night light, or a 500KW
arc lamp. But for both only one step.

A 2 bit unit has 4 levels, but again it does not tell you the total
range from 0 to 2^N.

Your 12 stops with an 8 bit AD need not lose range at all but the step
per data number will be bigger than say a 12 bit converter if the 12
bit unit has the same max and min range.

--
Paul Repacholi 1 Crescent Rd.,
+61 (0 9257-1001 Kalamunda.
West Australia 6076
comp.os.vms,- The Older, Grumpier Slashdot
Raw, Cooked or Well-done, it's all half baked.
EPIC, The Architecture of the future, always has been, always will be.