Revision 0d315f28

View differences:

libavcodec/h264.c
3010 3010
                        else                                pred+= abs_diff_pic_num;
3011 3011
                        pred &= h->max_pic_num - 1;
3012 3012
                    
3013
                        for(i= h->ref_count[list]-1; i>=index; i--){
3014
                            if(h->ref_list[list][i].pic_id == pred && h->ref_list[list][i].long_ref==0)
3013
                        for(i= h->ref_count[list]-1; i>=0; i--){
3014
                            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
3015 3015
                                break;
3016 3016
                        }
3017 3017
                    }else{
3018 3018
                        pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx
3019 3019

  
3020
                        for(i= h->ref_count[list]-1; i>=index; i--){
3021
                            if(h->ref_list[list][i].pic_id == pic_id && h->ref_list[list][i].long_ref==1)
3020
                        for(i= h->ref_count[list]-1; i>=0; i--){
3021
                            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
3022 3022
                                break;
3023 3023
                        }
3024 3024
                    }
3025 3025

  
3026
                    if(i < index){
3026
                    if (i < 0) {
3027 3027
                        av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n");
3028 3028
                        memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME
3029
                    }else if(i > index){
3029
                    } else if (i != index) /* this test is not necessary, it is only an optimisation to skip double copy of Picture structure in this case */ {
3030 3030
                        Picture tmp= h->ref_list[list][i];
3031
                        for(; i>index; i--){
3031
                        if (i < index) {
3032
                            i = h->ref_count[list];
3033
                        }
3034
                        for(; i > index; i--){
3032 3035
                            h->ref_list[list][i]= h->ref_list[list][i-1];
3033 3036
                        }
3034 3037
                        h->ref_list[list][index]= tmp;

Also available in: Unified diff