[libcamera-devel,v3,10/19] ipa: ipu3: tonemapping: Add the documentation for ToneMapping
diff mbox series

Message ID 20211022151218.111966-11-jeanmichel.hautbois@ideasonboard.com
State Changes Requested
Headers show
Series
  • Document IPU3 IPA
Related show

Commit Message

Jean-Michel Hautbois Oct. 22, 2021, 3:12 p.m. UTC
The Tone mapping algorithm is currently undocumented.

Provide an introduction and overview to the implementation as the class
definition and document how the algorithm operates in the process and
prepare methods.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

---
v3:
- rename gamma control as tone mapping
---
 src/ipa/ipu3/algorithms/tone_mapping.cpp | 30 +++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Oct. 25, 2021, 9:26 p.m. UTC | #1
Hi Jean-Michel,

Thank you for the patch.

On Fri, Oct 22, 2021 at 05:12:09PM +0200, Jean-Michel Hautbois wrote:
> The Tone mapping algorithm is currently undocumented.

s/Tone/tone/

> Provide an introduction and overview to the implementation as the class
> definition and document how the algorithm operates in the process and
> prepare methods.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

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

> ---
> v3:
> - rename gamma control as tone mapping
> ---
>  src/ipa/ipu3/algorithms/tone_mapping.cpp | 30 +++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp
> index 8fa8c7e9..832e5670 100644
> --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp
> +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp
> @@ -10,10 +10,22 @@
>  #include <cmath>
>  #include <string.h>
>  
> +/**
> + * \file tone_mapping.h
> + */
> +
>  namespace libcamera {
>  
>  namespace ipa::ipu3::algorithms {
>  
> +/**
> + * \class ToneMapping
> + * \brief A class to handle tone mapping based on gamma
> + *
> + * This algorithm improves the image dynamic using a look-up table which is
> + * generated based on a gamma parameter.
> + */
> +
>  ToneMapping::ToneMapping()
>  	: gamma_(1.0)
>  {
> @@ -35,6 +47,14 @@ int ToneMapping::configure(IPAContext &context,
>  	return 0;
>  }
>  
> +/**
> + * \brief Fill in the parameter structure, and enable gamma control
> + * \param context The shared IPA context
> + * \param params The IPU3 parameters
> + *
> + * Populate the IPU3 parameter structure with our tone mapping look up table and
> + * enable the gamma control module in the processing blocks.
> + */
>  void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
>  			  ipu3_uapi_params *params)
>  {
> @@ -49,7 +69,15 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
>  	params->acc_param.gamma.gc_ctrl.enable = 1;
>  }
>  
> -void ToneMapping::process([[maybe_unused]] IPAContext &context,
> +/**
> + * \brief Calculate the tone mapping look up table
> + * \param context The shared IPA context
> + * \param stats The IPU3 statistics and ISP results
> + *
> + * The tone mapping look up table is generated as an inverse power curve from
> + * our gamma setting.
> + */
> +void ToneMapping::process(IPAContext &context,
>  			  [[maybe_unused]] const ipu3_uapi_stats_3a *stats)
>  {
>  	/*
Kieran Bingham Oct. 25, 2021, 9:34 p.m. UTC | #2
Quoting Laurent Pinchart (2021-10-25 22:26:07)
> Hi Jean-Michel,
> 
> Thank you for the patch.
> 
> On Fri, Oct 22, 2021 at 05:12:09PM +0200, Jean-Michel Hautbois wrote:
> > The Tone mapping algorithm is currently undocumented.
> 
> s/Tone/tone/
> 
> > Provide an introduction and overview to the implementation as the class
> > definition and document how the algorithm operates in the process and
> > prepare methods.
> > 
> > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

> > ---
> > v3:
> > - rename gamma control as tone mapping
> > ---
> >  src/ipa/ipu3/algorithms/tone_mapping.cpp | 30 +++++++++++++++++++++++-
> >  1 file changed, 29 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp
> > index 8fa8c7e9..832e5670 100644
> > --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp
> > +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp
> > @@ -10,10 +10,22 @@
> >  #include <cmath>
> >  #include <string.h>
> >  
> > +/**
> > + * \file tone_mapping.h
> > + */
> > +
> >  namespace libcamera {
> >  
> >  namespace ipa::ipu3::algorithms {
> >  
> > +/**
> > + * \class ToneMapping
> > + * \brief A class to handle tone mapping based on gamma
> > + *
> > + * This algorithm improves the image dynamic using a look-up table which is
> > + * generated based on a gamma parameter.
> > + */
> > +
> >  ToneMapping::ToneMapping()
> >       : gamma_(1.0)
> >  {
> > @@ -35,6 +47,14 @@ int ToneMapping::configure(IPAContext &context,
> >       return 0;
> >  }
> >  
> > +/**
> > + * \brief Fill in the parameter structure, and enable gamma control
> > + * \param context The shared IPA context
> > + * \param params The IPU3 parameters
> > + *
> > + * Populate the IPU3 parameter structure with our tone mapping look up table and
> > + * enable the gamma control module in the processing blocks.
> > + */
> >  void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
> >                         ipu3_uapi_params *params)
> >  {
> > @@ -49,7 +69,15 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
> >       params->acc_param.gamma.gc_ctrl.enable = 1;
> >  }
> >  
> > -void ToneMapping::process([[maybe_unused]] IPAContext &context,
> > +/**
> > + * \brief Calculate the tone mapping look up table
> > + * \param context The shared IPA context
> > + * \param stats The IPU3 statistics and ISP results
> > + *
> > + * The tone mapping look up table is generated as an inverse power curve from
> > + * our gamma setting.
> > + */
> > +void ToneMapping::process(IPAContext &context,
> >                         [[maybe_unused]] const ipu3_uapi_stats_3a *stats)
> >  {
> >       /*
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp
index 8fa8c7e9..832e5670 100644
--- a/src/ipa/ipu3/algorithms/tone_mapping.cpp
+++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp
@@ -10,10 +10,22 @@ 
 #include <cmath>
 #include <string.h>
 
+/**
+ * \file tone_mapping.h
+ */
+
 namespace libcamera {
 
 namespace ipa::ipu3::algorithms {
 
+/**
+ * \class ToneMapping
+ * \brief A class to handle tone mapping based on gamma
+ *
+ * This algorithm improves the image dynamic using a look-up table which is
+ * generated based on a gamma parameter.
+ */
+
 ToneMapping::ToneMapping()
 	: gamma_(1.0)
 {
@@ -35,6 +47,14 @@  int ToneMapping::configure(IPAContext &context,
 	return 0;
 }
 
+/**
+ * \brief Fill in the parameter structure, and enable gamma control
+ * \param context The shared IPA context
+ * \param params The IPU3 parameters
+ *
+ * Populate the IPU3 parameter structure with our tone mapping look up table and
+ * enable the gamma control module in the processing blocks.
+ */
 void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
 			  ipu3_uapi_params *params)
 {
@@ -49,7 +69,15 @@  void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
 	params->acc_param.gamma.gc_ctrl.enable = 1;
 }
 
-void ToneMapping::process([[maybe_unused]] IPAContext &context,
+/**
+ * \brief Calculate the tone mapping look up table
+ * \param context The shared IPA context
+ * \param stats The IPU3 statistics and ISP results
+ *
+ * The tone mapping look up table is generated as an inverse power curve from
+ * our gamma setting.
+ */
+void ToneMapping::process(IPAContext &context,
 			  [[maybe_unused]] const ipu3_uapi_stats_3a *stats)
 {
 	/*