I use NvBufSurfTranform to transform ip_surf (RGBA) to intermediate_buffer
NvBufSurfTransform (&ip_surf, intermediate_buffer, &transform_params);
I am not sure if step 3 convert RGBA to YUV420
Use NvBufferGetParams and try to get NvBuffer but I got 0 for n_planes. I would like to write it to .yuv and use jpeg decode to convert it to jpeg so I can verify that I get the frame.
Where will you use NvBufSurfTranform? Inside some plugin such as ds-example or use pad probe with some plugin?
As for your codes, steps 1~ 3 are OK.
Step 4 needs the “NVBUF_MEM_SURFACE_ARRAY” or “NVBUF_MEM_HANDLE” memory type, but the memType of intermediate_buffer you created is “NVBUF_MEM_DEFAULT”, so it may not work.
Seems you can refer to the gstdsexample source codes to check how to deal with NvBufSurface.
How do I get it?
When I do this
NvBufferGetParams (intermediate_buffer->surfaceList[0].bufferDesc, &dest_param);
NvBuffer *myNvBuffer = (NvBuffer *)dest_param.nv_buffer;
g_print(“planes %d\n”, myNvBuffer->n_planes);
The n_planes is 0.
I am also confused about the memory concept.
On Jetson Xavier:
What is hardware memory? Is it the same as Cuda memory?
What about NVMM memory?