Mercurial > libavcodec.hg
comparison tiff.c @ 10324:5bbe55451800 libavcodec
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.
author | kostya |
---|---|
date | Wed, 30 Sep 2009 05:49:18 +0000 |
parents | 370d05e51d90 |
children | d1014913ad1b |
comparison
equal
deleted
inserted
replaced
10323:1f5c4d2ce77f | 10324:5bbe55451800 |
---|---|
496 av_log(avctx, AV_LOG_ERROR, "Image data is missing\n"); | 496 av_log(avctx, AV_LOG_ERROR, "Image data is missing\n"); |
497 return -1; | 497 return -1; |
498 } | 498 } |
499 /* now we have the data and may start decoding */ | 499 /* now we have the data and may start decoding */ |
500 if(!p->data[0]){ | 500 if(!p->data[0]){ |
501 av_log(s->avctx, AV_LOG_ERROR, "Picture initialization missing\n"); | 501 s->bpp = 1; |
502 return -1; | 502 avctx->pix_fmt = PIX_FMT_MONOBLACK; |
503 if(s->width != s->avctx->width || s->height != s->avctx->height){ | |
504 if(avcodec_check_dimensions(s->avctx, s->width, s->height)) | |
505 return -1; | |
506 avcodec_set_dimensions(s->avctx, s->width, s->height); | |
507 } | |
508 if(s->picture.data[0]) | |
509 s->avctx->release_buffer(s->avctx, &s->picture); | |
510 if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){ | |
511 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | |
512 return -1; | |
513 } | |
503 } | 514 } |
504 if(s->strips == 1 && !s->stripsize){ | 515 if(s->strips == 1 && !s->stripsize){ |
505 av_log(avctx, AV_LOG_WARNING, "Image data size missing\n"); | 516 av_log(avctx, AV_LOG_WARNING, "Image data size missing\n"); |
506 s->stripsize = buf_size - s->stripoff; | 517 s->stripsize = buf_size - s->stripoff; |
507 } | 518 } |