libcamera: Add and implement LensDewarpEnable control

Add a LensDewarpEnable control to enable or disable lens dewarping if it
is configured. Implement it inside the dw100 converter module.

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>
This commit is contained in:
Stefan Klug
2025-11-25 17:28:38 +01:00
parent 302f285b3b
commit 7313f046a2
2 changed files with 19 additions and 0 deletions

View File

@@ -1346,4 +1346,11 @@ controls:
reduces the WdrExposureValue until the amount of pixels that are close
to saturation is lower than this value.
- LensDewarpEnable:
type: bool
direction: inout
description: |
Enable or disable lens dewarping. This control is only available if lens
dewarp parameters are configured in the tuning file.
...

View File

@@ -343,6 +343,9 @@ void ConverterDW100Module::updateControlInfos(const Stream *stream, ControlInfoM
controls[&controls::ScalerCrop] = ControlInfo(Rectangle(sensorCrop_.x, sensorCrop_.y, 1, 1),
sensorCrop_, sensorCrop_);
if (dewarpParams_.has_value())
controls[&controls::LensDewarpEnable] = ControlInfo(false, true, true);
if (!converter_.supportsRequests())
LOG(Converter, Warning)
<< "dw100 kernel driver has no requests support."
@@ -366,6 +369,12 @@ void ConverterDW100Module::setControls(const Stream *stream, const ControlList &
auto &info = vertexMaps_[stream];
auto &vertexMap = info.map;
const auto &lensDewarpEnable = controls.get(controls::LensDewarpEnable);
if (lensDewarpEnable) {
vertexMap.setLensDewarpEnable(*lensDewarpEnable);
info.update = true;
}
const auto &crop = controls.get(controls::ScalerCrop);
if (crop) {
vertexMap.setScalerCrop(*crop);
@@ -394,6 +403,9 @@ void ConverterDW100Module::populateMetadata(const Stream *stream, ControlList &m
auto &vertexMap = vertexMaps_[stream].map;
meta.set(controls::ScalerCrop, vertexMap.effectiveScalerCrop());
if (dewarpParams_.has_value())
meta.set(controls::LensDewarpEnable, vertexMap.lensDewarpEnable());
}
/**