How to use NvMedia2D to convert YUYV Image to YUV420 Image

Please provide the following info (tick the boxes after creating this topic):
Software Version
DRIVE OS 6.0.6
[√] DRIVE OS 6.0.5
DRIVE OS 6.0.4 (rev. 1)
DRIVE OS 6.0.4 SDK
other

Target Operating System
[√] Linux
QNX
other

Hardware Platform
DRIVE AGX Orin Developer Kit (940-63710-0010-D00)
DRIVE AGX Orin Developer Kit (940-63710-0010-C00)
DRIVE AGX Orin Developer Kit (not sure its number)
[√] other

SDK Manager Version
1.9.2.10884
[√] other

Host Machine Version
native Ubuntu Linux 20.04 Host installed with SDK Manager
native Ubuntu Linux 20.04 Host installed with DRIVE OS Docker Containers
native Ubuntu Linux 18.04 Host installed with DRIVE OS Docker Containers
[√] other

I am using nvsipl to capture images from a camera. Since the camera has its own ISP, I am getting YUYV format images directly from the ICP.
The issue now is that NvMedia API requires images in YUV420 format, and I want to convert the YUYV format image to YUV420. I plan to use the NvMediaCompose() function in NvMedia2D to perform the conversion, but I am getting an error when I call NvMedia2DSetSrcNvSciBufObj().
Can you help me identify the problem or provide some sample code for this format conversion?

The error message I am getting when calling the API is as follows:"
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 22 Severity 6 : NvMediaICPCreateEx 72 **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 22 Severity 6 : T23x VI version 0x000023 **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set source buffer, conversion to surface container failed **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set NvMedia2D source buffer, error 1 **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set source buffer, conversion to surface container failed **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set source buffer, conversion to surface container failed **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set NvMedia2D source buffer, error 1 **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set source buffer, conversion to surface container failed **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set NvMedia2D source buffer, error 1 **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set source buffer, conversion to surface container failed **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set NvMedia2D source buffer, error 1 **
**Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to set NvMedia2D source buffer, error 1 **
Apr 19 09:38:32 tegra-ubuntu DULE: Module_id 48 Severity 2 : failed to get NvMedia2D compose parameters 9

Have you tried using the ‘nvmimg_2d’ sample application to perform the YUYV to YUV420 conversion? It might be helpful to try this sample application first to make sure that the issue is not specific to your implementation.

@VickNV I wrote my code completely based on the sample code, but unlike the sample code, I need to set the YUYV format image output by ICP as SrcSurface, and this step fails.

Based on your first post, it appears that the issue is not related to setting the YUYV format image output by ICP, but rather with a 2D related step. I suggest trying to input your YUYV images as a file to nvmimg_2d for conversion.

If you continue to experience the issue, please provide us with the input file and configuration file so that we can investigate the issue further.

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