summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-08-07libcamera: Hide *::Private classes with __DOXYGEN_PUBLIC__Laurent Pinchart
The *::Private classes are part of the internal API, as their name implies. They are defined in internal headers, but implemented in the same source file as their public counterparts. This will cause Doxygen to complain about missing class definition when splitting the public and internal API documents, as the internal headers won't be parsed by Doxygen for the public API documentation. Marking the classes with \internal isn't enough. The directive prevents the documentation block from being included in the output, but this occurs at the generation stage, after the documentation blocks are parsed. Fix this by completely hidding the implementation of the *::Private classes from Doxygen using preprocessor conditional compilation. To do so, introduce a new macro, __DOXYGEN_PUBLIC__, that will be defined for the public API documentation only. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Mark internal parts of public classes with \internalLaurent Pinchart
The libcamera public API exposes classes that have parts considered internal. They inherit the Extensible class, and their internal parts are split into a Private class. Those classes are defined in public API headers, and their Private counterparts are defined in internal headers sharing a common file name (in a different directory). Both headers are documented in the same source file. For instance, include/libcamera/camera.h contains the public API of the Camera class, and include/libcamera/internal/camera.h its internal counterpart. Both are documented in src/libcamera/camera.cpp. As the internal headers are not part of the public API, they need to be hidden from the future public API builds. To prepare for doing so, mark them with the \internal Doxygen directive. Hardcode the Doxygen INTERNAL_DOCS option to YES to include the internal API. This will be changed later for the public API documentation build. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Unify Doxygen file directive prefix for formats.hLaurent Pinchart
libcamera has two formats.h headers, an internal one in include/libcamera/internal/, and a public one generated at build time. The convention is to prefix the internal header name with libcamera/internal/ in the Doxygen file directive, but formats.cpp only uses internal/ as a prefix. Unify it with the rest of the code base. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Make all internal headers visible to DoxygenLaurent Pinchart
Two classes that have both public and internal headers, namely Camera and Request, make only their public header visible to Doxygen through a file directive. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Drop path prefix from Doxygen file directiveLaurent Pinchart
The Doxygen directive only requires qualifying header file names with a path to differentiate between multiple header files with the same name. Most file directives that refer to unambiguous files do not have a libcamera/ and/or internal/ path prefix, but a few do, most likely due to copy&paste. Drop the prefix in those few files for consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05libcamera: software_isp: Replace malloc() with std::vector<>Laurent Pinchart
libcamera is implemented in C++, use std::vector<> to manage the dynamically allocated line buffers instead of malloc() and free(). This simplifies the code and improves memory safety by ensuring no allocation will be leaked. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Hans de Goede <hdegoede@redhat.com>
2024-08-05ipa: libipa: camera_sensor_helper: Reference blackLevel() in documentationLaurent Pinchart
The documentation for the blackLevel_ member is very terse. Reference the more complete documentation of the sibling blackLevel() member function to provide more information. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05libcamera: Remove spaces at end of linesLaurent Pinchart
Spaces at end of lines have cropped up in a few places in libcamera. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01libcamera: ipa_proxy: Report a missing configuration as a warningMilan Zamazal
When the configuration file for an IPA module is missing, it is reported as an error in the log, for example: ERROR IPAProxy ipa_proxy.cpp:149 Configuration file 'imx219.yaml' not found for IPA module 'simple' This is misleading because several pipelines use uncalibrated.yaml in such a case and can continue working. And in case of software ISP, there is currently no other configuration file so the error is always reported. On the other hand, in some other cases the presence of the configuration file is required and it is an error if it is missing. Let's introduce a new optional argument to IPAProxy::configurationFile that specifies a fallback file if the requested file is not found. If the primary requested file is not found and a non-empty fallback file is specified then a warning is logged and the fallback file is looked up. If neither the fallback file can be found then only then an error is logged and the method returns an empty string. This change has also the benefit of putting the common fallback file ("uncalibrated.yaml") pattern to a single place. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01libcamera: simple: Log a missing sensor in a better wayMilan Zamazal
SimplePipelineHandler::match may be called several times for different pipeline configurations. Not all of these calls must succeed. For example, for TI AM69 board with a single camera attached, the following error is reported in the log even when libcamera works fine: ERROR SimplePipeline simple.cpp:1558 No sensor found This is because a sensor is found for /dev/media0 but not for /dev/media1. The error is harmless in such a case and only confuses users who may think no camera is detected at all. Let's change the error to info and add the device node to the message to indicate the error is specific to the given media only. It's up to the callers to report a fatal error condition if libcamera cannot work due to no matching pipeline configuration. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01libcamera: software_isp: Remove file seal TODO itemLaurent Pinchart
The file seal TODO item has been addressed. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-08-01libcamera: shared_mem_object: Prevent memfd from shrinking or growingLaurent Pinchart
The memfd underlying the SharedMem object must not shrink, or memory corruption will happen. Prevent this by setting the shrink seal on the file. As there's no valid use case for growing the memory either, set the grow seal as well. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-08-01libcamera: base: memfd: Handle uClibc compatibility with function wrapperLaurent Pinchart
uClibc doesn't provide memfd_create(), which led libcamera to open-code the call using syscall(). Sprinkling the code with #ifdef's isn't the most readable option, so improve it by providing a local implementation of memfd_create(), and call the function unconditionally from MemFd::create(). This makes the main code path more readable. Suggested-by: Nicolas Dufresne <nicolas@ndufresne.ca> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2024-08-01libcamera: base: Add MemFd helper classLaurent Pinchart
libcamera creates memfds in two locations already, duplicating some code. Move the code to a new MemFd helper class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-07-31libcamera: Avoid variable-length arraysLaurent Pinchart
Unlike in C where they have been standardized since C99, variable-length arrays in C++ are an extension supported by gcc and clang. Clang started warning about this with -Wall in version 18: src/libcamera/ipc_unixsocket.cpp:250:11: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 250 | char buf[CMSG_SPACE(num * sizeof(uint32_t))]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ One simple option is to disable the warning. However, usage of VLAs in C++ is discouraged by some, usually due to security reasons, based on the rationale that developers are often unaware of unintentional use of VLAs and how they may affect the security of the code when the array size is not properly validated. This rationale may sound dubious, as the most commonly proposed fix is to replace VLAs with vectors (or just arrays dynamically allocated with new() wrapped in unique pointers), without adding any size validation. This will not produce much better results. However, keeping the VLA warning and converting the code to dynamic allocation may still be slightly better, as it can prompt developers to notice VLAs and check if size validation is required. For these reasons, convert all VLAs to std::vector. Most of the VLAs don't need extra size validation, as the size is bound through different constraints (e.g. image width for line buffers). An arguable exception may be the buffers in IPCUnixSocket::sendData() and IPCUnixSocket::recvData() as the number of fds is not bound-checked locally, but we will run out of file descriptors before we could overflow the buffer size calculation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-07-30apps: qcam: Disable -Wextra-semiLaurent Pinchart
The Qt 6 qkeysequence.h header has an extra semicolon. This causes a build failure with clang: /usr/include/qt6/QtGui/qkeysequence.h:139:26: error: extra ';' after member function definition [-Werror,-Wextra-semi] 139 | Q_ENUM(SequenceMatch); | ^ We can't fix the issue, so ignore the warning in qcam. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-07-26gstreamer: Fix width and height range handlingHou Qi
This changes is fixing critical error message "gst_value_set_int_range_step: assertion 'start < end' failed" observed when building GStreamer caps from a stream configuration whose size range holds a single size. GStreamer range step definition requires distinct min and max values definitions, otherwise above error message is output. libcamera SizeRange instance may return a single size leading to identical min and max values. Add a conditional check where the min and max of the range are distinct during iterating the supported sizes for each pixelformat. To prevent appending structures that are already expressed with this update, gst_caps_merge_structure() is used in place of gst_caps_append_structure(). Signed-off-by: Hou Qi <qi.hou@nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gst: Add child proxy support to libcamerasrcNicolas Dufresne
The child proxy interface is needed in order to allow setting properties on pad using parse launch syntax. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25libcamera: libipa: camera_sensor: Add onsemi AR0144 sensor propertiesLaurent Pinchart
Provide the onsemi AR0144 camera sensor properties and registration with libipa for the gain code helpers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25v4l2: v4l2_compat: Fix ioctl() prototype with musl C libraryLaurent Pinchart
The musl C library, as well as the POSIX standard, define the ioctl() function's request argument as an int. glibc and uclibc, on the other hand, define it as an unsigned long. This difference between the function prototype and the implementation in the V4L2 adaptation layer causes a compilation error with musl. Fix it by detecting the function prototype and declaring the libcamera ioctl() handler accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gstreamer: allocator: Ensure camera manager stay aliveNicolas Dufresne
Without the camera manager, it is not possible to cleanly delete the FrameBufferAllocator object. Keep the camera manager alive until all the memory object have been released. A shared_ptr to the CameraManager is introduced which is itself stored as a plain pointer and allocated and released explicitly. When more than one C++ member is required, this can be refactored to use a new C++ class, but the struct _GstLibcameraAllocator is allocated and freed by glib, so it does not have automatic destruction presently. Bug: https://bugs.libcamera.org/show_bug.cgi?id=211 [Kieran: Update test framework to remove expected test fail] Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gstreamer: pool: Replace GstAtomicQueue with deque and mutexNicolas Dufresne
The GstAtomicQueue only supports 2 threads, one pushing, and one popping. We pop and push on error cases and we may have multiple threads downstream returning buffer (using tee), which breaks this assumption. On top of which, the release function, that notifies when the queue goes from empty to not-empty relies on a racy empty check. The downstream thread that does this check is effectively concurrent with our thread calling acquire(). Fix this by replacing the GstAtomicQueue with a std::deque, and protect access to that using the object lock. Bug: https://bugs.libcamera.org/show_bug.cgi?id=201 Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: ccm: Ensure metadata contains valid ccmStefan Klug
When the colour temperature does not change between frames, the ccm inside the frame context is not updated and the metadata contains invalid data. Fix that by caching the ccm inside the active state. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> [Kieran: Remove spurious [[maybe_unused]] addition] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: ccm: Fix ccm metadata outputStefan Klug
Only the first three entries of the matrix were set. Fix that. Fixes: cbfdfa42cacc ("ipa: rkisp1: algorithms: Add crosstalk algorithm") Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: awb: Unconditionally fill metadataStefan Klug
When the colour temperature estimation gets skipped, the metadata isn't populated. Fix that by filling the metadata early in the function. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa rkisp1: Remove temperatureK from FrameContextStefan Klug
The frame context is used to store data used for processing that frame. It is later used to either act as input for other algorithms or to fill the metadata. For the colour temperature this is not needed, as the meatadata shall not contain the value that was active when the image was processed, but the value that was calculated based on the statistics for that image. This is no functional change. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: awb: Clamp gains to machine limitsStefan Klug
When the color gains are set manually it is possible to specify a gain that wrapped the hardware limits. It would also be possible to further tune the floating point limits, but that is an error prone approach. So the limits are imposed on the integers, just before writing to the hardware. This noticeably reduces some oscillations in the awb regulation. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24libipa: camera_sensor_helper: Add OV5675 black levelDaniel Semkowicz
Add black level value for OV5675 camera sensor. According to datasheet, default value is 0x10, 10 bits width. However, Linux kernel driver initializes black level target value to 0x40. Set the value to the same as in kernel driver, but scaled to 16 bits. Signed-off-by: Daniel Semkowicz <dse@thaumatec.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24apps: qcam: Port to Qt 6Neal Gompa
Open source Qt 5 has been effectively end of life since the release of Qt 6, and Qt 6 has current LTS releases now. This change ports qcam to Qt 6.2 and drops some of the baggage related to Qt 5 that is no longer applicable. Signed-off-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-22libcamera: pipeline: simple: Enable Soft ISP for TI CSI-RXJai Luthra
The j721e-csi2rx driver pipeline uses no converters, so enable the software ISP plugin support. This is handy for boards with AM62 SoC (like BeaglePlay) that have no HW ISP. Tested with IMX519 on SK-AM62 running a kernel built with dmabuf heap support. Signed-off-by: Jai Luthra <j-luthra@ti.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-21libcamera: v4l2_videodevice: Use bufferType_ in [get|try|set]Format()Hans de Goede
V4L2VideoDevice is using the caps to determine which kind of buffers to use with the video-device in 2 different cases: 1. V4L2VideoDevice::open() 2. V4L2VideoDevice::[get|try|set]Format() And the order in which the caps are checked is different between these 2 cases. This is a problem for /dev/video# nodes which support both video-capture and metadata buffers. open() sets bufferType_ to V4L2_BUF_TYPE_VIDEO_CAPTURE[_MPLANE] in this case, where as [get|try|set]Format() will call [get|set]FormatMeta() which does not work with V4L2_BUF_TYPE_VIDEO_CAPTURE[_MPLANE] buffers. Switch [get|try|set]Format() to use the bufferType_ to determine on what sort of buffers they should be operating, leaving the V4L2VideoDevice code with only a single place where the decision is made what sort of buffers it should operate on for a specific /dev/video# node. This will also allow to modify open() in the future to take a bufferType argument to allow overriding the default bufferType it selects for /dev/video# nodes which are capable of supporting more then 1 buffer type. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-08qcam: viewfinder_qt: Maintain aspect ratioKieran Bingham
Keep the image aspect ratio when displaying in the viewfinder. When the window is adjusted to a size that differs in aspect ratio to the image, keep the image centered in the main window. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-06ipa: rkisp1: Install all tuning filesRobert Mader
We have all these neat tuning files. Unfortunately we forgot to install many of them. Signed-off-by: Robert Mader <robert.mader@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-04ipa: rkisp1: blc: Drop [[maybe_unused]] attributeLaurent Pinchart
The context parameter of the BlackLevelCorrection::init() function is used. Drop the [[maybe_unused]] attribute. Fixes: 50c28e135100 ("ipa: rkisp1: blc: Query black levels from camera sensor helper") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-04libcamera: pipeline: simple: Enable intel-ipu6 with Soft ISPDennis Bonke
Enable the simple pipeline handler with software ISP for the IPU6 now that the IPU6 CSI2 receiver (aka the isys driver) has landed in media_staging/master. Signed-off-by: Dennis Bonke <admin@dennisbonke.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-03ipa: rkisp1: Move ov4689 and ov5640 black levels into sensor helpersStefan Klug
Move black levels for tuning files that contained a BLC block into the camera sensor helpers. ov4689.yaml had 66@12bit while the datasheet states 64@12bit. Use the value from the datasheet (scaled to 16bit). ov5640.yaml had 256@12bit while the datasheet states 16@10bit. Looking at the commit message the 256 most likely stems from the imx219 tuning file and 16@10bit is the same as the 64@12bit from the ov4689. This seems more likely and is therefore used. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-03ipa: rkisp1: data: Update tuning files for imx219 and imx258Stefan Klug
The black levels for imx219 and imx258 are now contained in the camera sensor helpers. Remove them from the tuning file for the imx219. Add a BLC entry to the imx258 tuning file. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-03ipa: rkisp1: blc: Report sensor black levels in metadataStefan Klug
Add sensor black levels to the metadata of the rkisp1 pipeline. Additionally enable raw support for this algorithm and add it to uncalibrated.yaml, so that black levels get reported when capturing tuning images. This is a bit of a hack, because no actual black level correction is taking place in raw mode, but it is the easiest way to get blacklevel reported for raw streams. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-03ipa: rkisp1: blc: Query black levels from camera sensor helperStefan Klug
As the camera sensor helper now has the ability to provide the black level, use it. Black levels can still be overwritten by the tuning file, but the direction is to remove them from the tuning files and move them into the sensor helpers. Additionally interpret all values based on 16bits. The conversion to the scale required by the hardware is done in process(). It ensures all the values inside libcamera are the same scale and is in preparation for the i.MX8MP where black levels are based on a 20bit scale. Note that this breaks existing tuning files. The tuning files distributed with libcamera will be fixed in a later patch. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-03ipa: rkisp1: Move camHelper into IPAContextStefan Klug
To be able to query the black levels, the black level correction algorithm needs access to the camera sensor helper. Allow this by moving the camHelper_ member from IPARkISP1 into IPAContext. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-03ipa: libipa: Add black levels to camera sensor helperStefan Klug
For a proper tuning process we need to know the sensor black levels. In most cases these are fixed and not reported by the kernel driver. Store them inside the sensor helpers for later retrieval by the algorithms. Add black level value corresponding to the data pedestal for three initial sensors as documented in the datasheets. More should be added, eventually filling the gaps for all supported sensors. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-03libcamera: converter: Replace usage of stream index by Stream pointerUmang Jain
The converter interface uses the unsigned int output stream index to map to the output frame buffers. This is cumbersome to implement new converters because one has to keep around additional book keeping to track the streams with their correct indexes. The v4l2_converter_m2m and simple pipeline handler are adapted to use the new interface. This work roped in software ISP as well, which also seems to use indexes (although it doesn't implement converter interface) because of a common conversionQueue_ queue used for converter_ and swIsp_. The logPrefix is no longer able to generate an index from a stream, and is updated to be more expressive by reporting the stream configuration instead, for example, reporting "1920x1080-MJPEG" in place of "stream0". Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> # sm8250 RB5
2024-07-03converter: converter_v4l2_m2m: Rename private Stream classUmang Jain
Rename the private Stream class from V4L2M2MConverter::Stream to V4L2M2MConverter::V4L2M2MStream. This is done to improve readability of the code when we drop the handling of stream by indexes in a subsequent patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-03libcamera: software_isp: Drop unnecessary sanity checkUmang Jain
Currently the soft-isp outputs a single output stream. Hence, drop the unnecessary check for stream indexes. Another reason to drop is actually the stream indexes is meant to be unique in outputs std::map<>, hence checking for unique stream indexes is redundant. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-03converter: converter_v4l2_m2m: Rectify streams sanity checkUmang Jain
The streams sanity check tries to determine if all the stream indexes passed in outputs std::map<> are unique. However, since the data container is std::map<>, all its keys (stream indexes in this case), are already unique. Instead, rectify the sanity check to ensure all the framebuffers passed in the outputs std::map<> are unique to each index. Hence, no two stream indexes should have same framebuffer. Update the comment to reflect the change. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-01apps: common: dng_writer: Fix RAW10 and RAW12 packing on BE machinesLaurent Pinchart
The 16-bit padded raw 10 and raw 12 formats are stored in memory in little endian order, regardless of the machine's endianness. Read pixel data as uint8_t values and hardcode bit shifting to little endian to fix scanline packing. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-07-01apps: common: dng_writer: Fix thumbnail generation on BE machinesLaurent Pinchart
The 16-bit padded raw 10 and raw 12 formats are stored in memory in little endian order, regardless of the machine's endianness. Swap the 16-bit values on big-endian machines when reading pixels from memory to generate thumbnails. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-06-29apps: common: dng_writer: Support RAW10 and RAW12 formatStefan Klug
Add support for RAW10 and RAW12 to the dng_writer. This is needed on imx8mp to produce tuning images. Both formats were tested on a debix som with a imx335. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-29apps: common: dng_writer: Add thumbnail scanline function for RawStefan Klug
Add a thumbnail function for raw formats that are 16bit aligned. This is needed for the upcoming RAW10 and RAW12 implemntation. Use the new function for RAW16 as the thumbScanlineRaw_CSI2P produces incorrect results for that format (it averages over adjacent bytes, which works for the CSI formats). Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-29apps: common: dng_writer: Rename packing functionsStefan Klug
The old names lead to confusions. Rename to better express the intent. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>