# HG changeset patch # User kostya # Date 1254289758 0 # Node ID 5bbe554518009187dd6266136e6d6d7692337459 # Parent 1f5c4d2ce77f3dd6a4868ce02307379fac5d4dae When BitsPerSample tag is not present in TIFF, that means file is monochrome, so initialize picture before decoding. This fixes decoding monochrome files produced by lavc TIFF encoder. diff -r 1f5c4d2ce77f -r 5bbe55451800 tiff.c --- a/tiff.c Wed Sep 30 01:25:04 2009 +0000 +++ b/tiff.c Wed Sep 30 05:49:18 2009 +0000 @@ -498,8 +498,19 @@ } /* now we have the data and may start decoding */ if(!p->data[0]){ - av_log(s->avctx, AV_LOG_ERROR, "Picture initialization missing\n"); - return -1; + s->bpp = 1; + avctx->pix_fmt = PIX_FMT_MONOBLACK; + if(s->width != s->avctx->width || s->height != s->avctx->height){ + if(avcodec_check_dimensions(s->avctx, s->width, s->height)) + return -1; + avcodec_set_dimensions(s->avctx, s->width, s->height); + } + if(s->picture.data[0]) + s->avctx->release_buffer(s->avctx, &s->picture); + if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){ + av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return -1; + } } if(s->strips == 1 && !s->stripsize){ av_log(avctx, AV_LOG_WARNING, "Image data size missing\n");