11079
- 收藏
- 点赞
- 分享
- 举报
设置了depth以及用户模式,但是HI_MPI_VPSS_GetChnFrame获取到的数据为空
目前的方式,直接读取VI的数据,然后交给vpss处理之后得到缩放后的yuv数据,但是不管怎么样修改
HI_MPI_VPSS_GetChnFrame获取到的数据为空。看了论坛的相关的帖子,已经设置了depth,但是还是读取不到数据,麻烦
哪位帮忙看一下吧,谢谢:handshake
PS:HI_MPI_VI_GetFrame获取数据是ok的,HI_MPI_VPSS_SendFrame发送数据也没有报错。
int main()
{
VPSS_GRP_ATTR_S stGrpVpssAttr = {0};
VPSS_CHN_ATTR_S stChnAttr = {0};
VIDEO_FRAME_INFO_S stFrame;
HI_S32 s32Ret;
VPSS_CHN_MODE_S stVpssMode;
HI_S32 u32Depth = 2;
VPSS_GRP VpssGrp = 0;
VPSS_CHN VpssChn = 3;
VB_CONF_S stVbConf;
VB_BLK VbBlk = VB_INVALID_HANDLE;
VB_POOL hPool = VB_INVALID_POOLID;
int new_width = 1280;
int new_height = 720;
HI_U32 u32Size = new_width * new_height * 3 / 2;
PIC_SIZE_E enSize = PIC_UHD4K;
HI_U32 u32BlkSize;
VIDEO_NORM_E gs_enNorm = VIDEO_ENCODING_MODE_NTSC;
SAMPLE_VI_CONFIG_S stViConfig = {0};
VI_CHN ViChn = 0;
HI_U32 u32OldDepth = 8;
memset(&stVbConf,0,sizeof(VB_CONF_S));
SAMPLE_COMM_VI_GetSizeBySensor(&enSize);
stVbConf.u32MaxPoolCnt = 16;
u32BlkSize = SAMPLE_COMM_SYS_CalcPicVbBlkSize(gs_enNorm, enSize, PIXEL_FORMAT_YUV_SEMIPLANAR_422, SAMPLE_SYS_ALIGN_WIDTH);
stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[0].u32BlkCnt = 8;
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("system init failed with %d!\n", s32Ret);
}
stViConfig.enViMode = SENSOR_TYPE;
stViConfig.enRotate = ROTATE_NONE;
stViConfig.enNorm = VIDEO_ENCODING_MODE_AUTO;
stViConfig.enViChnSet = VI_CHN_SET_NORMAL;
stViConfig.enWDRMode = WDR_MODE_NONE;
s32Ret = SAMPLE_COMM_VI_StartVi(&stViConfig);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start vi failed!\n");
}
s32Ret = HI_MPI_VI_GetFrameDepth(ViChn,&u32OldDepth);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Err00000000000, s32Ret:0x%x\n",s32Ret);
}
s32Ret = HI_MPI_VI_SetFrameDepth(ViChn, u32Depth);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Err11111111111111, s32Ret:0x%x\n",s32Ret);
}
stGrpVpssAttr.u32MaxW = 3840;
stGrpVpssAttr.u32MaxH = 2160;
stGrpVpssAttr.bIeEn = HI_FALSE;
stGrpVpssAttr.bDciEn = HI_FALSE;
stGrpVpssAttr.bNrEn = HI_TRUE;
stGrpVpssAttr.bHistEn = HI_FALSE;
stGrpVpssAttr.enDieMode = VPSS_DIE_MODE_NODIE;
stGrpVpssAttr.stNrAttr.enNrType = VPSS_NR_TYPE_VIDEO;
stGrpVpssAttr.stNrAttr.stNrVideoAttr.enNrRefSource = VPSS_NR_REF_FROM_RFR;
stGrpVpssAttr.stNrAttr.u32RefFrameNum = 2;
stGrpVpssAttr.bStitchBlendEn = HI_FALSE;
stGrpVpssAttr.enPixFmt = PIXEL_FORMAT_YUV_SEMIPLANAR_422;
s32Ret = HI_MPI_VPSS_CreateGrp(VpssGrp, &stGrpVpssAttr);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_CreateGrp failed with %#x!\n", s32Ret);
goto END;
}
s32Ret = HI_MPI_VPSS_StartGrp(VpssGrp);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_StartGrp failed with %#x\n", s32Ret);
goto END;
}
s32Ret = VI_BindVpss(ViChn, VpssGrp, VpssChn);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("VI_BindVpss, failed :0x%x\n",s32Ret);
goto END;
}
#if 0
s32Ret = HI_MPI_VPSS_GetGrpAttr(VpssGrp, &stGrpVpssAttr);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_GetGrpAttr failed with %#x!\n", s32Ret);
goto END;
}
stGrpVpssAttr.bIeEn = HI_FALSE;
stGrpVpssAttr.bNrEn = HI_FALSE;
s32Ret = HI_MPI_VPSS_SetGrpAttr(VpssGrp, &stGrpVpssAttr);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_SetGrpAttr failed with %#x!\n", s32Ret);
goto END;
}
#endif
#if 0
s32Ret = HI_MPI_VPSS_GetChnAttr(VpssGrp, VpssChn, &stChnAttr);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_GetChnAttr failed with %#x!\n", s32Ret);
goto END;
}
#endif
memset(&stChnAttr, 0, sizeof(stChnAttr));
stChnAttr.s32SrcFrameRate = -1;
stChnAttr.s32DstFrameRate = -1;
s32Ret = HI_MPI_VPSS_SetChnAttr(VpssGrp, VpssChn, &stChnAttr);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_SetChnAttr failed with %#x!\n", s32Ret);
goto END;
}
#if 0
s32Ret = HI_MPI_VPSS_GetChnMode(VpssGrp, VpssChn, &stVpssMode);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_GetChnMode failed with %#x!\n", s32Ret);
goto END;
}
#endif
stVpssMode.enChnMode = VPSS_CHN_MODE_USER;
stVpssMode.bDouble = HI_FALSE;
stVpssMode.enPixelFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_422;
stVpssMode.u32Width = new_width;
stVpssMode.u32Height = new_height;
s32Ret = HI_MPI_VPSS_SetChnMode(VpssGrp, VpssChn, &stVpssMode);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_SetChnMode failed with %#x!\n", s32Ret);
goto END;
}
s32Ret = HI_MPI_VPSS_EnableChn(VpssGrp, VpssChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_SetChnMode failed with %#x!\n", s32Ret);
goto END;
}
#if 1
s32Ret = HI_MPI_VPSS_SetDepth(VpssGrp, VpssChn, u32Depth);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_SetDepth failed with %#x!\n", s32Ret);
goto END;
}
#endif
/*create comm vb pool*/
hPool = HI_MPI_VB_CreatePool(u32Size, 5 , NULL);
if (hPool == VB_INVALID_POOLID)
{
SAMPLE_PRT("HI_MPI_VB_CreatePool failed! \n");
goto END;
}
int count = 0;
while(1)
{
VIDEO_FRAME_INFO_S stExtFrmInfo;
count++;
s32Ret = HI_MPI_VI_GetFrame(ViChn, &stFrame, 100);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VI_GetFrame, failed :0x%x\n",s32Ret);
goto END;
}
s32Ret = HI_MPI_VPSS_SendFrame(VpssGrp, &stFrame /*&stDstframe*/, 100);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VPSS_SendFrame faild with%#x! \n", s32Ret);
goto END;
}
#if 1
memset(&stExtFrmInfo, 0, sizeof(stExtFrmInfo));
stExtFrmInfo.u32PoolId = VB_INVALID_POOLID;
s32Ret = HI_MPI_VPSS_GetChnFrame(VpssGrp, VpssChn, &stExtFrmInfo, 100);
if (s32Ret == HI_SUCCESS)
{
HI_MPI_VPSS_ReleaseChnFrame(VpssGrp, VpssChn, &stExtFrmInfo);
printf("success !!!!!!!!!!!!!!!!!!! \n");
}
else
{
SAMPLE_PRT("HI_MPI_VPSS_GetChnFrame failed with %#x\n", s32Ret);
//goto END;
}
#endif
s32Ret = HI_MPI_VI_ReleaseFrame(ViChn, &stFrame);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Info:HI_MPI_VB_ReleaseBlock fail, s32Ret:0x%x\n",s32Ret );
goto END;
}
if (count >= 50)
break;
}
END:
SAMPLE_COMM_VI_StopVi(&stViConfig);
if (VB_INVALID_POOLID != hPool)
{
HI_MPI_VB_DestroyPool( hPool );
hPool = VB_INVALID_POOLID;
}
s32Ret = VI_UnBindVpss(ViChn, VpssGrp, VpssChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("VI_UnBindVpss failed with %#x\n", s32Ret);
}
s32Ret = HI_MPI_VPSS_DisableChn(VpssGrp, VpssChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_DisableChn failed with %#x\n", s32Ret);
}
s32Ret = HI_MPI_VPSS_StopGrp(VpssGrp);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_StopGrp failed with %#x\n", s32Ret);
}
s32Ret = HI_MPI_VPSS_DisableChn(VpssGrp, VpssChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_DisableChn failed with %#x!\n", s32Ret);
}
s32Ret = HI_MPI_VPSS_DestroyGrp(VpssGrp);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VPSS_DestroyGrp failed with %#x!\n", s32Ret);
}
SAMPLE_COMM_SYS_Exit();
printf("\n\n\nfinished !!!! \n\n");
return 0;
}
我来回答
回答14个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2018-10-30 10:34:27
-
2019-12-16 11:41:34
-
2019-07-08 09:21:28
-
2020-04-17 16:08:21
-
2016-10-29 13:50:41
-
2019-07-03 20:16:52
-
2017-10-16 16:25:15
-
2019-09-05 13:48:28
-
2017-06-07 14:05:59
-
2020-06-17 18:06:35
-
2019-10-15 16:34:29
-
2019-08-02 09:46:16
-
2018-12-28 18:49:26
-
2019-12-20 12:02:51
-
2016-10-26 10:33:50
-
2019-07-11 13:52:03
-
2018-12-30 11:43:59
-
2020-01-09 10:00:23
-
2022-06-02 14:21:14
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认