summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-05-15 01:40:34 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-05-15 01:40:34 +0000
commit0d175622d8bb9e96dc75aa95f2321a467e34173a (patch)
treea5dd850a67b94de7053350b4f040d4a05c24955d /libavcodec/h264.c
parent3f9d3777b91264e3659cab7901b9694770bf2c67 (diff)
another try at decode_ref_pic_list_reordering()
Originally committed as revision 4245 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 856c93cdee..39af88f718 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3305,31 +3305,36 @@ static int decode_ref_pic_list_reordering(H264Context *h){
else pred+= abs_diff_pic_num;
pred &= h->max_pic_num - 1;
- for(i= h->ref_count[list]-1; i>=0; i--){
- 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
+ for(i= h->short_ref_count-1; i>=0; i--){
+ ref = h->short_ref[i];
+ assert(ref->reference == 3);
+ assert(!ref->long_ref);
+ if(ref->data[0] != NULL && ref->frame_num == pred && ref->long_ref == 0) // ignore non existing pictures by testing data[0] pointer
break;
}
+ if(i>=0)
+ ref->pic_id= ref->frame_num;
}else{
pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx
-
- for(i= h->ref_count[list]-1; i>=0; i--){
- 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
- break;
- }
+ ref = h->long_ref[pic_id];
+ ref->pic_id= pic_id;
+ assert(ref->reference == 3);
+ assert(ref->long_ref);
+ i=0;
}
if (i < 0) {
av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n");
memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME
- } else if (i != index) /* this test is not necessary, it is only an optimisation to skip double copy of Picture structure in this case */ {
- Picture tmp= h->ref_list[list][i];
- if (i < index) {
- i = h->ref_count[list];
+ } else {
+ for(i=index; i+1<h->ref_count[list]; i++){
+ if(ref->long_ref == h->ref_list[list][i].long_ref && ref->pic_id == h->ref_list[list][i].pic_id)
+ break;
}
for(; i > index; i--){
h->ref_list[list][i]= h->ref_list[list][i-1];
}
- h->ref_list[list][index]= tmp;
+ h->ref_list[list][index]= *ref;
}
}else{
av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n");