|
|
|
@ -237,14 +237,16 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h) |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (reordering_of_pic_nums_idc < 3) { |
|
|
|
|
if (reordering_of_pic_nums_idc < 2) { |
|
|
|
|
switch (reordering_of_pic_nums_idc) { |
|
|
|
|
case 0: |
|
|
|
|
case 1: { |
|
|
|
|
const unsigned int abs_diff_pic_num = get_ue_golomb(&h->gb) + 1; |
|
|
|
|
int frame_num; |
|
|
|
|
|
|
|
|
|
if (abs_diff_pic_num > h->max_pic_num) { |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n"); |
|
|
|
|
return -1; |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, |
|
|
|
|
"abs_diff_pic_num overflow\n"); |
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (reordering_of_pic_nums_idc == 0) |
|
|
|
@ -265,15 +267,18 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h) |
|
|
|
|
} |
|
|
|
|
if (i >= 0) |
|
|
|
|
ref->pic_id = pred; |
|
|
|
|
} else { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case 2: { |
|
|
|
|
int long_idx; |
|
|
|
|
pic_id = get_ue_golomb(&h->gb); // long_term_pic_idx
|
|
|
|
|
|
|
|
|
|
long_idx = pic_num_extract(h, pic_id, &pic_structure); |
|
|
|
|
|
|
|
|
|
if (long_idx > 31) { |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n"); |
|
|
|
|
return -1; |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, |
|
|
|
|
"long_term_pic_idx overflow\n"); |
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
} |
|
|
|
|
ref = h->long_ref[long_idx]; |
|
|
|
|
assert(!(ref && !ref->reference)); |
|
|
|
@ -284,10 +289,17 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h) |
|
|
|
|
} else { |
|
|
|
|
i = -1; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
default: |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, |
|
|
|
|
"illegal reordering_of_pic_nums_idc\n"); |
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (i < 0) { |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, |
|
|
|
|
"reference picture missing during reorder\n"); |
|
|
|
|
memset(&h->ref_list[list][index], 0, sizeof(Picture)); // FIXME
|
|
|
|
|
} else { |
|
|
|
|
for (i = index; i + 1 < h->ref_count[list]; i++) { |
|
|
|
@ -303,10 +315,6 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h) |
|
|
|
|
pic_as_field(&h->ref_list[list][index], pic_structure); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
av_log(h->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|