libcamera: swstats_cpu: Add processFrame() method

Add a method to the SwstatsCpu class to process a whole Framebuffer in
one go, rather then line by line. This is useful for gathering stats
when debayering is not necessary or is not done on the CPU.

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
This commit is contained in:
Hans de Goede 2025-05-10 16:12:17 +02:00 committed by Bryan O'Donoghue
parent ba4218669b
commit d4bc61f716
2 changed files with 63 additions and 0 deletions

View file

@ -18,12 +18,16 @@
#include <libcamera/geometry.h>
#include "libcamera/internal/bayer_format.h"
#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/shared_mem_object.h"
#include "libcamera/internal/software_isp/swisp_stats.h"
#include "benchmark.h"
namespace libcamera {
class PixelFormat;
class MappedFrameBuffer;
struct StreamConfiguration;
class SwStatsCpu
@ -42,6 +46,7 @@ public:
void setWindow(const Rectangle &window);
void startFrame();
void finishFrame(uint32_t frame, uint32_t bufferId);
void processFrame(uint32_t frame, uint32_t bufferId, FrameBuffer *input);
void processLine0(unsigned int y, const uint8_t *src[])
{
@ -65,6 +70,7 @@ public:
private:
using statsProcessFn = void (SwStatsCpu::*)(const uint8_t *src[]);
using processFrameFn = void (SwStatsCpu::*)(MappedFrameBuffer &in);
int setupStandardBayerOrder(BayerFormat::Order order);
/* Bayer 8 bpp unpacked */
@ -77,6 +83,10 @@ private:
void statsBGGR10PLine0(const uint8_t *src[]);
void statsGBRG10PLine0(const uint8_t *src[]);
void processBayerFrame2(MappedFrameBuffer &in);
processFrameFn processFrame_;
/* Variables set by configure(), used every line */
statsProcessFn stats0_;
statsProcessFn stats2_;
@ -89,9 +99,11 @@ private:
Size patternSize_;
unsigned int xShift_;
unsigned int stride_;
SharedMemObject<SwIspStats> sharedStats_;
SwIspStats stats_;
Benchmark bench_;
};
} /* namespace libcamera */