Commit graph

1381 commits

Author SHA1 Message Date
Sreerenj Balachandran
696b446f09 decoder: hevc: Fix decoding of stream when it has temporal sublayers
We are calculating the dpb size based on max_dec_pic_buffering.
But if there are more than one temporal sublayers, we are supposed
to use the max_dec_pic_buffering[max_sub_layers_minus] for dpb
size calculation (Assuming HighestTid as max_sub_layers_minus).

Sample streams: TSCL_A_VIDYO_5.bin, TSCL_B_VIDYO_4.bin

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-06 04:01:24 +03:00
Sreerenj Balachandran
cb8b2af5f0 decoder: hevc: Fix the decoding of dependent slice segment
Decoding process for reference picture list construction needs to be
invoked only for P and B slice and the value for slice_type of dependent slice
segment should be taken from the previous independent slice segment header
of the same pic.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-05 05:23:20 +03:00
Víctor Manuel Jáquez Leal
1e8610fc95 gstvaapicontext: fix the JPEG encoder attribs value
When we query for the VAConfigAttribEncJPEG, we get a value which packs the
VAConfigAttribValEncJPEG structure, but we did not assign it. This patch
assigns the returned value to the attribute.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-04 19:42:48 +02:00
Victor Jaquez
351496a304 gstvaapiencoder: framerate 0/1 is valid too
Framerate 0/1 is valid, and it is particularly useful for picture
encoding, such as jpeg. This patch makes the encoder to admit that
framerate.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-04 19:41:51 +02:00
Sreerenj Balachandran
47b78b7547 decoder: jpeg: Align with new API/ABI changes in codecparser
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-22 09:38:42 +03:00
Gwenole Beauchesne
52adebe779 decoder: h264: track previous reference frames.
Improve closure of gaps in frame_num by strictly following and trying
to fill them with previous reference frames. So, they are now tracked
thus avoiding insertion of dummy ("greenish") frames.
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
06147100f2 decoder: h264: fix integration of second field into the DPB.
If the new picture to be added to the DPB is not a first field, then
it shall be the second field of the previous picture that was added
before.

This removes the need for dpb_find_picture() now that we track the
immediately preceding decoded picture, in decode order.
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
d4ccae8398 decoder: h264: fix closure of "other-field" gap.
When a dummy "other-field" is inserted, it is assumed to inherit the
reference flags from the first field, and the sliding window decoded
reference picture marking process is also executed so that corrupted
frames are moved out as early as possible.

While doing so, we also try to output frames that now contain a single
valid field picture, prior to inserting any other picture into the DPB.
Note: this may be superfluous currently based on the fact that dpb_add()
combines the two most recent pairable fields, but this process would be
further simplified later on.
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
80a7ab0959 decoder: h264: track corrupted frames.
Mark the picture as "corrupted" if it is reconstructed from corrupted
references or if those references are fake, e.g. resulting from lost
frames.

This is useful for notifying the upper layer, or downstream elements,
that the decoded frame may contain artefacts.

https://bugzilla.gnome.org/show_bug.cgi?id=703921
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
939bdb08a5 decoder: add initial infrastructure for marking corrupted output.
Add initial infrastructure in core codec library and vaapidecode to mark
corrupted frames as such. A corrupted frame is such a frame that was
reconstructed from invalid references for instance.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-07-20 15:25:46 +02:00
Víctor Manuel Jáquez Leal
1b76561d95 vaapidecoder: no wmv profiles gstreamer 1.4/1.2
This patch fix the auto-plugging problem in gstreamer 1.2 and gstreamer 1.4

Right now there is not a primary ranked parser for vc1 and the demuxers
delivers caps without specifying the profile. This situation is not an issue
for avdec_vc1 but for vaapidecode it is, which refuses to negotiate without a
explicit profile defined in the negotiated caps.

Nonetheless, in gstreamer 1.5 it seems not to be a problem since the
negotiation admits caps subsets try outs.

This patch solves the issue ignoring the profile negotiation in the caps. For
gstreamer < 1.5 the profile string is not handled, so the auto-plugging get
done without the vc1 parser, such as happens in gstreamer 1.5.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-07-15 13:38:23 +02:00
Sreerenj Balachandran
86c4cdc8b6 build: Add missing CFLAGS to Makefile.am 2015-07-07 13:32:18 +03:00
Sreerenj Balachandran
9f0e054d9d gstvaapifilter: Only register STE property if it supported by corresponding VA library
Fix the regression introduced in commit eb465fb.
VAProcFilterSkinToneEnhancement is avaialbe from VA >= 0.36.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-03 15:07:45 +03:00
Sreerenj Balachandran
eb465fb392 gstvaapifilter: Add guard for VAProcFilterSkinToneEnhancement
VAProcFilterSkinToneEnhancement is avaialbe from VA >= 0.36.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-03 12:42:09 +03:00
Sreerenj Balachandran
6b88777627 encoder:h265: Fix the check for packed-header support
Use VA_ENC_PACKED_HEADER_* definition for checking.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-02 21:57:38 +03:00
Sreerenj Balachandran
02d8092da9 encoder:h264: Fix the check for packed-header support
Use VA_ENC_PACKED_HEADER_* definition for checking.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-02 21:37:56 +03:00
Sreerenj Balachandran
a260426194 encoder: h264: submit SEI buffering_period() and picture_timing() messages for CBR mode
One buffering_period() SEI message shall be present in every IDR access unit
when NalHrdBpPresentFlag is inferred to be equal to 1. This is the case when we
use a non-CQP mode, e.g. CBR. In other words, when
nal_hrd_parameters_present_flag is set to 1.

One picture_timing() SEI messages shall be present in every access unit
if CpbDpbDelaysPresentFlag is equal to 1 or pic_struct_present_flag is equal to 1

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-02 21:01:38 +03:00
Sreerenj Balachandran
cf9a0225c8 Fix build error for older VA-API versions
Provide guards for VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM and
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME which are only availble from
VA >= 0.36.
2015-06-18 12:20:37 +03:00
Víctor Manuel Jáquez Leal
1ef8c10aa8 vaapipostproc: add skin tone enhancement
Added the 'skin-tone-enhancement' property to vaapostproc.

https://bugzilla.gnome.org/show_bug.cgi?id=744088
2015-06-08 18:00:05 +02:00
Sreerenj Balachandran
2a2ecbe865 encoder: jpeg: Fix the packed header generation
This is a work-around to satisfy the va-intel-driver.
Normalize the quality factor and scale QM values (only for packed header
generation) similar to what VA-Intel driver is doing . Otherwise the
generated packed headers will be wrong, since the driver itself is
scaling the QM values using the normalized quality factor.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-06-02 08:52:53 +03:00
Gwenole Beauchesne
d2791a7844 decoder: h264: fix uninitialized variables in avcC mode.
Fix uninitialized variables when decoding SPS and PPS NAL units from
"codec-data" buffers. This is particularly important when seeking ops
are involved, and the new persistent states are used more often.

https://bugzilla.gnome.org/show_bug.cgi?id=750094
2015-06-02 11:50:56 +02:00
Sreerenj Balachandran
619058b5b7 encoder: hevc: Fix the size over-flow for encoded buffer.
The approximation of 6 times compression ratio migh not
work in all cases. Especially when enabling I frames.
Provide large enough size for coded-buffer creation.
2015-05-28 10:52:48 +03:00
Sreerenj Balachandran
4d8eaf1918 encoder: vp8: Fix the size over-flow for encoded buffer.
The approximation of 4 times compression ratio will not
work in all cases. Especially when enabling I frames.
Provide large enough size for coded-buffer creation.
2015-05-28 10:43:20 +03:00
Sreerenj Balachandran
55775c6203 encoder: hevc: fix bug in multi slice encoding.
This is a work-around for satisfying the VA-Intel driver.
The driver only support slices begin from CTU row start address.

Multi-Slice encoding also requires a fix in va-intel-driver:
http://lists.freedesktop.org/archives/libva/2015-May/003351.html

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-28 05:43:49 +03:00
Gwenole Beauchesne
5abd2b90b6 decoder: h264: add initial support for loss of pictures.
Implement decoding process for gaps in frame_num (8.5.2). This
also somewhat supports unintentional loss of pictures.

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

Original-patch-by: Wind Yuan <feng.yuan@intel.com>
[fixed derivation of POC, ensured clone is valid for reference,
 actually fixed detection of gaps in FrameNum by PrevRefFrameNum]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-05-28 10:51:44 +02:00
Gwenole Beauchesne
8dd93e9c8a decoder: h264: add support for missing first field.
Try to identify missing first fields too, thus disregarding any
intermediate gaps in frames. We also assume that we keep the same
field sequence, i.e. if previous frames were in top-field-first
(TFF) order, then so are subsequent frames.

Note that insertion of dummy first fields need to operate in two
steps: (i) create the original first field that the current field
will inherit from, and (ii) submit that field into the DPB prior
to initializing the current (other) field POC values but after any
reference flag was set. i.e. copy reference flags from the child
(other field) to the parent (first field).

https://bugzilla.gnome.org/show_bug.cgi?id=745048
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
efaadfc7c0 decoder: h264: add support for missing second field.
Interlaced H.264 video frames always have two fields to decode and
display. However, in some cases, e.g. packet loss, one of the field
can be missing. This perturbs the reference picture marking process,
whereby the number of references available in DPB no longer matches
the expected value.

This patch adds initial support for missing field within a decoded
frame. The current strategy taken is to find out the nearest field,
by POC value, and with the same parity.

https://bugzilla.gnome.org/show_bug.cgi?id=745048
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
4776138d4a decoder: h264: improve tracking of "top-field-first" flag.
Try to maintain a "top-field-first" (TFF) flag, even if the H.264 standard
does not mandate it. This will be useful for tracking missing fields, and
also for more correct _split_fields() implementation for frames in the DPB.
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
b4e920843b decoder: h264: skip all pictures prior the first I-frame.
Don't try to decode pictures until the first I-frame is received within
the currently active sequence. There is no point is decoding and then
displaying frames with artifacts.
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
6229ad4f7f decoder: h264: fix processing of EOSEQ NAL.
Fix decoding of end_of_seq() NAL unit so that to not submit the current
picture for decoding again. This is pretty vintage code that dates back
before the existing of the whole decoder units machinery.

One issue that could be arising if that code was kept is that we could
have submitted a picture, and subsequently a GstVideoCodec frame, twice.
Once without the decode_only flag set, and once with that flag set. The
end result is that the GstVideoDecoder would release the codec frame
twice, thus releasing stale data.

In short, the piece of code that is removed by this patch is for once
completely obsolete for a while, and secondly error-prone in corner
cases.
2015-05-28 10:51:43 +02:00
Wind Yuan
a89a8cf1e3 decoder: add utility function to clone picture objects.
https://bugzilla.gnome.org/show_bug.cgi?id=703921

Signed-off-by: Wind Yuan <feng.yuan@intel.com>
[added cosmetic changes, fixed propagation of "one-field" flag to
 children, fixed per-codec clone modes (h264)]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-05-28 10:51:43 +02:00
Alban Browaeys
3857d5fce1 HEVC: decode: add missing va_dec_hevc header
Signed-off-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749953
2015-05-27 23:43:16 +03:00
Gwenole Beauchesne
efc07f6bb1 mpeg2: fix PTS cache for GOP start.
If the GOP temporal sequence number (TSN) is interpolated from a valid
PTS, then we need to compensate that PTS corresponding to the start of
GOP with the next picture to be decoded, which shall be an I-frame,
based on its sequence number.

https://bugzilla.gnome.org/show_bug.cgi?id=748676
2015-05-27 16:43:34 +02:00
Víctor Manuel Jáquez Leal
d6255be939 mpeg2: avoid crash when seeking with debug logs
Move down the debug message when the state of the decoder is verified
so the slice header is not NULL.
2015-05-27 12:03:21 +02:00
Jan Schmidt
f1a60ec6a2 mpeg2: Avoid crashes and warnings on re-opened decoder after a seek
Reset state and add some checks for safe state to avoid a crash and
a warning after the decoder is destroyed/recreated during a seek.
2015-05-27 12:01:06 +02:00
Sreerenj Balachandran
78fb4bcf8d HEVC: decode: Replace clip3 implementation with glib CLAMP macro
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-26 06:04:11 +03:00
Sreerenj Balachandran
8762b04a19 HEVC: decode: Update Cropping Rectangle
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-26 05:33:33 +03:00
Sreerenj Balachandran
e623651d69 HEVC_Encode: Add HEVC(h265) encoder to core libgstvaapi
https://bugzilla.gnome.org/show_bug.cgi?id=748874

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-25 11:42:33 +03:00
Sreerenj Balachandran
e069ddf2b1 gstvaapiutils_h265: Add H265 Tier specific utility functions
-- New API: gst_vaapi_utils_h265_get_tier_from_string()
-- New API: gst_vaapi_utils_h265_get_tier_string()

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-25 11:23:16 +03:00
Víctor Manuel Jáquez Leal
89e41fc8e3 build: use git.mk
This patch handles dinamically the gitignore files with git.mk[1].

Removed the automake variable MAINTAINERCLANFILES in most of the
Makefile.am files since now it is handled by the top one.

1. https://github.com/behdad/git.mk/blob/master/git.mk

https://bugzilla.gnome.org/show_bug.cgi?id=749321
2015-05-18 16:14:46 +02:00
Víctor Manuel Jáquez Leal
70eff01d36 wayland: sync() when destroy()
Before pushing a the new frame, the render() method calls sync() to flush the
pending frames. Nonetheless, the last pushed frame never gets rendered, leading
to a memory leak too.

This patch calls sync() in the destroy() to flush the pending frames before
destroying the window.

Also a is_cancelled flag is added. This flag tells to not flush the event
queue again since the method failed previously or were cancelled by the user.

https://bugzilla.gnome.org/show_bug.cgi?id=749078
2015-05-18 15:25:52 +02:00
Michael Olbrich
11b9260b6c vaapisink: implement unlock/unlock_stop for wayland
Otherwise wl_display_dispatch_queue() might prevent the pipeline from
shutting down. This can happen e.g. if the wayland compositor exits while
the pipeline is running.

Changes:
* renamed unlock()/unlock_stop() to unblock()/unblock_cancel() in gstvaapiwindow
* splitted the patch removing wl_display_dispatch_queue()

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

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

https://bugzilla.gnome.org/show_bug.cgi?id=749078
2015-05-15 17:10:37 +02:00
Víctor Manuel Jáquez Leal
522ec79d2e wayland: wl_display_dispatch_queue() can block forever.
wl_display_dispatch_queue() might prevent the pipeline from shutting
down. This can happen e.g. if the wayland compositor exits while the
pipeline is running.

This patch replaces it with these steps:

- With wl_display_prepare_read() all threads announce their intention
  to read.
- wl_display_read_events() is thread save. On threads reads, the other
  wait for it to finish.
- With wl_display_dispatch_queue_pending() each thread dispatches its
  own events.

wl_display_dispatch_queue_pending() was defined since wayland 1.0.2

Original-patch-by: Michael Olbrich <m.olbrich@pengutronix.de>
* stripped out the unlock() unlock_stop() logic
* stripped out the poll handling

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

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

https://bugzilla.gnome.org/show_bug.cgi?id=747492
2015-05-15 17:10:37 +02:00
Víctor Manuel Jáquez Leal
882387de30 wayland: rename frame for last_frame
Since frame in the private data means the last frame sent, it would
semantically better use last_frame.

Also, this patch makes use of g_atomic_pointer_{compare_and_exchange, set}()
functions.

https://bugzilla.gnome.org/show_bug.cgi?id=749078
2015-05-14 16:48:43 +02:00
Víctor Manuel Jáquez Leal
c80951ada1 wayland: use a counter as sync flag
Wayland window has a pointer to the last pushed frame and use it to set the
flag for stopping the queue dispatch loop. This may lead to memory leaks,
since we are not keeping track of all the queued frames structures.

This patch removes the last pushed frame pointer and change the binary flag
for an atomic counter, keeping track of number of queued frames and use it for
the queue dispatch loop.

https://bugzilla.gnome.org/show_bug.cgi?id=749078
2015-05-14 16:48:43 +02:00
Víctor Manuel Jáquez Leal
62c3888b76 wayland: decouple wl_buffer from frame
This patch takes out the wayland's buffer from the the frame structure. The
buffer is queued to wayland and destroyed in the "release" callback. The
frame is freed in the surface's "done" callback.

In this way a buffer may be leaked but not the whole frame structure.

- surface 'done' callback is used to throttle the rendering operation and to
  unallocate the frame, but not the buffer.
- buffer 'release' callback is used to destroy wl_buffer.

Original-patch-by: Zhao Halley <halley.zhao@intel.com>
* code rebase
* kept the the event_queue for buffer's proxy

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749078
2015-05-14 16:48:43 +02:00
Víctor Manuel Jáquez Leal
ef7dc4eaf6 build: fix make distcheck
This patch fixes several issues found when running the `make distcheck`
target:

- In commit c561b8da, the update of gstcompat.h in Makefile.am was
  forgotten.
- In commit c5756a91 add the simple_encoder_source_h in EXTRA_DIST was
  forgotten.
- vpx.build.stamp is not generated at all, only vpx.configure.stamp.
- The make target distcleancheck failed because some autogenerated files
  were not handled with the DISTCLEANFILES variable.

Note: `make distcheck -jXX` is not currently supported.
2015-05-13 15:21:07 +02:00
Víctor Manuel Jáquez Leal
069edff757 libs: trivial documentation fix
GST_VAAPI_ENCODER_STATUS_NO_SURFACE and GST_VAAPI_ENCODER_STATUS_NO_BUFFER
are not errors, so they do not have the ERROR namespace.

This patch fixes this typo in documentation.
2015-05-06 09:54:26 +02:00
Simon Farnsworth
e60df073a0 window: Correct prototype to match implementation
On s390x, guintptr and GstVaapiID are not compatible types. The
implementation of gst_vaapi_window_new_internal() and all its callers
seem to assume that its third argument is a GstVaapiID, while the
header gives it guintptr type.

https://bugzilla.gnome.org/show_bug.cgi?id=744559
2015-05-04 18:07:46 +02:00
Víctor Manuel Jáquez Leal
81d6b42420 build: upgrade glib dependency to 2.32
Since bug #745728 was fixed the oldest supported version of GStreamer is
1.2. That GStreamer release requires glib 2.32, so we can upgrade our
requirement too.

This patch changes the required version of glib in configure.ac and removes
the hacks in glibcompat.h

https://bugzilla.gnome.org/show_bug.cgi?id=748698
2015-04-30 13:54:34 +02:00
Olivier Crete
4091e86ab6 wayland: don't leak the registry proxy
Release the registry proxy when closing the display.

https://bugzilla.gnome.org/show_bug.cgi?id=748564
2015-04-28 10:36:08 +02:00
Víctor Manuel Jáquez Leal
af8ea3701e wayland: refactor _sync() method and rename callback
This patch only intends to improve readability: in the method
gst_vaapi_window_wayland_sync() the if/do instructions are squashed into a
single while loop.

Also renames the frame_redraw_callback() callback into frame_done_callback(),
which is a bit more aligned to Wayland API.
2015-04-21 17:25:47 +02:00
Michael Olbrich
7548c72a7d wayland: free frame in buffer release callback
The Wayland compositor may still use the buffer when the frame done
callback is called.

This patch destroys the frame (which contains the buffer) until the
release callback is called. The draw termination callback only controls
the display queue dispatching.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=747492
2015-04-21 17:25:25 +02:00
Olivier Crete
11c963a3c1 vaapidecode: Tell the base class about released frames on close
The base class needs to be informed about frames that were still queued
in the decoder on release, otherwise they are leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=747999
2015-04-20 12:50:09 +02:00
Gwenole Beauchesne
b3eccdb72b decoder: hevc: cosmetics.
Mostly coding style updates. Avoid integer signess inconsistencies.
Optimize dpb_find_lowest_poc() to align with original h264's decoder.
2015-04-17 10:43:47 +02:00
Sreerenj Balachandran
baec8e35f4 decoder: hevc: Add Support for tiled video decoding
Based up on the value of uniform_spacing_flag in Picture Parameter Set,
the tile column width and tile row height should be calculated.
Equations: 6-1, 6-2
Tiled video Descriptions: 7.3.2.3, 7.4.3.3
2015-04-16 14:13:59 +03:00
Sreerenj Balachandran
2ddfcd8bc3 decoder: hevc: Fix decoding when there are RASL pictures present.
-- Set NoRaslOutputFlag based on EOS and EOB Nal units
-- Fix PicOutputFlag setting for RASL picture
-- Fix prev_poc_lsb/prev_poc_msb calculation
-- Drop the RASL frames if NoRaslOutputFlag is TRUE for the associated IRAP picture
-- Fixed couple of crashes and added cosmetics
2015-04-16 14:13:21 +03:00
Martin Sherburn
b5425da1de display: drm: fix race condition setting device type
There is a race condition where g_drm_device_type can be left set to
DRM_DEVICE_RENDERNODES when it shouldn't.

If thread 1 comes in and falls into the last else statement setting up both
RENDERNODES and LEGACY types. And begins to process the first type (RENDERNODES),
it sets g_drm_device_type = RENDERNODES.

Now when thread 2 comes in and sees g_drm_device_type is RENDERNODES, it queues
up that type to be tried but then encounters the lock and has to wait until the
first thread finishes. Once the lock is acquired it will then proceed to ONLY try
RENDERNODES and fail it. But it doesn't try LEGACY. And from then on, all future
attempts will only try RENDERNODES.

So to avoid this situation I have simply moved the acquisition of the lock higher
up in the attached patch.

https://bugzilla.gnome.org/show_bug.cgi?id=747914
2015-04-16 13:03:20 +02:00
Olivier Crete
0adb36b658 videopool: Release lock while allocating new object
The video pool can be accessed with the display lock held, for example,
when releasing a buffer from inside vaapisink_render, but allocating
a new object can may also take the display lock. Which means a possible
deadlock.

https://bugzilla.gnome.org/show_bug.cgi?id=747944
2015-04-16 12:11:45 +02:00
Víctor Manuel Jáquez Leal
8bef2cbd49 HEVC: silence the compiler
Fixed a couple of clang complains.
2015-04-16 11:25:42 +02:00
Michael Olbrich
b8f8d50f41 wayland: destroy vpp buffer pool on resize
Otherwise the old buffers with the old size are used.

https://bugzilla.gnome.org/show_bug.cgi?id=747491
2015-04-14 11:39:58 +02:00
Víctor Manuel Jáquez Leal
3eb7986409 build: don't compile HEVC if not supported
HEVC decoding was added recently libva-1.5.

This patch avoids HEVC decoding support in libgstvaapi if it is not available
in the installed libva.

https://bugzilla.gnome.org/show_bug.cgi?id=747831
2015-04-14 11:36:13 +02:00
Sreerenj Balachandran
430174f5a7 HEVC: Add HEVC(h265) decoder to core libgstvaapi
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-13 15:41:45 +03:00
Sreerenj Balachandran
8c5f1b1c4b HEVC: Add codec utility methods to core libgstvaapi
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-13 14:53:46 +03:00
Sreerenj Balachandran
23bf2ff9e5 HEVC: gstvaapiprofile: Add profile definitions
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-13 14:52:53 +03:00
Sreerenj Balachandran
33023d4d4d HEVC: Allow to build h265 codecparser internally
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-13 14:51:51 +03:00
Víctor Manuel Jáquez Leal
38f8fea4bb guard buffer export API if not available
The support for buffer exports in VA-API was added in version 0.36. These
interfaces are for interop with EGL, OpenCL, etc.

GStreamer-VAAPI uses it for a dmabuf memory allocator. Though, gstreamer-vaapi
has to support VA-API versions ranging from 0.30.4, which doesn't support it.

This patch guards all the buffer exports handling (and dmabuf allocator) if
the detected VA-API version is below 0.36.

https://bugzilla.gnome.org/show_bug.cgi?id=746405
2015-04-13 13:22:50 +02:00
Víctor Manuel Jáquez Leal
93d0141cc2 libs: remove unused variables
clang reports these unused variables. Let's get rid of them.

This patch is a missing part of commit c82e5173

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 18:21:49 +02:00
Víctor Manuel Jáquez Leal
a6518f6888 decoder: mpeg4: remove an spurious comparison
The member size in GstMpeg4Packet is gsize which is unsigned, which cannot be
less than zero. Hence this pre-condition test is a no-op. This patch removes
that code.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Víctor Manuel Jáquez Leal
7c71f057b4 encoder: h264: casts slice_param->slice_type
slice_type in slice_param is defined as (char *), but it is compared against a
signed integer. clang complains about this comparison.

This patch casts the variable.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Víctor Manuel Jáquez Leal
b1bbc087c1 encoder: avoid GstVaapiCodedBuffer redefinition
The symbol GstVaapiCodedBuffer is already defined in
gst-libs/gst/vaapi/gstvaapicodedbuffer.h which is loaded, at the end, by
gstvaapiencoder_objects.h. Clang complains about the symbol re-definition.

This patch removes that redefinition.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Víctor Manuel Jáquez Leal
c82e51738f libs: remove unused variables
clang reports these unused variables. Let's get rid of them.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Víctor Manuel Jáquez Leal
d363000eaa encoder: mpeg2: use fabsf() instead of abs()
The member value in frame_rate_tab is float, the result of the abs() function
should be float too. But abs() only manages integers.

This patch replaces abs() with fabsf() to handle correctly the possible floats
values.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Víctor Manuel Jáquez Leal
c9f0807752 decoder: cast GST_VAAPI_DECODER_STATUS_DROP_FRAME
Since GST_VAAPI_DECODER_STATUS_DROP_FRAME is not part of the enum
GstVaapiDecoderStatus, we need to cast it to avoid compiler complains.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Víctor Manuel Jáquez Leal
c561b8da8a update and move gstcompat.h
The purpose of gstcompat.h is to couple the API differences among
gstreamer-1.0 and gstreamer-0.10. Since gstreamer-0.10 is obsolete, the code
in this compatibility layer shall be removed.

Nevertheless, the gstcompat.h header should be kept, if new incompatibilites
appear in the future, but it shall live in gst/vaapi, not in gst-libs.

This patch removes the crumbs defined gstcompat.h and moves it to gst/vaapi.
In order to avoid layer violations, gstcompat.h includes sysdeps.h and all
the includes in gst/vaapi of sysdeps.h are replaced with gstcompat.h

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-03 17:08:30 +03:00
Víctor Manuel Jáquez Leal
f5d3c2d85d Remove libgstvaapi-videoutils.so
This library was intended to add the base classes for video decoders which
where not included in gstreamer-0.10.

Since the support of gstreamer-0.10 is deprecated those classes are not
required, thus the whole library is removed.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 17:01:45 +03:00
Víctor Manuel Jáquez Leal
43d8366ec6 Remove HAVE_GST_VIDEO_OVERLAY_HWCAPS macro
This macro guarded the use of HAVE_GST_VIDEO_OVERLAY_HWCAPS, which was not
defined before gstreamer 0.10.35. Since the support of gstreamer-0.10 is
deprecated these guards are not required.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 16:55:43 +03:00
Víctor Manuel Jáquez Leal
d256f1d283 Removal of gstreamer-0.10 support
This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-0.10.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 16:55:27 +03:00
Víctor Manuel Jáquez Leal
0311c7c8af autotools: remove gstreamer-0.10 support
This patch only removes the support of gstreamer-0.10 in the autotools
scripts. No other files are touched.

The configuration parameter --gstreamer-api was deleted since now it is always
auto-detected.

The verification of vmethod query in GstBaseSinkClass was removed since it was
added in gstreamer 0.10.35. The same case for GstVideoOverlayComposition and
its format flags.

The precious variable GST_PLUGIN_PATH was removed, while GST_PLUGIN_PATH_1_0
remained.

The automake files were changed accordingly.

Removed, in debian/control, the vaapiupload and vaapidownload descriptions.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 16:54:54 +03:00
Julien Isorce
200b1baabc vaapidisplay: mark X11 display as compatible with EGL
GST_GL_WINDOW=x11 GST_GL_API=gles2 GST_GL_PLATFORM=egl
gst-launch-1.0 ... ! vaapidecode ! glimagesink

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-03-14 22:12:19 +02:00
Sreerenj Balachandran
3f28da7f5a encoder: h264: add support for more than 2 views
Add support for H.264 MVC Multiview High profile encoding with
more than 2 views. All views within the same accesss unit are
provided in increasing order of view order index (VOIdx).

Upto 10 view are supported for now.

A new property "view-ids" has been provided for the plugins to
set the view ids (which is an array of guint values) to be used
for mvc encoding.

https://bugzilla.gnome.org/show_bug.cgi?id=732453
2015-02-24 17:14:33 +02:00
Gwenole Beauchesne
6a465ae793 plugins: add support for GstVideoGLTextureOrientation.
Add support for GstVideoGLTextureOrientation modes. In particular,
add orientation flags to the GstVaapiTexture wrapper and the GLX
implementations. Default mode is that texture memory is laid out
with top lines first, left row first. Flags indicate whether the
X or Y axis need to be inverted.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
aabb8c99c2 egl: add windowing support.
This provides for some basic EGL window abstraction.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
23c489d8ee egl: add texture abstraction.
Add GstVaapiTextureEGL abstraction that can create its own GL texture,
or import a foreign allocated one, while still allowing updates from a
VA surface.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
a9fe79610a egl: allow for EGLImage imports into VA Surfaces.
Add helpers to import EGLImage objects into VA surfaces. There are
two operational modes: (i) gst_vaapi_surface_new_from_egl_image(),
which allows for implicit conversion from EGLImage to a VA surface
in native video format, and (ii) gst_vaapi_surface_new_with_egl_image(),
which exactly wraps the source EGLImage, typically in RGBA format
with linear storage.

Note: in case of (i), the EGLImage can be disposed right after the
VA surface creation call, unlike in (ii) where the user shall ensure
that the EGLImage is live until the associated VA surface is no longer
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=743847
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
1e7c4db5a7 Add initial support for EGL.
Add initial support for EGL to libgstvaapi core library. The target
display server and the desired OpenGL API can be programmatically
selected at run-time.

A comprehensive set of EGL utilities are provided to support those
dynamic selection needs, but also most importantly to ensure that
the GL command stream is executed from within a single thread.

https://bugzilla.gnome.org/show_bug.cgi?id=743846
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
91c5d948be libs: initialize GValues in a thread-safe manner. 2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
11b02b05e5 libs: re-indent all GValue related source code. 2015-02-24 15:20:03 +01:00
Víctor Manuel Jáquez Leal
671b1ea305 Fix compiler warnings
This patch fixes some warnings that gcc 4.9 reports.

https://bugzilla.gnome.org/show_bug.cgi?id=744411
2015-02-18 11:46:11 +02:00
Víctor Manuel Jáquez Leal
481d6b1f25 VC1: decoder: Ignore VC1 user BDU's
Don't return error if the processed BDU is a user one, just ignore them.
https://bugzilla.gnome.org/show_bug.cgi?id=741237

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-02-18 11:20:42 +02:00
Sreerenj Balachandran
eeefdb4958 Add VP8 Encoder to core libgstvaapi. 2015-02-13 13:42:04 +02:00
Lim Siew Hoon
6edb173486 decoder: vc1: Rounding control handling for VC1 simple and Main profile
Added rounding control handling for VC1 simple and Main profile
based on VC1 standard spec: section 8.3.7

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

Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-02-10 11:40:16 +02:00
Sreerenj Balachandran
6b73746ab6 encoder: jpeg: Fix the sampling factor calculation for ENCODED format.
If the incoming raw video format is GST_VIDEO_FORMAT_ENCODED,
use native YUV420 format (which is i420) as default.
2015-02-05 13:08:53 +02:00
Sreerenj Balachandran
0f40843bb3 encoder: Only support YUV420 native format as input for now
Practically we should be able to support more formats, for eg:
JPEG Encoder can support YUV422, RGBA and all.
But this is causing more issues which need proper fix here and there.
2015-02-05 12:13:38 +02:00
Olivier Crete
fc7e6b19fd vaapidecode: Check the condition after taking the lock
Otherwise the condition could become true before the lock
is taken and the g_cond_signal() could be called
before the g_cond_wait(), so the g_cond_wait() is never
awoken.

https://bugzilla.gnome.org/show_bug.cgi?id=740645
2015-02-04 18:34:59 +02:00
Sreerenj Balachandran
4c7c858374 gstvaapicontext: Add VAConfigAttribValEncJPEG to the attribute list using for VAConfig creation. 2015-02-04 11:17:58 +02:00
Sreerenj Balachandran
7a84b06097 gstvaapicontext: Don't use the unsupported Ratecontrol attributes for vaCreateConfig
Don't add the VAConfigAttribRateControl to the attribute list using
for the vaCreateConfig if it is not supported by the driver.
2015-02-04 11:17:27 +02:00
Sreerenj Balachandran
beefadc7b7 gstvaapiencoder: Use hardcoded packed_raw_data flag for JPEG Encoding 2015-02-04 11:17:06 +02:00
Sreerenj Balachandran
3332c25ef6 gstvaapiencoder: Fix crash when handling rate control mask
Having a ratecontrol_mask equal to zero is not a bug, but the driver
might not be supporting any kind of rate control mechanisms.
Eg: JPEG Encoding
2015-02-04 11:16:37 +02:00
Sreerenj Balachandran
0609fad69c encoder: Add JPEG Encoder 2015-02-04 11:16:05 +02:00
Sreerenj Balachandran
f8020bb03e encoder_objects: Add QuantizationMatrix and JPEGHuffmanTable 2015-02-04 11:15:38 +02:00
Sreerenj Balachandran
d48ab9a3d6 Encode: Add support for Picture level Entrypoint
This is useful for JPEG encoding which is utilizing picture level
entrypoint instead of slice level entrypoint like h264,mpeg2 etc.
2015-02-04 11:15:00 +02:00
Gwenole Beauchesne
797632139f surface: add support for GEM buffer imports.
Add support for GEM buffer imports. This is useful for VA/EGL interop
with legacy Mesa implementations, or when it is desired or required to
support outbound textures for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=736718
2015-01-28 17:35:16 +01:00
Gwenole Beauchesne
011f9bd6cb surface: add support for dma_buf imports.
Add new gst_vaapi_surface_new_with_dma_buf_handle() helper function
to allow for creating VA surfaces from a foreign DRM PRIME fd. The
resulting VA surface owns the supplied buffer handle.

https://bugzilla.gnome.org/show_bug.cgi?id=735362
2015-01-28 17:35:16 +01:00
Gwenole Beauchesne
dd37fc4999 surface: add initial support for foreign buffer imports.
Add gst_vaapi_surface_new_from_buffer_proxy() helper function to
create a VA surface from an external buffer provided throug the
new GstVaapiBufferProxy object.
2015-01-28 17:35:16 +01:00
Gwenole Beauchesne
f3c58d4ef4 surface: add support for GEM buffer exports.
Add support for GEM buffer exports. This will only work with VA drivers
based off libdrm, e.g. the Intel HD Graphics VA driver. This is needed
to support interop with EGL and the "Desktop" GL specification. Indeed,
the EXT_image_dma_buf_import extension is not going to be supported in
Desktop GL, due to the lack of support for GL_TEXTURE_EXTERNAL_OES targets
there.

This is useful for implementing VA/EGL interop with legacy Mesa stacks,
in Desktop OpenGL context.

https://bugzilla.gnome.org/show_bug.cgi?id=736717
2015-01-28 17:35:16 +01:00
Gwenole Beauchesne
073d6d59e1 surface: add support for dma_buf exports.
Use the new VA buffer export APIs to allow for a VA surface to be
exposed as a plain PRIME fd. This is in view to simplifying interop
with EGL or OpenCL for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=735364
2015-01-28 17:35:16 +01:00
Gwenole Beauchesne
250260cc36 Add abstraction for exported VA buffers.
The VA buffer export APIs work for a particular lifetime starting from
vaAcquireBufferHandle() and ending with vaReleaseBufferHandle(). As such,
it could be much more convenient to support implicit releases by simply
having a refcount reaching zero.

https://bugzilla.gnome.org/show_bug.cgi?id=736721
2015-01-28 17:35:16 +01:00
Sreerenj Balachandran
7651c51324 Add missing header file to Makefile
Add gstvaapitexture_glx.h to Makefile.am
2015-01-28 18:25:09 +02:00
Gwenole Beauchesne
96ce1bc761 videopool: add optional flags for surface pool allocation.
Reword surface pool allocation helpers so that to allow for a simple
form, e.g. gst_vaapi_surface_pool_new(format, width, height); and a
somewhat more elaborated/flexible form with optional allocation flags
and precise GstVideoInfo specification.

This is an API/ABI change, and SONAME version needs to be bumped.
2015-01-27 18:11:45 +01:00
Gwenole Beauchesne
e4e43cd842 videopool: re-indent all GstVaapiVideoPool related source code. 2015-01-27 18:11:45 +01:00
Gwenole Beauchesne
f5af9d150e window: add toplevel display indirection for visualid and colormap.
Add GstVaapiDisplay::get_{visual_id,colormap}() helpers to help determine
the best suitable window visual id and colormap. This is an indirection in
view to supporting EGL and custom/generic replacements.
2015-01-27 18:11:45 +01:00
Gwenole Beauchesne
babae32432 window: add toplevel API to determine the colormap.
Add GstVaapiWindowClass::get_colormap() hook to help determine the
currently active colormap bound to the supplied window, or actually
create it if it does not already exist yet.
2015-01-27 18:11:45 +01:00
Gwenole Beauchesne
e9f437167f window: add toplevel API to determine a visual id.
Add GstVaapiWindowClass::get_visual_id() function hook to help find
the best suitable visual id for the supplied window. While doing so,
also simplify the process by which an X11 window is created with a
desired Visual, i.e. now use a visual id instead of a Visual object.
2015-01-27 18:11:45 +01:00
Gwenole Beauchesne
ff0a237458 window: add generic helper to create windows.
Add a new generic helper function gst_vaapi_window_new() to create
a window without having the caller to check for the display type
himself. i.e. internally, there is now a GstVaapiDisplayClass hook
to create windows, and the actual backend implementation fills it in.
Add new generic helper functions gst_vaapi_texture_new_wrapped()

This is a simplification in view to supporting EGL.
2015-01-27 18:11:45 +01:00
Gwenole Beauchesne
807c4e8248 display: add utility function to check for OpenGL rendering.
Add gst_vaapi_display_has_opengl() helper function to help determining
whether the display can support OpenGL context to be bound to it, i.e.
if the class is of type GST_VAAPI_DISPLAY_TYPE_GLX.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
7d5d3e8640 display: refine the meaning of display type.
Make gst_vaapi_display_get_display_type() return the actual VA display
type. Conversely, add a gst_vaapi_display_get_class_type() function to
return the type of the GstVaapiDisplay instance. The former is used to
identify the display server onto which the application is running, and
the latter to identify the original object class.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
17f21ac4db display: cosmetics (helper macros, new internal API names).
Add more helper macros to the top-level GstVaapiDisplay interfaces.
Rename a few others used internally for improved consistency.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
1843774c0b display: record native display object.
Record the underlying native display instance into the toplevel
GstVaapiDisplay object. This is useful for fast lookups to the
underlying native display, e.g. for creating an EGL display.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
2fb20e9906 display: use a recursive mutex for the display cache.
Use a recursive mutex for the display cache so that a 3rdparty display
object could be initialized during the initialization of the parent
display.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
93418ed5ee texture: add generic helper to create textures.
Add new generic helper functions gst_vaapi_texture_new_wrapped()
and gst_vaapi_texture_new() to create a texture without having
the caller to uselessly check for the display type himself. i.e.
internally, there is now a GstVaapiDisplayClass hook to create
textures, and the actual backend implementation fills it in.

This is a simplification in view to supporting EGL.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
2101685b7d texture: move to core libgstvaapi base library.
GstVaapiTexture is a generic abstraction that could be moved to the
core libgstvaapi library. While doing this, no extra dependency needs
to be added. This means that a GstVaapitextureClass is now available
for any specific code that needs to be added, e.g. creation of the
underlying GL texture objects, or backend dependent ways to upload
a surface to the texture object.

Generic OpenGL data types (GLuint, GLenum) are also replaced with a
plain guint.

https://bugzilla.gnome.org/show_bug.cgi?id=736715
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
1799b362a3 texture: drop support for VA/GLX interfaces.
The VA/GLX interfaces are obsolete. They used to exist for XvBA, and
ease of use, but they had other caveats to deal with. It's now better
to move on to legacy mode, whereby VA/GLX interop is two be provided
through (i) X11 Pixmap, and (ii) other modern means of buffer sharing.

https://bugzilla.gnome.org/show_bug.cgi?id=736711
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
0a108653f2 texture: add support for cropping rectangle during transfer.
The gst_vaapi_texture_put_surface() function is missing a crop_rect
argument that would be used during transfer for cropping the source
surface to the desired dimensions.

Note: from a user point-of-view, he should create the GstVaapiTexture
object with the cropped size. That's the default behaviour in software
decoding pipelines that we need to cope with.

This is an API/ABI change, and SONAME version needs to be bumped.

https://bugzilla.gnome.org/show_bug.cgi?id=736712
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
48fabae3ec texture: re-indent all GstVaapiTexture related source code. 2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
4ebfba0d49 surface: add more fine-grained allocation helper.
Add new gst_vaapi_surface_new_full() helper function that allocates
VA surface from a GstVideoInfo template in argument. Additional flags
may include ways to
- allocate linear storage (GST_VAAPI_SURFACE_ALLOC_FLAG_LINEAR_STORAGE) ;
- allocate with fixed strides (GST_VAPI_SURFACE_ALLOC_FLAG_FIXED_STRIDES) ;
- allocate with fixed offsets (GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_OFFSETS).
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
334dd704b6 surface: re-indent all GstVaapiSurface related source code. 2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
568a62ae1e surfaceproxy: add helper to create a wrapped surface object.
Add new gst_vaapi_surface_proxy_new() helper to wrap a surface into
a proxy. The main use case for that is to convey additional information
at the proxy level that would not be suitable to the plain surface.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
1810a41c68 surfaceproxy: re-indent all GstVaapiSurfaceProxy related source code. 2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
f270838515 libs: re-introduce a GST_VAAPI_ID_INVALID value.
Re-introduce a GST_VAAPI_ID_INVALID value that represents
a non-zero and invalid id. This is useful to have a value
that is still invalid for cases where zero could actually
be a valid value.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
fd775b4400 libs: expose GstVaapiMiniObject APIs to all backends.
Make it possible to have all libgstvaapi backends (libs) access to a
common GstVaapiMiniObject API and implementation. This is a minor step
towards full exposure when needed, but restrict it to libgstvaapi at
this time.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
c2afdb4650 libs: re-indent all GstVaapiObject related source code.
Re-indent and provide additional minor cosmetical changes to the
GstVaapiMiniObject and GstVaapiObject source files.
2015-01-27 18:11:44 +01:00
Sreerenj Balachandran
cffe87df89 gstvaapiencoder: Fix the negotiation issue with _ENCODED format handling
Don't error out for the video format GST_VIDEO_FORMAT_ENCODED with in gstvaapiencoder,
since the vaaapi context creation (gstvaapicontext.c) can still use the
default chroma type which is YUV420.

https://bugzilla.gnome.org/show_bug.cgi?id=743567
https://bugzilla.gnome.org/show_bug.cgi?id=743035
2015-01-27 12:38:45 +02:00
Sreerenj Balachandran
8bf8f1104d encoder: h264: Fix the period between I/P frames
If the key-frame period is set as one, then ip_period shuld be zero

https://bugzilla.gnome.org/show_bug.cgi?id=734992
2014-11-27 12:11:03 +02:00
Sreerenj Balachandran
7e4e6fc019 encoder: h264: Provide intra_idr_period value for VAEncSequenceParameterBufferH264
https://bugzilla.gnome.org/show_bug.cgi?id=734993
2014-11-27 11:21:03 +02:00
Gwenole Beauchesne
88b481e530 encoder: h264: fix pixel-aspect-ratio in encoded stream.
Really 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.
really make sure VUI parameter aspect_ratio_info_present_flag is set
to TRUE and that the indication from aspect_ratio_idc is Extended_SAR.

This is a leftover from git commit a12662f.

https://bugzilla.gnome.org/show_bug.cgi?id=740360
2014-11-27 11:13:20 +02:00
Gwenole Beauchesne
0508e13ddf decoder: mpeg4: fix uninitialized variables.
Fix gst_vaapi_decoder_mpeg4_parse() to initialize the packet type to
GST_MPEG4_USER_DATA so that a parse error would result in skipping
that packet. Also fix gst_vaapi_decoder_mpeg4_decode_codec_data() to
initialize status to GST_VAAPI_DECODER_STATUS_SUCCESS.
2014-11-25 11:46:12 +01:00
Gwenole Beauchesne
669e33418e encoder: h264: fix profile limits.
Fix ensure_profile_limits() to lower profile to the desired limits,
only if the latter are actually known and the profile needed to be
changed to fit.
2014-11-25 11:41:49 +01:00
Gwenole Beauchesne
d1b7dc21f8 vaapidecode: only expose supported profiles when needed.
JPEG and VP8 codecs do not really support the concept of "profile". So,
don't try to expose any set that wouldn't be supported by jpegparse, or
ivfparse for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=739713
https://bugzilla.gnome.org/show_bug.cgi?id=739714
2014-11-14 15:26:07 +01:00
Gwenole Beauchesne
8f71f74c5d decoder: h264: add initial support for repeat-first-field (RFF) flag.
Use the SEI pic_timing() message to track and propagate down the repeat
first field (RFF) flag. This is only initial support as there is one
other condition that could induce the RFF flag, which is not handled
yet.
2014-11-14 10:11:41 +01:00
Gwenole Beauchesne
a4048a9d6b decoder: h264: fix picture ordering count type 0 with previous MMCO5.
Fix the decoding process for picture order count type 0 when the previous
picture had a memory_management_control_operation = 5. In particular, fix
the actual variable type for prev_pic_structure to hold the full bits of
the picture structure.

In practice, this used to work though, due to the underlying type used to
express a gboolean.
2014-11-14 10:11:41 +01:00
Gwenole Beauchesne
415d5df7ee decoder: h264: fix detection of top-field-first (TFF) flag.
Use the SEI pic_timing() message to track the pic_struct variable when
present, or infer it from the regular slice header flags field_pic_flag
and bottom_field_flag. This fixes temporal sequence ordering when the
output pictures are to be displayed.

https://bugzilla.gnome.org/show_bug.cgi?id=739291
2014-11-14 10:11:41 +01:00
Gwenole Beauchesne
3656659d1c filter: add initial support for high quality scaling.
Add support for video scaling options in VPP pipelines. Only the
DEFAULT mode is bound to exist. Others might be folded into that
mode.
2014-10-29 17:33:48 +01:00
Gwenole Beauchesne
c537648c5b filter: re-indent all GstVaapiFilter related source code. 2014-10-29 16:35:46 +01:00
Gwenole Beauchesne
541f721fab display: add support for DRM Render-Nodes.
Add support for DRM Render-Nodes. This is a new feature that appeared
in kernel 3.12 for experimentation purposes, but was later declared
stable enough in kernel 3.15 for getting enabled by default.

This allows headless usages without authentication at all, i.e. usages
through plain ssh connections is possible.
2014-09-24 13:49:32 +02:00
Gwenole Beauchesne
97d7f21575 surfaceproxy: fix copy to propagate view_id.
Fix gst_vaapi_surface_proxy_copy() to copy the view-id element, thus
fixing random frames skipped when vaapipostproc element is used in
passthrough mode. In that mode, GstMemory is copied, thus including
the underlying GstVaapiVideoMeta and associated GstVaapiSurfaceProxy.
2014-08-22 15:54:31 +02:00
Gwenole Beauchesne
7ac501d026 build: fix with --no-undefined linker flags.
https://bugzilla.gnome.org/show_bug.cgi?id=729352
2014-08-01 11:05:01 +02:00
Gwenole Beauchesne
b8040b35c1 window: make gst_vaapi_window_reconfigure() thread-safe.
Ensure the X11 implementation for GstVaapiWindow::get_geometry() is
thread-safe by default, so that upper layer users don't need to handle
that explicitly.
2014-07-25 17:36:12 +02:00
Holger Kaelberer
08dc3036f4 window: allow for updating size from current geometry.
Add gst_vaapi_window_reconfigure() interface to force an update of
the GstVaapiWindow "soft" size, based on the current geometry of the
underlying native window.

This can be useful for instance to synchronize the window size when
the user changed it.

Thanks to Fabrice Bellet for rebasing the patch.

[changed interface to gst_vaapi_window_reconfigure()]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-25 17:36:12 +02:00
Gwenole Beauchesne
3490212988 window: re-indent all GstVaapiWindow related source code. 2014-07-25 17:36:12 +02:00
Gwenole Beauchesne
7c2c4c7a97 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.
2014-07-25 17:35:56 +02:00
Gwenole Beauchesne
39ab75becd 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.
2014-07-25 17:35:53 +02:00
Fabrice Bellet
00ca734ebf 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
2014-07-21 10:17:00 +02:00
Jan Schmidt
22dc8c4251 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
2014-07-04 07:38:50 +02:00
Sreerenj Balachandran
99bf1b1f98 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>
2014-07-03 23:50:11 +02:00
Sreerenj Balachandran
502952d080 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>
2014-07-03 23:38:25 +02:00
Gwenole Beauchesne
b5f1bdd59a 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.
2014-07-03 14:56:26 +02:00
Gwenole Beauchesne
a3e49d6d13 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.
2014-07-03 14:56:23 +02:00
Gwenole Beauchesne
cba9b97300 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).
2014-07-01 17:18:08 +02:00
Gwenole Beauchesne
702de9ad2f decoder: propagate MVC metadata ("view-id", head of multiview set).
Add new GstVaapiSurfaceProxy flag FFB, which means "first frame in
bundle", and really expresses the first view component of a multi
view coded frame. e.g. in H.264 MVC, the surface proxy has flag FFB
set if VOIdx = 0.

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

Anyway, the general process is to output decoded frames only when
they are complete. By complete, we mean a full frame was decoded or
both fields of a frame were decoded.
2014-06-30 19:13:25 +02:00
Gwenole Beauchesne
8bdef56cd4 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.
2014-06-30 19:13:25 +02:00
Gwenole Beauchesne
f48b1e0cd6 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
2014-06-30 19:13:25 +02:00
Gwenole Beauchesne
a208a80c29 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.
2014-06-30 11:51:59 +02:00
Gwenole Beauchesne
8ed129b8bd 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.
2014-06-30 11:51:57 +02:00
Gwenole Beauchesne
850d3d6a4d 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.
2014-06-28 07:41:00 +02:00
Gwenole Beauchesne
9169c520cb 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.
2014-06-27 20:44:24 +02:00
Sreerenj Balachandran
95d7f95971 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>
2014-06-27 20:26:21 +02:00
Gwenole Beauchesne
0d971bce26 encoder: h264: track encoder config changes.
Track and report when encoder configuration changed. For now, this covers
resolution, profile/level and bitrate changes.
2014-06-27 20:26:18 +02:00
Gwenole Beauchesne
a12662fd3e 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.
2014-06-27 13:15:13 +02:00
Sreerenj Balachandran
a4bd8450f7 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.
2014-06-27 11:51:32 +02:00
Sreerenj Balachandran
8ebf60124a 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).
2014-06-27 11:48:40 +02:00
Sreerenj Balachandran
619a79943a encoder: h264: add cpbBrNalFactor values for MVC profiles. 2014-06-27 11:48:36 +02:00
Sreerenj Balachandran
173f32d8e5 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
2014-06-26 11:08:32 +02:00
Sreerenj Balachandran
a7c27bb7d5 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
2014-06-26 11:00:47 +02:00
Gwenole Beauchesne
bea0d07042 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
2014-06-25 22:38:35 +02:00
Gwenole Beauchesne
8db72147c7 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.
2014-06-19 17:08:47 +02:00
Sreerenj Balachandran
cb9f98f0d5 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>
2014-06-19 15:29:12 +02:00
Gwenole Beauchesne
95c781c34f 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.
2014-06-19 15:13:04 +02:00
Sreerenj Balachandran
781abad2c7 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.
2014-06-17 16:05:11 +02:00
Sreerenj Balachandran
786b68ac21 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>
2014-06-17 16:03:33 +02:00
Gwenole Beauchesne
799d7b7d0e 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().
2014-06-13 11:36:56 +02:00
Gwenole Beauchesne
c65aec1aa6 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.
2014-06-10 18:33:59 +02:00
Gwenole Beauchesne
63fde28dfd decoder: h264: clean-ups.
Fix GST_VAAPI_PICTURE_IS_{INTER_VIEW,ANCHOR}() definitions to use
the base GST_VAAPI_PICTURE_FLAG_IS_SET() macro.
2014-06-10 18:33:59 +02:00
Gwenole Beauchesne
428b038dba 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.
2014-06-10 18:33:59 +02:00
Gwenole Beauchesne
42ab3e0669 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.
2014-06-10 18:33:59 +02:00
Gwenole Beauchesne
e8fe78824b 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.
2014-06-06 17:58:50 +02:00
Gwenole Beauchesne
60af04901f 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.
2014-06-06 17:34:02 +02:00
Gwenole Beauchesne
e670e36007 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.
2014-06-04 19:10:44 +02:00
Gwenole Beauchesne
f36486a1e2 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.
2014-06-04 19:08:18 +02:00
Gwenole Beauchesne
885ebf4c72 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.
2014-06-03 14:30:39 +02:00
Sreerenj Balachandran
e1976df1a1 encoder: h264: remove unnecessary calcualtion of max_pic_order_cnt.
https://bugzilla.gnome.org/show_bug.cgi?id=727418
2014-06-03 13:53:46 +02:00
Sreerenj Balachandran
6df5c74081 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
2014-06-03 13:53:43 +02:00
Sreerenj Balachandran
dba440b164 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.
2014-06-02 18:25:13 +02:00
Sreerenj Balachandran
0de9fd6347 encoder: h264: add support for packed slice headers.
https://bugzilla.gnome.org/show_bug.cgi?id=722905
2014-06-02 18:25:13 +02:00
Sreerenj Balachandran
73355a680f encoder: h264: store subset sps to generate the codec-data
Store the SubsetSPS nal unit which we need for MVC specific
codec_data generation.
2014-06-02 18:25:13 +02:00
Sreerenj Balachandran
f0924ba0d1 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.
2014-06-02 18:25:13 +02:00
Li Xiaowei
7bdf3fa177 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>
2014-06-02 18:25:13 +02:00
Li Xiaowei
5323570a35 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>
2014-06-02 18:25:13 +02:00
Li Xiaowei
4beee390e5 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>
2014-06-02 18:25:13 +02:00
Li Xiaowei
fb7ecb15e2 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>
2014-06-02 18:25:12 +02:00
Gwenole Beauchesne
800bfc1add 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.
2014-06-02 18:25:12 +02:00
Gwenole Beauchesne
f0d3d9cd3c 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.
2014-05-22 10:13:34 +02:00
Gwenole Beauchesne
abcc8bb7a2 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.
2014-05-21 20:04:35 +02:00
Gwenole Beauchesne
5d76afb40d 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.
2014-05-21 20:04:35 +02:00
Gwenole Beauchesne
8c5e89c298 decoder: h264: add initial support for MVC.
https://bugzilla.gnome.org/show_bug.cgi?id=721772
2014-05-21 20:04:34 +02:00
Gwenole Beauchesne
42b112f8bd decoder: h264: dynamically allocate the DPB.
Dynamically allocate the Decoded Picture Buffer (DPB) and add provisions
for supporting the MVC allocation requirements.
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
ae1d8267d9 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.
2014-05-21 19:59:52 +02:00
Sreerenj Balachandran
a6215a0757 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>
2014-05-21 19:59:52 +02:00
Sreerenj Balachandran
e4166f5a91 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>
2014-05-21 19:59:52 +02:00
Xiaowei Li
79118904a0 decoder: h264: add support for MVC base views.
Allow decoding for base views of MVC encoded streams. For now, just skip
the slice extension and prefix NAL units, and skip non-base view frames.

Signed-off-by: Xiaowei Li <xiaowei.a.li@intel.com>
[fixed memory leak, improved check for MVC NAL units]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
1c46990ecd decoder: h264: simplify storage of decoded picture into DPB.
Factor out process by which the decoded picture with the lowest POC
is found, and possibly output. Likewise, the storage and marking of
a reference decoded, or non-reference decoded picture, into the DPB
could also be simplified as they mostly share the same operations.
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
a571350dee decoder: h264: minor clean-ups.
Make init_picture_ref_lists() more consistent with other functions
related to the reference marking process by supplying the current
picture as argument.
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
c0993182bd display: add utility function to query VA driver name.
Add gst_vaapi_display_get_vendor_string() helper function to query
the underlying VA driver name. The display object owns the resulting
string, so it shall not be deallocated.

That function is thread-safe. It could be used for debugging purposes,
for instance.
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
71053228b3 display: make cache maintenance really MT-safe.
Make sure to initialize one GstVaapiDisplay at a time, even in threaded
environments. This makes sure the display cache is also consistent
during the whole display creation process. In the former implementation,
there were risks that display cache got updated in another thread.
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
446aa9acf8 context: allow dynamic growth of VA surfaces pool.
Add support for dynamic growth of the VA surfaces pool. For decoding,
this implies the recreation of the underlying VA context, as per the
requirement from VA-API. Besides, only increases are supported, not
shrinks.
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
906a561c26 context: reset VA context if VA surfaces set changed.
It is a requirement from VA-API specification that the VA context got
from vaCreateContext(), for decoding purposes, binds the supplied set
of VA surfaces. This means that if the set of VA surfaces is to be
changed for the current decode session, then the VA context needs to
be recreated with the new set of VA surfaces.
2014-05-21 19:59:52 +02:00
Gwenole Beauchesne
c12d80eb88 decoder: h264: fix assignment of LongTermFrameIdx.
Complement fix committed as e95a42e.

The H.264 AVC standard has to say: if the field is part of a reference
frame or a complementary reference field pair, and the other field of
the same reference frame or complementary reference field pair is also
marked as "used for long-term reference", the reference frame or
complementary reference field pair is also marked as "used for long-term
reference" and assigned LongTermFrameIdx equal to long_term_frame_idx.

This fixes decoding of MR9_BT_B in strict mode.

https://bugs.freedesktop.org/show_bug.cgi?id=64624
https://bugzilla.gnome.org/show_bug.cgi?id=724518
2014-05-12 19:29:37 +02:00
Gwenole Beauchesne
85a60441fa decoder: h264: properly support grayscale formats.
Request the correct chroma format for decoding grayscale streams.
i.e. make lookups of the VA chroma format more generic, thus possibly
supporting more formats in the future.

This means that, if a VA driver doesn't support grayscale formats,
it is now going to fail. We cannot safely assume that maybe grayscale
was implemented on top of some YUV 4:2:0 with the chroma components
all set to 0x80.
2014-05-10 06:29:25 +02:00
Simon Farnsworth
c4cd8e2b36 build: fix source file modes.
A few source files are marked executable in error - fix them

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
2014-05-09 14:41:57 +02:00
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
Gwenole Beauchesne
8d16aa87b2 build: fix make dist for codecparsers. 2014-05-01 11:23:20 +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
de02a5c190 build: fix make dist with certain conditionals not met.
Fix generation of source tarballs when certain conditionals are not
met. e.g. always include all buildable codecparsers sources in the
distribution tarball, fix plug-in element sources set to include X11
and encoder bits.
2014-04-21 18:02:21 +02:00
Gwenole Beauchesne
de6a980065 vp8: allow compilation without the built-in libvpx.
The built-in libvpx serves multiple purposes, among which the most
important ones could be: track the most up-to-date, and optimized,
range decoder; allow for future hybrid implementations (non-VLD);
and have a completely independent range decoder implementation.
2014-04-21 17:53:06 +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
1ceef7d5b9 vp8: fix compilation with built-in libvpx.
Apply correct patch from fd.o #722760 to fix several issues: update the
license terms to LGPLv2.1+, fix dependencies to built-in libvpx and fix
make dist.
2014-04-19 10:17:01 +02:00
Gwenole Beauchesne
b36eade7f3 vp8: use range decoder from libvpx.
Add libvpx submodule that tracks the upstream version 1.3.0. This is
needed to build a libgstcodecparsers_vpx.so library with all symbols
placed into the GSTREAMER namespace.
2014-04-18 20:37:25 +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
100f56eedf codecparsers: update to gst-vaapi-branch commit 8fadf40.
8fadf40 h264: Fix multiple SEI messages in one SEI RBSP parsing.
644825f h265: remove trailling 0x00 bytes as the spec doesn't allow them
95f9f0f h264: remove trailling 0x00 bytes as the spec doesn't allow them
766007b h265: Initialize pointer correctly that is never assigned but freed in error cases
8ec5816 h265: Fix segfault when parsing HRD parameter
5b1730f h265: Fix segfault when parsing VPS
983b7f7 h265: prevent to overrun chroma_weight_l0_flag
7ba641d h265: Fix debug output
d9f9f9b h264: not all startcodes should have 3-byte 0 prefix
2014-04-18 19:25:02 +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