summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipa/rkisp1/algorithms/ccm.cpp7
-rw-r--r--src/libcamera/base/log.cpp26
-rw-r--r--src/libcamera/matrix.cpp11
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp16
-rw-r--r--src/libcamera/pipeline/virtual/virtual.cpp23
-rw-r--r--src/libcamera/pipeline/virtual/virtual.h1
6 files changed, 39 insertions, 45 deletions
diff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp
index e2b5cf4d..eb8ca39e 100644
--- a/src/ipa/rkisp1/algorithms/ccm.cpp
+++ b/src/ipa/rkisp1/algorithms/ccm.cpp
@@ -120,12 +120,7 @@ void Ccm::process([[maybe_unused]] IPAContext &context,
[[maybe_unused]] const rkisp1_stat_buffer *stats,
ControlList &metadata)
{
- float m[9];
- for (unsigned int i = 0; i < 3; i++) {
- for (unsigned int j = 0; j < 3; j++)
- m[i * 3 + j] = frameContext.ccm.ccm[i][j];
- }
- metadata.set(controls::ColourCorrectionMatrix, m);
+ metadata.set(controls::ColourCorrectionMatrix, frameContext.ccm.ccm.data());
}
REGISTER_IPA_ALGORITHM(Ccm, "Ccm")
diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp
index 3a656b8f..72e0db85 100644
--- a/src/libcamera/base/log.cpp
+++ b/src/libcamera/base/log.cpp
@@ -8,6 +8,7 @@
#include <libcamera/base/log.h>
#include <array>
+#include <fnmatch.h>
#include <fstream>
#include <iostream>
#include <list>
@@ -38,8 +39,8 @@
* The levels are configurable through the LIBCAMERA_LOG_LEVELS environment
* variable that contains a comma-separated list of 'category:level' pairs.
*
- * The category names are strings and can include a wildcard ('*') character at
- * the end to match multiple categories.
+ * The category names are strings and can include a wildcard ('*') character to
+ * match multiple categories.
*
* The level are either numeric values, or strings containing the log level
* name. The available log levels are DEBUG, INFO, WARN, ERROR and FATAL. Log
@@ -717,24 +718,9 @@ void Logger::registerCategory(LogCategory *category)
categories_.push_back(category);
const std::string &name = category->name();
- for (const std::pair<std::string, LogSeverity> &level : levels_) {
- bool match = true;
-
- for (unsigned int i = 0; i < level.first.size(); ++i) {
- if (level.first[i] == '*')
- break;
-
- if (i >= name.size() ||
- name[i] != level.first[i]) {
- match = false;
- break;
- }
- }
-
- if (match) {
- category->setSeverity(level.second);
- break;
- }
+ for (const auto &[pattern, severity] : levels_) {
+ if (fnmatch(pattern.c_str(), name.c_str(), FNM_NOESCAPE) == 0)
+ category->setSeverity(severity);
}
}
diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp
index 4d95a19b..e7e02722 100644
--- a/src/libcamera/matrix.cpp
+++ b/src/libcamera/matrix.cpp
@@ -53,6 +53,17 @@ LOG_DEFINE_CATEGORY(Matrix)
*/
/**
+ * \fn Matrix::data()
+ * \brief Access the matrix data as a linear array
+ *
+ * Access the contents of the matrix as a one-dimensional linear array of
+ * values in row-major order. The size of the array is equal to the product of
+ * the number of rows and columns of the matrix (Rows x Cols).
+ *
+ * \return A span referencing the matrix data as a linear array
+ */
+
+/**
* \fn Span<const T, Cols> Matrix::operator[](size_t i) const
* \brief Index to a row in the matrix
* \param[in] i Index of row to retrieve
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 8ac24e6e..6e039bf3 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -537,21 +537,7 @@ int SimpleCameraData::init()
<< "Failed to create software ISP, disabling software debayering";
swIsp_.reset();
} else {
- /*
- * The inputBufferReady signal is emitted from the soft ISP thread,
- * and needs to be handled in the pipeline handler thread. Signals
- * implement queued delivery, but this works transparently only if
- * the receiver is bound to the target thread. As the
- * SimpleCameraData class doesn't inherit from the Object class, it
- * is not bound to any thread, and the signal would be delivered
- * synchronously. Instead, connect the signal to a lambda function
- * bound explicitly to the pipe, which is bound to the pipeline
- * handler thread. The function then simply forwards the call to
- * conversionInputDone().
- */
- swIsp_->inputBufferReady.connect(pipe, [this](FrameBuffer *buffer) {
- this->conversionInputDone(buffer);
- });
+ swIsp_->inputBufferReady.connect(this, &SimpleCameraData::conversionInputDone);
swIsp_->outputBufferReady.connect(this, &SimpleCameraData::conversionOutputDone);
swIsp_->ispStatsReady.connect(this, &SimpleCameraData::ispStatsReady);
swIsp_->setSensorControls.connect(this, &SimpleCameraData::setSensorControls);
diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp
index 469f5655..049ebcba 100644
--- a/src/libcamera/pipeline/virtual/virtual.cpp
+++ b/src/libcamera/pipeline/virtual/virtual.cpp
@@ -232,8 +232,7 @@ PipelineHandlerVirtual::generateConfiguration(Camera *camera,
default:
LOG(Virtual, Error)
<< "Requested stream role not supported: " << role;
- config.reset();
- return config;
+ return {};
}
std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
@@ -287,6 +286,11 @@ int PipelineHandlerVirtual::exportFrameBuffers([[maybe_unused]] Camera *camera,
int PipelineHandlerVirtual::start([[maybe_unused]] Camera *camera,
[[maybe_unused]] const ControlList *controls)
{
+ VirtualCameraData *data = cameraData(camera);
+
+ for (auto &s : data->streamConfigs_)
+ s.seq = 0;
+
return 0;
}
@@ -298,16 +302,27 @@ int PipelineHandlerVirtual::queueRequestDevice([[maybe_unused]] Camera *camera,
Request *request)
{
VirtualCameraData *data = cameraData(camera);
+ const auto timestamp = currentTimestamp();
for (auto const &[stream, buffer] : request->buffers()) {
bool found = false;
/* map buffer and fill test patterns */
for (auto &streamConfig : data->streamConfigs_) {
if (stream == &streamConfig.stream) {
+ FrameMetadata &fmd = buffer->_d()->metadata();
+
+ fmd.status = FrameMetadata::Status::FrameSuccess;
+ fmd.sequence = streamConfig.seq++;
+ fmd.timestamp = timestamp;
+
+ for (const auto [i, p] : utils::enumerate(buffer->planes()))
+ fmd.planes()[i].bytesused = p.length;
+
found = true;
+
if (streamConfig.frameGenerator->generateFrame(
stream->configuration().size, buffer))
- buffer->_d()->cancel();
+ fmd.status = FrameMetadata::Status::FrameError;
completeBuffer(request, buffer);
break;
@@ -316,7 +331,7 @@ int PipelineHandlerVirtual::queueRequestDevice([[maybe_unused]] Camera *camera,
ASSERT(found);
}
- request->metadata().set(controls::SensorTimestamp, currentTimestamp());
+ request->metadata().set(controls::SensorTimestamp, timestamp);
completeRequest(request);
return 0;
diff --git a/src/libcamera/pipeline/virtual/virtual.h b/src/libcamera/pipeline/virtual/virtual.h
index 92ad7d4a..683cb82b 100644
--- a/src/libcamera/pipeline/virtual/virtual.h
+++ b/src/libcamera/pipeline/virtual/virtual.h
@@ -37,6 +37,7 @@ public:
struct StreamConfig {
Stream stream;
std::unique_ptr<FrameGenerator> frameGenerator;
+ unsigned int seq = 0;
};
/* The config file is parsed to the Configuration struct */
struct Configuration {