diff --git a/libavcodec/h264.h b/libavcodec/h264.h index a7b8f133b0..53dc477f92 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -351,6 +351,9 @@ typedef struct H264SliceContext { int luma_weight[48][2][2]; int chroma_weight[48][2][2][2]; int implicit_weight[48][48][2]; + + int prev_mb_skipped; + int next_mb_skipped; } H264SliceContext; /** @@ -389,9 +392,6 @@ typedef struct H264Context { int flags; int workaround_bugs; - int prev_mb_skipped; - int next_mb_skipped; - // prediction stuff int chroma_pred_mode; int intra16x16_pred_mode; diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index e47bd87550..35ae3fde54 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -1900,16 +1900,16 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl) if( h->slice_type_nos != AV_PICTURE_TYPE_I ) { int skip; /* a skipped mb needs the aff flag from the following mb */ - if (FRAME_MBAFF(h) && (h->mb_y & 1) == 1 && h->prev_mb_skipped) - skip = h->next_mb_skipped; + if (FRAME_MBAFF(h) && (h->mb_y & 1) == 1 && sl->prev_mb_skipped) + skip = sl->next_mb_skipped; else skip = decode_cabac_mb_skip( h, h->mb_x, h->mb_y ); /* read skip flags */ if( skip ) { if (FRAME_MBAFF(h) && (h->mb_y & 1) == 0) { h->cur_pic.mb_type[mb_xy] = MB_TYPE_SKIP; - h->next_mb_skipped = decode_cabac_mb_skip( h, h->mb_x, h->mb_y+1 ); - if(!h->next_mb_skipped) + sl->next_mb_skipped = decode_cabac_mb_skip( h, h->mb_x, h->mb_y+1 ); + if(!sl->next_mb_skipped) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } @@ -1929,7 +1929,7 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl) h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } - h->prev_mb_skipped = 0; + sl->prev_mb_skipped = 0; fill_decode_neighbors(h, -(MB_FIELD(h))); diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index 85659fd8da..dd98b759f0 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -729,7 +729,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h, H264SliceContext *sl) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&h->gb); } - h->prev_mb_skipped= 0; + sl->prev_mb_skipped = 0; mb_type= get_ue_golomb(&h->gb); if(h->slice_type_nos == AV_PICTURE_TYPE_B){ diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h index 278be61382..38ffd0604d 100644 --- a/libavcodec/h264_mvpred.h +++ b/libavcodec/h264_mvpred.h @@ -824,7 +824,7 @@ static void av_unused decode_mb_skip(H264Context *h, H264SliceContext *sl) h->cur_pic.mb_type[mb_xy] = mb_type; h->cur_pic.qscale_table[mb_xy] = sl->qscale; h->slice_table[mb_xy] = h->slice_num; - h->prev_mb_skipped = 1; + sl->prev_mb_skipped = 1; } #endif /* AVCODEC_H264_MVPRED_H */