summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
11 daysgstreamer: Implement caps negotiation for video/x-bayerJohannes Kirchmair
The parsing of video/x-bayer sources from string makes it possible to use cameras providing e.g SGRBG8 streams via gst-launch. Like: gst-launch-1.0 libcamerasrc camera-name=<cam> ! video/x-bayer,format=grbg Without this change the gstreamer plugin complains about "Unsupported media type: video/x-bayer". Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Johannes Kirchmair <johannes.kirchmair@skidata.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
11 dayspipeline: rpi: Handler controls::rpi::ScalerCropsNaushir Patuck
Handle multiple scaler crops being set through the rpi::ScalerCrops control. We now populate the cropParams_ map in the loop where we handle the output stream configuration items. The key of this map is the index of the stream configuration structure set by the application. This will also be the same index used to specify the crop rectangles through the ScalerCrops control. CameraData::applyScalerCrop() has been adapted to look at either controls::ScalerCrop or controls::rpi::ScalerCrops. The latter takes priority over the former. If only controls::ScalerCrop is provided, the pipeline handler will apply the same scaler crop to all output streams. Finally return all crops through the same ScalerCrops control via request metadata. The first configure stream's crop rectangle is also returned via the ScalerCrop control in the request metadata. Signed-off-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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 dayspipeline: rpi: Pass ISP output index into platformSetIspCrop()Naushir Patuck
At this point, the index is unused, but will be in a future commit where we can set different crops on each ISP output. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 dayspipeline: rpi: Track which ISP output is configured for a streamNaushir Patuck
Add a ispIndex field to CropParams that is used to track which ISP output (0/1) will be used for a given stream during configuration. Tracking this information is required for an upcoming change where crop rectangles can be specified for each configured stream. Currently, the value is fixed to 0. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 dayspipeline: rpi: Introduce CameraData::CropParamsNaushir Patuck
In preparation for assigning separate crop windows for each stream, add a new CropParams structure that stores the existing ispCrop_ and ispMinCropSize_ as fields. Use a new std::map to store a CropParams structure where the map key is the index of the stream configuration in the CameraConfiguration vector. At preset, only a single CropParams structure will be set at key == 0 to preserve the existing crop handling logic. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 dayspipeline: rpi: Pass crop rectangle as a parameter to platformSetIspCrop()Naushir Patuck
This will be required when we program separate crop values to each ISP output in a future commit. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 dayspipeline: rpi: Remove CameraData::scalerCrop_Naushir Patuck
Do not cache the scalerCrop_ parameter. The cached value is used to update the request metadata, but since this is not an expensive operation (and can only occur once per frame), caching it is of limited value. This will simplify logic in a future commit where we can specify a crop per-output stream. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 dayscontrols: rpi: Add a vendor rpi::ScalerCrops controlNaushir Patuck
Add a vendor control rpi::ScalerCrops that is analogous to the current core::ScalerCrop, but can apply a different crop to each configured stream. This control takes a span of Rectangle structures - the order of rectangles must match the order of streams configured by the application. Signed-off-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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-28libcamera: formats: Change bytesPerGroup of RGB565 and RGB565_BE from 3 to 2Hou Qi
The RGB565 and RGB565_BE formats incorrectly specify a wrong value of 3 bytes per group of pixels, when they actually use 2. Fix them. Signed-off-by: Hou Qi <qi.hou@nxp.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-28ipa: libipa: Fix ExposureModeHelper function name in documentationLaurent Pinchart
Previous iterations of the ExposureModeHelper class had a setShutterGainLimits() function, which got renamed to setLimits(). The documentation still uses the old name. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-10-25qcam: Automatically select the camera if only one is availableStanislaw Gruszka
When only a single camera is available, showing the camera selection dialog is unnecessary. It's better to automatically select the available camera without prompting the user for input. Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.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-10-24libcamera: rkisp1: Plumb the dw100 dewarper as V4L2M2M converterUmang Jain
Plumb the dw100 dewarper as a V4L2M2M converter in the rkisp1 pipeline handler. If the dewarper is found, it is instantiated and buffers are exported from it, instead of RkISP1Path. Internal buffers are allocated for the RkISP1Path in case where dewarper is going to be used. The RKISP1 pipeline handler now supports scaler crop control through the converter. Register the ScalerCrop control for the cameras created in the RKISP1 pipeline handler. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-10-24libcamera: rkisp1: Prepare for additional camera controlsUmang Jain
Currently the rkisp1 pipeline handler only registers controls that are related to the IPA. This patch prepares the rkisp1 pipeline-handler to register camera controls which are not related to the IPA. Hence, introduce an additional ControlInfoMap for IPA controls. These controls will be merged together with the controls in the pipeline handler (introduced subsequently) as part of updateControls() and together will be registered during the registration of the camera. This is similar to what IPU3 pipeline handler handles its controls. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-24libcamera: converter: Add interface to support cropping capabilityUmang Jain
If the converter has cropping capability on its input, the interface should support it by providing appropriate virtual functions. Provide Feature::InputCrop in Feature enumeration for the same. Provide virtual setInputCrop() and inputCropBounds() interfaces so that the converter can implement its own cropping functionality. The V4L2M2MConverter implements these interfaces of the Converter interface. Not all V4L2M2M converters will have cropping ability on its input, hence it needs to be discovered at construction time. If the capability to crop is identified successfully, the cropping bounds are determined during configure() time. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-10-24libcamera: converter: Add interface for feature flagsUmang Jain
This patch intends to extend the converter interface to have feature flags, which enables each converter to expose the set of features it supports. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-21ipa: rpi: Add tuning files for OV7251Dave Stevenson
OV7251 is a mono VGA global shutter sensor that has a mainline driver and works with libcamera. Add the supporting files for it. The tuning is copied from OV9281. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-21py: Add bindings for ControlId vendor informationPaul Elder
Add python bindings for quering vendor information from a ControlId. While at it, update __repr__ so that it also prints the vendor. Example usage: >>> cid libcamera.ControlId(20, libcamera.Saturation, ControlType.Float) >>> cid.vendor 'libcamera' 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> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-21apps: cam: Print control vendor information when listing controlsPaul Elder
Now that the vendor of the control can be queried, print it in --list-controls. Example output: $ cam -c 1 --list-controls Using camera platform/vimc.0 Sensor B as cam0 Control: libcamera::Brightness: [-1.000000..1.000000] Control: libcamera::Contrast: [0.000000..2.000000] Control: libcamera::Saturation: [0.000000..2.000000] 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> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-21libcamera: controls: Add vendor information to ControlIdPaul Elder
Add vendor/namespace information to ControlId, so that the vendor can be queried from it. This is expected to be used by applications either simply to display the vendor or for it to be used for grouping in a UI. 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> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-19libcamera: pipeline: rkisp1: Fix typo in todo taskKieran Bingham
The delay values should be managed correctly. Not the dealys. Correct accordingly. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18libcamera: software_isp: Black level from tuning fileMilan Zamazal
This patch allows obtaining a black level from a tuning file in addition to the camera sensor helper. If both of them define a black level, the one from the tuning file takes precedence. The use cases are: - A user wants to use a different black level, for whatever reason. - There is a sensor without known gains but with a known black level. Because a camera sensor helper cannot be defined without specifying gains, the only way to specify the black level is using the tuning file. Software ISP uses its fallback gain handling in such a case. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18libcamera: software_isp: Get black level from the camera helperMilan Zamazal
The black level in software ISP is unconditionally guessed from the obtained frames. CameraSensorHelper optionally provides the black level from camera specifications now. Let's use the value if available. If the black level is not available from the given CameraSensorHelper instance, it's still determined on the fly. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Robert Mader <robert.mader@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18libcamera: software_isp: Clear IPA context on configure and stopRobert Mader
Like the hardware pipelines do. Not clearing frameContexts otherwise can trigger asserts like "Frame context for ... has been overwritten by ..." when switching between cameras using the swISP, e.g. on phones. Clearing the configuration and active state will become more important with upcoming changes such as getting the black level from the camera helper. Fixes: 04d171e6b299 ("libcamera: software_isp: Call Algorithm::queueRequest") Signed-off-by: Robert Mader <robert.mader@collabora.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18pycamera: Add missing code for ControlTypePointStefan Klug
In the python bindings ControlTypePoint is not handled in the corresponding conversion functions. Add that. While at it, sort the listings in the same order as the enum in controls.h. Fixes: 200d535ca85f ("libcamera: controls: Add ControlTypePoint") Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18ipa: rkisp1: algorithms: awb: Check for correct stats typeStefan Klug
Sometimes the ISP produces statistics only with a subset of statistic types being valid. It doesn't happen normally, but was observed in the wild. Check for the RKISP1_CIF_ISP_STAT_AWB bit to prevent using invalid or outdated data. As it doesn't happen regularly add an error message to get notified when it happens. For simpler code structure, the ColourTemperature metadata entry gets written unconditionally and overwritten later if needed. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18ipa: rkisp1: algorithms: agc: Check for correct stats typeStefan Klug
Sometimes the ISP produces statistics only with a subset of statistic types being valid. It doesn't happen normally, but was observed in the wild. Check for the RKISP1_CIF_ISP_STAT_AUTOEXP bit to prevent using invalid or outdated data. As it doesn't happen regularly add an error message to get notified when it happens. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18libcamera: MappedFrameBuffer: Fix typo in comment formattingPaul Elder
Fix typo in comment block formatting. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-15libcamera: rkisp1: Maintain alphabetical order of forward declarationsUmang Jain
Alphabetical order of Forward declarations should be maintained hence, 'class V4L2Subdevice' should come after 'class SensorConfiguration'. Fix it. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-10-15libcamera: rkisp1: Rectify SensorConfiguration checkUmang Jain
The 'found' flag was mistakenly understood that a compatible sensor format has been found when a sensor configuration is passed in. However, 'found' related to the stream configuration's pixelformat, whether it is supported by the RkISP1Path video node or not. It does not relate to the sensor format, hence the check: if (sensorConfig && !found) doesn't make sense. Rectify the above check with: if (sensorConfig && !rawFormat.isValid()) to ensure a sensor format compatible with sensor configuration has been set to rawFormat. Fixes: 047d647452c4 ("libcamera: rkisp1: Integrate SensorConfiguration support") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-10-15libcamera: rkisp1: Use const reference for sensor configurationUmang Jain
User-provided sensor configuration is never meant to be altered, hence pass SensorConfiguration by `const` reference in RkISP1Path::validate(). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-10-09libcamera: rkisp1: Clamp stream configuration to ISP limit on raw pathUmang Jain
Commit 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") introduced a mechanism to determine maximum supported sensor resolution and filter out resolutions that cannot be supported by the ISP. However, it missed to update the raw stream configuration path, where it should have clamped the raw stream configuration size to the maximum sensor supported resolution. This patch fixes the above issue and can be confirmed with IMX283 on i.MX8MP: From: ($) cam -c1 -srole=raw,width=5472,height=3072 INFO Camera camera.cpp:1197 configuring streams: (0) 5472x3648-SRGGB12 ERROR RkISP1 rkisp1_path.cpp:425 Unable to configure capture in 5472x3648-SRGGB12 Failed to configure camera Failed to start camera session To: ($) cam -c1 -srole=raw,width=5472,height=3072 INFO Camera camera.cpp:1197 configuring streams: (0) 4096x3072-SRGGB12 cam0: Capture until user interrupts by SIGINT 536.082380 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 25165824 536.182378 (10.00 fps) cam0-stream0 seq: 000001 bytesused: 25165824 536.282375 (10.00 fps) cam0-stream0 seq: 000002 bytesused: 25165824 ... Fixes: 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-10-09libcamera: rkisp1: Integrate SensorConfiguration supportUmang Jain
Integrate the RkISP1 pipeline handler to support sensor configuration provided by applications through CameraConfiguration::sensorConfig. The SensorConfiguration must be validated on both RkISP1Path (mainPath and selfPath), so the parameters of RkISP1Path::validate() have been updated to include sensorConfig. The camera configuration will be marked as invalid when the sensor configuration is supplied, if: - Invalid sensor configuration (SensorConfiguration::isValid()) - Bit depth not supported by RkISP1 pipeline - Sensor configuration output size is larger than maximum supported sensor's size on RkISP1 pipeline - No matching sensor configuration output size supplied by the sensor Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-10-08ipa: rpi: awb: Add a bias to the AWB searchNaushir Patuck
In the case of an AWB search failure, the current algorithm logic will return a point on the CT curve closest to where the search finisned. This can be quite undesirable. Instead, add some bias params to the AWB algorithm which will direct the search to a set CT value in the case where statistics become unreliable causing the search to fail. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-08ipa: rpi: awb: Add a const for the default colour temperatureNaushir Patuck
A default CT of 4500K is used in a couple of places. Add a constexpr value for the default CT value and use it instead. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-08libcamera: camera: Fix CameraConfiguration spelling errorUmang Jain
The documentation of CameraConfiguration::validate() has one misspelled "CameraConfiguration". Fix it. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-03libcamera: software_isp: Improve wording in a commentMilan Zamazal
A minor wording improvement suggested on refactoring review. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-03libcamera: yaml_parser: Take string keys in `std::string_view`Barnabás Pőcze
In many cases a static string literal is used as key. Thus having the argument type be `const std::string&` is suboptimal since an `std::string` object needs to be constructed before the call. C++17 introduced `std::string_view`, using which the call can be done with less overhead, as the `std::string_view` is non-owning and may be passed in registers entirely. So make `YamlObject::{contains,operator[]}` take the string keys in `std::string_view`s. Unfortunately, that is not sufficient yet, because `std::map::find()` takes an reference to `const key_type`, which would be `const std::string&` in the case of `YamlParser`. However, with a transparent comparator such as `std::less<>` `std::map::find()` is able to accept any object as the argument, and it forwards it to the comparator. So make `YamlParser::dictionary_` use `std::less<>` as the comparator to enable the use of `std::map::find()` with any type of argument. 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-10-01libcamera: android: Add face detection control supportHarvey Yang
Allow Android HAL adapter to pass the face detection metadata control to the pipeline and also send face detection metadata to the camera client if the pipeline generates it. Signed-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org>
2024-10-01libcamera: control_ids_draft: Add face detection controlsYudhistira Erlandinata
Add FaceDetectMode, FaceDetectFaceRectangles, FaceDetectFaceScores, and FaceDetectFaceLandmark. Also add ControlTypePoint for supporting FaceDetectFaceLandmark. Signed-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org> Co-developed-by: Becker Hsieh <beckerh@chromium.org> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org>
2024-10-01libcamera: controls: Add ControlTypePointYudhistira Erlandinata
Add a control_type<> specialization for libcamera::Point to allow storing data of that type in a ControlValue instance. The new control type will be used by controls introduced in the next patches. Signed-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org> Co-developed-by: Becker Hsieh <beckerh@chromium.org> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-01libcamera: geometry: Add two-point Rectangle constructorYudhistira Erlandinata
Add a constructor to the Rectangle class that accepts two points. The constructed Rectangle spans all the space between the two given points. Signed-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org>
2024-10-01libcamera: geometry: Clarify Rectangle's top-left cornerJacopo Mondi
The libcamera::Rectangle class allows defining rectangles regardless of the orientation of the reference system where a rectangle is used in. This implies that, depending on the reference system in use, the rectangle's top-left corner, as defined by libcamera, doesn't correspond to the visual top-left position. ^ | | ------------------- | ^ | h | | | y| o---->------------- | w -------------------------------> (0,0) x (0,0) x ------------------------------> | w y| o---->------------- | | | h | v | | ------------------- | V Clarify that a Rectangle's top-left corner corresponds to the point with the smaller x and y coordinates and that the horizontal and vertical dimensions are obtained by positive increments along the corresponding axes. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2024-09-30libcamera: Replace last users of math.hLaurent Pinchart
As described in the coding style document, libcamera favours <cmath> over <math.h>. Replace the last few occurrences of the latter with the former and adapt the code accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2024-09-30ipa: rpi: Replace last users of math.hLaurent Pinchart
As described in the coding style document, libcamera favours <cmath> over <math.h>. Replace the last few occurrences of the latter with the former in the Raspberry Pi IPA and adapt the code accordingly. In some cases, the <math.h> include is simply dropped as it isn't needed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2024-09-30libcamera: Replace usage of lroundf() with std::lround()Laurent Pinchart
As explained in the coding style document, usage of std::lround() is preferred over lroundf() as it picks the correct function based on the argument type. Replace calls to lroundf() with std::lround() through libcamera. 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-09-30ipa: rpi: Use std::abs()Laurent Pinchart
As explained in the coding style document, usage of std::abs() is preferred over abs() or fabs() as it picks the correct function based on the argument type. Replace calls to abs() and fabs() with std::abs() in the Raspberry Pi algorithms. This fixes a reported warning from clang: ../src/ipa/rpi/controller/rpi/awb.cpp:508:6: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value] if (abs(denominator) > eps) { ^ ../src/ipa/rpi/controller/rpi/awb.cpp:508:6: note: use function 'std::abs' instead if (abs(denominator) > eps) { ^~~ std::abs Reported-by: Maarten Lankhorst <dev@lankhorst.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-09-30libcamera: controls: Handle enum values without a castLaurent Pinchart
When constructing a ControlValue from an enum value, an explicit cast to int32_t is needed as we use int32_t as the underlying type for all enumerated controls. This makes users of ControlValue more complex. To simplify them, specialize the control_type template for enum types, to support construction of ControlValue directly without a cast. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-09-30libcamera: v4l2_videodevice: Add getSelection() functionLaurent Pinchart
The V4L2VideoDevice class implements setSelection() but not getSelection(). The latter is useful for instance to query crop bounds. Implement the function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-09-30apps: cam: Print an error when outputting DNG and DNG support is missingLaurent Pinchart
When DNG support is missing, the cam application ignores the .dng suffix of the file pattern and writes raw binary data instead, without notifying the user. This leads to confusion. Fix it by printing an error message. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-09-30apps: Replace HAVE_DNG with HAVE_TIFFLaurent Pinchart
Support for DNG capture is conditioned by the availability of libtiff, which is indicated by the HAVE_TIFF macro set by meson. The dng_writer.h header then defines HAVE_DNG, which is used in a couple of places to conditionally compile DNG-related code. Most of the other locations where conditional compilation is required use HAVE_TIFF. Using both HAVE_TIFF and HAVE_DNG is confusing. HAVE_DNG would be a better name, but as the macro is defined in dng_writer.h, it would require all files that need to test for DNG support to include that header. Failure to include it (directly or indirectly) would result in the code covered by the macro to be silently disabled. To avoid the confusion, standardize on using HAVE_TIFF everywhere and drop HAVE_DNG. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>