How to set the g2d param to implement yuyv convert to RGB32

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

How to set the g2d param to implement yuyv convert to RGB32

1,573 Views
zhonghongbozhon
Contributor I

I want to test the function which is yuyv  to convert to RGB32 in 3.10.53 kernel. But I found the output picture is seprate  more picture, and this picture is blurred.

Could you help me to see it?

The G2D convert code as following:

struct g2d_surface src, dst;

struct g2d_buf *buf;

void *handle = NULL;

int size = 640 * 480;

ret = g2d_open(&handle);

    if(ret < 0) {

   printf("g2d open fail for the ivicar\n");
   return 0;

    }

   buf = g2d_alloc(size * 2, 1);

    memcpy(buf.buf_vaddr, buf_yuyv, size * 2);

    src.planes[0] = buf.buf_paddr;

    src.left = 0;

    src.top = 0;

    src.right = 640;

    src.bottom = 480;

    src.stride = 640;

    src.width = 640;

    src.height = 480;

    src.rot = G2D_ROTATION_0;

    src.format = G2D_YUYV;

    dst.planes[0] = g_fb_phys;

    dst.left = 0;

    dst.top = 0;

    dst.right = 640;

    dst.bottom = 480;

    dst.stride = 640;

    dst.width = 640;

    dst.height = 480;

    dst.rot = G2D_ROTATION_0;

    dst.format = G2D_RGBA8888;

    g2d_blit(handle, &src, &dst);

    g2d_finish(handle);

    usleep(1000);

    g2d_close(handle);

   g2d_free(buf);

0 Kudos
2 Replies

810 Views
zhonghongbozhon
Contributor I

Hi igorpadykov,

Thanks your advise, But I try scale the image with g2d plugin in the gstreamer-imx, The error information as the following:

# gst-language-1.0 videotestsrc ! video/x-raw,foramt=BGRA,width=640,height=480 ! imxg2dvideotransform ! video/x-raw,width=400,height=240 ! imxipuvideosink

Setting pipeline to PAUSED ...

Pipeline is PREROLLING ...

g2d_blit: Invalid dst rect, left 0, top 0, right 0, bottom 0, width 400, height 240, stride 400!

ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data flow error.

Additional debug info:

/work/yocto/build-fb/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/gstreamer1.0/git-r0

/git/libs/gst/base/gstbasesrc.c(2933): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:

videotestsrc0:

streaming task paused, reason error (-5)

ERROR: pipeline doesn't want to preroll.

Setting pipeline to NULL ...

Freeing pipeline ...

0 Kudos

810 Views
igorpadykov
NXP Employee
NXP Employee

Hi bobo

for conversion example one can try

imxvideoconvert_g2d plugin, check sect.7.5.4 Video Conversion attached Linux Guide

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos