From debca90863e4ee53447efd02483c500f89766384 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 17 May 2016 16:45:15 +0200 Subject: h264: store {curr,max}_pic_num in the per-slice context While the value of those variables will be constant for the whole frame, they are only used in two functions called from slice header decoding. Moving them to the per-slice context allows us to make the H264Context passed to slice_header_parse() constant. --- libavcodec/h264_slice.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'libavcodec/h264_slice.c') diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index be44e66..d926884 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -405,9 +405,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst, memcpy(&h->poc, &h1->poc, sizeof(h->poc)); - h->curr_pic_num = h1->curr_pic_num; - h->max_pic_num = h1->max_pic_num; - memcpy(h->short_ref, h1->short_ref, sizeof(h->short_ref)); memcpy(h->long_ref, h1->long_ref, sizeof(h->long_ref)); memcpy(h->delayed_pic, h1->delayed_pic, sizeof(h->delayed_pic)); @@ -1173,7 +1170,7 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, return 0; } -static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl, +static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal) { const SPS *sps; @@ -1248,11 +1245,11 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl, sl->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (picture_structure == PICT_FRAME) { - h->curr_pic_num = sl->frame_num; - h->max_pic_num = 1 << sps->log2_max_frame_num; + sl->curr_pic_num = sl->frame_num; + sl->max_pic_num = 1 << sps->log2_max_frame_num; } else { - h->curr_pic_num = 2 * sl->frame_num + 1; - h->max_pic_num = 1 << (sps->log2_max_frame_num + 1); + sl->curr_pic_num = 2 * sl->frame_num + 1; + sl->max_pic_num = 1 << (sps->log2_max_frame_num + 1); } if (nal->type == NAL_IDR_SLICE) -- cgit v1.1