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 12:44:01 +01:00
committed by Kieran Bingham
parent c43aeaade0
commit 3ffaa4c0e2
18 changed files with 188 additions and 478 deletions

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2023-2025 Red Hat Inc.
* Copyright (C) 2023-2026 Red Hat Inc.
*
* Authors:
* Hans de Goede <hdegoede@redhat.com>
@@ -10,7 +10,6 @@
#pragma once
#include <array>
#include <stdint.h>
#include "libcamera/internal/matrix.h"
@@ -19,47 +18,11 @@
namespace libcamera {
struct DebayerParams {
static constexpr unsigned int kRGBLookupSize = 256;
struct CcmColumn {
int16_t r;
int16_t g;
int16_t b;
};
using LookupTable = std::array<uint8_t, kRGBLookupSize>;
using CcmLookupTable = std::array<CcmColumn, kRGBLookupSize>;
/*
* Color lookup tables when CCM is not used.
*
* Each color of a debayered pixel is amended by the corresponding
* value in the given table.
*/
LookupTable red;
LookupTable green;
LookupTable blue;
/*
* Color and gamma lookup tables when CCM is used.
*
* Each of the CcmLookupTable's corresponds to a CCM column; together they
* make a complete 3x3 CCM lookup table. The CCM is applied on debayered
* pixels and then the gamma lookup table is used to set the resulting
* values of all the three colors.
*/
CcmLookupTable redCcm;
CcmLookupTable greenCcm;
CcmLookupTable blueCcm;
LookupTable gammaLut;
/*
* Per frame corrections as calculated by the IPA
*/
Matrix<float, 3, 3> ccm;
Matrix<float, 3, 3> combinedMatrix;
RGB<float> blackLevel;
float gamma;
float contrastExp;
RGB<float> gains;
};
} /* namespace libcamera */

View File

@@ -17,8 +17,7 @@ interface IPASoftInterface {
libcamera.SharedFD fdStats,
libcamera.SharedFD fdParams,
libcamera.IPACameraSensorInfo sensorInfo,
libcamera.ControlInfoMap sensorControls,
bool gpuIspEnabled)
libcamera.ControlInfoMap sensorControls)
=> (int32 ret, libcamera.ControlInfoMap ipaControls, bool ccmEnabled);
start() => (int32 ret);
stop();