This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit bb92009386f0dc98e50e2ac949282a0986cce175 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Mon Feb 9 14:33:01 2026 +0100 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Sun Feb 22 22:05:15 2026 +0100 avcodec/snow: Only allocate emu_edge_buffer for encoder Also allocate it during init and move it to the encoder's context. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/snow.c | 6 +----- libavcodec/snow.h | 1 - libavcodec/snowenc.c | 9 ++++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 006d84d8ce..094b893c96 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -540,10 +540,7 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { int plane_index, level, orientation; if(!s->scratchbuf) { - int emu_buf_size; - emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); - if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) || - !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size)) + if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE)) return AVERROR(ENOMEM); } @@ -642,7 +639,6 @@ av_cold void ff_snow_common_end(SnowContext *s) av_freep(&s->block); av_freep(&s->scratchbuf); - av_freep(&s->emu_edge_buffer); for(i=0; i<MAX_REF_FRAMES; i++){ av_frame_free(&s->last_picture[i]); diff --git a/libavcodec/snow.h b/libavcodec/snow.h index 83dc6c1256..82417c3324 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -168,7 +168,6 @@ typedef struct SnowContext{ slice_buffer sb; uint8_t *scratchbuf; - uint8_t *emu_edge_buffer; AVMotionVector *avmv; unsigned avmv_size; diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 20a41f11a4..f34130f184 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -68,6 +68,8 @@ typedef struct SnowEncContext { uint64_t encoding_error[SNOW_MAX_PLANES]; + uint8_t *emu_edge_buffer; + IDWTELEM obmc_scratchpad[MB_SIZE * MB_SIZE * 12 * 2]; } SnowEncContext; @@ -286,6 +288,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if ((ret = get_encode_buffer(s, s->input_picture)) < 0) return ret; + enc->emu_edge_buffer = av_calloc(avctx->width + 128, 2 * (2 * MB_SIZE + HTAPS_MAX - 1)); + if (!enc->emu_edge_buffer) + return AVERROR(ENOMEM); + if (enc->motion_est == FF_ME_ITER) { int size= s->b_width * s->b_height << 2*s->block_max_depth; for(i=0; i<s->max_ref_frames; i++){ @@ -770,7 +776,7 @@ static int get_block_rd(SnowEncContext *enc, int mb_x, int mb_y, const uint8_t *src = s->input_picture->data[plane_index]; IDWTELEM *pred = enc->obmc_scratchpad + plane_index * block_size * block_size * 4; uint8_t *cur = s->scratchbuf; - uint8_t *tmp = s->emu_edge_buffer; + uint8_t *tmp = enc->emu_edge_buffer; const int b_stride = s->b_width << s->block_max_depth; const int b_height = s->b_height<< s->block_max_depth; const int w= p->width; @@ -2088,6 +2094,7 @@ static av_cold int encode_end(AVCodecContext *avctx) enc->m.s.me.temp = NULL; av_freep(&enc->m.s.me.scratchpad); + av_freep(&enc->emu_edge_buffer); av_freep(&avctx->stats_out); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
