Commit graph

86 commits

Author SHA1 Message Date
Matthew Waters 41aeadc36e glcolorconvert: add RGB to NV12/NV21 conversion 2017-12-09 19:32:06 +00:00
Lubosz Sarnecki 26e6be8fad glcolorconvert: Apply GstVideoOverlayCompositionMeta buffer to converted buffer
Since glcolorconvert creates a new GstBuffer,
without the GstVideoOverlayCompositionMeta data,
it needs to be copied to not be dropped.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki dc47e6d3c0 glimagesinkbin: Add GstVideoOverlayCompositionMeta caps features
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Julien Isorce 9b1eb32c49 gl: initialize output params to 0 before calling gl functions
The client side API of the Chromium's GPU Process has asserts
in debug mode that check that output params are initialized to 0.
2017-12-09 19:32:05 +00:00
Jan Schmidt 8a1fc4ab4e gl: Add support for multiple views in upload, colour convert and download
Support multiple attached views on input/output buffers
by processing each one, not just the first.
2017-12-09 19:32:04 +00:00
Matthew Waters 1e9f7b6303 gl: consolidate internal_rgba_format into glmemory
Expose some useful value format conversion functions available in
GstGLMemory.
2017-12-09 19:32:03 +00:00
Jan Schmidt 0f6b04c91d gl: Don't leak temp strings in _RGB_pixel_order()
Fix a memory leak of temporary strings when computing
swizzling of RGB formats.
2017-12-09 19:32:03 +00:00
Julien Isorce fce0e0ba3c gl: add and use gst_gl_internal_format_rgba
Previously when compiling GstGL with both GL and GLES2,
GL_RGBA8 was picked from GL/gl.h. But a clash may happen at
runtime when one is selecting GLES2.

gst_gl_internal_format_rgba allows to check at runtime
if it should use GL_RGBA or GL_RGBA8.
2017-12-09 19:32:02 +00:00
Xavier Claessens 80fab54c0a gl: fix crash on windows with intel driver
https://bugzilla.gnome.org/show_bug.cgi?id=749430
2017-12-09 19:32:01 +00:00
Matthew Waters 65c57b77ff gl: element buffers are part of vao state
Use them as such.  They are also required for GL3 core profile support
with glDrawElements on OS X.
2017-12-09 19:32:01 +00:00
Sebastian Dröge 51d3a0a059 Revert "gl: readd glupload/download onto element pads"
This reverts commit 87d8270f30.
2017-12-09 19:32:00 +00:00
Jan Schmidt c2450a28f5 glcolorconvert: Improve passthrough check when no conversion is needed.
Make the passthrough check contingent on only the fields we
can modify being unchanged, and pre-compute it when caps
change instead of checking on each buffer. Makes the passthrough
more lenient if consumers are lax about making input and output
caps complete.
2017-12-09 19:32:00 +00:00
Matthew Waters 343947f383 gl: readd glupload/download onto element pads
Allows insertion of gl elements into non-gl pipelines without converter
(upload/download) elements.

https://bugzilla.gnome.org/show_bug.cgi?id=743974
2017-12-09 19:32:00 +00:00
Sebastian Dröge 659477c7c7 glcolorconvert: Fix last commit 2017-12-09 19:31:59 +00:00
Sebastian Dröge 4a8001e683 gl: Remove iOS/EAGL workaround for R/RG textures
This should be unneeded now after https://bugzilla.gnome.org/show_bug.cgi?id=732507
2017-12-09 19:31:58 +00:00
Sebastian Dröge bd2821982f glcolorconvert: Add correct check for RG/R textures in glcolorconvert too
https://bugzilla.gnome.org/show_bug.cgi?id=732507
2017-12-09 19:31:58 +00:00
Matthew Waters 0b5c7e8b49 gl/docs: update some doc comments 2017-12-09 19:31:58 +00:00
Julien Isorce d6e460095f glcolorconvert: cache indices in a buffer object 2017-12-09 19:31:57 +00:00
Matthew Waters 1d4b82d5f8 glcolorconvert: we don't do resizing of the video frames
As we cannot do accurate texel sampling then due to the texture
coordinates being interpolated based on the output frame size.
2017-12-09 19:31:56 +00:00
Sebastian Dröge cb59ace574 gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform
instead of inventing new caps.
2017-12-09 19:31:56 +00:00
Nicolas Dufresne de79830b05 glmemory: Add GstAllocationParams and alignment support
This implements support for GstAllocationParams and memory alignments.
The parameters where simply ignored which could lead to crash on
certain platform when used with libav and no luck.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Edward Hervey f56c4c541a gl: Add/Update more debug statements
Where possible, use the _OBJECT variants in order to track better from
which object the debug statement is coming from

Define (and use) GST_CAT_DEFAULT where applicable

Use GST_PTR_FORMAT where applicable
2017-12-09 19:31:54 +00:00
Matthew Waters ae14797982 glcolorconvert: don't intersect with the input caps
that limits our formats to whatever is in the input caps
2017-12-09 19:31:54 +00:00
Matthew Waters 68dc0fef6d glcolorconvert: put GstGLSyncMeta on output buffers
allows thread safely using the provided output buffer in a separate
thread
2017-12-09 19:31:54 +00:00
Matthew Waters 530ae2cbb0 glupload/download/convert: provide transform_caps functions
Allows finer grain decisions about formats and features at each
stage of the pipeline.
Also provide propose_allocation for glupload besed on the supported
methods.
2017-12-09 19:31:54 +00:00
Sebastian Dröge 78aaa6b1de glcolorconvert: Add FIXME comment about possibility of non-Apple YCbCr422 rectangular textures 2017-12-09 19:31:53 +00:00
Sebastian Dröge 46086ac1fe glcolorconvert: Only use GL_TEXTURE_RECTANGLE with OpenGL
It's not defined for GLES.
2017-12-09 19:31:53 +00:00
Alessandro Decina 9f1cb84523 libgstgl: run a custom shader to convert YUV to RGB on mac and ios
When GL_APPLE_ycbcr_422 is available, run a custom shader to convert
GL_TEXTURE_RECTANGLE textures from YUV to RGB.

See https://www.opengl.org/registry/specs/APPLE/ycbcr_422.txt
2017-12-09 19:31:53 +00:00
Alessandro Decina 966cad27d7 gl: initial support for texture targets other than GL_TEXTURE_2D
Make GstGLMemory hold the texture target (tex_target) the texture it represents
(tex_id) is bound to. Modify gst_gl_memory_wrapped_texture and
gst_gl_download_perform_with_data to take the texture target as an argument.

This change is needed to support wrapping textures created outside libgstgl,
which might be bound to a target other than GL_TEXTURE_2D. For example on OSX
textures coming from VideoToolbox have target GL_TEXTURE_RECTANGLE.

With this change we still keep (and sometimes imply) GL_TEXTURE_2D as the
target of textures created with libgstgl.

API: modify GstGLMemory
API: modify gst_gl_memory_wrapped_texture
API: gst_gl_download_perform_with_data
2017-12-09 19:31:53 +00:00
Alessandro Decina f31ba88835 gstglcolorconvert: micro optimization
Don't call glClear && glClearColor at each draw since we're going to draw the
whole viewport anyway. Gets rid of a glFlush triggered by glClear on OSX.
2017-12-09 19:31:53 +00:00
Alessandro Decina 5c81a68eb1 gstglcolorconvert: relax caps features check
Require caps to have the GST_CAPS_FEATURE_MEMORY_GL_MEMORY feature but allow
them to have more features.
2017-12-09 19:31:53 +00:00
Matthew Waters 1dfeae2c42 gl: split glcolorconvert usage from glupload
the separation allows the transfer operation to occur in a separate
thread/time which may increase performance in specific circumstances.
2017-12-09 19:31:52 +00:00
Nicola Murino ef987be337 glcolorconvert: fix memleak
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2017-12-09 19:31:52 +00:00
Nicolas Dufresne a1e02726ee gl: Add support for GstVideoAlignment
This allow saving a copy with libav video decoders or decoders with
similar padding requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Matthew Waters 6bb113f685 gl: add a sync meta for synchronizing across GL contexts
A context can create a GLsync object that can be waited on in order
to ensure that GL resources created in one context are able to be
used in another shared context without any chance of reading invalid
data.

This meta would be placed on buffers that are known to cross from
one context to another.  The receiving element would then wait
on the sync object to ensure that the data to be used is complete.
2017-12-09 19:31:51 +00:00
Matthew Waters b6fc74c9b8 glcolorconvert: add support for gl3 2017-12-09 19:31:50 +00:00
Matthew Waters 86c084f1af glx: ask for a GL3 core context 2017-12-09 19:31:50 +00:00
Sebastian Dröge a6f02d4b29 glcolorconvert: Unref buffer with the correct function 2017-12-09 19:31:50 +00:00
Wang Xin-yu (王昕宇) 45db2931c8 glcolorconvert: support RGB16/BGR16 video format download
https://bugzilla.gnome.org/show_bug.cgi?id=740801
2017-12-09 19:31:50 +00:00
Luis de Bethencourt eabcf66f2f glcolorconvert: fix comments that confuse gtk-doc
GTK-Doc uses a special syntax for code documentation. A multiline comment that
starts with an additional '*' marks a documentation block that will be processed
by the GTK-Doc tools. So GTK-Doc is confused if a comment block starts with that
additional '*' but isn't meant to be processed. Removing this additional '*'.

https://bugzilla.gnome.org/show_bug.cgi?id=739444
2017-12-09 19:31:49 +00:00
Wang Xin-yu (王昕宇) 77682a51e6 glcolorconvert: support RGB16/BGR16 video format upload
https://bugzilla.gnome.org/show_bug.cgi?id=738842
2017-12-09 19:31:48 +00:00
Matthew Waters 3439402164 glcolorconvert: output why we cannot convert a buffer 2017-12-09 19:31:48 +00:00
Matthew Waters df6967c274 glcolorconvert: fix planar YUV download
- sample the u and v planes properly
- output the correctly scaled u and v planes for different chroma block sizes
2017-12-09 19:31:48 +00:00
Matthew Waters a771b40474 glcolorconvert: fix UYVY download green screen 2017-12-09 19:31:47 +00:00
Matthew Waters ea711807d8 glcolrconvert: fix YUY2 download
- The shader was outputing the wrong values compared with raw
  videotestsrc.
- deal with the texture edge properly.
- properly sample the 2x1 rectangle for the u and v values
- don't double sample the y value
2017-12-09 19:31:47 +00:00
Matthew Waters e6bd70d580 glcolorconvert: convert xRGB into ARGB properly
The alpha channel might not be the last component so check which one
it is in and clobber that one instead.
2017-12-09 19:31:47 +00:00
Matthew Waters c216799b20 glmemory: use GstVideoInfo everywhere
Simplifies a lot of the calling code

https://bugzilla.gnome.org/show_bug.cgi?id=733717
2017-12-09 19:31:45 +00:00
Matthew Waters 2b82b78ef5 glmemory: reenable the texture_rg support for !eagl
The GST_GL_HAVE_PLATFORM_EAGL is always defined we need to compare
against the value instead.
2017-12-09 19:31:44 +00:00
Wang Xin-yu (王昕宇) 2ce11e4bac gl: fix multi gl object leaks
1. fix FBO leaks in decide_allocation
2. fix texture leaks in decide_allocation and reset
3. fix texture leaks in FBO incomplete error path
2017-12-09 19:31:44 +00:00
Sebastian Dröge f6ae4ab243 eagl: Disable usage of R and RG textures on iOS
They don't work currently and just render zeroes, while the
fallback code path with LUM and LUM_ALPHA textures still works.

https://bugzilla.gnome.org/show_bug.cgi?id=732390
2017-12-09 19:31:44 +00:00