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 | 3178f4d33ff62243f7cdddb081db516ea34396c9 (patch) | |
tree | 37c25022b9333bb7e0d45543e3a55543c84d2ea5 /libavcodec/h264.c | |
parent | 582683b6ac798ed2a004a4e2121b7bd47892bbfd (diff) | |
download | ffmpeg-3178f4d33ff62243f7cdddb081db516ea34396c9.tar.gz |
h264: move rbsp_buffer into the per-slice context
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index df9d26fe44..8d213d765b 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -216,7 +216,8 @@ int ff_h264_check_intra_pred_mode(const H264Context *h, H264SliceContext *sl, return mode; } -const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, +const uint8_t *ff_h264_decode_nal(H264Context *h, H264SliceContext *sl, + const uint8_t *src, int *dst_length, int *consumed, int length) { int i, si, di; @@ -282,9 +283,9 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, return src; } - av_fast_malloc(&h->rbsp_buffer, &h->rbsp_buffer_size, + av_fast_malloc(&sl->rbsp_buffer, &sl->rbsp_buffer_size, length + FF_INPUT_BUFFER_PADDING_SIZE); - dst = h->rbsp_buffer; + dst = sl->rbsp_buffer; if (!dst) return NULL; @@ -380,10 +381,6 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp) if (!hx) continue; - if (free_rbsp) { - av_freep(&hx->rbsp_buffer); - hx->rbsp_buffer_size = 0; - } if (i) av_freep(&h->thread_context[i]); } @@ -405,6 +402,11 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp) sl->edge_emu_buffer_allocated = 0; sl->top_borders_allocated[0] = 0; sl->top_borders_allocated[1] = 0; + + if (free_rbsp) { + av_freep(&sl->rbsp_buffer); + sl->rbsp_buffer_size = 0; + } } } @@ -709,8 +711,6 @@ static int decode_init_thread_copy(AVCodecContext *avctx) h->slice_ctx[i].h264 = h; h->avctx = avctx; - h->rbsp_buffer = NULL; - h->rbsp_buffer_size = 0; h->context_initialized = 0; return 0; @@ -1385,7 +1385,7 @@ static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size) break; } - ptr = ff_h264_decode_nal(h, buf + buf_index, &dst_length, &consumed, + ptr = ff_h264_decode_nal(h, &h->slice_ctx[0], buf + buf_index, &dst_length, &consumed, next_avc - buf_index); if (!ptr || dst_length < 0) @@ -1471,7 +1471,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, hx = h->thread_context[context_count]; sl = &h->slice_ctx[context_count]; - ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length, + ptr = ff_h264_decode_nal(hx, sl, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); if (!ptr || dst_length < 0) { ret = -1; |