Pitch of second frame


I’ve an incoming video sample described by a structure of type CUeglFrame with the following values:

width: 640
height: 480
planeCount: 3
frame type: pitch
numChannels: 1
pitch: 768
depth: 0
CUarray_format: 1

my problem is which pitch I must use for the second and third planes ( U and V in YUV420 ). The data structure provides the pitch for the first plane in field CUeglFrame->pitch, but not the ones for remainders.

Using try&test, it seems the correct value is 512, that I suppose is the width (640) divided by 2 (because in YUV420 chroma planes has half width) and ceil rounded to 256, 640/2=320 => 512.

Googling, the only information I’ve found is this phrase (from here):

Note that in case of multiplanar *eglFrame, pitch of only first plane (unsigned int cudaEglPlaneDesc::pitch) is to be considered by the application.


If your buffer is NvBuffer, you can call NvBufferGetParams to get pitch of U and V planes. Looks like in CUeglFrame, it contains only pitch of first plane.

Yes, the result of the NvBufferGetParams contains an array of pitchs with the expected value 512 for the second and third plane. Thanks for the suggestion.

I wonder why CUeglFrame doesn’t contains an array instead of only the first element. Moreover, the cited phrase is misleading.