Mercurial > libavcodec.hg
comparison h264.c @ 4532:c296efb7575e libavcodec
fix 2nd ref_count check
add list_count
author | michael |
---|---|
date | Fri, 16 Feb 2007 21:34:21 +0000 |
parents | 8a5a3dd25390 |
children | dca590e16c43 |
comparison
equal
deleted
inserted
replaced
4531:8a5a3dd25390 | 4532:c296efb7575e |
---|---|
324 | 324 |
325 /** | 325 /** |
326 * num_ref_idx_l0/1_active_minus1 + 1 | 326 * num_ref_idx_l0/1_active_minus1 + 1 |
327 */ | 327 */ |
328 unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode | 328 unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode |
329 unsigned int list_count; | |
329 Picture *short_ref[32]; | 330 Picture *short_ref[32]; |
330 Picture *long_ref[32]; | 331 Picture *long_ref[32]; |
331 Picture default_ref_list[2][32]; | 332 Picture default_ref_list[2][32]; |
332 Picture ref_list[2][48]; ///< 0..15: frame refs, 16..47: mbaff field refs | 333 Picture ref_list[2][48]; ///< 0..15: frame refs, 16..47: mbaff field refs |
333 Picture *delayed_pic[18]; //FIXME size? | 334 Picture *delayed_pic[18]; //FIXME size? |
4704 if(num_ref_idx_active_override_flag){ | 4705 if(num_ref_idx_active_override_flag){ |
4705 h->ref_count[0]= get_ue_golomb(&s->gb) + 1; | 4706 h->ref_count[0]= get_ue_golomb(&s->gb) + 1; |
4706 if(h->slice_type==B_TYPE) | 4707 if(h->slice_type==B_TYPE) |
4707 h->ref_count[1]= get_ue_golomb(&s->gb) + 1; | 4708 h->ref_count[1]= get_ue_golomb(&s->gb) + 1; |
4708 | 4709 |
4709 if(h->ref_count[0] > 32 || h->ref_count[1] > 32){ | 4710 if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){ |
4710 av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n"); | 4711 av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n"); |
4711 h->ref_count[0]= h->ref_count[1]= 1; | 4712 h->ref_count[0]= h->ref_count[1]= 1; |
4712 return -1; | 4713 return -1; |
4713 } | 4714 } |
4714 } | 4715 } |
4715 } | 4716 if(h->slice_type == B_TYPE) |
4717 h->list_count= 2; | |
4718 else | |
4719 h->list_count= 1; | |
4720 }else | |
4721 h->list_count= 0; | |
4716 | 4722 |
4717 if(!default_ref_list_done){ | 4723 if(!default_ref_list_done){ |
4718 fill_default_ref_list(h); | 4724 fill_default_ref_list(h); |
4719 } | 4725 } |
4720 | 4726 |