Gwenole Beauchesne [Fri, 25 Jul 2014 09:24:39 +0000 (11:24 +0200)]
display: add interface to retrieve the display name.
Add gst_vaapi_display_get_display_name() helper function to determine
the name associated with the underlying native display. Note that for
raw DRM backends, the display name is actually the device path.
Gwenole Beauchesne [Fri, 25 Jul 2014 08:55:53 +0000 (10:55 +0200)]
display: fix comparison of X11 display names.
Make sure to not only compare display host names, but also the actual
display number. The screen number does not need to be checked at this
time.
Gwenole Beauchesne [Fri, 25 Jul 2014 13:52:06 +0000 (15:52 +0200)]
vaapidecode: add support for VideoAlignment bufferpool option.
Always add VideoAlignment bufferpool option if the downstream element
expects its own pool to be used but does not offer it through a proper
propose_allocation() implementation for instance, and that the ALLOCATION
query does not expose the availability of the Video Meta API.
This fixes propagation of video buffer stride information to Firefox.
Gwenole Beauchesne [Fri, 25 Jul 2014 13:44:58 +0000 (15:44 +0200)]
vaapivideomemory: always prefer native VA surface formats.
Make sure to always prefer native internal formats for the VA surfaces
that get allocated. Also disable "direct-rendering" mode in this case.
This is needed so that to make sure that anything that gets out of the
decoder, or anything that gets into the encoder, is in native format
for the hardware, and thus the driver doesn't need to perform implicit
conversions in there. Interop with SW elements is still available with
fast implementations of VA imaging APIs.
Gwenole Beauchesne [Thu, 24 Jul 2014 09:58:29 +0000 (11:58 +0200)]
vaapivideomemory: disallow memory shares across buffers, use a copy.
Forbid shares of GstMemory instances, and rather make copy of it. This
effectively copies the GstMemory structure and enclosed metadata, but
this does not copy the VA surface contents itself. It should though.
This fixes preroll and makes sure to not download garbage for the first
frame when a SW rendering sink is used.
Gwenole Beauchesne [Thu, 24 Jul 2014 04:46:22 +0000 (06:46 +0200)]
vaapivideomemory: use an image pool to cache objects.
Use an image pool to hold VA images to be used for downloads/uploads
of contents for the associated surface.
This is an optmization for size. So, instead of creating as many VA
images as there are buffers (then VA surfaces) allocated, we only
maintain a minimal set of live VA images, thus preserving memory
resources.
Gwenole Beauchesne [Wed, 23 Jul 2014 22:14:04 +0000 (00:14 +0200)]
vaapivideomemory: forbid R/W mappings if non direct-rendering mode.
Disable read-write mappings if "direct-rendering" is not supported.
Since the ordering of read and write operations is not specified,
this would require to always download the VA surface on _map(), then
commit the temporary VA image back to the VA surface on _unmap().
Some SW decoding plug-in elements still use R/W mappings though.
https://bugzilla.gnome.org/show_bug.cgi?id=733242
Gwenole Beauchesne [Wed, 23 Jul 2014 21:49:53 +0000 (23:49 +0200)]
vaapivideomemory: minor code clean-ups.
Fix error messages introduced in the previous commit for the _map()
imaplementation. Also use the new get_image_data() helper function
to determine the base pixels data buffer from a GstVaapiImage when
updating the video info structure from it.
Gwenole Beauchesne [Wed, 23 Jul 2014 16:54:13 +0000 (18:54 +0200)]
vaapivideomemory: add support for raw pixels mappings.
Allow raw pixels of the whole frame to be mapped read-only. i.e. in
cases where the buffer pool is allocated without VideoMeta API, thus
individual planes cannot be mapped.
This is initial support for Firefox >= 30.
https://bugzilla.gnome.org/show_bug.cgi?id=731886
Sreerenj Balachandran [Thu, 3 Jul 2014 15:41:11 +0000 (18:41 +0300)]
vaapivideomemory: fix determination of the surface pool format.
While creating the vaapi video allocator, make sure the associated
surface pool has correct format instead of defaulting to NV12 video
format even though there is no direct rendering support.
https://bugzilla.gnome.org/show_bug.cgi?id=732691
Gwenole Beauchesne [Wed, 23 Jul 2014 16:01:21 +0000 (18:01 +0200)]
vaapivideomemory: fix association of surface to proxy.
Make sure to always update the VA surface pointer whenever the proxy
changes. This used to only work when the VA surface is written to, in
interop with SW element ("upload" feature), and this now fixes cases
when the VA surface is needed for reading, in interop with SW element
("download" feature).
Gwenole Beauchesne [Wed, 23 Jul 2014 08:23:06 +0000 (10:23 +0200)]
plugins: expose I420 format for interop with SW elements.
Always expose I420 format by default when the VA surface could be
mapped for interoperability with non harware accelerated elements.
However, the default behaviour remains the auto-plugging of vaapi
elements, down to the sink.
Side effect: "direct-rendering" mode is also disabled most of the
times as plain memcpy() from uncached speculative write combining
memory is not going to be efficient enough.
Gwenole Beauchesne [Tue, 22 Jul 2014 16:54:29 +0000 (18:54 +0200)]
plugins: allow download capability to vaapidecode element.
Fix support for VA surface download capability in vaapidecode element
for GStreamer >= 1.2. This is a fix to supporting libva-vdpau-driver,
but also the libva-intel-driver while performing hardware accelerated
conversions from the native VA surface format (NV12) to the desired
output VA image format.
For instance, this fixes pipelines involving vaapidecode ! xvimagesink.
https://bugzilla.gnome.org/show_bug.cgi?id=733243
Fabrice Bellet [Wed, 16 Jul 2014 23:51:36 +0000 (01:51 +0200)]
decoder: mpeg4: fix picture decoder return value for skipped frames.
The picture decoder should return GST_VAAPI_DECODER_STATUS_DROP_FRAME
when a frame should be skipped, so the stream processing is not stalled.
https://bugzilla.gnome.org/show_bug.cgi?id=733324
Jan Schmidt [Fri, 4 Jul 2014 05:13:32 +0000 (15:13 +1000)]
decoder: mpeg2: respect any input PTS provided for a frame.
The timestamp generator in gstvaapidecoder_mpeg2.c always interpolated
frame timestamps within a GOP, even when it's been fed input PTS for
every frame.
That leads to incorrect output timestamps in some situations - for example
live playback where input timestamps have been scaled based on arrival time
from the network and don't exactly match the framerate.
https://bugzilla.gnome.org/show_bug.cgi?id=732719
Sreerenj Balachandran [Wed, 22 Jan 2014 06:20:59 +0000 (08:20 +0200)]
GstVaapiObject: make gst_vaapi_object_new() more robust.
Forbid GstVaapiObject to be created without an associated klass spec.
It is mandatory that the subclass implements an adequate .finalize()
hook, so it shall provide a valid GstVaapiObjectClass.
https://bugzilla.gnome.org/show_bug.cgi?id=722757
[made non-NULL klass argument to gst_vaapi_object_new() a requirement]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Sreerenj Balachandran [Tue, 21 Jan 2014 13:43:57 +0000 (15:43 +0200)]
GstVaapiObject: initialize the derived object data with init() hook.
Call the subclass .init() function in gst_vaapi_object_new(), if
needed. The default behaviour is to zero initialize the subclass
object data, then the .init() function can be used to initialize
fields to non-default values, e.g. VA object ids to VA_INVALID_ID.
Also fix the gst_vaapi_object_new() description, which was merely
copied from GstVaapiMiniObject.
https://bugzilla.gnome.org/show_bug.cgi?id=722757
[changed to always zero initialize the subclass]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Lionel Landwerlin [Fri, 13 Jun 2014 20:45:04 +0000 (21:45 +0100)]
vaapidecode: make decoder work with playbin
When playbin/decodebin builds the pipeline, it puts decoders and sinks
into different bins and forwards the queries from bins to bins. So in
the initials steps the pipeline is built iteratively by playbin and
looks like this :
[filesrc]
[filesrc] -> [typefind]
[filesrc] -> [typefind] -> [demuxer]
[filesrc] -> [typefind] -> [demuxer] -> [decoder]
At this point the decoder is asked for its SRC caps and it will make a
choice based on what gst_pad_peer_query_caps() returns. The problem is
that the caps returns at that point includes caps features like ANY,
essentially because playbin can plug in additional elements like
videoscale, videoconv or deinterlace.
This patch adds a another call to
gst_vaapi_find_preferred_caps_feature() when the decoder decides its
allocation, to make sure we asks the downstream elements when the
entire pipeline has been built.
https://bugzilla.gnome.org/show_bug.cgi?id=731645
Simon Farnsworth [Fri, 27 Jun 2014 10:57:11 +0000 (11:57 +0100)]
vaapipostproc: don't let tmp_rect go out of scope.
A compiler change showed me that tmp_rect went out of scope before
it was used. Move it to the beginning of the function instead.
https://bugzilla.gnome.org/show_bug.cgi?id=726363
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
[added guards for GStreamer 0.10 builds]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Thu, 3 Jul 2014 20:44:40 +0000 (22:44 +0200)]
AUTHORS: updates.
Gwenole Beauchesne [Thu, 3 Jul 2014 20:34:35 +0000 (22:34 +0200)]
README: updates.
Drop references to deprecated plugins (vaapiupload, vaapidownload),
mention that support for GStreamer 0.10 is deprecated, make overview
more descriptive in certain aspects.
Gwenole Beauchesne [Thu, 3 Jul 2014 20:21:39 +0000 (22:21 +0200)]
NEWS: updates.
Gwenole Beauchesne [Thu, 3 Jul 2014 17:42:02 +0000 (19:42 +0200)]
build: mention that support for GStreamer 0.10 is deprecated.
Gwenole Beauchesne [Thu, 3 Jul 2014 15:17:00 +0000 (17:17 +0200)]
build: fix for GStreamer 0.10.
Gwenole Beauchesne [Thu, 3 Jul 2014 16:01:09 +0000 (18:01 +0200)]
build: fix for GStreamer 1.0.x.
Gwenole Beauchesne [Thu, 3 Jul 2014 11:48:48 +0000 (13:48 +0200)]
decoder: h264: detect incorrectly paired fields in frames.
When a DPB flush is required, e.g. at a natural and of stream or issued
explicitly through an IDR, try to detect any frame left in the DPB that
is interlaced but does not contain two decoded fields. In that case, mark
the picture as having a single field only.
This avoids a hang while decoding tv_cut.mkv.
Gwenole Beauchesne [Thu, 3 Jul 2014 09:13:33 +0000 (11:13 +0200)]
decoder: h264: simplify the DPB output process.
Simplify the dpb_output() function to exclusively rely on the frame store
buffer to output, since this is now always provided. Besides, also fix
cases where split fields would not be displayed.
This is a regression from f48b1e0.
Gwenole Beauchesne [Tue, 1 Jul 2014 15:20:44 +0000 (17:20 +0200)]
h264parse: drop patches merged upstream.
0003-h264parse-fix-and-optimize-NAL-collection-function.patch
0005-h264parse-introduce-new-state-tracking-variables.patch
0006-h264parse-improve-conditions-for-skipping-NAL-units.patch
0007-h264parse-fix-collection-of-access-units-to-preserve.patch
Gwenole Beauchesne [Tue, 1 Jul 2014 15:18:08 +0000 (17:18 +0200)]
decoder: h264: fix memory leak in PPS.
Cope with latest changes from codecparsers/h264. It is now required
to explicitly clear the GstH264PPS structure as it could contain
additional allocations (slice_group_ids).
Gwenole Beauchesne [Tue, 1 Jul 2014 15:13:56 +0000 (17:13 +0200)]
codecparsers: update to gst-vaapi-branch commit 2d53b69.
c4ace00 h264parse: fix collection of access units to preserve config headers
0f9f7c9 h264parse: improve conditions for skipping NAL units
9ffb25c h264parse: introduce new state tracking variables
64955d3 h264parse: fix and optimize NAL collection function
13cd2a3 h264: clarifications and documentation fixes
53e7dd1 h264: fix identification of EOSEQ and EOS NALs
18f0de0 h264: fix memory leak in GstH264PPS
fdcb54c h264: fix typo in GstH264VUIParams description
fd4dae9 vp8: move up built-in range decoder private data
Gwenole Beauchesne [Mon, 30 Jun 2014 17:01:35 +0000 (19:01 +0200)]
decoder: propagate MVC metadata ("view-id", head of multiview set).
Add new GstVaapiSurfaceProxy flag FFB, which means "first frame in
bundle", and really expresses the first view component of a multi
view coded frame. e.g. in H.264 MVC, the surface proxy has flag FFB
set if VOIdx = 0.
Likewise, new API is exposed to retrieve the associated "view-id".
Gwenole Beauchesne [Mon, 30 Jun 2014 16:46:45 +0000 (18:46 +0200)]
decoder: propagate "one-field" flags.
Allow decoders to set the "one-field" attribute when the decoded frame
genuinely has a single field, or if the second field was mis-decoded but
we still want to display the first field.
Gwenole Beauchesne [Mon, 30 Jun 2014 16:34:45 +0000 (18:34 +0200)]
decoder: output decoded frames only once.
Make sure to output the decoded picture, and push the associated
GstVideoCodecFrame, only once. The frame fully represents what needs
to be output, included for interlaced streams. Otherwise, the base
GstVideoDecoder class would release the frame twice.
Anyway, the general process is to output decoded frames only when
they are complete. By complete, we mean a full frame was decoded or
both fields of a frame were decoded.
Gwenole Beauchesne [Mon, 30 Jun 2014 14:12:52 +0000 (16:12 +0200)]
decoder: h264: decode current picture earlier.
Slightly optimize decoding process by submitting the current VA surface
for decoding earlier to the hardware, and perform the reference picture
marking process and DPB update process afterwards.
This is a minor optimization to let the video decode engine kick in work
earlier, thus improving parallel resources utilization.
Gwenole Beauchesne [Mon, 30 Jun 2014 14:09:17 +0000 (16:09 +0200)]
decoder: h264: fix output of second field when first field is not in DPB.
Fix decoding of interlaced streams where a first field (e.g. B-slice)
was immediately output and the current decoded field is to be paired
with that former frame, which is no longer in DPB.
https://bugzilla.gnome.org/show_bug.cgi?id=701340
Gwenole Beauchesne [Mon, 30 Jun 2014 09:06:29 +0000 (11:06 +0200)]
decoder: h264: slightly optimize the process to detect new pictures.
Optimize the process to detect new pictures or start of new access
units by checking if the previous NAL unit was the end of a picture,
or the end of the previous access unit.
Gwenole Beauchesne [Fri, 13 Jun 2014 13:42:53 +0000 (15:42 +0200)]
decoder: h264: handle access unit ("au") optimization.
Optimize parsing when buffers are supplied with access unit alignment.
This helps determining faster when the end of an access unit is reached.
Gwenole Beauchesne [Sat, 28 Jun 2014 05:25:35 +0000 (07:25 +0200)]
decoder: h264: fix tracking of DPB size changes.
Add support for MVC streams with multiple SPS and subset SPS headers
emitted regularly, e.g. at around every I-frame. Track the maximum
number of views in ensure_context() and really reset the DPB size to
the expected value, always. i.e. even if it decreased. dpb_reset()
only cares of ensuring the DPB allocation.
Gwenole Beauchesne [Fri, 27 Jun 2014 18:44:24 +0000 (20:44 +0200)]
decoder: h264: fix the DPB compaction process.
Fix the compaction process when the DPB is cleared for a specific
view, i.e. fix the process of filling in the holes resulting from
removing frame buffers matching the current picture.
Sreerenj Balachandran [Fri, 27 Jun 2014 13:38:03 +0000 (16:38 +0300)]
encoder: h264: generate new SPS only when codec config changed.
It is not necessary to periodically send SPS or subset SPS headers.
This is up to the upper layer (e.g. transport layer) to decide on
if/how to periodically submit those. For now, only generate new SPS
or subset SPS headers when the codec config changed.
Note: the upper layer could readily determine the config headers
(SPS/PPS) through the gst_vaapi_encoder_h264_get_codec_data() function.
https://bugzilla.gnome.org/show_bug.cgi?id=732083
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Fri, 27 Jun 2014 16:43:27 +0000 (18:43 +0200)]
encoder: h264: track encoder config changes.
Track and report when encoder configuration changed. For now, this covers
resolution, profile/level and bitrate changes.
Gwenole Beauchesne [Fri, 27 Jun 2014 11:15:13 +0000 (13:15 +0200)]
encoder: h264: add pixel-aspect-ratio to VUI parameters.
Report sample aspect ratio (SAR) as present, and make it match what
we have obtained from the user as pixel-aspect-ratio (PAR). i.e. the
VUI parameter aspect_ratio_info_present_flag now defaults to TRUE.
Sreerenj Balachandran [Thu, 26 Jun 2014 21:49:34 +0000 (00:49 +0300)]
encoder: h264: fix number of anchor and non-anchor reference pictures.
Set the value of num_anchor_refs_l0, num_anchor_refs_l1, num_non_anchor_refs_l0,
and num_non_anchor_refs_l1 to zero since the inter-view prediction is not yet
supported.
Sreerenj Balachandran [Fri, 27 Jun 2014 07:37:38 +0000 (10:37 +0300)]
encoder: h264: fix timing_info_present_flag value in subset SPS.
When the seq_parameter_set_data() syntax structure is present in a subset
sequence parameter set and vui_parameters_present_flag is equal to 1, then
timing_info_present_flag shall be equal to 0 (H.7.4.2.1.1).
Sreerenj Balachandran [Thu, 26 Jun 2014 11:39:52 +0000 (14:39 +0300)]
encoder: h264: add cpbBrNalFactor values for MVC profiles.
Gwenole Beauchesne [Thu, 26 Jun 2014 12:51:32 +0000 (14:51 +0200)]
h264parse: fix detection of access unit boundaries for MVC.
The gst_h264_parse_collect_nal() function is a misnomer. In reality,
this function is used to determine access unit boundaries, i.e. that
is the key function for alignment=au output format generation.
Gwenole Beauchesne [Thu, 26 Jun 2014 12:49:53 +0000 (14:49 +0200)]
h264parse: fix collection of access units to preserve config headers.
Always use a GstAdapter when collecting access units (alignment="au")
in either byte-stream or avcC format. This is required to properly
preserve config headers like SPS and PPS when invalid or broken NAL
units are subsequently parsed.
More precisely, this fixes scenario like:
<SPS> <PPS> <invalid-NAL> <slice>
where we used to reset the output frame buffer when an invalid or
broken NAL is parsed, i.e. SPS and PPS NAL units were lost, thus
preventing the next slice unit to be decoded, should this also
represent any valid data.
https://bugzilla.gnome.org/show_bug.cgi?id=732203
Gwenole Beauchesne [Thu, 26 Jun 2014 12:48:08 +0000 (14:48 +0200)]
h264parse: improve conditions for skipping NAL units.
Carefully track cases when skipping broken or invalid NAL units is
necessary. In particular, always allow NAL units to be processed
and let that gst_h264_parse_process_nal() function decide on whether
the current NAL needs to be dropped or not.
This fixes parsing of streams with SEI NAL buffering_period() message
inserted between SPS and PPS, or SPS-Ext NAL following a traditional
SPS NAL unit, among other cases too.
Practical examples from the H.264 AVC conformance suite include
alphaconformanceG, CVSE2_Sony_B, CVSE3_Sony_H, CVSEFDFT3_Sony_E
when parsing in stream-format=byte-stream,alignment=au mode.
https://bugzilla.gnome.org/show_bug.cgi?id=732203
Gwenole Beauchesne [Thu, 26 Jun 2014 12:45:34 +0000 (14:45 +0200)]
h264parse: introduce new state tracking variables.
Improve parser state tracking by introducing new flags reflecting
it: "got-sps", "got-pps" and "got-slice". This is an addition for
robustness purposes.
Older have_sps and have_pps variables are kept because they have
a different meaning. i.e. they are used for deciding on when to
submit updated caps or not, and rather mean "have new SPS/PPS to
be submitted?"
Gwenole Beauchesne [Thu, 26 Jun 2014 12:39:30 +0000 (14:39 +0200)]
h264parse: default to byte-stream/nalu format (Annex B).
Always default to stream-format=byte-stream,alignment=nalu if avcC
format was not detected. This is the natural stream format specified
in the standard (Annex.B): a series of NAL units prefixed with the
usual start code.
https://bugzilla.gnome.org/show_bug.cgi?id=732167
Gwenole Beauchesne [Thu, 26 Jun 2014 12:37:58 +0000 (14:37 +0200)]
h264parse: fix and optimize NAL collection function.
Use gst_h264_parser_identify_nalu_unchecked() to identify the next
NAL unit. We don't want to parse the full NAL unit, but only the
header bytes and possibly the first RBSP byte for identifying the
first_mb_in_slice syntax element.
Also fix check for failure when returning from that function. The
only success condition for that is GST_H264_PARSER_OK, so use it.
https://bugzilla.gnome.org/show_bug.cgi?id=732154
Sreerenj Balachandran [Thu, 26 Jun 2014 08:39:38 +0000 (11:39 +0300)]
encoder: h264: fix NAL unit types in packed headers.
Submit Prefix NAL headers (nal_unit_type = 14) before every packed
slice header (nal_unit_type = 1 or 5) only for the base view. In non
base views, a Coded Slice Extension NAL header (nal_unit_type = 20)
is required, with an appropriate nal_unit_header_mvc_extension() in
the NAL header bytes.
https://bugzilla.gnome.org/show_bug.cgi?id=732083
Sreerenj Balachandran [Wed, 25 Jun 2014 19:05:52 +0000 (22:05 +0300)]
encoder: h264: add missing field in packed Subset SPS header.
Write the missing num_level_values_signalled_minus1 syntax element
into the packed header for subset sequence parameter set.
https://bugzilla.gnome.org/show_bug.cgi?id=732083
Gwenole Beauchesne [Wed, 25 Jun 2014 20:26:32 +0000 (22:26 +0200)]
decoder: h264: fix marking of non-reference picture into DPB.
Fix search for a picture in the DPB that has a lower POC value than
the current picture. The dpb_find_lowest_poc() function will return
a picture with the lowest POC in DPB and that is marked as "needed
for output", but an additional check against the actual POC value
of the current picture is needed.
This is a regression from 1c46990.
https://bugzilla.gnome.org/show_bug.cgi?id=732130
Gwenole Beauchesne [Thu, 19 Jun 2014 15:08:47 +0000 (17:08 +0200)]
decoder: h264: fix DPB clear when no decoding actually started.
Fix dpb_clear() to clear previous frame buffers only if they actually
exist to begin with. If the decoder bailed out early, e.g. when it
does not support a specific profile, that array of previous frames
might not be allocated beforehand.
Sreerenj Balachandran [Thu, 6 Feb 2014 06:30:10 +0000 (08:30 +0200)]
decoder: h264: add support for NALU "alignment" optimization.
We can avoid scanning for start codes again if the bitstream is fed
in NALU chunks. Currently, we always scan for start codes, and keep
track of remaining bits in a GstAdapter, even if, in practice, we
are likely receiving one GstBuffer per NAL unit. i.e. h264parse with
"nal" alignment.
https://bugzilla.gnome.org/show_bug.cgi?id=723284
[use gst_adapter_available_fast() to determine the top buffer size]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Wed, 18 Jun 2014 16:53:51 +0000 (18:53 +0200)]
decoder: h264: fix caps to report interlace-mode accordingly.
The `vaapipostproc' element could never determine if the H.264 stream
was interlaced, and thus always assumed it to be progressive. Fix the
H.264 decoder to report interlace-mode accordingly, thus allowing the
vaapipostproc element to automatically enable deinterlacing.
Gwenole Beauchesne [Thu, 19 Jun 2014 11:35:23 +0000 (13:35 +0200)]
vaapipostproc: don't crash with dynamic framerate (0/1).
Avoid reaching an assert if dynamic framerates (0/1) are used. One
way to solve this problem is to just stick field_duration to zero.
However, this means that, in presence of interlaced streams, the
very first field will never be displayed if precise presentation
timestamps are honoured.
https://bugzilla.gnome.org/show_bug.cgi?id=729604
Simon Farnsworth [Fri, 7 Feb 2014 12:27:50 +0000 (12:27 +0000)]
vaapipostproc: create filter surface pool if it does not exist yet.
ensure_srcpad_buffer_pool() tries to avoid unnecessarily deleting and
recreating filter_pool. Unfortunately, this also meant it didn't create
it if it did not exist.
Fix it to always create the buffer pool if it does not exist.
https://bugzilla.gnome.org/show_bug.cgi?id=723834
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Zhao, Halley [Thu, 12 Dec 2013 02:01:13 +0000 (10:01 +0800)]
vaapipostproc: reset deinterlacer state when there is a discontinuity.
Reset deinterlacer state, i.e. past reference frames used for advanced
deinterlacing, when there is some discontinuity detected in the course
of processing source buffers.
This fixes support for advanced deinterlacing when a seek occurred.
https://bugzilla.gnome.org/show_bug.cgi?id=720375
[fixed type of pts_diff variable, fetch previous buffer PTS from the
history buffer, reduce heuristic for detecting discontinuity]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Wed, 18 Jun 2014 14:16:34 +0000 (16:16 +0200)]
vaapipostproc: add support for crop regions in VPP mode.
Apply video cropping regions stored in GstVideoCropMeta, or in older
GstVaapiSurfaceProxy representation, to VPP pipelines. In non-VPP modes,
the crop meta are already propagated to the output buffers.
https://bugzilla.gnome.org/show_bug.cgi?id=720730
Simon Farnsworth [Fri, 14 Mar 2014 17:49:40 +0000 (17:49 +0000)]
vaapipostproc: make deinterlace-mode behave as expected.
deinterlace-mode didn't behave in the way you'd expect if you have
past experience of the deinterlace element. There were two bugs:
1. "auto" mode wouldn't deinterlace "interleaved" buffers, only "mixed".
2. "force" mode wouldn't deinterlace "mixed" buffers flagged as progressive.
Fix these up, and add assertions and error messages to detect cases that
aren't handled.
https://bugzilla.gnome.org/show_bug.cgi?id=726361
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Matthieu Bouron [Wed, 15 Jan 2014 16:36:29 +0000 (16:36 +0000)]
vaapidecode: do not discard video info props when the format changed.
gst_video_info_set_format() does not preserve video info properties. In
order to keep important information in the caps such as interlace mode,
framerate, pixel aspect ratio, ... we need to manually copy back those
properties after setting the new video format.
https://bugzilla.gnome.org/show_bug.cgi?id=722276
Matthew Waters [Sat, 22 Feb 2014 14:43:39 +0000 (01:43 +1100)]
vaapidecode: plug a memory leak.
It can happen that there is a pool provided that does not advertise
the vappivideometa. We should unref that pool before using our own.
Discovered with vaapidecode ! {glimagesink,cluttersink}
https://bugzilla.gnome.org/show_bug.cgi?id=724957
[fixed compilation by adding the missing semi-colon]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Wed, 18 Jun 2014 11:47:36 +0000 (13:47 +0200)]
vaapidecode: parse source data until a frame is obtained.
Parse any pending data until a complete frame is obtained. This is a
memory optimization to avoid expansion of video packets stuffed into
the GstAdapter, and a fix to EOS condition to detect there is actually
pending data that needs to be decoded, and subsequently output.
https://bugzilla.gnome.org/show_bug.cgi?id=731831
Sreerenj Balachandran [Thu, 5 Jun 2014 12:32:29 +0000 (15:32 +0300)]
encoder: h264: fix multiple slices support in packed headers mode.
Handle packedi slice headers and packed raw data on a per-slice basis,
which is necessary for multi slice encoding.
Sreerenj Balachandran [Thu, 5 Jun 2014 12:30:38 +0000 (15:30 +0300)]
encoder: add infrastructure for per-slice handling of packed headers.
The packed slice header and packed raw data need to be paired with
the submission of VAEncSliceHeaderParameterBuffer. So handle them
on a per-slice basis insted of a per-picture basis.
[removed useless initializer]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Fri, 7 Mar 2014 16:40:34 +0000 (17:40 +0100)]
vaapisink: fix initialization with "drm" display type.
Force early initializatin of the GstVaapiDisplay so that to make sure
that the sink element display object is presented first to upstream
elements, as it will be correctly featuring the requested display type
by the user.
Otherwise, we might end up in situations where a VA/X11 display is
initialized in vaapidecode, then we try VA/DRM display in vaapisink
(as requested by the "display" property), but this would cause a failure
because we cannot acquire a DRM display that was previously acquired
through another backend (e.g. VA/X11).
Gwenole Beauchesne [Fri, 7 Mar 2014 16:38:14 +0000 (17:38 +0100)]
plugins: fix initialization with foreign context.
When a new display is settled through GstElement::set_context() (>= 1.2),
or GstVideoContext::set_context() (<= 1.0), then we shall also update the
associated display type.
Gwenole Beauchesne [Mon, 28 Apr 2014 15:44:03 +0000 (17:44 +0200)]
plugins: add built-in video parsers as "vaapiparse" element.
The built-in video parsers elements are built into a single DSO named
libgstvaapi_parse.so. The various video parsers could be accessed as
vaapiparse_CODEC.
For now, this only includes a modified version of h264parse so that to
support H.264 MVC encoded streams.
Gwenole Beauchesne [Fri, 13 Jun 2014 09:36:56 +0000 (11:36 +0200)]
decoder: h264: cope with new gst_h264_quant_matrix_*() interfaces.
New gst_h264_quant_matrix_*_get_raster_from_zigzag() were renamed
from gst_h264_video_quant_matrix_*_get_raster_from_zigzag().
Gwenole Beauchesne [Fri, 13 Jun 2014 09:34:07 +0000 (11:34 +0200)]
codecparsers: update to gst-vaapi-branch commit d6325ac.
7d8d045 h264parse: use new gst_h264_video_calculate_framerate()
d2f965a h264parse: set field_pic_flag when parsing a slice header
24c15b8 Import h264parse
a9283e5 bytereader: Use concistant derefence method
a8252c6 bytereader: Use pointer instead of index access
b1bebfc Import GstBitReader and GstByteReader
2f58788 h264: recognize SVC NAL units
4335da5 h264: fix SPS copy code for MVC
cf9b6dc h264: fix quantization matrix conversion routine names
b11ce2a h264: add gst_h264_video_calculate_framerate()
126dc6f add C++ guards for MPEG-4 and VP8 parsers
Gwenole Beauchesne [Tue, 10 Jun 2014 16:30:21 +0000 (18:30 +0200)]
decoder: h264: factor out DPB pruning for MVC.
Factor out the removal process of unused inter-view only reference
pictures from the DPB, prior to the possible insertion of the current
picture.
Ideally, the compiler could still opt for generating two loops. But
at least, the code is now clearer for maintenance.
Gwenole Beauchesne [Tue, 10 Jun 2014 15:42:58 +0000 (17:42 +0200)]
decoder: h264: clean-ups.
Fix GST_VAAPI_PICTURE_IS_{INTER_VIEW,ANCHOR}() definitions to use
the base GST_VAAPI_PICTURE_FLAG_IS_SET() macro.
Gwenole Beauchesne [Tue, 10 Jun 2014 14:07:51 +0000 (16:07 +0200)]
decoder: h264: improve pruning of unused MVC inter-view frames.
Improve process for the removal of pictures from DPB before possible
insertion of the current picture (C.4.4) for H.264 MVC inter-view only
reference components. In particular, handle cases where picture to be
inserted is not the last one of the access unit and if it was already
output and is no longer marked as used for reference, including for
decoding next view components within the same access unit.
Gwenole Beauchesne [Tue, 3 Jun 2014 15:36:38 +0000 (17:36 +0200)]
decoder: h264: improve DPB bumping process for MVC.
While invoking the DPB bumping process in presence of many views,
it could be necessary to output previous pictures that are ready,
in a whole. i.e. emitting all view components from the very first
view order index zero to the very last one in its original access
unit; and not starting from the view order index of the picture
that caused the DPB bumping process to be invoked.
As a reminder, the maximum number of frames in DPB for MultiView
High profile with more than 2 views is not necessarily a multiple
of the number of views.
This fixes decoding of MVCNV-4.264.
Gwenole Beauchesne [Fri, 6 Jun 2014 15:56:06 +0000 (17:56 +0200)]
decoder: h264: fix inter-view references array growth.
Let the utility layer handle dynamic growth of the inter-view pictures
array. By definition, setting a new size to the array will effectively
grow the array, but would also fill in the newly created elements with
empty entries (NULL), thus also increasing the reported length, which
is not correct.
Gwenole Beauchesne [Tue, 3 Jun 2014 15:36:38 +0000 (17:36 +0200)]
decoder: h264: reduce ReferenceFrames entries to the essential set.
When decoding Multiview High profile streams with a large number of
views, it is not possible to make the VAPictureParameterBufferH264.
ReferenceFrames[] array hold the complete DPB, with all possibly
active pictures to be used for inter-view prediction in the current
access unit.
So reduce the scope of the ReferenceFrames[] array to only include
the set of reference pictures that are going to be used for decoding
the current picture. Basically, this is a union of all RefPicListX[]
array, for all slices constituting the decoded picture.
Gwenole Beauchesne [Wed, 4 Jun 2014 17:10:44 +0000 (19:10 +0200)]
decoder: h264: fix MVC inter-view prediction process.
The inter-view reference components and inter-view only reference
components that are included in the reference picture lists shall
be considered as not being marked as "used for short-term reference"
or "used for long-term reference". This means that reference flags
should all be removed from VAPictureH264.flags.
This fixes decoding of MVCNV-2.264.
Gwenole Beauchesne [Wed, 4 Jun 2014 17:03:18 +0000 (19:03 +0200)]
decoder: h264: fix detection of profile changes for MVC.
If the VA driver exposes ad-hoc H.264 MVC profiles, then we have to
be careful to detect profiles changes and not reset the underlying
VA context erroneously. In MVC situations, we could indeed get a
profile_idc change for every SPS that gets activated, alternatively
(base-view -> non-base view -> base-view, etc.).
An improved fix would be to characterize the exact profile to use
once and for all when SPS NAL units are parsed. This would also
allow for fallbacks to a base-view decoding only mode.
Gwenole Beauchesne [Tue, 3 Jun 2014 12:30:39 +0000 (14:30 +0200)]
encoder: h264: drop extraneous definitions.
Re-use definitions from the codecparser headers instead of duplicating
them here again. That covers NALU definitions and slice types.
Sreerenj Balachandran [Tue, 1 Apr 2014 08:26:04 +0000 (11:26 +0300)]
encoder: h264: remove unnecessary calcualtion of max_pic_order_cnt.
https://bugzilla.gnome.org/show_bug.cgi?id=727418
Sreerenj Balachandran [Tue, 1 Apr 2014 11:23:56 +0000 (14:23 +0300)]
encoder: h264: don't allow CABAC with Extended profile.
The H.264 specification does not support CABAC entropy coding for the
Extended profile.
https://bugzilla.gnome.org/show_bug.cgi?id=727418
Sreerenj Balachandran [Tue, 6 May 2014 21:12:39 +0000 (00:12 +0300)]
encoder: h264: use packed headers mode for MVC encoding.
Exclusively use VA drivers that support raw packed headers for encoding.
i.e. simply submit packed headers Subset SPS and Prefix NAL units. This
provides for better compatibility accross the various VA drivers and HW
generations since no particular API is needed beyond what readily exists.
Sreerenj Balachandran [Tue, 6 May 2014 21:09:45 +0000 (00:09 +0300)]
encoder: h264: add support for packed slice headers.
https://bugzilla.gnome.org/show_bug.cgi?id=722905
Sreerenj Balachandran [Tue, 6 May 2014 21:09:19 +0000 (00:09 +0300)]
encoder: h264: store subset sps to generate the codec-data
Store the SubsetSPS nal unit which we need for MVC specific
codec_data generation.
Sreerenj Balachandran [Tue, 6 May 2014 21:08:33 +0000 (00:08 +0300)]
encoder: h264: fix MVC pipeline hang while encoding with B-frames.
Since we are encoding each view independently from each other, we
need a higher number of pre-allocated surfaces to be used as the
reconstructed frames. For Stereo High profile encoding, this means
to effectively double the number of frames to be stored in the DPB.
Li Xiaowei [Mon, 17 Feb 2014 07:51:43 +0000 (15:51 +0800)]
encoder: h264: add initial support for H.264 Stereo High profile.
Add initial support for Subset SPS, Prefix NAL and Slice Extension NAL
for non-base-view streams encoding, and the usual SPS, PPS and Slice
NALs for base-view encoding.
The H.264 Stereo High profile encoding mode will be turned on when the
"num-views" parameter is set to 2. The source (raw) YUV frames will be
considered as Left/Right view, alternatively.
Each of the two views has its own frames reordering pool and reference
frames list management system. Inter-view references are not supported
yet, so the views are encoded independently from each other.
Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
[limited to Stereo High profile per the definition of MAX_NUM_VIEWS]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Li Xiaowei [Mon, 17 Feb 2014 03:10:26 +0000 (11:10 +0800)]
encoder: h264: wrap pools for refs and frames reordering.
Create structures to maintain the reference frames list (RefPool) and
frames reordering (ReorderPool) logic.
This is a prerequisite for H.264 MVC support.
Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
Li Xiaowei [Fri, 14 Feb 2014 07:33:15 +0000 (15:33 +0800)]
encoder: h264: add provisional support for subset SPS headers.
Add provisions to write subset SPS headers to the bitstream in view
to supporting the H.264 MVC specification.
This assumes the libva "staging" branch is in use.
Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
Li Xiaowei [Wed, 18 Dec 2013 05:47:32 +0000 (13:47 +0800)]
utils: add H.264 MVC profiles.
Add "MultiView High" and "Stereo High" definitions.
Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
[require VA-API >= 0.35.2 for MVC profiles]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Mon, 2 Jun 2014 14:25:03 +0000 (16:25 +0200)]
utils: only enable VP8 profiles for newer VA-API versions.
VP8 decoding API appeared in VA-API >= 0.35.0. So, disable mappings
involving VP8 codec on earlier versions of the API.
Gwenole Beauchesne [Thu, 22 May 2014 08:04:46 +0000 (10:04 +0200)]
decoder: h264: compute view ids only once per slice.
Optimize lookups of view ids / view order indices by caching the result
of the calculatiosn right into the GstVaapiParserInfoH264 struct. This
terribly simplifies is_new_access_unit() and find_first_field() functions.
Gwenole Beauchesne [Wed, 21 May 2014 15:57:00 +0000 (17:57 +0200)]
decoder: h264: add support for MVC interlaced streams.
Fix support for MVC Stereo High profile streams with interlaced frames.
Also improve the detection logic of the first field.
Gwenole Beauchesne [Tue, 20 May 2014 16:08:15 +0000 (18:08 +0200)]
decoder: h264: add MVC profiles compatibility logic.
Add safe fallbacks for MVC profiles:
- all MultiView High profile streams with 2 views at most can be decoded
with a Stereo High profile compliant decoder ;
- all Stereo High profile streams with only progressive views can be
decoded with a MultiView High profile compliant decoder ;
- all drivers that support slice-level decoding could normally support
MVC profiles when the DPB holds at most 16 frames.
Gwenole Beauchesne [Fri, 2 May 2014 12:58:45 +0000 (14:58 +0200)]
decoder: h264: add initial support for MVC.
https://bugzilla.gnome.org/show_bug.cgi?id=721772
Gwenole Beauchesne [Thu, 1 May 2014 17:16:09 +0000 (19:16 +0200)]
decoder: h264: dynamically allocate the DPB.
Dynamically allocate the Decoded Picture Buffer (DPB) and add provisions
for supporting the MVC allocation requirements.
Gwenole Beauchesne [Thu, 1 May 2014 17:33:40 +0000 (19:33 +0200)]
decoder: h264: fix detection of access unit boundaries.
In order to have a stricter conforming implementation, we need to carefully
detect access unit boundaries. Additional operations could be necessary to
perform at those boundaries.
Sreerenj Balachandran [Wed, 13 Mar 2013 09:44:38 +0000 (11:44 +0200)]
decoder: h264: detect the first VCL NAL unit of a picture for MVC.
Detect the first VCL NAL unit of a picture for MVC, based on the
view_id as per H.7.4.1.2.4. Note that we only need to detect new
view components.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Sreerenj Balachandran [Thu, 31 Oct 2013 11:32:55 +0000 (19:32 +0800)]
decoder: h264: properly handle Prefix NAL units.
Always cache the previous NAL unit so that we could check whether
there is a Prefix NAL unit immediately preceding the current slice
or IDR NAL unit. In that case, the NAL unit metadata is copied into
the current NAL unit. Otherwise, some default values are inferred,
tentatively. e.g. view_id shall be set to 0 and inter_view_flag to 1.
[infer default values for slice if previous NAL was not a Prefix]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>