在使用ip的动态库做alpha融合时,发现colorkey这个功能不能正常工作:
1 .顶层图片的格式是IPU_PIX_FMT_UYVY,底层图片的格式也是IPU_PIX_FMT_RGB565, input.format = IPU_PIX_FMT_RGB565, overlay.format =IPU_PIX_FMT_RGB565, 输出的格式也是IPU_PIX_FMT_RGB565。
按照上述配置, overlay层的RGB值为0的像素会被替换为底层的图片。 但是测试结果是RGB值为0的像素没有替换,而是半透明的。请问这个是什么原因导致的?
下面是我的部分关键代码。红色部分是alpha融合的代码。
int mxc_ipu_alpha_blend_main (void *arg)
{
struct ipu_task task;
struct timeval begin, end;
util_List *ev7250_cameraIn_que_node, *ev7250_cameraIn_que_node_last=NULL;
util_List *alpha_blend_out_que_node;
util_List *ipu_resize_out_que_node,*ipu_resize_out_que_node_last=NULL;
struct timeval tv_start, tv_current;
int ret;
util_IPU_buff ipu_buff_tmp;
if(arg) {;}
prctl(PR_SET_NAME,"blend_main");
fprintf( stdout,"\n\r *****mxc_ipu_alpha_blend_main task start *****\n\r"); fflush(stdout);
// Clear &task
memset(&task, 0, sizeof(task));
// Input image size and format
task.input.width =1920;
task.input.height=1024;
task.input.format = IPU_PIX_FMT_RGB565;
// Overlay image size and format
task.overlay.width = 1920;
task.overlay.height =1024;
task.overlay.format =IPU_PIX_FMT_RGB565;
task.overlay_en = 1;
task.overlay.alpha.mode = 0; //0 - Global alpha blending
task.overlay.alpha.gvalue = 128;
task.overlay.colorkey.enable=1;
task.overlay.colorkey.value=0x00;
// Output image size and format
task.output.width =1920;
task.output.height =1023;
task.output.format=IPU_PIX_FMT_RGB565;
while (1)
{
task.input.paddr=((util_IPU_buff* )ev7250_cameraIn_que_node_last->data)->paddr;
task.overlay.paddr=((util_IPU_buff* )ipu_resize_out_que_node_last->data)->paddr;
//task.output.paddr=ipu_buff_tmp.paddr;
task.output.paddr=((util_IPU_buff* )alpha_blend_out_que_node->data)->paddr;
module_dprintf(DEBUG_IPU_ALPHA_BLEND,4,"\n\r");
// Perform combining
ret = ioctl(util_ipu_fd, IPU_CHECK_TASK, &task);
if (ret < 0) {
//ret=ipu_check_task(&task);
err_msg("ioct IPU_CHECK_TASK fail %d %s\n", ret,strerror(errno));
//goto done;
}
else
{
module_dprintf(DEBUG_IPU_ALPHA_BLEND,4,"\n\r");
ret = ioctl(util_ipu_fd, IPU_QUEUE_TASK, &task);
if (ret < 0) {
//ret=ipu_check_task(&task);
err_msg("ioct IPU_QUEUE_TASK fail %d %s\n", ret,strerror(errno));
//goto done;
}
}
module_dprintf(DEBUG_IPU_ALPHA_BLEND,4,"\n\r");
module_dprintf(DEBUG_IPU_ALPHA_BLEND,4,"\n\r");
gettimeofday(&tv_current, NULL);
if(((tv_current.tv_sec*1000000+tv_current.tv_usec)-(tv_start.tv_sec*1000000+tv_start.tv_usec))<40000)
{
usleep(40000-((tv_current.tv_sec*1000000+tv_current.tv_usec)-(tv_start.tv_sec*1000000+tv_start.tv_usec)));
}
}
done:
return ret;
}
Hi,
Can you tell me the part number you are using? do you use StarCore family?
BR
Xiangjun Rong
Hi,
目前使用的I.MX6D的方案,型号:MCIMX6D5EYM10AD.请知悉。
发件人: xiangjun.rong
发送时间: 2019年4月18日 10:25
收件人: Jack Huang(黃克祥)(ChengDu)
主题: Re: - Re: 使用ipu做alpha融合的问题
NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>
Re: 使用ipu做alpha融合的问题
reply from xiangjun.rong<https://community.nxp.com/people/xiangjun.rong?et=watches.email.thread> in Digital Signal Controllers - View the full discussion<https://community.nxp.com/message/1140844?commentID=1140844&et=watches.email.thread#comment-1140844>
Hi, 克祥,
Unfortunately, this is the DSC forum, I ma not familiar with i.mx family, pls post your question to the following i.mx forum:
https://community.nxp.com/community/imx
I am sorry for the inconvenience.
BR
XiangJun Rong
Hi,XiangJun:
收到,谢谢!
************************************************
Best regards!
Jack Huang
WT Microclectronics (Shanghai) Co., Ltd. Chengdu Branch
Tel: 028-86151266-5617
Mobile: 13551220846
************************************************
发件人: xiangjun.rong
发送时间: 2019年4月19日 10:48
收件人: Jack Huang(黃克祥)(ChengDu)
主题: Re: - Re: 使用ipu做alpha融合的问题
NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>
Re: 使用ipu做alpha融合的问题
reply from xiangjun.rong<https://community.nxp.com/people/xiangjun.rong?et=watches.email.thread> in Digital Signal Controllers - View the full discussion<https://community.nxp.com/message/1141461?commentID=1141461&et=watches.email.thread#comment-1141461>