I would like to inquire about a method to efficiently pass captured data to the memory allocated by VPU_EncGetMem.
Is it possible to achieve this without using address assignment?
I am using v4l and V4L2_MEMORY_MMAP for capturing.
The memory for encoding is allocated using VPU_EncGetMem.
When I use memcpy to copy the data to the memory allocated by VPU_EncGetMem, encoding works fine. However, if I assign the memory address of the memory allocated by VPU_EncGetMem directly to input_buf, the encoded video appears green.
OK:
memcpy(pInputVirt, input_buf, input_size);
NG: Encoded video appears green.
pInputVirt = input_buf;
pInputVirt: Memory allocated by VPU_EncGetMem for encoding.
input_buf: Memory allocated by mmap for capturing.
CPU: i.MX8MPlus
Hi @kuri,
After researching, the following findings have been made:
(1) Copy from the address allocated by mmap to a global variable (414720 bytes) → Takes approximately 30ms for the copy operation.
(2) Copy within the global variable (414720 bytes) → Completes the copy in approximately 2ms.
The slow copying from the capture buffer allocated by mmap is identified as the issue.
The mmap is allocated with the following options:
addr = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)
<Questions> - Do you have any insights into the reasons for the slow copying from the mmap address? - Could you provide any methods to speed up the copying from the mmap address?
Best Regards
Dear @Dhruvit
Thank you for your response.
It takes about 30ms to copy Full HD YUYV data using memcpy.
I need to achieve 2-channel recording at Full HD and 30fps, but the processing speed is a problem.
Is there any good solution?
Best Regards