[FFmpeg-cvslog] Merge commit '7f045c4429e91688f1f2335dd347203431901c06'
Clément Bœsch
git at videolan.org
Mon Jun 20 12:05:28 CEST 2016
ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Mon Jun 20 12:00:29 2016 +0200| [c957909a9f48196bfb4cb295c750ec6d495d7bbb] | committer: Clément Bœsch
Merge commit '7f045c4429e91688f1f2335dd347203431901c06'
* commit '7f045c4429e91688f1f2335dd347203431901c06':
h264: merge ff_h264_free_context() into h264_decode_end()
Merged-by: Clément Bœsch <clement at stupeflix.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c957909a9f48196bfb4cb295c750ec6d495d7bbb
---
libavcodec/h264.c | 90 +++++++++++++++++++++++++----------------------------
libavcodec/h264.h | 6 ----
2 files changed, 42 insertions(+), 54 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index bf8e12d..bd9f672 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -357,6 +357,48 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
return 0;
}
+static av_cold int h264_decode_end(AVCodecContext *avctx)
+{
+ H264Context *h = avctx->priv_data;
+ int i;
+
+ ff_h264_remove_all_refs(h);
+ ff_h264_free_tables(h);
+
+ for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
+ ff_h264_unref_picture(h, &h->DPB[i]);
+ av_frame_free(&h->DPB[i].f);
+ }
+ memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
+
+ h->cur_pic_ptr = NULL;
+
+ for (i = 0; i < h->nb_slice_ctx; i++)
+ av_freep(&h->slice_ctx[i].rbsp_buffer);
+ av_freep(&h->slice_ctx);
+ h->nb_slice_ctx = 0;
+
+ ff_h264_sei_uninit(&h->sei);
+
+ for (i = 0; i < MAX_SPS_COUNT; i++)
+ av_buffer_unref(&h->ps.sps_list[i]);
+
+ for (i = 0; i < MAX_PPS_COUNT; i++)
+ av_buffer_unref(&h->ps.pps_list[i]);
+
+ av_buffer_unref(&h->ps.sps_ref);
+ av_buffer_unref(&h->ps.pps_ref);
+
+ ff_h2645_packet_uninit(&h->pkt);
+
+ ff_h264_unref_picture(h, &h->cur_pic);
+ av_frame_free(&h->cur_pic.f);
+ ff_h264_unref_picture(h, &h->last_pic_for_ec);
+ av_frame_free(&h->last_pic_for_ec.f);
+
+ return 0;
+}
+
static AVOnce h264_vlc_init = AV_ONCE_INIT;
av_cold int ff_h264_decode_init(AVCodecContext *avctx)
@@ -1359,54 +1401,6 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
return get_consumed_bytes(buf_index, buf_size);
}
-av_cold void ff_h264_free_context(H264Context *h)
-{
- int i;
-
- ff_h264_free_tables(h);
-
- for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
- ff_h264_unref_picture(h, &h->DPB[i]);
- av_frame_free(&h->DPB[i].f);
- }
- memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
-
- h->cur_pic_ptr = NULL;
-
- for (i = 0; i < h->nb_slice_ctx; i++)
- av_freep(&h->slice_ctx[i].rbsp_buffer);
- av_freep(&h->slice_ctx);
- h->nb_slice_ctx = 0;
-
- ff_h264_sei_uninit(&h->sei);
-
- for (i = 0; i < MAX_SPS_COUNT; i++)
- av_buffer_unref(&h->ps.sps_list[i]);
-
- for (i = 0; i < MAX_PPS_COUNT; i++)
- av_buffer_unref(&h->ps.pps_list[i]);
-
- av_buffer_unref(&h->ps.sps_ref);
- av_buffer_unref(&h->ps.pps_ref);
-
- ff_h2645_packet_uninit(&h->pkt);
-}
-
-static av_cold int h264_decode_end(AVCodecContext *avctx)
-{
- H264Context *h = avctx->priv_data;
-
- ff_h264_remove_all_refs(h);
- ff_h264_free_context(h);
-
- ff_h264_unref_picture(h, &h->cur_pic);
- av_frame_free(&h->cur_pic.f);
- ff_h264_unref_picture(h, &h->last_pic_for_ec);
- av_frame_free(&h->last_pic_for_ec.f);
-
- return 0;
-}
-
#define OFFSET(x) offsetof(H264Context, x)
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption h264_options[] = {
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 7b0555e..010f688 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -713,12 +713,6 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
H264ParamSets *ps, int bit_length);
/**
- * Free any data that may have been allocated in the H264 context
- * like SPS, PPS etc.
- */
-void ff_h264_free_context(H264Context *h);
-
-/**
* Reconstruct bitstream slice_type.
*/
int ff_h264_get_slice_type(const H264SliceContext *sl);
======================================================================
diff --cc libavcodec/h264.c
index bf8e12d,9d7b69c..bd9f672
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@@ -357,6 -323,39 +357,48 @@@ static int h264_init_context(AVCodecCon
return 0;
}
+ static av_cold int h264_decode_end(AVCodecContext *avctx)
+ {
+ H264Context *h = avctx->priv_data;
+ int i;
+
++ ff_h264_remove_all_refs(h);
+ ff_h264_free_tables(h);
+
+ for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
+ ff_h264_unref_picture(h, &h->DPB[i]);
+ av_frame_free(&h->DPB[i].f);
+ }
++ memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
+
+ h->cur_pic_ptr = NULL;
+
+ for (i = 0; i < h->nb_slice_ctx; i++)
+ av_freep(&h->slice_ctx[i].rbsp_buffer);
+ av_freep(&h->slice_ctx);
+ h->nb_slice_ctx = 0;
+
++ ff_h264_sei_uninit(&h->sei);
++
+ for (i = 0; i < MAX_SPS_COUNT; i++)
+ av_buffer_unref(&h->ps.sps_list[i]);
+
+ for (i = 0; i < MAX_PPS_COUNT; i++)
+ av_buffer_unref(&h->ps.pps_list[i]);
+
++ av_buffer_unref(&h->ps.sps_ref);
++ av_buffer_unref(&h->ps.pps_ref);
++
+ ff_h2645_packet_uninit(&h->pkt);
+
+ ff_h264_unref_picture(h, &h->cur_pic);
+ av_frame_free(&h->cur_pic.f);
++ ff_h264_unref_picture(h, &h->last_pic_for_ec);
++ av_frame_free(&h->last_pic_for_ec.f);
+
+ return 0;
+ }
+
static AVOnce h264_vlc_init = AV_ONCE_INIT;
av_cold int ff_h264_decode_init(AVCodecContext *avctx)
More information about the ffmpeg-cvslog
mailing list