Gavjenks
TPF Noob!
- Joined
- May 9, 2013
- Messages
- 2,976
- Reaction score
- 588
- Location
- Iowa City, IA
- Can others edit my Photos
- Photos OK to edit
So RAWs are at 12-14 bits or so. Jpegs are at 8.
The difference ends up being a difference of a factor of 16 or 64, respectively, in the number of different steps you can have along color or luminosity values. This gives you extra latitude in editing, because you can pick and choose which areas you want to sample more densely (like almost blown out highlights) and which to sample less densely in going from RAW to the final version you send to print or post on the internet, etc. In other words, more dynamic range to choose from (even though you end up with the same dynamic range).
However, RAWs take up way more space and take longer to process, etc. Why not have a format that compromises between the two? Why are camera companies ONLY offering you either a completely unedited format (aimed at people who want high image technical quality), OR an inflexibly edited version (aimed at people who want to use images SOOC)? Surely some people want something in between (I am one).
There's no reason why they couldn't also offer a format that flexes as needed, preserving PORTIONS of the dynamic range of RAW only where they are needed based on the resulting histogram from an image. Giving you the size and speed of a jpeg, but not sacrificing any of the precious data where you need it. Only where you DONT need it.
It could go something like this:
1) The camera calculates a luminance histogram from the RAW itself, or at least the closest rectangular grid approximation. (all these steps would work equally well for color. I'm just using luminance as an example). Simple arithmetic.
2) The camera superimposes the shape of the histogram so that its average value falls on the dotted line on the graph shown below. Also simple arithmetic.
3) The camera adjusts the shape of the histogram to account for the fact that you can't go higher than 12 bits (this involves clipping the parts above 12, and then pulling up the average value of every other point on the curve so that the average is once again right on the dotted line. Also simple arithmetic.).
4) Okay so now the camera is going to save it in an 8 bit format. Which means 256 lightness values. BUT, critically, each of those 256 values does not have to cover an equal portion of the dynamic range that RAW provides. They can cover VARIABLE portions of the dynamic range. As in, value 125 might cover a range of 50 different lightness values from RAW, whereas value 126 might only cover 35 values from RAW, etc. So we need to determine how big each bin is. How? Well, we already did. That's what that red line does for us.
5) The height of the red line at each point corresponds to what portion of RAWs dynamic range that value covers. Let's say that your camera has RAWs with 12 bits. If so, then if the red line is on the dotted line, then that value (for instance, approximately value 30 in the example above?) will average across 16 lightness values in the RAW (12 bit - 8 bit = 2^4 = 16). If the red line is at maximum (12 bits), then one value in the file will correspond to one value in the RAW (NO loss of data). If it is at 4 bits, then one value will correspond to 256 values of lightness in the RAW (12 - 4 = 2^8 = 256).
6) Save the data along with a "key" that tells you what the value of the red line was at each point (this only adds a couple of kilobytes or whatever to your image)
7) The highlights and very darkest shadows could, by default, be biased to have a bit denser sampling.
When you're done, the overall file size will equal the size of a normal 8 bit jpeg, but it will be nonlinearly sampled, to best suit your image. So in this example, the highlight will be at maximum density sampling with the RAW, meaning you will have almost just as good of an ability to recover highlights or do any other editing as if you had shot RAW. but in a jpeg sized file.
There are no decisions to be made in the field, because the density of data will auto-scale to where it's needed. Any large smooth areas that need to have smooth gradients will be densely.
When you load it into a computer, the computer can then use the key to decode it back to a normal grid with almost the same RELEVANT data density as the original RAW did.
A toy example:
The bars on top are a histogram. Imagine that the top row of boxes are a "RAW" file in an imaginary system where the data is 3x as dense in RAW as in the imaginary jpeg-style format. Each box = one value of lightness. This is how it samples currently, more or less. Each lightness value corresponds to an equal number of values in the other format. This is true regardless of the density of the pixels. Notice that the first of the compressed boxes doesn't correspond to even one pixel! Yet it is still using up some of our data bandwidth. At the same time, alll of the actual pixels in the image are being crammed into one single lightness value, and all that data is getting pointlessly thrown away. Wasteful.
In the proposed system, it would map like this:
The first box covers the whole empty area, and then the second two boxes are devoted to storing the majority of the data that is actually in the photo at a higher than otherwise resolution. The very top lightness value is actually equally as dense as the RAW data, where density and precision are most relevant to this particular photo.
Thoughts?
P.S.: two other random details:
1) You could select in camera menu how much you wanted to compress (doesn't have to be 8 bits. If we are gonna make our own new format anyway, might as well let people select how much compression they want).
2) In reality, the red line above would only go in steps of 1 bit at a time, for technical computer reasons.
The difference ends up being a difference of a factor of 16 or 64, respectively, in the number of different steps you can have along color or luminosity values. This gives you extra latitude in editing, because you can pick and choose which areas you want to sample more densely (like almost blown out highlights) and which to sample less densely in going from RAW to the final version you send to print or post on the internet, etc. In other words, more dynamic range to choose from (even though you end up with the same dynamic range).
However, RAWs take up way more space and take longer to process, etc. Why not have a format that compromises between the two? Why are camera companies ONLY offering you either a completely unedited format (aimed at people who want high image technical quality), OR an inflexibly edited version (aimed at people who want to use images SOOC)? Surely some people want something in between (I am one).
There's no reason why they couldn't also offer a format that flexes as needed, preserving PORTIONS of the dynamic range of RAW only where they are needed based on the resulting histogram from an image. Giving you the size and speed of a jpeg, but not sacrificing any of the precious data where you need it. Only where you DONT need it.
It could go something like this:
1) The camera calculates a luminance histogram from the RAW itself, or at least the closest rectangular grid approximation. (all these steps would work equally well for color. I'm just using luminance as an example). Simple arithmetic.
2) The camera superimposes the shape of the histogram so that its average value falls on the dotted line on the graph shown below. Also simple arithmetic.
3) The camera adjusts the shape of the histogram to account for the fact that you can't go higher than 12 bits (this involves clipping the parts above 12, and then pulling up the average value of every other point on the curve so that the average is once again right on the dotted line. Also simple arithmetic.).
4) Okay so now the camera is going to save it in an 8 bit format. Which means 256 lightness values. BUT, critically, each of those 256 values does not have to cover an equal portion of the dynamic range that RAW provides. They can cover VARIABLE portions of the dynamic range. As in, value 125 might cover a range of 50 different lightness values from RAW, whereas value 126 might only cover 35 values from RAW, etc. So we need to determine how big each bin is. How? Well, we already did. That's what that red line does for us.
5) The height of the red line at each point corresponds to what portion of RAWs dynamic range that value covers. Let's say that your camera has RAWs with 12 bits. If so, then if the red line is on the dotted line, then that value (for instance, approximately value 30 in the example above?) will average across 16 lightness values in the RAW (12 bit - 8 bit = 2^4 = 16). If the red line is at maximum (12 bits), then one value in the file will correspond to one value in the RAW (NO loss of data). If it is at 4 bits, then one value will correspond to 256 values of lightness in the RAW (12 - 4 = 2^8 = 256).
6) Save the data along with a "key" that tells you what the value of the red line was at each point (this only adds a couple of kilobytes or whatever to your image)
7) The highlights and very darkest shadows could, by default, be biased to have a bit denser sampling.
When you're done, the overall file size will equal the size of a normal 8 bit jpeg, but it will be nonlinearly sampled, to best suit your image. So in this example, the highlight will be at maximum density sampling with the RAW, meaning you will have almost just as good of an ability to recover highlights or do any other editing as if you had shot RAW. but in a jpeg sized file.
There are no decisions to be made in the field, because the density of data will auto-scale to where it's needed. Any large smooth areas that need to have smooth gradients will be densely.
When you load it into a computer, the computer can then use the key to decode it back to a normal grid with almost the same RELEVANT data density as the original RAW did.
A toy example:
The bars on top are a histogram. Imagine that the top row of boxes are a "RAW" file in an imaginary system where the data is 3x as dense in RAW as in the imaginary jpeg-style format. Each box = one value of lightness. This is how it samples currently, more or less. Each lightness value corresponds to an equal number of values in the other format. This is true regardless of the density of the pixels. Notice that the first of the compressed boxes doesn't correspond to even one pixel! Yet it is still using up some of our data bandwidth. At the same time, alll of the actual pixels in the image are being crammed into one single lightness value, and all that data is getting pointlessly thrown away. Wasteful.
In the proposed system, it would map like this:
The first box covers the whole empty area, and then the second two boxes are devoted to storing the majority of the data that is actually in the photo at a higher than otherwise resolution. The very top lightness value is actually equally as dense as the RAW data, where density and precision are most relevant to this particular photo.
Thoughts?
P.S.: two other random details:
1) You could select in camera menu how much you wanted to compress (doesn't have to be 8 bits. If we are gonna make our own new format anyway, might as well let people select how much compression they want).
2) In reality, the red line above would only go in steps of 1 bit at a time, for technical computer reasons.
Last edited: