summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apps/common/ppm_writer.cpp6
-rw-r--r--src/ipa/rkisp1/algorithms/ccm.cpp7
-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, 36 insertions, 28 deletions
diff --git a/src/apps/common/ppm_writer.cpp b/src/apps/common/ppm_writer.cpp
index 2e9378aa..368de8bf 100644
--- a/src/apps/common/ppm_writer.cpp
+++ b/src/apps/common/ppm_writer.cpp
@@ -29,7 +29,7 @@ int PPMWriter::write(const char *filename,
std::ofstream output(filename, std::ios::binary);
if (!output) {
std::cerr << "Failed to open ppm file: " << filename << std::endl;
- return -EINVAL;
+ return -EIO;
}
output << "P6" << std::endl
@@ -37,7 +37,7 @@ int PPMWriter::write(const char *filename,
<< "255" << std::endl;
if (!output) {
std::cerr << "Failed to write the file header" << std::endl;
- return -EINVAL;
+ return -EIO;
}
const unsigned int rowLength = config.size.width * 3;
@@ -46,7 +46,7 @@ int PPMWriter::write(const char *filename,
output.write(row, rowLength);
if (!output) {
std::cerr << "Failed to write image data at row " << y << std::endl;
- return -EINVAL;
+ return -EIO;
}
}
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/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 {