libcamera: ipa: simple: Remove Lut algorithm

The Lut algorithm is not really an algorithm.  Moreover, algorithms may
be enabled or disabled but with Lut disabled, nothing will work.

Let's move the construction of lookup tables to CPU debayering, where it
is used.  The implied and related changes are:

- DebayerParams is changed to contain the real params rather than lookup
  tables.
- contrastExp parameter introduced by GPU ISP is used for CPU ISP too.
- The params must be initialised so that debayering gets meaningful
  parameter values even when some algorithms are disabled.
- combinedMatrix must be put to params everywhere where it is modified.
- Matrix changes needn't be tracked in the algorithms any more.
- CPU debayering must watch for changes of the corresponding parameters
  to update the lookup tables when and only when needed.
- Swapping red and blue is integrated into lookup table constructions.
- gpuIspEnabled flags are removed as they are not needed any more.

Reviewed-by: Robert Mader <robert.mader@collabora.com>
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Milan Zamazal
2026-01-28 15:20:34 +00:00
committed by Kieran Bingham
parent c43aeaade0
commit 3ffaa4c0e2
18 changed files with 188 additions and 478 deletions
+25 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2023, Linaro Ltd
* Copyright (C) 2023-2025 Red Hat Inc.
* Copyright (C) 2023-2026 Red Hat Inc.
*
* Authors:
* Hans de Goede <hdegoede@redhat.com>
@@ -18,6 +18,8 @@
#include <libcamera/base/object.h>
#include "libcamera/internal/bayer_format.h"
#include "libcamera/internal/global_configuration.h"
#include "libcamera/internal/software_isp/debayer_params.h"
#include "libcamera/internal/software_isp/swstats_cpu.h"
#include "debayer.h"
@@ -108,10 +110,32 @@ private:
void memcpyNextLine(const uint8_t *linePointers[]);
void process2(uint32_t frame, const uint8_t *src, uint8_t *dst);
void process4(uint32_t frame, const uint8_t *src, uint8_t *dst);
void updateGammaTable(DebayerParams &params);
void updateLookupTables(DebayerParams &params);
/* Max. supported Bayer pattern height is 4, debayering this requires 5 lines */
static constexpr unsigned int kMaxLineBuffers = 5;
static constexpr unsigned int kRGBLookupSize = 256;
static constexpr unsigned int kGammaLookupSize = 1024;
struct CcmColumn {
int16_t r;
int16_t g;
int16_t b;
};
using LookupTable = std::array<uint8_t, kRGBLookupSize>;
using CcmLookupTable = std::array<CcmColumn, kRGBLookupSize>;
LookupTable red_;
LookupTable green_;
LookupTable blue_;
CcmLookupTable redCcm_;
CcmLookupTable greenCcm_;
CcmLookupTable blueCcm_;
std::array<double, kGammaLookupSize> gammaTable_;
LookupTable gammaLut_;
bool ccmEnabled_;
DebayerParams params_;
debayerFn debayer0_;
debayerFn debayer1_;
debayerFn debayer2_;