Commit graph

126 commits

Author SHA1 Message Date
Thibault Saunier
2fd28195ca Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00
Haihao Xiang
c778686a3c test: enlarge the number
This is to make sure the case can pass after adding new video formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1141>
2021-05-11 12:24:41 +08:00
Seungha Yang
410efd196a video-chroma: Add support for any combination of chroma-site flags
We've been allowing only a few known chroma-site values such as
jpeg (not co-sited), mpeg2 (horizontally co-sited) and
dv (co-sited on alternate lines). That's insufficient for
representing all possible chroma-site values. By this commit,
we can represent any combination of chroma-site flags.
But, an exception here is that any combination with
GST_VIDEO_CHROMA_SITE_NONE will be considered as invalid value.

For any combination of chroma-site flags,
gst_video_chroma_to_string() method is deprecated in order to
return newly allocated string via a new gst_video_chroma_site_to_string()
method. And for consistent API naming, gst_video_chroma_from_string()
is also deprecated. Newly written code should use
gst_video_chroma_site_from_string() instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/927>
2020-12-08 07:21:28 +00:00
Mathieu Duponchelle
c50f4477ec video-converter: switch to using a task pool ..
.. and make use of that API in videoaggregator.

When setting certain properties, such as cropping or the scaled
size of pads, a new converter is created by videoaggregator.

Before that patch, this implied spawning new threads, potentially
at each aggregate cycle when interpolating pad properties. This
is obviously wasteful, and re-using a task pool removes that
overhead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/896>
2020-11-12 17:38:34 +00:00
Marijn Suijten
d0f36c7e13 video: Rename video_color_transfer to video_transfer_function
Rename remaining `gst_video_color_transfer_{encode,decode}` functions on
the `GstVideoTransferFunction` enumeration to
`gst_video_transfer_function_{encode,decode}` permitting
gobject-introspection to turn these into associated functions and place
them under the respective `<enumeration>` block in gir XML files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/805>
2020-09-12 09:46:44 +03:00
Sebastian Dröge
91ec4e06d7 video: Rename gst_video_color_transfer_*() to gst_video_transfer_function_*() in new API
The type is called GstVideoTransferFunction so the function names should
match, otherwise gobject-introspection is keeping the functions as
global functions instead of methods on the type.

The same mistake was also made in lots of other APIs over the years, but
here we can at least fix it for 1.18 still.

Thanks to Marijn Suijten for noticing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/807>
2020-09-07 13:04:20 +03:00
Nicolas Dufresne
98b44fdb46 video: Add support for linear 32x32 NV12 tiles
This adds linear 32x32 NV12 based tiles. This format is notably used by
Allwinner VCU and exposed in V4L2 as being "SUNXI Tiled" format. In this
patch we generalize the plane info calculation so we can share this part
with the 4L4 variant.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/754>
2020-07-14 21:43:56 -04:00
Nicolas Dufresne
7d1028424c video: Add NV12_4L4 tile format
This format is produced by Verisillicon VC8000D VPU decoder, it is a simple 4x4
tiling layout in a linear way.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/753>
2020-07-14 17:33:31 +00:00
Vivia Nikolaidou
1d0ccf8baa video-color: Add bt601 transfer function
Functionally the same as 709 but technically has a different value, and
external software (e.g. ffmpeg) finds "wrong" values produced by
GStreamer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/724>
2020-07-03 11:57:49 +03:00
Jan Schmidt
205bb066ed video-converter: Add checks for configuration sanity.
If the cropping or scaling input or output rects put us completely
outside the input/output frame respectively, we can't draw anything
except black safely. Check for those conditions and don't set up a
configuration that attempts to access out of bounds memory outside
the input/output framebuffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/696>
2020-06-12 06:49:56 +00:00
Jan Schmidt
bf5d51c5da video-converter: Guard against invalid frame input
If the frames passed in to gst_video_converter_frame()
have a different layout than was configured for, the
conversion code might go out of bounds and crash.

Do a sanity check on each frame passed in, and in the
absence of a return value in the API, just
refuse the conversion in invalid cases and leave the
destination frame untouched so it's obvious to
users that it was broken.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/696>
2020-06-12 06:49:56 +00:00
Guillaume Desmottes
84e0689d58 video: add gst_video_make_raw_caps()
More binding friendly version of GST_VIDEO_CAPS_MAKE().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Seungha Yang
1dee0f05a7 video-hdr: Rework for GstVideoMasteringDisplayInfo and GstVideoContentLightLevel struct
This commit modifies GstVideoMasteringDisplayInfo and GstVideoContentLightLevel
structs so that each value is to be more like hdr_metadata_infoframe struct
of linux drm header and DXGI_HDR_METADATA_HDR10 struct of Windows.
So each value is no more fraction but normalized one as per CTA 861.G spec.
Also the unit of each value will be consistent with H.264, H.265
specifications, hdr_metadata_infoframe struct for linux and
DXGI_HDR_METADATA_HDR10 struct for Windows.
2020-04-01 11:11:15 +00:00
Guillaume Desmottes
ea2619aadc video: fix GST_VIDEO_FRAME_IS_BOTTOM_FIELD()
GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD is a subset of
GST_VIDEO_FRAME_FLAG_TOP_FIELD so needs to be checked accordingly.

Fix #726
2020-02-26 16:15:59 +00:00
Guillaume Desmottes
26f386ce8b video: add macros checking for GST_VIDEO_BUFFER_FLAG_TOP/BOTTOM_FIELD flags
The GST_VIDEO_BUFFER_FLAG_TOP_FIELD flag is a superset of
GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD as they are defined using other
flags. As a result we can't use GST_BUFFER_FLAG_IS_SET() to check for
those flags.
2020-02-26 16:15:59 +00:00
Guillaume Desmottes
75680e5d34 videometa: add alignment field
By adding this field, buffer producers can now explicitly set the exact
geometry of planes, allowing users to easily know the padded size and
height of each plane.

GstVideoMeta is always heap allocated by GStreamer itself so we can
safely extend it.
2019-11-02 13:05:43 +01:00
Guillaume Desmottes
36ce08826e video-info: add gst_video_info_align_full()
When using gst_video_info_align() user had no easy way to retrieve the
padded size and height of each plane.
This can easily be implemented in fill_planes() as it's already called
in align() with the padded height.

Ideally we'd add a plane_size field to GstVideoInfo but the remaining
padding is too small so that would be an ABI break.

Fix #618
2019-11-02 13:05:43 +01:00
Guillaume Desmottes
509d4c31f0 video-format: add gst_video_format_info_component()
New API to find out which components are packed in a given plane.
Will prevent us from assuming a 1-1 mapping between planes and
components.
2019-07-19 15:47:02 +05:30
Seungha Yang
7327214bce tests: video: Add test conversion between colorimetry and ISO/IEC 23001-8 values
Test forward/backword conversion of color{matrix,transfer,primaries}.
2019-07-15 20:55:34 +09:00
Seungha Yang
b9bb240c6b tests: video: Enable PQ and HLG transfer en/decode tests 2019-05-24 09:30:40 +00:00
A. Wilcox
57e2bc3c1c video test: Keep BE test inline with LE test 2019-05-03 06:26:27 +00:00
Seungha Yang
630d3c3d12 tests: video: Add test for video-hdr 2019-04-30 15:45:44 +00:00
Guillaume Desmottes
10ce73b6eb video-info: check if alternate caps has the feature as well
It's invalid to have a 'interlace-mode=alternate' without the Interlaced caps
feature as well.
Modify gst_video_info_from_caps() to reject such case so we can easily
spot them in bugged elements.
2019-03-25 15:36:57 +01:00
Guillaume Desmottes
6ba860021c video-info: handle 'field-order' in alternate mode
The alternate interlace mode may also use the 'field-order' field in caps.
2019-03-25 15:35:46 +01:00
Tim-Philipp Müller
3288093c75 tests: video: speed up test_video_color_convert
This test takes a long time. It tests ca. 8900 conversion
combinations, and then it also runs each conversion for
at least 100ms in order to come up with some kind of benchmark.

Remove the benchmarking from the unit test, we have a separate
benchmarking tool for that now.

Also split the conversions into groups and run those as
separate checks, which allows better parallelisation at
the runner level (normal runs and when using valgrind).
2019-03-24 16:39:30 +00:00
Tim-Philipp Müller
b05e70ea94 tests: video: reduce debug log spam
This shouldn't be logged at info level.
2019-03-24 16:39:30 +00:00
Tim-Philipp Müller
a1d757b1ee tests: video: add basic sanity check of pstrides for formats
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/117
2019-02-20 09:49:26 +00:00
Victor Toso
1012e3d89c tests: use GPOINTER_TO_INT to avoid warnings with mingw
New casts to avoid the the warnings mentioned below. While at it, move
some existing casts (introduced at 61bc909189) to use
GPOINTER_TO_INT too.

[458/673] Compiling C object 'tests/check/7d01337@@libs_video@exe/libs_video.c.obj'.
../tests/check/libs/video.c: In function 'fourcc_get_size':
../tests/check/libs/video.c:160:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   return (unsigned long) p->endptr;
          ^

In file included from ../tests/check/libs/video.c:32:
../tests/check/libs/video.c: In function 'test_video_formats':
../tests/check/libs/video.c:563:39: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   fail_unless_equals_int (size, (unsigned long) paintinfo.endptr);
   ^

And more.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/94
2019-02-19 18:23:25 +00:00
Nicolas Dufresne
fcaf938e8c tests: video: Test video format enum stability
It is really easy to break the API and insert a new video format in the
middle of the enum instead of at the end. This minimal test should catch
the most obvious errors. Ideally, this test should be updated after new
format have been added, so that it won't allow further modification to
the enumeration API.
2019-02-18 13:25:23 +00:00
Sebastian Dröge
70d8c174ac video: Split the success and error convert_frame_async() test into two tests
To make it more obvious which of the two is actually failing.
2018-11-30 12:39:43 +02:00
Zeeshan Ali
0c034f3894 test: Ensure gst_video_info_set_format() calls succeed
https://bugzilla.gnome.org/show_bug.cgi?id=796106
2018-08-29 12:14:38 -04:00
Zeeshan Ali
0fbe4634a6 video: Add gst_video_info_set_interlaced_format()
Add a helper to set the interlacing mode while creating the GstVideoInfo
in addition to format and resolution. Using this helper will ensure that
size is correctly calculated for split-field interlacing mode.

https://bugzilla.gnome.org/show_bug.cgi?id=796106
2018-08-29 12:14:38 -04:00
Zeeshan Ali
bd9c7b36d8 video: Add GST_VIDEO_INTERLACE_MODE_ALTERNATE
Add a new interlace mode enum to represent buffers containing a single
field of an interlaced video in a buffer. The name is based on the
equivalent video format in the V4L2 API, V4L2_FIELD_ALTERNATE:

https://01.org/linuxgraphics/gfx-docs/drm/media/uapi/v4l/field-order.html

Since caps fields are optional, we also introduce a new caps feature,
"format:Interlaced" that always goes with "alternate" interlace mode to ensure
that caps for this incompatible format are incompatible with other interlaced
and progressive video caps.

https://bugzilla.gnome.org/show_bug.cgi?id=796106
2018-08-29 12:14:38 -04:00
Tim-Philipp Müller
3f184c3abc tests: include config.h and don't include unix headers
In many cases the unistd.h includes weren't actually needed.

Don't build tests that need it on windows with MSVC
(multifdsink, multisocketsink, pipelines/tcp).

Preparation for making tests work on Windows with MSVC.
2018-01-16 18:14:59 +00:00
Jan Schmidt
68565ec0fc testsuite: Add some test checks for gst_video_guess_framerate() 2017-01-09 21:31:37 +11:00
Sebastian Dröge
47fdb15074 video-info: Add unit test for overflow checks
And also prevent overflows caused by allowing uint width/height in
gst_video_info_set_format() but storing them as (signed!) ints.
2016-11-24 15:40:22 +02:00
Nicolas Dufresne
7a40442ad5 video: Add VYUY pixel format
This format is sometimes the output of JPEG decoders. It is the same as
YUY2 and UYVY but with a different component order.

https://bugzilla.gnome.org/show_bug.cgi?id=767450
2016-11-01 19:55:20 +02:00
Nicolas Dufresne
afaa3f1380 video/test: Coding style fix 2016-09-07 14:24:54 -04:00
Stian Selnes
1335ccd228 video-color: Fix colorimetry IS_UNKNOWN
Fix issue with colorimetry default indicies not being in sync with the
actual table causing IS_UNKNOWN() to sometimes fail.

https://bugzilla.gnome.org/show_bug.cgi?id=767163
2016-06-02 17:14:50 +01:00
Joan Pau Beltran
abb88801e7 video: add IYU2 format
This existed in 0.10 and is needed by dc1394src.

IYU2 format is a YUV fully-sampled packed format similar to v308
but with different component order (U-Y-V instead of Y-U-V).

http://www.fourcc.org/yuv.php#IYU2

https://bugzilla.gnome.org/show_bug.cgi?id=763026#c5
2016-06-01 12:07:05 +01:00
Vineeth TM
b0b0536f91 tests:video: Fix overlay rectangle and buffer leak
Created overlay rectangle is not being freed in video tests
pix2 buffer is being created and not freed

https://bugzilla.gnome.org/show_bug.cgi?id=757927
2015-11-11 15:47:24 +01:00
Andreas Frisch
4a85438e5b tests: Add a test for video blending over transparent frames
And fix the test_overlay_blend test where we blend over a
transparent frame and where expecting wrong results

https://bugzilla.gnome.org/show_bug.cgi?id=681447
2015-11-04 22:17:35 +01:00
Jan Schmidt
e57754be9b tests: Fix video libs test for multiview GstVideoInfo change
The GstVideoInfo struct was changed late in integrating the
multiview changes, and I forgot to run and fix the unit test.
2015-06-11 12:21:08 +10:00
Jan Schmidt
7c1da700c4 video: Add multiview/stereo support
Add flags and enums to support multiview signalling in
GstVideoInfo and GstVideoFrame, and the caps serialisation and
deserialisation.

videoencoder: Copy multiview settings from reference input state

Add gst_video_multiview_* support API and GstVideoMultiviewMeta meta

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2015-06-11 12:05:00 +10:00
Tim-Philipp Müller
c53ba4beeb Fix double semicolons 2015-03-10 09:27:08 +00:00
Wim Taymans
72fd1345ad check: add another generic converter test
Run conversion and scaling with borders.
2015-03-04 12:29:45 +01:00
Wim Taymans
e0a192d3dd video-converter: don't reuse the input line when adding borders
When we need to add borders, we need a writable input line, so
don't reuse the source memory directly.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745207
2015-03-04 12:29:45 +01:00
Edward Hervey
ff57f69134 video: Fix non-default usage of gst_video_sink_center_rect
Make sure we take into account non-0 x/y destination rectangles
2014-12-15 14:11:07 +01:00
Tim-Philipp Müller
c61604fd9b tests: fix leak in video unit test 2014-11-16 13:56:16 +00:00
Vineeth T M
7f5aa9af04 tests: video: add video blend test
Add test to check rendering of overlays of different sizes
that are completely or partially outside the video surface.
Once the overlay is blended to the video, verify if the
position of the blended overlay is as expected, by comparing
the pixels of the blended video with the expected values.

https://bugzilla.gnome.org/show_bug.cgi?id=739281
2014-11-16 13:51:34 +00:00