[libcamera-devel,v2,2/3] ipa: rkisp1: Add enable field for LSC algorithm in IPA context
diff mbox series

Message ID 20220805124027.530212-3-fsylvestre@baylibre.com
State Accepted
Headers show
Series
  • Add DPF tuning support for RkISP1
Related show

Commit Message

Florian Sylvestre Aug. 5, 2022, 12:40 p.m. UTC
Add an enable variable in the lsc struct in IPASessionConfiguration which
indicates if the lsc algorithm has been configured. This will allow other
algorithms to retrieve this information.

Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/lsc.cpp | 10 ++++++++++
 src/ipa/rkisp1/algorithms/lsc.h   |  1 +
 src/ipa/rkisp1/ipa_context.cpp    |  8 ++++++++
 src/ipa/rkisp1/ipa_context.h      |  4 ++++
 4 files changed, 23 insertions(+)

Comments

Laurent Pinchart Aug. 5, 2022, 8:14 p.m. UTC | #1
Hi Florian,

Thank you for the patch.

On Fri, Aug 05, 2022 at 02:40:26PM +0200, Florian Sylvestre wrote:
> Add an enable variable in the lsc struct in IPASessionConfiguration which
> indicates if the lsc algorithm has been configured. This will allow other
> algorithms to retrieve this information.
> 
> Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/ipa/rkisp1/algorithms/lsc.cpp | 10 ++++++++++
>  src/ipa/rkisp1/algorithms/lsc.h   |  1 +
>  src/ipa/rkisp1/ipa_context.cpp    |  8 ++++++++
>  src/ipa/rkisp1/ipa_context.h      |  4 ++++
>  4 files changed, 23 insertions(+)
> 
> diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp
> index 05c8c0da..da287ac7 100644
> --- a/src/ipa/rkisp1/algorithms/lsc.cpp
> +++ b/src/ipa/rkisp1/algorithms/lsc.cpp
> @@ -119,6 +119,16 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,
>  	return 0;
>  }
>  
> +/**
> + * \copydoc libcamera::ipa::Algorithm::configure
> + */
> +int LensShadingCorrection::configure(IPAContext &context,
> +				     [[maybe_unused]] const IPACameraSensorInfo &configInfo)
> +{
> +	context.configuration.lsc.enabled = initialized_;
> +	return 0;
> +}
> +
>  /**
>   * \copydoc libcamera::ipa::Algorithm::prepare
>   */
> diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h
> index fdb2ec1d..f68602c0 100644
> --- a/src/ipa/rkisp1/algorithms/lsc.h
> +++ b/src/ipa/rkisp1/algorithms/lsc.h
> @@ -20,6 +20,7 @@ public:
>  	~LensShadingCorrection() = default;
>  
>  	int init(IPAContext &context, const YamlObject &tuningData) override;
> +	int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
>  	void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
>  
>  private:
> diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp
> index 23a63f8c..1338ae40 100644
> --- a/src/ipa/rkisp1/ipa_context.cpp
> +++ b/src/ipa/rkisp1/ipa_context.cpp
> @@ -92,6 +92,14 @@ namespace libcamera::ipa::rkisp1 {
>   * \brief Indicates if the AWB hardware is enabled to apply colour gains
>   */
>  
> +/**
> + * \var IPASessionConfiguration::lsc
> + * \brief Lens Shading Correction configuration of the IPA
> + *
> + * \var IPASessionConfiguration::lsc.enabled
> + * \brief Indicates if the LSC hardware is enabled to apply LSC algorithm

For AWB things were a bit unclear as the AWB modules handles both the
colour gains and the statistics calculation, and the term "AWB enabled"
usually means that the colour gains are computed automatically. Here we
can express things in a more simple way:

 * \var IPASessionConfiguration::lsc.enabled
 * \brief Indicates if the LSC hardware is enabled

I'll fix when applying.

> + */
> +
>  /**
>   * \var IPASessionConfiguration::sensor
>   * \brief Sensor-specific configuration of the IPA
> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
> index 7f7b3e4d..0cd6aadb 100644
> --- a/src/ipa/rkisp1/ipa_context.h
> +++ b/src/ipa/rkisp1/ipa_context.h
> @@ -32,6 +32,10 @@ struct IPASessionConfiguration {
>  		bool enabled;
>  	} awb;
>  
> +	struct {
> +		bool enabled;
> +	} lsc;
> +
>  	struct {
>  		utils::Duration lineDuration;
>  		Size size;

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp
index 05c8c0da..da287ac7 100644
--- a/src/ipa/rkisp1/algorithms/lsc.cpp
+++ b/src/ipa/rkisp1/algorithms/lsc.cpp
@@ -119,6 +119,16 @@  int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,
 	return 0;
 }
 
+/**
+ * \copydoc libcamera::ipa::Algorithm::configure
+ */
+int LensShadingCorrection::configure(IPAContext &context,
+				     [[maybe_unused]] const IPACameraSensorInfo &configInfo)
+{
+	context.configuration.lsc.enabled = initialized_;
+	return 0;
+}
+
 /**
  * \copydoc libcamera::ipa::Algorithm::prepare
  */
diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h
index fdb2ec1d..f68602c0 100644
--- a/src/ipa/rkisp1/algorithms/lsc.h
+++ b/src/ipa/rkisp1/algorithms/lsc.h
@@ -20,6 +20,7 @@  public:
 	~LensShadingCorrection() = default;
 
 	int init(IPAContext &context, const YamlObject &tuningData) override;
+	int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
 	void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
 
 private:
diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp
index 23a63f8c..1338ae40 100644
--- a/src/ipa/rkisp1/ipa_context.cpp
+++ b/src/ipa/rkisp1/ipa_context.cpp
@@ -92,6 +92,14 @@  namespace libcamera::ipa::rkisp1 {
  * \brief Indicates if the AWB hardware is enabled to apply colour gains
  */
 
+/**
+ * \var IPASessionConfiguration::lsc
+ * \brief Lens Shading Correction configuration of the IPA
+ *
+ * \var IPASessionConfiguration::lsc.enabled
+ * \brief Indicates if the LSC hardware is enabled to apply LSC algorithm
+ */
+
 /**
  * \var IPASessionConfiguration::sensor
  * \brief Sensor-specific configuration of the IPA
diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index 7f7b3e4d..0cd6aadb 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -32,6 +32,10 @@  struct IPASessionConfiguration {
 		bool enabled;
 	} awb;
 
+	struct {
+		bool enabled;
+	} lsc;
+
 	struct {
 		utils::Duration lineDuration;
 		Size size;