forked from pool/libcamera
Compare commits
33 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 0aab2f393e | |||
| 96c2436306 | |||
| 1082b35005 | |||
| 33a56e992a | |||
| 8adce2359a | |||
| 1dae4ed60d | |||
| fb1a9894eb | |||
| 01a858bb14 | |||
| 0880faa3fb | |||
| 3379cacde9 | |||
| aefad565c6 | |||
| fd5198a2b6 | |||
| f47db589ac | |||
| 5344ac30fb | |||
| 8e67cc2377 | |||
| bb6fe94e1e | |||
| e448df1d23 | |||
| 3472954e30 | |||
| 743671ac22 | |||
| b1226dc989 | |||
| 99c5a4825a | |||
| 489d3bc3c8 | |||
| 7d1ef4101d | |||
| 9939c832a6 | |||
| 6a61e1b70a | |||
| a6f3d6c60b | |||
| 325fbf1bf2 | |||
| f1d82dde24 | |||
| 05565bed7b | |||
| 39fe66ebc6 | |||
| e7f46ebedb | |||
| be36ffa5a5 | |||
| 5b68f7f119 |
@@ -0,0 +1,70 @@
|
||||
From b5a01e2c62347f6815569cb16ce9ccbb85d6cb19 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Zamazal <mzamazal@redhat.com>
|
||||
Date: Thu, 21 Aug 2025 15:41:37 +0200
|
||||
Subject: [PATCH 01/17] libcamera: software_isp: Clarify SwStatsCpu::setWindow
|
||||
use
|
||||
|
||||
The window coordinates passed to SwStatsCpu::setWindow are confusing.
|
||||
Let's clarify what the coordinates should be.
|
||||
|
||||
A source of confusion is that the specified window is relative to the
|
||||
processed area. Debayering adjusts line pointers for its processed area
|
||||
and this is what's also passed to stats processing. The window passed
|
||||
to SwStatsCpu::setWindow should either specify the size of the whole
|
||||
processed (not image) area, or its cropping in case the stats shouldn't
|
||||
be gathered over the whole processed area. This patch should clarify
|
||||
this in the code.
|
||||
|
||||
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
|
||||
---
|
||||
src/libcamera/software_isp/debayer_cpu.cpp | 6 +++++-
|
||||
src/libcamera/software_isp/swstats_cpu.cpp | 16 ++++++++++++++++
|
||||
2 files changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
index 66f6038c1..bcc847ae6 100644
|
||||
--- a/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
@@ -541,7 +541,11 @@ int DebayerCpu::configure(const StreamConfiguration &inputCfg,
|
||||
window_.width = outputCfg.size.width;
|
||||
window_.height = outputCfg.size.height;
|
||||
|
||||
- /* Don't pass x,y since process() already adjusts src before passing it */
|
||||
+ /*
|
||||
+ * Set the stats window to the whole processed window. Its coordinates are
|
||||
+ * relative to the debayered area since debayering passes only the part of
|
||||
+ * data to be processed to the stats; see SwStatsCpu::setWindow.
|
||||
+ */
|
||||
stats_->setWindow(Rectangle(window_.size()));
|
||||
|
||||
/* pad with patternSize.Width on both left and right side */
|
||||
diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp
|
||||
index 4b77b3600..72aa88b69 100644
|
||||
--- a/src/libcamera/software_isp/swstats_cpu.cpp
|
||||
+++ b/src/libcamera/software_isp/swstats_cpu.cpp
|
||||
@@ -416,6 +416,22 @@ int SwStatsCpu::configure(const StreamConfiguration &inputCfg)
|
||||
/**
|
||||
* \brief Specify window coordinates over which to gather statistics
|
||||
* \param[in] window The window object.
|
||||
+ *
|
||||
+ * This method specifies the image area over which to gather the statistics.
|
||||
+ * It must be called to set the area, otherwise the default zero-sized
|
||||
+ * \a Rectangle is used and no statistics is gathered.
|
||||
+ *
|
||||
+ * The specified \a window is relative to what is passed to processLine*
|
||||
+ * methods. Typically, this means processLine* methods get only data from the
|
||||
+ * processed area and \a window is \a Rectangle with (0, 0) top-left point and
|
||||
+ * of the same size as the processed area. But if statistics is gathered only
|
||||
+ * from some part of the image, e.g. its centre, \a window should specify such a
|
||||
+ * restriction accordingly.
|
||||
+ *
|
||||
+ * The method may adjust the window slightly if it is not aligned according to
|
||||
+ * the bayer pattern determined in \a SwStatsCpu::configure(). Such an
|
||||
+ * adjustment is guaranteed to not exceed the bounds of
|
||||
+ * Rectangle(0, 0, window.width, window.height).
|
||||
*/
|
||||
void SwStatsCpu::setWindow(const Rectangle &window)
|
||||
{
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
From d3aaab99a267c160cd67cc853b61a7d5d972ad0f Mon Sep 17 00:00:00 2001
|
||||
From: Milan Zamazal <mzamazal@redhat.com>
|
||||
Date: Thu, 21 Aug 2025 15:41:38 +0200
|
||||
Subject: [PATCH 02/17] libcamera: software_isp: Pass correct y-coordinate to
|
||||
stats
|
||||
|
||||
The window set by SwStatsCpu::setWindow is relative to the processed
|
||||
image area. But debayering passes the processed line y-coordinate to
|
||||
the stats relative to the whole image area. This can result in
|
||||
gathering stats from a wrong image area or in not gathering stats at
|
||||
all.
|
||||
|
||||
Let's pass the correct y-coordinate to the stats processing methods.
|
||||
|
||||
Bug: https://bugs.libcamera.org/show_bug.cgi?id=280
|
||||
Co-developed-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
|
||||
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
|
||||
---
|
||||
src/libcamera/software_isp/debayer_cpu.cpp | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
index bcc847ae6..185edd814 100644
|
||||
--- a/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
@@ -648,7 +648,7 @@ void DebayerCpu::memcpyNextLine(const uint8_t *linePointers[])
|
||||
|
||||
void DebayerCpu::process2(const uint8_t *src, uint8_t *dst)
|
||||
{
|
||||
- unsigned int yEnd = window_.y + window_.height;
|
||||
+ unsigned int yEnd = window_.height;
|
||||
/* Holds [0] previous- [1] current- [2] next-line */
|
||||
const uint8_t *linePointers[3];
|
||||
|
||||
@@ -664,12 +664,12 @@ void DebayerCpu::process2(const uint8_t *src, uint8_t *dst)
|
||||
linePointers[1] = src + inputConfig_.stride;
|
||||
linePointers[2] = src;
|
||||
/* Last 2 lines also need special handling */
|
||||
- yEnd -= 2;
|
||||
+ yEnd = (yEnd > 2 ? yEnd - 2 : 0);
|
||||
}
|
||||
|
||||
setupInputMemcpy(linePointers);
|
||||
|
||||
- for (unsigned int y = window_.y; y < yEnd; y += 2) {
|
||||
+ for (unsigned int y = 0; y < yEnd; y += 2) {
|
||||
shiftLinePointers(linePointers, src);
|
||||
memcpyNextLine(linePointers);
|
||||
stats_->processLine0(y, linePointers);
|
||||
@@ -703,7 +703,7 @@ void DebayerCpu::process2(const uint8_t *src, uint8_t *dst)
|
||||
|
||||
void DebayerCpu::process4(const uint8_t *src, uint8_t *dst)
|
||||
{
|
||||
- const unsigned int yEnd = window_.y + window_.height;
|
||||
+ const unsigned int yEnd = window_.height;
|
||||
/*
|
||||
* This holds pointers to [0] 2-lines-up [1] 1-line-up [2] current-line
|
||||
* [3] 1-line-down [4] 2-lines-down.
|
||||
@@ -721,7 +721,7 @@ void DebayerCpu::process4(const uint8_t *src, uint8_t *dst)
|
||||
|
||||
setupInputMemcpy(linePointers);
|
||||
|
||||
- for (unsigned int y = window_.y; y < yEnd; y += 4) {
|
||||
+ for (unsigned int y = 0; y < yEnd; y += 4) {
|
||||
shiftLinePointers(linePointers, src);
|
||||
memcpyNextLine(linePointers);
|
||||
stats_->processLine0(y, linePointers);
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
From 2611679a0a425bad4f071fb70c513f73be5132df Mon Sep 17 00:00:00 2001
|
||||
From: Milan Zamazal <mzamazal@redhat.com>
|
||||
Date: Thu, 21 Aug 2025 15:41:39 +0200
|
||||
Subject: [PATCH 03/17] libcamera: software_isp: Check processed window size
|
||||
alignment
|
||||
|
||||
The window of the image that should be debayered must be aligned to the
|
||||
bayer pattern size. This is already ensured for the window corner
|
||||
coordinates but not for the window sizes.
|
||||
|
||||
We can either make the window sizes aligned similarly to how the window
|
||||
corner coordinates are aligned or reject an unaligned configuration.
|
||||
This patches chooses the latter as using a different window size than
|
||||
the requested output size could lead to artefacts. Since such a
|
||||
situation is not expected to occur in correctly set up environments, the
|
||||
change should have no negative impact.
|
||||
|
||||
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
|
||||
---
|
||||
src/libcamera/software_isp/debayer_cpu.cpp | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
index 185edd814..3200b0c53 100644
|
||||
--- a/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
|
||||
@@ -539,7 +539,17 @@ int DebayerCpu::configure(const StreamConfiguration &inputCfg,
|
||||
window_.y = ((inputCfg.size.height - outputCfg.size.height) / 2) &
|
||||
~(inputConfig_.patternSize.height - 1);
|
||||
window_.width = outputCfg.size.width;
|
||||
+ if (window_.width % inputConfig_.patternSize.width != 0) {
|
||||
+ LOG(Debayer, Error)
|
||||
+ << "Output width is not a multiple of the bayer pattern width";
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
window_.height = outputCfg.size.height;
|
||||
+ if (window_.height % inputConfig_.patternSize.height != 0) {
|
||||
+ LOG(Debayer, Error)
|
||||
+ << "Output height is not a multiple of the bayer pattern height";
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* Set the stats window to the whole processed window. Its coordinates are
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 242ae30056eb3d4964b518cb902d2dfef6c69de5 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Zamazal <mzamazal@redhat.com>
|
||||
Date: Thu, 21 Aug 2025 15:41:40 +0200
|
||||
Subject: [PATCH 04/17] libcamera: simple: Avoid incorrect arithmetic in AWB
|
||||
|
||||
The R/G/B sums computed in AWB simple IPA may be zero or perhaps even
|
||||
negative. Let's make sure the sums are always positive, to prevent
|
||||
division by zero or completely nonsense results.
|
||||
|
||||
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
|
||||
---
|
||||
src/ipa/simple/algorithms/awb.cpp | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp
|
||||
index cf567e894..9509129e9 100644
|
||||
--- a/src/ipa/simple/algorithms/awb.cpp
|
||||
+++ b/src/ipa/simple/algorithms/awb.cpp
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "awb.h"
|
||||
|
||||
+#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -69,9 +70,10 @@ void Awb::process(IPAContext &context,
|
||||
const uint64_t nPixels = std::accumulate(
|
||||
histogram.begin(), histogram.end(), 0);
|
||||
const uint64_t offset = blackLevel * nPixels;
|
||||
- const uint64_t sumR = stats->sumR_ - offset / 4;
|
||||
- const uint64_t sumG = stats->sumG_ - offset / 2;
|
||||
- const uint64_t sumB = stats->sumB_ - offset / 4;
|
||||
+ const uint64_t minValid = 1;
|
||||
+ const uint64_t sumR = std::max(stats->sumR_ - offset / 4, minValid);
|
||||
+ const uint64_t sumG = std::max(stats->sumG_ - offset / 2, minValid);
|
||||
+ const uint64_t sumB = std::max(stats->sumB_ - offset / 4, minValid);
|
||||
|
||||
/*
|
||||
* Calculate red and blue gains for AWB.
|
||||
--
|
||||
2.50.1
|
||||
|
||||
33
0005-libcamera-simple-Prevent-division-by-zero-in-BLC.patch
Normal file
33
0005-libcamera-simple-Prevent-division-by-zero-in-BLC.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From ef0b475f471e114044a7fbacf13bb16b5d362def Mon Sep 17 00:00:00 2001
|
||||
From: Milan Zamazal <mzamazal@redhat.com>
|
||||
Date: Thu, 21 Aug 2025 15:41:41 +0200
|
||||
Subject: [PATCH 05/17] libcamera: simple: Prevent division by zero in BLC
|
||||
|
||||
When there are no values in the histogram, BLC simple IPA can crash on
|
||||
division by zero. We cannot get anything meaningful in such a case
|
||||
anyway, let's simply return from `process()' then.
|
||||
|
||||
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
|
||||
---
|
||||
src/ipa/simple/algorithms/blc.cpp | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp
|
||||
index 8c1e9ed08..71731c6f6 100644
|
||||
--- a/src/ipa/simple/algorithms/blc.cpp
|
||||
+++ b/src/ipa/simple/algorithms/blc.cpp
|
||||
@@ -77,6 +77,11 @@ void BlackLevel::process(IPAContext &context,
|
||||
constexpr float ignoredPercentage = 0.02;
|
||||
const unsigned int total =
|
||||
std::accumulate(begin(histogram), end(histogram), 0);
|
||||
+ if (total == 0) {
|
||||
+ LOG(IPASoftBL, Debug) << "Not guessing black level, histogram is empty";
|
||||
+ return;
|
||||
+ };
|
||||
+
|
||||
const unsigned int pixelThreshold = ignoredPercentage * total;
|
||||
const unsigned int histogramRatio = 256 / SwIspStats::kYHistogramSize;
|
||||
const unsigned int currentBlackIdx =
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From ced95de9a798243f0152a5e2d8743d8cdc58d65d Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Mon, 22 Apr 2024 23:30:31 +0200
|
||||
Subject: [PATCH 06/17] libcamera: simple: Enable softwareISP for the librem5
|
||||
|
||||
And - in theory - on similar devices.
|
||||
---
|
||||
src/libcamera/pipeline/simple/simple.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
|
||||
index 4323472e1..74e0683f4 100644
|
||||
--- a/src/libcamera/pipeline/simple/simple.cpp
|
||||
+++ b/src/libcamera/pipeline/simple/simple.cpp
|
||||
@@ -250,7 +250,7 @@ namespace {
|
||||
|
||||
static const SimplePipelineInfo supportedDevices[] = {
|
||||
{ "dcmipp", {}, false },
|
||||
- { "imx7-csi", { { "pxp", 1 } }, false },
|
||||
+ { "imx7-csi", { { "pxp", 1 } }, true },
|
||||
{ "intel-ipu6", {}, true },
|
||||
{ "j721e-csi2rx", {}, true },
|
||||
{ "mtk-seninf", { { "mtk-mdp", 3 } }, false },
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From cb0c4005f0303798c700352e00c9389e3e2f463b Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Thu, 9 May 2024 21:07:07 +0200
|
||||
Subject: [PATCH 07/17] libcamera: simple: Force-disable softwareISP for
|
||||
millipixels
|
||||
|
||||
As the later uses libcamera and requires raw-streams to get passed
|
||||
through. In the future, libcamera will likely support both - raw and
|
||||
swIsp - at the same time.
|
||||
---
|
||||
src/libcamera/pipeline/simple/simple.cpp | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
|
||||
index 74e0683f4..eb405e52c 100644
|
||||
--- a/src/libcamera/pipeline/simple/simple.cpp
|
||||
+++ b/src/libcamera/pipeline/simple/simple.cpp
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
+#include <fstream>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <map>
|
||||
@@ -1680,6 +1681,14 @@ bool SimplePipelineHandler::matchDevice(MediaDevice *media,
|
||||
|
||||
swIspEnabled_ = info.swIspEnabled;
|
||||
|
||||
+ std::string comm_string;
|
||||
+ std::ifstream("/proc/self/comm") >> comm_string;
|
||||
+ if (comm_string == "millipixels") {
|
||||
+ LOG(SimplePipeline, Warning)
|
||||
+ << "Detected millipixels, disabling swIsp";
|
||||
+ swIspEnabled_ = false;
|
||||
+ }
|
||||
+
|
||||
/* Locate the sensors. */
|
||||
std::vector<MediaEntity *> sensors = locateSensors(media);
|
||||
if (sensors.empty()) {
|
||||
--
|
||||
2.50.1
|
||||
|
||||
32
0008-libcamera-simple-Enable-softISP-for-the-Pinephone.patch
Normal file
32
0008-libcamera-simple-Enable-softISP-for-the-Pinephone.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From a03f8f4e44e5b6d794022f8de8f54f2f68692d64 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Wed, 1 May 2024 18:12:02 +0200
|
||||
Subject: [PATCH 08/17] libcamera: simple: Enable softISP for the Pinephone
|
||||
|
||||
In theory the PP should be able to use the actual HW ISP, however in
|
||||
practice this does not work well yet - especially as the driver for the
|
||||
front camera in Megi differs heavily from the upstream one.
|
||||
|
||||
Thus enable the swISP to make both cameras work reliably for now. This
|
||||
is essentially what Megapixels does as well. If the HW ISP situation
|
||||
improves, this can be dropped again.
|
||||
---
|
||||
src/libcamera/pipeline/simple/simple.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
|
||||
index eb405e52c..f4b49b1ab 100644
|
||||
--- a/src/libcamera/pipeline/simple/simple.cpp
|
||||
+++ b/src/libcamera/pipeline/simple/simple.cpp
|
||||
@@ -257,7 +257,7 @@ static const SimplePipelineInfo supportedDevices[] = {
|
||||
{ "mtk-seninf", { { "mtk-mdp", 3 } }, false },
|
||||
{ "mxc-isi", {}, false },
|
||||
{ "qcom-camss", {}, true },
|
||||
- { "sun6i-csi", {}, false },
|
||||
+ { "sun6i-csi", {}, true },
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 39a3d481aabb6f92f4b3b846064d8bc6f049f36d Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Mon, 6 May 2024 21:21:57 +0200
|
||||
Subject: [PATCH 09/17] libcamera: simple: Skip hwISP formats if swISP is
|
||||
active
|
||||
|
||||
On devices like the Pinephone libcamera will advertise support for
|
||||
formats provided by the HW ISP and the SW ISP at the same time. The
|
||||
reason why we enable the SW ISP in the first place is, however, that the
|
||||
HW ISP does not work reliable atm. Thus filter out formats from the HW
|
||||
ISP when the SW ISP is enabled, to ensure we use the later.
|
||||
---
|
||||
src/libcamera/pipeline/simple/simple.cpp | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
|
||||
index f4b49b1ab..c19ce17d4 100644
|
||||
--- a/src/libcamera/pipeline/simple/simple.cpp
|
||||
+++ b/src/libcamera/pipeline/simple/simple.cpp
|
||||
@@ -721,9 +721,7 @@ void SimpleCameraData::tryPipeline(unsigned int code, const Size &size)
|
||||
config.outputFormats = swIsp_->formats(pixelFormat);
|
||||
config.outputSizes = swIsp_->sizes(pixelFormat, format.size);
|
||||
if (config.outputFormats.empty()) {
|
||||
- /* Do not use swIsp for unsupported pixelFormat's. */
|
||||
- config.outputFormats = { pixelFormat };
|
||||
- config.outputSizes = config.captureSize;
|
||||
+ continue;
|
||||
}
|
||||
} else {
|
||||
config.outputFormats = { pixelFormat };
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 9303db28aedd7e7ffe7af1627418c1ff070f2499 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Fri, 11 Oct 2024 20:13:24 +0200
|
||||
Subject: [PATCH 10/17] pipeline: simple: Consider output sizes when choosing
|
||||
pipe config
|
||||
|
||||
In order to avoid having to adjust the size further down below which
|
||||
again can break user assumptions. Notably, without this the capture size
|
||||
of 1920x1080 gets adjusted to 1912x1080 when used with the swISP using a
|
||||
bayer pattern width of 4, breaking users like Gstreamer down the line.
|
||||
|
||||
Closes https://bugs.libcamera.org/show_bug.cgi?id=236
|
||||
|
||||
Signed-off-by: Robert Mader <robert.mader@collabora.com>
|
||||
---
|
||||
src/libcamera/pipeline/simple/simple.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
|
||||
index c19ce17d4..09310dc02 100644
|
||||
--- a/src/libcamera/pipeline/simple/simple.cpp
|
||||
+++ b/src/libcamera/pipeline/simple/simple.cpp
|
||||
@@ -1159,7 +1159,8 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
|
||||
const Size &size = pipeConfig->captureSize;
|
||||
|
||||
if (size.width >= maxStreamSize.width &&
|
||||
- size.height >= maxStreamSize.height) {
|
||||
+ size.height >= maxStreamSize.height &&
|
||||
+ pipeConfig->outputSizes.contains(maxStreamSize)) {
|
||||
if (!pipeConfig_ || size < pipeConfig_->captureSize)
|
||||
pipeConfig_ = pipeConfig;
|
||||
}
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 9b0f6c6d8c4bc3e4fed87c54daadaaf79c621341 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Sun, 13 Oct 2024 14:13:44 +0200
|
||||
Subject: [PATCH 11/17] pipeline: simple: Increase internal buffer count to
|
||||
four aswell
|
||||
|
||||
Signed-off-by: Robert Mader <robert.mader@collabora.com>
|
||||
---
|
||||
src/libcamera/pipeline/simple/simple.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
|
||||
index 09310dc02..58e70993f 100644
|
||||
--- a/src/libcamera/pipeline/simple/simple.cpp
|
||||
+++ b/src/libcamera/pipeline/simple/simple.cpp
|
||||
@@ -415,7 +415,7 @@ protected:
|
||||
int queueRequestDevice(Camera *camera, Request *request) override;
|
||||
|
||||
private:
|
||||
- static constexpr unsigned int kNumInternalBuffers = 3;
|
||||
+ static constexpr unsigned int kNumInternalBuffers = 4;
|
||||
|
||||
struct EntityData {
|
||||
std::unique_ptr<V4L2VideoDevice> video;
|
||||
--
|
||||
2.50.1
|
||||
|
||||
50
0012-ipa-simple-Add-tuning-file-for-IMX355.patch
Normal file
50
0012-ipa-simple-Add-tuning-file-for-IMX355.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From bf9c2c76e8f390f35d0a0e0380cb2fae03abe806 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Sat, 19 Oct 2024 00:25:03 +0200
|
||||
Subject: [PATCH 12/17] ipa/simple: Add tuning file for IMX355
|
||||
|
||||
64 at 10 bits. The value was guessed from known values for similar
|
||||
sensors and testing - on a Google Pixel 3a - suggest it's correct.
|
||||
|
||||
Adding this tuning file is partly motivated in order to serve as
|
||||
example, as it's the first one for the simple IPA.
|
||||
|
||||
Signed-off-by: Robert Mader <robert.mader@collabora.com>
|
||||
---
|
||||
src/ipa/simple/data/imx355.yaml | 11 +++++++++++
|
||||
src/ipa/simple/data/meson.build | 1 +
|
||||
2 files changed, 12 insertions(+)
|
||||
create mode 100644 src/ipa/simple/data/imx355.yaml
|
||||
|
||||
diff --git a/src/ipa/simple/data/imx355.yaml b/src/ipa/simple/data/imx355.yaml
|
||||
new file mode 100644
|
||||
index 000000000..f7d01b738
|
||||
--- /dev/null
|
||||
+++ b/src/ipa/simple/data/imx355.yaml
|
||||
@@ -0,0 +1,11 @@
|
||||
+# SPDX-License-Identifier: CC0-1.0
|
||||
+%YAML 1.1
|
||||
+---
|
||||
+version: 1
|
||||
+algorithms:
|
||||
+ - BlackLevel:
|
||||
+ blackLevel: 4096
|
||||
+ - Awb:
|
||||
+ - Lut:
|
||||
+ - Agc:
|
||||
+...
|
||||
diff --git a/src/ipa/simple/data/meson.build b/src/ipa/simple/data/meson.build
|
||||
index 92795ee4c..6e690f82d 100644
|
||||
--- a/src/ipa/simple/data/meson.build
|
||||
+++ b/src/ipa/simple/data/meson.build
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
conf_files = files([
|
||||
+ 'imx355.yaml',
|
||||
'uncalibrated.yaml',
|
||||
])
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
47
0013-ipa-simple-Add-tuning-file-for-IMX363.patch
Normal file
47
0013-ipa-simple-Add-tuning-file-for-IMX363.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
From 9e21554b1374b057e84b3afa76b55855b01671f4 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Sat, 19 Oct 2024 17:06:12 +0200
|
||||
Subject: [PATCH 13/17] ipa/simple: Add tuning file for IMX363
|
||||
|
||||
64 at 10 bits. The value was guessed from known values for similar
|
||||
sensors and testing - on a Google Pixel 3a - suggest it's correct.
|
||||
|
||||
Signed-off-by: Robert Mader <robert.mader@collabora.com>
|
||||
---
|
||||
src/ipa/simple/data/imx363.yaml | 11 +++++++++++
|
||||
src/ipa/simple/data/meson.build | 1 +
|
||||
2 files changed, 12 insertions(+)
|
||||
create mode 100644 src/ipa/simple/data/imx363.yaml
|
||||
|
||||
diff --git a/src/ipa/simple/data/imx363.yaml b/src/ipa/simple/data/imx363.yaml
|
||||
new file mode 100644
|
||||
index 000000000..f7d01b738
|
||||
--- /dev/null
|
||||
+++ b/src/ipa/simple/data/imx363.yaml
|
||||
@@ -0,0 +1,11 @@
|
||||
+# SPDX-License-Identifier: CC0-1.0
|
||||
+%YAML 1.1
|
||||
+---
|
||||
+version: 1
|
||||
+algorithms:
|
||||
+ - BlackLevel:
|
||||
+ blackLevel: 4096
|
||||
+ - Awb:
|
||||
+ - Lut:
|
||||
+ - Agc:
|
||||
+...
|
||||
diff --git a/src/ipa/simple/data/meson.build b/src/ipa/simple/data/meson.build
|
||||
index 6e690f82d..7d07d5670 100644
|
||||
--- a/src/ipa/simple/data/meson.build
|
||||
+++ b/src/ipa/simple/data/meson.build
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
conf_files = files([
|
||||
'imx355.yaml',
|
||||
+ 'imx363.yaml',
|
||||
'uncalibrated.yaml',
|
||||
])
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
44
0014-ipa-simple-Add-tuning-file-for-s5k3l6xx.patch
Normal file
44
0014-ipa-simple-Add-tuning-file-for-s5k3l6xx.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From e9694f7ed531d3a7394d42b9f4b0d00bf46e87be Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Sun, 24 Nov 2024 18:20:37 +0100
|
||||
Subject: [PATCH 14/17] ipa/simple: Add tuning file for s5k3l6xx
|
||||
|
||||
Used by the Librem5
|
||||
---
|
||||
src/ipa/simple/data/meson.build | 1 +
|
||||
src/ipa/simple/data/s5k3l6xx.yaml | 11 +++++++++++
|
||||
2 files changed, 12 insertions(+)
|
||||
create mode 100644 src/ipa/simple/data/s5k3l6xx.yaml
|
||||
|
||||
diff --git a/src/ipa/simple/data/meson.build b/src/ipa/simple/data/meson.build
|
||||
index 7d07d5670..a763edc4f 100644
|
||||
--- a/src/ipa/simple/data/meson.build
|
||||
+++ b/src/ipa/simple/data/meson.build
|
||||
@@ -3,6 +3,7 @@
|
||||
conf_files = files([
|
||||
'imx355.yaml',
|
||||
'imx363.yaml',
|
||||
+ 's5k3l6xx.yaml',
|
||||
'uncalibrated.yaml',
|
||||
])
|
||||
|
||||
diff --git a/src/ipa/simple/data/s5k3l6xx.yaml b/src/ipa/simple/data/s5k3l6xx.yaml
|
||||
new file mode 100644
|
||||
index 000000000..f7d01b738
|
||||
--- /dev/null
|
||||
+++ b/src/ipa/simple/data/s5k3l6xx.yaml
|
||||
@@ -0,0 +1,11 @@
|
||||
+# SPDX-License-Identifier: CC0-1.0
|
||||
+%YAML 1.1
|
||||
+---
|
||||
+version: 1
|
||||
+algorithms:
|
||||
+ - BlackLevel:
|
||||
+ blackLevel: 4096
|
||||
+ - Awb:
|
||||
+ - Lut:
|
||||
+ - Agc:
|
||||
+...
|
||||
--
|
||||
2.50.1
|
||||
|
||||
44
0015-ipa-simple-Add-tuning-file-for-hi846.patch
Normal file
44
0015-ipa-simple-Add-tuning-file-for-hi846.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From 175bb5ee1932242967e439955b0dad942228158d Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Sun, 24 Nov 2024 18:21:52 +0100
|
||||
Subject: [PATCH 15/17] ipa/simple: Add tuning file for hi846
|
||||
|
||||
Used by the Librem5
|
||||
---
|
||||
src/ipa/simple/data/hi846.yaml | 11 +++++++++++
|
||||
src/ipa/simple/data/meson.build | 1 +
|
||||
2 files changed, 12 insertions(+)
|
||||
create mode 100644 src/ipa/simple/data/hi846.yaml
|
||||
|
||||
diff --git a/src/ipa/simple/data/hi846.yaml b/src/ipa/simple/data/hi846.yaml
|
||||
new file mode 100644
|
||||
index 000000000..f7d01b738
|
||||
--- /dev/null
|
||||
+++ b/src/ipa/simple/data/hi846.yaml
|
||||
@@ -0,0 +1,11 @@
|
||||
+# SPDX-License-Identifier: CC0-1.0
|
||||
+%YAML 1.1
|
||||
+---
|
||||
+version: 1
|
||||
+algorithms:
|
||||
+ - BlackLevel:
|
||||
+ blackLevel: 4096
|
||||
+ - Awb:
|
||||
+ - Lut:
|
||||
+ - Agc:
|
||||
+...
|
||||
diff --git a/src/ipa/simple/data/meson.build b/src/ipa/simple/data/meson.build
|
||||
index a763edc4f..cae83a3d5 100644
|
||||
--- a/src/ipa/simple/data/meson.build
|
||||
+++ b/src/ipa/simple/data/meson.build
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
conf_files = files([
|
||||
+ 'hi846.yaml',
|
||||
'imx355.yaml',
|
||||
'imx363.yaml',
|
||||
's5k3l6xx.yaml',
|
||||
--
|
||||
2.50.1
|
||||
|
||||
44
0016-ipa-simple-Add-tuning-file-for-IMX371.patch
Normal file
44
0016-ipa-simple-Add-tuning-file-for-IMX371.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From 5d00a3b8aa891c0c0ca114c8ec1c0070d054055c Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Sat, 8 Mar 2025 10:38:06 +0100
|
||||
Subject: [PATCH 16/17] ipa/simple: Add tuning file for IMX371
|
||||
|
||||
The value is guessed from similar IMX sensors.
|
||||
---
|
||||
src/ipa/simple/data/imx371.yaml | 11 +++++++++++
|
||||
src/ipa/simple/data/meson.build | 1 +
|
||||
2 files changed, 12 insertions(+)
|
||||
create mode 100644 src/ipa/simple/data/imx371.yaml
|
||||
|
||||
diff --git a/src/ipa/simple/data/imx371.yaml b/src/ipa/simple/data/imx371.yaml
|
||||
new file mode 100644
|
||||
index 000000000..f7d01b738
|
||||
--- /dev/null
|
||||
+++ b/src/ipa/simple/data/imx371.yaml
|
||||
@@ -0,0 +1,11 @@
|
||||
+# SPDX-License-Identifier: CC0-1.0
|
||||
+%YAML 1.1
|
||||
+---
|
||||
+version: 1
|
||||
+algorithms:
|
||||
+ - BlackLevel:
|
||||
+ blackLevel: 4096
|
||||
+ - Awb:
|
||||
+ - Lut:
|
||||
+ - Agc:
|
||||
+...
|
||||
diff --git a/src/ipa/simple/data/meson.build b/src/ipa/simple/data/meson.build
|
||||
index cae83a3d5..19f90c976 100644
|
||||
--- a/src/ipa/simple/data/meson.build
|
||||
+++ b/src/ipa/simple/data/meson.build
|
||||
@@ -4,6 +4,7 @@ conf_files = files([
|
||||
'hi846.yaml',
|
||||
'imx355.yaml',
|
||||
'imx363.yaml',
|
||||
+ 'imx371.yaml',
|
||||
's5k3l6xx.yaml',
|
||||
'uncalibrated.yaml',
|
||||
])
|
||||
--
|
||||
2.50.1
|
||||
|
||||
44
0017-ipa-simple-Add-tuning-file-for-IMX376.patch
Normal file
44
0017-ipa-simple-Add-tuning-file-for-IMX376.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From 2f0d4f7929afb239d2b74ce7cfee447a70101f36 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Mader <robert.mader@collabora.com>
|
||||
Date: Sat, 8 Mar 2025 10:39:44 +0100
|
||||
Subject: [PATCH 17/17] ipa/simple: Add tuning file for IMX376
|
||||
|
||||
The value is guessed from similar IMX sensors.
|
||||
---
|
||||
src/ipa/simple/data/imx376.yaml | 11 +++++++++++
|
||||
src/ipa/simple/data/meson.build | 1 +
|
||||
2 files changed, 12 insertions(+)
|
||||
create mode 100644 src/ipa/simple/data/imx376.yaml
|
||||
|
||||
diff --git a/src/ipa/simple/data/imx376.yaml b/src/ipa/simple/data/imx376.yaml
|
||||
new file mode 100644
|
||||
index 000000000..f7d01b738
|
||||
--- /dev/null
|
||||
+++ b/src/ipa/simple/data/imx376.yaml
|
||||
@@ -0,0 +1,11 @@
|
||||
+# SPDX-License-Identifier: CC0-1.0
|
||||
+%YAML 1.1
|
||||
+---
|
||||
+version: 1
|
||||
+algorithms:
|
||||
+ - BlackLevel:
|
||||
+ blackLevel: 4096
|
||||
+ - Awb:
|
||||
+ - Lut:
|
||||
+ - Agc:
|
||||
+...
|
||||
diff --git a/src/ipa/simple/data/meson.build b/src/ipa/simple/data/meson.build
|
||||
index 19f90c976..e0c8e443a 100644
|
||||
--- a/src/ipa/simple/data/meson.build
|
||||
+++ b/src/ipa/simple/data/meson.build
|
||||
@@ -5,6 +5,7 @@ conf_files = files([
|
||||
'imx355.yaml',
|
||||
'imx363.yaml',
|
||||
'imx371.yaml',
|
||||
+ 'imx376.yaml',
|
||||
's5k3l6xx.yaml',
|
||||
'uncalibrated.yaml',
|
||||
])
|
||||
--
|
||||
2.50.1
|
||||
|
||||
1
90-libcamera.rules
Normal file
1
90-libcamera.rules
Normal file
@@ -0,0 +1 @@
|
||||
KERNEL=="udmabuf",GROUP="video",MODE="0660"
|
||||
6
_service
6
_service
@@ -1,9 +1,9 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="manual">
|
||||
<param name="scm">git</param>
|
||||
<param name="url">https://git.libcamera.org/libcamera/libcamera.git</param>
|
||||
<param name="revision">refs/tags/v0.5.2</param>
|
||||
<param name="versionformat">@PARENT_TAG@</param>
|
||||
<param name="url">https://gitlab.freedesktop.org/rmader/libcamera.git</param>
|
||||
<param name="revision">postmarketos-gpuisp-v4-master</param>
|
||||
<param name="versionformat">v0.5.2</param>
|
||||
<param name="versionrewrite-pattern">v([0-9\.]*)</param>
|
||||
</service>
|
||||
<service name="recompress" mode="manual">
|
||||
|
||||
BIN
libcamera-0.5.2.tar.xz
LFS
BIN
libcamera-0.5.2.tar.xz
LFS
Binary file not shown.
@@ -33,7 +33,25 @@ URL: https://libcamera.org/
|
||||
#Git-Web: https://git.libcamera.org/libcamera/libcamera.git/
|
||||
Source: libcamera-%version.tar.xz
|
||||
Source1: baselibs.conf
|
||||
Patch0: reproducible.patch
|
||||
Source2: 90-libcamera.rules
|
||||
Patch0: reproducible.patch
|
||||
#Patch1: 0001-libcamera-software_isp-Clarify-SwStatsCpu-setWindow-.patch
|
||||
#Patch2: 0002-libcamera-software_isp-Pass-correct-y-coordinate-to-.patch
|
||||
#Patch3: 0003-libcamera-software_isp-Check-processed-window-size-a.patch
|
||||
#Patch4: 0004-libcamera-simple-Avoid-incorrect-arithmetic-in-AWB.patch
|
||||
#Patch5: 0005-libcamera-simple-Prevent-division-by-zero-in-BLC.patch
|
||||
#Patch6: 0006-libcamera-simple-Enable-softwareISP-for-the-librem5.patch
|
||||
#Patch7: 0007-libcamera-simple-Force-disable-softwareISP-for-milli.patch
|
||||
#Patch8: 0008-libcamera-simple-Enable-softISP-for-the-Pinephone.patch
|
||||
#Patch9: 0009-libcamera-simple-Skip-hwISP-formats-if-swISP-is-acti.patch
|
||||
#Patch10: 0010-pipeline-simple-Consider-output-sizes-when-choosing-.patch
|
||||
#Patch11: 0011-pipeline-simple-Increase-internal-buffer-count-to-fo.patch
|
||||
#Patch12: 0012-ipa-simple-Add-tuning-file-for-IMX355.patch
|
||||
#Patch13: 0013-ipa-simple-Add-tuning-file-for-IMX363.patch
|
||||
#Patch14: 0014-ipa-simple-Add-tuning-file-for-s5k3l6xx.patch
|
||||
#Patch15: 0015-ipa-simple-Add-tuning-file-for-hi846.patch
|
||||
#Patch16: 0016-ipa-simple-Add-tuning-file-for-IMX371.patch
|
||||
#Patch17: 0017-ipa-simple-Add-tuning-file-for-IMX376.patch
|
||||
BuildRequires: boost-devel
|
||||
BuildRequires: c++_compiler
|
||||
%if 0%{?suse_version} <= 1500
|
||||
@@ -56,6 +74,11 @@ BuildRequires: pkgconfig(openssl)
|
||||
BuildRequires: pkgconfig(pybind11)
|
||||
BuildRequires: pkgconfig(python3)
|
||||
BuildRequires: pkgconfig(yaml-0.1)
|
||||
BuildRequires: pkgconfig(libpisp)
|
||||
BuildRequires: pkgconfig(gtest)
|
||||
BuildRequires: pkgconfig(libyuv)
|
||||
BuildRequires: Mesa-libGLESv3-devel
|
||||
|
||||
%if "@BUILD_FLAVOR@" != ""
|
||||
BuildRequires: pkgconfig(Qt6Core)
|
||||
BuildRequires: pkgconfig(Qt6Gui)
|
||||
@@ -157,9 +180,9 @@ export CXX=g++-11
|
||||
%else
|
||||
-Dqcam=disabled \
|
||||
%endif
|
||||
-Dv4l2=false -Dtracing=disabled \
|
||||
-Dpipelines=ipu3,rkisp1,simple,uvcvideo,vimc \
|
||||
-Dlc-compliance=disabled
|
||||
-Dv4l2=enabled -Dtracing=disabled \
|
||||
-Dlc-compliance=enabled -Dudev=enabled \
|
||||
-Dpipelines=all -Dipas=ipu3,mali-c55,rkisp1,rpi/pisp,rpi/vc4,simple,vimc
|
||||
%meson_build
|
||||
|
||||
%install
|
||||
@@ -169,6 +192,13 @@ cd "%buildroot"
|
||||
find . ! -type d ! -path ./usr/bin/cam ! -path ./usr/bin/qcam -print -delete
|
||||
%else
|
||||
rm -v usr/bin/cam
|
||||
%{__install} -Dm0644 -t %{buildroot}%{_udevrulesdir} %{SOURCE2}
|
||||
#for ipa in %{buildroot}%{_libdir}/libcamera/ipa/ipa*.so; do
|
||||
# %{_builddir}/%name-%version/src/ipa/ipa-sign.sh \
|
||||
# "$(find %{_builddir}/%name-%version/ -type f -iname "*ipa-priv-key.pem")" \
|
||||
# "$ipa" \
|
||||
# "$ipa".sign
|
||||
#done
|
||||
%endif
|
||||
|
||||
%ldconfig_scriptlets -n %lname
|
||||
@@ -192,6 +222,9 @@ rm -v usr/bin/cam
|
||||
%_libexecdir/libcamera/
|
||||
%_libdir/libcamera/
|
||||
%_datadir/libcamera/
|
||||
%{_udevrulesdir}/
|
||||
%{_bindir}/libcamerify
|
||||
%{_bindir}/lc-compliance
|
||||
|
||||
%files -n gstreamer-plugins-libcamera
|
||||
%_libdir/gstreamer-1.0/
|
||||
|
||||
Reference in New Issue
Block a user