[libcamera-devel,v3,07/11] ipa: rkisp1: Use the Algorithm class
diff mbox series

Message ID 20211123150423.125524-8-jeanmichel.hautbois@ideasonboard.com
State Superseded
Headers show
Series
  • Introduce AGC for RkISP1
Related show

Commit Message

Jean-Michel Hautbois Nov. 23, 2021, 3:04 p.m. UTC
Now that libipa offers a templated class for Algorithm, use it in
RkISP1.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
 src/ipa/rkisp1/algorithms/meson.build |  4 ++++
 src/ipa/rkisp1/meson.build            |  4 ++++
 src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
 4 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
 create mode 100644 src/ipa/rkisp1/algorithms/meson.build

Comments

Laurent Pinchart Nov. 23, 2021, 3:09 p.m. UTC | #1
Hi Jean-Michel,

Thank you for the patch.

On Tue, Nov 23, 2021 at 04:04:19PM +0100, Jean-Michel Hautbois wrote:
> Now that libipa offers a templated class for Algorithm, use it in
> RkISP1.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
>  src/ipa/rkisp1/algorithms/meson.build |  4 ++++
>  src/ipa/rkisp1/meson.build            |  4 ++++
>  src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
>  4 files changed, 40 insertions(+), 1 deletion(-)
>  create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
>  create mode 100644 src/ipa/rkisp1/algorithms/meson.build
> 
> diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
> new file mode 100644
> index 00000000..dfa58727
> --- /dev/null
> +++ b/src/ipa/rkisp1/algorithms/algorithm.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> +/*
> + * Copyright (C) 2021, Ideas On Board
> + *
> + * algorithm.h - RkISP1 control algorithm interface
> + */
> +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> +
> +#include <linux/rkisp1-config.h>
> +
> +#include <libcamera/ipa/rkisp1_ipa_interface.h>
> +
> +#include <libipa/algorithm.h>
> +
> +#include "ipa_context.h"
> +
> +namespace libcamera {
> +
> +namespace ipa::rkisp1 {
> +
> +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
> +
> +} /* namespace ipa::rkisp1 */
> +
> +} /* namespace libcamera */
> +
> +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
> new file mode 100644
> index 00000000..1c6c59cf
> --- /dev/null
> +++ b/src/ipa/rkisp1/algorithms/meson.build
> @@ -0,0 +1,4 @@
> +# SPDX-License-Identifier: CC0-1.0
> +
> +rkisp1_ipa_algorithms = files([
> +])
> diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
> index 3683c922..8c822fbb 100644
> --- a/src/ipa/rkisp1/meson.build
> +++ b/src/ipa/rkisp1/meson.build
> @@ -1,5 +1,7 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
> +subdir('algorithms')
> +
>  ipa_name = 'ipa_rkisp1'
>  
>  rkisp1_ipa_sources = files([
> @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
>      'rkisp1.cpp',
>  ])
>  
> +rkisp1_ipa_sources += rkisp1_ipa_algorithms
> +
>  mod = shared_module(ipa_name,
>                      [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
>                      name_prefix : '',
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 34c3f9a2..0c54d8ec 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -25,7 +25,7 @@
>  
>  #include <libcamera/internal/mapped_framebuffer.h>
>  
> -#include "ipa_context.h"
> +#include "algorithms/algorithm.h"
>  #include "libipa/camera_sensor_helper.h"
>  
>  namespace libcamera {
> @@ -82,6 +82,9 @@ private:
>  
>  	/* Local parameter storage */
>  	struct IPAContext context_;
> +
> +	/* Maintain the algorithms used by the IPA */
> +	std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
>  };
>  
>  int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
Jean-Michel Hautbois Nov. 23, 2021, 3:09 p.m. UTC | #2
No comment ? :-)

On 23/11/2021 16:09, Laurent Pinchart wrote:
> Hi Jean-Michel,
> 
> Thank you for the patch.
> 
> On Tue, Nov 23, 2021 at 04:04:19PM +0100, Jean-Michel Hautbois wrote:
>> Now that libipa offers a templated class for Algorithm, use it in
>> RkISP1.
>>
>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
>> ---
>>   src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
>>   src/ipa/rkisp1/algorithms/meson.build |  4 ++++
>>   src/ipa/rkisp1/meson.build            |  4 ++++
>>   src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
>>   4 files changed, 40 insertions(+), 1 deletion(-)
>>   create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
>>   create mode 100644 src/ipa/rkisp1/algorithms/meson.build
>>
>> diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
>> new file mode 100644
>> index 00000000..dfa58727
>> --- /dev/null
>> +++ b/src/ipa/rkisp1/algorithms/algorithm.h
>> @@ -0,0 +1,28 @@
>> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
>> +/*
>> + * Copyright (C) 2021, Ideas On Board
>> + *
>> + * algorithm.h - RkISP1 control algorithm interface
>> + */
>> +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
>> +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
>> +
>> +#include <linux/rkisp1-config.h>
>> +
>> +#include <libcamera/ipa/rkisp1_ipa_interface.h>
>> +
>> +#include <libipa/algorithm.h>
>> +
>> +#include "ipa_context.h"
>> +
>> +namespace libcamera {
>> +
>> +namespace ipa::rkisp1 {
>> +
>> +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
>> +
>> +} /* namespace ipa::rkisp1 */
>> +
>> +} /* namespace libcamera */
>> +
>> +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
>> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
>> new file mode 100644
>> index 00000000..1c6c59cf
>> --- /dev/null
>> +++ b/src/ipa/rkisp1/algorithms/meson.build
>> @@ -0,0 +1,4 @@
>> +# SPDX-License-Identifier: CC0-1.0
>> +
>> +rkisp1_ipa_algorithms = files([
>> +])
>> diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
>> index 3683c922..8c822fbb 100644
>> --- a/src/ipa/rkisp1/meson.build
>> +++ b/src/ipa/rkisp1/meson.build
>> @@ -1,5 +1,7 @@
>>   # SPDX-License-Identifier: CC0-1.0
>>   
>> +subdir('algorithms')
>> +
>>   ipa_name = 'ipa_rkisp1'
>>   
>>   rkisp1_ipa_sources = files([
>> @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
>>       'rkisp1.cpp',
>>   ])
>>   
>> +rkisp1_ipa_sources += rkisp1_ipa_algorithms
>> +
>>   mod = shared_module(ipa_name,
>>                       [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
>>                       name_prefix : '',
>> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
>> index 34c3f9a2..0c54d8ec 100644
>> --- a/src/ipa/rkisp1/rkisp1.cpp
>> +++ b/src/ipa/rkisp1/rkisp1.cpp
>> @@ -25,7 +25,7 @@
>>   
>>   #include <libcamera/internal/mapped_framebuffer.h>
>>   
>> -#include "ipa_context.h"
>> +#include "algorithms/algorithm.h"
>>   #include "libipa/camera_sensor_helper.h"
>>   
>>   namespace libcamera {
>> @@ -82,6 +82,9 @@ private:
>>   
>>   	/* Local parameter storage */
>>   	struct IPAContext context_;
>> +
>> +	/* Maintain the algorithms used by the IPA */
>> +	std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
>>   };
>>   
>>   int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
>
Laurent Pinchart Nov. 23, 2021, 3:13 p.m. UTC | #3
On Tue, Nov 23, 2021 at 04:09:51PM +0100, Jean-Michel Hautbois wrote:
> No comment ? :-)

Do I always need to comment ? :-)

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> On 23/11/2021 16:09, Laurent Pinchart wrote:
> > Hi Jean-Michel,
> > 
> > Thank you for the patch.
> > 
> > On Tue, Nov 23, 2021 at 04:04:19PM +0100, Jean-Michel Hautbois wrote:
> >> Now that libipa offers a templated class for Algorithm, use it in
> >> RkISP1.
> >>
> >> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> >> ---
> >>   src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
> >>   src/ipa/rkisp1/algorithms/meson.build |  4 ++++
> >>   src/ipa/rkisp1/meson.build            |  4 ++++
> >>   src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
> >>   4 files changed, 40 insertions(+), 1 deletion(-)
> >>   create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
> >>   create mode 100644 src/ipa/rkisp1/algorithms/meson.build
> >>
> >> diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
> >> new file mode 100644
> >> index 00000000..dfa58727
> >> --- /dev/null
> >> +++ b/src/ipa/rkisp1/algorithms/algorithm.h
> >> @@ -0,0 +1,28 @@
> >> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> >> +/*
> >> + * Copyright (C) 2021, Ideas On Board
> >> + *
> >> + * algorithm.h - RkISP1 control algorithm interface
> >> + */
> >> +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> >> +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> >> +
> >> +#include <linux/rkisp1-config.h>
> >> +
> >> +#include <libcamera/ipa/rkisp1_ipa_interface.h>
> >> +
> >> +#include <libipa/algorithm.h>
> >> +
> >> +#include "ipa_context.h"
> >> +
> >> +namespace libcamera {
> >> +
> >> +namespace ipa::rkisp1 {
> >> +
> >> +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
> >> +
> >> +} /* namespace ipa::rkisp1 */
> >> +
> >> +} /* namespace libcamera */
> >> +
> >> +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
> >> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
> >> new file mode 100644
> >> index 00000000..1c6c59cf
> >> --- /dev/null
> >> +++ b/src/ipa/rkisp1/algorithms/meson.build
> >> @@ -0,0 +1,4 @@
> >> +# SPDX-License-Identifier: CC0-1.0
> >> +
> >> +rkisp1_ipa_algorithms = files([
> >> +])
> >> diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
> >> index 3683c922..8c822fbb 100644
> >> --- a/src/ipa/rkisp1/meson.build
> >> +++ b/src/ipa/rkisp1/meson.build
> >> @@ -1,5 +1,7 @@
> >>   # SPDX-License-Identifier: CC0-1.0
> >>   
> >> +subdir('algorithms')
> >> +
> >>   ipa_name = 'ipa_rkisp1'
> >>   
> >>   rkisp1_ipa_sources = files([
> >> @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
> >>       'rkisp1.cpp',
> >>   ])
> >>   
> >> +rkisp1_ipa_sources += rkisp1_ipa_algorithms
> >> +
> >>   mod = shared_module(ipa_name,
> >>                       [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
> >>                       name_prefix : '',
> >> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> >> index 34c3f9a2..0c54d8ec 100644
> >> --- a/src/ipa/rkisp1/rkisp1.cpp
> >> +++ b/src/ipa/rkisp1/rkisp1.cpp
> >> @@ -25,7 +25,7 @@
> >>   
> >>   #include <libcamera/internal/mapped_framebuffer.h>
> >>   
> >> -#include "ipa_context.h"
> >> +#include "algorithms/algorithm.h"
> >>   #include "libipa/camera_sensor_helper.h"
> >>   
> >>   namespace libcamera {
> >> @@ -82,6 +82,9 @@ private:
> >>   
> >>   	/* Local parameter storage */
> >>   	struct IPAContext context_;
> >> +
> >> +	/* Maintain the algorithms used by the IPA */
> >> +	std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
> >>   };
> >>   
> >>   int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
> >
Kieran Bingham Nov. 23, 2021, 3:34 p.m. UTC | #4
Quoting Jean-Michel Hautbois (2021-11-23 15:04:19)
> Now that libipa offers a templated class for Algorithm, use it in
> RkISP1.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
>  src/ipa/rkisp1/algorithms/meson.build |  4 ++++
>  src/ipa/rkisp1/meson.build            |  4 ++++
>  src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
>  4 files changed, 40 insertions(+), 1 deletion(-)
>  create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
>  create mode 100644 src/ipa/rkisp1/algorithms/meson.build
> 
> diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
> new file mode 100644
> index 00000000..dfa58727
> --- /dev/null
> +++ b/src/ipa/rkisp1/algorithms/algorithm.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> +/*
> + * Copyright (C) 2021, Ideas On Board
> + *
> + * algorithm.h - RkISP1 control algorithm interface
> + */
> +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__

We're under ipa/rkisp1/algorithms/algorithm.h
So with the current style, that might need an extra _ALGORITHM_

But it also feels a bit redundant to have
..._ALGORITHM_ALGORITHM_H__

> +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> +
> +#include <linux/rkisp1-config.h>
> +
> +#include <libcamera/ipa/rkisp1_ipa_interface.h>
> +
> +#include <libipa/algorithm.h>
> +
> +#include "ipa_context.h"
> +
> +namespace libcamera {
> +
> +namespace ipa::rkisp1 {
> +
> +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
> +
> +} /* namespace ipa::rkisp1 */
> +
> +} /* namespace libcamera */
> +
> +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
> new file mode 100644
> index 00000000..1c6c59cf
> --- /dev/null
> +++ b/src/ipa/rkisp1/algorithms/meson.build
> @@ -0,0 +1,4 @@
> +# SPDX-License-Identifier: CC0-1.0
> +
> +rkisp1_ipa_algorithms = files([
> +])
> diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
> index 3683c922..8c822fbb 100644
> --- a/src/ipa/rkisp1/meson.build
> +++ b/src/ipa/rkisp1/meson.build
> @@ -1,5 +1,7 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
> +subdir('algorithms')
> +
>  ipa_name = 'ipa_rkisp1'
>  
>  rkisp1_ipa_sources = files([
> @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
>      'rkisp1.cpp',
>  ])
>  
> +rkisp1_ipa_sources += rkisp1_ipa_algorithms
> +
>  mod = shared_module(ipa_name,
>                      [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
>                      name_prefix : '',
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 34c3f9a2..0c54d8ec 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -25,7 +25,7 @@
>  
>  #include <libcamera/internal/mapped_framebuffer.h>
>  
> -#include "ipa_context.h"

Is this intentionally removed?
I suspect it should be put after the libipa/camera_sensor_helper.h...

Which means libipa/camera_sensor_helper.h should probably have been put
before ipa_context.h in the patch that added that...

With the minors resolved:


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

> +#include "algorithms/algorithm.h"
>  #include "libipa/camera_sensor_helper.h"
>  
>  namespace libcamera {
> @@ -82,6 +82,9 @@ private:
>  
>         /* Local parameter storage */
>         struct IPAContext context_;
> +
> +       /* Maintain the algorithms used by the IPA */
> +       std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
>  };
>  
>  int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
> -- 
> 2.32.0
>
Jean-Michel Hautbois Nov. 23, 2021, 3:37 p.m. UTC | #5
On 23/11/2021 16:34, Kieran Bingham wrote:
> Quoting Jean-Michel Hautbois (2021-11-23 15:04:19)
>> Now that libipa offers a templated class for Algorithm, use it in
>> RkISP1.
>>
>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
>> ---
>>   src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
>>   src/ipa/rkisp1/algorithms/meson.build |  4 ++++
>>   src/ipa/rkisp1/meson.build            |  4 ++++
>>   src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
>>   4 files changed, 40 insertions(+), 1 deletion(-)
>>   create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
>>   create mode 100644 src/ipa/rkisp1/algorithms/meson.build
>>
>> diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
>> new file mode 100644
>> index 00000000..dfa58727
>> --- /dev/null
>> +++ b/src/ipa/rkisp1/algorithms/algorithm.h
>> @@ -0,0 +1,28 @@
>> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
>> +/*
>> + * Copyright (C) 2021, Ideas On Board
>> + *
>> + * algorithm.h - RkISP1 control algorithm interface
>> + */
>> +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> 
> We're under ipa/rkisp1/algorithms/algorithm.h
> So with the current style, that might need an extra _ALGORITHM_
> 
> But it also feels a bit redundant to have
> ..._ALGORITHM_ALGORITHM_H__

I really dislike this :-) ! And in IPU3 we have 
__LIBCAMERA_IPA_IPU3_ALGORITHM_H__

> 
>> +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
>> +
>> +#include <linux/rkisp1-config.h>
>> +
>> +#include <libcamera/ipa/rkisp1_ipa_interface.h>
>> +
>> +#include <libipa/algorithm.h>
>> +
>> +#include "ipa_context.h"
>> +
>> +namespace libcamera {
>> +
>> +namespace ipa::rkisp1 {
>> +
>> +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
>> +
>> +} /* namespace ipa::rkisp1 */
>> +
>> +} /* namespace libcamera */
>> +
>> +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
>> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
>> new file mode 100644
>> index 00000000..1c6c59cf
>> --- /dev/null
>> +++ b/src/ipa/rkisp1/algorithms/meson.build
>> @@ -0,0 +1,4 @@
>> +# SPDX-License-Identifier: CC0-1.0
>> +
>> +rkisp1_ipa_algorithms = files([
>> +])
>> diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
>> index 3683c922..8c822fbb 100644
>> --- a/src/ipa/rkisp1/meson.build
>> +++ b/src/ipa/rkisp1/meson.build
>> @@ -1,5 +1,7 @@
>>   # SPDX-License-Identifier: CC0-1.0
>>   
>> +subdir('algorithms')
>> +
>>   ipa_name = 'ipa_rkisp1'
>>   
>>   rkisp1_ipa_sources = files([
>> @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
>>       'rkisp1.cpp',
>>   ])
>>   
>> +rkisp1_ipa_sources += rkisp1_ipa_algorithms
>> +
>>   mod = shared_module(ipa_name,
>>                       [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
>>                       name_prefix : '',
>> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
>> index 34c3f9a2..0c54d8ec 100644
>> --- a/src/ipa/rkisp1/rkisp1.cpp
>> +++ b/src/ipa/rkisp1/rkisp1.cpp
>> @@ -25,7 +25,7 @@
>>   
>>   #include <libcamera/internal/mapped_framebuffer.h>
>>   
>> -#include "ipa_context.h"
> 
> Is this intentionally removed?

Yes, because it is now included by algorithm.h wchich need it to define 
its template parameter Context.

> I suspect it should be put after the libipa/camera_sensor_helper.h...
> 
> Which means libipa/camera_sensor_helper.h should probably have been put
> before ipa_context.h in the patch that added that...
> 
> With the minors resolved:
> 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
>> +#include "algorithms/algorithm.h"
>>   #include "libipa/camera_sensor_helper.h"
>>   
>>   namespace libcamera {
>> @@ -82,6 +82,9 @@ private:
>>   
>>          /* Local parameter storage */
>>          struct IPAContext context_;
>> +
>> +       /* Maintain the algorithms used by the IPA */
>> +       std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
>>   };
>>   
>>   int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
>> -- 
>> 2.32.0
>>
Kieran Bingham Nov. 23, 2021, 4:16 p.m. UTC | #6
Quoting Jean-Michel Hautbois (2021-11-23 15:37:41)
> 
> 
> On 23/11/2021 16:34, Kieran Bingham wrote:
> > Quoting Jean-Michel Hautbois (2021-11-23 15:04:19)
> >> Now that libipa offers a templated class for Algorithm, use it in
> >> RkISP1.
> >>
> >> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> >> ---
> >>   src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
> >>   src/ipa/rkisp1/algorithms/meson.build |  4 ++++
> >>   src/ipa/rkisp1/meson.build            |  4 ++++
> >>   src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
> >>   4 files changed, 40 insertions(+), 1 deletion(-)
> >>   create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
> >>   create mode 100644 src/ipa/rkisp1/algorithms/meson.build
> >>
> >> diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
> >> new file mode 100644
> >> index 00000000..dfa58727
> >> --- /dev/null
> >> +++ b/src/ipa/rkisp1/algorithms/algorithm.h
> >> @@ -0,0 +1,28 @@
> >> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> >> +/*
> >> + * Copyright (C) 2021, Ideas On Board
> >> + *
> >> + * algorithm.h - RkISP1 control algorithm interface
> >> + */
> >> +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> > 
> > We're under ipa/rkisp1/algorithms/algorithm.h
> > So with the current style, that might need an extra _ALGORITHM_
> > 
> > But it also feels a bit redundant to have
> > ..._ALGORITHM_ALGORITHM_H__
> 
> I really dislike this :-) ! And in IPU3 we have 
> __LIBCAMERA_IPA_IPU3_ALGORITHM_H__

Yes, me too - so lets leave it as it is.


> 
> > 
> >> +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> >> +
> >> +#include <linux/rkisp1-config.h>
> >> +
> >> +#include <libcamera/ipa/rkisp1_ipa_interface.h>
> >> +
> >> +#include <libipa/algorithm.h>
> >> +
> >> +#include "ipa_context.h"
> >> +
> >> +namespace libcamera {
> >> +
> >> +namespace ipa::rkisp1 {
> >> +
> >> +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
> >> +
> >> +} /* namespace ipa::rkisp1 */
> >> +
> >> +} /* namespace libcamera */
> >> +
> >> +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
> >> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
> >> new file mode 100644
> >> index 00000000..1c6c59cf
> >> --- /dev/null
> >> +++ b/src/ipa/rkisp1/algorithms/meson.build
> >> @@ -0,0 +1,4 @@
> >> +# SPDX-License-Identifier: CC0-1.0
> >> +
> >> +rkisp1_ipa_algorithms = files([
> >> +])
> >> diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
> >> index 3683c922..8c822fbb 100644
> >> --- a/src/ipa/rkisp1/meson.build
> >> +++ b/src/ipa/rkisp1/meson.build
> >> @@ -1,5 +1,7 @@
> >>   # SPDX-License-Identifier: CC0-1.0
> >>   
> >> +subdir('algorithms')
> >> +
> >>   ipa_name = 'ipa_rkisp1'
> >>   
> >>   rkisp1_ipa_sources = files([
> >> @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
> >>       'rkisp1.cpp',
> >>   ])
> >>   
> >> +rkisp1_ipa_sources += rkisp1_ipa_algorithms
> >> +
> >>   mod = shared_module(ipa_name,
> >>                       [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
> >>                       name_prefix : '',
> >> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> >> index 34c3f9a2..0c54d8ec 100644
> >> --- a/src/ipa/rkisp1/rkisp1.cpp
> >> +++ b/src/ipa/rkisp1/rkisp1.cpp
> >> @@ -25,7 +25,7 @@
> >>   
> >>   #include <libcamera/internal/mapped_framebuffer.h>
> >>   
> >> -#include "ipa_context.h"
> > 
> > Is this intentionally removed?
> 
> Yes, because it is now included by algorithm.h wchich need it to define 
> its template parameter Context.
> 

I'd be tempted to say it should still be specified here, as we shouldn't
rely on other component headers to provide the headers we need.

But equally we can't anticipate the algorithm.h to remove the context.h
as that's fundamental property of the algorithms.

IWYU [0] would complain, but either way, it won't bother me so much,
and my tag is already there.

[0] https://include-what-you-use.org/

> > I suspect it should be put after the libipa/camera_sensor_helper.h...
> > 
> > Which means libipa/camera_sensor_helper.h should probably have been put
> > before ipa_context.h in the patch that added that...
> > 
> > With the minors resolved:
> > 
> > 
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > 
> >> +#include "algorithms/algorithm.h"
> >>   #include "libipa/camera_sensor_helper.h"
> >>   
> >>   namespace libcamera {
> >> @@ -82,6 +82,9 @@ private:
> >>   
> >>          /* Local parameter storage */
> >>          struct IPAContext context_;
> >> +
> >> +       /* Maintain the algorithms used by the IPA */
> >> +       std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
> >>   };
> >>   
> >>   int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
> >> -- 
> >> 2.32.0
> >>
Laurent Pinchart Nov. 23, 2021, 4:59 p.m. UTC | #7
On Tue, Nov 23, 2021 at 03:34:48PM +0000, Kieran Bingham wrote:
> Quoting Jean-Michel Hautbois (2021-11-23 15:04:19)
> > Now that libipa offers a templated class for Algorithm, use it in
> > RkISP1.
> > 
> > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> > ---
> >  src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
> >  src/ipa/rkisp1/algorithms/meson.build |  4 ++++
> >  src/ipa/rkisp1/meson.build            |  4 ++++
> >  src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
> >  4 files changed, 40 insertions(+), 1 deletion(-)
> >  create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
> >  create mode 100644 src/ipa/rkisp1/algorithms/meson.build
> > 
> > diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
> > new file mode 100644
> > index 00000000..dfa58727
> > --- /dev/null
> > +++ b/src/ipa/rkisp1/algorithms/algorithm.h
> > @@ -0,0 +1,28 @@
> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> > +/*
> > + * Copyright (C) 2021, Ideas On Board
> > + *
> > + * algorithm.h - RkISP1 control algorithm interface
> > + */
> > +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> 
> We're under ipa/rkisp1/algorithms/algorithm.h
> So with the current style, that might need an extra _ALGORITHM_
> 
> But it also feels a bit redundant to have
> ..._ALGORITHM_ALGORITHM_H__

Can I volunteer someone to switch all our headers to "#pragma once" ?

> > +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> > +
> > +#include <linux/rkisp1-config.h>
> > +
> > +#include <libcamera/ipa/rkisp1_ipa_interface.h>
> > +
> > +#include <libipa/algorithm.h>
> > +
> > +#include "ipa_context.h"
> > +
> > +namespace libcamera {
> > +
> > +namespace ipa::rkisp1 {
> > +
> > +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
> > +
> > +} /* namespace ipa::rkisp1 */
> > +
> > +} /* namespace libcamera */
> > +
> > +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
> > diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
> > new file mode 100644
> > index 00000000..1c6c59cf
> > --- /dev/null
> > +++ b/src/ipa/rkisp1/algorithms/meson.build
> > @@ -0,0 +1,4 @@
> > +# SPDX-License-Identifier: CC0-1.0
> > +
> > +rkisp1_ipa_algorithms = files([
> > +])
> > diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
> > index 3683c922..8c822fbb 100644
> > --- a/src/ipa/rkisp1/meson.build
> > +++ b/src/ipa/rkisp1/meson.build
> > @@ -1,5 +1,7 @@
> >  # SPDX-License-Identifier: CC0-1.0
> >  
> > +subdir('algorithms')
> > +
> >  ipa_name = 'ipa_rkisp1'
> >  
> >  rkisp1_ipa_sources = files([
> > @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
> >      'rkisp1.cpp',
> >  ])
> >  
> > +rkisp1_ipa_sources += rkisp1_ipa_algorithms
> > +
> >  mod = shared_module(ipa_name,
> >                      [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
> >                      name_prefix : '',
> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> > index 34c3f9a2..0c54d8ec 100644
> > --- a/src/ipa/rkisp1/rkisp1.cpp
> > +++ b/src/ipa/rkisp1/rkisp1.cpp
> > @@ -25,7 +25,7 @@
> >  
> >  #include <libcamera/internal/mapped_framebuffer.h>
> >  
> > -#include "ipa_context.h"
> 
> Is this intentionally removed?
> I suspect it should be put after the libipa/camera_sensor_helper.h...
> 
> Which means libipa/camera_sensor_helper.h should probably have been put
> before ipa_context.h in the patch that added that...
> 
> With the minors resolved:
> 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > +#include "algorithms/algorithm.h"
> >  #include "libipa/camera_sensor_helper.h"
> >  
> >  namespace libcamera {
> > @@ -82,6 +82,9 @@ private:
> >  
> >         /* Local parameter storage */
> >         struct IPAContext context_;
> > +
> > +       /* Maintain the algorithms used by the IPA */
> > +       std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
> >  };
> >  
> >  int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
Kieran Bingham Nov. 23, 2021, 5:15 p.m. UTC | #8
Quoting Laurent Pinchart (2021-11-23 16:59:29)
> On Tue, Nov 23, 2021 at 03:34:48PM +0000, Kieran Bingham wrote:
> > Quoting Jean-Michel Hautbois (2021-11-23 15:04:19)
> > > Now that libipa offers a templated class for Algorithm, use it in
> > > RkISP1.
> > > 
> > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> > > ---
> > >  src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
> > >  src/ipa/rkisp1/algorithms/meson.build |  4 ++++
> > >  src/ipa/rkisp1/meson.build            |  4 ++++
> > >  src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
> > >  4 files changed, 40 insertions(+), 1 deletion(-)
> > >  create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
> > >  create mode 100644 src/ipa/rkisp1/algorithms/meson.build
> > > 
> > > diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
> > > new file mode 100644
> > > index 00000000..dfa58727
> > > --- /dev/null
> > > +++ b/src/ipa/rkisp1/algorithms/algorithm.h
> > > @@ -0,0 +1,28 @@
> > > +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> > > +/*
> > > + * Copyright (C) 2021, Ideas On Board
> > > + *
> > > + * algorithm.h - RkISP1 control algorithm interface
> > > + */
> > > +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> > 
> > We're under ipa/rkisp1/algorithms/algorithm.h
> > So with the current style, that might need an extra _ALGORITHM_
> > 
> > But it also feels a bit redundant to have
> > ..._ALGORITHM_ALGORITHM_H__
> 
> Can I volunteer someone to switch all our headers to "#pragma once" ?

I'd love to ... Can we do that? I thought I'd brought that up before and
for some reason we couldn't ...


Get ready for a patch storm...

Ok - so ... not straight away ...


> 
> > > +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> > > +
> > > +#include <linux/rkisp1-config.h>
> > > +
> > > +#include <libcamera/ipa/rkisp1_ipa_interface.h>
> > > +
> > > +#include <libipa/algorithm.h>
> > > +
> > > +#include "ipa_context.h"
> > > +
> > > +namespace libcamera {
> > > +
> > > +namespace ipa::rkisp1 {
> > > +
> > > +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
> > > +
> > > +} /* namespace ipa::rkisp1 */
> > > +
> > > +} /* namespace libcamera */
> > > +
> > > +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
> > > diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
> > > new file mode 100644
> > > index 00000000..1c6c59cf
> > > --- /dev/null
> > > +++ b/src/ipa/rkisp1/algorithms/meson.build
> > > @@ -0,0 +1,4 @@
> > > +# SPDX-License-Identifier: CC0-1.0
> > > +
> > > +rkisp1_ipa_algorithms = files([
> > > +])
> > > diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
> > > index 3683c922..8c822fbb 100644
> > > --- a/src/ipa/rkisp1/meson.build
> > > +++ b/src/ipa/rkisp1/meson.build
> > > @@ -1,5 +1,7 @@
> > >  # SPDX-License-Identifier: CC0-1.0
> > >  
> > > +subdir('algorithms')
> > > +
> > >  ipa_name = 'ipa_rkisp1'
> > >  
> > >  rkisp1_ipa_sources = files([
> > > @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
> > >      'rkisp1.cpp',
> > >  ])
> > >  
> > > +rkisp1_ipa_sources += rkisp1_ipa_algorithms
> > > +
> > >  mod = shared_module(ipa_name,
> > >                      [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
> > >                      name_prefix : '',
> > > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> > > index 34c3f9a2..0c54d8ec 100644
> > > --- a/src/ipa/rkisp1/rkisp1.cpp
> > > +++ b/src/ipa/rkisp1/rkisp1.cpp
> > > @@ -25,7 +25,7 @@
> > >  
> > >  #include <libcamera/internal/mapped_framebuffer.h>
> > >  
> > > -#include "ipa_context.h"
> > 
> > Is this intentionally removed?
> > I suspect it should be put after the libipa/camera_sensor_helper.h...
> > 
> > Which means libipa/camera_sensor_helper.h should probably have been put
> > before ipa_context.h in the patch that added that...
> > 
> > With the minors resolved:
> > 
> > 
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > 
> > > +#include "algorithms/algorithm.h"
> > >  #include "libipa/camera_sensor_helper.h"
> > >  
> > >  namespace libcamera {
> > > @@ -82,6 +82,9 @@ private:
> > >  
> > >         /* Local parameter storage */
> > >         struct IPAContext context_;
> > > +
> > > +       /* Maintain the algorithms used by the IPA */
> > > +       std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
> > >  };
> > >  
> > >  int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)
> 
> -- 
> Regards,
> 
> Laurent Pinchart
Laurent Pinchart Nov. 23, 2021, 5:31 p.m. UTC | #9
On Tue, Nov 23, 2021 at 05:15:33PM +0000, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2021-11-23 16:59:29)
> > On Tue, Nov 23, 2021 at 03:34:48PM +0000, Kieran Bingham wrote:
> > > Quoting Jean-Michel Hautbois (2021-11-23 15:04:19)
> > > > Now that libipa offers a templated class for Algorithm, use it in
> > > > RkISP1.
> > > > 
> > > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> > > > ---
> > > >  src/ipa/rkisp1/algorithms/algorithm.h | 28 +++++++++++++++++++++++++++
> > > >  src/ipa/rkisp1/algorithms/meson.build |  4 ++++
> > > >  src/ipa/rkisp1/meson.build            |  4 ++++
> > > >  src/ipa/rkisp1/rkisp1.cpp             |  5 ++++-
> > > >  4 files changed, 40 insertions(+), 1 deletion(-)
> > > >  create mode 100644 src/ipa/rkisp1/algorithms/algorithm.h
> > > >  create mode 100644 src/ipa/rkisp1/algorithms/meson.build
> > > > 
> > > > diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
> > > > new file mode 100644
> > > > index 00000000..dfa58727
> > > > --- /dev/null
> > > > +++ b/src/ipa/rkisp1/algorithms/algorithm.h
> > > > @@ -0,0 +1,28 @@
> > > > +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> > > > +/*
> > > > + * Copyright (C) 2021, Ideas On Board
> > > > + *
> > > > + * algorithm.h - RkISP1 control algorithm interface
> > > > + */
> > > > +#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> > > 
> > > We're under ipa/rkisp1/algorithms/algorithm.h
> > > So with the current style, that might need an extra _ALGORITHM_
> > > 
> > > But it also feels a bit redundant to have
> > > ..._ALGORITHM_ALGORITHM_H__
> > 
> > Can I volunteer someone to switch all our headers to "#pragma once" ?
> 
> I'd love to ... Can we do that? I thought I'd brought that up before and
> for some reason we couldn't ...

I've inquired about potential drawbacks before, and haven't found any
significant one, so I think we're good to go.

> Get ready for a patch storm...
> 
> Ok - so ... not straight away ...

:-)

> > > > +#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
> > > > +
> > > > +#include <linux/rkisp1-config.h>
> > > > +
> > > > +#include <libcamera/ipa/rkisp1_ipa_interface.h>
> > > > +
> > > > +#include <libipa/algorithm.h>
> > > > +
> > > > +#include "ipa_context.h"
> > > > +
> > > > +namespace libcamera {
> > > > +
> > > > +namespace ipa::rkisp1 {
> > > > +
> > > > +using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
> > > > +
> > > > +} /* namespace ipa::rkisp1 */
> > > > +
> > > > +} /* namespace libcamera */
> > > > +
> > > > +#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
> > > > diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
> > > > new file mode 100644
> > > > index 00000000..1c6c59cf
> > > > --- /dev/null
> > > > +++ b/src/ipa/rkisp1/algorithms/meson.build
> > > > @@ -0,0 +1,4 @@
> > > > +# SPDX-License-Identifier: CC0-1.0
> > > > +
> > > > +rkisp1_ipa_algorithms = files([
> > > > +])
> > > > diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
> > > > index 3683c922..8c822fbb 100644
> > > > --- a/src/ipa/rkisp1/meson.build
> > > > +++ b/src/ipa/rkisp1/meson.build
> > > > @@ -1,5 +1,7 @@
> > > >  # SPDX-License-Identifier: CC0-1.0
> > > >  
> > > > +subdir('algorithms')
> > > > +
> > > >  ipa_name = 'ipa_rkisp1'
> > > >  
> > > >  rkisp1_ipa_sources = files([
> > > > @@ -7,6 +9,8 @@ rkisp1_ipa_sources = files([
> > > >      'rkisp1.cpp',
> > > >  ])
> > > >  
> > > > +rkisp1_ipa_sources += rkisp1_ipa_algorithms
> > > > +
> > > >  mod = shared_module(ipa_name,
> > > >                      [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
> > > >                      name_prefix : '',
> > > > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> > > > index 34c3f9a2..0c54d8ec 100644
> > > > --- a/src/ipa/rkisp1/rkisp1.cpp
> > > > +++ b/src/ipa/rkisp1/rkisp1.cpp
> > > > @@ -25,7 +25,7 @@
> > > >  
> > > >  #include <libcamera/internal/mapped_framebuffer.h>
> > > >  
> > > > -#include "ipa_context.h"
> > > 
> > > Is this intentionally removed?
> > > I suspect it should be put after the libipa/camera_sensor_helper.h...
> > > 
> > > Which means libipa/camera_sensor_helper.h should probably have been put
> > > before ipa_context.h in the patch that added that...
> > > 
> > > With the minors resolved:
> > > 
> > > 
> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > > 
> > > > +#include "algorithms/algorithm.h"
> > > >  #include "libipa/camera_sensor_helper.h"
> > > >  
> > > >  namespace libcamera {
> > > > @@ -82,6 +82,9 @@ private:
> > > >  
> > > >         /* Local parameter storage */
> > > >         struct IPAContext context_;
> > > > +
> > > > +       /* Maintain the algorithms used by the IPA */
> > > > +       std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
> > > >  };
> > > >  
> > > >  int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/algorithm.h b/src/ipa/rkisp1/algorithms/algorithm.h
new file mode 100644
index 00000000..dfa58727
--- /dev/null
+++ b/src/ipa/rkisp1/algorithms/algorithm.h
@@ -0,0 +1,28 @@ 
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2021, Ideas On Board
+ *
+ * algorithm.h - RkISP1 control algorithm interface
+ */
+#ifndef __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
+#define __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__
+
+#include <linux/rkisp1-config.h>
+
+#include <libcamera/ipa/rkisp1_ipa_interface.h>
+
+#include <libipa/algorithm.h>
+
+#include "ipa_context.h"
+
+namespace libcamera {
+
+namespace ipa::rkisp1 {
+
+using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPACameraSensorInfo, rkisp1_params_cfg, rkisp1_stat_buffer>;
+
+} /* namespace ipa::rkisp1 */
+
+} /* namespace libcamera */
+
+#endif /* __LIBCAMERA_IPA_RKISP1_ALGORITHM_H__ */
diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build
new file mode 100644
index 00000000..1c6c59cf
--- /dev/null
+++ b/src/ipa/rkisp1/algorithms/meson.build
@@ -0,0 +1,4 @@ 
+# SPDX-License-Identifier: CC0-1.0
+
+rkisp1_ipa_algorithms = files([
+])
diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build
index 3683c922..8c822fbb 100644
--- a/src/ipa/rkisp1/meson.build
+++ b/src/ipa/rkisp1/meson.build
@@ -1,5 +1,7 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
+subdir('algorithms')
+
 ipa_name = 'ipa_rkisp1'
 
 rkisp1_ipa_sources = files([
@@ -7,6 +9,8 @@  rkisp1_ipa_sources = files([
     'rkisp1.cpp',
 ])
 
+rkisp1_ipa_sources += rkisp1_ipa_algorithms
+
 mod = shared_module(ipa_name,
                     [rkisp1_ipa_sources, libcamera_generated_ipa_headers],
                     name_prefix : '',
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 34c3f9a2..0c54d8ec 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -25,7 +25,7 @@ 
 
 #include <libcamera/internal/mapped_framebuffer.h>
 
-#include "ipa_context.h"
+#include "algorithms/algorithm.h"
 #include "libipa/camera_sensor_helper.h"
 
 namespace libcamera {
@@ -82,6 +82,9 @@  private:
 
 	/* Local parameter storage */
 	struct IPAContext context_;
+
+	/* Maintain the algorithms used by the IPA */
+	std::list<std::unique_ptr<ipa::rkisp1::Algorithm>> algorithms_;
 };
 
 int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)