[FFmpeg-cvslog] avcodec/snow: Move freeing encoder-only buffers to snowenc.c
Andreas Rheinhardt
git at videolan.org
Fri Sep 29 03:03:39 EEST 2023
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Oct 9 07:03:10 2022 +0200| [7d112c638aaa6483a8e6a05d8b79f07092069b45] | committer: Andreas Rheinhardt
avcodec/snow: Move freeing encoder-only buffers to snowenc.c
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d112c638aaa6483a8e6a05d8b79f07092069b45
---
libavcodec/snow.c | 7 -------
libavcodec/snowenc.c | 11 +++++++++++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 690d8c2ce5..59815d00d9 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -560,18 +560,11 @@ av_cold void ff_snow_common_end(SnowContext *s)
av_freep(&s->temp_idwt_buffer);
av_freep(&s->run_buffer);
- s->m.me.temp= NULL;
- av_freep(&s->m.me.scratchpad);
- av_freep(&s->m.me.map);
- av_freep(&s->m.sc.obmc_scratchpad);
-
av_freep(&s->block);
av_freep(&s->scratchbuf);
av_freep(&s->emu_edge_buffer);
for(i=0; i<MAX_REF_FRAMES; i++){
- av_freep(&s->ref_mvs[i]);
- av_freep(&s->ref_scores[i]);
if(s->last_picture[i] && s->last_picture[i]->data[0]) {
av_assert0(s->last_picture[i]->data[0] != s->current_picture->data[0]);
}
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index a09f81939d..ab15c4e108 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -2022,6 +2022,17 @@ static av_cold int encode_end(AVCodecContext *avctx)
ff_snow_common_end(s);
ff_rate_control_uninit(&s->m);
av_frame_free(&s->input_picture);
+
+ for (int i = 0; i < MAX_REF_FRAMES; i++) {
+ av_freep(&s->ref_mvs[i]);
+ av_freep(&s->ref_scores[i]);
+ }
+
+ s->m.me.temp = NULL;
+ av_freep(&s->m.me.scratchpad);
+ av_freep(&s->m.me.map);
+ av_freep(&s->m.sc.obmc_scratchpad);
+
av_freep(&avctx->stats_out);
return 0;
More information about the ffmpeg-cvslog
mailing list