I am trying to get a buffer pointer from EGLStream. I am trying the NVBUF_COLOR_FORMAT_NV12 format. But I got following information from the NV buffer parameters:
But to me, the size doesn’t make sense because 5632 X 3710 = 20894720 but not 20971520. I also tried to just write the Y plane with the size of 20894720 and the image seems okay.
My end goal is to get a CPU accessible pointer to the continuous buffer with a frame in YUV420 format. But it seems the method mentioned in this post: How to get YUV Buffer pointer? - #5 by JerryChang is not valid anymore.
Does that mean there is no way to get YUV420 format frame data in continuous memory location?
The use case is that we have some algorithm which takes YUV420 frame data. But the algorithm needs continuous memory not different channels in separated memory locations.
you may still check MMAPI samples,
please refer to NvBufSurfTransform for the input/output DMA buffer, both exported as fd.
for instance, /usr/src/jetson_multimedia_api/samples/unittest_samples/transform_unit_sample
I checked the sample code. But I couldn’t find all those NvBufSurfTransform related definitions. It seems the sample code includes “transform_unit_sample.hpp” header file. But I couldn’t find that file anywhere.
Also, even I find the definitions, are all output planes in continuous memory? From the sample code, I couldn’t tell if that is the case. It still writes the data plane by plane.
Hi,
NvBufSurface is hardware DMA buffer and needs to consider data alignment. For multiple-plane resolutions, pitch and width and not identical. Would suggest use single-plane format such as RGBA for mapping to cv::Mat or cv::gpu::gpuMat
Please note for certain resolutions, it is still possible to see pitch and width are different in single-plane formats.