summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
3 dayslibcamera: introduce rcar-gen4 supportrcar-gen4Jacopo Mondi
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-23libcamera v0.4.0Kieran Bingham
The abi-compliance-checker reports that there is both ABI and API breakage in this release. Binary compatibility: 91.2% Source compatibility: 98.9% Total binary compatibility problems: 69, warnings: 0 Total source compatibility problems: 9, warnings: 0 This is not too surprising as this was the reason for the extra delay holding up this release, and as such this release bumps the SONAME to 0.4 accordingly. The majority of the ABI breakages are around the public API for Control handling and definitions, which have caused underlying identifiers to be changed, and the reuqired storage for controls has increased. I hope that grouping the expected ABI and API breakages and delaying this release will allow a longer stability on the 0.4 series but as we are developing rapidly this can not be guaranteed, though we aim to minimise disruption to distributions and applications whereever possible. This release brings in 253 commits, with substantial development on image control and tuning features for IPA and Pipeline handlers supporting libipa, as well as integrating libipa support for IPA handling on the ARM Mali-C55 ISP. A new 'Virtual Pipeline Handler' has been introduced to support more testing in CI and virtual environments. Gstreamer has had some interesting development to rework expressing the full control set from libcamera using auto generation from the full control descriptors. A key and notable change in this release too is that the softISP is now moving towards utilising the libipa implementaitons which will enable future tuning and image control capabilities, and should also support future development on a GPU-ISP implementation for GPU-accelerated handling. I do believe this work may have introduced an oscillation regression in the AEGC which will need to be investigated and fixed in the near future, but I don't want to hold up progressing the ABI updates at this stage. The i.MX8MP can now make full use of the DW100 Dewarp Engine for full rotation and digital zoom capabilities. Raspberry Pi systems now have improved support for the OV7251, IMX462, and IMX327 Sensors, and libipa platforms can now make use of the GalaxyCore gc05a2 and gc08a3 Image sensors. The following commits in this release relate to either a bug fix or an improvement to an existing commit. - ipa: rpi: Use std::abs() - Reported-by: Maarten Lankhorst <dev@lankhorst.se> - libcamera: rkisp1: Clamp stream configuration to ISP limit on raw path - Fixes: 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") - libcamera: rkisp1: Rectify SensorConfiguration check - Fixes: 047d647452c4 ("libcamera: rkisp1: Integrate SensorConfiguration support") - libcamera: controls: Add missing size to control_type<Point> - Fixes: 200d535ca85f ("libcamera: controls: Add ControlTypePoint") - pycamera: Add missing code for ControlTypePoint - Fixes: 200d535ca85f ("libcamera: controls: Add ControlTypePoint") - libcamera: software_isp: Clear IPA context on configure and stop - Fixes: 04d171e6b299 ("libcamera: software_isp: Call Algorithm::queueRequest") - utils: checkstyle.py: Centralize dependency handling for checkers - Fixes: 8ffaf376bb53 ("utils: checkstyle: Add a python formatter") - test: py: Fix log level restore in SimpleTestMethods() - Fixes: 06cb7130c4fa ("py: Add unittests.py") - v4l2: v4l2_camera_proxy: Fix VIDIOC_[GS]_PARM support - Fixes: 5456e02d3f5b ("v4l2: Support setting frame rate in the V4L2 Adaptation layer") - gstreamer: Remove auto-focus-mode property from device provider - Fixes: 5a142438b025 ("gstreamer: Add enable_auto_focus option to the GStreamer plugin") - libcamera: software_isp: Clean up pending requests on stop - Bug: https://bugs.libcamera.org/show_bug.cgi?id=234 - ipa: rpi: awb: Disable CT search bias for Grey World AWB - Fixes: ea8fd63d936f ("ipa: rpi: awb: Add a bias to the AWB search") - meson: Don't unnecessarily fallback to libyuv wrap - Fixes: eeaa7de21b8c ("libcamera: pipeline: Add test pattern for VirtualPipelineHandler") - libcamera: Don't copy `StreamConfiguration` when iterating - Fixes: 4217c9f1aa86 ("libcamera: camera: Zero streams before validate()") - libcamera: software_isp: Actually apply black level from tuning data - Fixes: 41e3d61c7451 ("libcamera: software_isp: Clear IPA context on configure and stop") - gstreamer: keep same transfer with that in negotiated caps - Bug: https://bugs.libcamera.org/show_bug.cgi?id=150 - pipeline: rkisp1: Fix scope of dewarper stop() exit action - Fixes: 12b553d691d4 ("libcamera: rkisp1: Plumb the dw100 dewarper as V4L2M2M converter") - pipeline: rkisp1: Limit sensor size to max resolution - Fixes: 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") And the following updates have been made in this release, grouped by category: core: - utils: abi-compat: Disable python build - utils: abi-compat: sort meson options - libcamera: controls: Add enum names and values map to ControlId - libcamera: controls: Add array information to ControlId - libcamera: v4l2_videodevice: Add getSelection() function - libcamera: controls: Handle enum values without a cast - libcamera: Replace usage of lroundf() with std::lround() - libcamera: Replace last users of math.h - libcamera: geometry: Clarify Rectangle's top-left corner - libcamera: geometry: Add two-point Rectangle constructor - libcamera: controls: Add ControlTypePoint - libcamera: control_ids_draft: Add face detection controls - libcamera: android: Add face detection control support - libcamera: yaml_parser: Take string keys in `std::string_view` - libcamera: camera: Fix CameraConfiguration spelling error - libcamera: MappedFrameBuffer: Fix typo in comment formatting - libcamera: controls: Add missing size to control_type<Point> - libcamera: tracepoints: Fix copyright year for reproducible builds - libcamera: controls: Add vendor information to ControlId - libcamera: converter: Add interface for feature flags - libcamera: converter: Add interface to support cropping capability - libcamera: formats: Change bytesPerGroup of RGB565 and RGB565_BE from 3 to 2 - utils: checkstyle.py: Factor out common code to new CheckerBase class - utils: checkstyle.py: Turn check() into a class method for all checkers - utils: checkstyle.py: Print issues using __str__ - utils: checkstyle.py: Centralize dependency handling for checkers - libcamera: camera_sensor: Introduce CameraSensorFactory - libcamera: camera_sensor: Create abstract base class - libcamera: camera_sensor: Sort factories by priority - libcamera: pipeline_handler: Provide cancelRequest - libcamera: simple: Track requests in conversionQueue_ - libcamera: Rationalize IPA and handlers names - libcamera: Add debug control space - libcamera: Add a DebugMetadata helper - utils: Add script to generate control_ids_debug.yaml - libcamera: yaml_parser: Use std::from_chars() - libcamera: add DmaBufAllocator::exportBuffers() - libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices - libcamera: virtual: Add VirtualPipelineHandler - libcamera: virtual: Add ImageFrameGenerator - libcamera: virtual: Read config and register cameras based on the config - meson: Don't unnecessarily fallback to libyuv wrap - libcamera: Rename "shutter speed" to "exposure time" - libcamera: camera_sensor_properties: Add sensor control delays - libcamera: pipelines: Draw control delays from CameraSensor properties - libcamera: Don't copy `StreamConfiguration` when iterating - treewide: Avoid some copies in range-based for loops - libcamera: v4l2_videodevice: Clarify V4L2M2MDevice - libcamera: Extend u32 control type - libcamera: Extend u16 control type - libcamera: add method to set thread affinity - libcamera: Copy Matrix class from libipa to libcamera - libcamera: internal: Move Matrix class into libcamera namespace - libcamera: internal: matrix: Replace vector with array in constructor - libcamera: internal: Add Matrix class to build - libcamera: mali-c55: Limit max size to sensor resolution - libcamera: mali-c55: Limit ISP input size - libcamera: mali-c55: Init camera properties - libcamera: mali-c55: Simplify bufferReady() - libcamera: mali-c55: Remove MaliC55CameraData::mbusCodes() - libcamera: mali-c55: Add stride and size to rawConfig - libcamera: v4l2-subdevice: Add Mali C55 media bus formats - libcamera: bayer_format: Add 20-bit bayer formats - libcamera: mali-c55: Propagate CSI-2 format to ISP - libcamera: mali-c55: Correct input/output format representation - libcamera: mali-c55: Enable links between resizer and video node - libcamera: mali-c55: Enable usage of scaler - libcamera: mali-c55: implement support for ScalerCrop - libcamera: yaml_parser: Output more details when parsing fails - libcamera: yaml_parser: Include stdlib.h instead of cstdlib - libcamera: utils: StringSplitter: Inline some trivial methods - libcamera: utils: StringSplitter: Add `operator==` - libcamera: stream: Add operator<<(StreamConfiguration) - libcamera: yaml_parser: Improve efficiency of string empty check - libcamera: geometry: Add Rectangle::transformedBetween() - libcamera: converter_v4l2_m2m: Add missing override specifier - libcamera: converter_v4l2_m2m: Refactor get crop bounds code - libcamera: converter: Add function to query crop bounds - libcamera: converter: Add function to check if a stream was configured - libcamera: converter: Add functions to adjust config - libcamera: camera: Add a const version of the pipe() function - libcamera: camera_sensor: Add parameter to limit returned sensor size - libcamera: camera_sensor_properties: Add ov7251 and ov9281 - libcamera: rpi: Draw sensor delays from CameraSensorProperties - include: linux: Add mali-c55-config.h - include: linux: Add Mali-C55 Stats and Params V4L2 format - libcamera: mali-c55: Acquire and plumb in 3a params and stats - libcamera: controls: Populate direction field in control definitions - utils: codegen: controls.py: Parse direction information - libcamera: controls: Add support for querying direction information - libcamera: controls: Update the ColourTemperature control to be writable - utils: gen-debug-controls: Output direction flag - hooks: pre-push: Verify that co-authors have a SoB line - gitignore: Add venv directory to gitignore - CameraManager: Ensure we cleanup on failure - Add .editorconfig file - DmaBufAllocator: Add Dma Buffer synchronization function & helper class apps: - apps: cam: Print control enum values more nicely - py: Add bindings for ControlId enum name - apps: cam: Print control array sizes - apps: Replace HAVE_DNG with HAVE_TIFF - apps: cam: Print an error when outputting DNG and DNG support is missing - pycamera: Add missing code for ControlTypePoint - apps: cam: Print control vendor information when listing controls - py: Add bindings for ControlId vendor information - qcam: Automatically select the camera if only one is available - gstreamer: Implement caps negotiation for video/x-bayer - v4l2: v4l2_camera_proxy: Fix VIDIOC_[GS]_PARM support - gstreamer: Remove auto-focus-mode property from device provider - gstreamer: Remove auto-focus-mode property from libcamerasrc - gstreamer: Generate controls from control_ids_*.yaml files - py: Add bindings for ControlId array information - qcam: Use pointer when choosing camera - gstreamer: keep same transfer with that in negotiated caps - apps: cam: Print control direction information pipeline: - libcamera: software_isp: Remove superfluous includes - libcamera: software_isp: Move BlackLevel to libcamera::ipa::soft - libcamera: software_isp: Define skeletons for IPA refactoring - libcamera: software_isp: Let IPASoftSimple inherit Module - libcamera: software_isp: Make stats frame and buffer aware - libcamera: software_isp: Remove final dots in debayer.cpp docstrings - libcamera: software_isp: Track and pass frame ids - libcamera: software_isp: Create algorithms - libcamera: software_isp: Call Algorithm::configure - libcamera: software_isp: Call Algorithm::queueRequest - libcamera: software_isp: Call Algorithm::prepare - libcamera: software_isp: Call Algorithm::process - libcamera: software_isp: Move black level to an algorithm module - libcamera: software_isp: Move color handling to an algorithm module - libcamera: software_isp: Use floating point for color parameters - libcamera: software_isp: Use DelayedControls - libcamera: software_isp: Move exposure+gain to an algorithm module - libcamera: software_isp: Update black level only on exposure changes - pipeline: simple: Increase buffer count to four - libcamera: rkisp1: Eliminate hard-coded resizer limits - pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline - libcamera: software_isp: Improve wording in a comment - libcamera: rkisp1: Integrate SensorConfiguration support - libcamera: rkisp1: Clamp stream configuration to ISP limit on raw path - libcamera: rkisp1: Use const reference for sensor configuration - libcamera: rkisp1: Rectify SensorConfiguration check - libcamera: rkisp1: Maintain alphabetical order of forward declarations - libcamera: software_isp: Clear IPA context on configure and stop - libcamera: software_isp: Get black level from the camera helper - libcamera: software_isp: Black level from tuning file - libcamera: pipeline: rkisp1: Fix typo in todo task - libcamera: rkisp1: Prepare for additional camera controls - libcamera: rkisp1: Plumb the dw100 dewarper as V4L2M2M converter - pipeline: rpi: Remove CameraData::scalerCrop_ - pipeline: rpi: Pass crop rectangle as a parameter to platformSetIspCrop() - pipeline: rpi: Introduce CameraData::CropParams - pipeline: rpi: Track which ISP output is configured for a stream - pipeline: rpi: Pass ISP output index into platformSetIspCrop() - pipeline: rpi: Handler controls::rpi::ScalerCrops - libcamera: rkisp1: Create main buffer pool out of if(!isRaw) - libcamera: software_isp: Clean up pending requests on stop - libcamera: pipeline: Add test pattern for VirtualPipelineHandler - libcamera: software_isp: Refactor SoftwareIsp to use DmaBufAllocator::exportBuffers - libcamera: software_isp: Initialize exposure+gain before agc calculations - libcamera: software_isp: Remove unused IPAActiveState fields - libcamera: software_isp: Actually apply black level from tuning data - rkisp1: Use Matrix class from libcamera - libcamera: software_isp: Add support for contrast control - libcamera: software_isp: Add contrast control - pipeline: rkisp1: Fix scope of dewarper stop() exit action - pipeline: rkisp1: Keep aspect ratio on imx8mp - pipeline: rkisp1: Split inputCrop and outputCrop - pipeline: rkisp1: Reorder sensorInfo collection code - pipeline: rkisp1: Query dewarper crop bounds if no stream configured - pipeline: rkisp1: Fix ScalerCrop to be in sensor coordinates - pipeline: rkisp1: Add ScalerMaximumCrop property - pipeline: rkisp1: Refactor path validation - pipeline: rkisp1: Enable the dewarper unconditionally - pipeline: rkisp1: make RkISP1CameraConfiguration a friend of the pipeline handler - pipeline: rkisp1: Fix config validation when dewarper is used - pipeline: rkisp1: Limit sensor size to max resolution - debayer_cpu: Replace syncing DMABUFs with DmaSyncer - include: media-bus-formats: Add Mali-C55 mbus codes - mali-c55: Plumb the IPA module in ipa: - ipa: rpi: Use std::abs() - ipa: rpi: Replace last users of math.h - ipa: rpi: awb: Add a const for the default colour temperature - ipa: rpi: awb: Add a bias to the AWB search - ipa: rkisp1: algorithms: agc: Check for correct stats type - ipa: rkisp1: algorithms: awb: Check for correct stats type - ipa: rpi: Add tuning files for OV7251 - ipa: libipa: Fix ExposureModeHelper function name in documentation - ipa: rkisp1: Add constructor to the ipa context - ipa: rkisp1: Add debug metadata support to the rkisp1 - ipa: libipa: Add data accessor to Histogram - ipa: libipa: Add colour helpers - ipa: ipu3: Use centralised libipa helpers - ipa: rkisp1: Use centralised libipa helpers - ipa: rpi: Use centralised libipa helpers - ipa: rpi: awb: Disable CT search bias for Grey World AWB - libipa: FCQueue: Make sure FrameContext#0 is initialized - libcamera: libipa: camera_sensor: Provide helper and properties for Sony IMX462 - ipa: rpi: cam_helper: Add Sony IMX327 - ipa: raspberrypi: Add tuning file for IMX462 sensor - ipa: raspberrypi: Add tuning file for IMX327 sensor - libcamera: libipa: camera_sensor_helper: add IMX290 black level - ipa: libipa: vector: Add mutable x(), y() and z() accessors - ipa: libipa: vector: Add r(), g() and b() accessors - ipa: libipa: vector: Add scalar constructor - ipa: libipa: vector: Rename the dot product operator*() to dot() - ipa: libipa: vector: Generalize arithmetic operators - ipa: libipa: vector: Add missing binary arithemtic operators - ipa: libipa: vector: Add compound assignment operators - ipa: libipa: vector: Add element-wise min() and max() functions - ipa: libipa: vector: Add sum() function - ipa: ipu3: awb: Replace Awb::RGB class with ipa::RGB - ipa: libipa: colour: Use the RGB class to model RGB values - ipa: libipa: colour: Use Vector and Matrix for linear algebra - ipa: rkisp1: awb: Use RGB class to store colour gains - ipa: rkisp1: awb: Use Vector and Matrix for linear algebra - ipa: rkisp1: awb: Expand comment - libcamera: libipa: camera_sensor: Add GalaxyCore gc05a2 sensor properties - libcamera: libipa: camera_sensor: Add GalaxyCore gc08a3 sensor properties - ipa: rpi: Rename Matrix to Matrix3x3 - ipa: rpi: ccm: Replace local matrix implementation with the libcamera one - libipa: Use Matrix class from libcamera - libipa: Drop Matrix class - libipa: agc_mean_luminance: Rename yaml key from exposure-time to exposureTime - ipa: software_isp: Add constructor to the IPA context - ipa: ipu3: Add constructor to the IPA context - libcamera: libipa: camera_sensor_helper: Use `variant` instead of `union` - ipa: rpi: Fix wrong frame integration difference value for OV9281 - ipa: rpi: cam_helper: imx708: Correct the frame integration diff value - libipa: Centralise Fixed / Floating point convertors - ipa: mali-c55: Add Mali-C55 ISP IPA module - ipa: mali-c55: Add Agc algorithm - ipa: mali-c55: Add BLC Algorithm - ipa: mali-c55: Add AWB Algorithm - ipa: mali-c55: Add Lens Shading Correction algorithm - ipa: mali-c55: Add IMX415 tuning data file - ipa: rkisp1: awb: Load white balance gains from tuning file - ipa: rkisp1: awb: Implement ColourTemperature control - ipa: rpi: awb: Make it possible to set the colour temperature directly - ipa: libipa: Add Lux helper - ipa: rkisp1: Add Lux algorithm module - controls: rpi: Add a vendor rpi::ScalerCrops control documentation: - Documentation: guides: Fix FileSink source link test: - test: py: Fix log level restore in SimpleTestMethods() - test: py: Replace environment array with environment object - test: py: LD_PRELOAD the C++ standard library when using ASan - test: libipa: Add Vector class test - test: span: Use intended variable tuning: - utils: tuning: libtuning: Fix tuning for non RGGB RAWs - libtuning: Use logging framework in ctt_awb.awb() - libtuning: Remove the Cam object from ctt_awb.awb() - libtuning: Fix access to color member in ctt_awb.awb() - libtuning: Add initial AWB module - utils: tuning: rkisp1: Replace static AWB with new AWB module Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-23utils: gen-debug-controls: Output direction flagStefan Klug
The yaml definitions for controls now require a direction attribute which is not auto generated by gen-debug-controls.py. Fix that. 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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-23ipa: rkisp1: Add Lux algorithm modulePaul Elder
Add a lux algorithm module to rkisp1 IPA for estimating the lux level of an image. This is reported in metadata, as well as saved in the frame context so that other algorithms (mainly AGC) can use its value. It does not set any controls. 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> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2024-12-23ipa: libipa: Add Lux helperPaul Elder
Add a Lux helper to libipa that does the estimation of the lux level given gain, exposure, and luminance histogram. The helper also handles reading the reference values from the tuning file. These are expected to be common operations of lux algorithm modules in IPAs, and is modeled/copied from Raspberry Pi. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2024-12-20ipa: rpi: awb: Make it possible to set the colour temperature directlyDavid Plowman
ColourTemperature is now exported as a writable control so that applications can set it directly. The AWB algorithm class now requires a method to be provided to perform this operation. The method should clamp the passed value to the calibrated range known to the algorithm. The default range is set very wide to cover all conceivable future AWB calibrations. It will always be clamped before use. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-20utils: tuning: rkisp1: Replace static AWB with new AWB moduleStefan Klug
The rkisp1 tuner used a static module to insert the AWB algorithm into the tuning file. Replace that with the new AWB module. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20libtuning: Add initial AWB moduleStefan Klug
This AWB module uses the awb function from Raspberry Pi to calculate the needed white balance gains per colour temperature. It stores these gains in the tuning file. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20libtuning: Fix access to color member in ctt_awb.awb()Stefan Klug
The color temperature member of the image object was named "col" in the past. Now it is named "color" (which is still not very expressive). There are still a few unspotted accesses to the col member. Fix them to access the color member. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20libtuning: Remove the Cam object from ctt_awb.awb()Stefan Klug
Replace the Cam object with a list parameter to be able to call the ctt_awb.awb() function from libtuning code. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20libtuning: Use logging framework in ctt_awb.awb()Stefan Klug
To be able to use the awb function copied from the Raspberry Pi tuning scripts in the libtuning code, we need to remove the Cam object. Use the logging framework to replace all accesses to Cam.log. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20ipa: rkisp1: awb: Implement ColourTemperature controlStefan Klug
There are many use-cases (tuning-validation, working in static environments) where a manual ColourTemperature control is helpful. Implement that by interpolating and applying the white balance gains from the tuning file according to the requested colour temperature. If colour gains are provided on the same request, they take precedence. Store the colour temperature used for a given frame in the frame context and report that in metadata. Note that in the automatic case, the colour gains are still based on the gray world model and the CT curve from the tuning file get ignored. 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-12-20ipa: rkisp1: awb: Load white balance gains from tuning fileStefan Klug
For the implementation of a manual colour temperature setting, it is necessary to read predefined colour gains per colour temperature from the tuning file. Implement this in a backwards compatible way. If no gains are contained in the tuning file, loading just continues as before. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20libcamera: controls: Update the ColourTemperature control to be writableStefan Klug
For manual control it is helpful to be able to specify a fixed colour temperature. It also provides an easy way to apply the temperature specific CCMs and colour gains that are contained in the tuning files. Document this and update the control dependencies. 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-12-18utils: tuning: libtuning: Fix tuning for non RGGB RAWsStefan Klug
Tuning fails for raw images that don't have the channels ordered in RGGB. In 19dc8c28f63c ("utils: tuning: libtuning: Implement the core of libtuning") the channels of the image were reordered to RGGB unconditionally in _read_image_dng(). That change was not applied to the ctt_awb code, so that the channels were reordered twice. Fix by removing the double ordering. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Isaac Scott <isaac.scott@ideasonboard.com> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-18apps: cam: Print control direction informationPaul Elder
Now that there is support for retrieving the allowed directions of a control, print this information when listing controls. Sample output: $ cam --list-controls -c 2 Using camera Virtual0 as cam0 Control: [inout] draft::FaceDetectMode: - FaceDetectModeOff (0) Control: [inout] libcamera::FrameDurationLimits: [16666..33333] Size: 2 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-12-18libcamera: controls: Add support for querying direction informationPaul Elder
Add support to ControlId for querying direction information. This allows applications to query whether a ControlId is meant for being set in controls or to be returned in metadata or both. This also has a side effect of properly encoding this information, as previously it was only mentioned losely and inconsistently in the control id definition. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-18utils: codegen: controls.py: Parse direction informationPaul Elder
In preparation for adding support for querying direction information from controls, parse the direction information from control ID definitions. This can later be plugged in directly to the IPA code generators simply by using ctrl.direction. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-18libcamera: controls: Populate direction field in control definitionsPaul Elder
In preparation for adding support for querying direction information from controls, populate the corresponding field in the control ID defintions. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-17ipa: mali-c55: Add IMX415 tuning data fileDaniel Scally
Add a tuning data file for the IMX415 camera sensor. The black level offset data is drawn from the camera sensor's datasheet. The lens shading tables are generated through the libtuning LSC modules. Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17ipa: mali-c55: Add Lens Shading Correction algorithmDaniel Scally
Add a lens shading correction algorithm to the mali-c55 IPA. This algorithm parses tables from Yaml in a easy to follow format before munging them into Arm's interleaved mesh to be copied to the ISP. A colour temperature estimate from the AGC statistics is used to select the appropriate table to apply; this can be some interpolation of two tables, in which case the colour temperature estimate is also used to derive the coefficient that does the blending. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17ipa: mali-c55: Add AWB AlgorithmDaniel Scally
Add a simple grey-world auto white balance algorithm to the mali-c55 IPA. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17ipa: mali-c55: Add BLC AlgorithmJacopo Mondi
Add a Black Level Correction algorithm. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17ipa: mali-c55: Add Agc algorithmDaniel Scally
Add a new algorithm and associated infrastructure for Agc. The tuning files for uncalibrated sensors is extended to enable the algorithm. Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-17mali-c55: Plumb the IPA module inJacopo Mondi
Plumb the Pipeline-IPA loop in. Load the IPA module at camera creation time and create the loop between the pipeline and the IPA. When a new Request is queued the IPA is asked to prepare the parameters buffer, once ready it notifies the pipeline which queues the parameters to the ISP along with a buffer for statistics and frames, Once statistics are ready they get passed to the IPA which upates its settings for the next frame. Driveby fix an error message in the Pipeline Handler's ::freeBuffers() function which reported a problem with the wrong video device in an error path. Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-17ipa: mali-c55: Add Mali-C55 ISP IPA moduleDaniel Scally
Add a barebones IPA module for the Mali-C55 ISP. In this initial implementation pretty much only buffer plumbing is implemented. Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-17libcamera: mali-c55: Acquire and plumb in 3a params and statsDaniel Scally
Acquire the mali-c55 3a stats and parameters video devices during ::match() and plumb them in. For this commit we simply allocate and release buffers for the statistics and parameters. Statistics buffers are queue and dequeued from the stats video device but their contents are for now untouched. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17include: linux: Add Mali-C55 Stats and Params V4L2 formatDaniel Scally
Add the new format describing the Mali C55's Statistics and Parameters to videodev2. These come from the v8 of the C55 kernel driver series [1]. Once the kernel driver is merged we can replace these temporary manual additions with updates to the scripts that merge in the kernel headers. [1] https://lore.kernel.org/linux-media/20241106100534.768400-1-dan.scally@ideasonboard.com/ Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17include: linux: Add mali-c55-config.hDaniel Scally
Add the header file describing the Mali C55's 3A statistics and parameters structures so that they can be used by the new IPA module. The header has been taken from the v6 of the patchset for the Mali C55 ISP driver submitted to linux-media, found at the link below: https://lore.kernel.org/linux-media/20240709132906.3198927-1-dan.scally@ideasonboard.com/ Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-17libipa: Centralise Fixed / Floating point convertorsDaniel Scally
The rkisp1 IPA has some utility functions to convert between fixed and floating point numbers. Move those to libipa so they're available for use in other IPA modules too. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-17libcamera: rpi: Draw sensor delays from CameraSensorPropertiesDaniel Scally
Now that we have camera sensor control application delay values in the CameraSensorProperties class, remove the duplicated definitions in the RPi IPA's CameraSensorHelpers and update the pipeline handler to use the values from CameraSensorProperties. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-17libcamera: camera_sensor_properties: Add ov7251 and ov9281Daniel Scally
Add entries for the OmniVision OV7251 and OV9281 sensors. The control delay values are drawn from the Raspberry Pi CameraSensorHelper class for these sensors - the pixel sizes from the datasheets. Both sensors are monochrome and do not have test pattern settings that correspond to defined control values. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-17pipeline: rkisp1: Limit sensor size to max resolutionStefan Klug
In RkISPPath::validate() the sensor sizes are correctly filtered to the ones supported by the ISP. But later in RkISPPipeline::configure() the configured stream size is passed to sensor->getFormat() and the CameraSensor class chooses the best sensor format for the requested stream size. This can result in a sensor format that is too big for the ISP. Fix that by supplying the maximum resolution supported by the ISP to setFormat(). Fixes: 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-12-17libcamera: camera_sensor: Add parameter to limit returned sensor sizeStefan Klug
The getFormat function takes the aspect ratio and the area of the requested size into account when choosing the best sensor size. In case the sensor is connected to an rkisp1 the maximum supported frame size of the ISP is another constraining factor for the selection of the best format. Add a maxSize parameter to support such a constraint. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17pipeline: rkisp1: Fix config validation when dewarper is usedStefan Klug
When the dewarper is used, config->validate() needs to take the restrictions of the dewarper into account. Add the corresponding checks. As the useDewarper_ variable is now accessed earlier in PipelineHandlerRkISP1::configure(), ensure it gets set early enough. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17pipeline: rkisp1: make RkISP1CameraConfiguration a friend of the pipeline ↵Stefan Klug
handler For the validate() implementation, the RkISP1CameraConfiguration needs access to dewarper related members of the PipelineHandlerRkISP1 object. Allow this access by adding const versions of the pipe accessors and making RkISP1CameraConfiguration a friend of PipelineHandlerRkISP1. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-12-17libcamera: camera: Add a const version of the pipe() functionStefan Klug
Allow access to the pipeline handler on a const instance of Camera::Private. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-12-17pipeline: rkisp1: Enable the dewarper unconditionallyStefan Klug
In configure() and in the future in generateConfiguration() the calculated stream sizes and crop rectangles depend on the dewarper being available or not. It is therefore not possible to disable the dewarper later if configuration fails. Error out in that case. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17pipeline: rkisp1: Refactor path validationStefan Klug
Refactor validation code to prepare for extensions in the upcoming patches. Code duplication is reduced by moving parts of the validation logic into a lambda function. This patch does not include any functional changes. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-12-17libcamera: converter: Add functions to adjust configJacopo Mondi
Add to the Converter interface two functions used by pipeline handlers to validate and adjust the converter input and output configurations by specifying the desired alignment for the adjustment. Add the adjustInputSize() and adjustOutputSize() functions that allows to adjust the converter input/output sizes with the desired alignment. Add a validateOutput() function meant to be used by the pipeline handler implementations of validate(). The function adjusts a StreamConfiguration to a valid configuration produced by the Converter. Signed-off-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: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-17pipeline: rkisp1: Add ScalerMaximumCrop propertyStefan Klug
The ScalerMaximumCrop property holds the biggest allowed ScalerCrop value. Add it to the rkisp1. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17pipeline: rkisp1: Fix ScalerCrop to be in sensor coordinatesStefan Klug
ScalerCrop is specified as being in sensor coordinates. The current dewarper implementation on the imx8mp handles ScalerCrop in dewarper coordinates. This leads to unexpected results and an unusable ScalerCrop control in camshark. Fix that by transforming back and forth between sensor coordinates and dewarper coordinates. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17pipeline: rkisp1: Query dewarper crop bounds if no stream configuredStefan Klug
Query the crop bounds on the dewarper instead of the stream in case the camera was not yet configured when updateControls() gets called. This provides sane defaults for the controls. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17libcamera: converter: Add function to check if a stream was configuredStefan Klug
Add a isConfigured() function to be able to check if a given stream was configured in the converter. This is useful in pipelines to either query device or stream specific crop bounds depending on whether the stream is configured or not. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-12-17libcamera: converter: Add function to query crop boundsStefan Klug
The inputCropBounds_ member of the V4L2M2MConverter::Stream class is only initialized after a V4L2M2MConverter::configure() call, when the streams are initialized. However, the converter has crop limits that do not depend on the configured Streams, and which are currently not accessible from the class interface. Add a new inputCropBounds() function to the V4L2M2MConverter class that allows to retrieve the converter crop limits before any stream is configured. This is particularly useful for pipelines to initialize controls and properties and to implement validation before the Camera gets configured. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17libcamera: converter_v4l2_m2m: Refactor get crop bounds codeStefan Klug
In an upcoming patch it is necessary to get the crop bounds on the converter itself. The V4L2M2MConverter contains code that is very similar to the get crop bounds code in the V4L2M2MStream. Merge these code blocks into a static function to be used from both classes. This patch contains no functional changes. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-12-17libcamera: converter_v4l2_m2m: Add missing override specifierStefan Klug
In preparation for adding new functions and overrides to the V4L2M2MDevice class, add an override specifier to all overridden functions in the class. This prevents -Winconsistent-missing-override warnings. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-12-17pipeline: rkisp1: Reorder sensorInfo collection codeStefan Klug
The sensorInfo (specifically the crop rectangle of the selected sensor mode) is collected to be passed to the IPA later. In an upcoming patch that data will also be needed for correct ScalerCrop handling. Move the collection of the sensorInfo before the dewarper configuration step and refactor the code a bit. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17pipeline: rkisp1: Split inputCrop and outputCropStefan Klug
One Rectangle instance is used to calculate the inputCrop and the outputCrop of the ISP in the rkisp1 pipeline. Split that into two distinct variables, because both values will be needed in the upcoming patches. This patch does not contain any functional changes. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-12-17libcamera: geometry: Add Rectangle::transformedBetween()Stefan Klug
Handling cropping and scaling within a complicated pipeline involves transformations of rectangles between different coordinate systems. For example the full input of the dewarper (0,0)/1920x1080 might correspond to the rectangle (0, 243)/2592x1458 in sensor coordinates (of a 2592x1944 sensor). Add a function that allows the transformation of a rectangle defined in one reference frame (dewarper) into the coordinates of a second reference frame (sensor). Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>