[libcamera-devel,v3,0/2] Add flicker avoidance controls
mbox series

Message ID 20230328085521.7409-1-david.plowman@raspberrypi.com
Headers show
Series
  • Add flicker avoidance controls
Related show

Message

David Plowman March 28, 2023, 8:55 a.m. UTC
Hi everyone

Here's an updated version of flicker avoidance controls. It's similar
to what I had previously, except that I've split the control which
gave an explicit flicker period into two, one for reporting a
currently detected value, and another for setting a custom flicker
period. So we now have 3 controls in total.

In terms of Android, the AeFlickerDetected control corresponds fairly
directly to Android's scene_flicker control, which is (from my reading
of it) merely reporting any currently detected flicker
period. AeFlickerDetected, however, allows arbitrary flicker periods
to be identified, not just 50 or 60Hz.

The other controls (AeFlickerMode and AeFlickerCustom) correspond to
Android's anti-banding control. Again, we extend it to allow arbitrary
flicker periods.

Hope that all makes sense!

Thanks
David

David Plowman (2):
  libcamera: controls: Add controls for AEC/AGC flicker avoidance
  ipa: raspberrypi: Handle AEC/AGC flicker controls

 src/ipa/raspberrypi/raspberrypi.cpp | 80 +++++++++++++++++++++++++++
 src/libcamera/control_ids.yaml      | 84 +++++++++++++++++++++++------
 2 files changed, 147 insertions(+), 17 deletions(-)

Comments

Laurent Pinchart April 4, 2023, 5:46 a.m. UTC | #1
Hi David,

On Tue, Mar 28, 2023 at 09:55:19AM +0100, David Plowman via libcamera-devel wrote:
> Hi everyone
> 
> Here's an updated version of flicker avoidance controls. It's similar
> to what I had previously, except that I've split the control which
> gave an explicit flicker period into two, one for reporting a
> currently detected value, and another for setting a custom flicker
> period. So we now have 3 controls in total.
> 
> In terms of Android, the AeFlickerDetected control corresponds fairly
> directly to Android's scene_flicker control, which is (from my reading
> of it) merely reporting any currently detected flicker period.

That's my understanding too.

> AeFlickerDetected, however, allows arbitrary flicker periods
> to be identified, not just 50 or 60Hz.

Out of curiosity, what are the use cases you envision for other
frequencies ?

> The other controls (AeFlickerMode and AeFlickerCustom) correspond to
> Android's anti-banding control. Again, we extend it to allow arbitrary
> flicker periods.
> 
> Hope that all makes sense!
> 
> Thanks
> David
> 
> David Plowman (2):
>   libcamera: controls: Add controls for AEC/AGC flicker avoidance
>   ipa: raspberrypi: Handle AEC/AGC flicker controls
> 
>  src/ipa/raspberrypi/raspberrypi.cpp | 80 +++++++++++++++++++++++++++
>  src/libcamera/control_ids.yaml      | 84 +++++++++++++++++++++++------
>  2 files changed, 147 insertions(+), 17 deletions(-)
David Plowman April 4, 2023, 9:10 a.m. UTC | #2
Hi Laurent

Thanks for the questions!

On Tue, 4 Apr 2023 at 06:46, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi David,
>
> On Tue, Mar 28, 2023 at 09:55:19AM +0100, David Plowman via libcamera-devel wrote:
> > Hi everyone
> >
> > Here's an updated version of flicker avoidance controls. It's similar
> > to what I had previously, except that I've split the control which
> > gave an explicit flicker period into two, one for reporting a
> > currently detected value, and another for setting a custom flicker
> > period. So we now have 3 controls in total.
> >
> > In terms of Android, the AeFlickerDetected control corresponds fairly
> > directly to Android's scene_flicker control, which is (from my reading
> > of it) merely reporting any currently detected flicker period.
>
> That's my understanding too.
>
> > AeFlickerDetected, however, allows arbitrary flicker periods
> > to be identified, not just 50 or 60Hz.
>
> Out of curiosity, what are the use cases you envision for other
> frequencies ?

I think the most obvious use cases are when people have LEDs that run
at other frequencies. Probably not such an issue for regular users,
but I could imagine it being useful in lab or technical environments,
and we do have a few of those. But I agree it's not 100% clear, so
alternatives are still definitely worth considering!

Thanks
David

>
> > The other controls (AeFlickerMode and AeFlickerCustom) correspond to
> > Android's anti-banding control. Again, we extend it to allow arbitrary
> > flicker periods.
> >
> > Hope that all makes sense!
> >
> > Thanks
> > David
> >
> > David Plowman (2):
> >   libcamera: controls: Add controls for AEC/AGC flicker avoidance
> >   ipa: raspberrypi: Handle AEC/AGC flicker controls
> >
> >  src/ipa/raspberrypi/raspberrypi.cpp | 80 +++++++++++++++++++++++++++
> >  src/libcamera/control_ids.yaml      | 84 +++++++++++++++++++++++------
> >  2 files changed, 147 insertions(+), 17 deletions(-)
>
> --
> Regards,
>
> Laurent Pinchart
Laurent Pinchart April 5, 2023, 1:51 a.m. UTC | #3
Hi David,

On Tue, Apr 04, 2023 at 10:10:45AM +0100, David Plowman wrote:
> On Tue, 4 Apr 2023 at 06:46, Laurent Pinchartwrote:
> > On Tue, Mar 28, 2023 at 09:55:19AM +0100, David Plowman via libcamera-devel wrote:
> > > Hi everyone
> > >
> > > Here's an updated version of flicker avoidance controls. It's similar
> > > to what I had previously, except that I've split the control which
> > > gave an explicit flicker period into two, one for reporting a
> > > currently detected value, and another for setting a custom flicker
> > > period. So we now have 3 controls in total.
> > >
> > > In terms of Android, the AeFlickerDetected control corresponds fairly
> > > directly to Android's scene_flicker control, which is (from my reading
> > > of it) merely reporting any currently detected flicker period.
> >
> > That's my understanding too.
> >
> > > AeFlickerDetected, however, allows arbitrary flicker periods
> > > to be identified, not just 50 or 60Hz.
> >
> > Out of curiosity, what are the use cases you envision for other
> > frequencies ?
> 
> I think the most obvious use cases are when people have LEDs that run
> at other frequencies. Probably not such an issue for regular users,
> but I could imagine it being useful in lab or technical environments,
> and we do have a few of those. But I agree it's not 100% clear, so
> alternatives are still definitely worth considering!

I thought about LED lightning an hour after sending the question :-)
This sounds like a good use case. I don't have an alternative proposal,
I think yours makes sense.

> > > The other controls (AeFlickerMode and AeFlickerCustom) correspond to
> > > Android's anti-banding control. Again, we extend it to allow arbitrary
> > > flicker periods.
> > >
> > > Hope that all makes sense!
> > >
> > > Thanks
> > > David
> > >
> > > David Plowman (2):
> > >   libcamera: controls: Add controls for AEC/AGC flicker avoidance
> > >   ipa: raspberrypi: Handle AEC/AGC flicker controls
> > >
> > >  src/ipa/raspberrypi/raspberrypi.cpp | 80 +++++++++++++++++++++++++++
> > >  src/libcamera/control_ids.yaml      | 84 +++++++++++++++++++++++------
> > >  2 files changed, 147 insertions(+), 17 deletions(-)