Commit graph

686 commits

Author SHA1 Message Date
Wind Yuan
1632b40982 mpeg4: fix timestamp issues on too fast playback.
Improve generation of presentation timestamps to be less sensitive
to input stream errors. In practise, GOP is also a synchronization
point for PTS calculation.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-10 11:38:06 +02:00
Gwenole Beauchesne
449606efc5 Fix build without JPEG decoder. 2012-04-16 10:02:29 +02:00
Wind Yuan
bf9f77b1af mpeg4: fix VOP coding type of backward reference pictures.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-12 11:48:24 +02:00
Wind Yuan
60b5c2da97 mpeg4: fix handling of temporal reference distances.
TRD and TRB fields are not large enough to hold the difference of PTS
expressed with nanosecond resolution. So, compute them from the original
VOP info.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-12 11:44:16 +02:00
Gwenole Beauchesne
687b482895 dpb: mpeg2: cosmetics.
Define MAX_MPEG2_REFERENCES to 2 and avoid magic numbers all around.
2012-04-12 11:00:22 +02:00
Wind Yuan
75e8a7d6f8 Add initial JPEG decoder.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-11 19:38:12 +02:00
Wind Yuan
c350a0809d codecparsers: add JPEG parser.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-11 19:38:12 +02:00
Wind Yuan
5d75cc4c6f vaapidecode: fix VA display type.
Fix typo whereby plain VADisplay type was used instead of the GstVaapiDisplay
wrapper.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-10 15:19:56 +02:00
Gwenole Beauchesne
68d1b7e525 vaapidecode: fix includes when compiling for a single API. 2012-04-10 15:19:56 +02:00
Gwenole Beauchesne
49b1dca2d3 mpeg2: fix calculation of macroblock_offset.
Fix decoding of streams with extra slice() information before the first
macroblock(). e.g. this fixes sony-ct3.bs from conformance test.
2012-04-02 18:42:12 +02:00
Gwenole Beauchesne
2d36f6199e mpeg2: fix interpolation of GOP TSN from new PTS.
New GOP TSN base could be mis-calculated. In particular, this fixes
decoding of uruseiyatsura.vob from <http://samples.mplayerhq.hu/>.
2012-04-02 18:09:21 +02:00
Gwenole Beauchesne
9c8b85b3c7 mpeg2: fix decoding of high profile streams.
Allow MPEG-2 High profile streams only if the HW supports that profile
or no High profile specific bits are used, and thus Main profile could
be used instead. i.e. chroma_format is 4:2:0, intra_dc_precision is not
set to 11 and no sequence_scalable_extension() was parsed.
2012-04-02 16:12:32 +02:00
Gwenole Beauchesne
84b5fc5e58 vaapidecode: report unsupported codec profiles.
Try to gracefully abort when the HW does not support the requested
profile. There is no fallback unless profiles are correctly parsed
and matched through caps beforehand.
2012-04-02 16:11:22 +02:00
Holger Kaelberer
bd08610e07 vaapisink: don't resize a 'foreign' X-window.
Don't forcibly resize foreign X windows. The user is responsible for
their size and vaapisink shall not change this.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-02 13:33:55 +02:00
Holger Kaelberer
c37c9ca6cf vaapisink: recalculate render rect only if caps are negotiated.
Fix gst_vaapisink_xoverlay_set_window_handle() when it is called before
caps got negotiated. Besides, when a foreign window is provided by the
user, so should the render rect.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-02 13:33:13 +02:00
Gwenole Beauchesne
c28eef0cb2 Bump version for development. 2012-04-02 13:07:34 +02:00
Gwenole Beauchesne
b819c890e7 0.3.6. 2012-04-02 13:06:15 +02:00
Gwenole Beauchesne
d9c57a236d Fix a few documentation issues. 2012-04-02 13:06:15 +02:00
Gwenole Beauchesne
7490c3500d Update introduction and changelog. 2012-04-02 11:38:44 +02:00
Gwenole Beauchesne
5975def8ab mpeg2: allocate dummy picture for first field based I-frame.
In P-pictures, prediction shall be made from the two most recently
decoded reference fields. However, when the first I-frame is a field,
the next field of the current picture could be a P-picture but only a
single field was decoded so far. In this case, create a dummy picture
with POC = -1 that will be used as reference.

Some VA drivers would error out if P-pictures don't have a forward
reference picture. This is true in general but not in this very specific
initial case.
2012-04-02 11:36:56 +02:00
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
Wind Yuan
b33dd69300 mpeg4: improve error checking while decoding packets.
decode_picture() could return an error when an MPEG-4 profile is not
supported for example. In this case, the underlying VA context is not
allocated and no other proper action can be taken. Likewise on exit
from decode_slice().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-30 17:23:38 +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
195a61fa02 decoder: allow pictures to be cloned for field decoding.
Add gst_vaapi_picture_new_field() function that clones a picture, while
preserving the parent picture surface. i.e. the surface proxy reference
count is increased and other fields copied as is. Besides, the picture
is reset into a "non-output" mode.
2012-03-28 18:58:27 +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
Gwenole Beauchesne
e8756ae427 decoder: add OUTPUT flag to pictures.
Allow pictures to be marked as output gst_vaapi_picture_output().
2012-03-28 17:59:19 +02:00
Gwenole Beauchesne
a7ec623279 decoder: fix semantics of SKIPPED pictures.
If GstVaapiPicture has flag SKIPPED set, this means gst_vaapi_picture_output()
will not push the underlying surface for rendering. Besides, VC-1 skipped P-frame
has nothing to do with rendering. This only means that the currently decoded
picture is just a copy of its reference picture.
2012-03-28 17:59:19 +02:00
Gwenole Beauchesne
b98d334dce vaapipostproc: get "interlaced" attribute from surface proxy.
Add new "interlaced" attribute to GstVaapiSurfaceProxy. Use this in
vaapipostproc so that to handles cases where bitstream is interlaced
but almost only frame pictures are generated. In this case, we should
not be alternating between top/bottom fields.
2012-03-28 17:59:19 +02:00
Gwenole Beauchesne
894d65b81a vaapipostproc: add new element for video postprocessing.
Add vaapipostproc element for video postprocessing. So far, only basic
bob deinterlacing is implemented. Interlaced mode is automatically
detected based on sink caps ("interlaced" field).
2012-03-26 14:37:24 +02:00
Gwenole Beauchesne
a5144358d1 videobuffer: add surface render flags.
Allow rendering flags, as a combination of GstVaapiSurfaceRenderFlags,
to be set to the video buffer. In particular, this is mostly useful for
basic deinterlacing.
2012-03-26 12:01:36 +02:00
Gwenole Beauchesne
3b67533d3d compat: add compatibility glue with VA-API 0.34+ (WIP). 2012-03-23 17:13:58 +01:00
Gwenole Beauchesne
7277f0e220 h264: skip all Filler Data NALs. 2012-03-23 17:11:18 +01:00
Wind Yuan
81ab8dad37 mpeg4: check for decoder status prior to decoding packet.
Make sure there is a VA surface free prior to decoding the current frame.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-22 14:44:42 +01:00
Wind Yuan
d43f3dc50a decode: delay NEWSEGMENT event if vaapidecode element was not linked.
Rationale: playbin2 links all elements at run-time. Once vaapidecode
is created and a NEWSEGMENT event arrives, downstream element may not
be ready yet. So, delay this event until next element is chained in,
otherwise basesink could output "Received buffer without a new-segment.
Assuming timestamps start from 0".

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-22 14:33:17 +01: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
Holger Kaelberer
2ebfa66ade ffmpeg: add support for interlaced streams.
Evaluate interlaced stream properties.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-19 18:43:06 +01:00
Holger Kaelberer
0d0cff695f vaapidecode: propagate interlaced and TFF properties downstream.
Propagate "interlaced" caps downstream and set "tff" buffer flag
appropriately to output buffers for interlaced pictures.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-19 18:43:06 +01:00
Holger Kaelberer
82f11ffb30 decoder: maintain caps for interlaced streams.
Extend GstVaapiDecoder base object to maintain caps with "interlaced"
property.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-19 18:43:06 +01:00
Holger Kaelberer
8593fb619c surfaceproxy: add TFF property.
Add TFF (top-field-first) property to GstVaapiSurfaceProxy.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-19 18:43:06 +01:00
Gwenole Beauchesne
c94390be71 AUTHORS: update to match current authors. 2012-03-16 14:21:36 +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