comparison h264.c @ 2683:7d86ebbccecf libavcodec

another try at decode_ref_pic_list_reordering()
author michael
date Sun, 15 May 2005 01:40:34 +0000
parents 1a6192e0b1f9
children 360024d31dab
comparison
equal deleted inserted replaced
2682:dfa4d2773d13 2683:7d86ebbccecf
3303 3303
3304 if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num; 3304 if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num;
3305 else pred+= abs_diff_pic_num; 3305 else pred+= abs_diff_pic_num;
3306 pred &= h->max_pic_num - 1; 3306 pred &= h->max_pic_num - 1;
3307 3307
3308 for(i= h->ref_count[list]-1; i>=0; i--){ 3308 for(i= h->short_ref_count-1; i>=0; i--){
3309 if(h->ref_list[list][i].data[0] != NULL && h->ref_list[list][i].pic_id == pred && h->ref_list[list][i].long_ref==0) // ignore non existing pictures by testing data[0] pointer 3309 ref = h->short_ref[i];
3310 assert(ref->reference == 3);
3311 assert(!ref->long_ref);
3312 if(ref->data[0] != NULL && ref->frame_num == pred && ref->long_ref == 0) // ignore non existing pictures by testing data[0] pointer
3310 break; 3313 break;
3311 } 3314 }
3315 if(i>=0)
3316 ref->pic_id= ref->frame_num;
3312 }else{ 3317 }else{
3313 pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx 3318 pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx
3314 3319 ref = h->long_ref[pic_id];
3315 for(i= h->ref_count[list]-1; i>=0; i--){ 3320 ref->pic_id= pic_id;
3316 if(h->ref_list[list][i].pic_id == pic_id && h->ref_list[list][i].long_ref==1) // no need to ignore non existing pictures as non existing pictures have long_ref==0 3321 assert(ref->reference == 3);
3317 break; 3322 assert(ref->long_ref);
3318 } 3323 i=0;
3319 } 3324 }
3320 3325
3321 if (i < 0) { 3326 if (i < 0) {
3322 av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); 3327 av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n");
3323 memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME 3328 memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME
3324 } else if (i != index) /* this test is not necessary, it is only an optimisation to skip double copy of Picture structure in this case */ { 3329 } else {
3325 Picture tmp= h->ref_list[list][i]; 3330 for(i=index; i+1<h->ref_count[list]; i++){
3326 if (i < index) { 3331 if(ref->long_ref == h->ref_list[list][i].long_ref && ref->pic_id == h->ref_list[list][i].pic_id)
3327 i = h->ref_count[list]; 3332 break;
3328 } 3333 }
3329 for(; i > index; i--){ 3334 for(; i > index; i--){
3330 h->ref_list[list][i]= h->ref_list[list][i-1]; 3335 h->ref_list[list][i]= h->ref_list[list][i-1];
3331 } 3336 }
3332 h->ref_list[list][index]= tmp; 3337 h->ref_list[list][index]= *ref;
3333 } 3338 }
3334 }else{ 3339 }else{
3335 av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); 3340 av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n");
3336 return -1; 3341 return -1;
3337 } 3342 }