[RFC,v2,2/8] libcamera: software_isp: Add LSC data to DebayerParams
diff mbox series

Message ID 20260420183949.110548-3-mzamazal@redhat.com
State New
Headers show
Series
  • LSC for SoftISP simple pipeline
Related show

Commit Message

Milan Zamazal April 20, 2026, 6:39 p.m. UTC
From: Xander Pronk <xander.c.pronk@gmail.com>

Add a lookup table for grid-based lens shading correction to debayer
params.  The lookup table is in the format of an RGB texture to be
passed to debayering.

The parameter is filled in by LSC algorithm implemented in a followup
patch.  If the algorithm is not enabled, the parameter content is
arbitrary and the parameter may not be used.  The parameter is currently
unused, its handling is implemented in a followup patch.

There is no special meaning about the selected grid size, it's
just one of the smaller common sizes.

Co-developed-by: Rick ten Wolde <rick_libcamera@wolde.info>
Signed-off-by: Rick ten Wolde <rick_libcamera@wolde.info>
Signed-off-by: Xander Pronk <xander.c.pronk@gmail.com>
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 .../internal/software_isp/debayer_params.h     |  5 +++++
 src/libcamera/software_isp/debayer.cpp         | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+)

Patch
diff mbox series

diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h
index 6772b43bc..3f25d3219 100644
--- a/include/libcamera/internal/software_isp/debayer_params.h
+++ b/include/libcamera/internal/software_isp/debayer_params.h
@@ -10,6 +10,7 @@ 
 
 #pragma once
 
+#include <array>
 #include <stdint.h>
 
 #include "libcamera/internal/matrix.h"
@@ -25,6 +26,10 @@  struct DebayerParams {
 	float gamma = 1.0;
 	float contrastExp = 1.0;
 	RGB<float> gains = RGB<float>({ 1.0, 1.0, 1.0 });
+
+	static constexpr unsigned int kLscGridSize = 16;
+	using LscLookupTable = std::array<uint8_t, 3 * kLscGridSize * kLscGridSize>;
+	LscLookupTable lscLut{};
 };
 
 } /* namespace libcamera */
diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp
index a6bceb58b..b60ebcd9b 100644
--- a/src/libcamera/software_isp/debayer.cpp
+++ b/src/libcamera/software_isp/debayer.cpp
@@ -49,6 +49,24 @@  namespace libcamera {
  * \brief Contrast value to be used as an exponent
  */
 
+/**
+ * \var DebayerParams::kLscGridSize
+ * \brief Number of lens shading grid areas in one direction
+ */
+
+/**
+ * \typedef DebayerParams::LscLookupTable
+ * \brief Lookup table for lens shading correction
+ *
+ * It's an array of bytes to be later used as a texture.
+ * The bytes are in row - column - RGB order.
+ */
+
+/**
+ * \var DebayerParams::lscLut
+ * \brief Lens shading lookup table
+ */
+
 /**
  * \class Debayer
  * \brief Base debayering class