aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2009-09-24 18:30:28 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2009-09-24 18:30:28 +0000
commita58e96be0e6f01721c5a3c26c42d08d6247dd682 (patch)
treeff3f1f3af47e56ea862e37f26978fa28e34ff1d4 /libavcodec/tiff.c
parentd38b7b80d136a9fafa649cd0b1a82c9d9e366cd6 (diff)
downloadffmpeg-a58e96be0e6f01721c5a3c26c42d08d6247dd682.tar.gz
Support both LSB and MSB orders for TIFF CCITT G.x compressed data.
This fixes issue 1410. Originally committed as revision 20016 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 720a6cf622..af7b40e3ca 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -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 *s, uint8_t* dst, int stride, const uin
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 *s, const uint8_t *start, const uint8_t *
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 *avctx,
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){