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 | 582683b6ac798ed2a004a4e2121b7bd47892bbfd (patch) | |
tree | b2c477720584657ff3a336bc52a80c39c2722b24 /libavcodec/h264.c | |
parent | 5bc69f38c1af71fbcbfb4b5efa77d0aeb5424c04 (diff) | |
download | ffmpeg-582683b6ac798ed2a004a4e2121b7bd47892bbfd.tar.gz |
h264: move remaining ER stuff into the per-slice context
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 007ba2a6b0..df9d26fe44 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -379,10 +379,6 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp) hx = h->thread_context[i]; if (!hx) continue; - av_freep(&hx->dc_val_base); - av_freep(&hx->er.mb_index2xy); - av_freep(&hx->er.error_status_table); - av_freep(&hx->er.er_temp_buffer); if (free_rbsp) { av_freep(&hx->rbsp_buffer); @@ -395,6 +391,11 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp) for (i = 0; i < h->nb_slice_ctx; i++) { H264SliceContext *sl = &h->slice_ctx[i]; + av_freep(&sl->dc_val_base); + av_freep(&sl->er.mb_index2xy); + av_freep(&sl->er.error_status_table); + av_freep(&sl->er.er_temp_buffer); + av_freep(&sl->bipred_scratchpad); av_freep(&sl->edge_emu_buffer); av_freep(&sl->top_borders[0]); @@ -477,23 +478,21 @@ fail: * Init context * Allocate buffers which are not shared amongst multiple threads. */ -int ff_h264_context_init(H264Context *h) +int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl) { - ERContext *er = &h->er; + ERContext *er = &sl->er; int mb_array_size = h->mb_height * h->mb_stride; int y_size = (2 * h->mb_width + 1) * (2 * h->mb_height + 1); int c_size = h->mb_stride * (h->mb_height + 1); int yc_size = y_size + 2 * c_size; int x, y, i; - for (i = 0; i < h->nb_slice_ctx; i++) { - h->slice_ctx[i].ref_cache[0][scan8[5] + 1] = - h->slice_ctx[i].ref_cache[0][scan8[7] + 1] = - h->slice_ctx[i].ref_cache[0][scan8[13] + 1] = - h->slice_ctx[i].ref_cache[1][scan8[5] + 1] = - h->slice_ctx[i].ref_cache[1][scan8[7] + 1] = - h->slice_ctx[i].ref_cache[1][scan8[13] + 1] = PART_NOT_AVAILABLE; - } + sl->ref_cache[0][scan8[5] + 1] = + sl->ref_cache[0][scan8[7] + 1] = + sl->ref_cache[0][scan8[13] + 1] = + sl->ref_cache[1][scan8[5] + 1] = + sl->ref_cache[1][scan8[7] + 1] = + sl->ref_cache[1][scan8[13] + 1] = PART_NOT_AVAILABLE; if (CONFIG_ERROR_RESILIENCE) { /* init ER */ @@ -525,13 +524,13 @@ int ff_h264_context_init(H264Context *h) FF_ALLOC_OR_GOTO(h->avctx, er->er_temp_buffer, h->mb_height * h->mb_stride, fail); - FF_ALLOCZ_OR_GOTO(h->avctx, h->dc_val_base, + FF_ALLOCZ_OR_GOTO(h->avctx, sl->dc_val_base, yc_size * sizeof(int16_t), fail); - er->dc_val[0] = h->dc_val_base + h->mb_width * 2 + 2; - er->dc_val[1] = h->dc_val_base + y_size + h->mb_stride + 1; + er->dc_val[0] = sl->dc_val_base + h->mb_width * 2 + 2; + er->dc_val[1] = sl->dc_val_base + y_size + h->mb_stride + 1; er->dc_val[2] = er->dc_val[1] + c_size; for (i = 0; i < yc_size; i++) - h->dc_val_base[i] = 1024; + sl->dc_val_base[i] = 1024; } return 0; |