libcamera/src/gstreamer
Hou Qi e9a876acc6 gstreamer: keep same transfer with that in negotiated caps
The conversions back and forth between GStreamer colorimetry and
libcamera color space are not invariant for the bt601 colorimetry.
The reason is that Rec709 transfer function defined in GStreamer
as GST_VIDEO_TRANSFER_BT709 (5), is to be replaced by its alias
GST_VIDEO_TRANSFER_BT601 (16) only for the case of bt601 (aka 2:4:16:4)
colorimetry - see [1].

Currently the composition of the GStreamer/libcamera conversions:
colorimetry_from_colorspace (colorspace_from_colorimetry (bt601))
returns 2:4:5:4 instead of the expected 2:4:16:4 (bt601). This
causes negotiation error when the downstream element explicitly
expects bt601 colorimetry.

Minimal example to reproduce the issue is with a pipeline handler
that do not set the optional color space in the stream configuration,
for instance vimc or imx8-isi:
export LIBCAMERA_PIPELINES_MATCH_LIST="vimc,imx8-isi"
gst-launch-1.0 -v libcamerasrc ! video/x-raw,colorimetry=bt601 ! fakesink

Above pipeline fails to start. This change memorizes downstream required
transfer function when mapped libcamera transfer is Rec709 in
gst_libcamera_configure_stream_from_caps(), and restores the transfer
function in gst_libcamera_stream_formats_to_caps().

[1] https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/724

Bug: https://bugs.libcamera.org/show_bug.cgi?id=150
Signed-off-by: Hou Qi <qi.hou@nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-16 15:12:50 +02:00
..
gstlibcamera-controls.cpp.in gstreamer: Generate controls from control_ids_*.yaml files 2024-11-05 16:28:09 +00:00
gstlibcamera-controls.h gstreamer: Generate controls from control_ids_*.yaml files 2024-11-05 16:28:09 +00:00
gstlibcamera-utils.cpp gstreamer: keep same transfer with that in negotiated caps 2024-12-16 15:12:50 +02:00
gstlibcamera-utils.h gstreamer: keep same transfer with that in negotiated caps 2024-12-16 15:12:50 +02:00
gstlibcamera.cpp libcamera: Drop remaining file name from header comment blocks 2024-05-09 23:31:15 +03:00
gstlibcameraallocator.cpp gstreamer: allocator: Ensure camera manager stay alive 2024-07-25 11:44:32 +01:00
gstlibcameraallocator.h libcamera: Drop file name from header comment blocks 2024-05-08 22:39:50 +03:00
gstlibcamerapad.cpp libcamera: Drop file name from header comment blocks 2024-05-08 22:39:50 +03:00
gstlibcamerapad.h libcamera: Drop file name from header comment blocks 2024-05-08 22:39:50 +03:00
gstlibcamerapool.cpp libcamera: Fix header grouping 2024-08-12 14:57:35 +03:00
gstlibcamerapool.h libcamera: Drop file name from header comment blocks 2024-05-08 22:39:50 +03:00
gstlibcameraprovider.cpp gstreamer: Remove auto-focus-mode property from device provider 2024-11-05 16:28:09 +00:00
gstlibcameraprovider.h libcamera: Drop file name from header comment blocks 2024-05-08 22:39:50 +03:00
gstlibcamerasrc.cpp gstreamer: keep same transfer with that in negotiated caps 2024-12-16 15:12:50 +02:00
gstlibcamerasrc.h gstreamer: Remove auto-focus-mode property from libcamerasrc 2024-11-05 16:28:09 +00:00
meson.build gstreamer: Generate controls from control_ids_*.yaml files 2024-11-05 16:28:09 +00:00