Commit d0bd44f7 authored by Loren Merritt's avatar Loren Merritt

avc2avi:

Use POC to determine frame boundaries (frame_num couldn't distinguish consecutive B-frames).
Fix keyframe flag to mark IDR only, not all I slices.


git-svn-id: svn://svn.videolan.org/x264/trunk@153 df754926-b1dd-0310-bc7b-ec298dee348c
parent f01e3d5f
......@@ -130,9 +130,12 @@ typedef struct
int i_ref_idc;
int i_idr_pic_id;
int i_frame_num;
int i_poc;
int b_key;
int i_log2_max_frame_num;
int i_poc_type;
int i_log2_max_poc_lsb;
} h264_t;
void h264_parser_init( h264_t * );
......@@ -432,6 +435,8 @@ void h264_parser_init( h264_t *h )
h->i_idr_pic_id = -1;
h->i_frame_num = -1;
h->i_log2_max_frame_num = 0;
h->i_poc = -1;
h->i_poc_type = -1;
}
void h264_parser_parse( h264_t *h, nal_t *nal, int *pb_nal_start )
{
......@@ -452,13 +457,12 @@ void h264_parser_parse( h264_t *h, nal_t *nal, int *pb_nal_start )
/* Skip i_log2_max_frame_num */
h->i_log2_max_frame_num = bs_read_ue( &s ) + 4;
/* Read poc_type */
i_tmp = bs_read_ue( &s );
if( i_tmp == 0 )
h->i_poc_type = bs_read_ue( &s );
if( h->i_poc_type == 0 )
{
/* skip i_log2_max_poc_lsb */
bs_read_ue( &s );
h->i_log2_max_poc_lsb = bs_read_ue( &s ) + 4;
}
else if( i_tmp == 1 )
else if( h->i_poc_type == 1 )
{
int i_cycle;
/* skip b_delta_pic_order_always_zero */
......@@ -525,10 +529,8 @@ void h264_parser_parse( h264_t *h, nal_t *nal, int *pb_nal_start )
h->b_key = 0;
break;
case 2: case 7: /* I */
h->b_key = 1;
break;
case 4: case 9: /* ? */
h->b_key = 1;
case 4: case 9: /* SI */
h->b_key = (nal->i_type == NAL_SLICE_IDR);
break;
}
/* pps id */
......@@ -550,6 +552,14 @@ void h264_parser_parse( h264_t *h, nal_t *nal, int *pb_nal_start )
h->i_idr_pic_id = i_tmp;
}
if( h->i_poc_type == 0 )
{
i_tmp = bs_read( &s, h->i_log2_max_poc_lsb );
if( i_tmp != h->i_poc )
*pb_nal_start = 1;
h->i_poc = i_tmp;
}
}
h->i_nal_type = nal->i_type;
h->i_ref_idc = nal->i_ref_idc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment