process_pipeline: Store a default whitelevel in the DNG file

This helps unpacked 10-bit formats, as otherwise applications
assume the image to be 16-bit because of TIFFTAG_BITSPERSAMPLE.
This commit is contained in:
Sebastian Krzyszkowiak
2021-06-19 19:42:32 +02:00
parent 05d6c3fa6d
commit c03fade3cd
3 changed files with 27 additions and 2 deletions

View File

@@ -427,9 +427,11 @@ process_image_for_capture(const uint8_t *image, int count)
TIFFSetField(tif, TIFFTAG_CFAPATTERN, 4, "\002\001\001\000"); // BGGR
#endif
printf("TIFF version %d\n", TIFFLIB_VERSION);
if (camera->whitelevel) {
TIFFSetField(tif, TIFFTAG_WHITELEVEL, 1, &camera->whitelevel);
int whitelevel = camera->whitelevel;
if (!whitelevel) {
whitelevel = (1 << mp_pixel_format_pixel_depth(mode.pixel_format)) - 1;
}
TIFFSetField(tif, TIFFTAG_WHITELEVEL, 1, &whitelevel);
if (camera->blacklevel) {
const float blacklevel = camera->blacklevel;
TIFFSetField(tif, TIFFTAG_BLACKLEVEL, 1, &blacklevel);