How to convert YUYV to RGBX8888 using g2d_blit in iMX8QM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to convert YUYV to RGBX8888 using g2d_blit in iMX8QM

281 Views
hsaito
Contributor I

Hi,

We are tring to convert YUYV to RGBX8888 using g2d_blit in iMX8QM.

Using this code, but We cant convert RGBX8888. g2d buf is black image.

How to convert YUYV to RGBX8888.

 

int YUYV2RGBX(void* handle, g2d_buf* src_g2d, g2d_buf* dst_g2d, int width, int height){
    g2d_surface src, mid, dst;

    src.planes[0] = src_g2d->buf_paddr;
    src.left = 0;
    src.top = 0;
    src.right = width;
    src.bottom = height/2;
    src.stride = width*2;
    src.width = width;
    src.height = height/2;
    src.rot = G2D_ROTATION_0;
    src.format = G2D_YUYV;

    dst.planes[0] = dst_g2d->buf_paddr;
    dst.left = 0;
    dst.top = 0;
    dst.right = width;
    dst.bottom = height;
    dst.stride = width;
    dst.width = width;
    dst.height = height;
    dst.rot = G2D_ROTATION_0;
    dst.format = G2D_RGBX8888;

    if(width == 0 || height == 0){
        return -1;
    }

    if(g2d_blit(handle, &src, &dst) == -1){
        return -1;
    }

    if(g2d_finish(handle) == -1){
        return -1;
    }
    return 0;
}
void* handle;
g2d_open(handle);
g2d_buf yuyv_buf = g2d_alloc(1280*720*2, 0);
g2d_buf g2d_buf = g2d_alloc(1280*720*4, 0);

YUYV2RGBX(handle, yuyv_buf, g2d_buf, 1280, 720);

 

 

0 Kudos
Reply
2 Replies

264 Views
jinghui_liu
NXP Employee
NXP Employee

Hi, 

Could u show the completed scr code?

It seems that u do some scale beside CSC, and not sure if the configure about this is correct.

And haven't found your vddr setting of g2d_buf.

 

Regards

Jinghui

 

0 Kudos
Reply

260 Views
hsaito
Contributor I

Hi,

 

I atttached source code files.

Some variables are defined below.

in_width=1280
in_height=720
in_pixel_fmt=V4L2_PIX_FMT_YUYV
in_mem_type=V4L2_MEMORY_USERPTR
 
Regards,
0 Kudos
Reply