How to use NvBufSurfaceColorFormat stored RAW10(16bit) data

Hi everyone,

I am trying to use NvBufSurf::NvAllocate to store RAW10 image data (V4L2_PIX_FMT_SGRBG10). For the allocated colorFormat parameter, I selected a format that maintains the same pitch (3840 for an image width of 1920). However, only NVBUF_COLOR_FORMAT_YUYV family meets these conditions.

When I used this format, I encountered the following error:

NVMAP_IOC_READ:1077431815 failed [4]
[1077431815]: Offset 0 SrcStride 7680 pDst 0xaaaaf28ee6f0 DstStride 7680 Count 1200
free(): invalid next size (normal)

Could you please provide some advice on how to resolve this issue?

Thanks!

Other information:

  1. Camera output format

    (1920 x 1200) pixfmt: BA10, stride: 3840, imagesize: 4608000,

  2. NvBufSurf info

    pitch = 3840 width = 1920 datasize = 4718592

Best regards,
Ultwcz1997

hello ultwcz1997,

you may using Applications Using V4L2 IOCTL Directly to store RAW10 image data.
for instance,
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1200,pixelformat=BA10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw

I understand, but I need to use DMA to access the image data for the next stage of post-processing, which is why I chose NVBufSurf.

hello ultwcz1997,

but… you still need hardware engine to do demosaic, right?

you may refer to Argus sample app, such as argus_demosaicOutput, which is added RGBA output support to ISP pipeline, it demonstrate the CVOutput capability.
please execute $ sudo apt install nvidia-l4t-jetson-multimedia-api to install MMAPI package.

Yes, but Now my APP is not using Argus, so it need extra work for me.

Main idea:
get 10bit image using v4l2 interface → store data using NvBuf(16bit per pixel) → demosaic → output RGBA(NVBUF_COLOR_FORMAT_RGBA)

I only want to find a proper NVBUF_COLOR_FORMAT_* to allocate NvBuf.

Hi,
There is no NvBufSurface for RAW10 data. A possible solution is

  1. Capture frame data to CUDA buffer
  2. Implement CUDA code for demosaic
  3. output RGBA to NvBufSurface

For capturing frame data to CUDA buffer, you can check

/usr/src/jetson_multimedia_api/samples/18_v4l2_camera_cuda_rgb

Hi, @DaneLLL

I work according to this process and capture frame data is 8bit, it already worked;

Now I want try 10bit.

I will refer it, thank you.

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