V4L2 DMABUF for greyscale images

I am following the 12_v4l2_camera_cuda sample from the jetson_multimedia_api.

Can anyone explain this snippet:

        if (ctx->cam_pixfmt == V4L2_PIX_FMT_GREY &&
            pSurf->surfaceList[0].pitch != pSurf->surfaceList[0].width)
            ctx->capture_dmabuf = false;

As this describes our case, I’d like to acquire 8-bit greyscale images via DMA direct to an NvBuffer for further processing with VPI.

I guess I understand that the NvBufSurface needs to be continuous (pitch == width). Is the question why isn’t it continuous?

Hi,
For certain resolutions, pitch is not equivalent to width in NvBufSurface due to data alignment of hardware DMA buffer. Please check if your source can be adjusted to fit the data alignment of NvBufSurface. If yes, you can capture frame data into NvBufSurface directly.

Interesting. So “source can be adjusted” would mean something like choosing a different X-resolution (width) that matches the pitch of the NvBufSurface?

Is there a reason it’s specific to greyscale images?

Hi,
It is not specific to GREY format. All formats may have pitch not equivalent to width for certain resolution.

Here is a related topic for reference:
2880x1860 camera NvBufferTransform failed - #4 by DaneLLL

Got it. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.