summaryrefslogtreecommitdiff
path: root/libavcodec/svq3.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-21 16:25:04 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-21 16:46:15 +0100
commitd76559fb5f529db5f14d304936cadebce902b68c (patch)
treecc7c6a35be33afc181a7a03749fdab72b693cd0c /libavcodec/svq3.c
parent668c65e7e73a21c86f43ffa1f79bf023fa44cbcd (diff)
parentd4d9068cdf8f4b2b87ae87a2ef880d243f77b977 (diff)
Merge commit 'd4d9068cdf8f4b2b87ae87a2ef880d243f77b977'
* commit 'd4d9068cdf8f4b2b87ae87a2ef880d243f77b977': h264: move mb_{x,y} into the per-slice context Conflicts: libavcodec/h264.c libavcodec/h264_cavlc.c libavcodec/h264_mb.c libavcodec/h264_slice.c libavcodec/svq3.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/svq3.c')
-rw-r--r--libavcodec/svq3.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 32a347b6c7..56befbfa7a 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -385,11 +385,11 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
for (i = 0; i < 16; i += part_height)
for (j = 0; j < 16; j += part_width) {
- const int b_xy = (4 * h->mb_x + (j >> 2)) +
- (4 * h->mb_y + (i >> 2)) * h->b_stride;
+ const int b_xy = (4 * sl->mb_x + (j >> 2)) +
+ (4 * sl->mb_y + (i >> 2)) * h->b_stride;
int dxy;
- x = 16 * h->mb_x + j;
- y = 16 * h->mb_y + i;
+ x = 16 * sl->mb_x + j;
+ y = 16 * sl->mb_y + i;
k = (j >> 2 & 1) + (i >> 1 & 2) +
(j >> 1 & 4) + (i & 8);
@@ -495,20 +495,20 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
uint32_t vlc;
int8_t *top, *left;
const int mb_xy = sl->mb_xy;
- const int b_xy = 4 * h->mb_x + 4 * h->mb_y * h->b_stride;
+ const int b_xy = 4 * sl->mb_x + 4 * sl->mb_y * h->b_stride;
- sl->top_samples_available = (h->mb_y == 0) ? 0x33FF : 0xFFFF;
- sl->left_samples_available = (h->mb_x == 0) ? 0x5F5F : 0xFFFF;
+ sl->top_samples_available = (sl->mb_y == 0) ? 0x33FF : 0xFFFF;
+ sl->left_samples_available = (sl->mb_x == 0) ? 0x5F5F : 0xFFFF;
sl->topright_samples_available = 0xFFFF;
if (mb_type == 0) { /* SKIP */
if (h->pict_type == AV_PICTURE_TYPE_P ||
s->next_pic->mb_type[mb_xy] == -1) {
- svq3_mc_dir_part(s, 16 * h->mb_x, 16 * h->mb_y, 16, 16,
+ svq3_mc_dir_part(s, 16 * sl->mb_x, 16 * sl->mb_y, 16, 16,
0, 0, 0, 0, 0, 0);
if (h->pict_type == AV_PICTURE_TYPE_B)
- svq3_mc_dir_part(s, 16 * h->mb_x, 16 * h->mb_y, 16, 16,
+ svq3_mc_dir_part(s, 16 * sl->mb_x, 16 * sl->mb_y, 16, 16,
0, 0, 0, 0, 1, 1);
mb_type = MB_TYPE_SKIP;
@@ -540,7 +540,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
*/
for (m = 0; m < 2; m++) {
- if (h->mb_x > 0 && sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1] + 6] != -1) {
+ if (sl->mb_x > 0 && sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1] + 6] != -1) {
for (i = 0; i < 4; i++)
AV_COPY32(sl->mv_cache[m][scan8[0] - 1 + i * 8],
h->cur_pic.motion_val[m][b_xy - 1 + i * h->b_stride]);
@@ -548,14 +548,14 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
for (i = 0; i < 4; i++)
AV_ZERO32(sl->mv_cache[m][scan8[0] - 1 + i * 8]);
}
- if (h->mb_y > 0) {
+ if (sl->mb_y > 0) {
memcpy(sl->mv_cache[m][scan8[0] - 1 * 8],
h->cur_pic.motion_val[m][b_xy - h->b_stride],
4 * 2 * sizeof(int16_t));
memset(&sl->ref_cache[m][scan8[0] - 1 * 8],
(sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - h->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
- if (h->mb_x < h->mb_width - 1) {
+ if (sl->mb_x < h->mb_width - 1) {
AV_COPY32(sl->mv_cache[m][scan8[0] + 4 - 1 * 8],
h->cur_pic.motion_val[m][b_xy - h->b_stride + 4]);
sl->ref_cache[m][scan8[0] + 4 - 1 * 8] =
@@ -563,7 +563,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - h->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1;
} else
sl->ref_cache[m][scan8[0] + 4 - 1 * 8] = PART_NOT_AVAILABLE;
- if (h->mb_x > 0) {
+ if (sl->mb_x > 0) {
AV_COPY32(sl->mv_cache[m][scan8[0] - 1 - 1 * 8],
h->cur_pic.motion_val[m][b_xy - h->b_stride - 1]);
sl->ref_cache[m][scan8[0] - 1 - 1 * 8] =
@@ -606,13 +606,13 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
memset(sl->intra4x4_pred_mode_cache, -1, 8 * 5 * sizeof(int8_t));
if (mb_type == 8) {
- if (h->mb_x > 0) {
+ if (sl->mb_x > 0) {
for (i = 0; i < 4; i++)
sl->intra4x4_pred_mode_cache[scan8[0] - 1 + i * 8] = sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1] + 6 - i];
if (sl->intra4x4_pred_mode_cache[scan8[0] - 1] == -1)
sl->left_samples_available = 0x5F5F;
}
- if (h->mb_y > 0) {
+ if (sl->mb_y > 0) {
sl->intra4x4_pred_mode_cache[4 + 8 * 0] = sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - h->mb_stride] + 0];
sl->intra4x4_pred_mode_cache[5 + 8 * 0] = sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - h->mb_stride] + 1];
sl->intra4x4_pred_mode_cache[6 + 8 * 0] = sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - h->mb_stride] + 2];
@@ -653,8 +653,8 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
if (mb_type == 8) {
ff_h264_check_intra4x4_pred_mode(h, sl);
- sl->top_samples_available = (h->mb_y == 0) ? 0x33FF : 0xFFFF;
- sl->left_samples_available = (h->mb_x == 0) ? 0x5F5F : 0xFFFF;
+ sl->top_samples_available = (sl->mb_y == 0) ? 0x33FF : 0xFFFF;
+ sl->left_samples_available = (sl->mb_x == 0) ? 0x5F5F : 0xFFFF;
} else {
for (i = 0; i < 4; i++)
memset(&sl->intra4x4_pred_mode_cache[scan8[0] + 8 * i], DC_128_PRED, 4);
@@ -829,7 +829,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
if ((header & 0x9F) == 2) {
i = (h->mb_num < 64) ? 6 : (1 + av_log2(h->mb_num - 1));
sl->mb_skip_run = get_bits(&h->gb, i) -
- (h->mb_y * h->mb_width + h->mb_x);
+ (sl->mb_y * h->mb_width + sl->mb_x);
} else {
skip_bits1(&h->gb);
sl->mb_skip_run = 0;
@@ -852,17 +852,17 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
/* reset intra predictors and invalidate motion vector references */
- if (h->mb_x > 0) {
+ if (sl->mb_x > 0) {
memset(sl->intra4x4_pred_mode + h->mb2br_xy[mb_xy - 1] + 3,
-1, 4 * sizeof(int8_t));
- memset(sl->intra4x4_pred_mode + h->mb2br_xy[mb_xy - h->mb_x],
- -1, 8 * sizeof(int8_t) * h->mb_x);
+ memset(sl->intra4x4_pred_mode + h->mb2br_xy[mb_xy - sl->mb_x],
+ -1, 8 * sizeof(int8_t) * sl->mb_x);
}
- if (h->mb_y > 0) {
+ if (sl->mb_y > 0) {
memset(sl->intra4x4_pred_mode + h->mb2br_xy[mb_xy - h->mb_stride],
- -1, 8 * sizeof(int8_t) * (h->mb_width - h->mb_x));
+ -1, 8 * sizeof(int8_t) * (h->mb_width - sl->mb_x));
- if (h->mb_x > 0)
+ if (sl->mb_x > 0)
sl->intra4x4_pred_mode[h->mb2br_xy[mb_xy - h->mb_stride - 1] + 3] = -1;
}
@@ -1153,7 +1153,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
return 0;
}
- h->mb_x = h->mb_y = sl->mb_xy = 0;
+ sl->mb_x = sl->mb_y = sl->mb_xy = 0;
if (s->watermark_key) {
av_fast_padded_malloc(&s->buf, &s->buf_size, buf_size);
@@ -1280,10 +1280,10 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
}
}
- for (h->mb_y = 0; h->mb_y < h->mb_height; h->mb_y++) {
- for (h->mb_x = 0; h->mb_x < h->mb_width; h->mb_x++) {
+ for (sl->mb_y = 0; sl->mb_y < h->mb_height; sl->mb_y++) {
+ for (sl->mb_x = 0; sl->mb_x < h->mb_width; sl->mb_x++) {
unsigned mb_type;
- sl->mb_xy = h->mb_x + h->mb_y * h->mb_stride;
+ sl->mb_xy = sl->mb_x + sl->mb_y * h->mb_stride;
if ((get_bits_count(&h->gb) + 7) >= h->gb.size_in_bits &&
((get_bits_count(&h->gb) & 7) == 0 ||
@@ -1305,7 +1305,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
mb_type += 4;
if (mb_type > 33 || svq3_decode_mb(s, mb_type)) {
av_log(h->avctx, AV_LOG_ERROR,
- "error while decoding MB %d %d\n", h->mb_x, h->mb_y);
+ "error while decoding MB %d %d\n", sl->mb_x, sl->mb_y);
return -1;
}
@@ -1313,20 +1313,20 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
ff_h264_hl_decode_mb(h, &h->slice_ctx[0]);
if (h->pict_type != AV_PICTURE_TYPE_B && !h->low_delay)
- h->cur_pic.mb_type[h->mb_x + h->mb_y * h->mb_stride] =
+ h->cur_pic.mb_type[sl->mb_x + sl->mb_y * h->mb_stride] =
(h->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;
}
ff_draw_horiz_band(avctx, &s->cur_pic->f,
s->last_pic->f.data[0] ? &s->last_pic->f : NULL,
- 16 * h->mb_y, 16, h->picture_structure, 0,
+ 16 * sl->mb_y, 16, h->picture_structure, 0,
h->low_delay);
}
left = buf_size*8 - get_bits_count(&h->gb);
- if (h->mb_y != h->mb_height || h->mb_x != h->mb_width) {
- av_log(avctx, AV_LOG_INFO, "frame num %d incomplete pic x %d y %d left %d\n", avctx->frame_number, h->mb_y, h->mb_x, left);
+ if (sl->mb_y != h->mb_height || sl->mb_x != h->mb_width) {
+ av_log(avctx, AV_LOG_INFO, "frame num %d incomplete pic x %d y %d left %d\n", avctx->frame_number, sl->mb_y, sl->mb_x, left);
//av_hex_dump(stderr, buf+buf_size-8, 8);
}