diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-26 19:02:37 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-29 19:30:25 +0100 |
commit | 5a04c6a2697568c2b7233a0a9f4f20aa8a2a1706 (patch) | |
tree | 266f975f3ad946e38ed46374e0d830ef95fe0715 /libavcodec/mpegvideo.c | |
parent | d0ceb90f44ff342e8de8259548a04fb9fce2ed68 (diff) |
avcodec/mpegpicture: Add function to completely free MPEG-Picture
Also use said function in mpegvideo.c and mpegvideo_enc.c;
and make ff_free_picture_tables() static as it isn't needed anymore
outside of mpegpicture.c.
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 3b889e0791..bbcf00b014 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -874,8 +874,6 @@ void ff_mpv_free_context_frame(MpegEncContext *s) /* init common structure for both encoder and decoder */ void ff_mpv_common_end(MpegEncContext *s) { - int i; - if (!s) return; @@ -895,25 +893,14 @@ void ff_mpv_common_end(MpegEncContext *s) return; if (s->picture) { - for (i = 0; i < MAX_PICTURE_COUNT; i++) { - ff_free_picture_tables(&s->picture[i]); - ff_mpeg_unref_picture(s->avctx, &s->picture[i]); - av_frame_free(&s->picture[i].f); - } + for (int i = 0; i < MAX_PICTURE_COUNT; i++) + ff_mpv_picture_free(s->avctx, &s->picture[i]); } av_freep(&s->picture); - ff_free_picture_tables(&s->last_picture); - ff_mpeg_unref_picture(s->avctx, &s->last_picture); - av_frame_free(&s->last_picture.f); - ff_free_picture_tables(&s->current_picture); - ff_mpeg_unref_picture(s->avctx, &s->current_picture); - av_frame_free(&s->current_picture.f); - ff_free_picture_tables(&s->next_picture); - ff_mpeg_unref_picture(s->avctx, &s->next_picture); - av_frame_free(&s->next_picture.f); - ff_free_picture_tables(&s->new_picture); - ff_mpeg_unref_picture(s->avctx, &s->new_picture); - av_frame_free(&s->new_picture.f); + ff_mpv_picture_free(s->avctx, &s->last_picture); + ff_mpv_picture_free(s->avctx, &s->current_picture); + ff_mpv_picture_free(s->avctx, &s->next_picture); + ff_mpv_picture_free(s->avctx, &s->new_picture); s->context_initialized = 0; s->context_reinit = 0; |