Commit d511dc65 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'bc98e8c0'

* commit 'bc98e8c0':
  h264: move mb_field_decoding_flag into the per-slice context

Conflicts:
	libavcodec/h264_slice.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents a0b39747 bc98e8c0
...@@ -91,7 +91,7 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, ...@@ -91,7 +91,7 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
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 = h->mb_mbaff =
h->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]);
} }
......
...@@ -401,6 +401,8 @@ typedef struct H264SliceContext { ...@@ -401,6 +401,8 @@ typedef struct H264SliceContext {
int mb_skip_run; int mb_skip_run;
int is_complex; int is_complex;
int mb_field_decoding_flag;
int redundant_pic_count; int redundant_pic_count;
/** /**
...@@ -537,7 +539,6 @@ typedef struct H264Context { ...@@ -537,7 +539,6 @@ typedef struct H264Context {
// interlacing specific flags // interlacing specific flags
int mb_aff_frame; int mb_aff_frame;
int mb_field_decoding_flag;
int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag
int picture_structure; int picture_structure;
int first_field; int first_field;
......
...@@ -1288,7 +1288,7 @@ static int decode_cabac_field_decoding_flag(H264Context *h, H264SliceContext *sl ...@@ -1288,7 +1288,7 @@ static int decode_cabac_field_decoding_flag(H264Context *h, H264SliceContext *sl
unsigned long ctx = 0; unsigned long ctx = 0;
ctx += h->mb_field_decoding_flag & !!sl->mb_x; //for FMO:(s->current_picture.mb_type[mba_xy] >> 7) & (h->slice_table[mba_xy] == h->slice_num); ctx += sl->mb_field_decoding_flag & !!sl->mb_x; //for FMO:(s->current_picture.mb_type[mba_xy] >> 7) & (h->slice_table[mba_xy] == h->slice_num);
ctx += (h->cur_pic.mb_type[mbb_xy] >> 7) & (h->slice_table[mbb_xy] == sl->slice_num); ctx += (h->cur_pic.mb_type[mbb_xy] >> 7) & (h->slice_table[mbb_xy] == sl->slice_num);
return get_cabac_noinline( &sl->cabac, &(sl->cabac_state+70)[ctx] ); return get_cabac_noinline( &sl->cabac, &(sl->cabac_state+70)[ctx] );
...@@ -1337,9 +1337,9 @@ static int decode_cabac_mb_skip(H264Context *h, H264SliceContext *sl, ...@@ -1337,9 +1337,9 @@ static int decode_cabac_mb_skip(H264Context *h, H264SliceContext *sl,
mba_xy = mb_xy - 1; mba_xy = mb_xy - 1;
if( (mb_y&1) if( (mb_y&1)
&& h->slice_table[mba_xy] == sl->slice_num && h->slice_table[mba_xy] == sl->slice_num
&& MB_FIELD(h) == !!IS_INTERLACED( h->cur_pic.mb_type[mba_xy] ) ) && MB_FIELD(sl) == !!IS_INTERLACED( h->cur_pic.mb_type[mba_xy] ) )
mba_xy += h->mb_stride; mba_xy += h->mb_stride;
if (MB_FIELD(h)) { if (MB_FIELD(sl)) {
mbb_xy = mb_xy - h->mb_stride; mbb_xy = mb_xy - h->mb_stride;
if( !(mb_y&1) if( !(mb_y&1)
&& h->slice_table[mbb_xy] == sl->slice_num && h->slice_table[mbb_xy] == sl->slice_num
...@@ -1648,9 +1648,9 @@ decode_cabac_residual_internal(H264Context *h, H264SliceContext *sl, ...@@ -1648,9 +1648,9 @@ decode_cabac_residual_internal(H264Context *h, H264SliceContext *sl,
#endif #endif
significant_coeff_ctx_base = sl->cabac_state significant_coeff_ctx_base = sl->cabac_state
+ significant_coeff_flag_offset[MB_FIELD(h)][cat]; + significant_coeff_flag_offset[MB_FIELD(sl)][cat];
last_coeff_ctx_base = sl->cabac_state last_coeff_ctx_base = sl->cabac_state
+ last_coeff_flag_offset[MB_FIELD(h)][cat]; + last_coeff_flag_offset[MB_FIELD(sl)][cat];
abs_level_m1_ctx_base = sl->cabac_state abs_level_m1_ctx_base = sl->cabac_state
+ coeff_abs_level_m1_offset[cat]; + coeff_abs_level_m1_offset[cat];
...@@ -1670,7 +1670,7 @@ decode_cabac_residual_internal(H264Context *h, H264SliceContext *sl, ...@@ -1670,7 +1670,7 @@ decode_cabac_residual_internal(H264Context *h, H264SliceContext *sl,
if( last == max_coeff -1 ) {\ if( last == max_coeff -1 ) {\
index[coeff_count++] = last;\ index[coeff_count++] = last;\
} }
const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD(h)]; const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD(sl)];
#ifdef decode_significance #ifdef decode_significance
coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index, coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index,
last_coeff_ctx_base, sig_off); last_coeff_ctx_base, sig_off);
...@@ -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 = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl); h->mb_mbaff = sl->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl);
} }
decode_mb_skip(h, sl); decode_mb_skip(h, sl);
...@@ -1949,12 +1949,12 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl) ...@@ -1949,12 +1949,12 @@ 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 = h->mb_mbaff =
h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl); sl->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h, sl);
} }
sl->prev_mb_skipped = 0; sl->prev_mb_skipped = 0;
fill_decode_neighbors(h, sl, -(MB_FIELD(h))); fill_decode_neighbors(h, sl, -(MB_FIELD(sl)));
if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
int ctx = 0; int ctx = 0;
...@@ -2018,7 +2018,7 @@ decode_intra_mb: ...@@ -2018,7 +2018,7 @@ decode_intra_mb:
sl->intra16x16_pred_mode = i_mb_type_info[mb_type].pred_mode; sl->intra16x16_pred_mode = i_mb_type_info[mb_type].pred_mode;
mb_type= i_mb_type_info[mb_type].type; mb_type= i_mb_type_info[mb_type].type;
} }
if(MB_FIELD(h)) if (MB_FIELD(sl))
mb_type |= MB_TYPE_INTERLACED; mb_type |= MB_TYPE_INTERLACED;
h->slice_table[mb_xy] = sl->slice_num; h->slice_table[mb_xy] = sl->slice_num;
......
...@@ -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 = h->mb_field_decoding_flag = get_bits1(&sl->gb); h->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 = h->mb_field_decoding_flag = get_bits1(&sl->gb); h->mb_mbaff = sl->mb_field_decoding_flag = get_bits1(&sl->gb);
} }
sl->prev_mb_skipped = 0; sl->prev_mb_skipped = 0;
...@@ -768,7 +768,7 @@ decode_intra_mb: ...@@ -768,7 +768,7 @@ decode_intra_mb:
mb_type= i_mb_type_info[mb_type].type; mb_type= i_mb_type_info[mb_type].type;
} }
if(MB_FIELD(h)) if (MB_FIELD(sl))
mb_type |= MB_TYPE_INTERLACED; mb_type |= MB_TYPE_INTERLACED;
h->slice_table[mb_xy] = sl->slice_num; h->slice_table[mb_xy] = sl->slice_num;
......
...@@ -757,9 +757,9 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl, ...@@ -757,9 +757,9 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
{3+4*0, 3+4*1, 3+4*2, 3+4*3, 3+4*0, 3+4*1, 3+4*2, 3+4*3}, {3+4*0, 3+4*1, 3+4*2, 3+4*3, 3+4*0, 3+4*1, 3+4*2, 3+4*3},
} }
}; };
const uint8_t *off= offset[MB_FIELD(h)][mb_y&1]; const uint8_t *off= offset[MB_FIELD(sl)][mb_y&1];
for( i = 0; i < 8; i++ ) { for( i = 0; i < 8; i++ ) {
int j= MB_FIELD(h) ? i>>2 : i&1; int j= MB_FIELD(sl) ? i>>2 : i&1;
int mbn_xy = sl->left_mb_xy[LEFT(j)]; int mbn_xy = sl->left_mb_xy[LEFT(j)];
int mbn_type = sl->left_type[LEFT(j)]; int mbn_type = sl->left_type[LEFT(j)];
...@@ -768,7 +768,7 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl, ...@@ -768,7 +768,7 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
else{ else{
bS[i] = 1 + !!(sl->non_zero_count_cache[12+8*(i>>1)] | bS[i] = 1 + !!(sl->non_zero_count_cache[12+8*(i>>1)] |
((!h->pps.cabac && IS_8x8DCT(mbn_type)) ? ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?
(h->cbp_table[mbn_xy] & (((MB_FIELD(h) ? (i&2) : (mb_y&1)) ? 8 : 2) << 12)) (h->cbp_table[mbn_xy] & (((MB_FIELD(sl) ? (i&2) : (mb_y&1)) ? 8 : 2) << 12))
: :
h->non_zero_count[mbn_xy][ off[i] ])); h->non_zero_count[mbn_xy][ off[i] ]));
} }
...@@ -792,7 +792,7 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl, ...@@ -792,7 +792,7 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
/* Filter edge */ /* Filter edge */
tprintf(h->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPb:%d/%d QPr:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], bqp[0], bqp[1], rqp[0], rqp[1], linesize, uvlinesize); tprintf(h->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPb:%d/%d QPr:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], bqp[0], bqp[1], rqp[0], rqp[1], linesize, uvlinesize);
{ int i; for (i = 0; i < 8; i++) tprintf(h->avctx, " bS[%d]:%d", i, bS[i]); tprintf(h->avctx, "\n"); } { int i; for (i = 0; i < 8; i++) tprintf(h->avctx, " bS[%d]:%d", i, bS[i]); tprintf(h->avctx, "\n"); }
if (MB_FIELD(h)) { if (MB_FIELD(sl)) {
filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0], a, b, 1 );
filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1], a, b, 1 ); filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1], a, b, 1 );
if (chroma){ if (chroma){
......
...@@ -57,7 +57,7 @@ static inline void get_lowest_part_y(const H264Context *h, H264SliceContext *sl, ...@@ -57,7 +57,7 @@ static inline void get_lowest_part_y(const H264Context *h, H264SliceContext *sl,
{ {
int my; int my;
y_offset += 16 * (sl->mb_y >> MB_FIELD(h)); y_offset += 16 * (sl->mb_y >> MB_FIELD(sl));
if (list0) { if (list0) {
int ref_n = sl->ref_cache[0][scan8[n]]; int ref_n = sl->ref_cache[0][scan8[n]];
...@@ -225,7 +225,7 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext ...@@ -225,7 +225,7 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext
const int full_mx = mx >> 2; const int full_mx = mx >> 2;
const int full_my = my >> 2; const int full_my = my >> 2;
const int pic_width = 16 * h->mb_width; const int pic_width = 16 * h->mb_width;
const int pic_height = 16 * h->mb_height >> MB_FIELD(h); const int pic_height = 16 * h->mb_height >> MB_FIELD(sl);
int ysh; int ysh;
if (mx & 7) if (mx & 7)
...@@ -285,7 +285,7 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext ...@@ -285,7 +285,7 @@ static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext
} }
ysh = 3 - (chroma_idc == 2 /* yuv422 */); ysh = 3 - (chroma_idc == 2 /* yuv422 */);
if (chroma_idc == 1 /* yuv420 */ && MB_FIELD(h)) { if (chroma_idc == 1 /* yuv420 */ && MB_FIELD(sl)) {
// chroma offset when predicting from a field of opposite parity // chroma offset when predicting from a field of opposite parity
my += 2 * ((sl->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); emu |= (my >> 3) < 0 || (my >> 3) + 8 >= (pic_height >> 1);
...@@ -346,7 +346,7 @@ static av_always_inline void mc_part_std(const H264Context *h, H264SliceContext ...@@ -346,7 +346,7 @@ static av_always_inline void mc_part_std(const H264Context *h, H264SliceContext
dest_cr += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize; dest_cr += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize;
} }
x_offset += 8 * sl->mb_x; x_offset += 8 * sl->mb_x;
y_offset += 8 * (sl->mb_y >> MB_FIELD(h)); y_offset += 8 * (sl->mb_y >> MB_FIELD(sl));
if (list0) { if (list0) {
H264Picture *ref = &sl->ref_list[0][sl->ref_cache[0][scan8[n]]]; H264Picture *ref = &sl->ref_list[0][sl->ref_cache[0][scan8[n]]];
...@@ -400,7 +400,7 @@ static av_always_inline void mc_part_weighted(const H264Context *h, H264SliceCon ...@@ -400,7 +400,7 @@ static av_always_inline void mc_part_weighted(const H264Context *h, H264SliceCon
dest_cr += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize; dest_cr += (x_offset << pixel_shift) + y_offset * sl->mb_uvlinesize;
} }
x_offset += 8 * sl->mb_x; x_offset += 8 * sl->mb_x;
y_offset += 8 * (sl->mb_y >> MB_FIELD(h)); y_offset += 8 * (sl->mb_y >> MB_FIELD(sl));
if (list0 && list1) { if (list0 && list1) {
/* don't optimize for luma-only case, since B-frames usually /* don't optimize for luma-only case, since B-frames usually
...@@ -532,7 +532,7 @@ static av_always_inline void xchg_mb_border(const H264Context *h, H264SliceConte ...@@ -532,7 +532,7 @@ static av_always_inline void xchg_mb_border(const H264Context *h, H264SliceConte
deblock_top = sl->top_type; deblock_top = sl->top_type;
} else { } else {
deblock_topleft = (sl->mb_x > 0); deblock_topleft = (sl->mb_x > 0);
deblock_top = (sl->mb_y > !!MB_FIELD(h)); deblock_top = (sl->mb_y > !!MB_FIELD(sl));
} }
src_y -= linesize + 1 + pixel_shift; src_y -= linesize + 1 + pixel_shift;
......
...@@ -66,7 +66,7 @@ static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContex ...@@ -66,7 +66,7 @@ static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContex
h->list_counts[mb_xy] = sl->list_count; h->list_counts[mb_xy] = sl->list_count;
if (!SIMPLE && MB_FIELD(h)) { if (!SIMPLE && MB_FIELD(sl)) {
linesize = sl->mb_linesize = h->linesize * 2; linesize = sl->mb_linesize = h->linesize * 2;
uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2; uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2;
block_offset = &h->block_offset[48]; block_offset = &h->block_offset[48];
...@@ -291,7 +291,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(const H264Context *h, H264SliceCo ...@@ -291,7 +291,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(const H264Context *h, H264SliceCo
h->list_counts[mb_xy] = sl->list_count; h->list_counts[mb_xy] = sl->list_count;
if (!SIMPLE && MB_FIELD(h)) { if (!SIMPLE && MB_FIELD(sl)) {
linesize = sl->mb_linesize = sl->mb_uvlinesize = h->linesize * 2; linesize = sl->mb_linesize = sl->mb_uvlinesize = h->linesize * 2;
block_offset = &h->block_offset[48]; block_offset = &h->block_offset[48];
if (mb_y & 1) // FIXME move out of this function? if (mb_y & 1) // FIXME move out of this function?
......
...@@ -62,11 +62,11 @@ static av_always_inline int fetch_diagonal_mv(const H264Context *h, H264SliceCon ...@@ -62,11 +62,11 @@ static av_always_inline int fetch_diagonal_mv(const H264Context *h, H264SliceCon
AV_ZERO32(sl->mv_cache[list][scan8[0] - 2]); AV_ZERO32(sl->mv_cache[list][scan8[0] - 2]);
*C = sl->mv_cache[list][scan8[0] - 2]; *C = sl->mv_cache[list][scan8[0] - 2];
if (!MB_FIELD(h) && IS_INTERLACED(sl->left_type[0])) { if (!MB_FIELD(sl) && IS_INTERLACED(sl->left_type[0])) {
SET_DIAG_MV(* 2, >> 1, sl->left_mb_xy[0] + h->mb_stride, SET_DIAG_MV(* 2, >> 1, sl->left_mb_xy[0] + h->mb_stride,
(sl->mb_y & 1) * 2 + (i >> 5)); (sl->mb_y & 1) * 2 + (i >> 5));
} }
if (MB_FIELD(h) && !IS_INTERLACED(sl->left_type[0])) { if (MB_FIELD(sl) && !IS_INTERLACED(sl->left_type[0])) {
// left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK. // left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK.
SET_DIAG_MV(/ 2, << 1, sl->left_mb_xy[i >= 36], ((i >> 2)) & 3); SET_DIAG_MV(/ 2, << 1, sl->left_mb_xy[i >= 36], ((i >> 2)) & 3);
} }
...@@ -237,7 +237,7 @@ static av_always_inline void pred_8x16_motion(const H264Context *const h, ...@@ -237,7 +237,7 @@ static av_always_inline void pred_8x16_motion(const H264Context *const h,
#define FIX_MV_MBAFF(type, refn, mvn, idx) \ #define FIX_MV_MBAFF(type, refn, mvn, idx) \
if (FRAME_MBAFF(h)) { \ if (FRAME_MBAFF(h)) { \
if (MB_FIELD(h)) { \ if (MB_FIELD(sl)) { \
if (!IS_INTERLACED(type)) { \ if (!IS_INTERLACED(type)) { \
refn <<= 1; \ refn <<= 1; \
AV_COPY32(mvbuf[idx], mvn); \ AV_COPY32(mvbuf[idx], mvn); \
...@@ -366,7 +366,7 @@ static void fill_decode_neighbors(const H264Context *h, H264SliceContext *sl, in ...@@ -366,7 +366,7 @@ static void fill_decode_neighbors(const H264Context *h, H264SliceContext *sl, in
sl->topleft_partition = -1; sl->topleft_partition = -1;
top_xy = mb_xy - (h->mb_stride << MB_FIELD(h)); top_xy = mb_xy - (h->mb_stride << MB_FIELD(sl));
/* Wow, what a mess, why didn't they simplify the interlacing & intra /* Wow, what a mess, why didn't they simplify the interlacing & intra
* stuff, I can't imagine that these complex rules are worth it. */ * stuff, I can't imagine that these complex rules are worth it. */
...@@ -767,7 +767,7 @@ static void fill_decode_caches(const H264Context *h, H264SliceContext *sl, int m ...@@ -767,7 +767,7 @@ static void fill_decode_caches(const H264Context *h, H264SliceContext *sl, int m
MAP_F2F(scan8[0] - 1 + 3 * 8, left_type[LBOT]) MAP_F2F(scan8[0] - 1 + 3 * 8, left_type[LBOT])
if (FRAME_MBAFF(h)) { if (FRAME_MBAFF(h)) {
if (MB_FIELD(h)) { if (MB_FIELD(sl)) {
#define MAP_F2F(idx, mb_type) \ #define MAP_F2F(idx, mb_type) \
if (!IS_INTERLACED(mb_type) && sl->ref_cache[list][idx] >= 0) { \ if (!IS_INTERLACED(mb_type) && sl->ref_cache[list][idx] >= 0) { \
...@@ -807,7 +807,7 @@ static void av_unused decode_mb_skip(const H264Context *h, H264SliceContext *sl) ...@@ -807,7 +807,7 @@ static void av_unused decode_mb_skip(const H264Context *h, H264SliceContext *sl)
memset(h->non_zero_count[mb_xy], 0, 48); memset(h->non_zero_count[mb_xy], 0, 48);
if (MB_FIELD(h)) if (MB_FIELD(sl))
mb_type |= MB_TYPE_INTERLACED; mb_type |= MB_TYPE_INTERLACED;
if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
......
...@@ -1553,7 +1553,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex ...@@ -1553,7 +1553,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex
h->picture_structure = picture_structure; h->picture_structure = picture_structure;
h->droppable = droppable; h->droppable = droppable;
h->frame_num = frame_num; h->frame_num = frame_num;
h->mb_field_decoding_flag = picture_structure != PICT_FRAME; sl->mb_field_decoding_flag = picture_structure != PICT_FRAME;
if (h0->current_slice == 0) { if (h0->current_slice == 0) {
/* Shorten frame num gaps so we don't have to allocate reference /* Shorten frame num gaps so we don't have to allocate reference
...@@ -2131,7 +2131,7 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type) ...@@ -2131,7 +2131,7 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
uint8_t *nnz; uint8_t *nnz;
uint8_t *nnz_cache; uint8_t *nnz_cache;
top_xy = mb_xy - (h->mb_stride << MB_FIELD(h)); top_xy = mb_xy - (h->mb_stride << MB_FIELD(sl));
/* Wow, what a mess, why didn't they simplify the interlacing & intra /* Wow, what a mess, why didn't they simplify the interlacing & intra
* stuff, I can't imagine that these complex rules are worth it. */ * stuff, I can't imagine that these complex rules are worth it. */
...@@ -2288,7 +2288,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e ...@@ -2288,7 +2288,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e
if (FRAME_MBAFF(h)) if (FRAME_MBAFF(h))
h->mb_mbaff = h->mb_mbaff =
h->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;
sl->mb_y = mb_y; sl->mb_y = mb_y;
...@@ -2302,7 +2302,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e ...@@ -2302,7 +2302,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e
mb_y * h->uvlinesize * block_h; mb_y * h->uvlinesize * block_h;
// FIXME simplify above // FIXME simplify above
if (MB_FIELD(h)) { if (MB_FIELD(sl)) {
linesize = sl->mb_linesize = h->linesize * 2; linesize = sl->mb_linesize = h->linesize * 2;
uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2; uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2;
if (mb_y & 1) { // FIXME move out of this function? if (mb_y & 1) { // FIXME move out of this function?
...@@ -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 = h->mb_field_decoding_flag = IS_INTERLACED(mb_type) ? 1 : 0; h->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