Pages: [1] 2   Go Down

Author Topic: While We're on the Subject of DNGs . . .  (Read 2139 times)

Chris Kern

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1288
    • Chris Kern's Eponymous Website
While We're on the Subject of DNGs . . .
« on: October 19, 2018, 01:05:04 pm »

. . . can someone please explain to me why it is possible to perform transformations such as adjusting white balance to a linear DNG (e.g., created with Lightroom's Pano Merge feature) that normally can only be applied to raw RGB data?

Yes, I know that a linear DNG is "scene-referred" rather than "output-referred," and I know that must be correct because I've read explanations to that effect by experts like Eric Chan, but I don't understand what it means.  Doesn't demosaicing a file inherently involve decisions about attributes such as white balance?  What magic is available in a linear DNG that isn't, for example, available in the TIFF format?

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #1 on: October 19, 2018, 01:45:03 pm »

From the (defunct) web page of Barry Pearson on DNG, specifically Linear DNG:



What is Linear DNG?
DNG has two varieties that deserve different names on this page:
* "Raw DNG": The familiar variety of DNG, containing the raw image data plus added-value metadata. Almost all of the products that support DNG support at least this variety. (There are exceptions). This variety of DNG will gradually become the de facto standard raw file format.
* "Linear DNG": A rarer variety of DNG, containing RGB image data (or not just RGB!) arranged in a rectilinear format. (Most practical examples of Linear DNG hold RGB image data, but it isn't a constraint, and 4 or more colours are allowed). This RGB image data may have come from demosaiced raw image data, or from another source such as TIFF or JPEG or something else. (There is little difference between "demosaiced" and "never mosaiced").
Most other pages on this site focus on Raw DNG. This page focuses on Linear DNG. This variety of DNG may become an alternative to TIFF in a new set of digital image processors.

Benefits of Linear DNG
Support for unusual sensor configurations
Whether or not a raw converter can handle the raw image data from a particular camera depends partly on whether that raw converter can handle the sensor configuration concerned. It is easier for a raw converter designed to handle Bayer sensors to handle raw files from another Bayer sensor camera than from a camera that doesn't use a Bayer sensor. (This is not a flaw in DNG - it is simply a comment on the relative difficulties of handling different sensor configurations).
* Some raw converters only handle Raw DNG files from camera whose raw file formats they support anyway.
* Some raw converters can handle Raw DNG files from cameras whose native raw file formats they don't support, but only where they support the sensor configuration concerned, for example Bayer sensor.
* But - some raw converters support Linear DNGs from cameras that have sensor configurations that they don't support either via the native raw formats or the Raw DNGs. (Eg. Silkypix).

When ACR handles a Linear DNG file, all of the tabs, sliders, and drop-down boxes still work, and do the sort of things expected of them. It is a digital image processor without any demosaicing to do, yet it is still useful. It can be used to set the white balance, correct for chromatic abberation, reduce noise, sharpen, apply a curve, etc. And that is true even if the "true" raw conversion was done before it was invoked, or was never needed because the image data didn't come from a digital camera, but perhaps started as a TIFF or a JPEG from some other source!

Pano (and HDR) converts a raw image to Linear DNG (still sort of, kind of raw) and then does the DNG/Pano blend. So the image in HDR is 16-bit floating point but the processing is done in 32-bit floating point. The Pano blend is 16-bit Linear DNG.
Logged
Andrew Rodney
Author “Color Management for Photographers"

jrsforums

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1157
Re: While We're on the Subject of DNGs . . .
« Reply #2 on: October 19, 2018, 02:26:48 pm »

From the (defunct) web page of Barry Pearson on DNG, specifically Linear DNG:



What is Linear DNG?
DNG has two varieties that deserve different names on this page:
* "Raw DNG": The familiar variety of DNG, containing the raw image data plus added-value metadata. Almost all of the products that support DNG support at least this variety. (There are exceptions). This variety of DNG will gradually become the de facto standard raw file format.
* "Linear DNG": A rarer variety of DNG, containing RGB image data (or not just RGB!) arranged in a rectilinear format. (Most practical examples of Linear DNG hold RGB image data, but it isn't a constraint, and 4 or more colours are allowed). This RGB image data may have come from demosaiced raw image data, or from another source such as TIFF or JPEG or something else. (There is little difference between "demosaiced" and "never mosaiced").
Most other pages on this site focus on Raw DNG. This page focuses on Linear DNG. This variety of DNG may become an alternative to TIFF in a new set of digital image processors.

Benefits of Linear DNG
Support for unusual sensor configurations
Whether or not a raw converter can handle the raw image data from a particular camera depends partly on whether that raw converter can handle the sensor configuration concerned. It is easier for a raw converter designed to handle Bayer sensors to handle raw files from another Bayer sensor camera than from a camera that doesn't use a Bayer sensor. (This is not a flaw in DNG - it is simply a comment on the relative difficulties of handling different sensor configurations).
* Some raw converters only handle Raw DNG files from camera whose raw file formats they support anyway.
* Some raw converters can handle Raw DNG files from cameras whose native raw file formats they don't support, but only where they support the sensor configuration concerned, for example Bayer sensor.
* But - some raw converters support Linear DNGs from cameras that have sensor configurations that they don't support either via the native raw formats or the Raw DNGs. (Eg. Silkypix).

When ACR handles a Linear DNG file, all of the tabs, sliders, and drop-down boxes still work, and do the sort of things expected of them. It is a digital image processor without any demosaicing to do, yet it is still useful. It can be used to set the white balance, correct for chromatic abberation, reduce noise, sharpen, apply a curve, etc. And that is true even if the "true" raw conversion was done before it was invoked, or was never needed because the image data didn't come from a digital camera, but perhaps started as a TIFF or a JPEG from some other source!

Pano (and HDR) converts a raw image to Linear DNG (still sort of, kind of raw) and then does the DNG/Pano blend. So the image in HDR is 16-bit floating point but the processing is done in 32-bit floating point. The Pano blend is 16-bit Linear DNG.

I do not believe that the above answered the question, “What magic is available in a linear DNG that isn't, for example, available in the TIFF format?”

As far as I know, TIFF and JPEG have “...all of the tabs, sliders, and drop-down boxes...”
Logged
John

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #3 on: October 19, 2018, 02:44:35 pm »

I do not believe that the above answered the question, “What magic is available in a linear DNG that isn't, for example, available in the TIFF format?”

As far as I know, TIFF and JPEG have “...all of the tabs, sliders, and drop-down boxes...”
TIFF and DNG are very close cousins. Both formats are owned and controlled by Adobe. AFAIK, there's nothing about TIFF that couldn’t contain the same linear partially processed data as the DNG.
HOW you'd produce this linear data and pop it into the TIFF would be the question or the need. So there's no magic.
Logged
Andrew Rodney
Author “Color Management for Photographers"

Chris Kern

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1288
    • Chris Kern's Eponymous Website
Re: While We're on the Subject of DNGs . . .
« Reply #4 on: October 19, 2018, 04:15:21 pm »

As far as I know, TIFF and JPEG have “...all of the tabs, sliders, and drop-down boxes...”

Yes, the Lightroom controls still work on TIFF and JPEG files, but at least some of them work quite differently than they do on linear DNGs.  Specifically, you can't properly adjust white balance and you can't apply a color profile.  (These are the most significant differences I've come across, and seem to be the result of the colors being "scene-referred" instead of "output-referred.")  Phil Harvey's Exiftool reports the DNG as having a photometric interpretation of "Linear Raw" and a TIFF created via a round-trip from Lightroom to Photoshop as having a photometric interpretation of "RGB"—the implication being that the DNG is still somewhat raw-like despite having been demosaiced while the TIFF has the colors "baked in."

AFAIK, there's nothing about TIFF that couldn’t contain the same linear partially processed data as the DNG.

That occurred to me, as well.  But if that's so, I don't understand why TIFFs aren't routinely processed this way.

Quote
HOW you'd produce this linear data and pop it into the TIFF would be the question or the need.

I have no clue regarding the how, but my response with respect to the need would be to allow the end-user to make the same sorts of color adjustments to a TIFF (e.g., white point, color profile) as are possible with a linear DNG.

Schewe

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 6229
    • http:www.schewephoto.com
Re: While We're on the Subject of DNGs . . .
« Reply #5 on: October 19, 2018, 04:32:50 pm »

I do not believe that the above answered the question, “What magic is available in a linear DNG that isn't, for example, available in the TIFF format?”

As far as I know, TIFF and JPEG have “...all of the tabs, sliders, and drop-down boxes...”

The significant difference between a TIFF or JPG that has a color space (sRGB for example) is that one gamma encoded, a linear file looses all the head room available in a linear file. That head room equates to the extended capability of white balance and highlight recovery.

The linear DNG has all of the raw processing benefits except for the demosiacing function. There may be some differences between a really raw DNG and a linear DNG as it relates to the inherent noise and sharpening done as part of the demosaicing as evidenced by the fact some 3rd party software can demoniac a raw file and save out a linear DNG with "better" (different) demosaicing for Fuji X-Trans sensors.


So while not a fully raw file, a linear DNG is what I call a "half-baked" raw file
(pun intended :~)


You still get the benefits of white balance and highlight recovery lost in a gamma encoded processed TIFF file but loose any special demosaicing special processing.
Logged

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #6 on: October 19, 2018, 04:36:20 pm »

Yes, the Lightroom controls still work on TIFF and JPEG files, but at least some of them work quite differently than they do on linear DNGs.  Specifically, you can't properly adjust white balance and you can't apply a color profile.  (These are the most significant differences I've come across, and seem to be the result of the colors being "scene-referred" instead of "output-referred.")  Phil Harvey's Exiftool reports the DNG as having a photometric interpretation of "Linear Raw" and a TIFF created via a round-trip from Lightroom to Photoshop as having a photometric interpretation of "RGB"—the implication being that the DNG is still somewhat raw-like despite having been demosaiced while the TIFF has the colors "baked in."

That occurred to me, as well.  But if that's so, I don't understand why TIFFs aren't routinely processed this way.

I have no clue regarding the how, but my response with respect to the need would be to allow the end-user to make the same sorts of color adjustments to a TIFF (e.g., white point, color profile) as are possible with a linear DNG.
Adobe and other's would need another and unnecessary command: convert to Linear TIFF. You've got a raw, you want a linear partially rendered package of data. Why not simply use the current DNG conversions to produce it and why add this to TIFF when it would make absolutely no difference? What next, partially rendered (partially raw) PSD? Pointless. Redundant. Confusing.
Logged
Andrew Rodney
Author “Color Management for Photographers"

Doug Gray

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2000
Re: While We're on the Subject of DNGs . . .
« Reply #7 on: October 19, 2018, 05:04:32 pm »

A few notes:

An image can be "scene referred" such as ProPhoto RGB or Adobe RGB. Linear and Gamma are unrelated to scene referred or output referred. You can even have a jpeg, sRGB scene referred image if it fits within sRGB's gamut.

Linear space should always use high bit encoding. You can use 8 bit encoding but it will produce serious banding in darker areas.

Once an image is output referred, you can't, as a practical matter, construct a scene referred image from it.
Logged

Aram Hăvărneanu

  • Full Member
  • ***
  • Offline Offline
  • Posts: 214
Re: While We're on the Subject of DNGs . . .
« Reply #8 on: October 19, 2018, 05:34:24 pm »

32-bit TIFFs are scene-referred in ACR and Photoshop.
Logged

Doug Gray

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2000
Re: While We're on the Subject of DNGs . . .
« Reply #9 on: October 19, 2018, 05:38:29 pm »

32-bit TIFFs are scene-referred in ACR and Photoshop.

No more than any other format. There is nothing in a TIFF, JPEG, PNG, GIF etc that indicates whether an image is scene referred or output referred.

You are confusing gamma=1 colorspaces with scene referred. The two are unrelated.
Logged

Aram Hăvărneanu

  • Full Member
  • ***
  • Offline Offline
  • Posts: 214
Re: While We're on the Subject of DNGs . . .
« Reply #10 on: October 19, 2018, 05:45:32 pm »

You are correct in asserting that there is nothing in a TIFF file that indicates whether an image is scene referred or output referred, however, ACR (and I believe Photoshop too) have two different code paths for processing scene-referred, respectively output-referred files, and 32 bit TIFF files are processed by the scene-referred path, just like raw files and unlike, say, 16 bit TIFFs.
Logged

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #11 on: October 19, 2018, 05:49:20 pm »

32-bit TIFFs are scene-referred in ACR and Photoshop.
They don’t have to be, and are not solely by virtue of being in ACR.
Logged
Andrew Rodney
Author “Color Management for Photographers"

Aram Hăvărneanu

  • Full Member
  • ***
  • Offline Offline
  • Posts: 214
Re: While We're on the Subject of DNGs . . .
« Reply #12 on: October 19, 2018, 05:51:09 pm »

No, they don't have to be, but for better of worse this is how ACR treats them, by using the scene-referred processing pipeline, not the output-referred one (as it does for 16 bit TIFFs and jpegs). Coincidentally, this is very useful for testing how ACR works by feeding it synthetic files (though generating a DNG instead of a 32 bit linear TIFF is not that much harder either).
Logged

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #13 on: October 19, 2018, 05:55:53 pm »

No, they don't have to be, but for better of worse this is how ACR treats them, by using the scene-referred processing pipeline, not the output-referred one (as it does for 16 bit TIFFs and jpegs). Coincidentally, this is very useful for testing how ACR works by feeding it synthetic files (though generating a DNG instead of a 32 bit linear TIFF is not that much harder either).
http://www.color.org/scene-referred.xalter#profiles
When using Adobe Camera Raw (ACR) in Photoshop CS3, the steps to create linear RIMM RGB scene-referred images are as follows:
Logged
Andrew Rodney
Author “Color Management for Photographers"

Aram Hăvărneanu

  • Full Member
  • ***
  • Offline Offline
  • Posts: 214
Re: While We're on the Subject of DNGs . . .
« Reply #14 on: October 19, 2018, 05:57:52 pm »

Not sure why you are providing this link, I generate synthetic images in code, not in Photoshop.
Logged

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #15 on: October 19, 2018, 05:59:25 pm »

Not sure why you are providing this link, I generate synthetic images in code, not in Photoshop.
To illustrates to YOU how to use ACR for scene referred! Again:
When using Adobe Camera Raw (ACR) in Photoshop CS3, the steps to create linear RIMM RGB scene-referred images are as follows:
The following (how to do so) is found by clicking on the link and reading what the ICC states!
Quote
No, they don't have to be, but for better of worse this is how ACR treats them.....
The ICC (color.org) states otherwise.
Edit: as does Chris Cox: https://forums.adobe.com/thread/595218
Logged
Andrew Rodney
Author “Color Management for Photographers"

Aram Hăvărneanu

  • Full Member
  • ***
  • Offline Offline
  • Posts: 214
Re: While We're on the Subject of DNGs . . .
« Reply #16 on: October 19, 2018, 06:10:16 pm »

You are missing the point here, surely it's my fault for not making it clearer, so I'll try to make it clear. The question was never how to generate an integer-encoded scene-referred file that is correctly parsed by ACR. I was merely pointing out that by default ACR considers floating point encoded files as scene referred (I misspoke when I said 32 bit TIFF, apparently it's related to floating point vs. integer encoding, not to bit depth): https://forum.luminous-landscape.com/index.php?topic=77413.msg621835#msg621835

ACR/Lightroom assume that integer TIFFs (the vast majority of TIFFs are written as integer TIFFs) are output-referred, and that floating-point TIFFs are scene-referred (e.g., HDR files).  The bit depth itself is not critical (ACR/LR will read 16-bit, 24-bit, and 32-bit floating-point formats for TIFF and DNG), but the data type itself (floating-point vs integer) matters to the default interpretation.

When I'll ever need to generate a scene-referred integer-encoded synthetic TIFF file, I'll remember your link.
« Last Edit: October 19, 2018, 06:20:58 pm by Aram Hăvărneanu »
Logged

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #17 on: October 19, 2018, 06:12:54 pm »

You are missing the point here, so I'll try to make it clear. The question was never how to generate an integer-encoded scene-referred file that is correctly parsed by ACR. I was merely pointing that by default ACR considers floating point encoded files as scene referred (I misspoke when I said 32 bit TIFF, apparently it's related to floating point vs. integer encoding, not to bit depth): https://forum.luminous-landscape.com/index.php?topic=77413.msg621835#msg621835

When I'll ever need to generate a scene-referred integer-encoded synthetic TIFF file, I'll remember your link.
You’re missing the point. What you wrote about a ACR (quoted below) is wrong.
Logged
Andrew Rodney
Author “Color Management for Photographers"

Aram Hăvărneanu

  • Full Member
  • ***
  • Offline Offline
  • Posts: 214
Re: While We're on the Subject of DNGs . . .
« Reply #18 on: October 19, 2018, 06:17:17 pm »

You have not quoted what I wrote about ACR. Are you disputing Eric Chan's explanation (an Adobe engineer) provided in the link I posted about how ACR treats integer vs. floating point encoded files?

Again, I misspoke when I said it's 32 bit vs 8/16 bit. I misremembered, it's integer vs float.
Logged

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 16270
    • http://www.digitaldog.net/
Re: While We're on the Subject of DNGs . . .
« Reply #19 on: October 19, 2018, 06:22:49 pm »

You have not quoted what I wrote about ACR. Are you disputing Eric Chan's explanation (an Adobe engineer) provided in the link I posted about how ACR treats integer vs. floating point encoded files?

Again, I misspoke when I said it's 32 bit vs 8/16 bit. I misremembered, it's integer vs float.
As Doug correctly points out, I think you’re confused between what scene referred is versus encoding. What you wrote I Again quoted from you about a ACR is incorrect. It can create scene referred imagery.
Logged
Andrew Rodney
Author “Color Management for Photographers"
Pages: [1] 2   Go Up