summaryrefslogtreecommitdiff
path: root/libavcodec/h264_mc_template.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-01-17 18:45:29 +0100
committerAnton Khirnov <anton@khirnov.net>2015-03-21 11:27:09 +0100
commit92c6c2a605f9b077b8fbc25b7ed6625541232b87 (patch)
tree51e89e9a2492a69f9364daaf4d63b0ba31f04e56 /libavcodec/h264_mc_template.c
parentd8a45d2d49f54fde042b195f9d5859251252493d (diff)
h264: split weighted pred-related vars into per-slice context
Diffstat (limited to 'libavcodec/h264_mc_template.c')
-rw-r--r--libavcodec/h264_mc_template.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/libavcodec/h264_mc_template.c b/libavcodec/h264_mc_template.c
index c085cc35d7..0e58eb3a87 100644
--- a/libavcodec/h264_mc_template.c
+++ b/libavcodec/h264_mc_template.c
@@ -34,7 +34,8 @@
#undef mc_part
#define mc_part MCFUNC(mc_part)
-static void mc_part(H264Context *h, int n, int square,
+static void mc_part(H264Context *h, H264SliceContext *sl,
+ int n, int square,
int height, int delta,
uint8_t *dest_y, uint8_t *dest_cb,
uint8_t *dest_cr,
@@ -47,10 +48,10 @@ static void mc_part(H264Context *h, int n, int square,
h264_biweight_func *weight_avg,
int list0, int list1)
{
- if ((h->use_weight == 2 && list0 && list1 &&
- (h->implicit_weight[h->ref_cache[0][scan8[n]]][h->ref_cache[1][scan8[n]]][h->mb_y & 1] != 32)) ||
- h->use_weight == 1)
- mc_part_weighted(h, n, square, height, delta, dest_y, dest_cb, dest_cr,
+ if ((sl->use_weight == 2 && list0 && list1 &&
+ (sl->implicit_weight[h->ref_cache[0][scan8[n]]][h->ref_cache[1][scan8[n]]][h->mb_y & 1] != 32)) ||
+ sl->use_weight == 1)
+ mc_part_weighted(h, sl, n, square, height, delta, dest_y, dest_cb, dest_cr,
x_offset, y_offset, qpix_put, chroma_put,
weight_op[0], weight_op[1], weight_avg[0],
weight_avg[1], list0, list1, PIXEL_SHIFT, CHROMA_IDC);
@@ -60,7 +61,8 @@ static void mc_part(H264Context *h, int n, int square,
chroma_avg, list0, list1, PIXEL_SHIFT, CHROMA_IDC);
}
-static void MCFUNC(hl_motion)(H264Context *h, uint8_t *dest_y,
+static void MCFUNC(hl_motion)(H264Context *h, H264SliceContext *sl,
+ uint8_t *dest_y,
uint8_t *dest_cb, uint8_t *dest_cr,
qpel_mc_func(*qpix_put)[16],
h264_chroma_mc_func(*chroma_put),
@@ -79,25 +81,25 @@ static void MCFUNC(hl_motion)(H264Context *h, uint8_t *dest_y,
prefetch_motion(h, 0, PIXEL_SHIFT, CHROMA_IDC);
if (IS_16X16(mb_type)) {
- mc_part(h, 0, 1, 16, 0, dest_y, dest_cb, dest_cr, 0, 0,
+ mc_part(h, sl, 0, 1, 16, 0, dest_y, dest_cb, dest_cr, 0, 0,
qpix_put[0], chroma_put[0], qpix_avg[0], chroma_avg[0],
weight_op, weight_avg,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
} else if (IS_16X8(mb_type)) {
- mc_part(h, 0, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 0,
+ mc_part(h, sl, 0, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 0,
qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
weight_op, weight_avg,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
- mc_part(h, 8, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 4,
+ mc_part(h, sl, 8, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 4,
qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
weight_op, weight_avg,
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
} else if (IS_8X16(mb_type)) {
- mc_part(h, 0, 0, 16, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,
+ mc_part(h, sl, 0, 0, 16, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,
qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
&weight_op[1], &weight_avg[1],
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
- mc_part(h, 4, 0, 16, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,
+ mc_part(h, sl, 4, 0, 16, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,
qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
&weight_op[1], &weight_avg[1],
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
@@ -113,29 +115,29 @@ static void MCFUNC(hl_motion)(H264Context *h, uint8_t *dest_y,
int y_offset = (i & 2) << 1;
if (IS_SUB_8X8(sub_mb_type)) {
- mc_part(h, n, 1, 8, 0, dest_y, dest_cb, dest_cr,
+ mc_part(h, sl, n, 1, 8, 0, dest_y, dest_cb, dest_cr,
x_offset, y_offset,
qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
&weight_op[1], &weight_avg[1],
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
} else if (IS_SUB_8X4(sub_mb_type)) {
- mc_part(h, n, 0, 4, 4 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr,
+ mc_part(h, sl, n, 0, 4, 4 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr,
x_offset, y_offset,
qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
&weight_op[1], &weight_avg[1],
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
- mc_part(h, n + 2, 0, 4, 4 << PIXEL_SHIFT,
+ mc_part(h, sl, n + 2, 0, 4, 4 << PIXEL_SHIFT,
dest_y, dest_cb, dest_cr, x_offset, y_offset + 2,
qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
&weight_op[1], &weight_avg[1],
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
} else if (IS_SUB_4X8(sub_mb_type)) {
- mc_part(h, n, 0, 8, 4 * h->mb_linesize,
+ mc_part(h, sl, n, 0, 8, 4 * h->mb_linesize,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
&weight_op[2], &weight_avg[2],
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
- mc_part(h, n + 1, 0, 8, 4 * h->mb_linesize,
+ mc_part(h, sl, n + 1, 0, 8, 4 * h->mb_linesize,
dest_y, dest_cb, dest_cr, x_offset + 2, y_offset,
qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
&weight_op[2], &weight_avg[2],
@@ -146,7 +148,7 @@ static void MCFUNC(hl_motion)(H264Context *h, uint8_t *dest_y,
for (j = 0; j < 4; j++) {
int sub_x_offset = x_offset + 2 * (j & 1);
int sub_y_offset = y_offset + (j & 2);
- mc_part(h, n + j, 1, 4, 0,
+ mc_part(h, sl, n + j, 1, 4, 0,
dest_y, dest_cb, dest_cr, sub_x_offset, sub_y_offset,
qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
&weight_op[2], &weight_avg[2],