[FFmpeg-devel] [PATCH]Fix some 1bpp tiff samples
Carl Eugen Hoyos
cehoyos at ag.or.at
Sat Dec 31 19:13:17 CET 2011
On Saturday 31 December 2011 07:00:07 pm Michael Niedermayer wrote:
> On Sat, Dec 31, 2011 at 04:52:35PM +0100, Carl Eugen Hoyos wrote:
> > I believe attached (or similar) is still necessary for raw and packed, I
> > only tested with forcing s->palette_is_set to 0.
> >
> > Please comment, Carl Eugen
> >
> > tiff.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> > 0a74113a3ef787d8aa2b9c8ebb80841138050920 patchtif1bpppal82.diff
> > diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> > index b353677..0ad8d97 100644
> > --- a/libavcodec/tiff.c
> > +++ b/libavcodec/tiff.c
> > @@ -224,7 +224,8 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t*
> > dst, int stride, const uin if (ssrc + size - src < width)
> > return AVERROR_INVALIDDATA;
> > if (!s->fill_order) {
> > - horizontal_fill(s->bpp, dst, 1, src, 0, width, 0);
> > + horizontal_fill(s->bpp * s->avctx->pix_fmt ==
> > PIX_FMT_PAL8, + dst, 1, src, 0, width, 0);
>
> this looks odd, did you mean
> s->bpp * (s->avctx->pix_fmt == PIX_FMT_PAL8)
> ?
Seems so;-)
New patch attached, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index b353677..b0ccbac 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -224,7 +224,8 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
if (ssrc + size - src < width)
return AVERROR_INVALIDDATA;
if (!s->fill_order) {
- horizontal_fill(s->bpp, dst, 1, src, 0, width, 0);
+ horizontal_fill(s->bpp * (s->avctx->pix_fmt == PIX_FMT_PAL8),
+ dst, 1, src, 0, width, 0);
} else {
int i;
for (i = 0; i < width; i++)
@@ -241,7 +242,8 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
av_log(s->avctx, AV_LOG_ERROR, "Copy went out of bounds\n");
return -1;
}
- horizontal_fill(s->bpp, dst, 1, src, 0, code, pixels);
+ horizontal_fill(s->bpp * (s->avctx->pix_fmt == PIX_FMT_PAL8),
+ dst, 1, src, 0, code, pixels);
src += code;
pixels += code;
}else if(code != -128){ // -127..-1
@@ -251,7 +253,8 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
return -1;
}
c = *src++;
- horizontal_fill(s->bpp, dst, 0, NULL, c, code, pixels);
+ horizontal_fill(s->bpp * (s->avctx->pix_fmt == PIX_FMT_PAL8),
+ dst, 0, NULL, c, code, pixels);
pixels += code;
}
}
More information about the ffmpeg-devel
mailing list