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:14 +0100
commitd4d9068cdf8f4b2b87ae87a2ef880d243f77b977 (patch)
tree2ede3f693c54ca02c41d90549295fe5868f55b54 /libavcodec/h264_mb.c
parent0edbe6faa7ef80daf0e84353cbe733389bf1a522 (diff)
h264: move mb_{x,y} into the per-slice context
Diffstat (limited to 'libavcodec/h264_mb.c')
-rw-r--r--libavcodec/h264_mb.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c
index 6410bcb684..a9ea97c73a 100644
--- a/libavcodec/h264_mb.c
+++ b/libavcodec/h264_mb.c
@@ -57,7 +57,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl,
{
int my;
- y_offset += 16 * (h->mb_y >> MB_FIELD(h));
+ y_offset += 16 * (sl->mb_y >> MB_FIELD(h));
if (list0) {
int ref_n = sl->ref_cache[0][scan8[n]];
@@ -287,7 +287,7 @@ static av_always_inline void mc_dir_part(H264Context *h, H264SliceContext *sl,
ysh = 3 - (chroma_idc == 2 /* yuv422 */);
if (chroma_idc == 1 /* yuv420 */ && MB_FIELD(h)) {
// chroma offset when predicting from a field of opposite parity
- my += 2 * ((h->mb_y & 1) - (pic->reference - 1));
+ my += 2 * ((sl->mb_y & 1) - (pic->reference - 1));
emu |= (my >> 3) < 0 || (my >> 3) + 8 >= (pic_height >> 1);
}
@@ -345,8 +345,8 @@ static av_always_inline void mc_part_std(H264Context *h, H264SliceContext *sl,
dest_cb += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize;
dest_cr += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize;
}
- x_offset += 8 * h->mb_x;
- y_offset += 8 * (h->mb_y >> MB_FIELD(h));
+ x_offset += 8 * sl->mb_x;
+ y_offset += 8 * (sl->mb_y >> MB_FIELD(h));
if (list0) {
H264Picture *ref = &sl->ref_list[0][sl->ref_cache[0][scan8[n]]];
@@ -399,8 +399,8 @@ static av_always_inline void mc_part_weighted(H264Context *h, H264SliceContext *
dest_cb += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize;
dest_cr += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize;
}
- x_offset += 8 * h->mb_x;
- y_offset += 8 * (h->mb_y >> MB_FIELD(h));
+ x_offset += 8 * sl->mb_x;
+ y_offset += 8 * (sl->mb_y >> MB_FIELD(h));
if (list0 && list1) {
/* don't optimize for luma-only case, since B-frames usually
@@ -421,7 +421,7 @@ static av_always_inline void mc_part_weighted(H264Context *h, H264SliceContext *
pixel_shift, chroma_idc);
if (sl->use_weight == 2) {
- int weight0 = sl->implicit_weight[refn0][refn1][h->mb_y & 1];
+ int weight0 = sl->implicit_weight[refn0][refn1][sl->mb_y & 1];
int weight1 = 64 - weight0;
luma_weight_avg(dest_y, tmp_y, sl->mb_linesize,
height, 5, weight0, weight1, 0);
@@ -482,11 +482,11 @@ static av_always_inline void prefetch_motion(H264Context *h, H264SliceContext *s
* optimized for 64byte cache lines */
const int refn = sl->ref_cache[list][scan8[0]];
if (refn >= 0) {
- const int mx = (sl->mv_cache[list][scan8[0]][0] >> 2) + 16 * h->mb_x + 8;
- const int my = (sl->mv_cache[list][scan8[0]][1] >> 2) + 16 * h->mb_y;
+ const int mx = (sl->mv_cache[list][scan8[0]][0] >> 2) + 16 * sl->mb_x + 8;
+ const int my = (sl->mv_cache[list][scan8[0]][1] >> 2) + 16 * sl->mb_y;
uint8_t **src = sl->ref_list[list][refn].f.data;
int off = (mx << pixel_shift) +
- (my + (h->mb_x & 3) * 4) * sl->mb_linesize +
+ (my + (sl->mb_x & 3) * 4) * sl->mb_linesize +
(64 << pixel_shift);
h->vdsp.prefetch(src[0] + off, h->linesize, 4);
if (chroma_idc == 3 /* yuv444 */) {
@@ -494,7 +494,7 @@ static av_always_inline void prefetch_motion(H264Context *h, H264SliceContext *s
h->vdsp.prefetch(src[2] + off, h->linesize, 4);
} else {
off = ((mx >> 1) << pixel_shift) +
- ((my >> 1) + (h->mb_x & 7)) * h->uvlinesize +
+ ((my >> 1) + (sl->mb_x & 7)) * h->uvlinesize +
(64 << pixel_shift);
h->vdsp.prefetch(src[1] + off, src[2] - src[1], 2);
}
@@ -515,7 +515,7 @@ static av_always_inline void xchg_mb_border(H264Context *h, H264SliceContext *sl
uint8_t *top_border;
if (!simple && FRAME_MBAFF(h)) {
- if (h->mb_y & 1) {
+ if (sl->mb_y & 1) {
if (!MB_MBAFF(h))
return;
} else {
@@ -527,16 +527,16 @@ static av_always_inline void xchg_mb_border(H264Context *h, H264SliceContext *sl
deblock_topleft = h->slice_table[sl->mb_xy - 1 - h->mb_stride] == sl->slice_num;
deblock_top = sl->top_type;
} else {
- deblock_topleft = (h->mb_x > 0);
- deblock_top = (h->mb_y > !!MB_FIELD(h));
+ deblock_topleft = (sl->mb_x > 0);
+ deblock_top = (sl->mb_y > !!MB_FIELD(h));
}
src_y -= linesize + 1 + pixel_shift;
src_cb -= uvlinesize + 1 + pixel_shift;
src_cr -= uvlinesize + 1 + pixel_shift;
- top_border_m1 = h->top_borders[top_idx][h->mb_x - 1];
- top_border = h->top_borders[top_idx][h->mb_x];
+ top_border_m1 = h->top_borders[top_idx][sl->mb_x - 1];
+ top_border = h->top_borders[top_idx][sl->mb_x];
#define XCHG(a, b, xchg) \
if (pixel_shift) { \
@@ -558,8 +558,8 @@ static av_always_inline void xchg_mb_border(H264Context *h, H264SliceContext *sl
}
XCHG(top_border + (0 << pixel_shift), src_y + (1 << pixel_shift), xchg);
XCHG(top_border + (8 << pixel_shift), src_y + (9 << pixel_shift), 1);
- if (h->mb_x + 1 < h->mb_width) {
- XCHG(h->top_borders[top_idx][h->mb_x + 1],
+ if (sl->mb_x + 1 < h->mb_width) {
+ XCHG(h->top_borders[top_idx][sl->mb_x + 1],
src_y + (17 << pixel_shift), 1);
}
}
@@ -574,9 +574,9 @@ static av_always_inline void xchg_mb_border(H264Context *h, H264SliceContext *sl
XCHG(top_border + (24 << pixel_shift), src_cb + (9 << pixel_shift), 1);
XCHG(top_border + (32 << pixel_shift), src_cr + (1 << pixel_shift), xchg);
XCHG(top_border + (40 << pixel_shift), src_cr + (9 << pixel_shift), 1);
- if (h->mb_x + 1 < h->mb_width) {
- XCHG(h->top_borders[top_idx][h->mb_x + 1] + (16 << pixel_shift), src_cb + (17 << pixel_shift), 1);
- XCHG(h->top_borders[top_idx][h->mb_x + 1] + (32 << pixel_shift), src_cr + (17 << pixel_shift), 1);
+ if (sl->mb_x + 1 < h->mb_width) {
+ XCHG(h->top_borders[top_idx][sl->mb_x + 1] + (16 << pixel_shift), src_cb + (17 << pixel_shift), 1);
+ XCHG(h->top_borders[top_idx][sl->mb_x + 1] + (32 << pixel_shift), src_cr + (17 << pixel_shift), 1);
}
}
} else {
@@ -671,7 +671,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
uint64_t tr_high;
if (dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED) {
const int topright_avail = (sl->topright_samples_available << i) & 0x8000;
- assert(h->mb_y || linesize <= block_offset[i]);
+ assert(sl->mb_y || linesize <= block_offset[i]);
if (!topright_avail) {
if (pixel_shift) {
tr_high = ((uint16_t *)ptr)[3 - linesize / 2] * 0x0001000100010001ULL;