[FFmpeg-devel] [PATCH]Fix 1bit bmp decoding
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Thu Nov 10 20:21:50 CET 2011
On Thu, Nov 10, 2011 at 08:12:42PM +0100, Michael Niedermayer wrote:
> On Thu, Nov 10, 2011 at 06:10:04PM +0100, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached fixes ticket #632 for me, it does not break the output of
> > ffmpeg -i tests/lena.pnm -pix_fmt monob out.bmp
> > but I don't know if 1-bit bmp without palette exists / how it can be created.
> >
> > Please comment, Carl Eugen
>
> > bmp.c | 22 ++++++++++++++++++----
> > 1 file changed, 18 insertions(+), 4 deletions(-)
> > a86b7387b0e8439d7177dafba9004482cf1b7431 patch1bitbmp.diff
> > diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
> > index 0b38724..22973aa 100644
> > --- a/libavcodec/bmp.c
> > +++ b/libavcodec/bmp.c
> > @@ -171,17 +171,15 @@ static int bmp_decode_frame(AVCodecContext *avctx,
> > else
> > avctx->pix_fmt = PIX_FMT_GRAY8;
> > break;
> > + case 1:
> > case 4:
> > if(hsize - ihsize - 14 > 0){
> > avctx->pix_fmt = PIX_FMT_PAL8;
> > }else{
> > - av_log(avctx, AV_LOG_ERROR, "Unknown palette for 16-colour BMP\n");
> > + av_log(avctx, AV_LOG_ERROR, "Unknown palette for %d-colour BMP\n", 1<<depth);
> > return -1;
> > }
> > break;
> > - case 1:
> > - avctx->pix_fmt = PIX_FMT_MONOBLACK;
>
> can the palette be analyzed and MONOWHITE / BLACK be used ?
> if so, it would be simpler
I agree that it would be nicer in principle, however it
unfortunately is not a proper, final solution since the
palette can just as well be red/green or whatever, not necessarily
either black and white or white and black.
More information about the ffmpeg-devel
mailing list