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

Ivan Schreter schreter
Wed Mar 4 20:37:59 CET 2009


Michael Niedermayer wrote:
> 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
>
>   
Applied.

Regards,

Ivan





More information about the ffmpeg-devel mailing list