a1a6253ff9
Pass contrastExp as calculated in lut to debayer params not the raw contrast. This way we calculate contrastExp once per frame in lut and pass the calculated value into the shaders, instead of passing contrast and calculating contrastExp once per pixel in the shaders. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Robert Mader <robert.mader@collabora.com> Tested-by: Hans de Goede <johannes.goede@oss.qualcomm.com> # ThinkPad T14s gen 6 (arm64) ov02c10 + X1c gen 12 ov08x40 Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> # Lenovo X13s Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
113 lines
1.9 KiB
C++
113 lines
1.9 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2024-2025 Red Hat, Inc.
|
|
*
|
|
* Simple pipeline IPA Context
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <optional>
|
|
#include <stdint.h>
|
|
|
|
#include <libcamera/controls.h>
|
|
|
|
#include "libcamera/internal/matrix.h"
|
|
#include "libcamera/internal/vector.h"
|
|
|
|
#include <libipa/fc_queue.h>
|
|
|
|
#include "core_ipa_interface.h"
|
|
|
|
namespace libcamera {
|
|
|
|
namespace ipa::soft {
|
|
|
|
struct IPASessionConfiguration {
|
|
float gamma;
|
|
struct {
|
|
int32_t exposureMin, exposureMax;
|
|
double againMin, againMax, again10, againMinStep;
|
|
utils::Duration lineDuration;
|
|
} agc;
|
|
struct {
|
|
std::optional<uint8_t> level;
|
|
} black;
|
|
};
|
|
|
|
struct IPAActiveState {
|
|
struct {
|
|
int32_t exposure;
|
|
double again;
|
|
bool valid;
|
|
} agc;
|
|
|
|
struct {
|
|
uint8_t level;
|
|
int32_t lastExposure;
|
|
double lastGain;
|
|
} blc;
|
|
|
|
struct {
|
|
RGB<float> gains;
|
|
unsigned int temperatureK;
|
|
} awb;
|
|
|
|
static constexpr unsigned int kGammaLookupSize = 1024;
|
|
struct {
|
|
std::array<double, kGammaLookupSize> gammaTable;
|
|
uint8_t blackLevel;
|
|
double contrast;
|
|
double contrastExp;
|
|
} gamma;
|
|
|
|
struct {
|
|
Matrix<float, 3, 3> ccm;
|
|
bool changed;
|
|
} ccm;
|
|
|
|
struct {
|
|
/* 0..2 range, 1.0 = normal */
|
|
std::optional<double> contrast;
|
|
std::optional<float> saturation;
|
|
} knobs;
|
|
};
|
|
|
|
struct IPAFrameContext : public FrameContext {
|
|
struct {
|
|
Matrix<float, 3, 3> ccm;
|
|
} ccm;
|
|
|
|
struct {
|
|
int32_t exposure;
|
|
double gain;
|
|
} sensor;
|
|
|
|
struct {
|
|
double red;
|
|
double blue;
|
|
} gains;
|
|
|
|
std::optional<double> contrast;
|
|
std::optional<float> saturation;
|
|
};
|
|
|
|
struct IPAContext {
|
|
IPAContext(unsigned int frameContextSize)
|
|
: frameContexts(frameContextSize)
|
|
{
|
|
}
|
|
|
|
IPACameraSensorInfo sensorInfo;
|
|
IPASessionConfiguration configuration;
|
|
IPAActiveState activeState;
|
|
FCQueue<IPAFrameContext> frameContexts;
|
|
ControlInfoMap::Map ctrlMap;
|
|
bool ccmEnabled = false;
|
|
};
|
|
|
|
} /* namespace ipa::soft */
|
|
|
|
} /* namespace libcamera */
|