[FFmpeg-devel] [PATCH] tiff: add support for inverted FillOrder for uncompressed data

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon May 9 22:28:06 CEST 2011


Fix decoding of file b.tif, trac issue #168.
---
 libavcodec/tiff.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 3963998..e2fa5dc 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -162,13 +162,20 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
         return ret;
     }
     for(line = 0; line < lines; line++){
+        int i;
+
         if(src - ssrc > size){
             av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n");
             return -1;
         }
         switch(s->compr){
         case TIFF_RAW:
-            memcpy(dst, src, width);
+            if (!s->fill_order) {
+                memcpy(dst, src, width);
+            } else {
+                for (i = 0; i < width; i++)
+                    dst[i] = av_reverse[src[i]];
+            }
             src += width;
             break;
         case TIFF_PACKBITS:
-- 
1.7.2.3



More information about the ffmpeg-devel mailing list