Commit graph

84 commits

Author SHA1 Message Date
Gwenole Beauchesne
99932049e4 mpeg2: fix simple to main profile fallback.
Allow fallback from simple to main profile when the HW decoder does
not support the former profile and that no sequence_header_extension()
is available to point out this.
2012-04-02 11:36:56 +02:00
Gwenole Beauchesne
75538bbc9b decoder: use POC to maintain the DPB.
Introduce a POC field in GstVaapiPicture so that to store simpler sequential
numbers. A signed 32-bit integer should be enough for 1 year of continuous
video streaming at 60 Hz.

Use this new POC value to maintain the DPB, instead of 64-bit timestamps.
This also aligns with H.264 that will be migrated to GstVaapiDpb infrastructure.
2012-03-30 17:08:37 +02:00
Gwenole Beauchesne
d51bb87482 mpeg2: rework generation of presentation timestamps.
Always prefer PTS from the demuxer layer for GOP times. If this is invalid,
i.e. demuxer could not determine the PTS or the generated PTS is lower than
max PTS from past pictures, then try to fix it up based on the duration of
a frame.

For picture PTS, simply use the GOP PTS formerly computed then use TSN to
reconstruct a current time. Also now handle wrapped TSN correctly.
2012-03-30 17:08:37 +02:00
Gwenole Beauchesne
6eeb20a953 mpeg2: ignore empty user-data packets.
Fix tcela-8.bits conformance test.
2012-03-30 17:08:37 +02:00
Gwenole Beauchesne
7af40475d5 mpeg2: review and report errors accordingly.
Use GST_ERROR() to report real errors instead of hiding them into
GST_DEBUG().
2012-03-29 11:13:20 +02:00
Gwenole Beauchesne
b003a2bab2 mpeg2: fix invalid interlaced frame in progressive sequence.
Some streams, badly constructed, could have signaled an interlaced
frame while the sequence was meant to be progressive. Warn and force
frame to be progressive in this case.
2012-03-28 19:41:28 +02:00
Gwenole Beauchesne
7a9410f826 mpeg2: add support for interlaced streams.
Pictures are submitted to the HW for rendering only when both fields
are decoded or current picture is a full frame.
2012-03-28 19:40:27 +02:00
Gwenole Beauchesne
ac4fc0d36c mpeg2: add new decoded picture buffer infrastructure.
Decoded pictures are now maintained into DPB, similarly to H.264.
The same mechanism could be re-used for VC-1 and MPEG-4:2 codecs.
2012-03-28 19:36:52 +02:00
Gwenole Beauchesne
b56ac16224 decoder: add first-field flag to picture.
Add first-field (FF) flag to GstVaapiPicture, thus not requiring is_first_field
member in each decoder. Rather, when a GstVaapiPicture is created, it is considered
as the first field. Any subsequent allocated field will become the second field.
2012-03-28 19:25:49 +02:00
Gwenole Beauchesne
c27385aa8d decoder: rework picture field flags.
Add top-field-first (TFF) and interlaced flags to GstVaapiPicture so they
could be propagated to the surface proxy when it is pushed for rendering.
Besides, top and bottom fields are now expressed with picture structure flags
from GstVaapiSurfaceRenderFlags.
2012-03-28 18:24:39 +02:00
Wind Yuan
baa80d9753 mpeg2: fix GOP timestamps when incorrect data is received.
Some streams have incorrect GOP timestamps, or nothing set at all.
i.e. GOP time is 00:00:00 for all GOPs. Try to recover in this case
from demuxer timestamps, which are monotonic.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-22 13:45:47 +01:00
Wind Yuan
fc3edde05c mpeg2: don't decode anything before the first sequence_header().
Skip all pictures prior to the first sequence_header(). Besides,
skip all picture_data() if there was no prior picture_header().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-21 17:38:22 +01:00
Gwenole Beauchesne
d6ab5e1210 mpeg2: fix is_first_field calculation.
Reset is_first_field for frame pictures. Factor out locations where
the flag is updated.
2012-03-16 13:56:48 +01:00
Gwenole Beauchesne
10dfc67cca mpeg2: catch incorrect picture_structure from bitstreams.
Assume "frame" picture structure if the syntax element was zero or if
progressive_frame is set.
2012-03-16 13:56:26 +01:00
Gwenole Beauchesne
8bbe22f831 mpeg2: fix slice_vertical_position calculation (again).
VA-API expects slice_vertical_position as the initial position from the
bitstream. i.e. the direct slice() information. VA drivers will be fixed
accordingly.
2012-03-16 13:55:28 +01:00
Sreerenj Balachandran
033a675bcc mpeg2: fix size calculation from sequence_extension().
Original values from sequence_header() are 12-bit and the remaining
2 most significant bits are coming from sequence_extension().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-02-24 11:09:05 +01:00
Gwenole Beauchesne
f1883b4a4e mpeg2: fix slice_vertical_position calculation.
Make sure to adjust slice_vertical_position if picture structure
is a top or bottom field.
2012-02-23 16:41:11 +01:00
Gwenole Beauchesne
3bc68b5b32 mpeg2: fix decoding at end-of-sequence. 2012-02-23 16:15:23 +01:00
Gwenole Beauchesne
60e515e0b7 mpeg2: fix slice_horizontal_position calculation. 2012-02-23 16:15:22 +01:00
Gwenole Beauchesne
b36d2c810e mpeg2: drop useless mb_y and mb_height members. 2012-02-23 16:14:02 +01:00
Gwenole Beauchesne
d47031b8ce mpeg2: fix decoding of multiple slices with same slice_vertical_position.
6.3.15 says that "some slices may have the same slice_vertical_position,
since slices may start and finish anywhere". So, we can't submit the current
picture to the HW right away since subsequent slices would be missing.
2012-02-23 11:19:48 +01:00
Gwenole Beauchesne
5cc357f88a cosmetics: fix warnings (drop unused variables). 2012-02-07 10:06:15 +01:00
Gwenole Beauchesne
d75d70d395 mpeg2: fix crash when there is no free surface to decode into. 2012-02-06 15:54:42 +01:00
Gwenole Beauchesne
11d09495ea mpeg2: use GstAdapter to track input sequence.
This fixes possible memory leaks and improves performance by removing
some extra copies.
2012-01-31 11:02:04 +01:00
Gwenole Beauchesne
0fb1147d9c Add header for system-dependent definitions. 2012-01-30 19:52:10 +01:00
Gwenole Beauchesne
2897618b85 decoder: properly reference count pictures.
This fixes cases where a GstVaapiPicture would be destroyed whereas
there is still a valid instance of it in either prev, current or
next picture.
2012-01-27 13:28:12 +01:00
Gwenole Beauchesne
e5d12e8853 decoder: rework the internal VA objects API.
The new API simplifies a lot reference counting and makes it more
flexible for future additions/changes. The GstVaapiCodecInfo is
also gone. Rather, new helper macros are provided to allocate
picture, slice and quantization matrix parameter buffers.
2012-01-27 13:28:11 +01:00
Zhao Halley
27fa5903ef mpeg2: fix first field detection.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-01-16 11:40:51 +01:00
Gwenole Beauchesne
a591dc3b72 mpeg2: fix quantisation matrix construction. 2012-01-16 11:40:50 +01:00
Sreerenj Balachandran
697a2804e1 mpeg2: replace GstVaapiTSB API with GstAdapter (gst-plugins-base >= 0.10.24).
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-01-16 11:40:50 +01:00
Gwenole Beauchesne
ab8f602957 mpeg2: fix packets spanning over two buffers. 2012-01-16 11:40:50 +01:00
Gwenole Beauchesne
ce413eb83d mpeg2: ignore system start codes (PES headers). 2012-01-16 11:40:50 +01:00
Gwenole Beauchesne
c5902b7a84 mpeg2: handle closed_gop. 2012-01-16 11:40:50 +01:00
Gwenole Beauchesne
49b4702fb6 Add initial MPEG-2 decoder. 2012-01-16 11:40:50 +01:00