DeepStreamSDK API FAQ

I am developing a plugin for DeepStream SDK.
DeepStream SDK dsexample_lib I am referring to it.
/opt/nvidia/deepstream/deepstream-4.0/sources/gst-plugins/gst-dsexample
I am using Jetson Nano.
I am using a file in the H.264 encoded yuv420 color format.
The sample plug-in is executed with the following command.
$ deepstream-app -c source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt
The following is added to the config file.

[ds-example]
enable=1
processing-width=1920
processing-height=1080
full-frame=0
unique-id=15
gpu-id=0

Ask about the “sourface” value at line 633 of gstdsexample.cpp

I want to read Y pixel data.
Q1) Should I refer to surface-> surfaceList-> mappedAddr-> addr [0]?
I understand that I use the NvSurfaceMap () API to refer to surface-> surfaceList-> mappedAddr-> addr [0].

Ask about the value of surface-> surfaceList-> layout on line 633 of gstdsexample.cpp.
Values are NVBUF_LAYOUT_PITCH orNVBUF_LAYOUT_BLOCK_LINEAR.
Q2)Please tell me the order of pixel data for NVBUF_LAYOUT_PITCH and NVBUF_LAYOUT_BLOCK_LINEAR. (NV12)

Can this page help you?

Thank you for your answer.
I was able to access the Y pixel data.
Please tell the order of arrangement of NV12 memory array (Y pixels).
ex) array[ ]={Y1,Y2,Y3…Y1920}

you can refer yuv - Image formats NV12 storage in memory - Stack Overflow

Thank you for the information.
See the source code answered by Chris Ding.

The order of Ypicel data in the memory below is not arranged line by line.
surface->surfaceList[frame_meta->batch_id].mappedAddr.addr[num_planes]

I was expecting “For a n-pixel NV12 frame: Y × 8 × n (UV) × 2 × n”, but it was different.
Y pixel data is not arranged in order.(array[ ]={Y1,Y2,Y3----Y1920,Y1921-----Y2073600}:for 1080p)
※I understand that I access the data by looking at the padding information.

Please tell me the arrangement order of Y pixel data of mappedAddr.addr [0]. (NV12)

It is pitch aligned, you need to note pParams->bytesPerPix[num_planes]*pParams->width[num_planes] <= pParams->pitch[num_planes].