5340
- 收藏
- 点赞
- 分享
- 举报
使用HI_MPI_IVE_CSC()将从HI_MPI_VPSS_GetChnFrame()获得的数据进行颜色空间转换问题
各位前辈,您好。我的流程是这样的,h264->VDEC->Vpss->IVE->NNIE,我使用HI_MPI_VPSS_GetChnFrame()获得图像yuv数据,因为我的模型使用的是rgb的数据,所以我想用HI_MPI_IVE_CSC()进行数据的转化,下面是我的代码:
HI_VOID * SAMPLE_COMM_VPSS_GetPic(HI_VOID *pArgs)
{
VPSS_CHN_ATTR_S *pstVpssChnParam =(VPSS_CHN_ATTR_S *)pArgs;
FILE *fp = HI_NULL;
HI_S32 s32Ret, s32Cnt = 0;
HI_S32 s32MilliSec = 20000;
VPSS_GRP_ATTR_S stVpssGrpAttr;
VPSS_CHN_ATTR_S stVpssChnAttr;
VPSS_GRP VpssGrp;
VIDEO_FRAME_INFO_S stVFrame; //定义视频图像帧信息结构体
HI_CHAR cSaveFile[256];
VpssGrp = 0;
VPSS_CHN VpssChn = VPSS_CHN0; // 0
IVE_HANDLE hIveHandle;
HI_BOOL bInstant = HI_TRUE;
HI_BOOL bFinish = HI_FALSE;
HI_BOOL bBlock = HI_TRUE;
IVE_SRC_DATA_S stSrcData;
IVE_DST_DATA_S stDstData;
IVE_CSC_CTRL_S stCscCtrl;
stCscCtrl.enMode = IVE_CSC_MODE_VIDEO_BT601_YUV2RGB;
s32Ret = HI_MPI_VPSS_GetChnAttr(VpssGrp,VpssChn, &stVpssChnAttr);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("chn %d get chn attr fail for %#x!\n", VpssGrp, s32Ret);
return (HI_VOID *)(HI_FAILURE);
}
while(1)
{
s32Ret = HI_MPI_VPSS_GetChnFrame(VpssGrp, VpssChn, &stVFrame, s32MilliSec);
stSrcData.u64PhyAddr = stVFrame.stVFrame.u64PhyAddr[0];
stSrcData.u32Width = stVFrame.stVFrame.u32Width;
stSrcData.u32Height = stVFrame.stVFrame.u32Height;
stSrcData.u32Stride = stVFrame.stVFrame.u32Stride[0];
stDstData.u64PhyAddr = stVFrame.stVFrame.u64PhyAddr[0];
stDstData.u32Width = stVFrame.stVFrame.u32Width;
stDstData.u32Height = stVFrame.stVFrame.u32Height;
stDstData.u32Stride = stVFrame.stVFrame.u32Stride[0];
s32Ret = HI_MPI_SYS_MmzAlloc_Cached(&stSrcData.u64PhyAddr, &stSrcData.u64VirAddr, "User", HI_NULL, stSrcData.u32Height * stSrcData.u32Stride);
if(HI_SUCCESS != s32Ret)
{
printf("HI_MPI_SYS_MmzAlloc_Cached Failed!");
return s32Ret;
}
memset(stSrcData.u64VirAddr, 1, stSrcData.u32Height * stSrcData.u32Stride);
s32Ret = HI_MPI_SYS_MmzAlloc_Cached(&stDstData.u64PhyAddr, &stDstData.u64VirAddr, "User", HI_NULL, stDstData.u32Height * stDstData.u32Stride);
printf("\n ------------s32Ret=%d ---------------\n", s32Ret);
if(HI_SUCCESS != s32Ret)
{
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
printf("HI_MPI_SYS_MmzAlloc_Cached Failed!");
return s32Ret;
}
printf("\n ----------------HELLO--------------\n");
memset(stDstData.u64VirAddr, 0, stDstData.u32Height * stDstData.u32Stride);
s32Ret = HI_MPI_SYS_MmzFlushCache(0, HI_NULL, 0);
printf("\n ------------s32Ret=%d ---------------\n", s32Ret); //空指针错误
if(HI_SUCCESS != s32Ret)
{
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
HI_MPI_SYS_MmzFree(stDstData.u64PhyAddr, stDstData.u64VirAddr);
return s32Ret;
}
s32Ret = HI_MPI_IVE_CSC(&hIveHandle,&stSrcData,&stDstData,&stCscCtrl,bInstant);
printf("\n ------------s32Ret=%d ---------------\n", s32Ret);
if(HI_SUCCESS != s32Ret)
{
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
HI_MPI_SYS_MmzFree(stDstData.u64PhyAddr, stDstData.u64VirAddr);
return s32Ret;
}
if (HI_TRUE == bInstant)
{
s32Ret = HI_MPI_IVE_Query(hIveHandle,&bFinish,bBlock);
while(HI_ERR_IVE_QUERY_TIMEOUT == s32Ret)
{
usleep(100);
s32Ret = HI_MPI_IVE_Query(hIveHandle,&bFinish,bBlock);
}
}
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
HI_MPI_SYS_MmzFree(stDstData.u64PhyAddr, stDstData.u64VirAddr);
}
return (HI_VOID *)HI_SUCCESS;
}
出现空指针错误,有前辈知道这是什么原因吗?十分感谢!
HI_VOID * SAMPLE_COMM_VPSS_GetPic(HI_VOID *pArgs)
{
VPSS_CHN_ATTR_S *pstVpssChnParam =(VPSS_CHN_ATTR_S *)pArgs;
FILE *fp = HI_NULL;
HI_S32 s32Ret, s32Cnt = 0;
HI_S32 s32MilliSec = 20000;
VPSS_GRP_ATTR_S stVpssGrpAttr;
VPSS_CHN_ATTR_S stVpssChnAttr;
VPSS_GRP VpssGrp;
VIDEO_FRAME_INFO_S stVFrame; //定义视频图像帧信息结构体
HI_CHAR cSaveFile[256];
VpssGrp = 0;
VPSS_CHN VpssChn = VPSS_CHN0; // 0
IVE_HANDLE hIveHandle;
HI_BOOL bInstant = HI_TRUE;
HI_BOOL bFinish = HI_FALSE;
HI_BOOL bBlock = HI_TRUE;
IVE_SRC_DATA_S stSrcData;
IVE_DST_DATA_S stDstData;
IVE_CSC_CTRL_S stCscCtrl;
stCscCtrl.enMode = IVE_CSC_MODE_VIDEO_BT601_YUV2RGB;
s32Ret = HI_MPI_VPSS_GetChnAttr(VpssGrp,VpssChn, &stVpssChnAttr);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("chn %d get chn attr fail for %#x!\n", VpssGrp, s32Ret);
return (HI_VOID *)(HI_FAILURE);
}
while(1)
{
s32Ret = HI_MPI_VPSS_GetChnFrame(VpssGrp, VpssChn, &stVFrame, s32MilliSec);
stSrcData.u64PhyAddr = stVFrame.stVFrame.u64PhyAddr[0];
stSrcData.u32Width = stVFrame.stVFrame.u32Width;
stSrcData.u32Height = stVFrame.stVFrame.u32Height;
stSrcData.u32Stride = stVFrame.stVFrame.u32Stride[0];
stDstData.u64PhyAddr = stVFrame.stVFrame.u64PhyAddr[0];
stDstData.u32Width = stVFrame.stVFrame.u32Width;
stDstData.u32Height = stVFrame.stVFrame.u32Height;
stDstData.u32Stride = stVFrame.stVFrame.u32Stride[0];
s32Ret = HI_MPI_SYS_MmzAlloc_Cached(&stSrcData.u64PhyAddr, &stSrcData.u64VirAddr, "User", HI_NULL, stSrcData.u32Height * stSrcData.u32Stride);
if(HI_SUCCESS != s32Ret)
{
printf("HI_MPI_SYS_MmzAlloc_Cached Failed!");
return s32Ret;
}
memset(stSrcData.u64VirAddr, 1, stSrcData.u32Height * stSrcData.u32Stride);
s32Ret = HI_MPI_SYS_MmzAlloc_Cached(&stDstData.u64PhyAddr, &stDstData.u64VirAddr, "User", HI_NULL, stDstData.u32Height * stDstData.u32Stride);
printf("\n ------------s32Ret=%d ---------------\n", s32Ret);
if(HI_SUCCESS != s32Ret)
{
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
printf("HI_MPI_SYS_MmzAlloc_Cached Failed!");
return s32Ret;
}
printf("\n ----------------HELLO--------------\n");
memset(stDstData.u64VirAddr, 0, stDstData.u32Height * stDstData.u32Stride);
s32Ret = HI_MPI_SYS_MmzFlushCache(0, HI_NULL, 0);
printf("\n ------------s32Ret=%d ---------------\n", s32Ret); //空指针错误
if(HI_SUCCESS != s32Ret)
{
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
HI_MPI_SYS_MmzFree(stDstData.u64PhyAddr, stDstData.u64VirAddr);
return s32Ret;
}
s32Ret = HI_MPI_IVE_CSC(&hIveHandle,&stSrcData,&stDstData,&stCscCtrl,bInstant);
printf("\n ------------s32Ret=%d ---------------\n", s32Ret);
if(HI_SUCCESS != s32Ret)
{
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
HI_MPI_SYS_MmzFree(stDstData.u64PhyAddr, stDstData.u64VirAddr);
return s32Ret;
}
if (HI_TRUE == bInstant)
{
s32Ret = HI_MPI_IVE_Query(hIveHandle,&bFinish,bBlock);
while(HI_ERR_IVE_QUERY_TIMEOUT == s32Ret)
{
usleep(100);
s32Ret = HI_MPI_IVE_Query(hIveHandle,&bFinish,bBlock);
}
}
HI_MPI_SYS_MmzFree(stSrcData.u64PhyAddr, stSrcData.u64VirAddr);
HI_MPI_SYS_MmzFree(stDstData.u64PhyAddr, stDstData.u64VirAddr);
}
return (HI_VOID *)HI_SUCCESS;
}
出现空指针错误,有前辈知道这是什么原因吗?十分感谢!
我来回答
回答17个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
12019-12-06 08:50:11
-
2019-08-23 09:51:16
-
2019-07-08 09:21:28
-
2020-11-26 16:56:05
-
2019-02-17 14:39:02
-
2019-07-12 08:51:24
-
2019-12-16 11:41:34
-
2015-08-06 15:14:57
-
2017-06-07 14:05:59
-
2019-08-02 09:46:16
-
2018-12-30 11:43:59
-
2020-06-17 18:06:35
-
2018-06-08 11:39:10
-
2018-10-30 10:34:27
-
2019-07-03 20:16:52
-
2016-10-29 13:50:41
-
2017-10-16 16:25:15
-
2017-05-10 15:37:55
-
2020-01-09 10:00:23
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
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板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认