- if(reordering_of_pic_nums_idc<3){
- if(reordering_of_pic_nums_idc<2){
- const unsigned int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1;
- int frame_num;
-
- if(abs_diff_pic_num > h->max_pic_num){
- av_log(h->s.avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n");
- return -1;
- }
-
- if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num;
- else pred+= abs_diff_pic_num;
- pred &= h->max_pic_num - 1;
-
- frame_num = pic_num_extract(h, pred, &pic_structure);
-
- for(i= h->short_ref_count-1; i>=0; i--){
- ref = h->short_ref[i];
- assert(ref->f.reference);
- assert(!ref->long_ref);
- if(
- ref->frame_num == frame_num &&
- (ref->f.reference & pic_structure)
- )
- break;
- }
- if(i>=0)
- ref->pic_id= pred;
- }else{
- int long_idx;
- pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx
-
- long_idx= pic_num_extract(h, pic_id, &pic_structure);
-
- if(long_idx>31){
- av_log(h->s.avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n");
- return -1;
- }
- ref = h->long_ref[long_idx];
- assert(!(ref && !ref->f.reference));
- if (ref && (ref->f.reference & pic_structure)) {
- ref->pic_id= pic_id;
- assert(ref->long_ref);
- i=0;
- }else{
- i=-1;
- }
+ switch (modification_of_pic_nums_idc) {
+ case 0:
+ case 1: {
+ const unsigned int abs_diff_pic_num = get_ue_golomb(&sl->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 AVERROR_INVALIDDATA;