[v4,2/4] ipa: ipu3: Add constructor to the IPA context
diff mbox series

Message ID 20241126091509.89677-3-mzamazal@redhat.com
State New
Headers show
Series
  • Add contrast control to software ISP
Related show

Commit Message

Milan Zamazal Nov. 26, 2024, 9:15 a.m. UTC
Let's have a constructor that takes just the non-default argument,
without the need to specify the defaults.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/ipa/ipu3/ipa_context.cpp | 4 ++++
 src/ipa/ipu3/ipa_context.h   | 5 +++++
 src/ipa/ipu3/ipu3.cpp        | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

Comments

Kieran Bingham Nov. 26, 2024, 9:32 a.m. UTC | #1
Quoting Milan Zamazal (2024-11-26 09:15:03)
> Let's have a constructor that takes just the non-default argument,
> without the need to specify the defaults.
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>

Thank you for changing this one too!


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

> ---
>  src/ipa/ipu3/ipa_context.cpp | 4 ++++
>  src/ipa/ipu3/ipa_context.h   | 5 +++++
>  src/ipa/ipu3/ipu3.cpp        | 2 +-
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp
> index 917d06541..76eeb52fe 100644
> --- a/src/ipa/ipu3/ipa_context.cpp
> +++ b/src/ipa/ipu3/ipa_context.cpp
> @@ -39,6 +39,10 @@ namespace libcamera::ipa::ipu3 {
>   * \struct IPAContext
>   * \brief Global IPA context data shared between all algorithms
>   *
> + * \fn IPAContext::IPAContext
> + * \brief Initialize the instance with the given number of frame contexts
> + * \param[in] frameContextSize Size of the frame context ring buffer
> + *
>   * \var IPAContext::configuration
>   * \brief The IPA session configuration, immutable during the session
>   *
> diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h
> index c85d1e34e..24f51a296 100644
> --- a/src/ipa/ipu3/ipa_context.h
> +++ b/src/ipa/ipu3/ipa_context.h
> @@ -84,6 +84,11 @@ struct IPAFrameContext : public FrameContext {
>  };
>  
>  struct IPAContext {
> +       IPAContext(unsigned int frameContextSize)
> +               : frameContexts(frameContextSize)
> +       {
> +       }
> +
>         IPASessionConfiguration configuration;
>         IPAActiveState activeState;
>  
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 89c3192c6..b65dea122 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -187,7 +187,7 @@ private:
>  };
>  
>  IPAIPU3::IPAIPU3()
> -       : context_({ {}, {}, { kMaxFrameContexts }, {} })
> +       : context_(kMaxFrameContexts)
>  {
>  }
>  
> -- 
> 2.44.2
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp
index 917d06541..76eeb52fe 100644
--- a/src/ipa/ipu3/ipa_context.cpp
+++ b/src/ipa/ipu3/ipa_context.cpp
@@ -39,6 +39,10 @@  namespace libcamera::ipa::ipu3 {
  * \struct IPAContext
  * \brief Global IPA context data shared between all algorithms
  *
+ * \fn IPAContext::IPAContext
+ * \brief Initialize the instance with the given number of frame contexts
+ * \param[in] frameContextSize Size of the frame context ring buffer
+ *
  * \var IPAContext::configuration
  * \brief The IPA session configuration, immutable during the session
  *
diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h
index c85d1e34e..24f51a296 100644
--- a/src/ipa/ipu3/ipa_context.h
+++ b/src/ipa/ipu3/ipa_context.h
@@ -84,6 +84,11 @@  struct IPAFrameContext : public FrameContext {
 };
 
 struct IPAContext {
+	IPAContext(unsigned int frameContextSize)
+		: frameContexts(frameContextSize)
+	{
+	}
+
 	IPASessionConfiguration configuration;
 	IPAActiveState activeState;
 
diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 89c3192c6..b65dea122 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -187,7 +187,7 @@  private:
 };
 
 IPAIPU3::IPAIPU3()
-	: context_({ {}, {}, { kMaxFrameContexts }, {} })
+	: context_(kMaxFrameContexts)
 {
 }