summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorNick Renieris <velocityra@gmail.com>2019-08-29 16:10:48 +0300
committerPaul B Mahol <onemda@gmail.com>2019-09-02 09:26:52 +0200
commita75a9e8f64ec9660b7c6e16653299f07bfe00f9d (patch)
tree101df2e6d34aeb26197538dbda0ebbd11b925423 /libavcodec/tiff.c
parentc510ed2ee8b3d5ec373d9d8a7e5a25c132ca620e (diff)
lavc/mjpegdec: Enable decoding of single-component bayer images
Also, ensure no false positives when determining DNG bayer images, by setting them in tiff.c instead of relying on a heuristic. There's no way to determine this just from the JPEG data, so we have to pass this information from outside the MJPEG decoder. Signed-off-by: Nick Renieris <velocityra@gmail.com>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 8cbcbdf7a5..bdc9335b9a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -839,6 +839,13 @@ static int dng_decode_jpeg_tile(AVCodecContext *avctx, AVFrame *frame,
jpkt.data = (uint8_t*)s->gb.buffer;
jpkt.size = tile_byte_count;
+ if (s->is_bayer) {
+ MJpegDecodeContext *mjpegdecctx = s->avctx_mjpeg->priv_data;
+ /* We have to set this information here, there is no way to know if a given JPEG is a DNG-embedded
+ image or not from its own data (and we need that information when decoding it). */
+ mjpegdecctx->bayer = 1;
+ }
+
ret = avcodec_send_packet(s->avctx_mjpeg, &jpkt);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error submitting a packet for decoding\n");