Converting NvMediaImage with Block Linear surface layout to Pitch Linear surface layout efficiently

Please provide the following info (check/uncheck the boxes after clicking “+ Create Topic”):
Software Version
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version

Target Operating System

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)

SDK Manager Version

Host Machine Version
native Ubuntu 18.04

I would like to learn the suggested way to convert NvMediaImage data with Block-Linear surface layout (for a semi-planar YUV 420) into Pitch-Linear surface layout, by using NvMedia libraries in Drive OS 5.2

The purpose is to be able to directly feed the output of the ISP0/1 into the jpeg encoder, which seems to accept only Pitch-Linear surface layout.

My current approach is doing the following:

 status = NvMedia2DBlitEx(m_i2d,           /* i2d */
	                             imageFrame,      /* dstSurface */
	                             NULL,       /* dstRect */
	                             imagePtr,      /* srcSurface */
	                             NULL,       /* srcRect */
	                             NULL,   /* params */
	                             NULL);              /* paramsOut */

where imageFrame is allocated with NvMediaImageCreateNew , with a pitch linear surface layout, and imagePtr is obtained from the output buffer of ISP0, which is in block linear surface layout.

This seems to work, since I can use imageFrame with NvMediaIJPEFeedFrame. However, I’m not sure if this way of blitting is the most efficient way to use the hardware.

Dear @goksani ,
Is the ask is same as in YUV 420 Semi-planar block linear format to JPEG encoding - #6 by VickNV?


Yes it is.