summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3/ipu3.cpp
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-08-19 10:49:42 +0200
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-08-20 12:11:28 +0200
commitfcf56b9716ad5722e21d2d345a8708c21c88ae03 (patch)
tree829d3e14f492c4c16bea81301a6d5162ce5f55c8 /src/ipa/ipu3/ipu3.cpp
parent96dfda8e4b4ef3021f025ea295c10fec49e081d8 (diff)
ipa: ipu3: Introduce a modular tone mapping algorithm
Introduce a new algorithm to manage the tone mapping handling of the IPU3. The initial algorithm is chosen to configure the gamma contrast curve which moves the implementation out of AWB for simplicity. As it is initialised with a default gamma value of 1.1, there is no need to use the default table at initialisation anymore. This demonstrates the way to use process() call when the EventStatReady comes in. The function calculates the LUT in the context of a frame, and when prepare() is called, the parameters are filled with the updated values. AGC is modified to take the new process interface into account. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/ipu3/ipu3.cpp')
-rw-r--r--src/ipa/ipu3/ipu3.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 4d5b0af1..3713b07b 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -30,6 +30,7 @@
#include "libcamera/internal/mapped_framebuffer.h"
#include "algorithms/algorithm.h"
+#include "algorithms/tone_mapping.h"
#include "ipu3_agc.h"
#include "ipu3_awb.h"
#include "libipa/camera_sensor_helper.h"
@@ -91,6 +92,17 @@
* \brief BDS output size configured by the pipeline handler
*/
+/**
+ * \struct IPAFrameContext::toneMapping
+ * \brief Context for ToneMapping and Gamma control
+ *
+ * \var IPAFrameContext::toneMapping::gammaCorrection
+ * \brief Per-pixel tone mapping implemented as a LUT
+ *
+ * The LUT structure is defined by the IPU3 kernel interface. See
+ * <linux/intel-ipu3.h> struct ipu3_uapi_gamma_corr_lut for further details.
+ */
+
static constexpr uint32_t kMaxCellWidthPerSet = 160;
static constexpr uint32_t kMaxCellHeightPerSet = 56;
@@ -225,6 +237,9 @@ int IPAIPU3::init(const IPASettings &settings,
*ipaControls = ControlInfoMap(std::move(controls), controls::controls);
+ /* Construct our Algorithms */
+ algorithms_.push_back(std::make_unique<algorithms::ToneMapping>());
+
return 0;
}
@@ -423,7 +438,7 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
algo->prepare(context_, &params_);
if (agcAlgo_->updateControls())
- awbAlgo_->updateWbParameters(params_, agcAlgo_->gamma());
+ awbAlgo_->updateWbParameters(params_);
*params = params_;