aboutsummaryrefslogtreecommitdiffstats
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
commit0edbe6faa7ef80daf0e84353cbe733389bf1a522 (patch)
tree95ebe3620f648479a9baf11d15b43a34c6800f23
parent07c5ca551b7327d3c4e33738cc0cd2d5ac2779fa (diff)
downloadffmpeg-0edbe6faa7ef80daf0e84353cbe733389bf1a522.tar.gz
h264: move mb_xy into the per-slice context
-rw-r--r--libavcodec/h264.c4
-rw-r--r--libavcodec/h264.h14
-rw-r--r--libavcodec/h264_cabac.c10
-rw-r--r--libavcodec/h264_cavlc.c2
-rw-r--r--libavcodec/h264_direct.c4
-rw-r--r--libavcodec/h264_loopfilter.c2
-rw-r--r--libavcodec/h264_mb.c6
-rw-r--r--libavcodec/h264_mb_template.c4
-rw-r--r--libavcodec/h264_mc_template.c2
-rw-r--r--libavcodec/h264_mvpred.h4
-rw-r--r--libavcodec/h264_slice.c4
-rw-r--r--libavcodec/svq3.c8
12 files changed, 32 insertions, 32 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 554c3d1f94..39d026f225 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -60,7 +60,7 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
h->mb_x = mb_x;
h->mb_y = mb_y;
- h->mb_xy = mb_x + mb_y * h->mb_stride;
+ sl->mb_xy = mb_x + mb_y * h->mb_stride;
memset(sl->non_zero_count_cache, 0, sizeof(sl->non_zero_count_cache));
assert(ref >= 0);
/* FIXME: It is possible albeit uncommon that slice references
@@ -69,7 +69,7 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
* practice then correct remapping should be added. */
if (ref >= sl->ref_count[0])
ref = 0;
- fill_rectangle(&h->cur_pic.ref_index[0][4 * h->mb_xy],
+ fill_rectangle(&h->cur_pic.ref_index[0][4 * sl->mb_xy],
2, 2, 2, ref, 1);
fill_rectangle(&sl->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
fill_rectangle(sl->mv_cache[0][scan8[0]], 4, 4, 8,
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 0b29777f47..ce4e163809 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -356,6 +356,7 @@ typedef struct H264SliceContext {
ptrdiff_t mb_linesize; ///< may be equal to s->linesize or s->linesize * 2, for mbaff
ptrdiff_t mb_uvlinesize;
+ int mb_xy;
int mb_skip_run;
int is_complex;
@@ -531,7 +532,6 @@ typedef struct H264Context {
int mb_height, mb_width;
int mb_stride;
int mb_num;
- int mb_xy;
// =============================================================
// Things below are not used in the MB or more inner code
@@ -946,7 +946,7 @@ static av_always_inline int pred_intra_mode(H264Context *h,
static av_always_inline void write_back_intra_pred_mode(H264Context *h,
H264SliceContext *sl)
{
- int8_t *i4x4 = sl->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy];
+ int8_t *i4x4 = sl->intra4x4_pred_mode + h->mb2br_xy[sl->mb_xy];
int8_t *i4x4_cache = sl->intra4x4_pred_mode_cache;
AV_COPY32(i4x4, i4x4_cache + 4 + 8 * 4);
@@ -958,7 +958,7 @@ static av_always_inline void write_back_intra_pred_mode(H264Context *h,
static av_always_inline void write_back_non_zero_count(H264Context *h,
H264SliceContext *sl)
{
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
uint8_t *nnz = h->non_zero_count[mb_xy];
uint8_t *nnz_cache = sl->non_zero_count_cache;
@@ -992,8 +992,8 @@ static av_always_inline void write_back_motion_list(H264Context *h,
AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2);
AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3);
if (CABAC(h)) {
- uint8_t (*mvd_dst)[2] = &sl->mvd_table[list][FMO ? 8 * h->mb_xy
- : h->mb2br_xy[h->mb_xy]];
+ uint8_t (*mvd_dst)[2] = &sl->mvd_table[list][FMO ? 8 * sl->mb_xy
+ : h->mb2br_xy[sl->mb_xy]];
uint8_t(*mvd_src)[2] = &sl->mvd_cache[list][scan8[0]];
if (IS_SKIP(mb_type)) {
AV_ZERO128(mvd_dst);
@@ -1021,7 +1021,7 @@ static av_always_inline void write_back_motion(H264Context *h,
{
const int b_stride = h->b_stride;
const int b_xy = 4 * h->mb_x + 4 * h->mb_y * h->b_stride; // try mb2b(8)_xy
- const int b8_xy = 4 * h->mb_xy;
+ const int b8_xy = 4 * sl->mb_xy;
if (USES_LIST(mb_type, 0)) {
write_back_motion_list(h, sl, b_stride, b_xy, b8_xy, mb_type, 0);
@@ -1034,7 +1034,7 @@ static av_always_inline void write_back_motion(H264Context *h,
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && CABAC(h)) {
if (IS_8X8(mb_type)) {
- uint8_t *direct_table = &h->direct_table[4 * h->mb_xy];
+ uint8_t *direct_table = &h->direct_table[4 * sl->mb_xy];
direct_table[1] = sl->sub_mb_type[1] >> 1;
direct_table[2] = sl->sub_mb_type[2] >> 1;
direct_table[3] = sl->sub_mb_type[3] >> 1;
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index c029fd5df8..fb75ff0df5 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -1284,7 +1284,7 @@ void ff_h264_init_cabac_states(H264Context *h, H264SliceContext *sl)
static int decode_cabac_field_decoding_flag(H264Context *h, H264SliceContext *sl)
{
- const long mbb_xy = h->mb_xy - 2L*h->mb_stride;
+ const long mbb_xy = sl->mb_xy - 2L*h->mb_stride;
unsigned long ctx = 0;
@@ -1348,7 +1348,7 @@ static int decode_cabac_mb_skip(H264Context *h, H264SliceContext *sl,
}else
mbb_xy = mb_x + (mb_y-1)*h->mb_stride;
}else{
- int mb_xy = h->mb_xy;
+ int mb_xy = sl->mb_xy;
mba_xy = mb_xy - 1;
mbb_xy = mb_xy - (h->mb_stride << FIELD_PICTURE(h));
}
@@ -1693,9 +1693,9 @@ decode_cabac_residual_internal(H264Context *h, H264SliceContext *sl,
if( is_dc ) {
if( cat == 3 )
- h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX);
+ h->cbp_table[sl->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX);
else
- h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX);
+ h->cbp_table[sl->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX);
sl->non_zero_count_cache[scan8[n]] = coeff_count;
} else {
if( max_coeff == 64 )
@@ -1914,7 +1914,7 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl)
int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2;
const int pixel_shift = h->pixel_shift;
- mb_xy = h->mb_xy = h->mb_x + h->mb_y*h->mb_stride;
+ mb_xy = sl->mb_xy = h->mb_x + h->mb_y*h->mb_stride;
tprintf(h->avctx, "pic:%d mb:%d/%d\n", h->frame_num, h->mb_x, h->mb_y);
if (sl->slice_type_nos != AV_PICTURE_TYPE_I) {
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 0ef5dcfe4f..6b16d2ac31 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -703,7 +703,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h, H264SliceContext *sl)
int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2;
const int pixel_shift = h->pixel_shift;
- mb_xy = h->mb_xy = h->mb_x + h->mb_y*h->mb_stride;
+ mb_xy = sl->mb_xy = h->mb_x + h->mb_y*h->mb_stride;
tprintf(h->avctx, "pic:%d mb:%d/%d\n", h->frame_num, h->mb_x, h->mb_y);
cbp = 0; /* avoid warning. FIXME: find a solution without slowing
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
index 67d9faea78..136d8fa25e 100644
--- a/libavcodec/h264_direct.c
+++ b/libavcodec/h264_direct.c
@@ -179,7 +179,7 @@ static void pred_spatial_direct_motion(H264Context *const h, H264SliceContext *s
{
int b8_stride = 2;
int b4_stride = h->b_stride;
- int mb_xy = h->mb_xy, mb_y = h->mb_y;
+ int mb_xy = sl->mb_xy, mb_y = h->mb_y;
int mb_type_col[2];
const int16_t (*l1mv0)[2], (*l1mv1)[2];
const int8_t *l1ref0, *l1ref1;
@@ -465,7 +465,7 @@ static void pred_temp_direct_motion(H264Context *const h, H264SliceContext *sl,
{
int b8_stride = 2;
int b4_stride = h->b_stride;
- int mb_xy = h->mb_xy, mb_y = h->mb_y;
+ int mb_xy = sl->mb_xy, mb_y = h->mb_y;
int mb_type_col[2];
const int16_t (*l1mv0)[2], (*l1mv1)[2];
const int8_t *l1ref0, *l1ref1;
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index e62657c8a1..6569c28328 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -248,7 +248,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
int chroma444 = CHROMA444(h);
int chroma422 = CHROMA422(h);
- int mb_xy = h->mb_xy;
+ int mb_xy = sl->mb_xy;
int left_type = sl->left_type[LTOP];
int top_type = sl->top_type;
diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c
index 09d31ecfaf..6410bcb684 100644
--- a/libavcodec/h264_mb.c
+++ b/libavcodec/h264_mb.c
@@ -96,7 +96,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl,
*/
static void await_references(H264Context *h, H264SliceContext *sl)
{
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy];
int refs[2][48];
int nrefs[2] = { 0 };
@@ -524,7 +524,7 @@ static av_always_inline void xchg_mb_border(H264Context *h, H264SliceContext *sl
}
if (sl->deblocking_filter == 2) {
- deblock_topleft = h->slice_table[h->mb_xy - 1 - h->mb_stride] == sl->slice_num;
+ 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);
@@ -812,7 +812,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
void ff_h264_hl_decode_mb(H264Context *h, H264SliceContext *sl)
{
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy];
int is_complex = CONFIG_SMALL || sl->is_complex ||
IS_INTRA_PCM(mb_type) || sl->qscale == 0;
diff --git a/libavcodec/h264_mb_template.c b/libavcodec/h264_mb_template.c
index 8b907b4637..4eca679357 100644
--- a/libavcodec/h264_mb_template.c
+++ b/libavcodec/h264_mb_template.c
@@ -44,7 +44,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
{
const int mb_x = h->mb_x;
const int mb_y = h->mb_y;
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy];
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize /*dct_offset*/;
@@ -276,7 +276,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext
{
const int mb_x = h->mb_x;
const int mb_y = h->mb_y;
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy];
uint8_t *dest[3];
int linesize;
diff --git a/libavcodec/h264_mc_template.c b/libavcodec/h264_mc_template.c
index beee7111ed..575320a301 100644
--- a/libavcodec/h264_mc_template.c
+++ b/libavcodec/h264_mc_template.c
@@ -71,7 +71,7 @@ static void MCFUNC(hl_motion)(H264Context *h, H264SliceContext *sl,
h264_weight_func *weight_op,
h264_biweight_func *weight_avg)
{
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy];
assert(IS_INTER(mb_type));
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index e81c6e9d34..ca6323726f 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -355,7 +355,7 @@ zeromv:
static void fill_decode_neighbors(H264Context *h, H264SliceContext *sl, int mb_type)
{
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
int topleft_xy, top_xy, topright_xy, left_xy[LEFT_MBS];
static const uint8_t left_block_options[4][32] = {
{ 0, 1, 2, 3, 7, 10, 8, 11, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4, 1 + 4 * 4, 1 + 8 * 4, 1 + 5 * 4, 1 + 9 * 4 },
@@ -802,7 +802,7 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
*/
static void av_unused decode_mb_skip(H264Context *h, H264SliceContext *sl)
{
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
int mb_type = 0;
memset(h->non_zero_count[mb_xy], 0, 48);
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 1e233ad27e..64dae07a16 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1909,7 +1909,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
*/
static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
{
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
int top_xy, left_xy[LEFT_MBS];
int top_type, left_type[LEFT_MBS];
uint8_t *nnz;
@@ -2065,7 +2065,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e
for (mb_x = start_x; mb_x < end_x; mb_x++)
for (mb_y = end_mb_y - FRAME_MBAFF(h); mb_y <= end_mb_y; mb_y++) {
int mb_xy, mb_type;
- mb_xy = h->mb_xy = mb_x + mb_y * h->mb_stride;
+ mb_xy = sl->mb_xy = mb_x + mb_y * h->mb_stride;
sl->slice_num = h->slice_table[mb_xy];
mb_type = h->cur_pic.mb_type[mb_xy];
sl->list_count = h->list_counts[mb_xy];
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index cb418c6220..bd35942539 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -487,7 +487,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
int cbp = 0;
uint32_t vlc;
int8_t *top, *left;
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
const int b_xy = 4 * h->mb_x + 4 * h->mb_y * h->b_stride;
sl->top_samples_available = (h->mb_y == 0) ? 0x33FF : 0xFFFF;
@@ -775,7 +775,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
SVQ3Context *s = avctx->priv_data;
H264Context *h = &s->h;
H264SliceContext *sl = &h->slice_ctx[0];
- const int mb_xy = h->mb_xy;
+ const int mb_xy = sl->mb_xy;
int i, header;
unsigned slice_id;
@@ -1132,7 +1132,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
init_get_bits(&h->gb, buf, 8 * buf_size);
- h->mb_x = h->mb_y = h->mb_xy = 0;
+ h->mb_x = h->mb_y = sl->mb_xy = 0;
if (svq3_decode_slice_header(avctx))
return -1;
@@ -1248,7 +1248,7 @@ 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++) {
unsigned mb_type;
- h->mb_xy = h->mb_x + h->mb_y * h->mb_stride;
+ sl->mb_xy = h->mb_x + h->mb_y * h->mb_stride;
if ((get_bits_count(&h->gb) + 7) >= h->gb.size_in_bits &&
((get_bits_count(&h->gb) & 7) == 0 ||