| Message ID | 20260114-sklug-lsc-resampling-v2-dev-v3-14-80cd24f4dd61@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
2026. 01. 14. 12:58 keltezéssel, Stefan Klug írta: > 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 android > 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(-) > > 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); I am confused about the android parts. First, because the control is never set on a request or anything. Second, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE says Whether the camera device will output the lens shading map in output result metadata. When set to ON, android.statistics.lensShadingMap will be provided in the output result metadata. so to me that suggests that it should control the presence of another metadata item. So mapping it to `LensShadingCorrectionEnable` does not seem entirely correct. > } > 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 >
Hi Barnabás, + Jacopo, @Jacopo I added you because of an android question a bit further down. Quoting Barnabás Pőcze (2026-01-14 16:52:10) > 2026. 01. 14. 12:58 keltezéssel, Stefan Klug írta: > > 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 > android > > > > 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(-) > > > > 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); > > I am confused about the android parts. First, because the control is never set on a request or > anything. Second, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE says > > Whether the camera device will output the lens shading map in output result metadata. > When set to ON, android.statistics.lensShadingMap will be provided in the output result metadata. > > so to me that suggests that it should control the presence of another metadata item. So mapping > it to `LensShadingCorrectionEnable` does not seem entirely correct. Oh it might well be that I misunderstood something here. I didn't completely get the android code and so I basically did a best guess effort. The old code checks if the controlsInfo contains controls::draft::LensShadingMapMode and then adds all possible enum values (which could either be LensShadingMapModeOff or LensShadingMapModeOn) or it just adds ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF in case it can't find it in the controlsInfo.. So I thought I'd do something similar and add ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON in case the control is present which should be the same as adding LensShadingMapModeOn in the old version of the code. And the ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF can then be added unconditionally. But overall it looks to me that LensShading was never fully implemented on android. So maybe we can just drop the block? Jacopo can you help here? Best regards, Stefan > > > > } > > 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 > > >
Hi Stefan On Fri, Jan 16, 2026 at 03:29:41PM +0100, Stefan Klug wrote: > Hi Barnabás, > + Jacopo, > > @Jacopo I added you because of an android question a bit further down. > > Quoting Barnabás Pőcze (2026-01-14 16:52:10) > > 2026. 01. 14. 12:58 keltezéssel, Stefan Klug írta: > > > 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 > > android > > > > > > > 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(-) > > > > > > 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); > > > > I am confused about the android parts. First, because the control is never set on a request or > > anything. Second, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE says > > > > Whether the camera device will output the lens shading map in output result metadata. > > When set to ON, android.statistics.lensShadingMap will be provided in the output result metadata. > > > > so to me that suggests that it should control the presence of another metadata item. So mapping > > it to `LensShadingCorrectionEnable` does not seem entirely correct. > > Oh it might well be that I misunderstood something here. I didn't > completely get the android code and so I basically did a best guess > effort. The old code checks if the controlsInfo contains > controls::draft::LensShadingMapMode and then adds all possible enum > values (which could either be LensShadingMapModeOff or > LensShadingMapModeOn) or it just adds > ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF in case it can't find it in > the controlsInfo.. So I thought I'd do something similar and add > ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON in case the control is > present which should be the same as adding LensShadingMapModeOn in the > old version of the code. And the > ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF can then be added > unconditionally. I have the same understanding that Barnabás has: controls::draft::LensShadingMapMode controls if the lens shading map is returned in metadata or not, not if lens shading should be performed or not. If I'm not mistaken, I think you can drop this patch and leave drafts::LensShadingMapMode in place, they control two different things if I'm not mistaken. > > But overall it looks to me that LensShading was never fully implemented > on android. So maybe we can just drop the block? > > Jacopo can you help here? > > Best regards, > Stefan > > > > > > > > > } > > > 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 > > > > >
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