@@ -1787,7 +1787,7 @@ again:
s->photometric = TIFF_PHOTOMETRIC_NONE;
s->compr = TIFF_RAW;
s->fill_order = 0;
- s->white_level = 0;
+ s->white_level = (1 << s->bpp) - 1; /* Default value as per the spec */
s->is_bayer = 0;
s->is_tiled = 0;
s->is_jpeg = 0;
@@ -2044,7 +2044,7 @@ again:
FFSWAP(int, p->linesize[0], p->linesize[1]);
}
- if (s->is_bayer && s->white_level && s->bpp == 16 &&
+ if (s->is_bayer && (s->white_level != (1 << s->bpp) - 1) && s->bpp == 16 &&
!(s->tiff_type == TIFF_TYPE_DNG || s->tiff_type == TIFF_TYPE_CINEMADNG)) {
uint16_t *dst = (uint16_t *)p->data[0];
for (i = 0; i < s->height; i++) {