Closed krasin closed 4 months ago
Is it so slow? I also want to use its video encoding and decoding capabilities, but it seems that it is not feasible.
Video works fine, actually: https://youtu.be/Zg73V6hciUM
It's the case of acquiring a single image that is very slow. I suspect something keeps being initialized on every frame or some other bug in that particular example (sensor_test)
The biggest contribution to latency is writing the dump to a slow SD card. When I started to write to tmpfs, the time to grab the frame is consistently ~200ms, except for the very first frame:
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 476.569000
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 199.576004
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 198.602997
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 198.850998
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 198.341995
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 198.636002
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 198.854004
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 198.496994
This is still very slow, but much better than before. I will continue diving into it, as I need it to work fast.
If I copy the pixels to a memory buffer instead of writing into a file on tmpfs, the fimes are somewhat better: 166ms instead of ~200ms.
And if I take the photos, but don't copy the pixels, then the timings are good:
ViPipe:0,===GC4653 1440P 30fps 10bit LINEAR Init OK!===
...
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 427.342010
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 33.511002
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 34.113998
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 31.136999
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 32.150002
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 33.304001
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 31.170000
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 32.153999
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 32.133999
width: 2560, height: 1440, total_buf_length: 5529600
ms consumed: 32.064999
So, taking photos is 33ms (which is the expected time for 30 FPS), but copying the data (~5MB) out of the buffer takes 130ms. That corresponds to 38 MB/s memory bandwidth which is much less than the expected value for DDR3 (~6 GB/s).
I made sure that there are no extra memory allocation between the frames, and the times stay the same: 166ms to take a frame and copy it out of the system buffer to my own buffer using memcpy.
This is strange. It copies the data about 200 times slow than it should.
I confirmed that copying buffers in regular memory is much faster. It's copying from stVideoFrame.stVFrame.pu8VirAddr[i]
that is slow...
I am closing this issue. Not because it's resolved (it's not; at least, not fully), but because the original description is too confusing. I will consider refiling this issue with a better description.
Hi there,
thank you for working on this incredibly cool project.
I am trying to take photos using GC4653 4MP camera sold together with LicheeRV Nano. The acquisition time using sensor_test is incredibly slow (around 1 second):
Is there a particular reason for this to be so slow? Given that the board has 4 MIPI CSI-2 lanes, I would have expected a delay around 30-40 ms, but not 1000-1500 ms.
Is there a better way to do this?