Commit graph

75 commits

Author SHA1 Message Date
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
Matthew Waters 216b5ec9a8 glcolorconvert: free pixel swizzling information 2017-12-09 19:31:44 +00:00
Matthew Waters 4a8b31afd6 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2017-12-09 19:31:42 +00:00
Matthew Waters 5009338a50 gl/colorconvert: keep our private pointer
again, avoid to much trigger
2017-12-09 19:31:42 +00:00
Matthew Waters 04b2144ff1 gl/colorconvert: use GstObject's lock instead of our own 2017-12-09 19:31:42 +00:00
Matthew Waters 1544f66f26 gl/colorconvert: remove unnecassary pointer inderection 2017-12-09 19:31:42 +00:00
Matthew Waters 8cf3a3a4f4 gl/colorconvert: optimise the same format case
simply return the input buffer unchanged
2017-12-09 19:31:41 +00:00
Matthew Waters 4fe67d48be gl/colorconvert: fix YUY2/UYVY download for RG/LA textures 2017-12-09 19:31:41 +00:00
Matthew Waters 8ac92cd90d gl/colorconvert: allocate output buffers
Allows the nop optimisation by simply reffing the input buffer.
2017-12-09 19:31:41 +00:00
Tim-Philipp Müller 06351d4d9b glcolorconvert: fix compiler warning
gstglcolorconvert.c:1133:11: error: 'j' may be used uninitialized in this function

Was used uninitialized when jumping to out label
in error case.
2017-12-09 19:31:41 +00:00
Matthew Waters 625efc1757 gl/colorconvert: operate on buffers instead of memories 2017-12-09 19:31:41 +00:00
Nicolas Dufresne 73c73470a0 glcolorconvert: Fix YUY2 and UYVY support with luminance_alpha
https://bugzilla.gnome.org/show_bug.cgi?id=730666
2017-12-09 19:31:41 +00:00