summaryrefslogtreecommitdiff
path: root/src/ipa/simple
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/simple')
-rw-r--r--src/ipa/simple/algorithms/blc.cpp6
-rw-r--r--src/ipa/simple/ipa_context.h4
-rw-r--r--src/ipa/simple/soft_simple.cpp10
3 files changed, 19 insertions, 1 deletions
diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp
index b9f2aaa6..a7af2e12 100644
--- a/src/ipa/simple/algorithms/blc.cpp
+++ b/src/ipa/simple/algorithms/blc.cpp
@@ -24,7 +24,8 @@ BlackLevel::BlackLevel()
int BlackLevel::configure(IPAContext &context,
[[maybe_unused]] const IPAConfigInfo &configInfo)
{
- context.activeState.blc.level = 255;
+ context.activeState.blc.level =
+ context.configuration.black.level.value_or(255);
return 0;
}
@@ -34,6 +35,9 @@ void BlackLevel::process(IPAContext &context,
const SwIspStats *stats,
[[maybe_unused]] ControlList &metadata)
{
+ if (context.configuration.black.level.has_value())
+ return;
+
if (frameContext.sensor.exposure == exposure_ &&
frameContext.sensor.gain == gain_) {
return;
diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h
index 3519f20f..fd121eeb 100644
--- a/src/ipa/simple/ipa_context.h
+++ b/src/ipa/simple/ipa_context.h
@@ -8,6 +8,7 @@
#pragma once
#include <array>
+#include <optional>
#include <stdint.h>
#include <libipa/fc_queue.h>
@@ -22,6 +23,9 @@ struct IPASessionConfiguration {
int32_t exposureMin, exposureMax;
double againMin, againMax, againMinStep;
} agc;
+ struct {
+ std::optional<uint8_t> level;
+ } black;
};
struct IPAActiveState {
diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp
index b45c41a6..825c0675 100644
--- a/src/ipa/simple/soft_simple.cpp
+++ b/src/ipa/simple/soft_simple.cpp
@@ -206,6 +206,16 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)
(context_.configuration.agc.againMax -
context_.configuration.agc.againMin) /
100.0;
+ if (camHelper_->blackLevel().has_value()) {
+ /*
+ * The black level from camHelper_ is a 16 bit value, software ISP
+ * works with 8 bit pixel values, both regardless of the actual
+ * sensor pixel width. Hence we obtain the pixel-based black value
+ * by dividing the value from the helper by 256.
+ */
+ context_.configuration.black.level =
+ camHelper_->blackLevel().value() / 256;
+ }
} else {
/*
* The camera sensor gain (g) is usually not equal to the value written