How to set NvCVImage members when the pixelFormat is YUV420P?

Hi,

I want to call NvCVImage_Transfer to transfer from YUV420P to NVCV_RGBA, I known that one YUV420P pix use 1 + 0.25 + 0.25 bytes , it likes the the following three members can only be set to integers:

nvcvIm->pixelBytes = (unsigned char)3;
nvcvIm->componentBytes = (unsigned char)1;
nvcvIm->numComponents = (unsigned char)3;

So how to set the values?

NvCVImage *nvcvIm;
nvcvIm->pixels = frame->data;
nvcvIm->width = frame->width;
nvcvIm->height = frame->height;
nvcvIm->pitch = frame->width * 3;
nvcvIm->pixelFormat = NvCVImage_PixelFormat::NVCV_YUV420;
nvcvIm->componentType = NvCVImage_ComponentType::NVCV_U8;
nvcvIm->bufferBytes = 0;
nvcvIm->deletePtr = nullptr;
nvcvIm->deleteProc = nullptr;
nvcvIm->pixelBytes = (unsigned char)3;
nvcvIm->componentBytes = (unsigned char)1;
nvcvIm->numComponents = (unsigned char)3;
nvcvIm->planar = NVCV_YUV;
nvcvIm->gpuMem = NVCV_CPU;
nvcvIm->reserved[0] = 0;
nvcvIm->reserved[1] = 0;

Please Help, thanks.

up