First of all, this is a bit of a repost of the following topic:
viewtopic.php?p=2113697&hilit=libcamera ... w#p2113697
But in that topic there doesn't seem to be a solution so I am posting it here again to hopefully find an answer.
I am trying to capture frames and am using the sample app simple-cam which can be found here:
https://github.com/kbingham/simple-cam/tree/master
This lets me capture images and in the processRequest function there the following comment:
To access the image data I added the following code:
Note that this works, and I am able to access the image data. However the memmove instruction takes about 25ms to complete which severely limits the frame rate I can process (The image resolution is a modest 1600x1080).
In the link above to the previous topic on this subject they talk about somehow overriding the fd of the mapped buffer which in their case increased the speed significantly but there is no information on how that is done.
Can someone suggest how I can access the frame buffer without incurring this significant delay?
Thanks.
viewtopic.php?p=2113697&hilit=libcamera ... w#p2113697
But in that topic there doesn't seem to be a solution so I am posting it here again to hopefully find an answer.
I am trying to capture frames and am using the sample app simple-cam which can be found here:
https://github.com/kbingham/simple-cam/tree/master
This lets me capture images and in the processRequest function there the following comment:
Code:
/* * Image data can be accessed here, but the FrameBuffer * must be mapped by the application */
Code:
for (const FrameBuffer::Plane &plane : buffer->planes()){ if (plane.fd.isValid()) { int fd = plane.fd.get(); unsigned char * addr = (unsigned char *) mmap(0, plane.length, PROT_READ, MAP_PRIVATE, fd, 0); if (addr != MAP_FAILED) { uint64_t t = GetTimeMs(); unsigned char buffer[plane.length]; memmove(buffer, addr, plane.length); printf("map time = %d", (unsigned) (GetTimeMs() - t)); munmap(addr, plane.length); } }}
Note that this works, and I am able to access the image data. However the memmove instruction takes about 25ms to complete which severely limits the frame rate I can process (The image resolution is a modest 1600x1080).
In the link above to the previous topic on this subject they talk about somehow overriding the fd of the mapped buffer which in their case increased the speed significantly but there is no information on how that is done.
Can someone suggest how I can access the frame buffer without incurring this significant delay?
Thanks.
Statistics: Posted by John Gaby — Tue Jan 16, 2024 1:00 am — Replies 0 — Views 479