Creating NvBuffer for 21:9 image

Hi,

I’m using the Jetson Multimedia API (32.6.1) on an AGX Xavier to work with some cameras. After some processing, my output image needs to be of the size 1720x720 (21:9 ultrawide).

I create an NvBuffer for the output as follows:

    int dmabuf_fd;
    NvBufferCreateParams params = {0};
    params.width = 1720;
    params.height = 720;
    params.layout = NvBufferLayout_Pitch;
    params.nvbuf_tag = NvBufferTag_VIDEO_CONVERT;
    params.colorFormat = NvBufferColorFormat_ABGR32;
    if (-1 == NvBufferCreateEx(&dmabuf_fd, &params)) {
        std::cout << "Failed to create output NvBuffer.\n";
        return 0;
    }

However, this creates a buffer with the wrong pitch. When I read the params of this NvBuffer, I get the pitch as 6912, when expected value should be 6880 (4x 1720). This is causing my output to look fragmented and weird.

Appreciate any help to create an NvBuffer with the correct parameters.

(additional info: I am getting the output image from some OpenCV CUDA processing and copying it to the output NvBuffer. If I create an output buffer with standard sizes, I can see the image properly as the buffer gets created with correct pitch).

Hi,
This is expected since NvBuffer is hardware DMA buffer. For some resolutions, pitch is not equivalent to width and you would need to consider data alignment. Please call NvBufferGetParams() to get pitch, width, and height.