[vlc-devel] Soft field repeat?

Juha Jeronen juha.jeronen at jyu.fi
Thu Jan 6 12:23:04 CET 2011

On 01/06/2011 12:51 PM, Laurent Aimar wrote:
> On Thu, Jan 06, 2011 at 12:20:25PM +0200, Juha Jeronen wrote:
>> There is an "i_nb_fields" member in picture_t, but this seems to be set
>> to 2 even for pictures whose PTS diff suggests it should be 3. Is this a
>> bug, or working as expected?
>   It is probably a bug. This field is set by the decoder. With avcodec you
> have:
> p_pic->i_nb_fields = 2 + p_sys->p_ff_pic->repeat_pict;
> Now, either avcode does not set 3 there, or this informations is lost
> somewhere between the decoder and your filter.
Ok. Hmm, grepping for assignments to i_nb_fields, 
modules/codec/libmpeg2.c says

     p_pic->i_nb_fields = p_sys->p_info->current_picture != NULL ?
         p_sys->p_info->current_picture->nb_fields : 2;

...so I think this one might need to be checked, too, if the stream 
comes from a DVD.

But I'm not really sure where to start looking for the rest of the data 
path, so I think I'll just hack it for now.

One weird thing with the disc I was testing is that it seems the PTS 
diff can be 16, 33, 50 or 66 ms... which would suggest *1*, 2, 3 or *4* 
fields. Two or three are common, but one or four? I suppose "1" can 
follow from a half-frame cut during editing in interlaced form, and "4" 
might be used to save space on the disc if two sequential full frames 
are identical.

There is also this part in libmpeg2.c:

             /* If nb_fields == 1, it is a field picture, and it will be
              * followed by another field picture for which we won't call
              * decoder_SynchroNewPicture() because this would have other
              * problems, so we take it into account here.
              * This kind of sucks, but I didn't think better. --Meuuh
             decoder_SynchroNewPicture( p_sys->p_synchro,
                                        p_current->flags & 
                                        p_current->nb_fields == 1 ? 2 :
                                        p_current->nb_fields, i_pts, i_dts,
                                        p_info->sequence->flags & 

...so I guess it either might or might not work correctly, if nb_fields 
is 1 :)


More information about the vlc-devel mailing list