5681
- 收藏
- 点赞
- 分享
- 举报
【已解决】Hi3531A相关MPP的使用
本帖最后由 goodman 于 2016-8-10 08:54 编辑
今天想用mpp中的sample_ive_gmm.c样例中的接口SAMPLE_COMM_IVE_CreateImage( )创建图片保存的内存,摄像头采集图片,然后进行中值了滤波,编译调试没问题但是已下载就提示错误:段错误!
HI_S32 SAMPLE_COMM_IVE_CreateImage_1(IVE_IMAGE_S *pstImg,IVE_IMAGE_TYPE_E enType,HI_U16 u16Width,HI_U16 u16Height)
{
HI_U32 u32Size = 0;
HI_S32 s32Ret;
if (NULL == pstImg)
{
SAMPLE_PRT("pstImg is null\n");
return HI_FAILURE;
}
pstImg->enType = enType;
pstImg->u16Width = u16Width;
pstImg->u16Height = u16Height;
pstImg->u16Stride[0] = SAMPLE_COMM_IVE_CalcStride(pstImg->u16Width,IVE_ALIGN);
switch(enType)
{
case IVE_IMAGE_TYPE_U8C1:
case IVE_IMAGE_TYPE_S8C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height+pstImg->u16Stride[0] * pstImg->u16Height/2;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
}
break;
case IVE_IMAGE_TYPE_YUV420SP:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * 3 / 2;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
pstImg->u16Stride[1] = pstImg->u16Stride[0];
pstImg->u32PhyAddr[1] = pstImg->u32PhyAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
pstImg->pu8VirAddr[1] = pstImg->pu8VirAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
}
break;
case IVE_IMAGE_TYPE_YUV422SP:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * 2;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
pstImg->u16Stride[1] = pstImg->u16Stride[0];
pstImg->u32PhyAddr[1] = pstImg->u32PhyAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
pstImg->pu8VirAddr[1] = pstImg->pu8VirAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
}
break;
case IVE_IMAGE_TYPE_YUV420P:
break;
case IVE_IMAGE_TYPE_YUV422P:
break;
case IVE_IMAGE_TYPE_S8C2_PACKAGE:
break;
case IVE_IMAGE_TYPE_S8C2_PLANAR:
break;
case IVE_IMAGE_TYPE_S16C1:
case IVE_IMAGE_TYPE_U16C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * sizeof(HI_U16);
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
}
break;
case IVE_IMAGE_TYPE_U8C3_PACKAGE:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * 3;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
pstImg->pu8VirAddr[1] = pstImg->pu8VirAddr[0] +1;
pstImg->pu8VirAddr[2] = pstImg->pu8VirAddr[1] + 1;
pstImg->u32PhyAddr[1] = pstImg->u32PhyAddr[0] + 1;
pstImg->u32PhyAddr[2] = pstImg->u32PhyAddr[1] + 1;
pstImg->u16Stride[1] = pstImg->u16Stride[0];
pstImg->u16Stride[2] = pstImg->u16Stride[0];
}
break;
case IVE_IMAGE_TYPE_U8C3_PLANAR:
break;
case IVE_IMAGE_TYPE_S32C1:
case IVE_IMAGE_TYPE_U32C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * sizeof(HI_U32);
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
}
break;
case IVE_IMAGE_TYPE_S64C1:
case IVE_IMAGE_TYPE_U64C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * sizeof(HI_U64);
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret); return s32Ret;
}
}
break;
default:
break;
}
return HI_SUCCESS;
}
static HI_S32 SAMPLE_IVE_Image_Init(SAMPLE_IVE_Image_S *pstGmm,HI_U16 u16Width,HI_U16 u16Height)
{
HI_S32 s32Ret = HI_SUCCESS;
memset(pstGmm,0,sizeof(SAMPLE_IVE_Image_S));
s32Ret = SAMPLE_COMM_IVE_CreateImage(&(pstGmm->stSrc),IVE_IMAGE_TYPE_U8C1,u16Width,u16Height);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!= s32Ret, MD_INIT_FAIL, "SAMPLE_COMM_IVE_CreateImage fail\n");
s32Ret = SAMPLE_COMM_IVE_CreateImage(&(pstGmm->stDst),IVE_IMAGE_TYPE_U8C1,u16Width,u16Height);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!= s32Ret, MD_INIT_FAIL, "SAMPLE_COMM_IVE_CreateImage fail\n");
MD_INIT_FAIL:
if(HI_SUCCESS != s32Ret)
{
SAMPLE_IVE_Image_Uninit(pstGmm);
}
return s32Ret;
}
s32Ret = HI_MPI_IVE_DMA(&IveHandle, &stSrcdata, &stDstdata, &stDmaCtrl, bInstant);
SAMPLE_CHECK_EXPR_RET(HI_SUCCESS != s32Ret, s32Ret, "HI_MPI_IVE_DMA fail,Error(%#x)\n",s32Ret);
s32Ret = HI_MPI_IVE_OrdStatFilter(&IveHandle,&pstGmm->stSrc,&pstGmm->stDst,&midFilterCtrl,bInstant);
SAMPLE_CHECK_EXPR_RET(HI_SUCCESS != s32Ret, s32Ret, "HI_MPI_IVE_OrdStatFilter fail,Error(%#x)\n",s32Ret);
今天想用mpp中的sample_ive_gmm.c样例中的接口SAMPLE_COMM_IVE_CreateImage( )创建图片保存的内存,摄像头采集图片,然后进行中值了滤波,编译调试没问题但是已下载就提示错误:段错误!
HI_S32 SAMPLE_COMM_IVE_CreateImage_1(IVE_IMAGE_S *pstImg,IVE_IMAGE_TYPE_E enType,HI_U16 u16Width,HI_U16 u16Height)
{
HI_U32 u32Size = 0;
HI_S32 s32Ret;
if (NULL == pstImg)
{
SAMPLE_PRT("pstImg is null\n");
return HI_FAILURE;
}
pstImg->enType = enType;
pstImg->u16Width = u16Width;
pstImg->u16Height = u16Height;
pstImg->u16Stride[0] = SAMPLE_COMM_IVE_CalcStride(pstImg->u16Width,IVE_ALIGN);
switch(enType)
{
case IVE_IMAGE_TYPE_U8C1:
case IVE_IMAGE_TYPE_S8C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height+pstImg->u16Stride[0] * pstImg->u16Height/2;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
}
break;
case IVE_IMAGE_TYPE_YUV420SP:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * 3 / 2;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
pstImg->u16Stride[1] = pstImg->u16Stride[0];
pstImg->u32PhyAddr[1] = pstImg->u32PhyAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
pstImg->pu8VirAddr[1] = pstImg->pu8VirAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
}
break;
case IVE_IMAGE_TYPE_YUV422SP:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * 2;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
pstImg->u16Stride[1] = pstImg->u16Stride[0];
pstImg->u32PhyAddr[1] = pstImg->u32PhyAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
pstImg->pu8VirAddr[1] = pstImg->pu8VirAddr[0] + pstImg->u16Stride[0] * pstImg->u16Height;
}
break;
case IVE_IMAGE_TYPE_YUV420P:
break;
case IVE_IMAGE_TYPE_YUV422P:
break;
case IVE_IMAGE_TYPE_S8C2_PACKAGE:
break;
case IVE_IMAGE_TYPE_S8C2_PLANAR:
break;
case IVE_IMAGE_TYPE_S16C1:
case IVE_IMAGE_TYPE_U16C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * sizeof(HI_U16);
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
}
break;
case IVE_IMAGE_TYPE_U8C3_PACKAGE:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * 3;
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
pstImg->pu8VirAddr[1] = pstImg->pu8VirAddr[0] +1;
pstImg->pu8VirAddr[2] = pstImg->pu8VirAddr[1] + 1;
pstImg->u32PhyAddr[1] = pstImg->u32PhyAddr[0] + 1;
pstImg->u32PhyAddr[2] = pstImg->u32PhyAddr[1] + 1;
pstImg->u16Stride[1] = pstImg->u16Stride[0];
pstImg->u16Stride[2] = pstImg->u16Stride[0];
}
break;
case IVE_IMAGE_TYPE_U8C3_PLANAR:
break;
case IVE_IMAGE_TYPE_S32C1:
case IVE_IMAGE_TYPE_U32C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * sizeof(HI_U32);
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret);
return s32Ret;
}
}
break;
case IVE_IMAGE_TYPE_S64C1:
case IVE_IMAGE_TYPE_U64C1:
{
u32Size = pstImg->u16Stride[0] * pstImg->u16Height * sizeof(HI_U64);
s32Ret = HI_MPI_SYS_MmzAlloc(&pstImg->u32PhyAddr[0], (void**)&pstImg->pu8VirAddr[0], NULL, HI_NULL, u32Size);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Mmz Alloc fail,Error(%#x)\n",s32Ret); return s32Ret;
}
}
break;
default:
break;
}
return HI_SUCCESS;
}
static HI_S32 SAMPLE_IVE_Image_Init(SAMPLE_IVE_Image_S *pstGmm,HI_U16 u16Width,HI_U16 u16Height)
{
HI_S32 s32Ret = HI_SUCCESS;
memset(pstGmm,0,sizeof(SAMPLE_IVE_Image_S));
s32Ret = SAMPLE_COMM_IVE_CreateImage(&(pstGmm->stSrc),IVE_IMAGE_TYPE_U8C1,u16Width,u16Height);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!= s32Ret, MD_INIT_FAIL, "SAMPLE_COMM_IVE_CreateImage fail\n");
s32Ret = SAMPLE_COMM_IVE_CreateImage(&(pstGmm->stDst),IVE_IMAGE_TYPE_U8C1,u16Width,u16Height);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!= s32Ret, MD_INIT_FAIL, "SAMPLE_COMM_IVE_CreateImage fail\n");
MD_INIT_FAIL:
if(HI_SUCCESS != s32Ret)
{
SAMPLE_IVE_Image_Uninit(pstGmm);
}
return s32Ret;
}
s32Ret = HI_MPI_IVE_DMA(&IveHandle, &stSrcdata, &stDstdata, &stDmaCtrl, bInstant);
SAMPLE_CHECK_EXPR_RET(HI_SUCCESS != s32Ret, s32Ret, "HI_MPI_IVE_DMA fail,Error(%#x)\n",s32Ret);
s32Ret = HI_MPI_IVE_OrdStatFilter(&IveHandle,&pstGmm->stSrc,&pstGmm->stDst,&midFilterCtrl,bInstant);
SAMPLE_CHECK_EXPR_RET(HI_SUCCESS != s32Ret, s32Ret, "HI_MPI_IVE_OrdStatFilter fail,Error(%#x)\n",s32Ret);
我来回答
回答18个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2019-10-15 19:23:01
-
2018-08-21 16:25:45
-
2020-02-27 16:09:08
-
2019-11-05 15:51:14
-
2016-06-28 18:01:47
-
2019-04-23 13:14:35
-
2020-02-18 14:35:12
-
2018-08-13 14:59:39
-
2016-07-21 14:20:54
-
2016-07-04 10:33:22
-
2018-08-07 08:48:16
-
02017-12-06 11:42:55
-
32017-03-02 19:52:35
-
2021-02-28 17:16:22
-
2014-10-20 10:16:51
-
2019-03-30 09:10:31
-
2016-08-05 11:30:14
-
2016-09-19 16:21:33
-
2019-01-10 14:57:12
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5RK3588的DPHY0接lt6911uxe转HDMI抓帧分辨率不对
-
20求rv1106板子的sdk包或者开发板资料
-
10ss928烧录uboot失败
-
10求助,3588调试imx586和ov50c40时,按照瑞芯微的单摄8k配置好设备树后,驱动配置的8k分辨率的,但是只能抓到4k的图,且颜色偏粉
-
50帮忙解决个交叉编译的问题
-
20帮忙交叉编译个源码
-
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
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认