Commit graph

46 commits

Author SHA1 Message Date
Haihao Xiang 04de66ee7b gstmsdkvpp: add RGBP and BGRP in src pad
It requires MFX version 2.4+

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2234>
2021-07-05 03:47:05 +00:00
Haihao Xiang cd3a3534c4 msdk: use a new method to create mfx session when using oneVPL dispatcher
In oneVPL, MFXLoad() and MFXCreateSession() are required to create a
workable mfx session[1]

[1] https://spec.oneapi.com/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html#onevpl-dispatcher

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1503>
2021-05-17 01:58:24 +00:00
Haihao Xiang 967c835ea6 msdk: don't load user plugins for MFX version 2.0+
MFX version 2.0+ no longer supports user plugins, please refer to the
links for details

https://spec.oneapi.com/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
https://github.com/oneapi-src/oneVPL

This is in preparation for oneVPL support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1503>
2021-05-17 01:58:24 +00:00
Haihao Xiang 73cd763b01 msdk: exclude the audio code for MFX version 2.0+
MFX version 2.0+ no longer supports audio functions, please refer to the
links below for details

https://spec.oneapi.com/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
https://github.com/oneapi-src/oneVPL

This is in preparation for oneVPL support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1503>
2021-05-17 01:58:24 +00:00
Haihao Xiang 86fdd39147 msdk: check GstMsdkContext instead of mfxSession instance
When creating a GstMsdkContext instance, it also creates a mfxSession
instance, so we may check GstMsdkContext instead of mfxSession instance
to make sure MSDK is available. In addition, according to MSDK doc [1],
MFXVideoCORE_SetHandle function should be executed before any actual
usage of library including queries, otherwise the behavior is
unexpected, so we should call MFXVideoCORE_QueryPlatform after
MFXVideoCORE_SetHandle on Linux

[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#working-with-va-api-applications

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1867>
2020-12-24 02:53:13 +00:00
Haihao Xiang 9443bf7a22 msdk: enable GPUCopy
Note it works for system memory only

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/910>
2020-09-20 01:40:08 +00:00
Haihao Xiang 1d082baf18 msdk: call MFXInitEx instead of MFXInit
MFXInitEx has more control than MFXInit. The current setting in this
commit is identical to MFXInit

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/910>
2020-09-20 01:40:08 +00:00
Haihao Xiang e769df9689 msdk: map Y412_LE to MFX_FOURCC_Y416
MFX_FOURCC_Y416 is used for packed 12 bits 4:4:4:4 YUV format in
MediaSDK
2020-04-03 01:19:45 +00:00
Haihao Xiang fb200ccfdd msdk: map Y212_LE to MFX_FOURCC_Y216
MFX_FOURCC_Y216 is used for packed 12 bits 422 YUV format in MediaSDK
2020-04-03 01:19:45 +00:00
Haihao Xiang fbd1d0cecb msdk: add a helper function to get codename of the platform
The features supported in MSDK vary from platform to platform. We may
support some features based on the codename of the platform in future.
2020-03-31 09:27:03 +08:00
Haihao Xiang 4d31299c12 msdk: map P012_LE to MFX_FOURCC_P016
MFX_FOURCC_P016 is used for semi planar 12 bits YUV format in MediaSDK
2020-03-23 06:31:29 +00:00
Haihao Xiang b18be3562c msdk: ignore MFX_ERR_UNDEFINED_BEHAVIOR when loading a plugin
An issue can be seen when using msdkh265enc with bitrate change in
playing state. The root cause is the corresponding plugin is loaded
again.

Returning MFX_ERR_UNDEFINED_BEHAVIOR from MSDK just means the plugin has
been loaded, so we may ignore this error when doing configuation again
in the sub class, otherwise the pipeline will be interrupted
2019-12-10 17:23:53 +00:00
Seungha Yang 00cb881431 msdk: Fix mixed declarations warning
msdk.c:194:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
2019-11-27 12:25:40 +09:00
Aaron Boxer 348494fd34 msdk: query hardware when checking MFX availability
msdk plugin is not used for sofware encode/decode as there are better
solutions available. Also, with MFX_IMPL_AUTO_ANY, if software decode
is not supported, the plugin will still load, but will then fail when trying to
run the (autoplugged) pipeline. With MFX_IMPL_HARDWARE_ANY,
the plugin fails and a better software decoder is auto-plugged.
2019-11-22 05:18:42 +00:00
Aaron Boxer 2f1256ada7 msdk: query platform when opening session 2019-11-22 05:18:42 +00:00
Aaron Boxer 6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Haihao Xiang 8daac1c09a msdk: adjust the stride align
GstAllocationParams::align is set to 31 in msdkdec/msdken/msdkvpp, hence
the stride align should be greater than or equal to 31, otherwise it
will result in issue
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/861
(msdk: "GStreamer-CRITICAL: gst_buffer_resize_range failed" SPAM),

In addition, the stride should match the pitch alignment in the media driver,
otherwise it will result in some issues when a buffer is shared between
different elements, e.g. the NV12 issue mentioned in commit 3f2314a, which
can be reproduced by `gst-launch-1.0 vidoetestsrc ! msdkvpp !
video/x-raw\(memory:DMABuf\),format=NV12 ! glimagesink`

Fixed https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/861
2019-09-21 16:59:10 +00:00
Haihao Xiang d5fd9bc22b msdkvpp: support video-direction property
video-direction property is common property in gstreamer. In addition,
both mirroring & rotation properties are marked as deprecated,
video-direction will override mirroring & rotation properties when they
are set explicitly

Fix https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1058
2019-08-26 16:39:39 +00:00
Haihao Xiang ef81c9d6c4 msdkdec: Update frame info from video parameters
A 10bit stream may have different depth values for Luma and Chroma, and
MSDK requires the frame info must match the corresponding video
parameters
2019-08-06 09:20:21 +00:00
Haihao Xiang 20f61db2e5 msdkdec: make sure mfx frame width/height meets MSDK's requirement
It is possible that the output region size (e.g. 192x144) is different
from the coded picture size (e.g. 192x256). We may adjust the alignment
parameters so that the padding is respected in GstVideoInfo and use
GstVideoInfo to calculate mfx frame width and height

This fixes the error below when decoding a stream which has different
output region size and coded picture size

0:00:00.057726900 28634 0x55df6c3220a0 ERROR                msdkdec
gstmsdkdec.c:1065:gst_msdkdec_handle_frame:<msdkh265dec0>
DecodeFrameAsync failed (failed to allocate memory)

Sample pipeline:

gst-launch-1.0 filesrc location=output.h265 ! h265parse ! msdkh265dec !
glimagesink
2019-07-24 08:41:13 +08:00
Haihao Xiang ba24af0490 msdk: set right BitDepth and Shift for Y410 mfx frame
BitDepth is 10 and Shitf must be set to 0 when creating Y410 mfx
frame in MSDK
2019-06-29 17:33:57 +02:00
Haihao Xiang 9b43a5621f msdk: map GST_VIDEO_FORMAT_Y410 to MFX_FOURCC_Y410 2019-06-29 17:33:57 +02:00
Haihao Xiang a3f8faa682 msdk: set right BitDepth and Shift for Y210 mfx frame
BitDepth is 10 and Shitf must be set to 1 when creating Y210 mfx
frame in MSDK
2019-06-29 14:15:32 +00:00
Haihao Xiang 24da8ec47b msdk: map GST_VIDEO_FORMAT_Y210 to MFX_FOURCC_Y210 2019-06-29 14:15:32 +00:00
Haihao Xiang 53fd4a1564 msdk: map GST_VIDEO_FORMAT_BGR10A2_LE to MFX_FOURCC_A2RGB10 2019-04-09 14:26:02 +00:00
Haihao Xiang f7863cc741 msdk: map GST_VIDEO_FORMAT_VUYA to MFX_FOURCC_AYUV 2019-03-25 09:50:33 +00:00
Seungha Yang 1d17e3891d mskd: Don't use MFX_FOURCC_RGB565 if it's undefined
../subprojects/gst-plugins-bad/sys/msdk/msdk.c(61): error C2065: 'MFX_FOURCC_RGB565'

The minimum required version for the format seems to MFX_VERSION >= 1028
2019-03-01 07:03:01 +00:00
Haihao Xiang 197f7f569b msdk: map GST_VIDEO_FORMAT_RGB16 to MFX_FOURCC_RGB565 2019-02-27 15:22:43 +00:00
Haihao Xiang 43e5eaeda1 msdk: assign the returned value to status variable
Othervise the subsequent check will use the stale value of status
variable
2018-12-12 17:24:00 +00:00
Xiang, Haihao 2b0923842a msdk: set right BitDepth and Shift for P010 mfx frame
BitDepth is 10 and Shitf must be set to 1 when creating P010 mfx
frame in MSDK
2018-11-26 16:47:17 +00:00
Xiang, Haihao fda4918cc8 msdk: don't use hard-coded video format
Some codecs may support varied formats, e.g. HEVC may support NV12
and P010_10LE etc
2018-11-26 16:47:17 +00:00
Haihao Xiang 54451b7303 msdk: map GST_VIDEO_FORMAT_P010_10LE to MFX_FOURCC_P010 2018-11-26 16:47:17 +00:00
Sreerenj Balachandran 84c33be0c0 msdk: Set 16 bit alignment for width
According to MediaSDK specification,
Width must be a multiple of 16 and Height must be a multiple
of 16 for progressive frame sequence and a multiple of 32 otherwise.

This patch sets a 16 bit alignment for width and 32 bit alignment
for height as default.

https://bugzilla.gnome.org/show_bug.cgi?id=796566
2018-07-02 16:50:46 -08:00
Sreerenj Balachandran 96c6a04d7a msdk: Add more video format mapping
BGRx format can be supported with Msdk's RGB4
2018-04-25 12:33:08 -08:00
U. Artie Eoff 275d754156 msdk: fix plugin load on implementations with only HW support
We can't assume that MSDK always supports SW implementation
on all platforms.  Thus, msdk_is_available should check for
ANY implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=794991
2018-04-04 17:31:14 -08:00
Sreerenj Balachandran f5a3d3d799 msdk: vpp: Add deinterlacing support
https://bugzilla.gnome.org/show_bug.cgi?id=793705
2018-04-03 10:38:52 -08:00
Hyunjun Ko ea92da6e54 msdk: dmabuf support
This patch includes:
1\ Implements MsdkDmaBufAllocator and allocation of msdk dmabuf memroy.
2\ Each msdk dmabuf memory include its own msdk surface kept by GQuark.
3\ Adds new option GST_BUFFER_POOL_OPTION_MSDK_USE_DMABUF

https://bugzilla.gnome.org/show_bug.cgi?id=793707
2018-03-30 11:06:05 -08:00
Hyunjun Ko 6547b638c5 msdk: adds new debug category
https://bugzilla.gnome.org/show_bug.cgi?id=794276
2018-03-13 14:20:50 -08:00
Hyunjun Ko 14f0186741 msdk: remove unused code
There's unused code remaining since MSDK bufferpool patches landed.

https://bugzilla.gnome.org/show_bug.cgi?id=793741
2018-02-23 14:30:56 -09:00
Hyunjun Ko 580a52ec49 msdkenc: use bufferpool
1\ Proposes msdk bufferpool to upstream.
  - If upstream has accepted the proposed msdk bufferpool,
    encoder can get msdk surface from the buffer directly.
  - If not, encoder get msdk surface its own msdk bufferpool
    and copy from upstream's frame to the surface.

2\ Replace arrays of surfaces with msdk bufferpool.

3\ In case of using VPP, there should be another msdk bufferpool
   with NV12 info so that it could convert first and encode.

Calls gst_msdk_set_frame_allocator and uses video memory only on linux.
and uses system memory on Windows until d3d allocator is implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:48:32 -09:00
Hyunjun Ko b45147a6d4 msdk: adds new utility functions for conversion from gstreamer to libmfx
https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:37:47 -09:00
Hyunjun Ko 8f0450dad4 msdk: move and rename the function msdk_video_alignment
Move the msdk_video_alignment function from decoder
to msdk.c and rename so that others could call this function
without duplicated declaration.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:36:46 -09:00
Hyunjun Ko 3c611da315 msdkenc: Fix handling of YUY2, UYVY, BGRA surfaces
https://bugzilla.gnome.org/show_bug.cgi?id=789847
2017-11-20 14:38:34 +02:00
Sebastian Dröge d3eeb98f0c msdkenc: Add support for YV12, YUY2, UYVY and BGRA
By doing conversion with VPP to NV12 before the actual encoding.

https://bugzilla.gnome.org/show_bug.cgi?id=789847
2017-11-20 14:38:25 +02:00
Sebastian Dröge 5c99f9cf37 gst: Don't declare variables inside the for loop header
This is a C99 feature.
2016-12-13 22:39:01 +02:00
Scott D Phillips 71df82db63 msdk: Initial windows build support
https://bugzilla.gnome.org/show_bug.cgi?id=770990
2016-11-14 15:17:41 +01:00