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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Oct 10 21:45:09 CEST 2024


Hi Hans,

On Wed, Oct 09, 2024 at 10:01:06PM +0200, Hans de Goede wrote:
> 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.

Why are the stats not usable ? Is it a hardware issue, a firmware issue,
or "just" that we don't have information about the statistics format ?

> 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).

It's more than non-ideal, it will make algorithms development much more
painful :-(

> 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

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list