comparison h264.c @ 2766:0609f405e000 libavcodec

make decoder a little bit more tolerant to missing NAL units
author michael
date Sun, 19 Jun 2005 23:33:09 +0000
parents 01ed2c3b8f08
children 7da100c7403c
comparison
equal deleted inserted replaced
2765:e44ff53b1c85 2766:0609f405e000
3892 av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_frame_num, h->mmco[i].long_index); 3892 av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_frame_num, h->mmco[i].long_index);
3893 3893
3894 switch(mmco[i].opcode){ 3894 switch(mmco[i].opcode){
3895 case MMCO_SHORT2UNUSED: 3895 case MMCO_SHORT2UNUSED:
3896 pic= remove_short(h, mmco[i].short_frame_num); 3896 pic= remove_short(h, mmco[i].short_frame_num);
3897 if(pic==NULL) return -1; 3897 if(pic)
3898 unreference_pic(h, pic); 3898 unreference_pic(h, pic);
3899 else if(s->avctx->debug&FF_DEBUG_MMCO)
3900 av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: remove_short() failure\n");
3899 break; 3901 break;
3900 case MMCO_SHORT2LONG: 3902 case MMCO_SHORT2LONG:
3901 pic= remove_long(h, mmco[i].long_index); 3903 pic= remove_long(h, mmco[i].long_index);
3902 if(pic) unreference_pic(h, pic); 3904 if(pic) unreference_pic(h, pic);
3903 3905
3905 h->long_ref[ mmco[i].long_index ]->long_ref=1; 3907 h->long_ref[ mmco[i].long_index ]->long_ref=1;
3906 h->long_ref_count++; 3908 h->long_ref_count++;
3907 break; 3909 break;
3908 case MMCO_LONG2UNUSED: 3910 case MMCO_LONG2UNUSED:
3909 pic= remove_long(h, mmco[i].long_index); 3911 pic= remove_long(h, mmco[i].long_index);
3910 if(pic==NULL) return -1; 3912 if(pic)
3911 unreference_pic(h, pic); 3913 unreference_pic(h, pic);
3914 else if(s->avctx->debug&FF_DEBUG_MMCO)
3915 av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: remove_long() failure\n");
3912 break; 3916 break;
3913 case MMCO_LONG: 3917 case MMCO_LONG:
3914 pic= remove_long(h, mmco[i].long_index); 3918 pic= remove_long(h, mmco[i].long_index);
3915 if(pic) unreference_pic(h, pic); 3919 if(pic) unreference_pic(h, pic);
3916 3920
4295 4299
4296 if(!default_ref_list_done){ 4300 if(!default_ref_list_done){
4297 fill_default_ref_list(h); 4301 fill_default_ref_list(h);
4298 } 4302 }
4299 4303
4300 decode_ref_pic_list_reordering(h); 4304 if(decode_ref_pic_list_reordering(h) < 0)
4305 return -1;
4301 4306
4302 if( (h->pps.weighted_pred && (h->slice_type == P_TYPE || h->slice_type == SP_TYPE )) 4307 if( (h->pps.weighted_pred && (h->slice_type == P_TYPE || h->slice_type == SP_TYPE ))
4303 || (h->pps.weighted_bipred_idc==1 && h->slice_type==B_TYPE ) ) 4308 || (h->pps.weighted_bipred_idc==1 && h->slice_type==B_TYPE ) )
4304 pred_weight_table(h); 4309 pred_weight_table(h);
4305 else if(h->pps.weighted_bipred_idc==2 && h->slice_type==B_TYPE) 4310 else if(h->pps.weighted_bipred_idc==2 && h->slice_type==B_TYPE)
7164 for(i=0; i<32; i++){ 7169 for(i=0; i<32; i++){
7165 printf("%X ", buf[i]); 7170 printf("%X ", buf[i]);
7166 } 7171 }
7167 #endif 7172 #endif
7168 h->slice_num = 0; 7173 h->slice_num = 0;
7174 s->current_picture_ptr= NULL;
7169 for(;;){ 7175 for(;;){
7170 int consumed; 7176 int consumed;
7171 int dst_length; 7177 int dst_length;
7172 int bit_length; 7178 int bit_length;
7173 uint8_t *ptr; 7179 uint8_t *ptr;