data_maximum > maximum on some files

On some files libraw_colordata_t::data_maximum is larger than libraw_colordata_t::maximum. Is this considered a bug or a normal situation? Doc says that maximum is a theoretical maximum value for a camera.


This is possible and normal

This is possible and normal for some formats. For example, for DNG files color.maximum is read from corresponding tag, that may contain anything.

BTW, could you provide sample file for analysis?

-- Alex Tutubalin @LibRaw LLC

The best way it to share it

The best way it to share it somewhere (Dropbox, google) and send me link.
Or just send via E-mail

my personal e-mail is

-- Alex Tutubalin @LibRaw LLC

Got the file, thanks.

Got the file, thanks.

This is very special case:
color.maximum is calculated from metadata for these files, this is just 0xfffc - black_level

And after LibRaw::unpack() real data maximum is within this range.

But on postprocessing stage, PhaseOne data are linearized using other metadata contained in file (complex process in phase_one_flat_field() call).

After that stage, real (linearized) data values may have values above color.maximum

-- Alex Tutubalin @LibRaw LLC