diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-05-14 00:04:11 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-05-14 00:04:11 +0000 |
commit | 6ab87211987f44808f2c7acffcefb1a3b9c2c7c6 (patch) | |
tree | 7ee802e2f53504a18c7f0fd1915d82ee585f0ba3 /libavcodec/h264.c | |
parent | cf5c5c8f08910f62949926969fe704bef6c85720 (diff) | |
download | ffmpeg-6ab87211987f44808f2c7acffcefb1a3b9c2c7c6.tar.gz |
fill missing reference pictures with something to avoid assertion failure
Originally committed as revision 4240 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 401b41a094..856c93cdee 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3197,6 +3197,8 @@ static int fill_default_ref_list(H264Context *h){ 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 void print_long_term(H264Context *h); 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 @@ static int decode_ref_pic_list_reordering(H264Context *h){ 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 @@ static int decode_ref_pic_list_reordering(H264Context *h){ 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); |