summaryrefslogtreecommitdiff
path: root/libavcodec/h264_mb_template.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-01-29 13:06:25 +0100
committerAnton Khirnov <anton@khirnov.net>2015-03-21 11:27:16 +0100
commitc28ed1d743443e783537d279ae721be3bbdf7646 (patch)
tree9d9177a0fb4622a085b87c8732078c37342b4bf0 /libavcodec/h264_mb_template.c
parentb53569e0681ff7bc99103ab4c961dbac3cc0fce6 (diff)
h264: move [uv]linesize to the per-slice context
While it is a per-frame variable, it is only really used in the low-level decoding code, so it is more efficient to store it in the slice context.
Diffstat (limited to 'libavcodec/h264_mb_template.c')
-rw-r--r--libavcodec/h264_mb_template.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/libavcodec/h264_mb_template.c b/libavcodec/h264_mb_template.c
index 94de31634c..75757a66a5 100644
--- a/libavcodec/h264_mb_template.c
+++ b/libavcodec/h264_mb_template.c
@@ -57,23 +57,23 @@ static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContex
const int block_h = 16 >> h->chroma_y_shift;
const int chroma422 = CHROMA422(h);
- dest_y = h->cur_pic.f.data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16;
- dest_cb = h->cur_pic.f.data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * h->uvlinesize * block_h;
- dest_cr = h->cur_pic.f.data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * h->uvlinesize * block_h;
+ dest_y = h->cur_pic.f.data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16;
+ dest_cb = h->cur_pic.f.data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
+ dest_cr = h->cur_pic.f.data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
- h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * h->linesize + (64 << PIXEL_SHIFT), h->linesize, 4);
- h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * h->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);
+ h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), sl->linesize, 4);
+ h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);
h->list_counts[mb_xy] = sl->list_count;
if (!SIMPLE && MB_FIELD(sl)) {
- linesize = sl->mb_linesize = h->linesize * 2;
- uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2;
+ linesize = sl->mb_linesize = sl->linesize * 2;
+ uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2;
block_offset = &h->block_offset[48];
if (mb_y & 1) { // FIXME move out of this function?
- dest_y -= h->linesize * 15;
- dest_cb -= h->uvlinesize * (block_h - 1);
- dest_cr -= h->uvlinesize * (block_h - 1);
+ dest_y -= sl->linesize * 15;
+ dest_cb -= sl->uvlinesize * (block_h - 1);
+ dest_cr -= sl->uvlinesize * (block_h - 1);
}
if (FRAME_MBAFF(h)) {
int list;
@@ -94,8 +94,8 @@ static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContex
}
}
} else {
- linesize = sl->mb_linesize = h->linesize;
- uvlinesize = sl->mb_uvlinesize = h->uvlinesize;
+ linesize = sl->mb_linesize = sl->linesize;
+ uvlinesize = sl->mb_uvlinesize = sl->uvlinesize;
// dct_offset = s->linesize * 16;
}
@@ -287,19 +287,19 @@ static av_noinline void FUNC(hl_decode_mb_444)(const H264Context *h, H264SliceCo
for (p = 0; p < plane_count; p++) {
dest[p] = h->cur_pic.f.data[p] +
- ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16;
- h->vdsp.prefetch(dest[p] + (sl->mb_x & 3) * 4 * h->linesize + (64 << PIXEL_SHIFT),
- h->linesize, 4);
+ ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16;
+ h->vdsp.prefetch(dest[p] + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT),
+ sl->linesize, 4);
}
h->list_counts[mb_xy] = sl->list_count;
if (!SIMPLE && MB_FIELD(sl)) {
- linesize = sl->mb_linesize = sl->mb_uvlinesize = h->linesize * 2;
+ linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize * 2;
block_offset = &h->block_offset[48];
if (mb_y & 1) // FIXME move out of this function?
for (p = 0; p < 3; p++)
- dest[p] -= h->linesize * 15;
+ dest[p] -= sl->linesize * 15;
if (FRAME_MBAFF(h)) {
int list;
for (list = 0; list < sl->list_count; list++) {
@@ -319,7 +319,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(const H264Context *h, H264SliceCo
}
}
} else {
- linesize = sl->mb_linesize = sl->mb_uvlinesize = h->linesize;
+ linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize;
}
if (!SIMPLE && IS_INTRA_PCM(mb_type)) {