[FFmpeg-devel] [PATCH] H.264: decode picture timing SEI message and get field order
Haruhiko Yamagata
h.yamagata
Sat Nov 1 10:43:06 CET 2008
Hi,
I wrote a patch which implements decoding of picture timing SEI.
[Current problems]
libavcodec derives field order from POCs.
cur->top_field_first = cur->field_poc[0] < cur->field_poc[1];
It assumes BFF if two POSs are equal. This is not always correct.
And it derives AVFrame::interlaced_frame from used decoding process.
cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE;
Sometimes this is not correct. Interlaced/progressive mode of post-decoding
processes such as deinterlacing and color space conversion is not always
same as the mode used during decoding. H.264 for example allows to encode
an interlaced frame using a progressive algorithm. Sample: premiere-paff.ts
(http://x264.nl/h.264.samples/premiere-paff.ts).
[Solutions]
Picture timing SEI message contains pic_struct which defines interlace/progressive
mode of post decoding processes and field order. Most streams have the SEI for
every frame or field. My patch implements decoding of the SEI and use of pic_struct.
Now the field order is always correct. Interlaced picture is judged interlaced.
Field 1 repeat flags are also set.
[Limitation]
As usual, there are exceptions: badly encoded streams. Some progressive
streams from television have pic_struct 3, which indicates interlacing.
Fortunately such streams are rare. This is not my fault, other decoder
show the same behavior.
Please review.
----------------------------- for svn log -----------------------
H.264: Implement decoding of picture timing SEI message
Now correct values are set to interlaced_frame, top_field_first
and repeat_pict in AVFrame structure.
patch by ffdshow tryouts
--------------------------------------------------------------
Best regards,
Haruhiko Yamagata
-------------- next part --------------
A non-text attachment was scrubbed...
Name: docode_picture_timing_SEI.diff
Type: application/octet-stream
Size: 10231 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081101/548a737d/attachment.obj>
More information about the ffmpeg-devel
mailing list