[1/3] libcamera: swstats_cpu: Stop doing unnecessary work in processFrame()
diff mbox series

Message ID 20251122205507.37387-2-johannes.goede@oss.qualcomm.com
State New
Headers show
Series
  • GPUISP fixes
Related show

Commit Message

Hans de Goede Nov. 22, 2025, 8:55 p.m. UTC
Since commit c28bb6a6a48e ("libcamera: software_isp: Run sw-statistics
once every 4th frame) CPU based software-statistics are supposed to
only run every 4th frame.

And processFrame() already honors this in the sense that endFrame()
call will mark the generated statistics as not valid just like it does
when called from debayer_cpu.cpp, which does the statistics line by line
rather then calling processFrame().

But before marking the statistics as invalid processFrame() still does
the actual work of dma-syncing and mapping the input-buffer and then
generating the statistics, only to mark them invalid in the end.

Remove all the unnecesary work for every 3 of 4 frames by skipping
everything and just marking the statistics as not valid right away.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
---
This should be squashed into "libcamera: swstats_cpu: Add processFrame()
method" for the next version of the "[PATCH 00/22] GPUISP precursor series"
---
 src/libcamera/software_isp/swstats_cpu.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp
index f5906197..c931edb4 100644
--- a/src/libcamera/software_isp/swstats_cpu.cpp
+++ b/src/libcamera/software_isp/swstats_cpu.cpp
@@ -521,6 +521,11 @@  void SwStatsCpu::processBayerFrame2(MappedFrameBuffer &in)
  */
 void SwStatsCpu::processFrame(uint32_t frame, uint32_t bufferId, FrameBuffer *input)
 {
+	if (frame % kStatPerNumFrames) {
+		finishFrame(frame, bufferId);
+		return;
+	}
+
 	bench_.startFrame();
 	startFrame(frame);