summaryrefslogtreecommitdiff
path: root/libavcodec/h264_mb.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/h264_mb.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/h264_mb.c')
-rw-r--r--libavcodec/h264_mb.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c
index 31e372bc25..23aa684fcc 100644
--- a/libavcodec/h264_mb.c
+++ b/libavcodec/h264_mb.c
@@ -237,12 +237,12 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext
full_my < 0 - extra_height ||
full_mx + 16 /*FIXME*/ > pic_width + extra_width ||
full_my + 16 /*FIXME*/ > pic_height + extra_height) {
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer,
+ h->vdsp.emulated_edge_mc(sl->edge_emu_buffer,
src_y - (2 << pixel_shift) - 2 * sl->mb_linesize,
sl->mb_linesize, sl->mb_linesize,
16 + 5, 16 + 5 /*FIXME*/, full_mx - 2,
full_my - 2, pic_width, pic_height);
- src_y = h->edge_emu_buffer + (2 << pixel_shift) + 2 * sl->mb_linesize;
+ src_y = sl->edge_emu_buffer + (2 << pixel_shift) + 2 * sl->mb_linesize;
emu = 1;
}
@@ -256,13 +256,13 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext
if (chroma_idc == 3 /* yuv444 */) {
src_cb = pic->f.data[1] + offset;
if (emu) {
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer,
+ h->vdsp.emulated_edge_mc(sl->edge_emu_buffer,
src_cb - (2 << pixel_shift) - 2 * sl->mb_linesize,
sl->mb_linesize, sl->mb_linesize,
16 + 5, 16 + 5 /*FIXME*/,
full_mx - 2, full_my - 2,
pic_width, pic_height);
- src_cb = h->edge_emu_buffer + (2 << pixel_shift) + 2 * sl->mb_linesize;
+ src_cb = sl->edge_emu_buffer + (2 << pixel_shift) + 2 * sl->mb_linesize;
}
qpix_op[luma_xy](dest_cb, src_cb, sl->mb_linesize); // FIXME try variable height perhaps?
if (!square)
@@ -270,13 +270,13 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext
src_cr = pic->f.data[2] + offset;
if (emu) {
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer,
+ h->vdsp.emulated_edge_mc(sl->edge_emu_buffer,
src_cr - (2 << pixel_shift) - 2 * sl->mb_linesize,
sl->mb_linesize, sl->mb_linesize,
16 + 5, 16 + 5 /*FIXME*/,
full_mx - 2, full_my - 2,
pic_width, pic_height);
- src_cr = h->edge_emu_buffer + (2 << pixel_shift) + 2 * sl->mb_linesize;
+ src_cr = sl->edge_emu_buffer + (2 << pixel_shift) + 2 * sl->mb_linesize;
}
qpix_op[luma_xy](dest_cr, src_cr, sl->mb_linesize); // FIXME try variable height perhaps?
if (!square)
@@ -297,22 +297,22 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext
(my >> ysh) * sl->mb_uvlinesize;
if (emu) {
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cb,
+ h->vdsp.emulated_edge_mc(sl->edge_emu_buffer, src_cb,
sl->mb_uvlinesize, sl->mb_uvlinesize,
9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
- src_cb = h->edge_emu_buffer;
+ src_cb = sl->edge_emu_buffer;
}
chroma_op(dest_cb, src_cb, sl->mb_uvlinesize,
height >> (chroma_idc == 1 /* yuv420 */),
mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7);
if (emu) {
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cr,
+ h->vdsp.emulated_edge_mc(sl->edge_emu_buffer, src_cr,
sl->mb_uvlinesize, sl->mb_uvlinesize,
9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
- src_cr = h->edge_emu_buffer;
+ src_cr = sl->edge_emu_buffer;
}
chroma_op(dest_cr, src_cr, sl->mb_uvlinesize, height >> (chroma_idc == 1 /* yuv420 */),
mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7);
@@ -405,9 +405,9 @@ static av_always_inline void mc_part_weighted(const H264Context *h, H264SliceCon
if (list0 && list1) {
/* don't optimize for luma-only case, since B-frames usually
* use implicit weights => chroma too. */
- uint8_t *tmp_cb = h->bipred_scratchpad;
- uint8_t *tmp_cr = h->bipred_scratchpad + (16 << pixel_shift);
- uint8_t *tmp_y = h->bipred_scratchpad + 16 * sl->mb_uvlinesize;
+ uint8_t *tmp_cb = sl->bipred_scratchpad;
+ uint8_t *tmp_cr = sl->bipred_scratchpad + (16 << pixel_shift);
+ uint8_t *tmp_y = sl->bipred_scratchpad + 16 * sl->mb_uvlinesize;
int refn0 = sl->ref_cache[0][scan8[n]];
int refn1 = sl->ref_cache[1][scan8[n]];