3246
- 收藏
- 点赞
- 分享
- 举报
海思3559AV100 插入用户图片HI_MPI_VI_SetUserPic报错0xa0108003
在调试海思3559AV100,VI,VPSS工作在离线模式,当没有视频源输入时,插入一张显示没有输入的yuv420p用户图片,代码如下,在调用HI_MPI_VI_SetUserPic()时报错误码0xa0108003(视频输入参数设置无效),应该是这个结构体VI_USERPIC_ATTR配置错了,有经验的帮忙看下,我哪里配置错了,该怎么改?
HI_S32 insert_usr_pic(SAMPLE_VI_CONFIG_S* pstViConfig)
{
HI_S32 s32Ret = HI_SUCCESS;
HI_S32 i, j;
HI_S32 s32ViNum;
SAMPLE_SNS_TYPE_E enSnsType;
SAMPLE_VI_INFO_S *pstViInfo = HI_NULL;
VI_USERPIC_ATTR_S *pstVFrameInfo;
HI_U32 u32LStride = 0;
HI_U32 u32CStride = 0;
HI_U32 u32LumaSize = 0;
HI_U32 u32ChrmSize = 0;
HI_U32 u32Size = 0;
VB_BLK VbBlk;
HI_U64 u64PhyAddr;
HI_VOID *ppVirAddr;
HI_U8 *p, *puv, *pu, *pv;
FILE *fpic = NULL;
HI_U32 u32Width = 1280;
HI_U32 u32Height = 720;
VI_PIPE_FRAME_SOURCE_E penSource;
s32ViNum = pstViConfig->as32WorkingViId[0];
pstViInfo = &pstViConfig->astViInfo[s32ViNum];
enSnsType = pstViInfo->stSnsInfo.enSnsType;
pstVFrameInfo = (VI_USERPIC_ATTR_S*)calloc(1, sizeof(VI_USERPIC_ATTR_S));
if (SAMPLE_SNS_TYPE_BUTT == enSnsType)
{
u32LStride = (u32Width + 15) & ( ~(15) );
u32LumaSize = (u32LStride * u32Height);
u32ChrmSize = (u32CStride * u32Height) >> 2;/* 420*/
u32Size = u32LumaSize + (u32ChrmSize << 1);
/* get video buffer block form common pool */
VbBlk = HI_MPI_VB_GetBlock(VB_INVALID_POOLID, u32Size, NULL);
if (VB_INVALID_HANDLE == VbBlk)
{
SAMPLE_PRT("get YUV vb block failed\n");
return HI_FAILURE;
}
/* get physical address*/
u64PhyAddr = HI_MPI_VB_Handle2PhysAddr(VbBlk);
if (0 == u64PhyAddr)
{
SAMPLE_PRT("get YUV vb block phy addr failed\n");
return HI_FAILURE;
}
SAMPLE_PRT("u64PhyAddr: %#x\n", u64PhyAddr);
/* get pool id */
pstVFrameInfo->unUsrPic.stUsrPicFrm.u32PoolId = HI_MPI_VB_Handle2PoolId(VbBlk);
if (VB_INVALID_POOLID == pstVFrameInfo->unUsrPic.stUsrPicFrm.u32PoolId)
{
SAMPLE_PRT("get YUV vb pool id failed\n");
return HI_FAILURE;
}
SAMPLE_PRT("u32PoolId: %d\n", pstVFrameInfo->unUsrPic.stUsrPicFrm.u32PoolId);
/* mmap physical address to virtual address*/
s32Ret = HI_MPI_VB_MmapPool(pstVFrameInfo->unUsrPic.stUsrPicFrm.u32PoolId);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("get YUV vb pool id failed with: 0x%x\n", s32Ret);
return HI_FAILURE;
}
s32Ret = HI_MPI_VB_GetBlockVirAddr(pstVFrameInfo->unUsrPic.stUsrPicFrm.u32PoolId, u64PhyAddr, (void **)&ppVirAddr);
if(s32Ret != HI_SUCCESS)
{
HI_MPI_VB_ReleaseBlock(VbBlk);
HI_MPI_VB_MunmapPool(pstVFrameInfo->unUsrPic.stUsrPicFrm.u32PoolId);
SAMPLE_PRT("HI_MPI_VB_GetBlkVirAddr failed with: %#x", s32Ret);
return HI_FAILURE;
}
//SAMPLE_PRT("ppVirAddr: %#x", ppVirAddr);
/* now you need get YUV Semi Palnar Data ,fill them to the virtual address */
puv = malloc(u32Size);
if(puv == NULL)
{
SAMPLE_PRT("pyuv malloc failed");
return HI_FAILURE;
}
p = ppVirAddr;
fpic = fopen(pUserpicName,"rb");
if (fpic == NULL)
{
SAMPLE_PRT("can't open file %s", pUserpicName);
return HI_FAILURE;
}
/* read the data of Y component*/
fread(p, 1, u32Height * u32LStride, fpic);
/* read the data of UV component*/
fread(puv, 1, (u32Height * u32LStride) >> 1, fpic);
pu = puv;
pv = puv + ((u32Height * u32LStride) >> 2);
p = ppVirAddr + (u32Height * u32LStride);
for (i = 0; i < (u32Height >> 1); i++)
{
for (j=0; j<(u32Width >> 1); j++)
{
p[j*2+1] = pu[j];
p[j*2+0] = pv[j];
}
pu += u32LStride >> 1; //u32YStride
pv += u32LStride >> 1;
p += u32LStride;
}
free(puv);
puv = HI_NULL;
fclose(fpic);
pstVFrameInfo->enUsrPicMode = VI_USERPIC_MODE_PIC;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64PhyAddr[0] = u64PhyAddr;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64PhyAddr[1] = pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64PhyAddr[0] + u32LumaSize;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64PhyAddr[2] = pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64PhyAddr[1] + u32ChrmSize;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64VirAddr[0] = ppVirAddr;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64VirAddr[1] = pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64VirAddr[0] + u32LumaSize;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64VirAddr[2] = pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u64VirAddr[1] + u32ChrmSize;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u32Width = u32Width;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u32Height = u32Height;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u32Stride[0] = u32LStride;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u32Stride[1] = u32LStride;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.u32Stride[2] = u32LStride;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.enCompressMode = COMPRESS_MODE_NONE;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.enVideoFormat = VIDEO_FORMAT_LINEAR;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.enField = VIDEO_FIELD_FRAME;
pstVFrameInfo->unUsrPic.stUsrPicFrm.stVFrame.enPixelFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
HI_MPI_VI_GetPipeFrameSource(0, &penSource);
SAMPLE_PRT("PIPE_FRAME_SOURCE: %d\n", penSource);
s32Ret = HI_MPI_VI_SetPipeFrameSource(0, VI_PIPE_FRAME_SOURCE_DEV);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VI_SetPipeFrameSource failed with: 0x%x\n", s32Ret);
return HI_FAILURE;
}
/* first set user pic info*/
s32Ret = HI_MPI_VI_SetUserPic(0, pstVFrameInfo);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VI_SetUserPic failed with: 0x%x\n", s32Ret);
return HI_FAILURE;
}
/* enable insert user pic if you need */
s32Ret = HI_MPI_VI_EnableUserPic(0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VI_EnableUserPic failed with: 0x%x\n", s32Ret);
return HI_FAILURE;
}
}
else
{
/* disable insert user pic if you don't need */
s32Ret = HI_MPI_VI_DisableUserPic(0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VI_DisableUserPic failed with: 0x%x\n", s32Ret);
return HI_FAILURE;
}
}
return s32Ret;
}
我来回答
回答8个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2019-12-10 15:49:18
-
2020-04-09 16:32:52
-
2021-11-15 15:24:45
-
2018-01-31 11:02:26
-
2017-08-16 18:01:45
-
2017-05-09 16:20:33
-
2019-01-12 16:19:57
-
2017-05-15 16:56:50
-
182019-08-16 12:23:06
-
2020-09-10 11:45:00
-
2023-11-10 11:30:18
-
2020-04-01 16:35:54
-
2018-06-08 19:18:57
-
2020-07-20 15:39:04
-
2023-11-28 09:29:40
-
2018-07-17 18:05:35
-
2018-05-11 19:02:40
-
2019-09-12 11:10:24
-
2019-10-31 19:08:21
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认