[RFC,v2,25/43] ipa: libipa: agc: Use default exposure
diff mbox series

Message ID 20260723154327.1357866-26-barnabas.pocze@ideasonboard.com
State Superseded
Headers show
Series
  • ipa: libipa: agc rework
Related show

Commit Message

Barnabás Pőcze July 23, 2026, 3:43 p.m. UTC
Instead of hard-coding 10ms, just use the default exposure time
as determined by the V4L2 control. This ensures that the advertised
default in the `ControlInfo` matches what actually happens.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/ipa/libipa/agc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Barnabás Pőcze July 24, 2026, 12:15 p.m. UTC | #1
2026. 07. 23. 17:43 keltezéssel, Barnabás Pőcze írta:
> Instead of hard-coding 10ms, just use the default exposure time
> as determined by the V4L2 control. This ensures that the advertised
> default in the `ControlInfo` matches what actually happens.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>   src/ipa/libipa/agc.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
> index edcbab1e0b..54c5c6c349 100644
> --- a/src/ipa/libipa/agc.cpp
> +++ b/src/ipa/libipa/agc.cpp
> @@ -355,7 +355,7 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, cons
>   	/* Configure the default exposure and gain. */
>   	state = {};
>   	state.automatic.gain = session.minAnalogueGain;
> -	state.automatic.exposure = clampExposure(10ms, session);
> +	state.automatic.exposure = clampExposure(defExposure * session.lineDuration, session);
>   	state.automatic.quantizationGain = 1;
>   	state.automatic.yTarget = impl_.effectiveYTarget(0, 1);
>   	state.manual.gain = state.automatic.gain;

Note that I have just updated this change:

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index c0d690c802..876f11f5ad 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -355,7 +355,7 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, cons
         /* Configure the default exposure and gain. */
         state = {};
         state.automatic.gain = session.minAnalogueGain;
-       state.automatic.exposure = clampExposure(10ms, session);
+       state.automatic.exposure = defExposure;
         state.automatic.quantizationGain = 1;
         state.automatic.yTarget = impl_.effectiveYTarget(0, 1);
         state.manual.gain = state.automatic.gain;
Jacopo Mondi July 27, 2026, 2 p.m. UTC | #2
On Fri, Jul 24, 2026 at 02:15:11PM +0200, Barnabás Pőcze wrote:
> 2026. 07. 23. 17:43 keltezéssel, Barnabás Pőcze írta:
> > Instead of hard-coding 10ms, just use the default exposure time
> > as determined by the V4L2 control. This ensures that the advertised
> > default in the `ControlInfo` matches what actually happens.
> >
> > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> > ---
> >   src/ipa/libipa/agc.cpp | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
> > index edcbab1e0b..54c5c6c349 100644
> > --- a/src/ipa/libipa/agc.cpp
> > +++ b/src/ipa/libipa/agc.cpp
> > @@ -355,7 +355,7 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, cons
> >   	/* Configure the default exposure and gain. */
> >   	state = {};
> >   	state.automatic.gain = session.minAnalogueGain;
> > -	state.automatic.exposure = clampExposure(10ms, session);
> > +	state.automatic.exposure = clampExposure(defExposure * session.lineDuration, session);
> >   	state.automatic.quantizationGain = 1;
> >   	state.automatic.yTarget = impl_.effectiveYTarget(0, 1);
> >   	state.manual.gain = state.automatic.gain;
>
> Note that I have just updated this change:
>
> diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
> index c0d690c802..876f11f5ad 100644
> --- a/src/ipa/libipa/agc.cpp
> +++ b/src/ipa/libipa/agc.cpp
> @@ -355,7 +355,7 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, cons
>         /* Configure the default exposure and gain. */
>         state = {};
>         state.automatic.gain = session.minAnalogueGain;
> -       state.automatic.exposure = clampExposure(10ms, session);
> +       state.automatic.exposure = defExposure;

So you can probably drop this patch as do this when introducing
AgcAlgorithm ?

Or maybe, as the code is copied, highlighting the change has value

Either ways
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>



>         state.automatic.quantizationGain = 1;
>         state.automatic.yTarget = impl_.effectiveYTarget(0, 1);
>         state.manual.gain = state.automatic.gain;
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp
index edcbab1e0b..54c5c6c349 100644
--- a/src/ipa/libipa/agc.cpp
+++ b/src/ipa/libipa/agc.cpp
@@ -355,7 +355,7 @@  int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, cons
 	/* Configure the default exposure and gain. */
 	state = {};
 	state.automatic.gain = session.minAnalogueGain;
-	state.automatic.exposure = clampExposure(10ms, session);
+	state.automatic.exposure = clampExposure(defExposure * session.lineDuration, session);
 	state.automatic.quantizationGain = 1;
 	state.automatic.yTarget = impl_.effectiveYTarget(0, 1);
 	state.manual.gain = state.automatic.gain;