From d528045558825f01472e9bee873f60c98d661e53 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Mon, 27 Apr 2015 22:09:19 +0100 Subject: mpegvideo: Have ff_mpeg_unref_picture use AVCodecContext directly This skips setting the memory to 0 but allows for reuse on different contextes. Oracle did not report any unsual activity because of it. --- libavcodec/mpegvideo_enc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'libavcodec/mpegvideo_enc.c') diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index a46b685535..116f494fec 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -886,7 +886,7 @@ av_cold int ff_mpv_encode_end(AVCodecContext *avctx) av_frame_free(&s->tmp_frames[i]); ff_free_picture_tables(&s->new_picture); - ff_mpeg_unref_picture(s, &s->new_picture); + ff_mpeg_unref_picture(s->avctx, &s->new_picture); av_freep(&s->avctx->stats_out); av_freep(&s->ac_stats); @@ -1370,7 +1370,7 @@ no_output_pic: s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_B ? 3 : 0; - ff_mpeg_unref_picture(s, &s->new_picture); + ff_mpeg_unref_picture(s->avctx, &s->new_picture); if ((ret = ff_mpeg_ref_picture(s, &s->new_picture, s->reordered_input_picture[0]))) return ret; @@ -1405,14 +1405,14 @@ no_output_pic: s->new_picture.f->data[i] += INPLACE_OFFSET; } } - ff_mpeg_unref_picture(s, &s->current_picture); + ff_mpeg_unref_picture(s->avctx, &s->current_picture); if ((ret = ff_mpeg_ref_picture(s, &s->current_picture, s->current_picture_ptr)) < 0) return ret; s->picture_number = s->new_picture.f->display_picture_number; } else { - ff_mpeg_unref_picture(s, &s->new_picture); + ff_mpeg_unref_picture(s->avctx, &s->new_picture); } return 0; } @@ -1456,7 +1456,7 @@ static void frame_end(MpegEncContext *s) /* release non-reference frames */ for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) - ff_mpeg_unref_picture(s, &s->picture[i]); + ff_mpeg_unref_picture(s->avctx, &s->picture[i]); } } @@ -1493,13 +1493,13 @@ static int frame_start(MpegEncContext *s) if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->f->buf[0]) { - ff_mpeg_unref_picture(s, s->last_picture_ptr); + ff_mpeg_unref_picture(s->avctx, s->last_picture_ptr); } s->current_picture_ptr->f->pict_type = s->pict_type; s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; - ff_mpeg_unref_picture(s, &s->current_picture); + ff_mpeg_unref_picture(s->avctx, &s->current_picture); if ((ret = ff_mpeg_ref_picture(s, &s->current_picture, s->current_picture_ptr)) < 0) return ret; @@ -1511,14 +1511,14 @@ static int frame_start(MpegEncContext *s) } if (s->last_picture_ptr) { - ff_mpeg_unref_picture(s, &s->last_picture); + ff_mpeg_unref_picture(s->avctx, &s->last_picture); if (s->last_picture_ptr->f->buf[0] && (ret = ff_mpeg_ref_picture(s, &s->last_picture, s->last_picture_ptr)) < 0) return ret; } if (s->next_picture_ptr) { - ff_mpeg_unref_picture(s, &s->next_picture); + ff_mpeg_unref_picture(s->avctx, &s->next_picture); if (s->next_picture_ptr->f->buf[0] && (ret = ff_mpeg_ref_picture(s, &s->next_picture, s->next_picture_ptr)) < 0) -- cgit v1.2.3