[libcamera-devel,v1,07/10] ipa: raspberrypi: Make RegionStats::get() always return a Region struct
diff mbox series

Message ID 20230322130612.5208-8-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Raspberry Pi: Generalised algorithms
Related show

Commit Message

Naushir Patuck March 22, 2023, 1:06 p.m. UTC
Update the overloaded RegionStats::get() and RegionStats::getFloating()
member functions to return a Region struct for consistency.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/ipa/raspberrypi/controller/region_stats.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Plowman March 22, 2023, 1:56 p.m. UTC | #1
Hi Naush

Thanks for the patch.

On Wed, 22 Mar 2023 at 13:06, Naushir Patuck via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> Update the overloaded RegionStats::get() and RegionStats::getFloating()
> member functions to return a Region struct for consistency.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Thanks!
David

> ---
>  src/ipa/raspberrypi/controller/region_stats.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/controller/region_stats.h b/src/ipa/raspberrypi/controller/region_stats.h
> index 9aaf3a58a6f7..a8860dc8dba2 100644
> --- a/src/ipa/raspberrypi/controller/region_stats.h
> +++ b/src/ipa/raspberrypi/controller/region_stats.h
> @@ -86,12 +86,12 @@ public:
>                 return get_(index);
>         }
>
> -       const T &get(const libcamera::Point &pos) const
> +       const Region &get(const libcamera::Point &pos) const
>         {
>                 return get(pos.y * size_.width + pos.x);
>         }
>
> -       const T &getFloating(unsigned int index) const
> +       const Region &getFloating(unsigned int index) const
>         {
>                 if (index >= numFloatingRegions())
>                         return default_;
> --
> 2.34.1
>
Jacopo Mondi March 24, 2023, 9:13 a.m. UTC | #2
Hi Naush

On Wed, Mar 22, 2023 at 01:06:09PM +0000, Naushir Patuck via libcamera-devel wrote:
> Update the overloaded RegionStats::get() and RegionStats::getFloating()
> member functions to return a Region struct for consistency.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> ---
>  src/ipa/raspberrypi/controller/region_stats.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/controller/region_stats.h b/src/ipa/raspberrypi/controller/region_stats.h
> index 9aaf3a58a6f7..a8860dc8dba2 100644
> --- a/src/ipa/raspberrypi/controller/region_stats.h
> +++ b/src/ipa/raspberrypi/controller/region_stats.h
> @@ -86,12 +86,12 @@ public:
>  		return get_(index);
>  	}
>
> -	const T &get(const libcamera::Point &pos) const
> +	const Region &get(const libcamera::Point &pos) const

Was this working because Region has a first member of type T ?

Anyway, looks good
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j
>  	{
>  		return get(pos.y * size_.width + pos.x);
>  	}
>
> -	const T &getFloating(unsigned int index) const
> +	const Region &getFloating(unsigned int index) const
>  	{
>  		if (index >= numFloatingRegions())
>  			return default_;
> --
> 2.34.1
>
Naushir Patuck March 27, 2023, 10:49 a.m. UTC | #3
Hi Jacopo,

Thanks for your review!

On Fri, 24 Mar 2023 at 09:13, Jacopo Mondi <jacopo.mondi@ideasonboard.com>
wrote:

> Hi Naush
>
> On Wed, Mar 22, 2023 at 01:06:09PM +0000, Naushir Patuck via
> libcamera-devel wrote:
> > Update the overloaded RegionStats::get() and RegionStats::getFloating()
> > member functions to return a Region struct for consistency.
> >
> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> > ---
> >  src/ipa/raspberrypi/controller/region_stats.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/ipa/raspberrypi/controller/region_stats.h
> b/src/ipa/raspberrypi/controller/region_stats.h
> > index 9aaf3a58a6f7..a8860dc8dba2 100644
> > --- a/src/ipa/raspberrypi/controller/region_stats.h
> > +++ b/src/ipa/raspberrypi/controller/region_stats.h
> > @@ -86,12 +86,12 @@ public:
> >               return get_(index);
> >       }
> >
> > -     const T &get(const libcamera::Point &pos) const
> > +     const Region &get(const libcamera::Point &pos) const
>
> Was this working because Region has a first member of type T ?
>

This getter was at-this-point unused.  My usage expectation seemed to be
quite
wrong when I originally defined this :-)

Regards,
Naush


>
> Anyway, looks good
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
>
> Thanks
>   j
> >       {
> >               return get(pos.y * size_.width + pos.x);
> >       }
> >
> > -     const T &getFloating(unsigned int index) const
> > +     const Region &getFloating(unsigned int index) const
> >       {
> >               if (index >= numFloatingRegions())
> >                       return default_;
> > --
> > 2.34.1
> >
>

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/controller/region_stats.h b/src/ipa/raspberrypi/controller/region_stats.h
index 9aaf3a58a6f7..a8860dc8dba2 100644
--- a/src/ipa/raspberrypi/controller/region_stats.h
+++ b/src/ipa/raspberrypi/controller/region_stats.h
@@ -86,12 +86,12 @@  public:
 		return get_(index);
 	}
 
-	const T &get(const libcamera::Point &pos) const
+	const Region &get(const libcamera::Point &pos) const
 	{
 		return get(pos.y * size_.width + pos.x);
 	}
 
-	const T &getFloating(unsigned int index) const
+	const Region &getFloating(unsigned int index) const
 	{
 		if (index >= numFloatingRegions())
 			return default_;