diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-16 01:51:04 +0200 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-16 16:34:47 +0200 |
commit | 68bed67d2eaabcfa7eaf00442312055f7d953b69 (patch) | |
tree | a43fce71bf1ab5f292c4f151099401afe7309a6a /libavcodec/pngdec.c | |
parent | 85eedcf6ff46b5d3e593a16ebcdd84af278e6d83 (diff) | |
download | ffmpeg-68bed67d2eaabcfa7eaf00442312055f7d953b69.tar.gz |
pngdec: relax condition for setting monoblack pixel format
Ignore color_type information for setting the monoblack pixel format,
only rely on bit_depth.
In particular: fix Test_1bpp_grayscale.png from issue #172.
This may work fine for some broken encoder, and not for others.
Diffstat (limited to 'libavcodec/pngdec.c')
-rw-r--r-- | libavcodec/pngdec.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 100b60cd1e..9732396dc6 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -467,8 +467,7 @@ static int decode_frame(AVCodecContext *avctx, } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_RGB) { avctx->pix_fmt = PIX_FMT_RGB48BE; - } else if (s->bit_depth == 1 && - s->color_type == PNG_COLOR_TYPE_GRAY) { + } else if (s->bit_depth == 1) { avctx->pix_fmt = PIX_FMT_MONOBLACK; } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) { avctx->pix_fmt = PIX_FMT_PAL8; @@ -504,7 +503,7 @@ static int decode_frame(AVCodecContext *avctx, s->image_buf = p->data[0]; s->image_linesize = p->linesize[0]; /* copy the palette if needed */ - if (s->color_type == PNG_COLOR_TYPE_PALETTE) + if (avctx->pix_fmt == PIX_FMT_PAL8) memcpy(p->data[1], s->palette, 256 * sizeof(uint32_t)); /* empty row is used if differencing to the first row */ s->last_row = av_mallocz(s->row_size); |