[libcamera-devel,v2,07/10] ipa: ipu3: convert AGC to the new algorithm interface
diff mbox series

Message ID 20210812165243.276977-8-jeanmichel.hautbois@ideasonboard.com
State Superseded
Headers show
Series
  • IPU3: Introduce modularity for algorithms
Related show

Commit Message

Jean-Michel Hautbois Aug. 12, 2021, 4:52 p.m. UTC
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 src/ipa/ipu3/ipu3.cpp     | 2 +-
 src/ipa/ipu3/ipu3_agc.cpp | 8 +++++---
 src/ipa/ipu3/ipu3_agc.h   | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

Comments

Kieran Bingham Aug. 13, 2021, 9:54 a.m. UTC | #1
On 12/08/2021 17:52, Jean-Michel Hautbois wrote:

Perhaps a little extra brief to summarise beyond the title?

"""
In preparation for using the AGC through the new algorithm interfaces,
convert the existing code to use the new function types.
"""

But I wonder if this would get squashed into the next patch.

If not, (and it might be good to keep it separated, as I can see the
changes to the functions required), then

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


> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  src/ipa/ipu3/ipu3.cpp     | 2 +-
>  src/ipa/ipu3/ipu3_agc.cpp | 8 +++++---
>  src/ipa/ipu3/ipu3_agc.h   | 2 +-
>  3 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index dba5554d..2a8225a0 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -232,7 +232,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)
>  	awbAlgo_ = std::make_unique<IPU3Awb>();
>  
>  	agcAlgo_ = std::make_unique<IPU3Agc>();
> -	agcAlgo_->initialise(context_.configuration.grid.bdsGrid, sensorInfo_);
> +	agcAlgo_->configure(context_, configInfo);
>  
>  	return 0;
>  }
> diff --git a/src/ipa/ipu3/ipu3_agc.cpp b/src/ipa/ipu3/ipu3_agc.cpp
> index c6782ff4..0cc35b9f 100644
> --- a/src/ipa/ipu3/ipu3_agc.cpp
> +++ b/src/ipa/ipu3/ipu3_agc.cpp
> @@ -59,12 +59,14 @@ IPU3Agc::IPU3Agc()
>  {
>  }
>  
> -void IPU3Agc::initialise(struct ipu3_uapi_grid_config &bdsGrid, const IPACameraSensorInfo &sensorInfo)
> +int IPU3Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)
>  {
> -	aeGrid_ = bdsGrid;
> +	aeGrid_ = context.configuration.grid.bdsGrid;
>  
> -	lineDuration_ = sensorInfo.lineLength * 1.0s / sensorInfo.pixelRate;
> +	lineDuration_ = configInfo.sensorInfo.lineLength * 1.0s / configInfo.sensorInfo.pixelRate;
>  	maxExposureTime_ = kMaxExposure * lineDuration_;
> +
> +	return 0;
>  }
>  
>  void IPU3Agc::processBrightness(const ipu3_uapi_stats_3a *stats)
> diff --git a/src/ipa/ipu3/ipu3_agc.h b/src/ipa/ipu3/ipu3_agc.h
> index 8b32e52f..e096648b 100644
> --- a/src/ipa/ipu3/ipu3_agc.h
> +++ b/src/ipa/ipu3/ipu3_agc.h
> @@ -29,7 +29,7 @@ public:
>  	IPU3Agc();
>  	~IPU3Agc() = default;
>  
> -	void initialise(struct ipu3_uapi_grid_config &bdsGrid, const IPACameraSensorInfo &sensorInfo);
> +	int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
>  	void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;
>  	bool converged() { return converged_; }
>  	bool updateControls() { return updateControls_; }
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index dba5554d..2a8225a0 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -232,7 +232,7 @@  int IPAIPU3::configure(const IPAConfigInfo &configInfo)
 	awbAlgo_ = std::make_unique<IPU3Awb>();
 
 	agcAlgo_ = std::make_unique<IPU3Agc>();
-	agcAlgo_->initialise(context_.configuration.grid.bdsGrid, sensorInfo_);
+	agcAlgo_->configure(context_, configInfo);
 
 	return 0;
 }
diff --git a/src/ipa/ipu3/ipu3_agc.cpp b/src/ipa/ipu3/ipu3_agc.cpp
index c6782ff4..0cc35b9f 100644
--- a/src/ipa/ipu3/ipu3_agc.cpp
+++ b/src/ipa/ipu3/ipu3_agc.cpp
@@ -59,12 +59,14 @@  IPU3Agc::IPU3Agc()
 {
 }
 
-void IPU3Agc::initialise(struct ipu3_uapi_grid_config &bdsGrid, const IPACameraSensorInfo &sensorInfo)
+int IPU3Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)
 {
-	aeGrid_ = bdsGrid;
+	aeGrid_ = context.configuration.grid.bdsGrid;
 
-	lineDuration_ = sensorInfo.lineLength * 1.0s / sensorInfo.pixelRate;
+	lineDuration_ = configInfo.sensorInfo.lineLength * 1.0s / configInfo.sensorInfo.pixelRate;
 	maxExposureTime_ = kMaxExposure * lineDuration_;
+
+	return 0;
 }
 
 void IPU3Agc::processBrightness(const ipu3_uapi_stats_3a *stats)
diff --git a/src/ipa/ipu3/ipu3_agc.h b/src/ipa/ipu3/ipu3_agc.h
index 8b32e52f..e096648b 100644
--- a/src/ipa/ipu3/ipu3_agc.h
+++ b/src/ipa/ipu3/ipu3_agc.h
@@ -29,7 +29,7 @@  public:
 	IPU3Agc();
 	~IPU3Agc() = default;
 
-	void initialise(struct ipu3_uapi_grid_config &bdsGrid, const IPACameraSensorInfo &sensorInfo);
+	int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
 	void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;
 	bool converged() { return converged_; }
 	bool updateControls() { return updateControls_; }