On date Wednesday 2011-05-11 11:47:14 +0200, Kostya encoded:
> On Mon, May 09, 2011 at 09:59:20PM +0200, Stefano Sabatini wrote:
> > 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 1ecdc94..ae4c68e 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:
> > --
>
> looks ok (though you can move "int i;" declaration inside else{} block IMO)
Sure, updated.
>From ecffd1c732649a05d06a9929cc2f1a031fd64410 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <[email protected]>
Date: Mon, 9 May 2011 21:59:20 +0200
Subject: [PATCH] tiff: add support for inverted FillOrder for uncompressed data
Fix decoding of file b.tif, trac issue #168.
---
libavcodec/tiff.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 9a94e86..ef3a8df 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -168,7 +168,13 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
}
switch(s->compr){
case TIFF_RAW:
- memcpy(dst, src, width);
+ if (!s->fill_order) {
+ memcpy(dst, src, width);
+ } else {
+ int i;
+ for (i = 0; i < width; i++)
+ dst[i] = av_reverse[src[i]];
+ }
src += width;
break;
case TIFF_PACKBITS:
--
1.7.2.3
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel