libcamera: software_isp: Track and pass frame ids

A previous preparation patch implemented passing frame ids to stats
processing but without actual meaningful frame id value passed there.
This patch extends that by actually providing the frame id and passing
it through to the stats processor.

The frame id is taken from the request sequence number, the same as in
hardware pipelines.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Milan Zamazal
2024-09-27 15:46:13 +02:00
committed by Kieran Bingham
parent e334227dcc
commit f06c344bd5
7 changed files with 24 additions and 17 deletions

View File

@@ -73,10 +73,10 @@ public:
int start();
void stop();
int queueBuffers(FrameBuffer *input,
int queueBuffers(uint32_t frame, FrameBuffer *input,
const std::map<const Stream *, FrameBuffer *> &outputs);
void process(FrameBuffer *input, FrameBuffer *output);
void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output);
Signal<FrameBuffer *> inputBufferReady;
Signal<FrameBuffer *> outputBufferReady;

View File

@@ -861,7 +861,13 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)
if (converter_)
converter_->queueBuffers(buffer, conversionQueue_.front());
else
swIsp_->queueBuffers(buffer, conversionQueue_.front());
/*
* request->sequence() cannot be retrieved from `buffer' inside
* queueBuffers because unique_ptr's make buffer->request() invalid
* already here.
*/
swIsp_->queueBuffers(request->sequence(), buffer,
conversionQueue_.front());
conversionQueue_.pop();
return;

View File

@@ -94,8 +94,9 @@ Debayer::~Debayer()
*/
/**
* \fn void Debayer::process(FrameBuffer *input, FrameBuffer *output, DebayerParams params)
* \fn void Debayer::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params)
* \brief Process the bayer data into the requested format
* \param[in] frame The frame number
* \param[in] input The input buffer
* \param[in] output The output buffer
* \param[in] params The parameters to be used in debayering

View File

@@ -40,7 +40,7 @@ public:
virtual std::tuple<unsigned int, unsigned int>
strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0;
virtual void process(FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0;
virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0;
virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0;

View File

@@ -611,8 +611,7 @@ void DebayerCpu::memcpyNextLine(const uint8_t *linePointers[])
memcpy(lineBuffers_[lineBufferIndex_].data(),
linePointers[patternHeight] - lineBufferPadding_,
lineBufferLength_);
linePointers[patternHeight] = lineBuffers_[lineBufferIndex_].data()
+ lineBufferPadding_;
linePointers[patternHeight] = lineBuffers_[lineBufferIndex_].data() + lineBufferPadding_;
lineBufferIndex_ = (lineBufferIndex_ + 1) % (patternHeight + 1);
}
@@ -748,7 +747,7 @@ inline int64_t timeDiff(timespec &after, timespec &before)
} /* namespace */
void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams params)
void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params)
{
timespec frameStartTime;
@@ -808,12 +807,11 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
}
/*
* Frame and buffer ids are currently not used, so pass zeros as parameters.
* Buffer ids are currently not used, so pass zeros as its parameter.
*
* \todo Pass real values once frame is passed here and stats buffer passing
* is changed.
* \todo Pass real bufferId once stats buffer passing is changed.
*/
stats_->finishFrame(0, 0);
stats_->finishFrame(frame, 0);
outputBufferReady.emit(output);
inputBufferReady.emit(input);
}

View File

@@ -36,7 +36,7 @@ public:
std::vector<PixelFormat> formats(PixelFormat input);
std::tuple<unsigned int, unsigned int>
strideAndFrameSize(const PixelFormat &outputFormat, const Size &size);
void process(FrameBuffer *input, FrameBuffer *output, DebayerParams params);
void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params);
SizeRange sizes(PixelFormat inputFormat, const Size &inputSize);
/**

View File

@@ -278,12 +278,13 @@ int SoftwareIsp::exportBuffers(const Stream *stream, unsigned int count,
/**
* \brief Queue buffers to Software ISP
* \param[in] frame The frame number
* \param[in] input The input framebuffer
* \param[in] outputs The container holding the output stream pointers and
* their respective frame buffer outputs
* \return 0 on success, a negative errno on failure
*/
int SoftwareIsp::queueBuffers(FrameBuffer *input,
int SoftwareIsp::queueBuffers(uint32_t frame, FrameBuffer *input,
const std::map<const Stream *, FrameBuffer *> &outputs)
{
/*
@@ -301,7 +302,7 @@ int SoftwareIsp::queueBuffers(FrameBuffer *input,
}
for (auto iter = outputs.begin(); iter != outputs.end(); iter++)
process(input, iter->second);
process(frame, input, iter->second);
return 0;
}
@@ -333,13 +334,14 @@ void SoftwareIsp::stop()
/**
* \brief Passes the input framebuffer to the ISP worker to process
* \param[in] frame The frame number
* \param[in] input The input framebuffer
* \param[out] output The framebuffer to write the processed frame to
*/
void SoftwareIsp::process(FrameBuffer *input, FrameBuffer *output)
void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output)
{
debayer_->invokeMethod(&DebayerCpu::process,
ConnectionTypeQueued, input, output, debayerParams_);
ConnectionTypeQueued, frame, input, output, debayerParams_);
}
void SoftwareIsp::saveIspParams()