platform/upstream/gstreamer.git
10 years agoNEWS: updates.
Gwenole Beauchesne [Thu, 23 Jan 2014 18:18:13 +0000 (19:18 +0100)]
NEWS: updates.

10 years agotests: test-filter: fix "deinterlace" option parse.
Gwenole Beauchesne [Mon, 20 Jan 2014 13:16:56 +0000 (14:16 +0100)]
tests: test-filter: fix "deinterlace" option parse.

Default to GST_VAAPI_DEINTERLACE_METHOD_NONE if no "deinterlace" option
string was provided, i.e. if it remained set to NULL.

10 years agolibs: factor out usages of vaGetConfigAttributes().
Gwenole Beauchesne [Thu, 23 Jan 2014 17:41:24 +0000 (18:41 +0100)]
libs: factor out usages of vaGetConfigAttributes().

Add gst_vaapi_get_config_attribute() helper function that takes a
GstVaapiDisplay and the rest of the arguments with VA types. The aim
is to have thread-safe VA helpers by default.

10 years agolibs: re-indent all source code related to VA utilities.
Gwenole Beauchesne [Thu, 23 Jan 2014 16:41:02 +0000 (17:41 +0100)]
libs: re-indent all source code related to VA utilities.

10 years agolibs: add missing file (libgstvaapi_priv_check.h).
Gwenole Beauchesne [Thu, 23 Jan 2014 16:06:08 +0000 (17:06 +0100)]
libs: add missing file (libgstvaapi_priv_check.h).

10 years agoencoder: notify the encoder of the submitted packed headers.
Gwenole Beauchesne [Thu, 23 Jan 2014 14:13:06 +0000 (15:13 +0100)]
encoder: notify the encoder of the submitted packed headers.

Make sure to configure the encoder with the set of packed headers we
intend to generate and submit. i.e. make selection of packed headers
to submit more robust.

10 years agoencoder: fix and factor out check for supported rate-control modes.
Gwenole Beauchesne [Thu, 23 Jan 2014 14:10:11 +0000 (15:10 +0100)]
encoder: fix and factor out check for supported rate-control modes.

Cache the first compatible GstVaapiProfile found if the encoder is not
configured yet. Next, factor out the code to check for the supported
rate-control modes by moving out vaGetConfigAttributes() to a separate
function, while also making sure that the attribute type is actually
supported by the encoder.

Also fix the default set of supported rate control modes to not the
"none" variant. It's totally useless to expose it at this point.

10 years agocontext: move rate-control mode to encoder specific config.
Gwenole Beauchesne [Thu, 23 Jan 2014 13:01:33 +0000 (14:01 +0100)]
context: move rate-control mode to encoder specific config.

Move usage-specific config out of the common GstVaapiContextInfo.
Create a specialized config for encoding and move rate-control mode
to there.

10 years agocontext: introduce concept of usage.
Gwenole Beauchesne [Thu, 23 Jan 2014 12:30:41 +0000 (13:30 +0100)]
context: introduce concept of usage.

Introduce GstVaapiContextUsage so that to explicitly determine the
usage of a VA context. This is useful in view to simplifying the
creation of VA context for VPP too.

10 years agocontext: fix get_attribute() value result.
Gwenole Beauchesne [Thu, 23 Jan 2014 10:44:12 +0000 (11:44 +0100)]
context: fix get_attribute() value result.

Unknown attributes, or attributes that are not supported for the given
profile/entrypoint pair have a return value of VA_ATTRIB_NOT_SUPPORTED.
So, return failure in this case.

10 years agocontext: move overlay composition to separate files.
Gwenole Beauchesne [Thu, 23 Jan 2014 09:59:20 +0000 (10:59 +0100)]
context: move overlay composition to separate files.

Move GstVideoOverlayComposition handling to separate source files.
This helps keeing GstVaapiContext core implementation to the bare
minimal, i.e. simpy helpers to create a VA context and handle pool
of associated VA surfaces.

10 years agocontext: clean-ups. Strip down APIs.
Gwenole Beauchesne [Thu, 23 Jan 2014 08:41:07 +0000 (09:41 +0100)]
context: clean-ups. Strip down APIs.

Improve documentation and debug messages. Clean-up APIs, i.e. strip
them down to the minimal set of interfaces. They are private, so no
need expose getters for instance.

10 years agocontext: re-indent all GstVaapiContext related source code.
Gwenole Beauchesne [Thu, 23 Jan 2014 08:27:38 +0000 (09:27 +0100)]
context: re-indent all GstVaapiContext related source code.

10 years agolibs: check that private headers remain private.
Gwenole Beauchesne [Thu, 23 Jan 2014 09:20:40 +0000 (10:20 +0100)]
libs: check that private headers remain private.

Make sure that libgstvaapi private headers remain internally used to
build libgstvaapi libraries only. All header dependencies were reviewed
and checks for IN_LIBGSTVAAPI definition were added accordingly.

Also rename GST_VAAPI_CORE definition to IN_LIBGSTVAAPI_CORE to keep
consistency.

10 years agoBump library major version.
Gwenole Beauchesne [Wed, 22 Jan 2014 18:04:58 +0000 (19:04 +0100)]
Bump library major version.

Bump the library major version due to API/ABI changes that occurred in
the imaging API. In particular, GstVaapiDisplay interfaces no longer
expose any GstCaps but provide GArray based ones e.g. to determine the
set of supported decode/encode profiles.

10 years agolegal: update copyright notice dates.
Gwenole Beauchesne [Wed, 22 Jan 2014 17:54:14 +0000 (18:54 +0100)]
legal: update copyright notice dates.

10 years agolegal: add per-file authorship information.
Gwenole Beauchesne [Wed, 22 Jan 2014 17:49:20 +0000 (18:49 +0100)]
legal: add per-file authorship information.

10 years agodecoder: fix video codec frame number in standalone mode.
Gwenole Beauchesne [Wed, 22 Jan 2014 17:11:26 +0000 (18:11 +0100)]
decoder: fix video codec frame number in standalone mode.

Set a valid GstVideoCodecFrame.system_frame_number when decoding a
stream in standalone mode. While we are at it, improve the debugging
messages to also include that frame number.

10 years agodecoder: fix crash on invalid pointer for GST_DEBUG().
Wind Yuan [Fri, 17 Jan 2014 08:56:53 +0000 (16:56 +0800)]
decoder: fix crash on invalid pointer for GST_DEBUG().

When decoding failed, or that the frame was dropped, the associated
surface proxy is not guaranteed to be present. Thus, the GST_DEBUG()
message needs to check whether the proxy is actually present or not.

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

[fixed gst_vaapi_surface_proxy_get_surface_id() to return VA_INVALID_ID]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agoencoder: h264: disable NAL HRD parameters for now.
Gwenole Beauchesne [Wed, 22 Jan 2014 16:07:24 +0000 (17:07 +0100)]
encoder: h264: disable NAL HRD parameters for now.

Don't emit NAL HRD parameters for now in the SPS headers because the
SEI buffering_period() and picture_timing() messages are not handled
yet. Some additional changes are necessary to get it right.

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

10 years agoencoder: h264: fix default CPB buffer size.
Gwenole Beauchesne [Tue, 21 Jan 2014 18:04:41 +0000 (19:04 +0100)]
encoder: h264: fix default CPB buffer size.

Fix default CPB buffer size to something more reasonable (1500 ms)
and that still fits the level limits. This is a non configurable
property for now. The initial CPB removal delay is also fixed to
750 ms.

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

10 years agoencoder: h264: fix bitrate encoding for HRD conformance.
Gwenole Beauchesne [Wed, 22 Jan 2014 13:43:24 +0000 (14:43 +0100)]
encoder: h264: fix bitrate encoding for HRD conformance.

Round down the calculated, or supplied, bitrate (kbps) into a multiple
of the HRD bitrate scale factor. Use a bitrate scale factor of 64 so
that to have less losses in precision. Likewise, don't round up because
that could be a strict constraint imposed by the user.

10 years agoencoder: h264: fix level lookup constraints wrt. bitrate.
Gwenole Beauchesne [Wed, 22 Jan 2014 10:25:13 +0000 (11:25 +0100)]
encoder: h264: fix level lookup constraints wrt. bitrate.

Fix the level calculation involving bitrate limits. Since we are
targetting NAL HRD conformance, the check against MaxBR from the
Table A-1 limits shall involve cpbBrNalFactor depending on the
active profile.

10 years agoencoder: h264: submit sequence parameter only once.
Gwenole Beauchesne [Tue, 21 Jan 2014 17:01:20 +0000 (18:01 +0100)]
encoder: h264: submit sequence parameter only once.

Submit sequence parameter buffers only once, or when the bitstream
was reconfigured in a way that requires such. Always submit packed
sequence parameter buffers at I-frame period, if the VA driver needs
those.

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

10 years agoencoder: h264: only submit packed headers when required.
Gwenole Beauchesne [Tue, 21 Jan 2014 17:35:17 +0000 (18:35 +0100)]
encoder: h264: only submit packed headers when required.

Make sure to submit the packed headers only if the underlying VA driver
requires those. Currently, only handle packed sequence and picture
headers.

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

10 years agoencoder: h264: fix ip_period value in sequence parameter.
Gwenole Beauchesne [Tue, 21 Jan 2014 16:35:24 +0000 (17:35 +0100)]
encoder: h264: fix ip_period value in sequence parameter.

The VAEncSequenceParameterBuffer.ip_period value reprents the distance
between the I-frame and the next P-frame. So, this also accounts for
any additional B-frame in the middle of it.

This fixes rate control heuristics for certain VA drivers.

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

10 years agoencoder: h264: fix level when bitrate is automatically computed.
Gwenole Beauchesne [Tue, 21 Jan 2014 16:04:40 +0000 (17:04 +0100)]
encoder: h264: fix level when bitrate is automatically computed.

Fix level characterisation when the bitrate is automatically computed
from the active coding tools. i.e. ensure the bitrate once the profile
is completely characterized but before the level calculation process.

10 years agoencoder: h264: clean-ups.
Gwenole Beauchesne [Tue, 21 Jan 2014 15:05:22 +0000 (16:05 +0100)]
encoder: h264: clean-ups.

Document and rename a few functions here and there. Drop code that
caps num_bframes variable in reset_properties() since they shall
have been checked beforehand, during properties initialization.

10 years agoencoder: h264: clean-up bitwriter related utilities.
Gwenole Beauchesne [Tue, 21 Jan 2014 14:28:34 +0000 (15:28 +0100)]
encoder: h264: clean-up bitwriter related utilities.

Clean-up GstBitWriter related utility functions and simplify notations.
While we are at it, also make bitstream writing more robust should an
overflow occur. We could later optimize for writing headers capped to
their maximum possible size by using the _unchecked() helper variants.

10 years agoencoder: h264: completely remove private headers.
Gwenole Beauchesne [Tue, 21 Jan 2014 14:23:01 +0000 (15:23 +0100)]
encoder: h264: completely remove private headers.

Drop private header since it was originally used to expose internals
to the plugin element. The proper interface is now the properties API,
thus rendering private headers totally obsolete.

10 years agoencoder: h264: fix PPS header packing with profile < high.
Gwenole Beauchesne [Wed, 15 Jan 2014 14:54:32 +0000 (15:54 +0100)]
encoder: h264: fix PPS header packing with profile < high.

Fix PPS header packing when profile is below High since 8x8 transform
mode and scaling lists are High Profile features.

10 years agoencoder: h264: always emit VUI parameters for framerate.
Gwenole Beauchesne [Wed, 15 Jan 2014 14:46:19 +0000 (15:46 +0100)]
encoder: h264: always emit VUI parameters for framerate.

Always emit VUI parameters for timing_info, which includes framerate
information.

10 years agoencoder: h264: really fix frame cropping rectangle calculation.
Gwenole Beauchesne [Wed, 15 Jan 2014 14:10:48 +0000 (15:10 +0100)]
encoder: h264: really fix frame cropping rectangle calculation.

Make frame cropping rectangle calculation future proof, i.e. exactly
follow the specification (7-18) to (7-21), and subsampling definitions
from Table 6-1.

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

10 years agovaapisink: set csc render flags from sinkpad caps.
Holger Kaelberer [Wed, 15 Jan 2014 11:09:14 +0000 (12:09 +0100)]
vaapisink: set csc render flags from sinkpad caps.

This maps GstVideoColorimetry information in vaapisink's sinkpad caps
to GST_VAAPI_COLOR_STANDARD_* flags, if per-buffer information was not
available.

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

[factored out code, added SMPTE240M, handle per-buffer flags]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agosurface: rework render flags.
Gwenole Beauchesne [Wed, 28 Mar 2012 13:05:26 +0000 (15:05 +0200)]
surface: rework render flags.

Pack render flags per category and provide more flags into the color
standard category. In particular, cover for SMPTE-240M.

10 years agovaapipostproc: add support for colorbalance filters.
Zhao, Halley [Thu, 12 Dec 2013 20:14:41 +0000 (04:14 +0800)]
vaapipostproc: add support for colorbalance filters.

Add support for hue, saturation, brightness and constrat adjustments.
Also fix cap info local copy to match the really expected cap subtype
of interest.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapipostproc: fix support for "sharpen" filter.
Zhao, Halley [Thu, 12 Dec 2013 00:38:12 +0000 (08:38 +0800)]
vaapipostproc: fix support for "sharpen" filter.

Fix copy/paste error when submitting the "sharpen" value to the
GstVaapiFilter instance.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agopkgconfig: plugin dir should use PKG version not API version.
Lionel Landwerlin [Fri, 20 Dec 2013 12:05:42 +0000 (12:05 +0000)]
pkgconfig: plugin dir should use PKG version not API version.

Fix the pluginsdir and includedir variables in the generated pkgconfig
(.pc) files. The location needs to be built with the PKG version in
mind instead of the API version.

While we are at it, also fix the PKG version for GStreamer >= 1.3.

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

[additional fixes for includedir and pkg requirements]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapisink: fix display initialization in GstVideoOverlay implementation.
Holger Kaelberer [Wed, 15 Jan 2014 09:05:45 +0000 (10:05 +0100)]
vaapisink: fix display initialization in GstVideoOverlay implementation.

When gst_vaapisink_video_overlay_set_window_handle() is called early,
before the pipeline has been set to PLAYING, the display has not yet
been initialized and _PLUGIN_BASE_DISPLAY_TYPE() is not yet
up-to-date. For this reason the foreign XID is not attached.

Now _ensure_display() is called earlier.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapisink: expose the raw video formats in static caps template.
Sreerenj Balachandran [Wed, 9 Oct 2013 10:47:54 +0000 (13:47 +0300)]
vaapisink: expose the raw video formats in static caps template.

Expose all raw video formats in the static caps template since the
vaapisink is supporting raw data. We will get the exact set of formats
supported by the driver dynamically through the _get_caps() routine.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapidecode: query downstream caps features like GLTextureUploadMeta.
Matthieu Bouron [Wed, 11 Dec 2013 18:08:26 +0000 (18:08 +0000)]
vaapidecode: query downstream caps features like GLTextureUploadMeta.

Fix vaapidecode to correctly report caps features downstream, when
a custom pipeline is built manually.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
10 years agovaapidecode: add system memory caps to template caps.
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>
10 years agovaapidecode: fix hang on SIGINT.
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>
10 years agovaapiencode: fix possible hang on SIGINT.
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>
10 years agovaapiencode: fix typo in error message.
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().

10 years agoplugins: add helpers to create video caps with features.
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

10 years agoplugins: don't apply overlay composition in GLTextureUpload function.
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>
10 years agoencoder: re-order submission of VA objects.
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.

10 years agoencoder: clean-up objects.
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.

10 years agoencoder: h264: fix frame cropping rectangle calculation.
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

10 years agoencoder: h264: improve automatic bitrate calculation.
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

10 years agoencoder: h264: support "high-compression" tuning option.
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

10 years agoencoder: h264: allow target decoder constraints.
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

10 years agoencoder: h264: refine size of coded buffer.
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

10 years agoencoder: h264: expose more coding tools.
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>
10 years agoencoder: h264: derive profile and level from active coding tools.
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

10 years agoencoder: h264: fix hardware profile lookup.
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

10 years agoencoder: h264: support only the byte-stream format.
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.

10 years agoencoder: h264: clean-ups.
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.

10 years agoencoder: mpeg2: fix hardware profile lookup.
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.

10 years agoencoder: mpeg2: derive profile and level from active coding tools.
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

10 years agoencoder: mpeg2: clean-ups.
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.

10 years agoencoder: add tuning options API.
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.

10 years agoencoder: fix bitrate units to match kbps.
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

10 years agoencoder: clean-ups.
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.

10 years agoencoder: filter out the supported set of rate-control properties.
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.

10 years agoencoder: add keyframe period API.
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.

10 years agoencoder: improve codec 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().

10 years agoencoder: fix possible memory leak of coded buffer pools.
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.

10 years agoencoder: add video codec-state API.
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.

10 years agovaapiencode: don't crash on NULL encoder on _finish().
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

10 years agovaapiencode: use more GstVaapiPluginBase facilities.
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.

10 years agovaapiencode: fix negotiation process of output caps.
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.

10 years agovaapiencode: make GstVaapiEncode an abstract type.
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.

10 years agovaapiencode: rename a few member functions.
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.

10 years agovaapiencode: update for new properties API.
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

10 years agoencoder: add properties API.
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

10 years agoencoder: add bitrate API.
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

10 years agoencoder: add rate control API.
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

10 years agovaapiencode: fix indentation.
Gwenole Beauchesne [Fri, 3 Jan 2014 15:57:25 +0000 (16:57 +0100)]
vaapiencode: fix indentation.

10 years agoencoder: fix indentation.
Gwenole Beauchesne [Fri, 3 Jan 2014 15:57:09 +0000 (16:57 +0100)]
encoder: fix indentation.

10 years agoutils: add new MPEG-2 helper functions.
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.

10 years agoutils: h264: don't use fatal asserts.
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.

10 years agoutils: h264: add helpers for profile and level string mappings.
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.

10 years agoutils: h264: expose levels in public header.
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.

10 years agocodec: add helper macros to maintain object refcount.
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.

10 years agocodec: re-indent decoder objects.
Gwenole Beauchesne [Thu, 9 Jan 2014 08:30:49 +0000 (09:30 +0100)]
codec: re-indent decoder objects.

10 years agocodec: re-indent base codec objects.
Gwenole Beauchesne [Thu, 9 Jan 2014 08:10:21 +0000 (09:10 +0100)]
codec: re-indent base codec objects.

10 years agoplugins: do not free debug category in finalize method.
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>
10 years agotests: simple-decoder: don't use deprecated g_thread_create().
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.

10 years agoFix printf()-like formats.
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.

11 years agoutils: format: drop unused helper functions.
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()

11 years agoutils: re-indent GstVideoFormat related helpers.
Gwenole Beauchesne [Sat, 21 Dec 2013 06:29:50 +0000 (07:29 +0100)]
utils: re-indent GstVideoFormat related helpers.

11 years agodownload: use GstVideoInfo facilities to build output caps.
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.

11 years agoplugins: factor out construction of template caps.
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

11 years agoplugins: factor out construction of GValue from GstVideoFormat.
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

11 years agoplugins: re-indent common and video context creation utils.
Gwenole Beauchesne [Sat, 21 Dec 2013 05:22:30 +0000 (06:22 +0100)]
plugins: re-indent common and video context creation utils.

11 years agodisplay: don't use GstCaps for decode or encode profiles list.
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().

11 years agodisplay: don't use GstCaps for image or subpicture formats list.
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().

11 years agodisplay: allocate queried resources on-demand.
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.