summaryrefslogtreecommitdiff
path: root/libavcodec/pngdec.c
diff options
context:
space:
mode:
authorBenoit Fouet <benoit.fouet@free.fr>2014-11-28 10:43:01 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-28 15:51:23 +0100
commitaff50ae1d176edacf7ff3fb24db9d25ebe9a4b2e (patch)
tree884f7597b517b15480423e7111937c20dcd93b0d /libavcodec/pngdec.c
parentbd67d0ead1451c8ea9b2ef40629360c4a9d9c99c (diff)
avcodec/pngdec: do not blend on transparent black
There is no need to memset the zlib output buffer, as there is no blending happening there. Instead, do not blend when the dispose operation is set to 'background' (tranparent black). Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pngdec.c')
-rw-r--r--libavcodec/pngdec.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 4c9d32107e..da852c4100 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -674,10 +674,6 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
s->crow_buf = s->buffer + 15;
s->zstream.avail_out = s->crow_size;
s->zstream.next_out = s->crow_buf;
-
- if (avctx->codec_id == AV_CODEC_ID_APNG &&
- s->dispose_op == APNG_DISPOSE_OP_BACKGROUND)
- memset(s->zstream.next_out, 0, s->zstream.avail_out);
}
s->state |= PNG_IDAT;
if ((ret = png_decode_idat(s, length)) < 0)
@@ -887,7 +883,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
pd_last += s->image_linesize;
}
- if (s->blend_op == APNG_BLEND_OP_OVER) {
+ if (s->dispose_op != APNG_DISPOSE_OP_BACKGROUND && s->blend_op == APNG_BLEND_OP_OVER) {
uint8_t ri, gi, bi, ai;
if (avctx->pix_fmt == AV_PIX_FMT_RGBA) {