- 收藏
- 点赞
- 分享
- 举报
ive resize sobel问题
利用ive的resize和sobel算子做图像处理,申请了两块mmz的空间,申请空间的时候没有报错,但是经过resize和sobel的时候就报错:
是怎么回事阿,我不知道是mmz空间的问题还是什么问题????????????
~ # cat /dev/logmpp
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
<3>[ ive] [Func]:ive_sobel [Line]:388 [Info]:Error(0xa01d8007): check sobel parameters failed!
申请空间的代码:
hi_void create_img(hi_svp_img img,hi_svp_img_type type,hi_u32 width,hi_u32 height)
{
hi_s32 ret = HI_SUCCESS;
hi_u32 size;
hi_void virt = NULL;
size = widthheight;
ret = hi_mpi_sys_mmz_alloc((hi_phys_addr_t )&img->phys_addr[0],(hi_void **)&virt,
HI_NULL,HI_NULL,size);
if(ret != HI_SUCCESS)
{
printf(“hi_mpi_sys_mmz_alloc fail, ret = 0x%x\n”,ret);
}
img->width = width;
img->height = height;
img->stride[0] = width;
img->type = type;
img->virt_addr[0] = (hi_u64)virt;
}
resize的配置:
hi_s32 resize(hi_video_frame frame,hi_svp_img dst,hi_s32 width,hi_s32 height)
{
hi_s32 ret = HI_SUCCESS;
hi_ive_handle handle;
hi_svp_img src;
hi_ive_resize_ctrl ctrl;
hi_bool is_instant = TD_FALSE;
src.width = frame->width;
src.height = frame->height;
src.phys_addr[0] = frame->phys_addr[0];
src.virt_addr[0] = frame->virt_addr[0];
src.stride[0] = frame->stride[0];
src.type = OT_SVP_IMG_TYPE_U8C1;
dst->width = width;
dst->height = height;
dst->stride[0] = width;
dst->type = OT_SVP_IMG_TYPE_U8C1;
ctrl.mode = OT_IVE_RESIZE_MODE_LINEAR;
ctrl.num = 1;
ctrl.mem.phys_addr = dst->phys_addr[0];
ctrl.mem.virt_addr = dst->virt_addr[0];
ctrl.mem.size = (width*height);
ret = hi_mpi_ive_resize(&handle, &src, dst,&ctrl,is_instant);
if(ret == HI_FAILURE)
{
printf("hi_mpi_ive_dma fail,ret = 0x%x\n",ret);
}
return ret;
}
sobel的配置:
hi_s32 sobel(hi_svp_src_img src,hi_svp_src_img dst_h,hi_svp_src_img *dst_v)
{
hi_s32 ret = HI_SUCCESS;
hi_ive_handle handle;
hi_bool is_instant = TD_FALSE;
hi_ive_sobel_ctrl ctrl;
hi_s8 mask[HI_IVE_MASK_NUM] = {-1,-2 ,0, 2,1,
-4,-8 ,0, 8,4,
-6,-12,0,12,6,
-4,-8 ,0, 8,4,
-1,-2 ,0, 2,1};
memcpy(ctrl.mask,mask,HI_IVE_MASK_NUM);
ctrl.out_ctrl = HI_IVE_SOBEL_OUT_CTRL_BOTH;
ret = hi_mpi_ive_sobel(&handle, src, dst_h,dst_v, &ctrl,is_instant);
if(ret == HI_FAILURE)
{
printf("hi_mpi_ive_sobel fail,ret = 0x%x\n",ret);
}
return ret;
}
主程序:
width = 640;
height= 480;
y_size = width*height;
create_img(&img_resize,HI_SVP_IMG_TYPE_U8C1,width,height);
create_img(&img_sobel_h,HI_SVP_IMG_TYPE_S16C1,width,height);
create_img(&img_sobel_v,HI_SVP_IMG_TYPE_S16C1,width,height);
hi_mpi_vpss_get_chn_attr(grp,chn,&chn_attr);
//printf("depth = %d\n",chn_attr.depth);
chn_attr.depth = 1;
hi_mpi_vpss_set_chn_attr(grp,chn,&chn_attr);
//while(!exit)
//{
ret = hi_mpi_vpss_get_chn_frame(grp, chn, &frame_info,milli_sec);
if(ret!=HI_SUCCESS)
{
printf("hi_mpi_vpss_get_chn_frame fail,ret = 0x%x\n",ret);
}
if(catch)
{
video_frame = &frame_info.video_frame;
resize(video_frame,&img_resize,width,height);
sobel(&img_resize,&img_sobel_h,&img_sobel_v);
#if 0
y_addr = img_resize.virt_addr[0];
fp = fopen("test.yuv","w+");
if(fp == NULL)
{
perror("fopen");
}
fwrite(y_addr,y_size,1,fp);
if(fp)
fclose(fp);
#endif
}
hi_mpi_vpss_release_chn_frame(grp, chn, &frame_info);
//}
destroy_img(&img_resize);
destroy_img(&img_sobel_h);
destroy_img(&img_sobel_v);
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
-
2020-05-14 20:10:19
-
2020-05-14 19:01:27
-
2020-05-22 11:08:02
-
2019-04-02 00:06:46
-
2016-12-14 10:37:30
-
2023-04-23 09:54:08
-
242020-08-12 13:59:36
-
2016-07-28 14:41:14
-
2020-07-23 09:09:18
-
2018-12-11 10:12:12
-
2016-07-28 09:29:13
-
2023-08-15 11:11:47
-
2016-08-19 17:28:59
-
2020-05-21 09:50:15
-
2019-07-23 19:11:38
-
2019-11-01 17:45:15
-
2016-11-28 12:14:40
-
2015-02-11 14:46:28
-
2015-03-24 17:39:25
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明