Commit graph

1060 commits

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