[FFmpeg-cvslog] r20016 - in trunk/libavcodec: tiff.c tiff.h

kostya subversion
Thu Sep 24 20:30:29 CEST 2009


Author: kostya
Date: Thu Sep 24 20:30:28 2009
New Revision: 20016

Log:
Support both LSB and MSB orders for TIFF CCITT G.x compressed data.
This fixes issue 1410.

Modified:
   trunk/libavcodec/tiff.c
   trunk/libavcodec/tiff.h

Modified: trunk/libavcodec/tiff.c
==============================================================================
--- trunk/libavcodec/tiff.c	Thu Sep 24 18:54:26 2009	(r20015)
+++ trunk/libavcodec/tiff.c	Thu Sep 24 20:30:28 2009	(r20016)
@@ -44,6 +44,7 @@ typedef struct TiffContext {
     int invert;
     int fax_opts;
     int predictor;
+    int fill_order;
 
     int strips, rps, sstype;
     int sot;
@@ -113,8 +114,12 @@ static int tiff_unpack_strip(TiffContext
             av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
             return -1;
         }
-        for(i = 0; i < size; i++)
-            src2[i] = ff_reverse[src[i]];
+        if(!s->fill_order){
+            memcpy(src2, src, size);
+        }else{
+            for(i = 0; i < size; i++)
+                src2[i] = ff_reverse[src[i]];
+        }
         memset(src2+size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
         if(s->compr == TIFF_G3 && !(s->fax_opts & 1))
             s->compr = TIFF_CCITT_RLE;
@@ -375,6 +380,13 @@ static int tiff_decode_tag(TiffContext *
             return -1;
         }
         break;
+    case TIFF_FILL_ORDER:
+        if(value < 1 || value > 2){
+            av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value);
+            value = 1;
+        }
+        s->fill_order = value - 1;
+        break;
     case TIFF_PAL:
         if(s->avctx->pix_fmt != PIX_FMT_PAL8){
             av_log(s->avctx, AV_LOG_ERROR, "Palette met but this is not palettized format\n");
@@ -433,6 +445,7 @@ static int decode_frame(AVCodecContext *
     s->le = le;
     s->invert = 0;
     s->compr = TIFF_RAW;
+    s->fill_order = 0;
     // As TIFF 6.0 specification puts it "An arbitrary but carefully chosen number
     // that further identifies the file as a TIFF file"
     if(tget_short(&buf, le) != 42){

Modified: trunk/libavcodec/tiff.h
==============================================================================
--- trunk/libavcodec/tiff.h	Thu Sep 24 18:54:26 2009	(r20015)
+++ trunk/libavcodec/tiff.h	Thu Sep 24 20:30:28 2009	(r20016)
@@ -37,6 +37,7 @@ enum TiffTags{
     TIFF_BPP,
     TIFF_COMPR,
     TIFF_INVERT = 0x106,
+    TIFF_FILL_ORDER = 0x10A,
     TIFF_STRIP_OFFS = 0x111,
     TIFF_SAMPLES_PER_PIXEL = 0x115,
     TIFF_ROWSPERSTRIP = 0x116,



More information about the ffmpeg-cvslog mailing list