[RFC 0/4] libcamera: swstats_cpu: Add processFrame() method

Hans de Goede hdegoede at redhat.com
Wed Oct 9 22:01:06 CEST 2024


Hi All,

Here is a patch series adding a processFrame() method to gather
statistics on an entire frame in one go, rather then using the
line by line approach which is used by the somewhat tightly coupled
DebayerCpu class.

ATM there are no users for processFrame() yet, so the code is
compile tested only which is why it is marked as RFC.

I see at least 3 possible use-cases for this:

1. Gathering sw statistics for 3A on raw bayer buffers before
passing them along for a to-be-added software CPU ISP raw mode.

2. Gathering sw statistics for 3A on raw bayer buffers before
doing further processing on the GPU for the software GPU ISP
(possibly as an intermediate step until the stats are gathered
on the GPU too and/or as a way to compare CPU vs GPU stats
for verification purposes).

3. I'm working on a pipeline handler for the atomISP2, where
there is a working hw ISP but no usable statistics.
The plan is to gather sw statistics on the output buffers
(so on e.g. YUV images) and then re-use the 3A code from
the software ISP (I realize gathering statistics on the
pipeline output buffers is not ideal, but the atomISP driver
has no way to access the raw bayer data).

Usage would look something like this:

once:

	if (stats_->configure(inputCfg) != 0)
		return -EINVAL;

	stats_->setWindow(Rectangle(window_.size()));

per frame:

	stats_->startFrame();
	stats_->processFrame(inputFrameBuffer);
	stats_->finishFrame(frameNo, bufferID);

Regards,

Hans


Hans de Goede (4):
  libcamera: swstats_cpu: Update statsProcessFn() / processLine0()
    documentation
  libcamera: swstats_cpu: Drop patternSize_ documentation
  libcamera: software_isp: Move benchmark code to its own class
  libcamera: swstats_cpu: Add processFrame() method

 src/libcamera/software_isp/benchmark.cpp   |  78 +++++++++++++++
 src/libcamera/software_isp/benchmark.h     |  36 +++++++
 src/libcamera/software_isp/debayer_cpu.cpp |  32 +-----
 src/libcamera/software_isp/debayer_cpu.h   |   7 +-
 src/libcamera/software_isp/meson.build     |   1 +
 src/libcamera/software_isp/swstats_cpu.cpp | 108 +++++++++++++++++----
 src/libcamera/software_isp/swstats_cpu.h   |  10 ++
 7 files changed, 216 insertions(+), 56 deletions(-)
 create mode 100644 src/libcamera/software_isp/benchmark.cpp
 create mode 100644 src/libcamera/software_isp/benchmark.h

-- 
2.46.2



More information about the libcamera-devel mailing list