dcraw: use the right black levels for linear DNGs (#6444)

Linear dng (like the one created by Adobe DNG Converter) contains
multiple tiff subifd with different kind of images (the Primary Image
and multiple previews), these defines different kind of black levels.

Currently dcraw has a global cblack array that is overwritten by the
last parsed tiff ifd. With such kind of linear dng it's the last subifd.
The causes the use of the wrong black levels with the image having
usually a magenta color cast.

The dng spec uses the NewSubFileType tag to define the primary image
with tag value as 0.
This patch reads also the NewSubFileType tag and populates the cblack
array provided by the other tags only if it's the primary image.
This commit is contained in:
Simone Gotti
2022-03-26 11:28:05 +01:00
committed by GitHub
parent 5502f52f90
commit bd118a4a40
2 changed files with 7 additions and 1 deletions

View File

@@ -209,7 +209,7 @@ protected:
} first_decode[2048], *second_decode, *free_decode;
struct tiff_ifd {
int width, height, bps, comp, phint, offset, flip, samples, bytes;
int new_sub_file_type, width, height, bps, comp, phint, offset, flip, samples, bytes;
int tile_width, tile_length, sample_format, predictor;
float shutter;
} tiff_ifd[10];