h264: set mb_aff_frame in frame_start()

Avoid unnecessary modification of the decoder-global state in per-slice
code.
This commit is contained in:
Anton Khirnov 2016-05-17 15:07:23 +02:00
parent 8d36932c8d
commit 54dd9b1cdd
1 changed files with 3 additions and 5 deletions

View File

@ -377,6 +377,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
h->coded_picture_number = h1->coded_picture_number;
h->first_field = h1->first_field;
h->picture_structure = h1->picture_structure;
h->mb_aff_frame = h1->mb_aff_frame;
h->droppable = h1->droppable;
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
@ -501,6 +502,8 @@ static int h264_frame_start(H264Context *h)
h->postpone_filter = 0;
h->mb_aff_frame = h->ps.sps->mb_aff && (h->picture_structure == PICT_FRAME);
assert(h->cur_pic_ptr->long_ref == 0);
return 0;
@ -1173,7 +1176,6 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl,
unsigned int slice_type, tmp, i;
int field_pic_flag, bottom_field_flag;
int frame_num, droppable, picture_structure;
int mb_aff_frame = 0;
sl->first_mb_addr = get_ue_golomb(&sl->gb);
@ -1236,12 +1238,8 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl,
picture_structure = PICT_TOP_FIELD + bottom_field_flag;
} else {
picture_structure = PICT_FRAME;
mb_aff_frame = sps->mb_aff;
}
}
if (!h->setup_finished) {
h->mb_aff_frame = mb_aff_frame;
}
sl->picture_structure = picture_structure;
sl->mb_field_decoding_flag = picture_structure != PICT_FRAME;