Hi,
You may utilize Nvbuffer APIs for conversion. Since hardware converter does not support RGB, you may allocate either NvBufferColorFormat_ABGR32 or NvBufferColorFormat_XRGB32 in calling NvBufferCreateEx().
1 Allocate NvBufferColorFormat_ABGR32(or NvBufferColorFormat_XRGB32) and NvBufferColorFormat_YUV420 buffers
2 Copy the RGB8 data into the RGBA buffers.
3 Do conversion though NvBufferTransform()
4 Feed YUV420 buffers to NvVideoEcoder.
There are several samples demonstrating NvBuffer APIs. Please check and try.
After run “sudo /home/nvidia/jetson_clocks.sh” and sudo nvpmodel -m 0.
The CPU fan is running, and nvpmodel is 0. But Raw2NvBuffer is slow too.
tmB is also memcpy, and just need 3000us; But Raw2NvBuffer need 54857 us.
Finally, I find the result.
If I set NvBufferLayout_BlockLinear, Raw2NvBuffer need 54857 us.
And if i set NvBufferLayout_Pitch,Raw2NvBuffer need 6656 us.
So what is the different of NvBufferLayout_BlockLinear and NvBufferLayout_Pitch.
Hi,
Raw2NvBuffer() is an easy-to-use function. For better performance, you may use other NvBuffer APIs. Please check code of DO_CPU_PROCESS option in 10_camera_recording. You can call NvBufferGetParams() and NvBufferMemMap() once in initialization and NvBufferMemUnMap() in termination. It should save certain time in mapping/unmapping memory.