Commit graph

46 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
28d01c0857 libs: small code style fixes
This a set of small code style fixes detected as-is by gst-indent.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-02-03 12:45:30 +01:00
Gwenole Beauchesne
939bdb08a5 decoder: add initial infrastructure for marking corrupted output.
Add initial infrastructure in core codec library and vaapidecode to mark
corrupted frames as such. A corrupted frame is such a frame that was
reconstructed from invalid references for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=751434

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-07-20 15:25:46 +02:00
Wind Yuan
a89a8cf1e3 decoder: add utility function to clone picture objects.
https://bugzilla.gnome.org/show_bug.cgi?id=703921

Signed-off-by: Wind Yuan <feng.yuan@intel.com>
[added cosmetic changes, fixed propagation of "one-field" flag to
 children, fixed per-codec clone modes (h264)]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
8f71f74c5d decoder: h264: add initial support for repeat-first-field (RFF) flag.
Use the SEI pic_timing() message to track and propagate down the repeat
first field (RFF) flag. This is only initial support as there is one
other condition that could induce the RFF flag, which is not handled
yet.
2014-11-14 10:11:41 +01:00
Gwenole Beauchesne
702de9ad2f decoder: propagate MVC metadata ("view-id", head of multiview set).
Add new GstVaapiSurfaceProxy flag FFB, which means "first frame in
bundle", and really expresses the first view component of a multi
view coded frame. e.g. in H.264 MVC, the surface proxy has flag FFB
set if VOIdx = 0.

Likewise, new API is exposed to retrieve the associated "view-id".
2014-06-30 19:13:25 +02:00
Gwenole Beauchesne
70a48e0962 decoder: propagate "one-field" flags.
Allow decoders to set the "one-field" attribute when the decoded frame
genuinely has a single field, or if the second field was mis-decoded but
we still want to display the first field.
2014-06-30 19:13:25 +02:00
Gwenole Beauchesne
f040f4f8b4 decoder: output decoded frames only once.
Make sure to output the decoded picture, and push the associated
GstVideoCodecFrame, only once. The frame fully represents what needs
to be output, included for interlaced streams. Otherwise, the base
GstVideoDecoder class would release the frame twice.

Anyway, the general process is to output decoded frames only when
they are complete. By complete, we mean a full frame was decoded or
both fields of a frame were decoded.
2014-06-30 19:13:25 +02:00
Gwenole Beauchesne
8c5e89c298 decoder: h264: add initial support for MVC.
https://bugzilla.gnome.org/show_bug.cgi?id=721772
2014-05-21 20:04:34 +02:00
Zhao, Halley
029bae0b6a Add initial VP8 decoder.
https://bugzilla.gnome.org/show_bug.cgi?id=722761

[complete overhaul, fixed support for resolution changes]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-18 20:03:44 +02:00
Gwenole Beauchesne
6bf3c1863c legal: update copyright notice dates. 2014-01-22 19:02:35 +01:00
Gwenole Beauchesne
39dda15f5f codec: add helper macros to maintain object refcount.
Add gst_vaapi_mini_object_{ref,unref,replace}() helper macros so that
to avoid explicit casts to GstVaapiMiniObject in all caller sites.
2014-01-09 09:59:17 +01:00
Gwenole Beauchesne
caf13671bb codec: re-indent decoder objects. 2014-01-09 09:46:46 +01:00
Gwenole Beauchesne
15519ebe3d legal: add per-file authorship information.
Credit original authors on a per-file basis as we cannot expect people
to know all country-specific rules, or bother browsing through the git
history.
2013-11-22 06:39:15 +01:00
XuGuangxin
f9d0d6e272 libs: robustify decoder objects and surface proxy initialization.
Fix GstVaapiPicture, GstVaapiSlice and GstVaapiSurfaceProxy initialization
sequences to have the expected default values set beforehand in case of an
error raising up further during creation. i.e. make it possible to cleanly
destroy those partially initialized objects.

https://bugzilla.gnome.org/show_bug.cgi?id=707108

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-21 11:08:23 +01:00
Gwenole Beauchesne
5444ab44d2 jpeg: add support for multiscan images.
Add support for images with multiple scans per frame. The Huffman table
can be updated before SOS, and thus possibly requiring multiple uploads
of Huffman tables to the VA driver. So, the latter must be able to cope
with multiple VA buffers of type 'huffman-table' and with the correct
sequential order.
2013-09-23 17:38:07 +02:00
Gwenole Beauchesne
b358651fb3 decoder: dispose GstVideoCodecFrame earlier.
Once the picture was output, it is no longer necessary to keep an extra
reference to the underlying GstVideoCodecFrame. So, we can release it
earlier, and maybe subsequently release the associate surface proxy
earlier.
2013-07-15 17:43:34 +02:00
Gwenole Beauchesne
1fff3a44dd decoder: fix memory leak when processing interlaced pictures.
Fix memory leak when processing interlaced pictures and that occurs
because the first field, represented as a GstVideoCodecFrame, never
gets released. i.e. when the picture is completed, this is generally
the case when the second field is successfully decoded, we need to
propagate the GstVideoCodecFrame of the first field to the original
GstVideoDecoder so that it could reclaim memory.

Otherwise, we keep accumulating the first fields into GstVideoDecoder
private frames list until the end-of-stream is reached. The frames
are eventually released there, but too late, i.e. too much memory
may have been consumed.

https://bugzilla.gnome.org/show_bug.cgi?id=701257
2013-07-15 14:01:06 +02:00
Sreerenj Balachandran
e66e72e7e3 decoder: add support for video cropping.
Add gst_vaapi_picture_set_crop_rect() helper function to copy the video
cropping information from raw bitstreams to each picture being decoded.
Also add helper function to surface proxy to propagate that information
outside of libgstvaapi. e.g. plug-in elements or standalone applications.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:52:56 +02:00
Gwenole Beauchesne
3cc7b26961 libs: use GstVaapiMiniObject for video decoders.
Port GstVaapiDecoder and GstVaapiDecoder{MPEG2,MPEG4,JPEG,H264,VC1} to
GstVaapiMiniObject. Add gst_vaapi_decoder_set_codec_state_changed_func()
helper function to let the user add a callback to a function triggered
whenever the codec state (e.g. caps) changes.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
87e5717f66 decoder: use new GstVaapiSurfaceProxy utility functions.
Use new GstVaapiSurfaceProxy internal helper functions to propagate the
necessary GstVideoCodecFrame flags to vaapidecode (GStreamer 0.10).

Also make GstVaapiDecoder push_frame() operate similarly to drop_frame().
i.e. increase the GstVideoCodecFrame reference count in push_frame rather
than gst_vaapi_picture_output().
2013-04-16 19:07:24 +02:00
Sreerenj Balachandran
51151e7aa1 Add initial support for GStreamer 1.0.
This integrates support for GStreamer API >= 1.0 only in the libgstvaapi
core decoding library. The changes are kept rather minimal here so that
the library retains as little dependency as possible on core GStreamer
functionality.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00
Gwenole Beauchesne
e22a863084 decoder: simplify acquisition/release of spare surface.
Introduce gst_vaapi_surface_proxy_new_from_pool() to allocate a new surface
proxy from the context surface pool. This change also makes sure to retain
the parent surface pool in the proxy.

Besides, it was also totally useless to attach/detach parent context to
VA surface each time we acquire/release it. Since the whole context owns
all associated VA surfaces, we can mark this as such only once and for all.
2013-04-03 13:34:59 +02:00
Gwenole Beauchesne
0c99f351fc legal: fix year for some copyright notices (2013). 2013-01-29 14:37:02 +01:00
Gwenole Beauchesne
492cafdbc1 decoder: always use the calculated presentation timestamp.
Use PTS value computed by the decoder, which could also be derived from
the GstVideoCodecFrame PTS. This makes it possible to fix up the PTS if
the original one was miscomputed or only represented a DTS instead.
2013-01-03 13:05:47 +01:00
Gwenole Beauchesne
c727e5b6d6 decoder: drop useless checks for codec objects.
Codec objects are used internally only and they are bound to be created
with a valid GstVaapiDecoder object.
2013-01-03 09:08:19 +01:00
Gwenole Beauchesne
51d028a628 surfaceproxy: drop accessors to obsolete attributes.
Make GstVaapiSurfaceProxy only a thin wrapper around a VA context and a
VA surface. i.e. drop any other attribute like timestamp, duration,
interlaced or top-field-first.
2012-12-18 15:31:52 +01:00
Gwenole Beauchesne
8c2d9bcd24 decoder: maintain decoded frames as GstVideoCodecFrame objects.
Maintain decoded surfaces as GstVideoCodecFrame objects instead of
GstVaapiSurfaceProxy objects. The latter will tend to be reduced to
the strict minimum: a context and a surface.
2012-12-18 15:31:52 +01:00
Gwenole Beauchesne
6bed9ebe0f decoder: expose new parse/decode API.
Introduce new decoding process whereby a GstVideoCodecFrame is created
first. Next, input stream buffers are accumulated into a GstAdapter,
that is then passed to the _parse() function. The GstVaapiDecoder object
accumulates all parsed units and when a complete frame or field is
detected, that GstVideoCodecFrame is passed to the _decode() function.

Ultimately, the caller receives a GstVaapiSurfaceProxy if decoding
process was successful.
2012-12-18 15:31:51 +01:00
Gwenole Beauchesne
f88374d642 Port codec objects to GstVaapiMiniObject. 2012-12-18 15:31:51 +01:00
Gwenole Beauchesne
1130a46837 surfaceproxy: port to GstVaapiMiniObject.
GstVaapiSurfaceProxy does not use any particular functionality from
GObject. Actually, it only needs a basic object type with reference
counting.

This is an API and ABI change.
2012-12-18 15:31:50 +01:00
Gwenole Beauchesne
e11f815b0d decoder: fix gst_vaapi_picture_new_field() object type.
Fix gst_vaapi_picture_new_field() to preserve the original picture type.
e.g. gst_vaapi_picture_new_field() with a GstVaapiPictureH264 argument
shall generate a GstVaapiPictureH264 object.
2012-11-14 17:39:19 +01: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
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
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
ab94048ea0 decoder: fix double buffer free with some VA drivers.
vaRenderPicture() implicitly disposes VA buffers. Some VA drivers would
push the VA buffer object into a list of free buffers to be re-used. However,
reference pictures (and data) that was kept would explicitly release the VA
buffer object later on, thus possibly destroying a valid (re-used) object.

Besides, some other VA drivers don't support correctly the vaRenderPicture()
semantics for VA buffers disposal and would leak memory if there is no explicit
vaDestroyBuffer(). The temporary workaround is to explcitily destroy VA buffers
right after vaRenderPicture(). All VA drivers need to be aligned.
2012-02-13 10:10:35 +01:00
Gwenole Beauchesne
fe791efc28 decoder: allocate proxy surface earlier.
This simplifies gst_vaapi_picture_output() to only update the presentation
timestamp and submit the proxy to the decoder for output.
2012-01-31 11:34:17 +01:00
Gwenole Beauchesne
399875ee86 decoder: fix memory leak of VA objects on exit.
On sequence end, if the last decoded picture is not output for rendering,
then the proxy surface is not created. In this case, the original surface
must be released explicitly to the context.
2012-01-31 11:29:06 +01:00
Gwenole Beauchesne
0fb1147d9c Add header for system-dependent definitions. 2012-01-30 19:52:10 +01:00
Gwenole Beauchesne
a79c7f9fa6 decoder: optimize slice data buffers initialization.
VA drivers may have a faster means to transfer user buffers to GPU
buffers than using memcpy(). In particular, on Intel Gen graphics, we
can use pwrite(). This provides for faster upload of bitstream and can
help higher bitrates.

vaapi_create_buffer() helper function was also updated to allow for
un-mapped buffers and pre-initialized data for buffers.
2012-01-30 10:32:14 +01:00
Gwenole Beauchesne
4a46b5d6c4 decoder: retain proxy surface until the GstVaapiPicture is destroyed.
Keep a valid reference to the proxy in GstVaapiPicture so that frames
marked as "used for reference" could be kept during the lifetime of the
picture. i.e. don't release them too soon as they could be re-used right
away.
2012-01-27 15:56:32 +01:00
Gwenole Beauchesne
7b19745141 decoder: simplify output of decoded frames.
Drop obsolete gst_vaapi_decoder_push_surface() that was no longer used.
Change gst_vaapi_decoder_push_surface_proxy() semantics to assume PTS
is already set correctly and reference count increased, if necessary.
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