[FFmpeg-cvslog] libavcodec/tiff: Process SubIFDs tag with multiple entries

Nick Renieris git at videolan.org
Thu May 30 20:38:42 EEST 2019


ffmpeg | branch: master | Nick Renieris <velocityra at gmail.com> | Thu May 30 13:42:41 2019 +0300| [661facb8a89a2712b67da221f0176a42382c9827] | committer: Paul B Mahol

libavcodec/tiff: Process SubIFDs tag with multiple entries

SubIFDs that were part of more than single-sized "SubIFDs" tags were
being ignored due to existing code ignoring that case.

This patch makes is so the first entry is read, which is not ideal
but enough for some DNG images present in the wild to be decodeable
More specifically, the first SubIFD which we would process with this
patch is the main image and the second one is a second thumbnail,
which is not as important to decode.

In DNG images with the .tiff extension, it solves the issue where
the TIFF thumbnail in IFD 0 was incorrectly parsed (related
confusion: [1]).

Embedded thumbnails for DNG images can still be decoded with the
"-thumbnail" option.

Related to ticket: https://trac.ffmpeg.org/ticket/4364

[1]: https://superuser.com/questions/546879/creating-video-from-dng-images-with-ffmpeg

Signed-off-by: Nick Renieris <velocityra at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=661facb8a89a2712b67da221f0176a42382c9827
---

 libavcodec/tiff.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 6e15d00310..3a3f68fa94 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1090,7 +1090,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
         s->predictor = value;
         break;
     case TIFF_SUB_IFDS:
-        s->sub_ifd = value;
+        if (count == 1)
+            s->sub_ifd = value;
+        else if (count > 1)
+            s->sub_ifd = ff_tget(&s->gb, TIFF_LONG, s->le); /** Only get the first SubIFD */
         break;
     case TIFF_WHITE_LEVEL:
         s->white_level = value;



More information about the ffmpeg-cvslog mailing list