Commit graph

3449 commits

Author SHA1 Message Date
gla c5738c6125 dshowsrcwrapper: fix regression on device selection
Do not take device_name if a device has been specified. Do not take device_index into account if a device or a device name has been specified.
2019-08-23 09:53:59 +00:00
U. Artie Eoff bd3caf0c04 msdk: vpp: rotate output frame
When vpp rotation is 90 or 270, the output frame
should be rotated, too.

Example:
  gst-launch-1.0 -vf videotestsrc \
   ! video/x-raw,width=720,height=480 \
   ! msdkvpp rotation=90 ! vaapisink
2019-08-22 18:17:30 +00:00
Seungha Yang 807e311ae8 nvdec: Always response QUERY_CONTEXT even if openGL is unavailable on the system
nvdec can response for the CUDA context type query regardless of openGL
availability.
2019-08-21 14:14:07 +09:00
Xavier Claessens 83883718ee amc: Print error when failing to register listener 2019-08-20 08:53:55 -04:00
Xavier Claessens 9ab76c73ea amc: Do not use g_log() for criticals 2019-08-20 08:53:55 -04:00
Xavier Claessens 06fc7880bb amc: crop values are not mandatory in format
Android documentation has example code how to compute width and height
when crop values are present.
https://developer.android.com/reference/android/media/MediaCodec#accessing-raw-video-bytebuffers-on-older-devices
2019-08-20 08:53:55 -04:00
Xavier Claessens a604796c41 amc: Remove unused gst_amc_surface_texture_set_default_buffer_size() 2019-08-20 08:53:55 -04:00
Xavier Claessens 50cdaf1036 amc: Fix matrix constness in _get_transform_matrix() 2019-08-20 08:53:55 -04:00
Xavier Claessens ad7c4f5f27 amc: Select between encoder/decoder at GstAmcCodec construct time
Magical 0/1 values where passed to gst_amc_codec_configure() flags
argument. It's more natural to have a boolean is gst_amc_codec_new().
2019-08-20 08:53:55 -04:00
Xavier Claessens 0fe0270244 amc: Remove gst_amc_format_contains_key()
It is not needed, we can just try to get the key and ignore error.
NdkMediaFormat doesn't have that method.
2019-08-20 08:53:55 -04:00
Xavier Claessens 7fcf3ebf07 amc: Turn GstAmcSurfaceTexture into a base class with JNI implementation 2019-08-20 08:53:55 -04:00
Xavier Claessens 29ef89983c amc: Create JNI wrapper for MediaCodecList
There is no NdkMediaCodecList API yet, but it is still better to isolate
JNI code. This will facilitate porting to a native API if Google ever
release one.
2019-08-20 08:53:55 -04:00
Xavier Claessens 515398a9ff amc: Move MediaCodec JNI wrapper into its own module
This will facilitate adding another implementation based on
NdkMediaCodec instead of JNI.
2019-08-20 08:53:55 -04:00
Seungha Yang 4f60117db9 nvdec: Fix possible null object unref
gst_query_get_n_allocation_pools > 0 does not guarantee that
the N th internal array has GstBufferPool object. So users should
check the returned GstBufferPool object from
gst_query_parse_nth_allocation_pool.
2019-08-20 10:14:54 +09:00
Seungha Yang eab564d857 nvcodec: Use default flag for CUDA stream creation
Since nvdec/nvenc engine is running on default stream,
non-default CUDA stream should be synchronized with default
stream eventually.
2019-08-19 07:13:26 +00:00
Seungha Yang ca6657367c nvenc: Use non default CUDA stream and async operation
Use CUDA async operation if possible with non default CUDA stream
2019-08-19 01:18:52 +00:00
Seungha Yang 5615e9258f nvdec: Don't use default CUDA stream
Async CUDA operation with default stream (NULL CUstream) is not much
beneficial than blocking operation since all CUDA operations which belong
to the CUDA context will be synchronized with the default stream's operation.
Note that CUDA stream will share all resources of the corresponding CUDA context
but which can help parallel operation similar to the relation between thread and process
2019-08-19 01:18:52 +00:00
Seungha Yang 20d8f54e63 nvdec: Push/Pop CUDA context around library API call 2019-08-19 01:18:52 +00:00
Seungha Yang f7b2b1b99d nvdec: Fix timestamp mismatch on draining frames
The internal decoding state must be GST_NVDEC_STATE_PARSE before
calling CuvidParseVideoData(). Otherwise, nvdec will be confused
on decode callback as if the frame is decoding only frame and
the input timestamp of corresponding frame will be ignored.
Eventually one decoded frame will have non-increased PTS.
2019-08-18 15:52:32 +09:00
Seungha Yang b64733972e nvdec: Do not access nvdec object from destroy function of qdata
The destroy callback can be called just before the fìnalization of
GstMiniObject. So the nvdec object might be destroyed already.
Instead, store the GstCudaContext with increased ref to safely
unregister the CUDA resource.
2019-08-16 19:40:31 +09:00
Seungha Yang 736df5604f d3dvideosink: Fix crash on WinProc handler
... caused by null pointer dereference. The d3dvideosink object might
not available yet on the handler.
2019-08-15 17:55:29 +09:00
Seungha Yang 58afcf09b4 meson: d3d11: Remove unnecessary dependency
d3d11 never use any API of gstreamer-allocators-1.0
2019-08-15 16:55:51 +09:00
Seungha Yang 5909a495a7 d3d11videosink: Take into account pixel aspect ratio
Fix unexpected cropping with non 1:1 pixel aspect-ratio.

The actual buffer width/height should be passed to gst_d3d11_window_render(),
instead of the calculated resolution. The width/height
values are parameters for copying d3d11 video memory.
Also, aspect-ratio should be considered on resize callback
to decide render rectangle size.
2019-08-15 16:55:37 +09:00
Xavier Claessens 9b9e39be24 amc: Fix crash when a sync_meta survives its sink
_amc_gl_free() could be called after the GstAmcVideoDec has been
finalized, in the case downstream still has a ref to a buffer.
2019-08-14 16:37:19 +00:00
Ignacio Casal Quinteiro 1181436545 wasapi: fix symbol redefinition build error 2019-08-12 07:20:43 +00:00
Seungha Yang e6d21d048a nvenc: Add support YV12 format
YV12 format is supported by Nvidia NVENC without manual conversion.
So nvenc is exposing YV12 format at sinkpad template but there is some
missing point around uploading the memory to GPU.
2019-08-09 11:43:22 +09:00
Seungha Yang 8dbaed0af7 nvh265enc: Enable HDR related SEI nal insertion
If upstream provides the HDR related information, create SEI message
nals and pass them to NVENC.
2019-08-08 23:18:14 +09:00
Fuwei Tang df59db988b msdkdec: fix decoding issue for interlaced streams
Currently h264parser produces a field or a frame for
alignment=au for interlaced streams, but the flag
MFX_BITSTREAM_COMPLETE_FRAME needs a complete frame
or complementary field pair of data, this results in
broken images being output.

Some patches have been sent out to fix h264parser,
but they are pending on some unfinished work. In
order to make gstreamer-msdk decoding work properly
for interlaced streams before h264parser is fixed,
this flag will be removed temporarily and will be
added back once h264parser if fixed.

Related to:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/399
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/228
2019-08-08 07:55:41 +08:00
Seungha Yang f3e12a0b56 nvh265enc: Add support YUV 444 10bits encoding
Note that h264 encoder does not support the YUV 444 10bits format
2019-08-08 00:46:16 +09:00
Seungha Yang fa5e6f546b nvenc: Remove unnecessary constraint from YUV420 10bits capability decision
YUV444 capability shouldn't be applied to YUV420 10 bits format
2019-08-08 00:46:12 +09:00
Sebastian Dröge 99af098a7b decklinkvideosrc: Retrieve mode of the ancillary data from the frame
Instead of using the information we stored ourselves for the video frame
itself. Which was also the wrong one: it was the mode from the property,
not the autodetected one.

This fixes vanc extraction with mode=auto
2019-08-07 10:27:42 +00:00
Sebastian Dröge 2b3a14ff4e decklinkvideosrc: Also set the INTERLACED buffer flag on non-TFF buffers 2019-08-07 10:27:42 +00:00
Aaron Boxer 7dbcddff61 msdkdec: no need to cache output state info 2019-08-07 11:37:28 +03:00
Seungha Yang cc4d0e91e3 nvenc: Fix broken RGB format support
Add missing format check introduced by the commit 7de4dbdeb2
2019-08-07 07:27:36 +00:00
Seungha Yang 9d0545d1a2 nvcodec: Wrap CUDA API return check with gst_cuda_result
The gst_cuda_result macro function is more helpful for debugging
than previous cuda_OK because gst_cuda_result prints the function
and line number. If the CUDA API return was not CUDA_SUCCESS,
gst_cuda_result will print WARNING level debug message with
error name, error text strings.
2019-08-07 00:59:36 +00:00
Seungha Yang d69b590683 nvdec: Port to GstCUDAContext
... and drop CUvideoctxlock usage. The CUvideoctxlock basically
has the identical role of cuda context push/pop but nvdec specific
way. Since we can share the CUDA context among encoders and decoders,
use CUDA context directly for accessing GPU API.
2019-08-07 00:59:36 +00:00
Seungha Yang 5cf0351418 nvenc: Port to GstCudaContext
... and add support CUDA context sharing similar to glcontext sharing.
Multiple CUDA context per GPU is not the best practice. The context
sharing method is very similar to that of glcontext. The difference
is that there can be multiple context object on a pipeline since
the CUDA context is created per GPU id. For example, a pipeline
has nvh264dec (uses GPU #0) and nvh264device0dec (uses GPU #1),
then two CUDA context will propagated to all pipeline.
2019-08-07 00:59:36 +00:00
Seungha Yang 094e4a9f5c nvcodec: Introduce NVIDA CUDA helpers
New object and helper functions can remove duplicated code
from nvenc/nvdec. Also this is prework for CUDA device context sharing
among nvdec(s)/nvenc(s).
2019-08-07 00:59:36 +00:00
Sebastian Dröge ab8bd0aa44 decklinkaudiosrc/decklinkvideosrc: Do nothing in BaseSrc::negotiate() and always set caps in ::create()
We don't support negotiation with downstream but simply set caps based
on the buffers we receive. This prevents renegotiation to other formats,
and negotiation to NTSC in mode=auto in the beginning until the first
buffer is received.

As side-effect of this, also remove various other caps handling code
that was working around the behaviour of the default
BaseSrc::negotiate().
2019-08-06 19:05:38 +00:00
Seungha Yang 7de4dbdeb2 nvenc: Return profile compatible input formats from GstVideoEncoder::getcaps
Do not accept any input formats which could not be supported
by downstream requested codec profiles.
2019-08-06 15:03:22 +00:00
Seungha Yang 9e81f8e700 nvenc: Fix caps negotiation failure on unspecified interlace-mode
During GstVideoInfo conversion from GstCaps, interlace-mode is
inferred to progressive so unspecified interlace-mode should not cause any
negotiation issue. Simly set GST_PAD_FLAG_ACCEPT_INTERSECT flag
on sinkpad to fix issue.
2019-08-06 15:03:22 +00:00
Seungha Yang b43d0f785c nvenc: Remove unused member variables
Supported interlace-mode and codec profiles are checked
during plugin init and those values are never used.
2019-08-06 15:03:22 +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
Seungha Yang f7f9f327cd nvdec: Respect upstream provided timestamp
Decoder sometimes reports nonincreasing timestamp.
Use input frame's timestamp like other decoder elements.
2019-08-05 20:32:39 +00:00
Seungha Yang e68bfd7566 nvenc: Add support RGB 8/10bits formats
BGRA/RGBA/RGB10A2/BGR10A2 formats can be supported by nvenc.
Depending on device, supported format can be different.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1038
2019-08-05 18:55:28 +00:00
Seungha Yang c99b160b50 nvdec: Use upstream framerate if possible
Encoded bitstream might not have valid framerate. If upstream
provided non-variable-framerate (i.e., fps_n > 0 and fps_d > 0)
use upstream framerate instead of parsed one.
2019-08-05 15:32:43 +00:00
Seungha Yang 158b4d8649 nvenc: Fix crash with unspecified framerate
Nvidia driver seems to calculating floating point framerate
without validation. This causes crash both on linux and Windows.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1012
2019-08-05 15:32:43 +00:00
Aaron Boxer 40f7001bef msdkdec: no need to cache allocation_caps 2019-08-05 13:32:15 +00:00
Seungha Yang 2a76807c9a configure: Update for nvcodec dependency change
nvcodec is compilable without external dependency
2019-07-31 15:36:04 +00:00
Seungha Yang f1cbab7cfd nvdec: Fix build warning error
gstnvdec.c:1222:3: error: implicit declaration of function ‘memset’ [-Werror=implicit-function-declaration]
   memset (&type_info, 0, sizeof (type_info));
   ^~~~~~
2019-07-31 15:36:04 +00:00
Seungha Yang 4fa5a82762 nvenc: Fix build error with x86 msvc
__stdcall is accepted or ignored by the compiler on x64 but x86
is not the case. So the function definition should be consistent
with declaration.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1039
2019-07-30 19:12:46 +09:00
Seungha Yang 0445ed6ba5 nvenc: Fix deadlock when pad_push return was not GST_FLOW_OK
Encoding thread is terminated without any notification so
upstream streaming thread is locked because there is nothing
to pop from GAsyncQueue. If downstream returns error,
we need put SHUTDOWN_COOKIE to GAsyncQueue for chain function
can wakeup.
2019-07-30 17:49:25 +09:00
Seungha Yang 3faf439347 nvcodec: Fix broken ABI in cuda stub header to fix nvenc with opengl
Fix the broken ABI introduced by the commit 367e742e5d
From CUDA Toolkit 3.2, size_t has been used in CUDA_MEMCPY2D structure
instead of unsigned int.
2019-07-30 11:13:18 +09:00
Aaron Boxer 6c7a07bc2a msdk: enable 32 bit build on windows 2019-07-26 11:42:55 +02:00
Seungha Yang 694f91da88 nvdec: Make OpenGL dependency optional
By adding system memory support for nvdec, both en/decoder
in the nvcodec plugin are able to be usable regardless of
OpenGL dependency. Besides, the direct use of system memory
might have less overhead than OpenGL memory depending on use cases.
(e.g., transcoding using S/W encoder)
2019-07-26 00:01:23 +00:00
Sebastian Dröge e326260173 decklink: Make sure to return a value from all code paths
False warning from MSVC, or it does not understand that
g_assert_not_reached() does not return.

...\gst-plugins-bad-1.0-1.17.0.1\sys\decklink\gstdecklink.cpp(1647) : warning C4715: 'gst_decklink_configure_duplex_mode': not all control paths return a value
2019-07-25 12:29:22 +03:00
Sebastian Dröge b4b911da4d decklinksrc: Reset timestamp observations on format change
We will usually get timestamps starting from 0 again and due to the
format change the clock of the input might also be different.
2019-07-25 12:29:22 +03:00
Seungha Yang 733c109ce9 nvcodec: Clean up pointless return values around plugin init
Any plugin which returned FALSE from plugin_init will be blacklisted
so the plugin will be unusable even if an user install required runtime
dependency next time. So that's the reason why nvcodec returns TRUE always.

This commit is to remove possible misreading code.
2019-07-25 08:47:50 +00:00
Seungha Yang 7b9045d846 nvcodec: Change log level for g_module_open failure
Since we build nvcodec plugin without external CUDA dependency,
CUDA and en/decoder library loading failure can be natural behavior.

Emit error only when the module was opend but required symbols are missing.
2019-07-25 08:47:50 +00:00
Seungha Yang e5a98cf9d8 nvdec: Add support for 10bits 4:2:0 decoding
This commit includes h265 main-10 profile support if the device can
decode it.

Note that since h264 10bits decoding is not supported by nvidia GPU for now,
the additional code path for h264 high-10 profile is a preparation for
the future Nvidia's enhancement.
2019-07-25 08:06:26 +00:00
Seungha Yang d692350fc3 nvdec: Specify supported profiles of h264/h265 codec
See more details about supported formats at
nvidia codec sdk document "NVDEC_VideoDecoder_API_ProgGuide.pdf"
Table 1. Hardware Video Decoder Capabilities.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/926
2019-07-25 08:06:26 +00:00
Seungha Yang c8640e23f4 nvdec: Skip draining before creating internal parser
GstVideoDecoder::drain/flush can be called at very initial state
with stream-start and flush-stop event, respectively.
Draning with NULL CUvideoparser seems to unsafe and that eventually
failed to handle it.
2019-07-25 07:11:04 +00:00
Aaron Boxer 96dc150b8b msdkdec: improve spelling and grammar of comments 2019-07-24 12:30:31 +02: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 8145a2236d msdkdec: remove unneeded code
Before calling gst_msdkdec_create_buffer_pool, the alignment parameters
have been adjusted.
2019-07-24 08:17:29 +08:00
Seungha Yang 367e742e5d nvcodec: Drop system installed cuda.h dependency
... and add our stub cuda header.

Newly introduced stub cuda.h file is defining minimal types in order to
build nvcodec plugin without system installed CUDA toolkit dependency.
This will make cross-compile possible.
2019-07-23 16:32:31 +09:00
Seungha Yang a2ada54265 nvcodec: Keep requested rank for default device
Fix for default encoder and decoder element factory to make them have
higher rank than the others.
2019-07-23 10:28:52 +09:00
Seungha Yang 92afa74939 nvenc: Register elements per GPU device with capability check
* By this commit, if there are more than one device,
nvenc element factory will be created per
device like nvh264device{device-id}enc and nvh265device{device-id}enc
in addition to nvh264enc and nvh265enc, so that the element factory
can expose the exact capability of the device for the codec.

* Each element factory will have fixed cuda-device-id
which is determined during plugin initialization
depending on the capability of corresponding device.
(e.g., when only the second device can encode h265 among two GPU,
then nvh265enc will choose "1" (zero-based numbering)
as it's target cuda-device-id. As we have element factory
per GPU device, "cuda-device-id" property is changed to read-only.

* nvh265enc gains ability to encoding
4:4:4 8bits, 4:2:0 10 bits formats and up to 8K resolution
depending on device capability.
Additionally, I420 GLMemory input is supported by nvenc.
2019-07-22 21:01:41 +00:00
Seungha Yang 0239152bca nvdec: Create CUDA context with registered device id
Only the default device has been used by NVDEC so far.
This commit make it possible to use registered device id.
To simplify device id selection, GstNvDecCudaContext usage is removed.
2019-07-22 17:39:45 +00:00
Seungha Yang 1df2f13d0c nvdec: Register elements per device/codec with capability check
By this commit, each codec has its own element factory so the
nvdec element factory is removed. Also, if there are more than one device,
additional nvdec element factory will be created per
device like nvh264device{device-id}dec, so that the element factory
can expose the exact capability of the device for the codec.
2019-07-22 17:39:45 +00:00
Seungha Yang 9ec62418c3 msdk: Do not expose DMA buffer caps feature on Windows
On Windows, DMA buffer is not supported. PadTemplate with actually
supported feature seems to more make sense.
2019-07-22 16:13:43 +00:00
Seungha Yang afe3c7e3ef nvcodec: Drop cudaGL.h dependency
nvcodec does not use any type/define/enum in cudaGL.h.
2019-07-22 23:11:14 +09:00
Seungha Yang 48a6641717 nvdec: Fix video stuttering issue with VP9
Address nvidia driver specific behavior to avoid unexpected frame mismatch
between GStreamer and NVDEC.
2019-07-19 18:44:32 +09:00
Seungha Yang 8018fa2526 nvdec: Drop async queue and handle data on callback of CUvideoparser
Callbacks of CUvideoparser is called on the streaming thread.
So the use of async queue has no benefit.

Make control flow straightforward instead of long while/switch loop.
2019-07-19 18:44:32 +09:00
Seungha Yang 8753561015 nvdec: Port to color_{primaries,transfer,matrix}_to_iso
... and update the color information only when upstream was not provided
the information.
2019-07-17 06:34:21 +00:00
Seungha Yang e01c68524f nvenc: Specify colorimetry related VUI parameters
Set the colorimetry config for the information to be embedded in encodec bitstream.
2019-07-17 14:45:05 +09:00
Seungha Yang c64cdf2ff3 kmssink: Fix implicit declaration build error
ffs() and strcmp() require string.h

gstkmssink.c:255:28: error: implicit declaration of function ‘ffs’ [-Werror=implicit-function-declaration]
       crtc_id = res->crtcs[ffs (crtcs_for_connector) - 1];
                            ^~~

gstkmssink.c:590:10: error: implicit declaration of function ‘strcmp’ [-Werror=implicit-function-declaration]
     if (!strcmp (property->name, prop_name)) {
          ^~~~~~
2019-07-17 01:05:32 +09:00
Sebastian Dröge bf9ecd65cf decklinkvideosrc: Don't report that we have signal until we know for sure
Previously we would've reported that there is signal unless we know for
sure that we don't have signal. For example signal would've been
reported before the device is even opened.

Now keep track whether the signal state is unknown or not and report no
signal if we don't know yet. As before, only send an INFO message about
signal recovery if we actually had a signal loss before.
2019-07-15 12:06:25 +03:00
Seungha Yang 8862abd7c6 nvdec: Fix possible frame drop on EOS
On eos, baseclass videoencoder call finish() vfunc instead of drain()
2019-07-09 20:52:23 +09:00
Ray Tiley b00f6c4f81 decklinkvideosrc: remove g_print
Causes a lot of output :)
2019-07-09 08:38:18 +00:00
Marc Leeman 489ff8604f nvcodec: do a generic cuda tests before going into version specifics 2019-07-08 10:37:46 +00:00
Seungha Yang c18fda03d9 nvdec,nvenc: Port to dynamic library loading
... and put them into new nvcodec plugin.

* nvcodec plugin
Now each nvenc and nvdec element is moved to be a part of nvcodec plugin
for better interoperability.
Additionally, cuda runtime API header dependencies
(i.e., cuda_runtime_api.h and cuda_gl_interop.h) are removed.
Note that cuda runtime APIs have prefix "cuda". Since 1.16 release with
Windows support, only "cuda.h" and "cudaGL.h" dependent symbols have
been used except for some defined types. However, those types could be
replaced with other types which were defined by "cuda.h".

* dynamic library loading
CUDA library will be opened with g_module_open() instead of build-time linking.
On Windows, nvcuda.dll is installed to system path by CUDA Toolkit
installer, and on *nix, user should ensure that libcuda.so.1 can be
loadable (i.e., via LD_LIBRARY_PATH or default dlopen path)
Therefore, NVIDIA_VIDEO_CODEC_SDK_PATH env build time dependency for Windows
is removed.
2019-07-08 10:37:46 +00:00
Seungha Yang 5c3879ace6 d3d11videosink: Add new Direct3D11 video render plugin
Direct3D11 was shipped as part of Windows7 and it's obviously
primary graphics API on Windows.

This plugin includes HDR10 rendering if following requirements are satisfied
* IDXGISwapChain4::SetHDRMetaData is available (decleared in dxgi1_5.h)
* Display can support DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 color space
* Upstream provides 10 bitdepth format with smpte-st 2084 static metadata
2019-07-08 08:31:47 +00:00
Haihao Xiang f5b1c75d4c msdk: add msdkvp9enc element 2019-07-07 15:16:28 +00:00
Haihao Xiang ba7f3f48c2 msdk: workaround for MFX_FOURCC_VP9_SEGMAP surface
MFX_FOURCC_VP9_SEGMAP surface in MSDK is an internal surface however
MSDK still call the external allocator for this surface, so this plugin
has to return UNSUPPORTED and force MSDK allocates surface using the
internal allocator.

See https://github.com/Intel-Media-SDK/MediaSDK/issues/762 for details
2019-07-07 15:16:28 +00:00
Haihao Xiang 1221898404 msdkenc: allow encode element requires extra frames
The call of MFXVideoENCODE_EncodeFrameAsync may not generate output and
the function returns MFX_ERR_MORE_DATA with NULL sync point, the input
frame is cached in this case, so it is possible that all allocated
frames go into the surfaces_used list after calling
MFXVideoENCODE_EncodeFrameAsync a few times, then the encoder will fail
to get an available surface before releasing used frames

This patch adds a new field of num_extra_frames to GstMsdkEnc and allows
encode element requires extra frames, the default value is 0.

This patch is the preparation for msdkvp9enc element.
2019-07-07 15:16:28 +00:00
Haihao Xiang 98e4967337 msdk: don't share context between msdkvpp and msdkenc
msdkenc supports CSC implicitly, so it is possible that two VPP
processes are required when a pipeline contains msdkvpp and msdkenc.
Before this fix, msdkvpp and msdkenc may share the same context, hence
the same mfx session, which results in MFX_ERR_UNDEFINED_BEHAVIOR
in MSDK because a mfx session has at most one VPP process only

This fixes the broken pipelines below:

gst-launch-1.0 videotestsrc ! video/x-raw,format=I420 ! msdkh264enc ! \
msdkh264dec ! msdkvpp ! video/x-raw,format=YUY2 ! fakesink

gst-launch-1.0 videotestsrc ! msdkvpp ! video/x-raw,format=YUY2 ! \
msdkh264enc ! fakesink
2019-06-30 06:08:31 +00:00
U. Artie Eoff b756b13ee2 msdkmjpegdec: support 422 output
MSDK supports JPEG YUY2 (422 chroma) output color
format. The color format of input bitstream is
described by JPEGChromaFormat and JPEGColorFormat
fields in the mfxInfoMFX structure which is filled
in by the MFXVideoDECODE_DecodeHeader function.

To obtain lossless decoded output from 422 encoded
JPEGs, we must set the output color format in the
FourCC and ChromaFormat fields in the mfxFrameInfo
structure to the appropriate values at post_configure
so that they are propagated through to the srcpad
caps accordingly.
2019-06-29 17:40:06 +00:00
U. Artie Eoff 70bfd34b41 msdkdec: add post_configure virtual method
A post_configure virtual method is added to allow
codec subclasses to adjust the initialized parameters
after MFXVideoDECODE_DecodeHeader is called from the
gstmsdkdec::gst_msdkdec_handle_frame function.

This is useful if codecs want to adjust the output
parameters based on the codec-specific decoding
options that are present in the mfxInfoMFX structure
after MFXVideoDECODE_DecodeHeader initializes them.
2019-06-29 17:40:06 +00:00
Haihao Xiang 6117a2c6bc msdkvp9dec: add support for VP9 444
The output formats are VUYA for 8bit 444 and Y410 for 10bit 444.
2019-06-29 18:10:23 +02:00
Haihao Xiang b483f3499a msdkh265dec: add support for main-444-10/main-444-10-intra profile
The output format is Y410
2019-06-29 17:33:57 +02:00
Haihao Xiang 9da737d6aa msdk: return a right pointer for Y410 when mapping a frame 2019-06-29 17:33:57 +02: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 84a46f04a7 msdk: set parameters in mfxFrameData for a MFX_FOURCC_Y410 frame 2019-06-29 17:33:57 +02:00
Haihao Xiang bc3a43bdb4 msdk: map MFX_FOURCC_Y410 to VA_FOURCC_Y410 2019-06-29 17:33:57 +02:00
Haihao Xiang 365f6cf0c8 msdk: map GST_VIDEO_FORMAT_Y410 to VA_FOURCC_Y410 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 49ae5c2de4 msdkh265dec: add support for main-444 profile
The output format is VUYA
2019-06-29 17:33:57 +02:00
Haihao Xiang 1ee2adc580 msdkh265dec: add support for main-422-10/main-422-10-intra 10bit
The ouput format is Y210
2019-06-29 14:15:32 +00: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