Commit graph

1163 commits

Author SHA1 Message Date
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