Matthieu Bouron [Tue, 17 Dec 2013 15:27:10 +0000 (15:27 +0000)]
vaapidecode: add system memory caps to template caps.
Since vaapidecode provides buffer that can be mapped as regular memory,
those caps should be added to the template caps. That only applies to
GStreamer >= 1.2.
https://bugzilla.gnome.org/show_bug.cgi?id=720608
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Wind Yuan [Tue, 17 Dec 2013 02:26:03 +0000 (10:26 +0800)]
vaapidecode: fix hang on SIGINT.
vaapidecode hangs when pipeline is stopped without any EOS, e.g. when
<Ctrl>+C is pressed, thus causing the srcpad task to keep running and
locked. This fixes a deadlock on state change from PAUSED to READY.
https://bugzilla.gnome.org/show_bug.cgi?id=720584
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Wind Yuan [Tue, 17 Dec 2013 09:23:42 +0000 (04:23 -0500)]
vaapiencode: fix possible hang on SIGINT.
vaapiencode might hang when the pipeline is stopped without any EOS,
e.g. when <Ctrl>+C is pressed, thus causing the srcpad task to keep
running and locked. This fixes a possible deadlock on state change
from PAUSED to READY.
https://bugzilla.gnome.org/show_bug.cgi?id=720584
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Tue, 14 Jan 2014 15:33:04 +0000 (16:33 +0100)]
vaapiencode: fix typo in error message.
Fix incomplete error message in gst_vaapiencode_push_frame().
Gwenole Beauchesne [Tue, 14 Jan 2014 18:08:36 +0000 (19:08 +0100)]
plugins: add helpers to create video caps with features.
Add gst_vaapi_video_format_new_template_caps_with_features() helper
function to add the supplied caps feature string on GStreamer >= 1.2.
Add gst_vaapi_find_preferred_caps_feature() helper function to discover
the "best" caps feature to use for the supplied pad. In practice, we
will always favor memory:VASurface first, then meta:GLTextureUploadMeta,
and finally the system memory caps.
https://bugzilla.gnome.org/show_bug.cgi?id=719372
Matthieu Bouron [Thu, 9 Jan 2014 11:54:11 +0000 (11:54 +0000)]
plugins: don't apply overlay composition in GLTextureUpload function.
The GLTextureUpload function is not in charge of doing the overlay
composition if any.
https://bugzilla.gnome.org/show_bug.cgi?id=721859
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Tue, 14 Jan 2014 12:47:52 +0000 (13:47 +0100)]
encoder: re-order submission of VA objects.
Change the submission order of VA objects so that to make that process
more logical. i.e. submit sequence parameter first, if any; next the
packed headers associated to sequece, picture or slices; and finally
the actual picture and associated slices.
Gwenole Beauchesne [Tue, 14 Jan 2014 11:01:11 +0000 (12:01 +0100)]
encoder: clean-up objects.
Various clean-ups to improve consistency and readability: rename some
variables, drop unused macro definitions, drop initialization of vars
that are zero-initialized from the base class, drop un-necessary casts,
allocate GPtrArrays with a destroy function.
Gwenole Beauchesne [Mon, 13 Jan 2014 12:41:35 +0000 (13:41 +0100)]
encoder: h264: fix frame cropping rectangle calculation.
Fix frame cropping rectangle calculation to handle horizontal resolutions
that don't match a multiple of 16 pixels, but also the vertical resolution
that was incorrectly computed for progressive sequences too.
https://bugzilla.gnome.org/show_bug.cgi?id=722089
Gwenole Beauchesne [Mon, 13 Jan 2014 10:49:14 +0000 (11:49 +0100)]
encoder: h264: improve automatic bitrate calculation.
For non "Constant-QP" modes, we could provide more reasonable heuristics
for the target bitrate. In general, 48 bits per macroblock with all the
useful coding tools enable looks safe enough. Then, this rate is raised
by +10% to +15% for each coding tool that is disabled.
https://bugzilla.gnome.org/show_bug.cgi?id=719699
Gwenole Beauchesne [Mon, 13 Jan 2014 10:11:25 +0000 (11:11 +0100)]
encoder: h264: support "high-compression" tuning option.
Add support for "high-compression" tuning option. First, determine the
largest supported profile by the hardware. Next, check any target limit
set by the user. Then, enable each individual coding tool based on the
resulting profile_idc value to use.
https://bugzilla.gnome.org/show_bug.cgi?id=719696
Gwenole Beauchesne [Sun, 12 Jan 2014 21:24:04 +0000 (22:24 +0100)]
encoder: h264: allow target decoder constraints.
Allow user to precise the largest profile to use for encoding due
to target decoder constraints. For instance, if CABAC entropy coding
mode is requested by "constrained-baseline" profile only is desired,
then an error is returned during codec configuration.
Also make sure that the suitable profile we derived actually matches
what the HW can cope with.
https://bugzilla.gnome.org/show_bug.cgi?id=719694
Gwenole Beauchesne [Sun, 12 Jan 2014 21:14:11 +0000 (22:14 +0100)]
encoder: h264: refine size of coded buffer.
Refine the heuristic to determine the maximum size of a coded buffer
to account for the exact number of slices. set_context_info() is the
last step during codec reconfiguration, no additional change is done
afterwards, so re-using the num_slices field here is fine.
https://bugzilla.gnome.org/show_bug.cgi?id=719953
Wind Yuan [Fri, 13 Dec 2013 09:36:08 +0000 (17:36 +0800)]
encoder: h264: expose more coding tools.
Add new H.264 coding tools to improve compression:
- "cabac": enable CABAC entropy coding (default: FALSE);
- "dct8x8": enable spatial transform 8x8 (default: FALSE).
https://bugzilla.gnome.org/show_bug.cgi?id=719693
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Fri, 10 Jan 2014 17:18:25 +0000 (18:18 +0100)]
encoder: h264: derive profile and level from active coding tools.
Automatically derive the minimum profile and level to be used for
encoding, based on the activated coding tools. The encoder will
be trying to generate a bitstream that has the best chances to be
decoded on most platforms by default.
Also change the default profile to "constrained-baseline" so that
to ensure maximum compatibility when the stream is decoded.
https://bugzilla.gnome.org/show_bug.cgi?id=719691
Gwenole Beauchesne [Fri, 10 Jan 2014 16:02:44 +0000 (17:02 +0100)]
encoder: h264: fix hardware profile lookup.
Fix lookup for a suitable HW profile, as to be used by the underlying
hardware, based on heuristics that lead to characterize the SW profile,
i.e. the one used by the SW level encoding logic.
Also fix constraint_set0_flag (A.2.1) and constraint_set1_flag (A.2.2)
as they should respectively match the baseline and main profile.
https://bugzilla.gnome.org/show_bug.cgi?id=719827
Gwenole Beauchesne [Fri, 10 Jan 2014 13:46:15 +0000 (14:46 +0100)]
encoder: h264: support only the byte-stream format.
The libgstvaapi core encoders are meant to support raw bitstreams only.
Henceforth, we are always producing a stream in "byte-stream" format.
However, the "codec-data" buffer which holds SPS and PPS headers is
always available. The "lengthSizeMinusOne" field is always set to 3
so that in-place "byte-stream" format to "avc" format conversion could
be performed.
Gwenole Beauchesne [Fri, 10 Jan 2014 13:05:40 +0000 (14:05 +0100)]
encoder: h264: clean-ups.
Various clean-ups to improve consistency and readability: rename some
variables, drop unused macro definitions, drop initialization of vars
that are zero-initialized from the base class, drop un-necessary casts.
Gwenole Beauchesne [Mon, 13 Jan 2014 16:11:15 +0000 (17:11 +0100)]
encoder: mpeg2: fix hardware profile lookup.
Fix lookup for a suitable HW profile, as to be used by the underlying
hardware, based on heuristics that lead to characterize the SW profile,
i.e. the one used by the SW level encoding logic.
Gwenole Beauchesne [Mon, 13 Jan 2014 15:56:04 +0000 (16:56 +0100)]
encoder: mpeg2: derive profile and level from active coding tools.
Automatically derive the minimum profile and level to be used for
encoding, based on the activated coding tools. Improve lookup for
the best suitable level with the new MPEG-2 helper functions.
Also change the default profile to "simple" so that to ensure maximum
compatibility when the stream is decoded.
https://bugzilla.gnome.org/show_bug.cgi?id=719703
Gwenole Beauchesne [Mon, 13 Jan 2014 13:41:15 +0000 (14:41 +0100)]
encoder: mpeg2: clean-ups.
Various clean-ups to improve consistency and readability: drop unused
macro definitions, drop initialization of vars that are zero-initialized
from the base class, drop un-necessary casts.
Gwenole Beauchesne [Mon, 13 Jan 2014 09:48:25 +0000 (10:48 +0100)]
encoder: add tuning options API.
Add encoder "tune" option to override the default behaviour that is to
favor maximum decoder compatibility at the expense of lower compression
ratios.
Expected tuning options to be developed are:
- "high-compression": improve compression, target best-in-class decoders;
- "low-latency": tune for low-latency decoding;
- "low-power": tune for encoding in low power / resources conditions.
Gwenole Beauchesne [Sun, 12 Jan 2014 22:17:14 +0000 (23:17 +0100)]
encoder: fix bitrate units to match kbps.
Bitrate is expressed in kilobits per second (kbps). So, this exactly
means in multiple of 1000 bits, not 1024 bits.
https://bugzilla.gnome.org/show_bug.cgi?id=722086
Gwenole Beauchesne [Sun, 12 Jan 2014 20:57:20 +0000 (21:57 +0100)]
encoder: clean-ups.
Drop obsolete and unused macros. Add a few doc comments. Slightly
improve indentation of a few leftovers.
Gwenole Beauchesne [Sun, 12 Jan 2014 17:52:14 +0000 (18:52 +0100)]
encoder: filter out the supported set of rate-control properties.
Only expose the exact static set of supported rate-control properties
to the upper layer. For instance, if the GstVaapiEncoderXXX class does
only support CQP rate control, then only add it the the exposed enum
type.
Add helper macros and functions to build a GType for an enum subset.
Gwenole Beauchesne [Fri, 10 Jan 2014 12:23:48 +0000 (13:23 +0100)]
encoder: add keyframe period API.
Add gst_vaapi_encoder_set_keyframe_period() interface to allow the
user control the maximum distance between two keyframes. This new
property can only be set prior to gst_vaapi_encoder_set_codec_state().
A value of zero for "keyframe-period" gets it re-evaluated to the
actual framerate during encoder reconfiguration.
Gwenole Beauchesne [Fri, 10 Jan 2014 11:01:51 +0000 (12:01 +0100)]
encoder: improve codec reconfiguration.
Improve codec reconfiguration to be performed only through a single
function. That is, remove the _set_context_info() hook as subclass
should not alter the parent GstVaapiContextInfo itself. Besides, the
VA context is constructed only at the final stages of reconfigure().
Gwenole Beauchesne [Fri, 10 Jan 2014 10:30:25 +0000 (11:30 +0100)]
encoder: fix possible memory leak of coded buffer pools.
Fix gst_vaapi_encoder_reconfigure_internal() to re-/allocate the coded
buffer pool only if the coded buffer size actually changed.
Gwenole Beauchesne [Fri, 10 Jan 2014 09:54:22 +0000 (10:54 +0100)]
encoder: add video codec-state API.
Add interface to communicate the encoder resolution and related info
like framerate, interlaced vs. progressive, etc. This new interface
supersedes gst_vaapi_encoder_set_format() and doesn't use any GstCaps
but rather use GstVideoCodecState.
Note that gst_vaapi_encoder_set_codec_state() is also a synchronization
point for codec config. This means that the encoder is reconfigured
there to match the latest properties.
Gwenole Beauchesne [Mon, 13 Jan 2014 16:18:42 +0000 (17:18 +0100)]
vaapiencode: don't crash on NULL encoder on _finish().
Don't try to destroy an encoder, in GstVideoEncoder::finish() handler,
if it was not created in the first place. Return "not-negotiated" error
since this means we did not even reach GstVideoEncoder::set_format(),
where the encoder could have been created.
This fixes a crash when the vaapiencode_* plug-in elements get deallocated
and that we failed to negotiate either pad.
https://bugzilla.gnome.org/show_bug.cgi?id=719704
Gwenole Beauchesne [Thu, 9 Jan 2014 17:20:24 +0000 (18:20 +0100)]
vaapiencode: use more GstVaapiPluginBase facilities.
Avoid duplication of pad references or query functions since they are
provided through the GstVaapiPluginBase object.
Gwenole Beauchesne [Thu, 9 Jan 2014 17:10:35 +0000 (18:10 +0100)]
vaapiencode: fix negotiation process of output caps.
The specified caps in gst_video_encoder_set_output_state() function
arguments should not contain any resolution, pixel-aspect-ratio,
framerate, codec-data et al. Those rather should be set through the
returned GstVideoCodecState. This means that output caps creation
could be delayed until before gst_video_encoder_finish_frame() is
called.
This greatly simplifies the GstVideoEncoder::set_format() callback
by the way.
Gwenole Beauchesne [Wed, 8 Jan 2014 17:56:23 +0000 (18:56 +0100)]
vaapiencode: make GstVaapiEncode an abstract type.
Make base GstVaapiEncode class an abstract type so that we cannot
create an instance from it without going through any of the codec
specific derived class.
Gwenole Beauchesne [Thu, 9 Jan 2014 09:09:38 +0000 (10:09 +0100)]
vaapiencode: rename a few member functions.
Rename a few member functions to make them more consistent:
- alloc_encoder(): now reduced to allocate the encoder object only;
- alloc_buffer(): allocate buffer from srcpad, and copy bitstream.
Gwenole Beauchesne [Wed, 8 Jan 2014 17:36:46 +0000 (18:36 +0100)]
vaapiencode: update for new properties API.
Update MPEG-2 and H.264 encode elements to cope with the new core
libgstvaapi properties API. i.e. all configurable properties are now
directly handled at the GstVaapiEncoder level.
Besides, this also makes sure to not use or modify the GstVaapiEncoder
private definitions directly. Private data need to remain private.
https://bugzilla.gnome.org/show_bug.cgi?id=719529
Gwenole Beauchesne [Mon, 6 Jan 2014 16:46:40 +0000 (17:46 +0100)]
encoder: add properties API.
Add interface to communicate configurable properties to the encoder.
This covers both the common ones (rate-control, bitrate), and the
codec specific properties.
https://bugzilla.gnome.org/show_bug.cgi?id=719529
Gwenole Beauchesne [Mon, 6 Jan 2014 17:01:33 +0000 (18:01 +0100)]
encoder: add bitrate API.
Add gst_vaapi_encoder_set_bitrate() interface to allow the user control
the bitrate for encoding. Currently, changing this parameter is only
valid before the first frame is encoded. Should the value be modified
afterwards, then GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED is
returned.
https://bugzilla.gnome.org/show_bug.cgi?id=719529
Gwenole Beauchesne [Mon, 6 Jan 2014 14:10:36 +0000 (15:10 +0100)]
encoder: add rate control API.
Add gst_vaapi_encoder_set_rate_control() interface to request a new
rate control mode for encoding. Changing the rate control mode is
only valid prior to encoding the very first frame. Afterwards, an
error ("operation-failed") is issued.
https://bugzilla.gnome.org/show_bug.cgi?id=719529
Gwenole Beauchesne [Fri, 3 Jan 2014 15:57:25 +0000 (16:57 +0100)]
vaapiencode: fix indentation.
Gwenole Beauchesne [Fri, 3 Jan 2014 15:57:09 +0000 (16:57 +0100)]
encoder: fix indentation.
Gwenole Beauchesne [Mon, 13 Jan 2014 15:20:06 +0000 (16:20 +0100)]
utils: add new MPEG-2 helper functions.
Add various helper functions to convert profile, level, chroma formats
from gstreamer-vaapi world and the MPEG-2 specification world.
Gwenole Beauchesne [Fri, 10 Jan 2014 18:49:52 +0000 (19:49 +0100)]
utils: h264: don't use fatal asserts.
Replace g_assert() with a g_debug() so that to not make the program
abort when an unsupported value is supplied.
Gwenole Beauchesne [Fri, 10 Jan 2014 18:37:44 +0000 (19:37 +0100)]
utils: h264: add helpers for profile and level string mappings.
Add profile and level helper functions to convert to/from strings.
Gwenole Beauchesne [Fri, 10 Jan 2014 17:27:20 +0000 (18:27 +0100)]
utils: h264: expose levels in public header.
Instal <gst/vaapi/gstvaapiutils_h264.h> header but only expose the
H.264 levels in there. The additional helper functions are meant
to be private for now.
Gwenole Beauchesne [Thu, 9 Jan 2014 08:27:40 +0000 (09:27 +0100)]
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.
Gwenole Beauchesne [Thu, 9 Jan 2014 08:30:49 +0000 (09:30 +0100)]
codec: re-indent decoder objects.
Gwenole Beauchesne [Thu, 9 Jan 2014 08:10:21 +0000 (09:10 +0100)]
codec: re-indent base codec objects.
Matthieu Bouron [Fri, 3 Jan 2014 12:49:05 +0000 (12:49 +0000)]
plugins: do not free debug category in finalize method.
Fixes a crash when multiple vaapidecode elements are finalized since
the debug category is created once in the class init method.
This is a regression from git commit 7e58d60.
https://bugzilla.gnome.org/show_bug.cgi?id=721390
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Thu, 2 Jan 2014 10:35:30 +0000 (11:35 +0100)]
tests: simple-decoder: don't use deprecated g_thread_create().
Use g_thread_try_new() instead of the deprecated g_thread_create()
function. Provide compatibility glue for any GLib version < 2.31.2.
Gwenole Beauchesne [Thu, 2 Jan 2014 10:17:28 +0000 (11:17 +0100)]
Fix printf()-like formats.
Fix formts for various GST_DEBUG et al. invocations. More precisely,
make size_t arguments use the %zu format specifier accordingly; force
XID formats to be a 32-bit unsigned integer; and fix the format used
for gst_vaapi_create_surface_with_format() error cases since we have
been using strings nowadays.
Gwenole Beauchesne [Sat, 21 Dec 2013 06:38:14 +0000 (07:38 +0100)]
utils: format: drop unused helper functions.
The following helper functions are no longer used, thus are removed:
- gst_vaapi_video_format_from_structure()
- gst_vaapi_video_format_from_caps()
- gst_vaapi_video_format_to_caps()
Gwenole Beauchesne [Sat, 21 Dec 2013 06:29:50 +0000 (07:29 +0100)]
utils: re-indent GstVideoFormat related helpers.
Gwenole Beauchesne [Sat, 21 Dec 2013 07:27:30 +0000 (08:27 +0100)]
download: use GstVideoInfo facilities to build output caps.
Use standard GstVideoInfo related functions to build the output caps,
thus directly preserving additional fields as needed, instead of
manually copying them over through gst_vaapi_append_surface_caps().
Also ensure that the input caps are fixated first.
Gwenole Beauchesne [Sat, 21 Dec 2013 09:41:22 +0000 (10:41 +0100)]
plugins: factor out construction of template caps.
Add new helper functions to build video template caps.
- gst_vaapi_video_format_new_template_caps():
create GstCaps with size, frame rate and PAR to full range
- gst_vaapi_video_format_new_template_caps_from_list():
try to create a "simplified" list from the supplied formats
Gwenole Beauchesne [Sat, 21 Dec 2013 05:41:34 +0000 (06:41 +0100)]
plugins: factor out construction of GValue from GstVideoFormat.
Add new helper functions to build GValues from GstVideoFormat:
- gst_vaapi_value_set_format():
build a GValue from the supplied video format
- gst_vaapi_value_set_format_list():
build a GValue list from the supplied array of video formats
Gwenole Beauchesne [Sat, 21 Dec 2013 05:22:30 +0000 (06:22 +0100)]
plugins: re-indent common and video context creation utils.
Gwenole Beauchesne [Fri, 20 Dec 2013 14:31:14 +0000 (15:31 +0100)]
display: don't use GstCaps for decode or encode profiles list.
Replace gst_vaapi_display_get_{decode,encode}_caps() APIs with more
more convenient APIs that return an array of GstVaapiProfile instead
of GstCaps: gst_vaapi_display_get_{decode,encode}_profiles().
Gwenole Beauchesne [Fri, 20 Dec 2013 14:15:05 +0000 (15:15 +0100)]
display: don't use GstCaps for image or subpicture formats list.
Replace gst_vaapi_display_get_{image,subpicture}_caps() APIs, that
returned GstCaps, with more convenient APIs that return an array of
GstVideoFormat: gst_vaapi_display_get_{image,subpicture}_formats().
Gwenole Beauchesne [Fri, 20 Dec 2013 13:01:45 +0000 (14:01 +0100)]
display: allocate queried resources on-demand.
Allocate the set of decoders or encoders on-demand, when they are
queried. Likewise for VA display attributes, image and subpicture
formats.
Gwenole Beauchesne [Fri, 20 Dec 2013 12:27:07 +0000 (13:27 +0100)]
display: re-indent all GstVaapiDisplay related source code.
Gwenole Beauchesne [Fri, 20 Dec 2013 15:04:19 +0000 (16:04 +0100)]
utils: add helper functions to get codec or profile name.
Gwenole Beauchesne [Fri, 20 Dec 2013 16:08:23 +0000 (17:08 +0100)]
plugins: fix permissions for certain files.
Drop the execute bit for gstvaapiuploader.c and gstvaapipostproc.[ch]
files.
Matthieu Bouron [Thu, 12 Dec 2013 17:01:29 +0000 (17:01 +0000)]
plugins: implement GLTextureUploadMeta user data copy.
Makes the copies of a buffer reference their own GLTextureUploadMeta
user data and prevent the original buffer accessing already freed
memory if its copies has been released and freed.
https://bugzilla.gnome.org/show_bug.cgi?id=720336
[Propagate the original meta texture to the copy too]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Tue, 17 Dec 2013 17:52:23 +0000 (18:52 +0100)]
plugins: factor out support for raw YUV buffers on sink pads.
Factor out propose_allocation() hooks, creation of video buffer pool
for the sink pad, conversion from raw YUV buffers to VA surface backed
buffers. Update vaapidecode, vaapiencode and vaapipostproc to cope
with the new GstVaapiPluginBase abilities.
Gwenole Beauchesne [Tue, 17 Dec 2013 17:46:07 +0000 (18:46 +0100)]
plugins: factor out pad caps.
Gwenole Beauchesne [Fri, 13 Dec 2013 15:03:08 +0000 (16:03 +0100)]
plugins: factor out video context sharing code.
Gwenole Beauchesne [Fri, 13 Dec 2013 12:24:24 +0000 (13:24 +0100)]
plugins: factor out GstImplementsInterface.
Gwenole Beauchesne [Fri, 13 Dec 2013 11:00:35 +0000 (12:00 +0100)]
plugins: check type of display obtained from neighbours.
Fix display creation code to check that any display obtained from a
neighbour actually has the type we expect. Note: if display type is
set to "any", we can then accept any VA display type.
Gwenole Beauchesne [Fri, 13 Dec 2013 10:52:47 +0000 (11:52 +0100)]
plugins: factor out display creation process.
Move common VA display creation code to GstVaapiPluginBase, with the
default display type remaining "any". Also add a "display-changed"
hook so that subclasses could perform additional tasks when/if the
VA display changed, due to a new display type request for instance.
All plug-ins are updated to cope with the new internal APIs.
Gwenole Beauchesne [Fri, 13 Dec 2013 09:24:26 +0000 (10:24 +0100)]
plugins: add new base object, store display in there.
Introduce a new GstVaapiPluginBase object that will contain all common
data structures and perform all common tasks. First step is to have a
single place to hold VA displays.
While we are at it, also make sure to store and subsequently release
the appropriate debug category for the subclasses.
Gwenole Beauchesne [Wed, 11 Dec 2013 13:04:27 +0000 (14:04 +0100)]
plugins: fix GLTextureUploadMeta to work with different texture ids.
The GLTextureUploadMeta implementation assumed that for each upload()
sequence, the supplied texture id is always the same as the one that
was previously cached into the underlying GstVaapiTexture. Cope with
any texture id change the expense to recreate the underlying VA/GLX
resources.
https://bugzilla.gnome.org/show_bug.cgi?id=719643
Gwenole Beauchesne [Wed, 11 Dec 2013 12:25:51 +0000 (13:25 +0100)]
plugins: allow builds without GLX enabled for GStreamer 1.2.
Don't try to build GLTextureUploadMeta related code if GLX is not
enabled during GStreamer >= 1.2 builds.
Matthieu Bouron [Wed, 20 Nov 2013 17:20:07 +0000 (17:20 +0000)]
plugins: request GLTextureUpload meta on buffers in the buffer pool.
Requesting the GLTextureUpload meta on buffers in the bufferpool
prevents such metas from being de-allocated when buffers are released
in the sink.
This is particulary useful in terms of performance when using the
GLTextureUploadMeta API since the GstVaapiTexture associated with
the target texture is stored in the meta.
https://bugzilla.gnome.org/show_bug.cgi?id=712558
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Wed, 11 Dec 2013 09:51:03 +0000 (10:51 +0100)]
plugins: robustify GstVideoGLTextureUploadMeta implementation.
Make GstVideoGLTextureUploadMeta::upload() implementation more robust
when the GstVaapiTexture associated with the supplied texture id could
not be created.
Gwenole Beauchesne [Tue, 10 Dec 2013 15:14:27 +0000 (16:14 +0100)]
h264: improve robustness when packets are missing.
Improve robustness when some expected packets where not received yet
or that were not correctly decoded. For example, don't try to decode
a picture if there was no valid frame headers parsed so far.
https://bugs.freedesktop.org/show_bug.cgi?id=57902
Gwenole Beauchesne [Tue, 10 Dec 2013 13:20:55 +0000 (14:20 +0100)]
decoder: h264: fix decoding of BA3_SVA_C.264.
Conformance test Base_Ext_Main_profiles/BA3_SVA_C.264 complys with
extended profile specifications. However, the SPS header has the
constraint_set1_flag syntax element set to 1. This means that, if
a Main profile compliant decoder is available, then it should be
able to decode this stream.
This changes makes it possible to fall-back from Extended profile
to Main profile if constraint_set1_flag is set to 1.
https://bugzilla.gnome.org/show_bug.cgi?id=720190
Gwenole Beauchesne [Tue, 10 Dec 2013 10:13:01 +0000 (11:13 +0100)]
utils: h264: add more profiles.
Add extended profile (A.2.3), high 4:2:2 profile (A.2.6), high 4:2:2
profiles (A.2.7, A.2.10), scalable profiles (G.10.1.1, G.10.1.2) and
multiview profiles (H.10.1.1, H.10.1.2).
Document "Constrained Baseline" and "High 10" profiles.
Gwenole Beauchesne [Tue, 10 Dec 2013 14:21:51 +0000 (15:21 +0100)]
codecparsers: update to gst-vaapi-branch commit e7d0e18.
e7d0e18 h264: complete set of NAL unit types
Wind Yuan [Fri, 6 Dec 2013 07:08:26 +0000 (15:08 +0800)]
decoder: h264: add support for constrained baseline profile.
Recognize streams marked as conforming to the "Constrained Baseline
Profile". If VA driver supports that as is, fine. Otherwise, fallback
to baseline, main or high profile.
Constrained Baseline Profile conveys coding tools that are common
to baseline profile and main profile.
https://bugzilla.gnome.org/show_bug.cgi?id=719947
[Added fallbacks to main and high profiles]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Mon, 9 Dec 2013 11:46:45 +0000 (12:46 +0100)]
decoder: h264: fix decoding of scaling lists.
The GStreamer codecparser layer now parses the scaling lists in zigzag
scan order, as expected, so that to match the original bitstream layout
and specification. However, further convert the scaling lists into
raster scan order to fit the existing practice in most VA drivers.
https://bugzilla.gnome.org/show_bug.cgi?id=706406
Gwenole Beauchesne [Mon, 9 Dec 2013 11:07:28 +0000 (12:07 +0100)]
codecparsers: update to gst-vaapi-branch commit 177c73b.
a7e3255 add H.265 (HEVC) bitstream parser
177c73b h264: fix picture level scaling lists derivation (rule B)
14733f1 h264: fix parsing of VCL HRD parameters
59a0b47 h264: store quantization matrices in zig-zag order
ffb6e26 h264: add helpers to convert quantization matrices
c78a504 mpeg2: also initialize debug category in parse_sequence_header()
719d1b0 mpeg2: turn internal consistency check into a g_assert()
5241d8e all: remove some unused functions
18eb312 all: fix for GST_DISABLE_GST_DEBUG
963c04a all: make warnings more meaningful
Gwenole Beauchesne [Fri, 6 Dec 2013 18:05:52 +0000 (19:05 +0100)]
utils: add helpers for H.264 levels.
- gst_vaapi_utils_h264_get_level():
Returns GstVaapiLevelH264 from H.264 level_idc value
- gst_vaapi_utils_h264_get_level_idc():
Returns H.264 level_idc value from GstVaapiLevelH264
- gst_vaapi_utils_h264_get_level_limits():
Returns level limits as specified in Table A-1 of the H.264 standard
- gst_vaapi_utils_h264_get_level_limits_table():
Returns the Table A-1 specification
Gwenole Beauchesne [Fri, 6 Dec 2013 16:34:52 +0000 (17:34 +0100)]
utils: add new H.264 profiles.
Add "Constrained Baseline Profile" and "High 10 Profile" definitions
and helper functiions.
Gwenole Beauchesne [Fri, 6 Dec 2013 16:21:52 +0000 (17:21 +0100)]
utils: add new H.264 helper functions.
* Profiles:
- gst_vaapi_utils_h264_get_profile():
Returns GstVaapiProfile from H.264 profile_idc value
- gst_vaapi_utils_h264_get_profile_idc():
Returns H.264 profile_idc value from GstVaapiProfile
* Chroma formats:
- gst_vaapi_utils_h264_get_chroma_type():
Returns GstVaapiChromaType from H.264 chroma_format_idc value
- gst_vaapi_utils_h264_get_chroma_format_idc():
Returns H.264 chroma_format_idc value from GstVaapiChromaType
Matthieu Bouron [Tue, 3 Dec 2013 11:05:17 +0000 (11:05 +0000)]
Fix missing files in distribution tarball.
https://bugzilla.gnome.org/show_bug.cgi?id=719776
[Additional fixes and clean-ups]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Thu, 5 Dec 2013 17:13:54 +0000 (18:13 +0100)]
encoder: fix computation of max coded buffer size (again).
The previous fix was only valid to express the maximum size of the
macroblock layer, i.e. without any headers. Now, also account for
the slice headers and top picture header, but also any other header
we might stuff into the VA coded buffer, e.g. sequence headers.
Gwenole Beauchesne [Wed, 4 Dec 2013 18:10:13 +0000 (19:10 +0100)]
encoder: fix computation of max coded buffer size.
Fix coded buffer size for each codec. A generic issue was that the
number of macroblocks was incorrectly computed. The second issue was
specific to MPEG-2 were the max number of bits per macroblock, and
as defined by the standard, was incorrectly mapped to the (lower)
H.264 requirement. i.e. 4608 bits vs. 3200 bits limit.
Gwenole Beauchesne [Wed, 4 Dec 2013 17:48:35 +0000 (18:48 +0100)]
encoder: simplify VA context initialization process.
Change get_context_info() into a set_context_info() function that
initializes common defaults into the base class, thus allowing the
subclasses to specialize the context info further on.
The set_context_info() hook is also the location where additional
context specific data could be initialized. At this point, we are
guaranteed to have valid video resolution size and framerate. i.e.
gst_vaapi_encoder_set_format() was called beforehand.
Wind Yuan [Tue, 26 Nov 2013 06:38:23 +0000 (14:38 +0800)]
encoder: fix mpeg2 compilation error.
https://bugzilla.gnome.org/show_bug.cgi?id=719746
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Wed, 4 Dec 2013 16:55:18 +0000 (17:55 +0100)]
encoder: clean-ups and document public APIs.
Clean public APIs up so that to better align with the decoder APIs.
Most importantly, gst_vaapi_encoder_get_buffer() is changed to only
return the VA coded buffer proxy. Also provide useful documentation
for the public APIs.
Gwenole Beauchesne [Wed, 4 Dec 2013 16:05:17 +0000 (17:05 +0100)]
encoder: avoid extra allocations of GstVaapiEncoderSyncPic objects.
Kill GstVaapiEncoderSyncPic objects that are internally and temporarily
allocated. Rather, associate a GstVaapiEncPicture to a coded buffer
through GstVaapiCodedBufferProxy user-data facility.
Besides, use a GAsyncQueue to maintain a thread-safe queue object of
coded buffers.
Partial fix for the following report:
https://bugzilla.gnome.org/show_bug.cgi?id=719530
Gwenole Beauchesne [Tue, 3 Dec 2013 16:04:43 +0000 (17:04 +0100)]
encoder: refactor status codes.
Drop obsolete or unused status codes. Align some status codes with the
decoder counterparts.
Gwenole Beauchesne [Wed, 4 Dec 2013 10:54:40 +0000 (11:54 +0100)]
encoder: fix subclassing process.
Fix the GstVaapiEncoderClass parent class type. Make sure to validate
subclass hooks as early as possible, i.e. in gst_vaapi_encoder_init(),
thus avoiding useless run-time checks. Also simplify the subclass
initialization process to be less error prone.
Gwenole Beauchesne [Tue, 3 Dec 2013 15:11:46 +0000 (16:11 +0100)]
encoder: rework GstVaapiCodedBuffer and related proxy.
Refactor the GstVaapiCodedBuffer APIs so that to more clearly separate
public and private interfaces. Besides, the map/unmap APIs should not
be exposed as is but appropriate accessors should be provided instead.
* GstVaapiCodedBuffer: VA coded buffer abstraction
- gst_vaapi_coded_buffer_get_size(): get coded buffer size.
- gst_vaapi_coded_buffer_copy_into(): copy coded buffer into GstBuffer
* GstVaapiCodedBufferPool: pool of VA coded buffer objects
- gst_vaapi_coded_buffer_pool_new(): create a pool of coded buffers of
the specified max size, and bound to the supplied encoder
* GstVaapiCodedBufferProxy: pool-allocated VA coded buffer object proxy
- gst_vaapi_coded_buffer_proxy_new_from_pool(): create coded buf from pool
- gst_vaapi_coded_buffer_proxy_get_buffer(): get underlying coded buffer
- gst_vaapi_coded_buffer_proxy_get_buffer_size(): get coded buffer size
Rationale: more optimized transfer functions might be provided in the
future, thus rendering the map/unmap mechanism obsolete or sub-optimal.
https://bugzilla.gnome.org/show_bug.cgi?id=719775
Gwenole Beauchesne [Fri, 29 Nov 2013 13:02:52 +0000 (14:02 +0100)]
plugins: fix reference leaks of VA display objects.
Fix GstElement::set_context() implementation for all plug-in elements
to avoid leaking an extra reference to the VA display, thus preventing
correct cleanup of VA resources in GStreamer 1.2 builds.
Gwenole Beauchesne [Fri, 29 Nov 2013 12:56:12 +0000 (13:56 +0100)]
plugins: simplify gst_vaapi_ensure_display().
Return earlier if the creation of a VA display failed. Likewise, simplify
gst_vaapi_video_context_propagate() now that we are guaranteed to have a
valid VA display.
Gwenole Beauchesne [Thu, 28 Nov 2013 18:08:28 +0000 (19:08 +0100)]
plugins: fix memory leaks through GstVideoMeta maps.
When GstVideoMeta maps were used, the supporting functions incorrectly
used gst_buffer_get_memory() instead of gst_buffer_peek_memory(), thus
always increasing the associated GstMemory reference count and giving
zero chance to actually release that, and subsequently the VA display.
Gwenole Beauchesne [Thu, 28 Nov 2013 13:15:44 +0000 (14:15 +0100)]
plugins: use G_PARAM_STATIC_STRINGS.
This avoids a few string copies during initialization.
Gwenole Beauchesne [Thu, 28 Nov 2013 16:28:11 +0000 (17:28 +0100)]
plugins: simplify VA video meta to only reference surface proxies.
Simplify GstVaapiVideoMeta to only hold a surface proxy, which is
now allocated from a surface pool. This also means that the local
reference to the VA surface is also gone, as it could be extracted
from the associated surface proxy.
Gwenole Beauchesne [Thu, 28 Nov 2013 15:51:37 +0000 (16:51 +0100)]
plugins: drop obsolete functions.
Drop the following functions that are not longer used:
- gst_vaapi_video_buffer_new_with_surface()
- gst_vaapi_video_meta_new_with_surface()
- gst_vaapi_video_meta_set_surface()
- gst_vaapi_video_meta_set_surface_from_pool()