Commit 9d0450ae authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'e9b2383b'

* commit 'e9b2383b':
  h264: move mb_mbaff into the per-slice context

Conflicts:
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_slice.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents d511dc65 e9b2383b
...@@ -90,7 +90,7 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, ...@@ -90,7 +90,7 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
fill_rectangle(&sl->ref_cache[0][scan8[0]], 4, 4, 8, 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, fill_rectangle(sl->mv_cache[0][scan8[0]], 4, 4, 8,
pack16to32((*mv)[0][0][0], (*mv)[0][0][1]), 4); pack16to32((*mv)[0][0][0], (*mv)[0][0][1]), 4);
h->mb_mbaff = sl->mb_mbaff =
sl->mb_field_decoding_flag = 0; sl->mb_field_decoding_flag = 0;
ff_h264_hl_decode_mb(h, &h->slice_ctx[0]); ff_h264_hl_decode_mb(h, &h->slice_ctx[0]);
} }
......
...@@ -402,6 +402,7 @@ typedef struct H264SliceContext { ...@@ -402,6 +402,7 @@ typedef struct H264SliceContext {
int is_complex; int is_complex;
int mb_field_decoding_flag; int mb_field_decoding_flag;
int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag
int redundant_pic_count; int redundant_pic_count;
...@@ -539,7 +540,6 @@ typedef struct H264Context { ...@@ -539,7 +540,6 @@ typedef struct H264Context {
// interlacing specific flags // interlacing specific flags
int mb_aff_frame; int mb_aff_frame;
int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag
int picture_structure; int picture_structure;
int first_field; int first_field;
......
...@@ -1933,7 +1933,7 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl) ...@@ -1933,7 +1933,7 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl)
h->cur_pic.mb_type[mb_xy] = MB_TYPE_SKIP; h->cur_pic.mb_type[mb_xy] = MB_TYPE_SKIP;
sl->next_mb_skipped = decode_cabac_mb_skip(h, sl, sl->mb_x, sl->mb_y+1 ); sl->next_mb_skipped = decode_cabac_mb_skip(h, sl, sl->mb_x, sl->mb_y+1 );
if(!sl->next_mb_skipped) if(!sl->next_mb_skipped)
h->mb_mbaff = sl->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl); sl->mb_mbaff = sl->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl);
} }
decode_mb_skip(h, sl); decode_mb_skip(h, sl);
...@@ -1948,7 +1948,7 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl) ...@@ -1948,7 +1948,7 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl)
} }
if (FRAME_MBAFF(h)) { if (FRAME_MBAFF(h)) {
if ((sl->mb_y & 1) == 0) if ((sl->mb_y & 1) == 0)
h->mb_mbaff = sl->mb_mbaff =
sl->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl); sl->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl);
} }
...@@ -2057,8 +2057,8 @@ decode_intra_mb: ...@@ -2057,8 +2057,8 @@ decode_intra_mb:
return 0; return 0;
} }
local_ref_count[0] = sl->ref_count[0] << MB_MBAFF(h); local_ref_count[0] = sl->ref_count[0] << MB_MBAFF(sl);
local_ref_count[1] = sl->ref_count[1] << MB_MBAFF(h); local_ref_count[1] = sl->ref_count[1] << MB_MBAFF(sl);
fill_decode_caches(h, sl, mb_type); fill_decode_caches(h, sl, mb_type);
......
...@@ -723,7 +723,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h, H264SliceContext *sl) ...@@ -723,7 +723,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h, H264SliceContext *sl)
if (sl->mb_skip_run--) { if (sl->mb_skip_run--) {
if (FRAME_MBAFF(h) && (sl->mb_y & 1) == 0) { if (FRAME_MBAFF(h) && (sl->mb_y & 1) == 0) {
if (sl->mb_skip_run == 0) if (sl->mb_skip_run == 0)
h->mb_mbaff = sl->mb_field_decoding_flag = get_bits1(&sl->gb); sl->mb_mbaff = sl->mb_field_decoding_flag = get_bits1(&sl->gb);
} }
decode_mb_skip(h, sl); decode_mb_skip(h, sl);
return 0; return 0;
...@@ -731,7 +731,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h, H264SliceContext *sl) ...@@ -731,7 +731,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h, H264SliceContext *sl)
} }
if (FRAME_MBAFF(h)) { if (FRAME_MBAFF(h)) {
if ((sl->mb_y & 1) == 0) if ((sl->mb_y & 1) == 0)
h->mb_mbaff = sl->mb_field_decoding_flag = get_bits1(&sl->gb); sl->mb_mbaff = sl->mb_field_decoding_flag = get_bits1(&sl->gb);
} }
sl->prev_mb_skipped = 0; sl->prev_mb_skipped = 0;
...@@ -794,8 +794,8 @@ decode_intra_mb: ...@@ -794,8 +794,8 @@ decode_intra_mb:
return 0; return 0;
} }
local_ref_count[0] = sl->ref_count[0] << MB_MBAFF(h); local_ref_count[0] = sl->ref_count[0] << MB_MBAFF(sl);
local_ref_count[1] = sl->ref_count[1] << MB_MBAFF(h); local_ref_count[1] = sl->ref_count[1] << MB_MBAFF(sl);
fill_decode_neighbors(h, sl, mb_type); fill_decode_neighbors(h, sl, mb_type);
fill_decode_caches(h, sl, mb_type); fill_decode_caches(h, sl, mb_type);
......
...@@ -173,7 +173,7 @@ static void await_references(const H264Context *h, H264SliceContext *sl) ...@@ -173,7 +173,7 @@ static void await_references(const H264Context *h, H264SliceContext *sl)
int ref_field_picture = ref_pic->field_picture; int ref_field_picture = ref_pic->field_picture;
int pic_height = 16 * h->mb_height >> ref_field_picture; int pic_height = 16 * h->mb_height >> ref_field_picture;
row <<= MB_MBAFF(h); row <<= MB_MBAFF(sl);
nrefs[list]--; nrefs[list]--;
if (!FIELD_PICTURE(h) && ref_field_picture) { // frame referencing two fields if (!FIELD_PICTURE(h) && ref_field_picture) { // frame referencing two fields
...@@ -520,10 +520,10 @@ static av_always_inline void xchg_mb_border(const H264Context *h, H264SliceConte ...@@ -520,10 +520,10 @@ static av_always_inline void xchg_mb_border(const H264Context *h, H264SliceConte
if (!simple && FRAME_MBAFF(h)) { if (!simple && FRAME_MBAFF(h)) {
if (sl->mb_y & 1) { if (sl->mb_y & 1) {
if (!MB_MBAFF(h)) if (!MB_MBAFF(sl))
return; return;
} else { } else {
top_idx = MB_MBAFF(h) ? 0 : 1; top_idx = MB_MBAFF(sl) ? 0 : 1;
} }
} }
......
...@@ -794,7 +794,7 @@ static av_always_inline void backup_mb_border(H264Context *h, H264SliceContext * ...@@ -794,7 +794,7 @@ static av_always_inline void backup_mb_border(H264Context *h, H264SliceContext *
if (!simple && FRAME_MBAFF(h)) { if (!simple && FRAME_MBAFF(h)) {
if (sl->mb_y & 1) { if (sl->mb_y & 1) {
if (!MB_MBAFF(h)) { if (!MB_MBAFF(sl)) {
top_border = h->top_borders[0][sl->mb_x]; top_border = h->top_borders[0][sl->mb_x];
AV_COPY128(top_border, src_y + 15 * linesize); AV_COPY128(top_border, src_y + 15 * linesize);
if (pixel_shift) if (pixel_shift)
...@@ -829,7 +829,7 @@ static av_always_inline void backup_mb_border(H264Context *h, H264SliceContext * ...@@ -829,7 +829,7 @@ static av_always_inline void backup_mb_border(H264Context *h, H264SliceContext *
} }
} }
} }
} else if (MB_MBAFF(h)) { } else if (MB_MBAFF(sl)) {
top_idx = 0; top_idx = 0;
} else } else
return; return;
...@@ -1513,7 +1513,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex ...@@ -1513,7 +1513,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex
} }
} }
h->mb_mbaff = 0; sl->mb_mbaff = 0;
h->mb_aff_frame = 0; h->mb_aff_frame = 0;
last_pic_structure = h0->picture_structure; last_pic_structure = h0->picture_structure;
last_pic_droppable = h0->droppable; last_pic_droppable = h0->droppable;
...@@ -2053,7 +2053,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h, ...@@ -2053,7 +2053,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
if (USES_LIST(top_type, list)) { if (USES_LIST(top_type, list)) {
const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride; const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
const int b8_xy = 4 * top_xy + 2; const int b8_xy = 4 * top_xy + 2;
int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2)); int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]); AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
ref_cache[0 - 1 * 8] = ref_cache[0 - 1 * 8] =
ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]]; ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];
...@@ -2068,7 +2068,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h, ...@@ -2068,7 +2068,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
if (USES_LIST(left_type[LTOP], list)) { if (USES_LIST(left_type[LTOP], list)) {
const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3; const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3;
const int b8_xy = 4 * left_xy[LTOP] + 1; const int b8_xy = 4 * left_xy[LTOP] + 1;
int (*ref2frm)[64] =(void*)( sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2)); int (*ref2frm)[64] =(void*)( sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]); AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]);
AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]); AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]);
AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]); AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]);
...@@ -2101,7 +2101,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h, ...@@ -2101,7 +2101,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
{ {
int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy]; int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy];
int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2)); int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101; uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101; uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
AV_WN32A(&ref_cache[0 * 8], ref01); AV_WN32A(&ref_cache[0 * 8], ref01);
...@@ -2287,7 +2287,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e ...@@ -2287,7 +2287,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e
sl->list_count = h->list_counts[mb_xy]; sl->list_count = h->list_counts[mb_xy];
if (FRAME_MBAFF(h)) if (FRAME_MBAFF(h))
h->mb_mbaff = sl->mb_mbaff =
sl->mb_field_decoding_flag = !!IS_INTERLACED(mb_type); sl->mb_field_decoding_flag = !!IS_INTERLACED(mb_type);
sl->mb_x = mb_x; sl->mb_x = mb_x;
...@@ -2344,7 +2344,7 @@ static void predict_field_decoding_flag(H264Context *h, H264SliceContext *sl) ...@@ -2344,7 +2344,7 @@ static void predict_field_decoding_flag(H264Context *h, H264SliceContext *sl)
h->cur_pic.mb_type[mb_xy - 1] : h->cur_pic.mb_type[mb_xy - 1] :
(h->slice_table[mb_xy - h->mb_stride] == sl->slice_num) ? (h->slice_table[mb_xy - h->mb_stride] == sl->slice_num) ?
h->cur_pic.mb_type[mb_xy - h->mb_stride] : 0; h->cur_pic.mb_type[mb_xy - h->mb_stride] : 0;
h->mb_mbaff = sl->mb_field_decoding_flag = IS_INTERLACED(mb_type) ? 1 : 0; sl->mb_mbaff = sl->mb_field_decoding_flag = IS_INTERLACED(mb_type) ? 1 : 0;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment