aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-09-23 17:30:55 +0200
committerPaul B Mahol <onemda@gmail.com>2022-09-23 20:28:31 +0200
commitec8be8a913d64af210afee27cbedfafcbcbd05c9 (patch)
tree2e7a913965ac8c93928e5560dca96f050e523fff /libavcodec/tiff.c
parent6c233910640e0616db2f2ed0b39a6c20f6208add (diff)
downloadffmpeg-ec8be8a913d64af210afee27cbedfafcbcbd05c9.tar.gz
avcodec/tiff: improve lut handling for DNG
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 226050744f..4da77a3a31 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -283,16 +283,15 @@ static uint16_t av_always_inline dng_process_color16(uint16_t value,
float value_norm;
// Lookup table lookup
- if (lut)
- value = lut[value];
+ value = lut[value];
// Black level subtraction
value = av_clip_uint16_c((unsigned)value - black_level);
// Color scaling
- value_norm = (float)value * scale_factor;
+ value_norm = (float)value * scale_factor * 65535.f;
- value = av_clip_uint16_c(value_norm * 65535);
+ value = av_clip_uint16_c(lrintf(value_norm));
return value;
}
@@ -1414,6 +1413,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
else if (count > 1)
s->sub_ifd = ff_tget(&s->gb, TIFF_LONG, s->le); /** Only get the first SubIFD */
break;
+ case TIFF_GRAY_RESPONSE_CURVE:
case DNG_LINEARIZATION_TABLE:
if (count > FF_ARRAY_ELEMS(s->dng_lut))
return AVERROR_INVALIDDATA;