[FFmpeg-cvslog] r14339 - trunk/libavcodec/h264.c
michael
subversion
Wed Jul 23 04:12:56 CEST 2008
Author: michael
Date: Wed Jul 23 04:12:54 2008
New Revision: 14339
Log:
Support gaps in the frame num.
Fixes at least:
MR3_TANDBERG_B.264
MR4_TANDBERG_C.264
MR5_TANDBERG_C.264
Modified:
trunk/libavcodec/h264.c
Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c (original)
+++ trunk/libavcodec/h264.c Wed Jul 23 04:12:54 2008
@@ -3539,6 +3539,12 @@ static int execute_ref_pic_marking(H264C
pic= remove_long(h, j);
if(pic) unreference_pic(h, pic, 0);
}
+ s->current_picture_ptr->poc=
+ s->current_picture_ptr->field_poc[0]=
+ s->current_picture_ptr->field_poc[1]=
+ h->poc_lsb=
+ h->poc_msb=
+ h->frame_num=
s->current_picture_ptr->frame_num= 0;
break;
default: assert(0);
@@ -3599,7 +3605,7 @@ static int execute_ref_pic_marking(H264C
"number of reference frames exceeds max (probably "
"corrupt input), discarding one\n");
- if (h->long_ref_count) {
+ if (h->long_ref_count && !h->short_ref_count) {
for (i = 0; i < 16; ++i)
if (h->long_ref[i])
break;
@@ -4018,6 +4024,16 @@ static int decode_slice_header(H264Conte
}
if(h0->current_slice == 0){
+ while(h->frame_num != h->prev_frame_num &&
+ h->frame_num != (h->prev_frame_num+1)%(1<<h->sps.log2_max_frame_num)){
+ av_log(NULL, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);
+ frame_start(h);
+ h->prev_frame_num++;
+ h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
+ s->current_picture_ptr->frame_num= h->prev_frame_num;
+ execute_ref_pic_marking(h, NULL, 0);
+ }
+
/* See if we have a decoded first field looking for a pair... */
if (s0->first_field) {
assert(s0->current_picture_ptr);
@@ -7738,7 +7754,7 @@ static int decode_frame(AVCodecContext *
//FIXME factorize this with the output code below
out = h->delayed_pic[0];
out_idx = 0;
- for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame; i++)
+ for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && h->delayed_pic[i]->poc; i++)
if(h->delayed_pic[i]->poc < out->poc){
out = h->delayed_pic[i];
out_idx = i;
@@ -7821,13 +7837,13 @@ static int decode_frame(AVCodecContext *
s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264;
s->current_picture_ptr->pict_type= s->pict_type;
- h->prev_frame_num_offset= h->frame_num_offset;
- h->prev_frame_num= h->frame_num;
if(!s->dropable) {
+ execute_ref_pic_marking(h, h->mmco, h->mmco_index);
h->prev_poc_msb= h->poc_msb;
h->prev_poc_lsb= h->poc_lsb;
- execute_ref_pic_marking(h, h->mmco, h->mmco_index);
}
+ h->prev_frame_num_offset= h->frame_num_offset;
+ h->prev_frame_num= h->frame_num;
/*
* FIXME: Error handling code does not seem to support interlaced
@@ -7887,7 +7903,7 @@ static int decode_frame(AVCodecContext *
out = h->delayed_pic[0];
out_idx = 0;
- for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame; i++)
+ for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && h->delayed_pic[i]->poc; i++)
if(h->delayed_pic[i]->poc < out->poc){
out = h->delayed_pic[i];
out_idx = i;
More information about the ffmpeg-cvslog
mailing list