Re: Timestamp, flags, YUV, play VOB files
Bj|rn Englund <[email protected]> Sat, 1 Oct 2005 01:53:41 +0200
| Newsgroups | gmane.comp.video.ogle.devel |
|---|---|
| Message-ID | <[email protected]> |
Fri Sep 30 2005, Mikhail Ramendik wrote: > What is the type for the timestamp? And, if the deinterlacer wants to lower > the framerate (as often happens in the case of telecined content), should it > perhaps modify the timestamps to space frames more evenly? Or is it better to > just drop some frames and leave the timestamps on others intact? The timestamps should be set to the time you want the picture to be displayed. I don't know if dropping frames would be good, depends on how you intend to make the deinterlacing I suppose. The time stamps are measured in a 90kHz clock (stored in an uint64_t). So 90000/30 = 3000 will be the difference in timestamps for two different frames at 30 frames per second, 3750 for 24 frames/s and 1500 for 60 frames per second. The mpeg decoder can, if the stream is field coded, output fields at 60 fields per second (1500) but what ogle does now is to combine 2 fields to one frame and output at 30fps (3000). This could (maybe) be changed if you think it is better for the deinterlacer with 60 fields per second in case the stream is coded so. > > What interlacing-related flags, originating from the MPEG2 source, can be > provided? And are they set fcor every frame? They are set for every frame. The flags are (if I remember all): *progressive_frame (if this is set the picture is a progressive frame) *frame/top_field/bottom_field (if frame, both fields are in this picture, if field, the specified field is in this picture). At the moment the decoder in ogle will combine to fields into a frame before outputting it in case of field. *top_field_first *repeat_first_field *picture_type I,P or B picture. *frame/field rate. Maybe not all of these flags are useful in deinterlacing. Some examples: A 24 fps progressive film will have the progressive frame flag set and the repeat_first_field set on every other picture. What should be output in that case (to an interlaced display) is in numbers (frame.field (* for repeat_field)): input to decoder 24 fps progressive: 0 1* 2 3* output from decoder 60 fields/s interlaced: 0.0 0.1, 1.0 1.1, 1.0 2.0, 2.1 3.0, 3.1 3.0 (I haven't included the top_field_first flags in this example) So for every 2 frames, 5 fields will be produced => 24 frames => 60 fields = 30 frames@30Hz This particular case is detected by ogle and the 24 fps progressive pictures are just output at 24 frames/second (instead of outputting at 30frames/s with repeated_fields. Sometimes this 3/2 conversion is done before coding so you want to do the inverse to deinterlace. You have (30fps): 0.0 0.1, 1.0 1.1, 2.0 2.1, 3.0 3.1, 4.0 4.1, ..., 29.0 29.1, 30.0 30.1 timestamps: 0 , 3000 , 6000 , 9000 , 12000 , ..., 87000 , 90000 But what this really is (and hopefully the deinterlacer will detect) is: 0.0 0.1, 1.0 1.1, 1.0 2.0, 2.1 3.0, 3.1 3.0 , ...,23.1 23.0, 24.0 24.1 or in other notation 0, 1*, 2, 3*, ... Which should result in (24fps): 0, 1, 2, 3, ..., 23, 24 timestamps: 0, 3750, 7500, 11250, ... , 86250, 90000 The field numbers in the example above is only the temporal number of the field, not if it is the top or bottom field. If we have pictures that are truly interlaced (not from film material) then you obviously have to do something more complex. If you for instance for every field in a 30 fps ( 60 fields/s) stream, output a whole frame, resulting in a 60frames/s stream. Then you should timestamp the new pictures: input (30 fps): 0,1,2,3,... timstamps: 0,3k,6k,9k,... output (60fps) 0,1,2,3,4,5,6,7,... timestamps: 0,1.5k,3k,4.5k,6k,7.5k,9k,10.5k,... Then there is 29.97, 30 fps drop frame and 25fps material. > > In the YUV model used in ogle, is every plane one-byte-per-pixel? It's as coded in the mpeg stream 4:2:0 Y = 1 byte per pixel U and V is 0.25 byte per pixel each. U and V are byte values but they 'map' to 4 Y values. I also think the mapping to Y values is different depending on if the picture is frame or field coded. So the total size in bytes of a picture is w*h*1.5 > And, can ogle play an (unencrypted) VOB file? I don't think I have a telecined > DVD at the moment, but I do have a telecined VOB or two. No it can't play VOBS without the IFO files. But you could perhaps generate some simple IFO files for the VOBS. Another note. There can be still pictures in the mpeg stream. So for every picture input to the deinterlacer, that picture must be returned without having to input any more pictures. Is this a problem? Is there any case when you have to look at future pictures to deinterlace, instead of only previous ones? It might be possible to make a call when ogle detects a still picture so you can output it directly in that case. /Bj|rn