@@ -34,6 +34,9 @@ struct DebayerParams {
kLscValuesPerCell * sizeof(LscValueType);
using LscLookupTable =
std::array<LscValueType, kLscGridSize * kLscGridSize * kLscValuesPerCell>;
+ enum LscType : uint32_t {
+ LscTable,
+ };
LscLookupTable lscLut{};
};
@@ -17,13 +17,22 @@ LOG_DEFINE_CATEGORY(IPASoftLsc)
int Lsc::init(IPAContext &context, const ValueNode &tuningData)
{
- int retR = lscR_.readYaml(tuningData["sets"], "ct", "r");
- int retG = lscG_.readYaml(tuningData["sets"], "ct", "g");
- int retB = lscB_.readYaml(tuningData["sets"], "ct", "b");
-
- if (retR < 0 || retG < 0 || retB < 0) {
- LOG(IPASoftLsc, Error)
- << "Failed to parse 'lsc' parameter from tuning file.";
+ std::string type = tuningData["type"].get<std::string>("table");
+
+ if (type == "table") {
+ int retR = lscR_.readYaml(tuningData["sets"], "ct", "r");
+ int retG = lscG_.readYaml(tuningData["sets"], "ct", "g");
+ int retB = lscB_.readYaml(tuningData["sets"], "ct", "b");
+
+ if (retR < 0 || retG < 0 || retB < 0) {
+ LOG(IPASoftLsc, Error)
+ << "Failed to parse 'lsc' parameter from tuning file.";
+ return -EINVAL;
+ }
+
+ type_ = DebayerParams::LscTable;
+ } else {
+ LOG(IPASoftLsc, Error) << "LSC: type " << type << " not supported";
return -EINVAL;
}
@@ -31,6 +31,7 @@ public:
private:
using LscMatrix = Matrix<float, DebayerParams::kLscGridSize, DebayerParams::kLscGridSize>;
+ DebayerParams::LscType type_;
Interpolator<LscMatrix> lscR_;
Interpolator<LscMatrix> lscG_;
Interpolator<LscMatrix> lscB_;
@@ -53,6 +53,16 @@ namespace libcamera {
* \brief Number of pixel values per each of the lens shading grid areas
*/
+/**
+ * \enum DebayerParams::LscType
+ * \brief Type of lens shading correction to apply
+ */
+
+/**
+ * \var DebayerParams::LscTable
+ * \brief Lens shading correction using a lookup table
+ */
+
/**
* \typedef DebayerParams::LscValueType
* \brief Type of LSC grid values
Add a `type' YAML item to the lens shading correction algorithm, in order to distinguish between different methods and their parameters. It is the same as in rkisp1 IPA. A corresponding class variable is added to Lsc. The only supported type for the moment is `table', for the grid-based LSC already implemented. The LSC type will be passed through the IPA interface in a followup patch. For this reason, it's defined as an enum based on uint32_t rather than as an `enum class', so that it can be passed through the Mojo interface as a simple integer without further arrangements. The Lsc algorithm YAML definition has now a new required item type: table to indicate the LSC method to be used. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- .../internal/software_isp/debayer_params.h | 3 +++ src/ipa/simple/algorithms/lsc.cpp | 23 +++++++++++++------ src/ipa/simple/algorithms/lsc.h | 1 + src/libcamera/software_isp/debayer.cpp | 10 ++++++++ 4 files changed, 30 insertions(+), 7 deletions(-)