Can AGX Orin support RGBA/YUV422/NV21 for LDC in drive OS?

Hi NV,

We found that nvmimg_ldc Sample code is just for YUV420(I420) file input/output, with strange 2 planes YUV (instead of 3 planes) .
Can the library be supported for RGBA/YUV422/NV21 format?
If yes, can you provide some guide for me?

Here are some progresses what I tried:

  • If I change 2 planes to 3 planes for I420, NvMediaLdcProcess will failed with error code “NOT_Supported”
  • If I change scibuf to allocate RGBA or YUV422 type and load image, NvMediaLdcProcess will failed with error code “NOT_Supported”
  • If I directly use original code, load NV21 instead of I420, imager effect will be wrong

Besides, I found parameter “subSampling” which using to define yuv format in config file was removed in drive os 6.0.x, while driveos 5.2 was supported.

Are you asking for Jetson AGX Orin or Drive AGX Orin platform?

Drive AGX Orin, Thanks.
And I have modified this issue.

The function comment from imageldc.c source file describes the supported pixel formats.

/* Reads YUV file to the NvSciBufObj memory.

  • Currently only 8bit per component YUV420 planar files are supported.
  • The supported NvSciBufObj formats are
  • T_Y8___V8U8_N420 (semiplanar)
  • T_Y8___U8___V8_N420 (YUV420 planar, YV12)
    */
    static NvMediaStatus
    ReadYUV(char file,
    uint32_t frameIdx, /
    frame number */
    NvSciBufObj buf,
    NvSciBufAttrList *sciBufAttrListReconciled)
    {

Hi Vick,
Thanks for your quick reply. We got that it is not supported for RGBA and YUV422. Now in this issue, we focus on why format YUV420 semiplanar (NV21) does not work.

There is an image in directory /drive-linux/samples/Media/fisheye_1280_1080_yuv420.yuv, which is actually YUV420 I420 format with 3 planes.

1.If I use original code with YUV420(I420, 3 planes) sample image, it works. Attached the config file and img:
img_fisheye_1280_1080.I420 (9.9 MB)
img_fisheye_1280_1080_out.yuv420 (2.0 MB)

ldc_gen_warpmap_I420.conf (3.2 KB)

2.If I convert img format from I420 to YV12(3 planes), it works. Attached the config file and img:
img_fisheye_1280_1080.yv12 (9.9 MB)

img_fisheye_1280_1080_out.yv12 (2.0 MB)
ldc_gen_warpmap_yv12.conf (3.2 KB)

Above case is very very strange because originally nvmimg_ldc allocate 2 planes YUV , instead of 3 planes:
CreateSciBuf(2, srcWidth, srcHeight, pLDC, sciBufModule, &curr, &sciBufAttrListSrc);
And if I change it to 3 planes with CreateSciBuf(3, …), NvMediaLdcProcess will report err 6. syslog reports:

May 17 11:51:55 tegra-ubuntu nvmimg_ldc: Module_id 56 Severity 2 : failed to fill config struct, pixel format invalid
May 17 11:51:55 tegra-ubuntu nvmimg_ldc: NvLogOsSupportEnabled: nvlog DT node is not enabled, disabling library
May 17 11:51:55 tegra-ubuntu nvmimg_ldc: NvLogOsInit - NvLog support is not enabled
May 17 11:51:55 tegra-ubuntu nvmimg_ldc: Module_id 56 Severity 2 : failed to submit NvVIC geotrans operation 2
May 17 11:51:55 tegra-ubuntu nvmimg_ldc: Module_id 50 Severity 2 : failed to submit LDC operation, NvVIC failed with 2
May 17 11:51:55 tegra-ubuntu nvmimg_ldc: Module_id 50 Severity 2 : failed to submit NvMediaLdc operation 6
  1. If I convert img format from I420 to NV21 (semiplanar), sample runs without error logs, but image is wrong (Y correct, U/V wrong), Attached the config file and img
    img_fisheye_1280_1080.nv21 (9.9 MB)

img_fisheye_1280_1080_out.nv21 (2.0 MB)
ldc_gen_warpmap_nv21.conf (3.2 KB)

BTW, Which API tells LDC what input YUV format should be? It was confused to process YV12 with 2 plane buffers.

Please take a look at its source code to know how it reads planes from a file.

/* Reads or writes a plane to or from a file */
static inline NvMediaStatus
ReadWritePlane(FILE *f,
const BufferAttrs *attrs,
uint8_t plane,
bool semiplanar,
FileFunction func)
{
uint64_t offset = attrs->offset[plane];
uint64_t width = attrs->width[plane] * (attrs->bpp[plane] >> 3);
uint64_t pitch = attrs->pitch[plane];

if (!semiplanar) {
    for (int j = 0; j < attrs->height[plane]; j++) {
        if (func(attrs->cpuPtr + offset, 1, width, f) != width) {
            return NVMEDIA_STATUS_ERROR;
        }
        offset += pitch;
    }
} else { // semiplanar : read two planes into one


}
return NVMEDIA_STATUS_OK;
}

/* Reads or writes planes to or from a file */
static inline NvMediaStatus
ReadWriteAllPlanes(FILE *f,
const BufferAttrs *attrs,
FileFunction func)
{
NvMediaStatus status = NVMEDIA_STATUS_OK;

 if (attrs->planecount == 2) {
    status = ReadWritePlane(f, attrs, 0, false, func);
    if (status != NVMEDIA_STATUS_OK) {
        LOG_ERR("Error processing the YUV file");
        return status;
    }
    status = ReadWritePlane(f, attrs, 1, true, func);
    if (status != NVMEDIA_STATUS_OK) {
        LOG_ERR("Error processing the YUV file");
        return status;
    }
} else {


}

return status;

}

Hi Vick,

Thanks a lot.
The read function will parse 3 plane YV12 into 2 plane NV21.

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