[libcamera-devel,0/1] DigitalGain control
mbox series

Message ID 20201027141246.4708-1-david.plowman@raspberrypi.com
Headers show
Series
  • DigitalGain control
Related show

Message

David Plowman Oct. 27, 2020, 2:12 p.m. UTC
Hi everyone

I wanted to raise a topic on which there was already some discussion a
few weeks back, prompted by my noticing a gap in the metadata that we
provide with images.

My observation was that I couldn't correctly set the ISO value in my
JPEG files because we don't report how much digital gain has been
supplied by the image processing pipeline. To address this problem, it
seemed as good a way as any actually to include a proposal for a new
DigitalGain control (see the associated patch). Nevertheless, I think
there's a discussion to be had first. Notably:

* Should we let the pipeline report a single global "digital gain"
  value or, given that different gains may be applied to the colour
  channels, should we report three gain values instead?

* In the Pi world I'd like this to be a read-only control, i.e. you
  can't force the pipeline digital gain to a particular value, as our
  AGC doesn't work like that. But there may be platforms that do allow
  you to set the digital gain.

* You could imagine this being "per-stream". I think it's another case
  of "practically everyone will just want a single value", though
  technically you might be able to imagine some platform and use-cases
  where different outputs might reflect different digital gains.

* There's a question about digital gain being applied by the sensor
  itself, but I'm inclined to view that as a separate topic. The issue
  at hand, at least for me, is being able to distinguish the gain
  applied by the sensor, and which we see in the raw frames, from that
  applied by the ISP, which appears in the JPEGs.

You may have other comments too - so everyone's thoughts would be much
appreciated.

Thanks!
David

David Plowman (1):
  libcamera: controls: Add DigitalGain control

 src/libcamera/control_ids.yaml | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

David Plowman Nov. 9, 2020, 7:53 a.m. UTC | #1
Hi everyone

Can I give this patch a little prod, see how folks would like to move
forward on this one?

Thanks!
David

On Tue, 27 Oct 2020 at 14:12, David Plowman <david.plowman@raspberrypi.com>
wrote:

> Hi everyone
>
> I wanted to raise a topic on which there was already some discussion a
> few weeks back, prompted by my noticing a gap in the metadata that we
> provide with images.
>
> My observation was that I couldn't correctly set the ISO value in my
> JPEG files because we don't report how much digital gain has been
> supplied by the image processing pipeline. To address this problem, it
> seemed as good a way as any actually to include a proposal for a new
> DigitalGain control (see the associated patch). Nevertheless, I think
> there's a discussion to be had first. Notably:
>
> * Should we let the pipeline report a single global "digital gain"
>   value or, given that different gains may be applied to the colour
>   channels, should we report three gain values instead?
>
> * In the Pi world I'd like this to be a read-only control, i.e. you
>   can't force the pipeline digital gain to a particular value, as our
>   AGC doesn't work like that. But there may be platforms that do allow
>   you to set the digital gain.
>
> * You could imagine this being "per-stream". I think it's another case
>   of "practically everyone will just want a single value", though
>   technically you might be able to imagine some platform and use-cases
>   where different outputs might reflect different digital gains.
>
> * There's a question about digital gain being applied by the sensor
>   itself, but I'm inclined to view that as a separate topic. The issue
>   at hand, at least for me, is being able to distinguish the gain
>   applied by the sensor, and which we see in the raw frames, from that
>   applied by the ISP, which appears in the JPEGs.
>
> You may have other comments too - so everyone's thoughts would be much
> appreciated.
>
> Thanks!
> David
>
> David Plowman (1):
>   libcamera: controls: Add DigitalGain control
>
>  src/libcamera/control_ids.yaml | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> --
> 2.20.1
>
>
David Plowman Nov. 16, 2020, 10:18 a.m. UTC | #2
Hi again

Can I give this discussion another little metaphorical shove, please?
Thanks!

Best regards
David

On Mon, 9 Nov 2020 at 07:53, David Plowman <david.plowman@raspberrypi.com>
wrote:

> Hi everyone
>
> Can I give this patch a little prod, see how folks would like to move
> forward on this one?
>
> Thanks!
> David
>
> On Tue, 27 Oct 2020 at 14:12, David Plowman <david.plowman@raspberrypi.com>
> wrote:
>
>> Hi everyone
>>
>> I wanted to raise a topic on which there was already some discussion a
>> few weeks back, prompted by my noticing a gap in the metadata that we
>> provide with images.
>>
>> My observation was that I couldn't correctly set the ISO value in my
>> JPEG files because we don't report how much digital gain has been
>> supplied by the image processing pipeline. To address this problem, it
>> seemed as good a way as any actually to include a proposal for a new
>> DigitalGain control (see the associated patch). Nevertheless, I think
>> there's a discussion to be had first. Notably:
>>
>> * Should we let the pipeline report a single global "digital gain"
>>   value or, given that different gains may be applied to the colour
>>   channels, should we report three gain values instead?
>>
>> * In the Pi world I'd like this to be a read-only control, i.e. you
>>   can't force the pipeline digital gain to a particular value, as our
>>   AGC doesn't work like that. But there may be platforms that do allow
>>   you to set the digital gain.
>>
>> * You could imagine this being "per-stream". I think it's another case
>>   of "practically everyone will just want a single value", though
>>   technically you might be able to imagine some platform and use-cases
>>   where different outputs might reflect different digital gains.
>>
>> * There's a question about digital gain being applied by the sensor
>>   itself, but I'm inclined to view that as a separate topic. The issue
>>   at hand, at least for me, is being able to distinguish the gain
>>   applied by the sensor, and which we see in the raw frames, from that
>>   applied by the ISP, which appears in the JPEGs.
>>
>> You may have other comments too - so everyone's thoughts would be much
>> appreciated.
>>
>> Thanks!
>> David
>>
>> David Plowman (1):
>>   libcamera: controls: Add DigitalGain control
>>
>>  src/libcamera/control_ids.yaml | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> --
>> 2.20.1
>>
>>
David Plowman Nov. 23, 2020, 7:40 a.m. UTC | #3
Morning all

Can I give this one its little weekly nudge? Thanks  :)

Best regards
David

On Mon, 16 Nov 2020 at 10:18, David Plowman
<david.plowman@raspberrypi.com> wrote:
>
> Hi again
>
> Can I give this discussion another little metaphorical shove, please? Thanks!
>
> Best regards
> David
>
> On Mon, 9 Nov 2020 at 07:53, David Plowman <david.plowman@raspberrypi.com> wrote:
>>
>> Hi everyone
>>
>> Can I give this patch a little prod, see how folks would like to move forward on this one?
>>
>> Thanks!
>> David
>>
>> On Tue, 27 Oct 2020 at 14:12, David Plowman <david.plowman@raspberrypi.com> wrote:
>>>
>>> Hi everyone
>>>
>>> I wanted to raise a topic on which there was already some discussion a
>>> few weeks back, prompted by my noticing a gap in the metadata that we
>>> provide with images.
>>>
>>> My observation was that I couldn't correctly set the ISO value in my
>>> JPEG files because we don't report how much digital gain has been
>>> supplied by the image processing pipeline. To address this problem, it
>>> seemed as good a way as any actually to include a proposal for a new
>>> DigitalGain control (see the associated patch). Nevertheless, I think
>>> there's a discussion to be had first. Notably:
>>>
>>> * Should we let the pipeline report a single global "digital gain"
>>>   value or, given that different gains may be applied to the colour
>>>   channels, should we report three gain values instead?
>>>
>>> * In the Pi world I'd like this to be a read-only control, i.e. you
>>>   can't force the pipeline digital gain to a particular value, as our
>>>   AGC doesn't work like that. But there may be platforms that do allow
>>>   you to set the digital gain.
>>>
>>> * You could imagine this being "per-stream". I think it's another case
>>>   of "practically everyone will just want a single value", though
>>>   technically you might be able to imagine some platform and use-cases
>>>   where different outputs might reflect different digital gains.
>>>
>>> * There's a question about digital gain being applied by the sensor
>>>   itself, but I'm inclined to view that as a separate topic. The issue
>>>   at hand, at least for me, is being able to distinguish the gain
>>>   applied by the sensor, and which we see in the raw frames, from that
>>>   applied by the ISP, which appears in the JPEGs.
>>>
>>> You may have other comments too - so everyone's thoughts would be much
>>> appreciated.
>>>
>>> Thanks!
>>> David
>>>
>>> David Plowman (1):
>>>   libcamera: controls: Add DigitalGain control
>>>
>>>  src/libcamera/control_ids.yaml | 11 +++++++++++
>>>  1 file changed, 11 insertions(+)
>>>
>>> --
>>> 2.20.1
>>>
Jacopo Mondi Nov. 23, 2020, 8:55 a.m. UTC | #4
Hi David,

On Mon, Nov 23, 2020 at 07:40:33AM +0000, David Plowman wrote:
> Morning all
>
> Can I give this one its little weekly nudge? Thanks  :)

Sorry for having you nudgin us for three weeks :(

I'll try to provide feedback on the integration with the Control
framework. I have less valuable comments on the control semantic
itself, so I'll skip that part.

>

[snip]

> >>>
> >>> Hi everyone
> >>>
> >>> I wanted to raise a topic on which there was already some discussion a
> >>> few weeks back, prompted by my noticing a gap in the metadata that we
> >>> provide with images.
> >>>
> >>> My observation was that I couldn't correctly set the ISO value in my
> >>> JPEG files because we don't report how much digital gain has been
> >>> supplied by the image processing pipeline. To address this problem, it
> >>> seemed as good a way as any actually to include a proposal for a new
> >>> DigitalGain control (see the associated patch). Nevertheless, I think
> >>> there's a discussion to be had first. Notably:
> >>>
> >>> * Should we let the pipeline report a single global "digital gain"
> >>>   value or, given that different gains may be applied to the colour
> >>>   channels, should we report three gain values instead?
> >>>
> >>> * In the Pi world I'd like this to be a read-only control, i.e. you
> >>>   can't force the pipeline digital gain to a particular value, as our
> >>>   AGC doesn't work like that. But there may be platforms that do allow
> >>>   you to set the digital gain.

Libcamera does not enforce (yet) controls being read-only. What I mean
is that, in example, we don't have a flag in the yaml definition that
restrict the control from being written by applications.

But metadata are read-only by definition and for your case it is
enough not to advertise digital gain in the Camera's ControlInfoMap
controlInfo_ to prevent application from setting DigitalGain in a
Request.

Question is now it it is useful to report a ControlInfoMap of
supported metadata and their limits. Anyway that should not block you
from reporting DigitalGain like you now report other metadata.

> >>>
> >>> * You could imagine this being "per-stream". I think it's another case
> >>>   of "practically everyone will just want a single value", though
> >>>   technically you might be able to imagine some platform and use-cases
> >>>   where different outputs might reflect different digital gains.

I feel the same way as I felt for ScalerCrop: we should be able to
report it per stream, but there's no reason to block the definition of
a new control waiting for that feature to eventually land.

> >>>
> >>> * There's a question about digital gain being applied by the sensor
> >>>   itself, but I'm inclined to view that as a separate topic. The issue
> >>>   at hand, at least for me, is being able to distinguish the gain
> >>>   applied by the sensor, and which we see in the raw frames, from that
> >>>   applied by the ISP, which appears in the JPEGs.

As long as it is made clear in the Control definition, and we don't
make it very hard to find a non-conflicting name for the sensor's
digital gain I think it's fine.

Thanks
  j

> >>>
> >>> You may have other comments too - so everyone's thoughts would be much
> >>> appreciated.
> >>>
> >>> Thanks!
> >>> David
> >>>
> >>> David Plowman (1):
> >>>   libcamera: controls: Add DigitalGain control
> >>>
> >>>  src/libcamera/control_ids.yaml | 11 +++++++++++
> >>>  1 file changed, 11 insertions(+)
> >>>
> >>> --
> >>> 2.20.1
> >>>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel