[v2,14/15] libcamera: control_ids: Introduce LensShadingCorrectionEnable
diff mbox series

Message ID 20260108-sklug-lsc-resampling-v2-dev-v2-14-e682ec4b9893@ideasonboard.com
State New
Headers show
Series
  • Add resampling support for polynomial LSC data
Related show

Commit Message

Stefan Klug Jan. 8, 2026, 4:05 p.m. UTC
Introduce a control to enable and disable LSC and replace the
draft android control. Having a map as in andoid doesn't give a benefit
as up to today no values apart from ON/OFF were ever implemented.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

---

Changes in v2:
- Renamed LensShadingEnable to LensShadingCorrectionEnable
- Fixed android code to properly handle the boolean value
- Added "only if tuned" info sentence to the control description
---
 src/android/camera_capabilities.cpp  | 11 ++++-------
 src/libcamera/control_ids_core.yaml  |  9 +++++++++
 src/libcamera/control_ids_draft.yaml | 14 --------------
 3 files changed, 13 insertions(+), 21 deletions(-)

Patch
diff mbox series

diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
index b161bc6b3ed68b7206e524762f8a941816812e45..9948868d3bd99a9cfb59a5d48a20ccc455a94964 100644
--- a/src/android/camera_capabilities.cpp
+++ b/src/android/camera_capabilities.cpp
@@ -1223,13 +1223,10 @@  int CameraCapabilities::initializeStaticMetadata()
 	{
 		std::vector<uint8_t> data;
 		data.reserve(2);
-		const auto &infoMap = controlsInfo.find(&controls::draft::LensShadingMapMode);
-		if (infoMap != controlsInfo.end()) {
-			for (const auto &value : infoMap->second.values())
-				data.push_back(value.get<int32_t>());
-		} else {
-			data.push_back(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF);
-		}
+		data.push_back(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF);
+		const auto &infoMap = controlsInfo.find(&controls::LensShadingCorrectionEnable);
+		if (infoMap != controlsInfo.end())
+			data.push_back(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON);
 		staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES,
 					  data);
 	}
diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml
index 8e99bd84825f6060dbc323be3f4b0cd6283e0942..ced98e4625bfba9165be4f93d1fd2756881a2d1b 100644
--- a/src/libcamera/control_ids_core.yaml
+++ b/src/libcamera/control_ids_core.yaml
@@ -1356,4 +1356,13 @@  controls:
         Enable or disable lens dewarping. This control is only available if lens
         dewarp parameters are configured in the tuning file.
 
+  - LensShadingCorrectionEnable:
+      type: bool
+      direction: inout
+      description: |
+        Enable or disable the lens shading algorithm.
+
+        This control is only available when there are valid lens shading
+        correction parameters available in the tuning file.
+
 ...
diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml
index 03309eeac34fa76eee4bb5d1c87d6467b890c9a7..14026de46ad6de92cfd978e5c68c9944ce9987fa 100644
--- a/src/libcamera/control_ids_draft.yaml
+++ b/src/libcamera/control_ids_draft.yaml
@@ -110,20 +110,6 @@  controls:
        row and the start of exposure of the last row. Currently identical to
        ANDROID_SENSOR_ROLLING_SHUTTER_SKEW
 
-  - LensShadingMapMode:
-      type: int32_t
-      direction: inout
-      description: |
-       Control to report if the lens shading map is available. Currently
-       identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE.
-      enum:
-        - name: LensShadingMapModeOff
-          value: 0
-          description: No lens shading map mode is available.
-        - name: LensShadingMapModeOn
-          value: 1
-          description: The lens shading map mode is available.
-
   - PipelineDepth:
       type: int32_t
       direction: out