Adobe DNG Gainmap support or extraction

Hello,
Since this is my first message on the forum, I would like to thank you for the brilliant LibRaw library that has enabled a bunch of different great uses.

On of them is developing Adobe DNGs, produced by smartphones.

However, many, if not all phones, use something that is called a "GainMap", basically a per-channel lens correction, that gains the data based on the embedded 2D image. This helps tremendously with strong Vignetting and hue shifts produced by the tiny lenses in smartphones.

I would love to have a way to either 'enable' or 'disable' it, or, worst case, extract it somehow. Could this be considered?

Page 115 of the Adobe DNG spec:
https://helpx.adobe.com/content/dam/help/en/photoshop/pdf/DNG_Spec_1_7_1...

It comes up as Opcode List# in Exif info.

Thank you very much in advance.

Forums: 

Assuming you're talking about

Assuming you're talking about OpcodeList#, not ProfileGainTableMap (introduced in DNG 1.6).

If LibRaw is compiled with Adobe DNG SDK: it is possible to process via DNG Stage2/Stage3 by specifying corresponding rawoption bits:

Process Stage2/3 only if OpcodeList2/3 present: LIBRAW_RAWOPTIONS_DNG_STAGE2_IFPRESENT,LIBRAW_RAWOPTIONS_DNG_STAGE3_IFPRESENT

Forced Stage2/3 processing: LIBRAW_RAWOPTIONS_DNG_STAGE2 and
LIBRAW_RAWOPTIONS_DNG_STAGE3

If one want to extract specific DNG/TIFF/EXIF tags: use exifparser_handler to setup own callback function.

-- Alex Tutubalin @LibRaw LLC

Thank you very much for the

Thank you very much for the reply. Hopefully this is what I'm looking for.
All the best.

Separate user here. To

Separate user here. To clarify, if I’m interested in having the ProfileGainTableMap processed (so images don’t come out underexposed), would building with the DNG SDK and setting these flags accomplish this? I’m currently trying (and failing) to get a build for this, so it’d be helpful to know before I spend more time getting it to build.

DNG SDK Applies

DNG SDK Applies ProfileGainTableMap in dng_renderer (RAW to RGB conversion), not in stage3 opcodes.

-- Alex Tutubalin @LibRaw LLC