changeset 2680:1a6192e0b1f9 libavcodec

fill missing reference pictures with something to avoid assertion failure
author michael
date Sat, 14 May 2005 00:04:11 +0000
parents edd8e513376c
children 663dca3aa1d9
files h264.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Fri May 13 23:11:32 2005 +0000
+++ b/h264.c	Sat May 14 00:04:11 2005 +0000
@@ -3197,6 +3197,8 @@
 
                 for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) {
                     while(j<0 || j>= h->short_ref_count){
+                        if(j != -99 && step == (list ? -1 : 1))
+                            return -1;
                         step = -step;
                         j= smallest_poc_greater_than_current + (step>>1);
                     }
@@ -3264,7 +3266,7 @@
 
 static int decode_ref_pic_list_reordering(H264Context *h){
     MpegEncContext * const s = &h->s;
-    int list;
+    int list, index;
     
     print_short_term(h);
     print_long_term(h);
@@ -3275,7 +3277,6 @@
 
         if(get_bits1(&s->gb)){
             int pred= h->curr_pic_num;
-            int index;
 
             for(index=0; ; index++){
                 int reordering_of_pic_nums_idc= get_ue_golomb(&s->gb);
@@ -3339,6 +3340,13 @@
 
         if(h->slice_type!=B_TYPE) break;
     }
+    for(list=0; list<2; list++){
+        for(index= 0; index < h->ref_count[list]; index++){
+            if(!h->ref_list[list][index].data[0])
+                h->ref_list[list][index]= s->current_picture;
+        }
+        if(h->slice_type!=B_TYPE) break;
+    }
     
     if(h->slice_type==B_TYPE && !h->direct_spatial_mv_pred)
         direct_dist_scale_factor(h);