This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 49e57c6c8504a13a1f6dedb2c1c96839c7b54f52 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Fri Feb 27 16:36:00 2026 +0100 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Tue Mar 3 13:07:46 2026 +0100 avcodec/error_resilience: Initialize error resilience context earlier Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/error_resilience.c | 16 +++++++++------- libavcodec/error_resilience.h | 3 ++- libavcodec/h264dec.c | 2 ++ libavcodec/mpeg_er.c | 2 ++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index cf6f83e096..76d5bfa73b 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -28,6 +28,7 @@ #include <limits.h> #include "libavutil/avassert.h" +#include "libavutil/attributes.h" #include "libavutil/mem.h" #include "avcodec.h" #include "error_resilience.h" @@ -38,6 +39,14 @@ #include "threadframe.h" #include "threadprogress.h" +av_cold void ff_er_init(ERContext *const s) +{ + MECmpContext mecc; + + ff_me_cmp_init(&mecc, s->avctx); + s->sad = mecc.sad[0]; +} + /** * @param stride the number of MVs to get to the next row * @param mv_step the number of MVs per row or column in a macroblock @@ -795,13 +804,6 @@ void ff_er_frame_start(ERContext *s) if (!s->avctx->error_concealment) return; - if (!s->mecc_inited) { - MECmpContext mecc; - ff_me_cmp_init(&mecc, s->avctx); - s->sad = mecc.sad[0]; - s->mecc_inited = 1; - } - memset(s->error_status_table, ER_MB_ERROR | VP_START | ER_MB_END, s->mb_stride * s->mb_height * sizeof(uint8_t)); atomic_init(&s->error_count, 3 * s->mb_num); diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h index 8e43219b09..6c8736a445 100644 --- a/libavcodec/error_resilience.h +++ b/libavcodec/error_resilience.h @@ -56,7 +56,6 @@ typedef struct ERContext { int (*sad)(MPVEncContext *unused, const uint8_t *blk1, const uint8_t *blk2, ptrdiff_t stride, int h); - int mecc_inited; int *mb_index2xy; int mb_num; @@ -91,6 +90,8 @@ typedef struct ERContext { void *opaque; } ERContext; +void ff_er_init(ERContext *const s); + void ff_er_frame_start(ERContext *s); /** diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index ab31832308..e430bc58fc 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -255,6 +255,8 @@ int ff_h264_alloc_tables(H264Context *h) er->dc_val[2] = er->dc_val[1] + big_mb_num; for (int i = 0; i < yc_size; i++) h->dc_val_base[i] = 1024; + + ff_er_init(er); } return 0; diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index 5df75d8e85..93eb9221d7 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -122,6 +122,8 @@ av_cold int ff_mpeg_er_init(MpegEncContext *s) er->decode_mb = mpeg_er_decode_mb; er->opaque = s; + ff_er_init(er); + return 0; fail: av_freep(&er->er_temp_buffer); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
