[libcamera-devel,v4,02/32] ipa: ipu3: af: Pass context reference to afIsOutOfFocus()
diff mbox series

Message ID 20220908014200.28728-3-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • ipa: Frame context queue, IPU3 & RkISP consolidation, and RkISP1 improvements
Related show

Commit Message

Laurent Pinchart Sept. 8, 2022, 1:41 a.m. UTC
Avoid copying the whole IPA context by passing a reference to the
Af::afIsOutOfFocus() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/ipa/ipu3/algorithms/af.cpp | 2 +-
 src/ipa/ipu3/algorithms/af.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Bingham Sept. 20, 2022, 1:21 p.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2022-09-08 02:41:30)
> Avoid copying the whole IPA context by passing a reference to the
> Af::afIsOutOfFocus() function.

We need to disable/delete the implicit copy constructor of the IPA
context...

Is that something you have already?

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

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/ipa/ipu3/algorithms/af.cpp | 2 +-
>  src/ipa/ipu3/algorithms/af.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
> index 106a7614e2c7..9127c24f1287 100644
> --- a/src/ipa/ipu3/algorithms/af.cpp
> +++ b/src/ipa/ipu3/algorithms/af.cpp
> @@ -383,7 +383,7 @@ double Af::afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1)
>   * \return True if the variance threshold is crossed indicating lost focus,
>   * false otherwise
>   */
> -bool Af::afIsOutOfFocus(IPAContext context)
> +bool Af::afIsOutOfFocus(IPAContext &context)
>  {
>         const uint32_t diff_var = std::abs(currentVariance_ -
>                                            context.activeState.af.maxVariance);
> diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
> index ccf015f3f8f5..9b93594898bb 100644
> --- a/src/ipa/ipu3/algorithms/af.h
> +++ b/src/ipa/ipu3/algorithms/af.h
> @@ -44,7 +44,7 @@ private:
>         void afIgnoreFrameReset();
>         double afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1);
>  
> -       bool afIsOutOfFocus(IPAContext context);
> +       bool afIsOutOfFocus(IPAContext &context);
>  
>         /* VCM step configuration. It is the current setting of the VCM step. */
>         uint32_t focus_;
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart Sept. 20, 2022, 6:56 p.m. UTC | #2
Hi Kieran,

On Tue, Sep 20, 2022 at 02:21:46PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart via libcamera-devel (2022-09-08 02:41:30)
> > Avoid copying the whole IPA context by passing a reference to the
> > Af::afIsOutOfFocus() function.
> 
> We need to disable/delete the implicit copy constructor of the IPA
> context...
> 
> Is that something you have already?

No I don't. It would indeed be useful. That will need to be done
individually in IPA modules though, as there's no base class for the
context, but I don't think that's a problem. I'll add a patch on top.

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  src/ipa/ipu3/algorithms/af.cpp | 2 +-
> >  src/ipa/ipu3/algorithms/af.h   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
> > index 106a7614e2c7..9127c24f1287 100644
> > --- a/src/ipa/ipu3/algorithms/af.cpp
> > +++ b/src/ipa/ipu3/algorithms/af.cpp
> > @@ -383,7 +383,7 @@ double Af::afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1)
> >   * \return True if the variance threshold is crossed indicating lost focus,
> >   * false otherwise
> >   */
> > -bool Af::afIsOutOfFocus(IPAContext context)
> > +bool Af::afIsOutOfFocus(IPAContext &context)
> >  {
> >         const uint32_t diff_var = std::abs(currentVariance_ -
> >                                            context.activeState.af.maxVariance);
> > diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
> > index ccf015f3f8f5..9b93594898bb 100644
> > --- a/src/ipa/ipu3/algorithms/af.h
> > +++ b/src/ipa/ipu3/algorithms/af.h
> > @@ -44,7 +44,7 @@ private:
> >         void afIgnoreFrameReset();
> >         double afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1);
> >  
> > -       bool afIsOutOfFocus(IPAContext context);
> > +       bool afIsOutOfFocus(IPAContext &context);
> >  
> >         /* VCM step configuration. It is the current setting of the VCM step. */
> >         uint32_t focus_;
Jacopo Mondi Sept. 21, 2022, 10:01 a.m. UTC | #3
Hi Laurent

On Thu, Sep 08, 2022 at 04:41:30AM +0300, Laurent Pinchart via libcamera-devel wrote:
> Avoid copying the whole IPA context by passing a reference to the
> Af::afIsOutOfFocus() function.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j

> ---
>  src/ipa/ipu3/algorithms/af.cpp | 2 +-
>  src/ipa/ipu3/algorithms/af.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
> index 106a7614e2c7..9127c24f1287 100644
> --- a/src/ipa/ipu3/algorithms/af.cpp
> +++ b/src/ipa/ipu3/algorithms/af.cpp
> @@ -383,7 +383,7 @@ double Af::afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1)
>   * \return True if the variance threshold is crossed indicating lost focus,
>   * false otherwise
>   */
> -bool Af::afIsOutOfFocus(IPAContext context)
> +bool Af::afIsOutOfFocus(IPAContext &context)
>  {
>  	const uint32_t diff_var = std::abs(currentVariance_ -
>  					   context.activeState.af.maxVariance);
> diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
> index ccf015f3f8f5..9b93594898bb 100644
> --- a/src/ipa/ipu3/algorithms/af.h
> +++ b/src/ipa/ipu3/algorithms/af.h
> @@ -44,7 +44,7 @@ private:
>  	void afIgnoreFrameReset();
>  	double afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1);
>
> -	bool afIsOutOfFocus(IPAContext context);
> +	bool afIsOutOfFocus(IPAContext &context);
>
>  	/* VCM step configuration. It is the current setting of the VCM step. */
>  	uint32_t focus_;
> --
> Regards,
>
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
index 106a7614e2c7..9127c24f1287 100644
--- a/src/ipa/ipu3/algorithms/af.cpp
+++ b/src/ipa/ipu3/algorithms/af.cpp
@@ -383,7 +383,7 @@  double Af::afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1)
  * \return True if the variance threshold is crossed indicating lost focus,
  * false otherwise
  */
-bool Af::afIsOutOfFocus(IPAContext context)
+bool Af::afIsOutOfFocus(IPAContext &context)
 {
 	const uint32_t diff_var = std::abs(currentVariance_ -
 					   context.activeState.af.maxVariance);
diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
index ccf015f3f8f5..9b93594898bb 100644
--- a/src/ipa/ipu3/algorithms/af.h
+++ b/src/ipa/ipu3/algorithms/af.h
@@ -44,7 +44,7 @@  private:
 	void afIgnoreFrameReset();
 	double afEstimateVariance(Span<const y_table_item_t> y_items, bool isY1);
 
-	bool afIsOutOfFocus(IPAContext context);
+	bool afIsOutOfFocus(IPAContext &context);
 
 	/* VCM step configuration. It is the current setting of the VCM step. */
 	uint32_t focus_;