[FFmpeg-devel] [PATCH] H.264 fix interlaced flag

Michael Niedermayer michaelni
Tue Mar 3 22:13:20 CET 2009


On Tue, Mar 03, 2009 at 09:18:45PM +0100, Ivan Schreter wrote:
> Hi,
>
> Michael Niedermayer wrote:
>> On Tue, Mar 03, 2009 at 07:49:53PM +0100, Ivan Schreter wrote:
>>   
>>> [...]
>>> Index: libavcodec/h264.c
>>> ===================================================================
>>> --- libavcodec/h264.c	(revision 17723)
>>> +++ libavcodec/h264.c	(working copy)
>>> @@ -6805,7 +6805,7 @@
>>>          for (i = 0 ; i < num_clock_ts ; i++){
>>>              if(get_bits(&s->gb, 1)){                  /* 
>>> clock_timestamp_flag */
>>>                  unsigned int full_timestamp_flag;
>>> -                skip_bits(&s->gb, 2);                 /* ct_type */
>>> +                h->sei_ct_type[i] = get_bits(&s->gb, 2);
>>>     
>>
>> h->sei_ct_type |= 1<<get_bits(&s->gb, 2);
>> stores things in a, for us easier to use form
>>
>>   
> Hm, I could come to this idea to use bitset myself :-)
>
>> [...]
>>
>>   
>>> @@ -7767,20 +7784,22 @@
>>>                  switch (h->sei_pic_struct)
>>>                  {
>>>                  case SEI_PIC_STRUCT_FRAME:
>>> -                    cur->interlaced_frame = 0;
>>> +                    cur->interlaced_frame = h264_is_interlaced(h);
>>>                      break;
>>>                  case SEI_PIC_STRUCT_TOP_FIELD:
>>>                  case SEI_PIC_STRUCT_BOTTOM_FIELD:
>>> +                    cur->interlaced_frame = 1;
>>> +                    break;
>>>                  case SEI_PIC_STRUCT_TOP_BOTTOM:
>>>                  case SEI_PIC_STRUCT_BOTTOM_TOP:
>>> -                    cur->interlaced_frame = 1;
>>> +                    cur->interlaced_frame = h264_is_interlaced(h);
>>>                      break;
>>>                  case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
>>>                  case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
>>>                      // Signal the possibility of telecined film 
>>> externally (pic_struct 5,6)
>>>                      // From these hints, let the applications decide if 
>>> they apply deinterlacing.
>>>                      cur->repeat_pict = 1;
>>> -                    cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE;
>>> +                    cur->interlaced_frame = h264_is_interlaced(h);
>>>                      break;
>>>                  case SEI_PIC_STRUCT_FRAME_DOUBLING:
>>>                      // Force progressive here, as doubling interlaced 
>>> frame is a bad idea.
>>>     
>>
>> this is incorrect
>> ct_type should always be used if available, otherwise
>> FIELD_OR_MBAFF_PICTURE should be.
>> that at least is how i understand the spec, if this fails for some
>> case iam interrested in the file
>>   
> Updated patch attached.
>
> BTW, I left frame doubling and tripling set interlaced to false. To be 
> completely consistent, possibly this should be done via ct_type as well 
> (but doubling and tripling will surely look bad interlaced...). What do you 
> think?

hmm, you may be correct
patch ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090303/93fb2ada/attachment.pgp>



More information about the ffmpeg-devel mailing list