Samsung S22 DNG files

I find it interesting that my phone produces a DNG file that has already been debayered and probably denoised from the looks of it. Also seems to be underexposed by 5 stops even though the OOC jpeg is fine.

I wonder if any AI algorithms were used to create this raw file even though it is supposed to be “raw”

20240309_184257.dng (25.9 MB)

This file is licensed Creative Commons, By-Attribution, Share-Alike.


It’s a very interesting DNG file for sure.
I can see denoising, sharpening, and it’s really strongly under-exposed (as you said, 5 stops).

It seems that it’s just a TIFF with a DNG wrapper.

Darktable doesn’t seem to open the file but Saulala did. Not much to do when it’s -5 stops though.

Have you tried any other camera apps and checked whether the same process is applied?

That’s weird, darktable and RT are able to open the file for me with no issues. I haven’t tried any other apps, this is the stock “Expert RAW” app provided by samsung.

Time to update my software, I guess!

Yes, Samsung DNGs require dt 4.6.1

1 Like

Most likely it’s not AI, just enhanced stacking such as an implementation of Google’s MFSR, which is part of Night Sight:

If you read the info on Google’s full Night Sight pipeline (don’t have a link at the moment), you’ll see that the only roles a neural network plays in Night Sight are:

  • High speed live preview of the local tonemapping
  • Enhanced automatic white balance

Of course this IS Samsung we’re talking about, with a long history of taking things too far in the name of marketing gimmicks, such as implementing Super AMOLED without any color management (marketing: OMG SATURATION! LOOK AT THE VIVID COLORS!, reality: Garish oversaturated colors from throwing sRGB content at a far wider gamut display with no colorspace conversions).

But seeing a demosaiced result from any modern phone is expected - it’s impossible to achieve decent image quality without multiframe stacking, and limiting yourself to same-color pixel shifts severely limits how well the stacking can do. Subpixel-capable stacking requires that the stacking algorithm inherently also demosaic the image.

Nowadays demosaicing algorithms in hardware are usually good enough that the benefits of RAW are more from higher bit depths and storing information in camera-native color space (no color conversion).

Reducing exposure is also standard practice here - preserve the highlights, use stacking to improve shadow noise so that the shadows can be pulled with local tonemapping.

1 Like

Have you tried adjusting black and white point ?

The starting point is to apply the gain map…DT will do it automatically but if using Art or RT you have to do it by activating the metadata in the flat field correction. This changes the lighting substantially

EDIT… not working it seems for these DNG…

20240309_184257_1.dng.xmp (12.9 KB)

20240309_184257_1.dng (23.6 MB)

I converted the file with DNG converter.

1 Like

It looks like the way they are handled skips the gain maps … is that by design or because the samsung op codes are non standard???

20240309_184257.jpg.out.arp (11.8 KB)

Tried an ART edit just for fun this time…

1 Like

The GainMap in this file is a no-op so it’s ignored. (The size is 1x1)

1 Like

20240309_184257.dng.xmp (19.6 KB)
Here is my attempt. This seems really to be a case of when is a raw file not a raw file. The look of this image in the lighttable is so different to the darkroom view in DT. I own a Pentax that allows saving as a DNG or PEF file. I always choose PEF because I know it is the RAW file. DNG files seem to a Frankenstein file and I never know how much it has been adulterated.

1 Like

I’ve never seen a difference between PEF and DNG.

As I stated in my previous comment on the subject, phone files are ALWAYS heavily processed, with at two things coming into play:

  • They are ALWAYS stacks of multiple exposures. Without stacking, the image quality from such a tiny sensor would be garbage. All modern stacking algorithms rely on subpixel shifts, so cannot operate without also demosaicing
  • They also almost universally involve local tonemapping for the JPEG

It’s not your DNG that is heavily processed (except for, again, multiframe stacking algorithms), it’s the JPEG (including the embedded preview in the DNG) that is heavily processed from a RAW image that has been exposed to protect the highlights.

Your assertion that the image in the lighttable is so different from the RAW is not because the RAW is cooked, but because the JPEG has been processed by advanced local tonemapping techniques that are missing/broken in darktable. (The JPEG has been processed using something similar to compressing dynamic range with exposure fusion | darktable - but darktable’s exposure fusion implementation is unfortunately rather broken and attempts to fix it were killed by AP with enthusiastic support from the rest of the development team. The person who wrote that article no longer contributes to DT - if you want his stuff, go for vkdt instead.)

1 Like

Thanks for the insight Andy. For me the advantage of pef is that it must be the raw file as shot. Dng may be an export from another program or may be as shot.

Yeah - in the case of Pentax cameras, it’s definitely as shot though. You can usually tell from the EXIF if it’s been mangled. Although now that I think about it, i really should have pystack put something in the metadata to make it more obvious than “cameras never output float16” that it was processed through a stacker.

Thank you for de play.

Edit with ART, chaiNNer (SCUNet), GIMP and G’MIC:

1 Like

My version…

20240309_184257.dng.xmp (16.7 KB)