The below example show to conversion from ARGB8888 to YUV420sp in sunxi.
[code lang=”c”]
#include <g2d_driver.h>
g2d_blt blit_para;
int err;
blit_para.src_image.addr[0] = smem_start; /* Physical address of start point */
blit_para.src_image.w = width; /* src buffer width in pixel units */
blit_para.src_image.h = height; /* src buffer height in pixel units */
blit_para.src_image.format = G2D_FMT_ABGR_AVUY8888;//G2D_FMT_ARGB_AYUV8888;
blit_para.src_image.pixel_seq = G2D_SEQ_NORMAL; /* not use now */
blit_para.src_rect.x = 0; /* src rect->x in pixel */
blit_para.src_rect.y = 0; /* src rect->y in pixel */
blit_para.src_rect.w = width; /* src rect->w in pixel */
blit_para.src_rect.h = height; /* src rect->h in pixel */
blit_para.dst_image.addr[0] = (int)phy_y;
blit_para.dst_image.addr[1] = (int)phy_c;
blit_para.dst_image.w = width; /* dst buffer width in pixel units */
blit_para.dst_image.h = height; /* dst buffer height in pixel units */
blit_para.dst_image.format = G2D_FMT_PYUV420UVC;
blit_para.dst_image.pixel_seq = G2D_SEQ_VUVU; /* not use now */
blit_para.dst_x = 0; /* dst rect->x in pixel */
blit_para.dst_y = 0; /* dst rect->y in pixel */
blit_para.color = 0xff; /* fix me*/
blit_para.alpha = 0xff; /* globe alpha */
blit_para.flag = G2D_BLT_NONE; // G2D_BLT_FLIP_HORIZONTAL;
err = ioctl(mG2DHandle , G2D_CMD_BITBLT ,(unsigned long)&blit_para);
if(err < 0) {
ALOGE("ioctl, G2D_CMD_BITBLT failed");
}
[/code]




Leave a Reply