[FFmpeg-devel] [PATCH] tiff: support inverted fill_order for packbits compression

Paul B Mahol onemda at gmail.com
Tue May 28 19:31:07 CEST 2013


Fixes #1995.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/tiff.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index e10badb..f503132 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -553,7 +553,7 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
                     av_log(s->avctx, AV_LOG_ERROR, "Read went out of bounds\n");
                     return AVERROR_INVALIDDATA;
                 }
-                code = (int8_t) * src++;
+                code = s->fill_order ? (int8_t) ff_reverse[*src++]: (int8_t) *src++;
                 if (code >= 0) {
                     code++;
                     if (pixels + code > width) {
@@ -582,6 +582,11 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
                     pixels += code;
                 }
             }
+            if (s->fill_order) {
+                int i;
+                for (i = 0; i < width; i++)
+                    dst[i] = ff_reverse[dst[i]];
+            }
             break;
         case TIFF_LZW:
             pixels = ff_lzw_decode(s->lzw, dst, width);
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list