cur_w > s->width - x_offset|| cur_h > s->height - y_offset)
return AVERROR_INVALIDDATA;
+ if (blend_op != APNG_BLEND_OP_OVER && blend_op != APNG_BLEND_OP_SOURCE) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid blend_op %d\n", blend_op);
+ return AVERROR_INVALIDDATA;
+ }
+
if (sequence_number == 0 && dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
// No previous frame to revert to for the first frame
// Spec says to just treat it as a APNG_DISPOSE_OP_BACKGROUND
AVFrame *p)
{
size_t x, y;
- uint8_t *buffer = av_malloc(s->image_linesize * s->height);
-
- if (!buffer)
- return AVERROR(ENOMEM);
+ uint8_t *buffer;
if (s->blend_op == APNG_BLEND_OP_OVER &&
avctx->pix_fmt != AV_PIX_FMT_RGBA &&
return AVERROR_PATCHWELCOME;
}
+ buffer = av_malloc_array(s->image_linesize, s->height);
+ if (!buffer)
+ return AVERROR(ENOMEM);
+
+
// Do the disposal operation specified by the last frame on the frame
if (s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
}
}
ff_thread_report_progress(&s->picture, INT_MAX, 0);
+ ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
av_frame_set_metadata(p, metadata);
metadata = NULL;
fail:
av_dict_free(&metadata);
ff_thread_report_progress(&s->picture, INT_MAX, 0);
+ ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
return ret;
}
return AVERROR_INVALIDDATA;
}
- s->y = s->state = 0;
+ s->y = s->state = s->has_trns = 0;
/* init the zlib */
s->zstream.zalloc = ff_png_zalloc;
}
#endif
+#if HAVE_THREADS
static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
{
PNGDecContext *psrc = src->priv_data;
return 0;
}
+#endif
static av_cold int png_dec_init(AVCodecContext *avctx)
{