summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-05-31utils: checkstyle.py: Extend IncludeChecker to cover math.hLaurent Pinchart
math.h is an exception to the C compatibility header rule, as we prefer using cmath. Extend the IncludeCheck to warn about it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-31utils: checkstyle.py: Refactor IncludeCheckerLaurent Pinchart
The IncludeCheck warns when code uses C++ standard library headers where corresponding C compatibility headers are preferred. We have an exception to that rule for math.h, where cmath is prefered. In order to prepare for extending checkstyle.py to enforce that rule, refactor the way the IncludeChecker identifies headers. No functional change is intended. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-31test: ipa: rkisp1-utils: Fix capitalization of hex numbersPaul Elder
Fix capitalization of the hexdecimal numbers in the test for conversion between floating point and fixed point numbers. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-31ipa: rkisp1: Add a helper to convert floating-point to fixed-pointPaul Elder
Add helper functions for converting between floating point and fixed point numbers. Also add tests for them. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-27android: camera_capabilities: Fix GCC 14 warningBarnabás Pőcze
GCC 14 thinks `rects` is a "possibly dangling reference to a temporary": /libcamera/src/android/camera_capabilities.cpp: In member function ‘int CameraCapabilities::initializeStaticMetadata()’: /libcamera/src/android/camera_capabilities.cpp:1084:46: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 1084 | const Span<const Rectangle>& rects = | ^~~~~ /libcamera/src/android/camera_capabilities.cpp:1085:83: note: the temporary was destroyed at the end of the full expression ‘(& properties)->libcamera::ControlList::get<libcamera::Span<const libcamera::Rectangle> >(libcamera::properties::PixelArrayActiveAreas).std::optional<libcamera::Span<const libcamera::Rectangle> >::value_or<libcamera::Span<const libcamera::Rectangle> >(libcamera::Span<const libcamera::Rectangle>())’ 1085 | properties.get(properties::PixelArrayActiveAreas).value_or(Span<const Rectangle>{}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ The return value of `value_or()` is indeed a temporary, but binding it to a reference extends its lifetime. Avoid the warning by not using a reference; this does not make much difference since `value_or()` does not return a reference. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.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-05-27ipa: rpi: Make monoSensor() accessor constLaurent Pinchart
The ipa::RPi::IpaBase::monoSensor() function doesn't modify the class. Make it const. Fixes: 2031e2f29014 ("ipa: rpi: Add accessor function for monoSensor_") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-05-21libcamera: yaml_parser: Avoid double lookup in `operator[]`Barnabás Pőcze
`YamlObject::contains()` does the same search, doing the lookup twice is unnecessary. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-21treewide: Query list of cameras just onceBarnabás Pőcze
This is more efficient since only a single vector will be constructed, and furthermore, it prevents the TOCTOU issue that might arise when the list of cameras changes between the two queries. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-19libcamera v0.3.0Kieran Bingham
abi-compliance checker reports 99.7% binary compatibility and 99.9% source compatibility between v0.2.0 and v0.3.0. The SONAME has been updated accordingly and applications must be relinked against this version of libcamera. Total binary compatibility problems: 2, warnings: 0 Total source compatibility problems: 2, warnings: 0 Specifically, the symbol - ControlList::merge(struct ControlList const& source ) has been replaced with the new symbol: - ControlList::merge ( struct ControlList const& source, enum ControlList::MergePolicy policy ) The following commits in this release relate to either a bug fix or improvement to existing commit. - utils: ipc: extract-docs: Fix escape characters in regex - Reported-by: Nicolas Dufresne <nicolas@ndufresne.ca> - libcamera: Remove empty formats.c - Fixes: e0a51061bc69 ("libcamera: formats: Add 14-bits Bayer RAW formats") - libcamera: bayer_format: Add Y12 to bayerToFormat - Fixes: ec6309571654 ("libcamera: bayer_format: Add unpacked mono 12-bit format to the conversion table") - apps: common: dng_writer: Add a default case for switch-case on a modulo - Bug: https://bugs.libcamera.org/show_bug.cgi?id=207 - utils: mojom: Fix build error caused by the mojom tool update - Fixes: d17de86904f0 ("utils: ipc: Update mojo") - libcamera: formats: Fix planes bounds check - Fixes: e83727a194b5 ("libcamera: PixelFormatInfo: Add functions stride and frameSize") - utils: ipu3: Fix return value check on file output - Fixes: 23ac77dc4a09 ("utils: ipu3: Add IPU3 raw capture unpack utility") - ipa: libipa: histogram: Fix documentation of constructor - Fixes: 1dc01bc9e6c3 ("ipa: libipa: histogram: Add transform parameter to constructor") - gstreamer: Fix string memory leak - Fixes: fc9783acc6083a ("gstreamer: Provide colorimetry <> ColorSpace mappings") - gstreamer: Use copied camera name - Fixes: 58feb69f852289 ("gst: libcamerasrc: Implement selection and acquisition") core: - include: linux: Update kernel headers to version v6.7 - libcamera: v4l2_subdevice: Enable streams API when supported - libcamera: base: signal: Update Qt documentation link to Qt 6 - Documentation: Update Qt documentation links to Qt 6 - test: gstreamer: Use env instead of registry edit - libcamera: Remove empty formats.c - libcamera: formats: Add 16-bit mono format - libcamera: formats: Fix sort ordering of R10_CSI2P - libcamera: bayer_format: Add Y12 to bayerToFormat - libcamera: v4l2_subdevice: Explain sort order of formatInfoMap - libcamera: object: Fix thread-bound reference in documentation - libcamera: signal: Replace object.h inclusion with forward declatation - test: object-delete: Test deferred delete just before thread stops - libcamera: thread: Ensure deferred deletion of all objects before stopping - test: event-thread: Destroy Object from correct thread context - test: message: Remove incorrect slow receiver test - test: message: Destroy Object from correct thread context - test: signal-threads: Destroy Object from correct thread context - test: timer-thread: Move timer start from wrong thread to separate test - test: timer-thread: Destroy Object from correct thread context - libcamera: object: Document and ensure Object deletion constraints - libcamera: object: Add and use thread-bound assertion - utils: mojom: Fix build error caused by the mojom tool update - include: linux: Add RKISP1_V_IMX8MP version - libcamera: utils: Add to_underlying() helper function - libcamera: Use utils::to_underlying() - libcamera: formats: Fix typos in PixelFormatInfo documentation - utils: checkstyle.py: Don't presume python3 location - utils: checkstyle.py: Update LogCategoryChecker regexp - utils: rkisp1: gen-csc-table.py: Don't presume python3 location - libcamera: formats: Fix planes bounds check - utils: ipu3: Fix return value check on file output - README.rst: Report py dependencies - meson_options: Autodetect pycamera support - libcamera: controls: Fix typo on thermal - guides: pipeline-handler: Fix controlInfo_ initialization - libcamera: v4l2_subdevice: Add 14-bit Bayer formats - utils: checkstyle.py: Add Co-developed-by to known_trailers - utils: checkstyle.py: Fix known_trailers sort order - libcamera: framebuffer_allocator: Move from argument in constructor - libcamera: framebuffer_allocator: Use default destructor - libcamera: framebuffer_allocator: Remove entry if allocation fails - libcamera: controls: Add policy parameter to ControlList::merge() - libcamera: v4l2_subdevice: Rename V4L2SubdeviceFormatInfo - libcamera: v4l2_subdevice: Add code member to MediaBusFormatInfo - libcamera: v4l2_subdevice: Expose media bus format info as internal API - libcamera: v4l2_subdevice: Extend MediaBusFormatInfo with metadata formats - libcamera: v4l2_subdevice: Drop V4L2SubdeviceFormat::bitsPerPixel() - libcamera: v4l2_subdevice: Rename V4L2SubdeviceFormat::mbus_code to code - libcamera: v4l2_subdevice: Add stream support to get/set functions - libcamera: v4l2_subdevice: Replace Routing::toString() with operator<<() - libcamera: v4l2_subdevice: Add V4L2Subdevice::Route structure - libcamera: camera_sensor: Move related classes to subdirectory - libcamera: camera_sensor: Drop updateControlInfo() function - libcamera: camera_sensor: Reorder functions - libcamera: camera_sensor: Test for read-only HBLANK with READ_ONLY flag - libcamera: camera_sensor: Expose the Bayer order - checkstyle: Work around bug in difflib - utils: tuning: readme: Improve names of dependency packages - libcamera: internal: Move dma_heaps.[h, cpp] to common directories - libcamera: dma_heaps: extend DmaHeap class to support system heap - libcamera: internal: Move SharedMemObject class to a common directory - libcamera: shared_mem_object: Rename SIZE constant to `size' - libcamera: shared_mem_object: Reorganize the code and document the SharedMemObject class - libcamera: software_isp: Add SwStatsCpu class - libcamera: software_isp: Add Debayer base class - libcamera: software_isp: Add DebayerCpu class - libcamera: Introduce SoftwareIsp - libcamera: swstats_cpu: Add support for 8, 10 and 12 bpp unpacked bayer input - libcamera: debayer_cpu: Add support for 8, 10 and 12 bpp unpacked bayer input - libcamera: debayer_cpu: Add BGR888 output support - libcamera: Add "Software ISP benchmarking" documentation - libcamera: software_isp: Apply black level compensation - Documentation: coding-style: Clean up header guard style - utils: checkstyle.py: Use r'' strings for regular expressions - utils: checkstyle.py: Drop period at end of Doxygen one liners - libcamera: device_enumerator: Fix spell error - libcamera: Fix output spelling error - libcamera: utils: Avoid infinite recursion with strtod() - libcamera: shared_mem_object: Fix compilation with uClibc - meson: Deprecate bitwise operations between different enumeration type - Revert "meson: Deprecate bitwise operations between different enumeration type" - test: Don't add current build directory to include path - libcamera: controls: Generate enum value-name maps - libcamera: Drop file name from header comment blocks - libcamera: Drop file name from header comment blocks in templates - libcamera: Drop remaining file name from header comment blocks - test: gstreamer: Simplify single stream test - Documentation: Add option to treat Doxygen warnings as errors - libcamera: camera_manager: Add environment variable to order pipelines match - include: linux: Add RGB48 formats - libcamera: formats: Add RGB48 formats - include: linux: Add PiSP specific image and config buffer formats - libcamera: formats: Add PiSP specific image and config buffer formats - libcamera: v4l2_subdevice: Add missing MEDIA_BUS_FMT_xxxx16_1X16 info pipeline: - pipeline: rpi: Always initialize the embedded buffer in tryRunPipeline - pipeline: rpi: vc4: Use an unpacked format if no packed one is available - pipeline: simple: Add support for MediaTek MT8365 platforms - libcamera: pipeline: Add Mali-C55 ISP pipeline - libcamera: pipeline: simple: fix size adjustment in validate() - libcamera: pipeline: simple: Rename converterBuffers_ and related vars - libcamera: pipeline: simple: Enable use of Soft ISP and Soft IPA - ipu3: Use posix basename - pipeline: rpi: Avoid duplicating size range for the same pixel format - libcamera: pipeline: Rename pipelines to a shorter name - libcamera: pipeline: Add a get factory by name helper ipa: - libipa: camera_sensor_helper: Mark createInstance() with override - utils: ipc: extract-docs: Fix escape characters in regex - ipa: rkisp1: agc: Wrap variable length C arrays in spans - ipa: rkisp1: Store hardware parameters in IPA context - ipa: rkisp1: Fix histogram weights configuration - ipa: rkisp1: Support the i.MX8MP ISP version - ipa: rpi: cam_helper: Extend embedded data parsing to RAW14 modes - utils: ipc: Fix event functions with no parameters - utils: ipc: Fix async main interface functions with no parameters - libcamera: ipa: Add Soft IPA - libcamera: libipa: camera_sensor: Add Sony IMX283 sensor properties - libcamera: libipa: camera_sensor: Add Sony IMX335 sensor properties - libcamera: libipa: camera_sensor: Add Sony IMX415 sensor properties - ipa: libipa: Allow creation of empty Histogram - ipa: libipa: Add ExposureModeHelper - ipa: libipa: Add AgcMeanLuminance base class - ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance - ipa: ipu3: Remove bespoke AGC functions from IPU3 - ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance - ipa: rkisp1: Remove bespoke Agc functions - ipa: libipa: histogram: Add transform parameter to constructor - ipa: rpi: Fix for incorrectly reported max shutter speed - ipa: rkisp1: agc: Fix histogram construction - ipa: libipa: histogram: Fix documentation of constructor - ipa: rpi: Add HDR support - ipa: rpi: Add accessor function for monoSensor_ apps: - gstreamer: Add meson devenv support - apps: common: dng_writer: Add a default case for switch-case on a modulo - doc: gstreamer: Add missing queues - gstreamer: Map R8/R16 pixel format - gstreamer: Map 10/12/14/16 bayer formats supports - cam: capture_script: Make parseRectangles work for non-array - apps: lc-compliance: Check that requests complete successfully - apps: lc-compliance: Fix typo in comment - apps: lc-compliance: Re-organize source directory - android: camera_device: Save capture settings unconditionally - v4l2: Unset _TIME_BITS in addition to _FILE_OFFSET_BITS - v4l2: meson: Keep defines sorted alphabetically - apps: cam: Add support for PPM output format - android: camera_device: Always clear descriptors_ in stop() - apps: cam: Fix C++20 deprecation warning - apps: qcam: Use standard key sequence for quit action - gstreamer: Fix string memory leak - gstreamer: Use copied camera name Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16ipa: rpi: Add accessor function for monoSensor_Naushir Patuck
The monoSensor_ member variable will be used by the derived IPAs in an upcoming commit, so add an accessor function for it. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16ipa: rpi: Add HDR supportNaushir Patuck
Add support for the following HDR modes in the Raspberry Pi IPA: - Night mode - Single exposure mode - Multi-exposure (merged and unmerged) The algorithm is updated to expect the HDR short channel to meter explicitly for highlights. This means that it will not in general under-expose the short channel more than is actually necessary. When images don't have much saturation, it's good to detect this so that some of the boost we want to apply to the dark areas can be implemented as regular gain. This means we can then adjust the tone curve less, leading to less flat looking images. The impact on the HDR algorithm is then that this determines how we build tonemaps dynamically. The highlights are more-or-less correct now, so we have to build a power-type curve that gives us the appropriately configured targets in the lower part of the histogram. We allow the tuning file to supply the maximum spatial gain value, rather than the whole curve (though it can supply this if it wants). Some parameter defaults are tweaked to be generally better across the range of our cameras. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16libcamera: v4l2_subdevice: Add missing MEDIA_BUS_FMT_xxxx16_1X16 infoNaushir Patuck
Add the missing 16-bit MEDIA_BUS_FMT_xxxx16_1X16 definitions to the mediaBusFormatInfo table. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.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-05-16libcamera: formats: Add PiSP specific image and config buffer formatsNaushir Patuck
Add the Raspberry Pi 5 PiSP specific compressed Bayer format types 1/2: - V4L2_PIX_FMT_PISP_COMP1_xxx - V4L2_PIX_FMT_PISP_COMP2_xxx Add the Raspberry Pi 5 PiSP Frontend and Backend config formats: - V4L2_META_FMT_RPI_FE_CFG - V4L2_META_FMT_RPI_BE_CFG Add the Raspberry Pi 5 PiSP Frontend statistics format: - V4L2_META_FMT_RPI_FE_STATS Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16include: linux: Add PiSP specific image and config buffer formatsNaushir Patuck
Add the Raspberry Pi 5 PiSP specific compressed Bayer format types 1/2: - V4L2_PIX_FMT_PISP_COMP1_xxx - V4L2_PIX_FMT_PISP_COMP2_xxx Add the Raspberry Pi 5 PiSP Frontend and Backend config formats: - V4L2_META_FMT_RPI_FE_CFG - V4L2_META_FMT_RPI_BE_CFG Add the Raspberry Pi 5 PiSP Frontend statistics format: - V4L2_META_FMT_RPI_FE_STATS The corresponding changes submitted to the linux-media mailing list can be found at: (series "media: raspberrypi: Add support for PiSP Back End") https://lore.kernel.org/linux-media/20240502110503.38412-4-jacopo.mondi@ideasonboard.com/ https://lore.kernel.org/linux-media/20240502110503.38412-5-jacopo.mondi@ideasonboard.com/ and for the DRM mailing at: (patch "[RFC] drm/fourcc: Add RPI modifiers") https://lore.kernel.org/dri-devel/20240226153854.99471-1-jacopo.mondi@ideasonboard.com/ Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16libcamera: formats: Add RGB48 formatsNaushir Patuck
Add support for 16-bps (48-bpp) RGB output formats to libcamera. These new formats are defined for the RGB and BGR ordering. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16include: linux: Add RGB48 formatsNaushir Patuck
Add support for 16-bps (48-bpp) RGB output formats in the uapi headers. These new formats are defined for the RGB and BGR ordering. The corresponding change submitted to the linux-media and DRM mailing lists can be found at: https://lore.kernel.org/linux-media/20240502110503.38412-3-jacopo.mondi@ideasonboard.com/ and https://lore.kernel.org/dri-devel/20240226132544.82817-1-jacopo.mondi@ideasonboard.com/ respectively. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-14libcamera: camera_manager: Add environment variable to order pipelines matchJulien Vuillaumier
To match the enumerated media devices, each registered pipeline handler is used in no specific order. It is a limitation when several pipelines can match the devices, and user has to select a specific pipeline. For this purpose, environment variable LIBCAMERA_PIPELINES_MATCH_LIST is created to give the option to define an ordered list of pipelines to match on. LIBCAMERA_PIPELINES_MATCH_LIST="<name1>[,<name2>[,<name3>...]]]" Example: LIBCAMERA_PIPELINES_MATCH_LIST="rkisp1,simple" Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-14libcamera: pipeline: Add a get factory by name helperJulien Vuillaumier
Add a static helper to the PipelineHandlerFactoryBase class to allow retrieving a pipeline by name. Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-14libcamera: pipeline: Rename pipelines to a shorter nameJulien Vuillaumier
The PipelineHandlerFactoryBase class has a name that is propagated to the PipelineHandler instance it creates. In present implementation, this name comes from the REGISTER_PIPELINE_HANDLER registration macro. It corresponds to the stringified name of the PipelineHandler derived class. Therefore, PipelineHandler factories and instances names can be quite long such as "PipelineHandlerRkISP1". A libcamera user may have to explicitly refer to a PipelineHandler name for configuration purpose: one usage of the name can be to define a pipeline handlers match list and their priorities. It is desired, for user convenience, to use a short name to designate a pipeline handler. Reusing the short pipeline names already defined in the meson option files is an existing and consistent way of naming pipelines. This change adds an explicit name parameter to the REGISTER_PIPELINE_HANDLER registration macro. That parameter is used to define the name of a pipeline handler factory, instead of the current pipeline handler class name. Each pipeline registration is updated accordingly. The short name assigned corresponds to the pipeline directory name in the source tree. It is consistent with pipelines names used in meson. Changing the pipeline name has an impact on the IPA modules: each module defines a IPAModuleInfo structure. This structure has a pipelineName member defining the pipeline handler name it shall match with. Therefore, each internal IPA module definition has to be changed to have its IPAModuleInfo pipelineName name updated with the short pipeline handler name. In addition to this pipelineName member, the IPAModuleInfo structure also has a name member, associated to the IPA module name. Having renamed the pipelines to a short name, the pipeline name and the IPA module names of the IPAModuleInfo structure are the same: for in-tree IPA, they correspond to the respective pipeline and IPA subdirectories in the source tree. However the IPA name could be different, for instance with a close source IPA implementation built out-of-tree. Thus, it makes sense to keep the IPA name in that structure, as the 2 definitions may not always be redundant. Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> [Kieran: Adjust for clang-format style fix, reformat commitmsg] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-14gstreamer: Use copied camera nameBarnabás Pőcze
The camera name is copied in gst_libcamera_src_open() as we can't hold the lock protecting the name while calling GST_ELEMENT_ERROR(). The GST_ELEMENT_ERROR() macro sends a message on the bus, taking more locks and possibly causing issues. However, the current code makes the copy, but does not actually use it. So fix that. Fixes: 58feb69f852289 ("gst: libcamerasrc: Implement selection and acquisition") Signed-off-by: Barnabás Pőcze <pobrn@protonmail.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-05-14gstreamer: Fix string memory leakBarnabás Pőcze
The string returned by `gst_video_colorimetry_to_string()` has to be freed, this was missing. Fixes: fc9783acc6083a ("gstreamer: Provide colorimetry <> ColorSpace mappings") Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-14Documentation: Add option to treat Doxygen warnings as errorsLaurent Pinchart
A new Doxygen warning introduced in a recent commit went unnoticed, both in manual tests and in CI. Unlike C/C++ warnings that are treated as errors, we don't fail the build with Doxygen warnings. This is due to the fact that the libcamera documentation compiles cleanly only with quite recent versions of Doxygen. Enabling the WARN_AS_ERROR Doxygen option unconditionally could bother many users. To improve the situation, add a meson option to treat Doxygen warnings as errors. The option is disabled by default, preserving the current behaviour, and will be enabled in CI builds. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-13test: gstreamer: Simplify single stream testNicolas Dufresne
The single stream test for the GStreamer component has a simple pipeline construction using only a fakesink. The implementation currently supports connecting to a more complex stream construction defined by the streamDescription, but this is over engineered for the simple need to start a stream to capture and discard the frames. Convert the use of gst_parse_bin_from_description_full() which uses only a single element 'fakesink' to construct the fakesink directly and link it to the libcamerasrc. 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-13ipa: libipa: histogram: Fix documentation of constructorLaurent Pinchart
Commit 1dc01bc9e6c3 ("ipa: libipa: histogram: Add transform parameter to constructor") added a new constructor for the Histogram class. The implementation is inline in the header file, and the documentation was added in the corresponding .cpp file, but it missed the \fn directive. This causes Doxygen to complain: src/ipa/libipa/histogram.h:31: warning: Member Histogram(Span< const uint32_t > data, Transform transform) (function) of class libcamera::ipa::Histogram is not documented. src/ipa/libipa/histogram.cpp:59: warning: libcamera::ipa::Histogram::bins has @param documentation sections but no arguments Fix it. Fixes: 1dc01bc9e6c3 ("ipa: libipa: histogram: Add transform parameter to constructor") 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-05-09libcamera: Drop remaining file name from header comment blocksLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment blocks in all remaining locations that were not caught by the automated script as they are out of sync with the file name. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-05-09libcamera: Drop file name from header comment blocks in templatesLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment blocks in template files and templates embedded in generator scripts. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-05-09ipa: rkisp1: agc: Fix histogram constructionPaul Elder
This histogram reported by the rkisp1 hardware is 20 bits, where the upper 16 bits are meaningful integer data and the lower 4 bits are fractional and meant to be discarded. Remove these 4 bits when construction the histogram. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-09ipa: rpi: Fix for incorrectly reported max shutter speedNaushir Patuck
The maximum shutter speed calculation in the cam-helper relied on the frame duration limits being correctly set in the cam-helper's mode structure. This was not the case on first startup, so the maximum shutter speed reported back via the ControlInfo was incorrect. Fix this by setting up the camera mode in the cam-helper before querying for the max shutter value. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-09pipeline: rpi: Avoid duplicating size range for the same pixel formatDavid Plowman
Some V4L2 formats translate to the same pixel format, e.g. YU12 and YM12 both produce YUV420. In this case our ISP driver advertises the same size range for both, but we must not record the same thing twice for the same pixel format (which will cause a failure later on). Instead, ignore the V4l2 format if the pixel format has already been seen. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-09ipa: libipa: histogram: Add transform parameter to constructorPaul Elder
Add a parameter to the histogram constructor that takes a transformation function to apply to all the bins upon construction. This is necessary notably for the rkisp1, as the values reported from the hardware are 20 bits where the upper 16-bits are meaningful integer values and the lower 4 bits are fractional and meant to be discarded. As adding a right-shift parameter is probably too specialized, a generic function is added as a parameter instead. While at it, optimize the existing constructor to avoid push_back() into a vector with a known final size. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-08libcamera: Drop file name from header comment blocksLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment block. The change was generated with the following script: ---------------------------------------- dirs="include/libcamera src test utils" declare -rA patterns=( ['c']=' \* ' ['cpp']=' \* ' ['h']=' \* ' ['py']='# ' ['sh']='# ' ) for ext in ${!patterns[@]} ; do files=$(for dir in $dirs ; do find $dir -name "*.${ext}" ; done) pattern=${patterns[${ext}]} for file in $files ; do name=$(basename ${file}) sed -i "s/^\(${pattern}\)${name} - /\1/" "$file" done done ---------------------------------------- This misses several files that are out of sync with the comment block header. Those will be addressed separately and manually. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-05-08ipa: rkisp1: Remove bespoke Agc functionsDaniel Scally
Now that the rkisp1 Agc algorithm is a derivation of MeanLuminanceAgc we can remove the bespoke functions from the IPA's class. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-08ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminanceDaniel Scally
Now that we have a AgcMeanLuminance class that centralises our AEGC algorithm, derive the RkISP1's Agc class from it and plumb in the necessary framework to enable it to be used. For simplicities sake this commit switches the algorithm to use the derived class, but does not remove the bespoke functions at this time. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-08ipa: ipu3: Remove bespoke AGC functions from IPU3Daniel Scally
Now that the IPU3's Agc is derived from MeanLuminanceAgc we can delete all the unecessary bespoke functions. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-08ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminanceDaniel Scally
In preparation for switching to a derivation of AgcMeanLuminance, add a function to parse and store the statistics for easy retrieval in an overriding estimateLuminance() function. Now that we have a MeanLuminanceAgc class that centralises our AEGC algorithm, derive the IPU3's Agc class from it and plumb in the necessary framework to enable it to be used. For simplicity's sake this commit switches the algorithm to use the derived class, but does not remove the bespoke functions at this time. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-08ipa: libipa: Add AgcMeanLuminance base classDaniel Scally
The Agc algorithms for the RkIsp1 and IPU3 IPAs do the same thing in very large part; following the Rpi IPA's algorithm in spirit with a few tunable values in that IPA being hardcoded in the libipa ones. Add a new base class for AgcMeanLuminance which implements the same algorithm and additionally parses yaml tuning files to inform an IPA module's Agc algorithm about valid constraint and exposure modes and their associated bounds. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-08ipa: libipa: Add ExposureModeHelperPaul Elder
Add a helper for managing exposure modes and splitting exposure times into shutter and gain values. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-08libcamera: controls: Generate enum value-name mapsDaniel Scally
Generate maps for each control enum which associate strings that represent the enum values with the values themselves. This change will allow us to refer to enumerated control values using the string. For example if we want to pass variables to an algorithm for use when a control has a particular value we can embed within tuning files a dictionary that uses the control values as keys. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-08ipa: libipa: Allow creation of empty HistogramDaniel Scally
For convenience's sake allow the creation of empty Histograms so they can be embedded within other Classes and filled out with data at some later point in time. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-07Revert "meson: Deprecate bitwise operations between different enumeration type"Laurent Pinchart
Enabling -Wdeprecated-enum-enum-conversion by default turned out to be a too hasty decision. It causes compilation failures with Qt headers prior to Qt v5.15.8. As the previous LTS versions of Debian and Ubuntu ship older Qt versions, those errors cause real inconvenience to users. This reverts commit bf4695266bfca8cc21bcf10a3281e874ebce0d27. The original goal of avoiding C++20 compilation regressions is still handled through a test in CI. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-07test: Don't add current build directory to include pathLaurent Pinchart
Meson adds the current source and build directory to the include path by default. This causes a namespace clash in tests when using C++20, as the Span class test is compiled into a binary named 'span', which then gets included by source code through indirect '#include <span>' directives. Unsurprisingly, the compiler doesn't react happily when fed binary data. We could work around the problem by renaming the test executable, but disabling the implicit inclusion of the local directory is a more generic solution that will avoid similar issues in the future. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-05-03meson: Deprecate bitwise operations between different enumeration typeLaurent Pinchart
C++20 deprecates bitwise operations between different enumeration types. This is a bad practice even in C++17, so enable the deprecation warning. Doing so ensures no such operations will be added. 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-05-03apps: qcam: Use standard key sequence for quit actionLaurent Pinchart
Replace the manual CTRL+Q key sequence with QKeySequence::Quit. This automatically maps to the native shortcut for the quit action, regardless of the platform. Even though we don't expect qcam to run on non-Linux platform, using a QKeySequence is still a good practice when one exists. This doesn't change qcam's behaviour, as the native quit key sequence is CTRL+Q on Linux systems. 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-05-03libcamera: shared_mem_object: Fix compilation with uClibcLaurent Pinchart
uClibc doesn't provide a memfd_create() implementation. Fix it by using a direct syscall when the function isn't available. 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-05-03libcamera: utils: Avoid infinite recursion with strtod()Laurent Pinchart
When the C library doesn't provide local object support, the utils::strtod() function simply calls strtod() from the C library. The current implementation does so incorrectly, and calls utils::strtod() instead, resulting in infinite recursion. Fix it with a proper namespace qualifier. 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-05-03libcamera: libipa: camera_sensor: Add Sony IMX415 sensor propertiesAlexander Stein
Provide the Sony IMX415 camera sensor properties and registration with libipa for the gain code helpers. The test patterns exposed by the IMX415 do not map well to the current set of test pattern controls supplied by libcamera. These are left intentionally unimplemented. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.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>
2024-05-03apps: cam: Fix C++20 deprecation warningBarnabás Pőcze
C++20 deprecated implicit capture of `this` via `[=]`. Fix that by explicitly capturing the necessary variables. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.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-05-03libcamera: libipa: camera_sensor: Add Sony IMX335 sensor propertiesKieran Bingham
Provide the Sony IMX335 camera sensor properties and registration with libipa for the gain code helpers. The test patterns exposed by the IMX335 do not map well to the current set of test pattern controls supplied by libcamera. These are left intentionally unimplemented. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-03libcamera: libipa: camera_sensor: Add Sony IMX283 sensor propertiesKieran Bingham
Provide the IMX283 camera sensor properties and registration with libipa for the gain code helpers. The test patterns exposed by the IMX283 do not map well to the current set of test pattern controls supplied by libcamera. These are left intentionally unimplemented. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-04-20android: camera_device: Always clear descriptors_ in stop()Anle Pan
When flush() is called and then a new stream configuration is set, the descriptors_ queue might have a chance to be not cleared in stop(), as the Camera is already in Stopped state. This will prevent further requests from being completed in sendCaptureResults() as the descriptors_ queue is not empty. To fix the issue, clear the descriptors_ even if the Camera State is Stopped. As a drawback the libcamera::Camera::stop() function might be called twice, but this is allowed by the Camera state machine, and the second call is guaranteed to be a nop. Signed-off-by: Anle Pan <anle.pan@nxp.com> Signed-off-by: Fang Hui <hui.fang@nxp.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>