4260
- 收藏
- 点赞
- 分享
- 举报
Hi3516 移动侦测
使用的hi3516,关于移动侦测,在rtmp里添加了海思sample_ive_md.c里的部分代码,实现了移动侦测的功能,能正常侦测并且可对移动区域显示矩形直线,但是在添加之前,录像生产的h264文件用vlc播放正常,但是添加了之后,h264文件播放就像点了快进一样,而且h264文件大小也缩小了很多。
pthread_create(&s_hMdThread, 0, SAMPLE_IVE_MdProc, (HI_VOID *)&s_stMd);
HI_VOID * SAMPLE_IVE_MdProc(HI_VOID * pArgs)
{
...
while (HI_FALSE == s_bStopSignal)
{
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[1], &stExtFrmInfo, s32MilliSec);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[1], s32Ret);
continue;
}
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[0], &stBaseFrmInfo, s32MilliSec);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!=s32Ret, EXT_RELEASE,
"HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[0], s32Ret);
if (HI_TRUE != bFirstFrm)
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
}
else
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[1 - s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
bFirstFrm = HI_FALSE;
goto CHANGE_IDX;//first frame just init reference frame
}
s32Ret = HI_IVS_MD_Process(MdChn,&pstMd->astImg[s32CurIdx],&pstMd->astImg[1 - s32CurIdx],&stSad,&pstMd->stBlob);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"HI_IVS_MD_Process fail,Error(%#x)\n",s32Ret);
SAMPLE_COMM_IVE_BlobToRect((IVE_CCBLOB_S *)pstMd->stBlob.pu8VirAddr,&(pstMd->stRegion),50,8,
pstMdAttr->u16Width,pstMdAttr->u16Height,(HI_U16)stBaseFrmInfo.stVFrame.u32Width,(HI_U16)stBaseFrmInfo.stVFrame.u32Height); //将移动侦测的数据处理为移动区域rect
//Draw rect
s32Ret = SAMPLE_COMM_VGS_FillRect(&stBaseFrmInfo, &pstMd->stRegion, 0x0000FF00);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_VGS_FillRect fail,Error(%#x)\n",s32Ret);
}
}
我尝试把SAMPLE_COMM_VGS_FillRect这句注释掉,录像恢复正常,只是不能显示矩形直线框了,请问是什么原因呢?按照现象来说是这个接口导致了h264录像播放速度变得很快,而且h264文件变得很小,我怀疑可能是导致丢帧了。
还请路过的大神不吝赐教。
SAMPLE_COMM_VGS_FillRect该接口的实现如下:
HI_S32 SAMPLE_COMM_VGS_FillRect(VIDEO_FRAME_INFO_S* pstFrmInfo, SAMPLE_RECT_ARRAY_S* pstRect, HI_U32 u32Color)
{
VGS_HANDLE VgsHandle = -1;
HI_S32 s32Ret = HI_SUCCESS;
HI_U16 i;
VGS_TASK_ATTR_S stVgsTask;
VGS_ADD_COVER_S stVgsAddCover;
if (0 == pstRect->u16Num)
{
return s32Ret;
}
s32Ret = HI_MPI_VGS_BeginJob(&VgsHandle);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Vgs begin job fail,Error(%#x)\n", s32Ret);
return s32Ret;
}
memcpy(&stVgsTask.stImgIn, pstFrmInfo, sizeof(VIDEO_FRAME_INFO_S));
memcpy(&stVgsTask.stImgOut, pstFrmInfo, sizeof(VIDEO_FRAME_INFO_S));
stVgsAddCover.enCoverType = COVER_QUAD_RANGLE;
stVgsAddCover.u32Color = u32Color;
for (i = 0; i < pstRect->u16Num; i++)
{
stVgsAddCover.stQuadRangle.bSolid = HI_FALSE;
stVgsAddCover.stQuadRangle.u32Thick = 2;
memcpy(stVgsAddCover.stQuadRangle.stPoint, pstRect->astRect.astPoint, sizeof(pstRect->astRect.astPoint));
s32Ret = HI_MPI_VGS_AddCoverTask(VgsHandle, &stVgsTask, &stVgsAddCover);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VGS_AddCoverTask fail,Error(%#x)\n", s32Ret);
HI_MPI_VGS_CancelJob(VgsHandle);
return s32Ret;
}
}
s32Ret = HI_MPI_VGS_EndJob(VgsHandle);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VGS_EndJob fail,Error(%#x)\n", s32Ret);
HI_MPI_VGS_CancelJob(VgsHandle);
return s32Ret;
}
return s32Ret;
}
pthread_create(&s_hMdThread, 0, SAMPLE_IVE_MdProc, (HI_VOID *)&s_stMd);
HI_VOID * SAMPLE_IVE_MdProc(HI_VOID * pArgs)
{
...
while (HI_FALSE == s_bStopSignal)
{
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[1], &stExtFrmInfo, s32MilliSec);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[1], s32Ret);
continue;
}
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[0], &stBaseFrmInfo, s32MilliSec);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!=s32Ret, EXT_RELEASE,
"HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[0], s32Ret);
if (HI_TRUE != bFirstFrm)
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
}
else
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[1 - s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
bFirstFrm = HI_FALSE;
goto CHANGE_IDX;//first frame just init reference frame
}
s32Ret = HI_IVS_MD_Process(MdChn,&pstMd->astImg[s32CurIdx],&pstMd->astImg[1 - s32CurIdx],&stSad,&pstMd->stBlob);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"HI_IVS_MD_Process fail,Error(%#x)\n",s32Ret);
SAMPLE_COMM_IVE_BlobToRect((IVE_CCBLOB_S *)pstMd->stBlob.pu8VirAddr,&(pstMd->stRegion),50,8,
pstMdAttr->u16Width,pstMdAttr->u16Height,(HI_U16)stBaseFrmInfo.stVFrame.u32Width,(HI_U16)stBaseFrmInfo.stVFrame.u32Height); //将移动侦测的数据处理为移动区域rect
//Draw rect
s32Ret = SAMPLE_COMM_VGS_FillRect(&stBaseFrmInfo, &pstMd->stRegion, 0x0000FF00);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_VGS_FillRect fail,Error(%#x)\n",s32Ret);
}
}
我尝试把SAMPLE_COMM_VGS_FillRect这句注释掉,录像恢复正常,只是不能显示矩形直线框了,请问是什么原因呢?按照现象来说是这个接口导致了h264录像播放速度变得很快,而且h264文件变得很小,我怀疑可能是导致丢帧了。
还请路过的大神不吝赐教。
SAMPLE_COMM_VGS_FillRect该接口的实现如下:
HI_S32 SAMPLE_COMM_VGS_FillRect(VIDEO_FRAME_INFO_S* pstFrmInfo, SAMPLE_RECT_ARRAY_S* pstRect, HI_U32 u32Color)
{
VGS_HANDLE VgsHandle = -1;
HI_S32 s32Ret = HI_SUCCESS;
HI_U16 i;
VGS_TASK_ATTR_S stVgsTask;
VGS_ADD_COVER_S stVgsAddCover;
if (0 == pstRect->u16Num)
{
return s32Ret;
}
s32Ret = HI_MPI_VGS_BeginJob(&VgsHandle);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("Vgs begin job fail,Error(%#x)\n", s32Ret);
return s32Ret;
}
memcpy(&stVgsTask.stImgIn, pstFrmInfo, sizeof(VIDEO_FRAME_INFO_S));
memcpy(&stVgsTask.stImgOut, pstFrmInfo, sizeof(VIDEO_FRAME_INFO_S));
stVgsAddCover.enCoverType = COVER_QUAD_RANGLE;
stVgsAddCover.u32Color = u32Color;
for (i = 0; i < pstRect->u16Num; i++)
{
stVgsAddCover.stQuadRangle.bSolid = HI_FALSE;
stVgsAddCover.stQuadRangle.u32Thick = 2;
memcpy(stVgsAddCover.stQuadRangle.stPoint, pstRect->astRect.astPoint, sizeof(pstRect->astRect.astPoint));
s32Ret = HI_MPI_VGS_AddCoverTask(VgsHandle, &stVgsTask, &stVgsAddCover);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VGS_AddCoverTask fail,Error(%#x)\n", s32Ret);
HI_MPI_VGS_CancelJob(VgsHandle);
return s32Ret;
}
}
s32Ret = HI_MPI_VGS_EndJob(VgsHandle);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VGS_EndJob fail,Error(%#x)\n", s32Ret);
HI_MPI_VGS_CancelJob(VgsHandle);
return s32Ret;
}
return s32Ret;
}
我来回答
回答10个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2019-05-22 09:47:35
-
102019-05-22 09:55:10
-
2019-06-26 11:27:46
-
02018-12-30 19:22:56
-
32016-05-05 14:11:19
-
2016-12-09 15:51:55
-
2017-06-28 23:14:18
-
2016-12-16 11:33:50
-
2016-11-28 12:14:40
-
2014-12-26 22:08:26
-
2016-06-03 09:33:41
-
2022-05-26 15:57:39
-
2016-11-04 18:42:03
-
2021-03-02 21:17:31
-
2017-08-11 12:21:31
-
2017-06-29 14:30:34
-
2020-06-03 15:44:54
-
2017-06-29 14:29:35
-
2020-10-30 08:25:00
-
2022-06-09 10:17:47
更多相似问答
点击登录
-- 积分
-- 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币)
取消
确认