diff options
author | Anton Khirnov <anton@khirnov.net> | 2015-01-17 22:28:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-03-21 11:27:15 +0100 |
commit | 36d04801ba9d8622c2d759c172aea18561bac74d (patch) | |
tree | 24ad5e5b12360b0ba4b2498d79d0d2da930c911a /libavcodec/h264.c | |
parent | 34d4c605e9a5116d5289b35633ade5b01cacab24 (diff) | |
download | ffmpeg-36d04801ba9d8622c2d759c172aea18561bac74d.tar.gz |
h264: move the scratch buffers into the per-slice context
Also change the method for allocating them. Instead of two possible
alloc calls from different places, just ensure they are allocated at the
start of each slice. This should be simpler and less bug-prone than the
previous method.
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index e441a81a77..e60d1fc349 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -381,8 +381,6 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp) continue; av_freep(&hx->top_borders[1]); av_freep(&hx->top_borders[0]); - av_freep(&hx->bipred_scratchpad); - av_freep(&hx->edge_emu_buffer); av_freep(&hx->dc_val_base); av_freep(&hx->er.mb_index2xy); av_freep(&hx->er.error_status_table); @@ -397,6 +395,16 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp) if (i) av_freep(&h->thread_context[i]); } + + for (i = 0; i < h->nb_slice_ctx; i++) { + H264SliceContext *sl = &h->slice_ctx[i]; + + av_freep(&sl->bipred_scratchpad); + av_freep(&sl->edge_emu_buffer); + + sl->bipred_scratchpad_allocated = 0; + sl->edge_emu_buffer_allocated = 0; + } } int ff_h264_alloc_tables(H264Context *h) |