[libcamera-devel] swisp performance notes was Re: [RFC] Add 8-bit bayer support.
Pavel Machek
pavel at ucw.cz
Thu Dec 14 22:44:03 CET 2023
Hi!
So... For some reason latest version uses full sensor resolution. That
gave me 0.1 fps. If I copy image to cached memory (like below), I get
~1 fps with -O0, and ~4 fps with optimalizations. (On pinephone).
[9:26:04.598819548] [22455] INFO Camera camera.cpp:1183 configuring streams: (0) 2584x1940-RGB888
cam0: Capture until user interrupts by SIGINT
copy...5038848
process...
copy...5038848
33967.480079 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 15038880
process...
copy...5038848
33967.652354 (5.80 fps) cam0-stream0 seq: 000001 bytesused: 15038880
process...
copy...5038848
33968.685997 (0.97 fps) cam0-stream0 seq: 000007 bytesused: 15038880
You may want to check if caching works for you. (Adjust that 7000.. number.)
Best regards,
Pavel
commit 190d351eb3158c7d5f1eddd81b0a2aeedffaef9c
Author: Pavel Machek <pavel at ucw.cz>
Date: Thu Dec 14 21:58:26 2023 +0100
Copy image to cached memory. This gives me more than 10x performance
improvement.
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index 52910a03..0b4bf7ff 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -483,10 +483,27 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
return;
}
+ const uint8_t *uncached_src = in.planes()[0].data();
+ static uint8_t src[7000000];
+ unsigned long size = in.planes()[0].size();
+ if (size%8)
+ printf("very bad size!\n");
+
+ printf("copy...%ld\n", size);
+ (void) uncached_src;
+ if (1) {
+ unsigned int i;
+ for (i=0; i<size/8; i++) {
+ ((uint64_t *) src)[i] = ((uint64_t *) uncached_src)[i];
+ }
+ }
+ printf("process...\n");
+ // debayer is "free" compared to the memcpy.
+
if (inputConfig_.patternSize.height == 2)
- process2(in.planes()[0].data(), out.planes()[0].data());
+ process2(src, out.planes()[0].data());
else
- process4(in.planes()[0].data(), out.planes()[0].data());
+ process4(src, out.planes()[0].data());
metadata.planes()[0].bytesused = out.planes()[0].size();
--
People of Russia, stop Putin before his war on Ukraine escalates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20231214/fc8a3da1/attachment.sig>
More information about the libcamera-devel
mailing list