From 9ce74a101c7ba9b5872378555f6901b32a089ff6 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 25 Mar 2025 12:17:25 +0100 Subject: [PATCH 26/44] avcodec/mpegvideo: Make ff_mpv_{free,init}_context_frame() static Possible now that ff_mpv_common_framesize_change() no longer exists. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 16 +++++----------- libavcodec/mpegvideo.h | 11 ----------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index d09eb1211d..dfa3930f83 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -249,7 +249,7 @@ static av_cold void free_buffer_pools(BufferPoolContext *pools) pools->alloc_mb_height = pools->alloc_mb_width = pools->alloc_mb_stride = 0; } -av_cold int ff_mpv_init_context_frame(MpegEncContext *s) +static av_cold int mpv_init_context_frame(MpegEncContext *s) { BufferPoolContext *const pools = &s->buffer_pools; int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; @@ -450,7 +450,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) if (ret) return ret; - if ((ret = ff_mpv_init_context_frame(s))) + ret = mpv_init_context_frame(s); + if (ret < 0) goto fail; if (nb_slices > MAX_THREADS || (nb_slices > s->mb_height && s->mb_height)) { @@ -481,7 +482,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) return ret; } -av_cold void ff_mpv_free_context_frame(MpegEncContext *s) +av_cold void ff_mpv_common_end(MpegEncContext *s) { free_duplicate_contexts(s); @@ -503,14 +504,7 @@ av_cold void ff_mpv_free_context_frame(MpegEncContext *s) av_freep(&s->er.er_temp_buffer); av_freep(&s->mb_index2xy); - s->linesize = s->uvlinesize = 0; -} - -av_cold void ff_mpv_common_end(MpegEncContext *s) -{ - ff_mpv_free_context_frame(s); - if (s->slice_context_count > 1) - s->slice_context_count = 1; + s->slice_context_count = 1; ff_mpv_unref_picture(&s->last_pic); ff_mpv_unref_picture(&s->cur_pic); diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index de3ebd5ed2..3a769db569 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -354,17 +354,6 @@ int ff_mpv_common_init(MpegEncContext *s); * that are freed/reset in free_duplicate_context() are NULL. */ int ff_mpv_init_duplicate_contexts(MpegEncContext *s); -/** - * Initialize and allocates MpegEncContext fields dependent on the resolution. - */ -int ff_mpv_init_context_frame(MpegEncContext *s); -/** - * Frees and resets MpegEncContext fields depending on the resolution - * as well as the slice thread contexts. - * Is used during resolution changes to avoid a full reinitialization of the - * codec. - */ -void ff_mpv_free_context_frame(MpegEncContext *s); void ff_mpv_common_end(MpegEncContext *s); -- 2.45.2