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>
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)
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) {