5653
- 收藏
- 点赞
- 分享
- 举报
【已解决】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
-
2016-07-04 10:33:22
-
2018-08-13 14:59:39
-
2016-07-21 14:20:54
-
2018-08-07 08:48:16
-
2014-10-20 10:16:51
-
2021-02-28 17:16:22
-
2019-03-30 09:10:31
-
32017-03-02 19:52:35
-
02017-12-06 11:42:55
-
2017-07-04 21:43:48
-
2016-08-05 11:30:14
-
2019-01-10 14:57:12
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
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板子运行自己编码的程序
-
10求HI3519DV500_SDK_V2.0.1.1
-
5有偿求HI3516DV500 + OV5647驱动
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认