summaryrefslogtreecommitdiff
path: root/libavcodec/svq3.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-01-17 22:28:46 +0100
committerAnton Khirnov <anton@khirnov.net>2015-03-21 11:27:15 +0100
commit36d04801ba9d8622c2d759c172aea18561bac74d (patch)
tree24ad5e5b12360b0ba4b2498d79d0d2da930c911a /libavcodec/svq3.c
parent34d4c605e9a5116d5289b35633ade5b01cacab24 (diff)
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/svq3.c')
-rw-r--r--libavcodec/svq3.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 56b5fb40b9..d28b2d2f19 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -296,6 +296,7 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
int thirdpel, int dir, int avg)
{
H264Context *h = &s->h;
+ H264SliceContext *sl = &h->slice_ctx[0];
const H264Picture *pic = (dir == 0) ? s->last_pic : s->next_pic;
uint8_t *src, *dest;
int i, emu = 0;
@@ -316,11 +317,11 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
src = pic->f.data[0] + mx + my * h->linesize;
if (emu) {
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src,
+ h->vdsp.emulated_edge_mc(sl->edge_emu_buffer, src,
h->linesize, h->linesize,
width + 1, height + 1,
mx, my, s->h_edge_pos, s->v_edge_pos);
- src = h->edge_emu_buffer;
+ src = sl->edge_emu_buffer;
}
if (thirdpel)
(avg ? s->tdsp.avg_tpel_pixels_tab
@@ -343,12 +344,12 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
src = pic->f.data[i] + mx + my * h->uvlinesize;
if (emu) {
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src,
+ h->vdsp.emulated_edge_mc(sl->edge_emu_buffer, src,
h->uvlinesize, h->uvlinesize,
width + 1, height + 1,
mx, my, (s->h_edge_pos >> 1),
s->v_edge_pos >> 1);
- src = h->edge_emu_buffer;
+ src = sl->edge_emu_buffer;
}
if (thirdpel)
(avg ? s->tdsp.avg_tpel_pixels_tab
@@ -1060,6 +1061,7 @@ static int get_buffer(AVCodecContext *avctx, H264Picture *pic)
{
SVQ3Context *s = avctx->priv_data;
H264Context *h = &s->h;
+ H264SliceContext *sl = &h->slice_ctx[0];
const int big_mb_num = h->mb_stride * (h->mb_height + 1) + 1;
const int mb_array_size = h->mb_stride * h->mb_height;
const int b4_stride = h->mb_width * 4 + 1;
@@ -1093,9 +1095,9 @@ static int get_buffer(AVCodecContext *avctx, H264Picture *pic)
if (ret < 0)
goto fail;
- if (!h->edge_emu_buffer) {
- h->edge_emu_buffer = av_mallocz(pic->f.linesize[0] * 17);
- if (!h->edge_emu_buffer)
+ if (!sl->edge_emu_buffer) {
+ sl->edge_emu_buffer = av_mallocz(pic->f.linesize[0] * 17);
+ if (!sl->edge_emu_buffer)
return AVERROR(ENOMEM);
}