Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4990

Camera board • Re: When using libcamera accessing the camera buffer is very slow.

$
0
0
So I moved the timing function to just be around mmapping and finding the pointer to the mmapped data and now I'm seeing results as expected.

Mmapping each frame takes about 30000 nanoseconds.

Code:

 uint8_t *ptr = static_cast<uint8_t *>(mmap(NULL, buffer->planes()[0].length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
Finding the mmapped pointer takes about 1000 nanoseconds.

Code:

auto it = mapped_buffers[0].find(bufferPair.second);if (it == mapped_buffers[0].end())throw std::runtime_error("failed to identify queue request buffer");uint8_t *ptr = (uint8_t *)it->second[0].data();
Please note that these speeds are on a Pi5 for a V3 camera with a resolution of 2304x1296.

Statistics: Posted by peytonicmaster — Tue Feb 13, 2024 4:55 am



Viewing all articles
Browse latest Browse all 4990

Trending Articles