Lee Jay said:
You're very lost.
If you cram 18 stops into 6 stops, you do it by reducing contrast. Stretching the resulting 6-stop file doesn't change it back to an 18 stop file, it's still just 6 stops with the tones pushed toward the edges.
There are two extremes.
You can keep all 18 stops by cramming them into a 6 stop file. This costs you contrast. The darkest tones in the file are no more than 6 stops darker than the brightest tones. If all 18 stops are in their, you've lost 12 stops of contrast no matter how you distribute those tones.
The other extreme is to crop the histogram. Here, you choose 6 stops of the original scene and keep only those, discarding the rest. This preserves original scene contrast, but costs you all those darks and lights you drove to saturation.
There are no other choices except all those between those two. You cannot preserve both the DR and the contrast, by definition.
Well, I beg to differ. I'll demonstrate.
BTW, I never said you could "restore dynamic range." I also never said "preserve contrast", which I take to mean preserve the
original contrast of the image. I said you could "restore contrast." I try to very carefully choose my words on this site, and when I say restore contrast, I mean exactly that, restore contrast. Not the original contrast of the image, I simply mean "restore some contrast to the image", the image you have sitting in front of you on the screen, so that it isn't simply some dull, lifeless, bland image.
Now for the benefit of everyone, this is what I am talking about, and how I see the value of dynamic range. I don't have any image with 18 stops worth of data, but I do have images with at least 14 stops of data. Sony A7r, image purposely exposed to clip the highlights a bit to ensure I was using maximum DR. (NOTE: Because the image was intentionally overexposed a little, I cannot fully recover highlights...this technique works much better when your highlights are not clipped, obviously.)
Original
Recovered
Contrast Restored
Recovery was done with LR in Basic panel:
Exposure +4
Blacks +100
Whites -100
Highlights -100
Shadows +50
Contrast restoration was done in LR in Tone Curve panel:
Highlights +20
Lights +10
Darks -30
Shadows 0
Dynamic range is the space within which the information resides. It's really a hardware thing, the ratio between the signal clipping point and the read noise floor. I think it is an oft misused term, and I honestly don't think there is any really meaningful way to apply "dynamic range" to a "file", or to the signal in the file. The signal itself doesn't have dynamic range...it has a signal-to-noise ratio, though...but that is not the same as dynamic range.
In the three images above, the loss in contrast is fairly obvious in the second image. That is a very heavy recovery, and unrealistically deep shadows in the original image (my living room was not even close to that dark when I took the photo) were lifted about a total of 6 stops. I did some quick testing, and a +100 blacks has about the same impact on the shadows as a +1 stop exposure adjustment in Lightroom. A +100 shadows has about the same impact on the shadows as a +2 stop exposure adjustment. So my +100 blacks and +50 shadows is about another two stop push for the shadows, on top of the +4 stop exposure shift. Similarly -100 whites is similar to a -2 stop exposure shift. Highlights is a different beast...at base exposure, -100 seems to behave like a -7 stop exposure shift, however after recovering exposure by +4, it seems to have a more muted impact of maybe a couple of stops. All told, I would say I compressed the original 14 stops worth of signal into the space of maybe 6-7 stops.
The restoration of contrast works on the post-recovery tonal distribution. I moved the tones around rather significantly, however I was still able to restore contrast. If dynamic range and contrast were the same thing, and recovering data only to restore contrast simply undid the recovery, then restoration of more contrast to the post-recovery image wouldn't be possible. However, as image three shows, it clearly is possible.
For everyone out there who thinks that more dynamic range means that you will always have dull, low-contrast processed photos and there is nothing you can do about that, well...your wrong.

Dynamic range is a camera trait, it's the space within which the tones of your photographs are distributed at a signal level. More dynamic range means less electronic noise, and that means more data deeper into the black depths of the signal can be recovered. Recovery is only the first step, though. You don't have to stop there. If you want your final processed photos to be more contrasty...
then make them more contrasty! You can also make them more saturated. You can do whatever you want to them after you have recovered the data buried deep in the "shadows" of the signal...because recovery is only the first step. Your own personal style, your artistic processing, starts AFTER recovery.
BTW, to stress the point about how the scene really looked to my eyes, vs. how it looked in the strait-out-of-camera RAW file. The real-world scene looked quite different than the original image above. The "shadows" of the original image above are unnaturally, unrealistically dark. We use the term shadows in an overloaded context a lot of the time, and that clearly leads to confusion for many photographers. I'm to blame for that, I apologize. But I think I have an opportunity to at least clear up my usage of the term in certain contexts.
If all I had presented you with was just that original image and no others, you might think that's actually what the room looked like at the time it was photographed. That is most assuredly not what my living room looked like when I took that photo. This is much closer to what it really looked like:
When I talk about "shadows" in a digital signal, I am talking about the part of the signal that looks very dark: blacks and the tones close to black. Not the midtones. I am also not talking about real-world shadows. As you can see from the above image, the real-world distribution of light and shadow in my living room at the time this photo was taken is quite different from the original untouched, "strait out of camera" version I posted farther up in this post.
There are shadows, and there are "shadows." The "shadows" in a photographic signal in a RAW file may not be the same as the shadows your scene may have actually had in the real world. When I talk about "shadows" in the context of dynamic range on these forums, I am usually talking about the tones in the signal that are very dark, the tones below the broad range of midtones between the blacks and shadows and the highlights and whites. To put it into terms that may be more familiar, when I talk about the "shadows" of a RAW image, I am referring to the range of tones most affected by the blacks and shadows sliders in Lightroom.
The amount of tones that fall into the "shadows" may be the majority of the tones in the photograph, and that may include real-world shadows, as well as real-world midtones and maybe even real-world highlights. Signal shadows are not the same as real-world shadows. Similarly, signal highlights are not the same as real-world highlights, etc. There is what the scene actually looked like at the time it was taken, and what the scene looks like when it comes strait out of camera. It's possible the two may be very similar, it is also possible for the two to be very different...depends on the scene.
When I talk about recovery, I mean restoring the potentially unnatural distribution of tones in the RAW to such a distribution that the image once again begins to look like the real-world scene did at the time the photograph was taken.