[libcamera-devel,v2,2/2] src: ipa: raspberrypi: Add digital gain to libcamera metadata
diff mbox series

Message ID 20201126145005.8838-3-david.plowman@raspberrypi.com
State Accepted
Delegated to: Laurent Pinchart
Headers show
Series
  • Digital gain control
Related show

Commit Message

David Plowman Nov. 26, 2020, 2:50 p.m. UTC
The digital gain reported by the AGC algorithm is reported in the
metadata that is included in completed requests.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/raspberrypi/raspberrypi.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jacopo Mondi Nov. 26, 2020, 3:32 p.m. UTC | #1
Hi David,

On Thu, Nov 26, 2020 at 02:50:05PM +0000, David Plowman wrote:
> The digital gain reported by the AGC algorithm is reported in the
> metadata that is included in completed requests.
>

I see a potential minor issue here.
Your AGC algortihm seems to limit the valid digital gain values in the
[1.0, 4.0] interval. Currently there's no way to report that to
application as we don't have a:
        const ControlInfoMap &Camera::metadata() const;

as we have a:
        const ControlInfoMap &Camera::controls() const;

Do you think it would be useful ?

> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

For the patch itself
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> ---
>  src/ipa/raspberrypi/raspberrypi.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index 9853a343..631fe7b3 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -403,8 +403,10 @@ void IPARPi::reportMetadata()
>  	}
>
>  	AgcStatus *agcStatus = rpiMetadata_.GetLocked<AgcStatus>("agc.status");
> -	if (agcStatus)
> +	if (agcStatus) {
>  		libcameraMetadata_.set(controls::AeLocked, agcStatus->locked);
> +		libcameraMetadata_.set(controls::DigitalGain, agcStatus->digital_gain);
> +	}
>
>  	LuxStatus *luxStatus = rpiMetadata_.GetLocked<LuxStatus>("lux.status");
>  	if (luxStatus)
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
David Plowman Nov. 26, 2020, 3:47 p.m. UTC | #2
Hi Jacopo

Thanks for the comments.

On Thu, 26 Nov 2020 at 15:32, Jacopo Mondi <jacopo@jmondi.org> wrote:
>
> Hi David,
>
> On Thu, Nov 26, 2020 at 02:50:05PM +0000, David Plowman wrote:
> > The digital gain reported by the AGC algorithm is reported in the
> > metadata that is included in completed requests.
> >
>
> I see a potential minor issue here.
> Your AGC algortihm seems to limit the valid digital gain values in the
> [1.0, 4.0] interval. Currently there's no way to report that to
> application as we don't have a:
>         const ControlInfoMap &Camera::metadata() const;
>
> as we have a:
>         const ControlInfoMap &Camera::controls() const;
>
> Do you think it would be useful ?

Well, that whole [1.0, 4.0] thing is entirely arbitrary, I probably
couldn't think what else to put in there. Maybe it'll change... so no
urgency from my point of view!

Thanks
David

>
> > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
>
> For the patch itself
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
>
> Thanks
>   j
>
> > ---
> >  src/ipa/raspberrypi/raspberrypi.cpp | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> > index 9853a343..631fe7b3 100644
> > --- a/src/ipa/raspberrypi/raspberrypi.cpp
> > +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> > @@ -403,8 +403,10 @@ void IPARPi::reportMetadata()
> >       }
> >
> >       AgcStatus *agcStatus = rpiMetadata_.GetLocked<AgcStatus>("agc.status");
> > -     if (agcStatus)
> > +     if (agcStatus) {
> >               libcameraMetadata_.set(controls::AeLocked, agcStatus->locked);
> > +             libcameraMetadata_.set(controls::DigitalGain, agcStatus->digital_gain);
> > +     }
> >
> >       LuxStatus *luxStatus = rpiMetadata_.GetLocked<LuxStatus>("lux.status");
> >       if (luxStatus)
> > --
> > 2.20.1
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Dec. 20, 2020, 3:16 a.m. UTC | #3
Hi David,

Thank you for the patch.

On Thu, Nov 26, 2020 at 02:50:05PM +0000, David Plowman wrote:
> The digital gain reported by the AGC algorithm is reported in the
> metadata that is included in completed requests.
> 
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

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

I'll push to the master branch shortly after the tests finish running.

> ---
>  src/ipa/raspberrypi/raspberrypi.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index 9853a343..631fe7b3 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -403,8 +403,10 @@ void IPARPi::reportMetadata()
>  	}
>  
>  	AgcStatus *agcStatus = rpiMetadata_.GetLocked<AgcStatus>("agc.status");
> -	if (agcStatus)
> +	if (agcStatus) {
>  		libcameraMetadata_.set(controls::AeLocked, agcStatus->locked);
> +		libcameraMetadata_.set(controls::DigitalGain, agcStatus->digital_gain);
> +	}
>  
>  	LuxStatus *luxStatus = rpiMetadata_.GetLocked<LuxStatus>("lux.status");
>  	if (luxStatus)

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 9853a343..631fe7b3 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -403,8 +403,10 @@  void IPARPi::reportMetadata()
 	}
 
 	AgcStatus *agcStatus = rpiMetadata_.GetLocked<AgcStatus>("agc.status");
-	if (agcStatus)
+	if (agcStatus) {
 		libcameraMetadata_.set(controls::AeLocked, agcStatus->locked);
+		libcameraMetadata_.set(controls::DigitalGain, agcStatus->digital_gain);
+	}
 
 	LuxStatus *luxStatus = rpiMetadata_.GetLocked<LuxStatus>("lux.status");
 	if (luxStatus)