Commit graph

658 commits

Author SHA1 Message Date
Seungha Yang
e353fe8fcc h264decoder: Handle malformed avc/avc3 packets
Packetized stream format should not contain start-code prefix
in bitstream and each [nal-length-byte, nal-byte] unit should consist of
single nal unit. But there are malformed streams in the world.
Use newly added gst_h264_parser_identify_and_split_nalu_avc()
method to identify each nal unit.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3219
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5772>
2024-01-17 14:57:57 +00:00
Seungha Yang
c737799900 h264parser: Add gst_h264_parser_identify_and_split_nalu_avc() method
Equivalent to _split_nalu_hevc() method in h265parser. This method
will scan start-code prefix and split into individual NAL units
if start-code prefix is detected

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5772>
2024-01-17 14:57:57 +00:00
Chris Spencer
2388932767 vkmemory: don't map memory more than once
vkMapMemory may not be called on a memory object that is already
host-mapped. If the gstreamer memory object is mapped more than once then
reuse the existing Vulkan mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5917>
2024-01-16 17:44:48 +01:00
Chris Spencer
865227b750 vkimagebufferpool: allow specifying initial image layout
The pool currently defaults to performing a layout transition to
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, with some special exceptions for
video usages. This may not be a legal transition depending on the usage.
Provide an API to explicitly control the initial image layout.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5881>
2024-01-13 05:54:00 +00:00
Scott Moreau
f0d15f335d gst-launch: accept option to set program name
The option --prog-name="PROGRAM-NAME" can be passed to set the program name.
The program name is used by gtk and gstreamer to set the class or app-id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5263>
2024-01-12 17:11:11 +00:00
Stéphane Cerveau
f337d37d6d codecparsers: add slice type name for h265
Add a method to convert the slice type to a descriptive
name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5908>
2024-01-11 13:17:43 +01:00
Stéphane Cerveau
9c250179c6 codecparsers: add helper methods for h264
Add two helper methods to convert profile
and slice types

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5908>
2024-01-11 13:17:43 +01:00
Olivier Crête
745197d386 analytics: Implement scale meta transform for Object detection meta
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:35:17 -05:00
Olivier Crête
5d3035553c analytics: Replace type quark with opaque struct pointer
This way, we can add function pointers in there for things like
transformations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:34:53 -05:00
Olivier Crête
91815710dd analyticsmeta: Make the GstAnalyticsRelatableMtdData struct private
Only ask the subclass about how much space they need, this way we can keep
the allocation details more private.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:19:38 -05:00
Stéphane Cerveau
476c7efcb7 vulkan: decoder: create union for profile usage
As a profile can include a VkVideoDecodeUsageInfoKHR
or VkVideoEncodeUsageInfoKHR, use union to separate the both.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5701>
2024-01-10 17:15:12 +00:00
Stéphane Cerveau
97ebaa0bc1 gstutils: add gst_util_ceil_log2
Move ceil_log2 from nalutils.* to gstutils.*

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5888>
2024-01-09 15:34:10 +00:00
Seungha Yang
abe1f5044d cuda: Prefer CUBIN over PTX
System installed NVRTC library might be newer version than
driver, then generate PTX can be incompatible with the driver.
Instead of the intermediate code PTX, use actual assembly code
directly.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3108
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5639>
2024-01-02 10:10:09 +00:00
Olivier Crête
f5d5f2cf1a meta: Add API to register metas in two steps
And also remove the specific registration APIs for
serializable meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5830>
2023-12-19 22:41:31 +00:00
Olivier Crête
2a9c4e3270 meta: Move the clear operation to its own vfunc
Some transforms always assumed that the transformation was some kind
of copy. So adding a "clear" operation didn't work out in practice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5830>
2023-12-19 22:41:31 +00:00
Philippe Normand
61d3f5c8e0 play: Include pipeline dump in error details structure
This can be useful for debugging purposes. It can't be done on application side
because the on_error callback tears down the pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5828>
2023-12-18 20:13:38 +00:00
Philippe Normand
c6c567e3e4 play: Fix error details parsing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5828>
2023-12-18 20:13:38 +00:00
Seungha Yang
890d59e97e av1parser: Fix array sizes in scalability structure
Since the AV1 specification is not explicitly mentioning about
the array size bounds, array sizes in scalability structure
should be defined as possible maximum sizes that can have.

Also, this commit removes GST_AV1_MAX_SPATIAL_LAYERS define from
public header which is API break but the define is misleading
and this patch is introducing ABI break already

ZDI-CAN-22300

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5823>
2023-12-18 10:58:24 +00:00
Daniel Morin
49f200cb54 h264parse: Improved AU boundary detection
- AU boundary detection reviewed to follow more closely H.264 spec. and more
  specifically clauses 7.4.1.2.3 and 7.4.1.2.4.
- The gist of the changes is a look-a-head in then next AU required identify the
  last vcl-nal of current AU and firt vcl-nal of next AU (according to
  7.4.1.2.4) followed by the identification of the first nal of next AU
  (according to 7.4.1.2.3).
- A backlog of all nals of current AU and next AU up to the point where current
  AU can identified completed is kept.
- In NAL alignement mode vcl-nal are sent immediatly but the history is kept to
  allow AU boundary detection. Non-vcl-nal can be delayed up to the reception of
  the next vcl-nal to allow a correct AUD insertion.
- Based on this improved AU boudary detection we can avoid erronous AUD
  insertion, like the one highlighted by test
  test_parse_sliced_with_prefix_and_sei_nal_au.
- Add support for MVC AU boundary detection. (H.7.4.1.2.4)
- Explicitly report SVC not supported. We don't have the SVC NAL parsing
  required to identify boundary. (missing dependency_id and quality_id fields
  from SVC, see G.7.4.1.2.4)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5741>
2023-12-17 21:42:47 +00:00
Víctor Manuel Jáquez Leal
4a22cc8fb3 va: no need to provide a buffer size for VA pool
VA drivers allocate surfaces given their properties, so there's no need to
provide a buffer size to the VA pool.

Though, the buffer size is provided by the driver, or the canonical size
is used for single planed surfaces.

This patch removes the need to provide a size for the function
gst_va_pool_new_with_config() and adds a helper method to retrieve the surface
size, gst_va_pool_get_buffer_size(). Also change the callers accordingly.

Changes for custom VA pool creation will be addressed in the following commits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
2023-12-14 12:50:32 +00:00
Víctor Manuel Jáquez Leal
f413714b37 vaallocator: use gst_va_display_check_version()
Instead of the local method to parse the vendor string.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5800>
2023-12-13 09:12:28 +00:00
Víctor Manuel Jáquez Leal
8574bb8914 vadisplay: add gst_va_display_check_version()
This function compares the driver version with the user provided one to check if
driver's is equal or bigger.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5800>
2023-12-13 09:12:28 +00:00
Víctor Manuel Jáquez Leal
94e6a6e3de vaallocator: clean up use derived feature
Remove allocator member variable for use derived feature which doesn't need to be kept,
it's just for configuration purposes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5799>
2023-12-12 18:39:49 +01:00
He Junyan
fac9fb2174 codecs: correct the print log for h265 picture getting by poc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5789>
2023-12-11 10:24:34 +00:00
Jordan Petridis
30c968f0ee build/mse: Add the enum sources to the test gstmse_private_test_dep
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5763>
2023-12-11 06:39:29 +00:00
Víctor Manuel Jáquez Leal
7332eb6427 vaallocator: force non-derived for old mesa drivers
Mesa <23.3 can't map derived images for P010 format. This patch forces
non-derived if this is the case.

See: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24381
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Víctor Manuel Jáquez Leal
ddf6fd9c61 va: check surface status before get derive image
According with documentation the surface has to be in ready state before getting
it derived image. This patch adds that check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Víctor Manuel Jáquez Leal
6b1fba14bf vaallocator: remove runtime mapping selection
The original idea was to select the type of mapping (either using derive images
or downloading the image) in runtime, under the assumption that both methods
shared the same memory layout (offsets and strides), because a single
GstVideoMeta is assigned by the buffer pool at allocation time. Nonetheless, in
recent hardware this assumption is invalid, raising memory access errors.

This patch removes completely the mapping type selection at runtime, using the
method selected when the allocator is configured, synced with the bufferpool
allocation.

This problem was fixed originally for iHD driver only. But now it makes sense to
remove all of it.

Original-patch-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Víctor Manuel Jáquez Leal
90af9b7704 vaallocator: don't fail if drm fourcc are different
When exporting a DMABuf from a VASurface the user might tell that the surface
was allocated with certain fourcc, but the returned VADRMPRIMESurfaceDescriptor
migth tell a different fourcc, as in the case or radeonsi driver, for duplicated
fourcc, such as YUY2 and YUYV.

Originally it was supposed to be a failed exportation. This patch relax this
validation by allowing different fourcc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Daniel Morin
4425562661 analytics: fix analytics-meta re-use
- Fix alignment error when source and destination analytics-meta have the same
  relation order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5767>
2023-12-06 18:25:16 +00:00
Daniel Morin
aaee569087 analytics: replace id type from gint to guint
- Replace all id type from gint to guint
- Fix annotation for GstAnalyticsODMtdData

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5758>
2023-12-04 10:14:59 -05:00
Seungha Yang
801492b334 d3d11: Add RBGA format support
Allocates DXGI_FORMAT_AYUV texture for RBGA so that it can be used
by video decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5703>
2023-11-29 16:54:16 +00:00
Benjamin Gaignard
cd14b0892e codecparsers: av1: Clip max tile rows and cols values
Clip tile rows and cols to 64 as describe in AV1 specification
to avoid writing outside array range but preserve sb_cols
and sb_rows value which are used to futher computation.

Fixes ZDI-CAN-22226 / CVE-2023-44429

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5702>
2023-11-29 15:48:50 +00:00
Benjamin Gaignard
f525de6d00 Revert "codecparsers: av1: Clip max tile rows and cols values"
This reverts commit b76a801f57.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5702>
2023-11-29 15:48:50 +00:00
Seungha Yang
ccf6ac2b4c h264decoder: Fix GstVideoCodecFrame leak
If current buffer has no slice data, frame should be released.
Otherwise frames will stay in decoder baseclass forever.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5693>
2023-11-29 10:52:58 +00:00
Seungha Yang
6992e14eee d3d11: Fix string version shader code
RGBA to BGRA conversion code should have written in compute
shader.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5723>
2023-11-28 21:02:44 +09:00
Seungha Yang
461c4bc32c d3d11: Add support for more packed formats using compute shader
Adding below listed formats support, and reorders supported format
list based on preference

<YUV 4:2:2>
UYVY, VYUY, YVYU, v210, v216

<YUV 4:4:4>
v308, IYU2

<RGB 16bits per pixel>
RGB16, RGB15, BGR16, BGR15

<RGB 8bits per channel>
ARGB, xRGB, ABGR, xBGR, RGB, BGR

<RGB 10bits per channel>
r210, BGR10A2

<RGB 16bits per channel>
BGRA64

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5717>
2023-11-27 15:14:09 +00:00
Seungha Yang
845f5d4856 d3d11: Rework memory allocation params signalling
Hide GstD3D11AllocationParams detail from public header and
set setter methods.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5717>
2023-11-27 15:14:09 +00:00
Seungha Yang
721533d042 d3d11: Use shader model 4
Since shader model 4 is sufficient for the current pixel shader
implementations, prebuild HLSL with shader model 4 as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5709>
2023-11-25 20:27:43 +09:00
Seungha Yang
df0e6c4140 d3d11converter: Do not use R32_UINT UAV
It does not work well with YUY2 texture on some GPUs. Always use
the same DXGI formats for each SRV and UAV

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5709>
2023-11-25 20:27:43 +09:00
Seungha Yang
030800905b d3d11device: Remove outdated comment
We do support 4:2:2 YUV formats using compute shader now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5709>
2023-11-25 20:27:43 +09:00
Seungha Yang
3ab8d520fb d3d11: Drop legacy device support
Direct3D feature level 10 supported GPUs were released
more than 15 years ago, around the time when Windows
Vista / 7 were released. Also our d3d11 plugin/library
does not support feature level 9.x very well already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5709>
2023-11-25 20:27:43 +09:00
Stéphane Cerveau
15b719d7f6 vkbufferpool: add support for video encoded buffers
Add support for non video raw  buffers to allocate memory
such as in encoded content scenario.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5645>
2023-11-21 19:16:37 +00:00
Stéphane Cerveau
c6a5437e0d vkbufferpool: allow to set allocation params
Add the possibility to change the vulkan usage and mem properties from
external source.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5645>
2023-11-21 19:16:37 +00:00
Daniel Morin
d23a90cb16 analytics: base class for analytics meta
- GstAnalyticRelationMeta is a base class for analytics
  meta. It's able to store analytics results (GstAnalyticRelatableMtd)
  and describe the relation between each analysis results.
- GstAnalysisRelationMeta also contain an algorithm able to explore
  analysis results relation using a bfs.
- Relation(edge) between analysis results (vertice) are stored in an adjacency-matrix
  that allow to quickly identify if two analysis results are related and by
  which relation they related. It also work for indirect relation
  and can provide the path of analysis results by which two
  analysis results are related.
- One allocation per buffer to store analysis results. Here we rely on
  the application to guess how much space will be required to store all
  analysis results. This is something that could be improved
  significantly but it's a starting point.
- Define common analysis results, classification, object-detection,
  tracking that are subclass of GstAnalyticRelatableMtd. The also
  provide exemple of how to extend GstAnalyticRelatableMtd to have them
  benefit for the mechanim to express relation with other analysis
  results.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4962>
2023-11-21 18:04:53 +00:00
Stéphane Cerveau
159f24c07f vulkan: use gst_vulkan_device_select_queue
Use gst_vulkan_device_select_queue api to retrieve a valid queue
in vkupload, vkdownload, vkimagebufferpool, and vkvideofilter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5656>
2023-11-21 13:51:21 +00:00
Stéphane Cerveau
74c6298eb7 vkdevice: select queue with expected flags
Allow to select a queue with the given flags
such as compute bit etc from a given device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5656>
2023-11-21 13:51:21 +00:00
Nirbheek Chauhan
ec3962f9c7 directxmath.wrap: Fix cpuid mismatch on MinGW
This fixes a build failure with meson 1.3.0, which was caused by
a bugfix in Meson that made the cc.compile() check succeed on MSYS2
MinGW and enable DirectXMath SIMD, which in turn triggered the broken
`__cpuid()` issue mentioned in the meson.build file.

Upstream fix: https://github.com/microsoft/DirectXMath/pull/172

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5690>
2023-11-20 20:08:57 +00:00
Nirbheek Chauhan
f65d074354 meson: Rework d3d11 checks, add new d3d11-math option
This allows us to ensure that directxmath SIMD is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5690>
2023-11-20 18:49:13 +00:00
Seungha Yang
b42b45af46 d3d11: Add Y412 format support
It's mapped to DXGI_FORMAT_Y416 and major format for 12bits 4:4:4
video decoding. Since DXGI_FORMAT_Y416 format cannot be a render target,
adding corresponding compute shader code too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5692>
2023-11-21 02:40:10 +09:00