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

Message ID 20260120-sklug-lsc-resampling-v2-dev-v5-14-ef5cec7b299f@ideasonboard.com
State Superseded
Headers show
Series
  • Add resampling support for polynomial LSC data
Related show

Commit Message

Stefan Klug Jan. 20, 2026, 12:26 p.m. UTC
Introduce a LensShadingCorrectionEnable control to enable and disable
LSC. This is useful to assess the working and quality of the lens
shading correction at runtime as well as being able to disable the
correction in case it shall be done manually in post processing.

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

---

Changes in v5:
- Readd this patch to have a separate patch for the control id
- Dropped android specific changes

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/libcamera/control_ids_core.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Kieran Bingham Jan. 22, 2026, 12:39 p.m. UTC | #1
Quoting Stefan Klug (2026-01-20 12:26:19)
> Introduce a LensShadingCorrectionEnable control to enable and disable
> LSC. This is useful to assess the working and quality of the lens
> shading correction at runtime as well as being able to disable the
> correction in case it shall be done manually in post processing.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> 
> ---
> 
> Changes in v5:
> - Readd this patch to have a separate patch for the control id
> - Dropped android specific changes
> 
> 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/libcamera/control_ids_core.yaml | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> 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.

I'm curious if we should really call it the algorithm. But it's probably
fine. It's literally enabling or disabling whether the correction is
applied I think - not if the algorithm is enabled or disabled.

But maybe that's the same thing? Or could it be mis-interpreted that
this disable stops the algorithm from changing the LSC dependant upon
colour temperature perhaps.

... Maybe, so I'd probably say "Enable or disable the lens shading
correction"

Perhaps expand that when disabled a flat / zero correction is applied?
Or maybe that's implicit by saying no correction is applied.

Anyway with that updated or not however you prefer:


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> +
> +        This control is only available when there are valid lens shading
> +        correction parameters available in the tuning file.
> +
>  ...
> 
> -- 
> 2.51.0
>
Laurent Pinchart Jan. 28, 2026, 11:33 a.m. UTC | #2
On Thu, Jan 22, 2026 at 12:39:51PM +0000, Kieran Bingham wrote:
> Quoting Stefan Klug (2026-01-20 12:26:19)
> > Introduce a LensShadingCorrectionEnable control to enable and disable
> > LSC. This is useful to assess the working and quality of the lens
> > shading correction at runtime as well as being able to disable the
> > correction in case it shall be done manually in post processing.

I'm a bit dubious about the usefulness of applying LSC in
post-processing, as the rest of the ISP pipeline will introduce image
quality issues if the lens shading is not corrected first. Still, the
first use case you list is valid, so I'm fine with the control.

> > 
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > 
> > ---
> > 
> > Changes in v5:
> > - Readd this patch to have a separate patch for the control id
> > - Dropped android specific changes
> > 
> > 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/libcamera/control_ids_core.yaml | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > 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.
> 
> I'm curious if we should really call it the algorithm. But it's probably
> fine. It's literally enabling or disabling whether the correction is
> applied I think - not if the algorithm is enabled or disabled.

Some people call the ISP hardware processing blocks algorithms. I'm not
sure I like that though.

> 
> But maybe that's the same thing? Or could it be mis-interpreted that
> this disable stops the algorithm from changing the LSC dependant upon
> colour temperature perhaps.
> 
> ... Maybe, so I'd probably say "Enable or disable the lens shading
> correction"

I would also write "lens shading correction" instead of "lens shading
algorithm".

> 
> Perhaps expand that when disabled a flat / zero correction is applied?
> Or maybe that's implicit by saying no correction is applied.

I think it's implicit.

> 
> Anyway with that updated or not however you prefer:
> 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > +
> > +        This control is only available when there are valid lens shading
> > +        correction parameters available in the tuning file.

I'd drop this, as I don't think we should talk about the tuning file in
the control definitions. The tuning file is for integrators, the
controls are for users.

I see that the LensDewarpEnable control also mentions the same, I'd drop
it there too.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> > +
> >  ...
> >

Patch
diff mbox series

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.
+
 ...