Commit graph

981 commits

Author SHA1 Message Date
Sreerenj Balachandran
ee6d1b7bd1 build: fix conditional compilation of VP8 decoder.
https://bugzilla.gnome.org/show_bug.cgi?id=729170

[added check for VASliceParameterBufferBase fields]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-05-09 14:41:52 +02:00
Cong Zhong
e95a42ea6e decoder: h264: fix long-term reference picture marking process.
Fix reference picture marking process with memory_management_control_op
set to 3 and 6, i.e. assign LongTermFrameIdx to a short-term reference
picture, or the current picture.

This fixes decoding of FRExt_MMCO4_Sony_B.

https://bugs.freedesktop.org/show_bug.cgi?id=64624
https://bugzilla.gnome.org/show_bug.cgi?id=724518

[squashed, edited to use GST_VAAPI_PICTURE_IS_COMPLETE() macro]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-26 22:16:19 +02:00
Gwenole Beauchesne
fac59d6fcf decoder: h264: fix initialization of RefPicLists for multiple slices.
The initialization of reference picture lists (8.2.4.2) applies to all
slices. So, the RefPicList0/1 lists need to be constructed prior to
each slice submission to the HW decoder.

This fixes decoding of video sequences where frames are encoded with
multiple slices of different types, e.g. 4 slices in this order I, P,
I, and P. More precisely, CABAST3_Sony_E and CABASTBR3_Sony_B.

https://bugzilla.gnome.org/show_bug.cgi?id=724518
2014-04-26 20:21:46 +02:00
Zhong Cong
3a6f6f97ab decoder: h264: skip SPS extension and auxiliary slice NALs.
When NAL units of type 13 (SPS extension) or type 19 (auxiliary slice)
are present in a video, decoders shall perform the (optional) decoding
process specified for these NAL units or shall ignore them (7.4.1).

Implement option 2 (skip) for now, as alpha composition is not
supported yet during the decoding process.

This fixes decoding of the primary coded video in alphaconformanceG.

https://bugzilla.gnome.org/show_bug.cgi?id=703928
https://bugzilla.gnome.org/show_bug.cgi?id=728869
https://bugzilla.gnome.org/show_bug.cgi?id=724518

[skip NAL units earlier, i.e. at parsing time]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-26 14:38:59 +02:00
Li Xiaowei
3f14745d61 decoder: h264: fix slice data bit offset with MVC NAL units.
When MVC slice NAL units (coded slice extension and prefix NAL) are
present, the number of NAL header bytes is 3, not 1 as usual.

Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
5a3e51472d decoder: h264: fix activation of picture and sequence parameters.
At the time the first VCL NAL unit of a primary coded picture is found,
and if that NAL unit was parsed to be an SPS or PPS, then the entries
in the parser may have been overriden. This means that, when the picture
is to be decoded, slice_hdr->pps could point to an invalid (the next)
PPS entry.

So, one way to solve this problem is to not use the parser PPS and
SPS info but rather maintain our own activation chain in the decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=724519
https://bugzilla.gnome.org/show_bug.cgi?id=724518
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
a365dfd269 decoder: h264: retain SEI messages until the end of frame.
Retain the SEI messages that were parsed from the access unit until we
have completely decoded the current frame. This is done so that we can
peek at that data whenever necessary during decoding. e.g. for exposing
3D stereoscopic information at a later stage.
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
fa7f9cd08c decoder: h264: add support for grayscale encoded clips.
Fix support for grayscale encoded video clips, and possibly others if
the underlying driver supports the non-YUV 4:2:0 formats. i.e. defer
the decision that a surface with the desired chroma format is not
supported to the actual VA driver implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=728144
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
dbf32a2521 decoder: default to YUV 4:2:0 VA surfaces.
Cope with context changes to support non-YUV 4:2:0 VA surfaces. Still,
make sure all codecs use YUV 4:2:0 output format for now, by default.
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
1b79049317 decoder: re-indent GstVaapiDecoder base object. 2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
14e9d383e3 encoder: derive chroma type from video format.
Cope with previous VA context change to derive the correct surface chroma
type from the input video format.
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
519f0e6b8a context: add support for non-YUV 4:2:0 formats.
Don't force allocation of VA surfaces in YUV 4:2:0 format. Rather, allow
for the upper layer to specify the desired chroma type. If the chroma
type field is not set (or yields zero), then YUV 4:2:0 format is used
by default.
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
f2b0d02168 vp8: fix per-segment deblocking filter level in relative mode.
Fix possible bug when a per-segment deblocking filter level value
needs to be set in non-absolute mode, i.e. when the loop filter update
value is negative in delta mode.

Also clamp the resulting filter level value to 0..63 range.
2014-04-22 19:57:04 +02:00
Gwenole Beauchesne
01c78c4b20 vp8: fix check for disabling the loop filter (again).
Improve condition to disable the loop filter. The previous heuristic
used to check all filter levels, for all segments. It turns out that
only the base filter_level value defined in the frame header needs
to be checked.

This fixes 00-comprehensive-013.
2014-04-22 18:30:18 +02:00
Gwenole Beauchesne
746ac17f59 vp8: propagate PTS from demux frame.
gst_adapter_prev_pts() is forbidden within libgstvaapi. Besides, the demuxer
or parser would already have determined the PTS from a previous stage.
2014-04-21 17:36:49 +02:00
Gwenole Beauchesne
c9299bf18b vp8: fix check for disabling the loop filter. 2014-04-18 20:03:44 +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
450092e371 decoder: h264: cope with new gst_h264_parser_parse_sei() interface.
The gst_h264_parse_parse_sei() function now returns an array of SEI
messages, instead of a single SEI message. Reason: it is allowed to
have several SEI messages packed into a single SEI NAL unit, instead
of multiple NAL units.
2014-04-18 19:37:16 +02:00
Gwenole Beauchesne
e52d394b9e decoder: h264: fix robustness patch for bytestream format.
Fix parser and decoder state to sync at the right locations. This is
because we could reset the parser state, while the decoder state was
not copied yet, e.g. when parsing several NAL units from multiple frames
whereas the current frame was not decoded yet.

This is a regression brought in by commit 6fe5496.
2014-02-19 06:14:12 +01:00
Gwenole Beauchesne
6e621413ab build: fix packaging for GStreamer 1.2.
Fix gstreamer-vaapi includedir for GStreamer 1.2 setups. i.e. use
the pkgconfig version (1.0) instead of the intended API version (1.2).
libgstvaapi1.0-dev and libgstvaapi1.2-dev packages will now conflict,
as would core GStreamer 1.0 and GStreamer 1.2 dev packages anyway.
2014-02-19 06:13:41 +01:00
Gwenole Beauchesne
cab11ef609 build: fix warnings on 64-bit platforms. 2014-01-23 22:50:03 +01:00
Gwenole Beauchesne
614aa4ac95 build: fix for older versions of VA-API (< 0.34.0).
Fix build with older versions of VA-API (< 0.34.0), or versions without
good enough headers for encoding support for instance.
2014-01-23 22:44:09 +01:00
Gwenole Beauchesne
db7a3b8d3e 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.
2014-01-23 18:51:59 +01:00
Gwenole Beauchesne
449727ea31 libs: re-indent all source code related to VA utilities. 2014-01-23 18:51:59 +01:00
Gwenole Beauchesne
84044f28f7 libs: add missing file (libgstvaapi_priv_check.h). 2014-01-23 17:06:08 +01:00
Gwenole Beauchesne
4481c155b8 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.
2014-01-23 15:48:58 +01:00
Gwenole Beauchesne
1dc9837dd9 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.
2014-01-23 15:48:58 +01:00
Gwenole Beauchesne
14ad694fdc 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.
2014-01-23 14:29:09 +01:00
Gwenole Beauchesne
0eb4070977 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.
2014-01-23 14:29:09 +01:00
Gwenole Beauchesne
e3ed05bc52 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.
2014-01-23 14:29:09 +01:00
Gwenole Beauchesne
3b714c8913 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.
2014-01-23 14:29:09 +01:00
Gwenole Beauchesne
c85b080688 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.
2014-01-23 14:29:09 +01:00
Gwenole Beauchesne
1ffdc010ad context: re-indent all GstVaapiContext related source code. 2014-01-23 14:29:09 +01:00
Gwenole Beauchesne
c5bdeb6980 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.
2014-01-23 14:29:09 +01:00
Gwenole Beauchesne
6bf3c1863c legal: update copyright notice dates. 2014-01-22 19:02:35 +01:00
Gwenole Beauchesne
1c95903b98 legal: add per-file authorship information. 2014-01-22 18:49:20 +01:00
Gwenole Beauchesne
387371b19f 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.
2014-01-22 18:30:26 +01:00
Wind Yuan
0e8afe1c22 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>
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
deff9c775c 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
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
9d5fc53899 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
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
9d42c86422 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.
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
4c04a1bc88 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.
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
1e502d63d5 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
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
71113e4999 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
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
d9cf58e88a 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
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
586f872085 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.
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
54d1900e1d 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.
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
c48e769e08 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.
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
8e62164160 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.
2014-01-22 18:30:26 +01:00
Gwenole Beauchesne
7e6f7f384a 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.
2014-01-15 15:54:32 +01:00
Gwenole Beauchesne
391ad15ba0 encoder: h264: always emit VUI parameters for framerate.
Always emit VUI parameters for timing_info, which includes framerate
information.
2014-01-15 15:46:19 +01:00
Gwenole Beauchesne
5f5df3f723 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
2014-01-15 15:15:54 +01:00
Gwenole Beauchesne
751aa05937 surface: rework render flags.
Pack render flags per category and provide more flags into the color
standard category. In particular, cover for SMPTE-240M.
2014-01-15 13:53:42 +01:00
Zhao, Halley
467bf95c09 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>
2014-01-15 11:49:49 +01:00
Gwenole Beauchesne
c03682ecc1 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.
2014-01-14 15:28:21 +01:00
Gwenole Beauchesne
d45c6a486f 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.
2014-01-14 15:28:19 +01:00
Gwenole Beauchesne
78bf2c01cc 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
c7a2095b78 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
7b1233faa8 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
bdf91aa765 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
00e0af9a7c 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
2014-01-13 17:31:55 +01:00
Wind Yuan
8df97cf9ec 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>
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
b59a5572af 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
2b482e8e4b 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
e2f8c059a5 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
45732dcc83 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
0c5f69e0d9 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
e311d53c8a 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
1edeb6ec08 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
21c95dbc42 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
368caf22da 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
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
4a6fbddad6 encoder: clean-ups.
Drop obsolete and unused macros. Add a few doc comments. Slightly
improve indentation of a few leftovers.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
850a637d0f 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
59229b20a5 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
8788ea99a8 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().
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
20ab910d15 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
5394c75461 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.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
dcc7a94408 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
2014-01-13 17:31:54 +01:00
Gwenole Beauchesne
70b3600f11 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
2014-01-13 17:31:54 +01:00
Gwenole Beauchesne
a24c52e4d0 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
2014-01-13 17:31:54 +01:00
Gwenole Beauchesne
01af353116 encoder: fix indentation. 2014-01-13 17:31:54 +01:00
Gwenole Beauchesne
9548e32cf4 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.
2014-01-13 16:25:49 +01:00
Gwenole Beauchesne
4a650e8e62 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.
2014-01-10 19:52:50 +01:00
Gwenole Beauchesne
b0c2ac4159 utils: h264: add helpers for profile and level string mappings.
Add profile and level helper functions to convert to/from strings.
2014-01-10 19:52:50 +01:00
Gwenole Beauchesne
589078f2a4 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.
2014-01-10 19:52:50 +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
c010ce2340 codec: re-indent base codec objects. 2014-01-09 09:46:46 +01:00
Gwenole Beauchesne
dd2ca582a1 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.
2014-01-06 10:04:08 +01:00
Gwenole Beauchesne
33bb859228 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.
2014-01-06 10:04:05 +01:00
Gwenole Beauchesne
4902df0e40 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()
2013-12-21 12:35:24 +01:00
Gwenole Beauchesne
52b6fc57d4 utils: re-indent GstVideoFormat related helpers. 2013-12-21 12:35:24 +01:00
Gwenole Beauchesne
c5581298fb 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().
2013-12-20 17:16:58 +01:00
Gwenole Beauchesne
c4ca08a8d6 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().
2013-12-20 17:16:58 +01:00
Gwenole Beauchesne
446b060c7a 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.
2013-12-20 17:16:12 +01:00
Gwenole Beauchesne
ff0642efad display: re-indent all GstVaapiDisplay related source code. 2013-12-20 17:16:12 +01:00
Gwenole Beauchesne
a6fe7698bc utils: add helper functions to get codec or profile name. 2013-12-20 17:16:12 +01:00
Gwenole Beauchesne
b324fc6add plugins: factor out pad caps. 2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
fad3f538bc 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.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
61f6cbffc6 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
2013-12-11 15:30:51 +01:00