ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Wed Apr 30 03:48:38 2025 +0200| [65015003f5c4b83a8202abfa7420ccf37cde6ce3] | committer: Andreas Rheinhardt
avcodec/svq1enc: Allocate buffers during init Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65015003f5c4b83a8202abfa7420ccf37cde6ce3 --- libavcodec/svq1enc.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 7319740a78..3b8738c14f 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -594,6 +594,15 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) if (!s->current_picture || !s->last_picture) { return AVERROR(ENOMEM); } + ret = ff_encode_alloc_frame(avctx, s->current_picture); + if (ret < 0) + return ret; + ret = ff_encode_alloc_frame(avctx, s->last_picture); + if (ret < 0) + return ret; + s->scratchbuf = av_malloc_array(s->current_picture->linesize[0], 16 * 3); + if (!s->scratchbuf) + return AVERROR(ENOMEM); s->frame_width = avctx->width; s->frame_height = avctx->height; @@ -644,22 +653,6 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (ret < 0) return ret; - if (!s->current_picture->data[0]) { - if ((ret = ff_encode_alloc_frame(avctx, s->current_picture)) < 0) { - return ret; - } - } - if (!s->last_picture->data[0]) { - ret = ff_encode_alloc_frame(avctx, s->last_picture); - if (ret < 0) - return ret; - } - if (!s->scratchbuf) { - s->scratchbuf = av_malloc_array(s->current_picture->linesize[0], 16 * 3); - if (!s->scratchbuf) - return AVERROR(ENOMEM); - } - FFSWAP(AVFrame*, s->current_picture, s->last_picture); if (avctx->gop_size && (avctx->frame_num % avctx->gop_size)) _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".