9033
- 收藏
- 点赞
- 分享
- 举报
昨晚跑了3520D的sample_vio程序,遇到几个困惑点,跟大家探讨下
先上代码:
HI_S32 SAMPLE_VIO_4_D1(HI_VOID)
{
SAMPLE_VI_MODE_E enViMode = SAMPLE_VI_MODE_4_D1;
HI_U32 u32ViChnCnt = 4;
HI_S32 s32VpssGrpCnt = 4;
VB_CONF_S stVbConf;
VI_CHN ViChn;
VPSS_GRP VpssGrp;
VPSS_GRP_ATTR_S stGrpAttr;
VPSS_CHN VpssChn_VoHD0 = VPSS_PRE0_CHN;
VO_DEV VoDev;
VO_CHN VoChn;
VO_PUB_ATTR_S stVoPubAttr,stVoPubAttrSD;
SAMPLE_VO_MODE_E enVoMode, enPreVoMode;
HI_S32 i;
HI_S32 s32Ret = HI_SUCCESS;
HI_U32 u32BlkSize;
HI_CHAR ch;
SIZE_S stSize;
HI_U32 u32WndNum;
VO_WBC_ATTR_S stWbcAttr;
/******************************************
step 1: init variable
******************************************/
gs_u32ViFrmRate = (VIDEO_ENCODING_MODE_PAL== gs_enNorm)?25:30;
memset(&stVbConf,0,sizeof(VB_CONF_S));
u32BlkSize = SAMPLE_COMM_SYS_CalcPicVbBlkSize(gs_enNorm,\
PIC_D1, SAMPLE_PIXEL_FORMAT, SAMPLE_SYS_ALIGN_WIDTH);
stVbConf.u32MaxPoolCnt = 128;
/* video buffer*/
//todo: vb=15
stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[0].u32BlkCnt = u32ViChnCnt * 8;
/******************************************
step 2: mpp system init.
******************************************/
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("system init failed with %d!\n", s32Ret);
goto END_8D1_0;
}
/******************************************
step 3: start vi dev & chn
******************************************/
s32Ret = SAMPLE_COMM_VI_Start(enViMode, gs_enNorm);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start vi failed!\n");
goto END_8D1_0;
}
/******************************************
step 4: start vpss and vi bind vpss
******************************************/
s32Ret = SAMPLE_COMM_SYS_GetPicSize(gs_enNorm, PIC_D1, &stSize);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_SYS_GetPicSize failed!\n");
goto END_8D1_0;
}
stGrpAttr.u32MaxW = stSize.u32Width;
stGrpAttr.u32MaxH = stSize.u32Height;
stGrpAttr.bDrEn = HI_FALSE;
stGrpAttr.bDbEn = HI_FALSE;
stGrpAttr.bIeEn = HI_TRUE;
stGrpAttr.bNrEn = HI_TRUE;
stGrpAttr.bHistEn = HI_FALSE;
stGrpAttr.enDieMode = VPSS_DIE_MODE_AUTO;
stGrpAttr.enPixFmt = SAMPLE_PIXEL_FORMAT;
s32Ret = SAMPLE_COMM_VPSS_Start(s32VpssGrpCnt, &stSize, VPSS_MAX_CHN_NUM,NULL);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Vpss failed!\n");
goto END_8D1_1;
}
s32Ret = SAMPLE_COMM_VI_BindVpss(enViMode);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Vi bind Vpss failed!\n");
goto END_8D1_2;
}
/******************************************
step 6: start vo HD0 (HDMI+VGA), multi-screen, you can switch mode
******************************************/
printf("start vo HD0.\n");
//HI3520D¸高清输出设备只有一个DHD0
VoDev = SAMPLE_VO_DEV_DHD0;
u32WndNum = 4;
enVoMode = VO_MODE_4MUX;
if(VIDEO_ENCODING_MODE_PAL == gs_enNorm)
{
stVoPubAttr.enIntfSync = VO_OUTPUT_1024x768_60;
}
else
{
stVoPubAttr.enIntfSync = VO_OUTPUT_1024x768_60;
}
//HI_FPGA 未定义
#ifdef HI_FPGA
stVoPubAttr.enIntfType = VO_INTF_HDMI|VO_INTF_VGA|VO_INTF_BT1120;
#else
stVoPubAttr.enIntfType = VO_INTF_HDMI|VO_INTF_VGA;
#endif
stVoPubAttr.u32BgColor = 0x000000ff;
stVoPubAttr.bDoubleFrame = HI_TRUE;
s32Ret = SAMPLE_COMM_VO_StartDevLayer(VoDev, &stVoPubAttr, gs_u32ViFrmRate);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_StartDevLayer failed!\n");
goto END_8D1_4;
}
//启动每个指定的视频输出通道VoDev=SAMPLE_VO_DEV_DHD0
s32Ret = SAMPLE_COMM_VO_StartChn(VoDev, &stVoPubAttr, enVoMode);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_StartChn failed!\n");
goto END_8D1_5;
}
/* if it's displayed on HDMI, we should start HDMI */
if (stVoPubAttr.enIntfType & VO_INTF_HDMI)
{
if (HI_SUCCESS != SAMPLE_COMM_VO_HdmiStart(stVoPubAttr.enIntfSync))
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_HdmiStart failed!\n");
goto END_8D1_5;
}
}
for(i=0;i
{
VoChn = i;
VpssGrp = i;
s32Ret = SAMPLE_COMM_VO_BindVpss(VoDev,VoChn,VpssGrp,VpssChn_VoHD0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start VO failed!\n");
goto END_8D1_5;
}
}
#if 1
/******************************************
step 7: start vo SD0 (CVBS) (WBC target)
******************************************/
printf("start vo SD0: wbc from hd0\n");
VoDev = SAMPLE_VO_DEV_DSD1;//这里如果使用SAMPLE_VO_DEV_DSD0不行,CVBS无视频输出
u32WndNum = 1;
enVoMode = VO_MODE_1MUX;
stVoPubAttrSD.enIntfSync = VO_OUTPUT_PAL;
stVoPubAttrSD.enIntfType = VO_INTF_CVBS;
stVoPubAttrSD.u32BgColor = 0x000000ff;
stVoPubAttrSD.bDoubleFrame = HI_FALSE;
s32Ret = SAMPLE_COMM_VO_StartDevLayer(VoDev, &stVoPubAttrSD, gs_u32ViFrmRate);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartDevLayer failed!\n");
goto END_8D1_5;
}
///启动输出设备VoDev(SAMPLE_VO_DEV_DSD1) 的所有通道
//因为enVoMode==VO_MODE_1MUX,实际只启动一个输出通道(通道0)
s32Ret = SAMPLE_COMM_VO_StartChn(VoDev, &stVoPubAttrSD, enVoMode);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartChn failed!\n");
goto END_8D1_6;
}
s32Ret = SAMPLE_COMM_VO_GetWH(VO_OUTPUT_PAL, \
&stWbcAttr.stTargetSize.u32Width, \
&stWbcAttr.stTargetSize.u32Height, \
&stWbcAttr.u32FrameRate);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_GetWH failed!\n");
goto END_8D1_6;
}
stWbcAttr.enPixelFormat = SAMPLE_PIXEL_FORMAT;
stWbcAttr.enDataSource = VO_WBC_DATASOURCE_MIXER;
/*
对高清输出设备SAMPLE_VO_DEV_DHD0 进行视频回写,设置回写参数
*/
s32Ret = HI_MPI_VO_SetWbcAttr(SAMPLE_VO_DEV_DHD0, &stWbcAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VO_SetWbcAttr failed!\n");
goto END_8D1_6;
}
s32Ret = HI_MPI_VO_EnableWbc(SAMPLE_VO_DEV_DHD0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VO_SetWbcAttr failed!\n");
goto END_8D1_7;
}
///以高清输出设备SAMPLE_VO_DEV_DHD0的通道0作为视频源
///标清输出设备VoDev(SAMPLE_VO_DEV_DSD1)的通道0作为目标进行视频回写
s32Ret = SAMPLE_COMM_VO_BindVoWbc(SAMPLE_VO_DEV_DHD0, VoDev, 0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VO_SetWbcAttr failed!\n");
goto END_8D1_7;
}
#endif
while(1)sleep(1);/////到这一步就可以在显示器的看到VGA,HDMI,以及CVBS视频了
后面的代码省略
....
}
跟我的困惑可能有相关的部分注释我已经在代码中标识了出来
下面说下我的几点困惑:
1.在这个例子中,VGA.HDMI,以及CVBS都有输出的,其中CVBS接的显示器上的AV接口,显示器有AV1和AV2两个,
按理说不是应该只有一个AV显示吗,这里标清输出设备用的是SAMPLE_VO_DEV_DSD1,我觉得应该显示器AV2有视频才对,至少不应该AV1.AV2两个都有视频吧?
当然这里的CVBS输出的是高清设备0的视频回写
2.标清输出设备SAMPLE_VO_DEV_DSD1 ,enVoMode = VO_MODE_1MUX不是应该只输出一路(1个窗口)吗?为什么我测试的时候显示有4个窗口.
3.step7,VoDev = SAMPLE_VO_DEV_DSD1换成VoDev = SAMPLE_VO_DEV_DSD0后,显示器AV口不再显示视频,为什么?
望大家互相讨论,不吝赐教,上面哪里说的不对欢迎指正.
HI_S32 SAMPLE_VIO_4_D1(HI_VOID)
{
SAMPLE_VI_MODE_E enViMode = SAMPLE_VI_MODE_4_D1;
HI_U32 u32ViChnCnt = 4;
HI_S32 s32VpssGrpCnt = 4;
VB_CONF_S stVbConf;
VI_CHN ViChn;
VPSS_GRP VpssGrp;
VPSS_GRP_ATTR_S stGrpAttr;
VPSS_CHN VpssChn_VoHD0 = VPSS_PRE0_CHN;
VO_DEV VoDev;
VO_CHN VoChn;
VO_PUB_ATTR_S stVoPubAttr,stVoPubAttrSD;
SAMPLE_VO_MODE_E enVoMode, enPreVoMode;
HI_S32 i;
HI_S32 s32Ret = HI_SUCCESS;
HI_U32 u32BlkSize;
HI_CHAR ch;
SIZE_S stSize;
HI_U32 u32WndNum;
VO_WBC_ATTR_S stWbcAttr;
/******************************************
step 1: init variable
******************************************/
gs_u32ViFrmRate = (VIDEO_ENCODING_MODE_PAL== gs_enNorm)?25:30;
memset(&stVbConf,0,sizeof(VB_CONF_S));
u32BlkSize = SAMPLE_COMM_SYS_CalcPicVbBlkSize(gs_enNorm,\
PIC_D1, SAMPLE_PIXEL_FORMAT, SAMPLE_SYS_ALIGN_WIDTH);
stVbConf.u32MaxPoolCnt = 128;
/* video buffer*/
//todo: vb=15
stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[0].u32BlkCnt = u32ViChnCnt * 8;
/******************************************
step 2: mpp system init.
******************************************/
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("system init failed with %d!\n", s32Ret);
goto END_8D1_0;
}
/******************************************
step 3: start vi dev & chn
******************************************/
s32Ret = SAMPLE_COMM_VI_Start(enViMode, gs_enNorm);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start vi failed!\n");
goto END_8D1_0;
}
/******************************************
step 4: start vpss and vi bind vpss
******************************************/
s32Ret = SAMPLE_COMM_SYS_GetPicSize(gs_enNorm, PIC_D1, &stSize);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_SYS_GetPicSize failed!\n");
goto END_8D1_0;
}
stGrpAttr.u32MaxW = stSize.u32Width;
stGrpAttr.u32MaxH = stSize.u32Height;
stGrpAttr.bDrEn = HI_FALSE;
stGrpAttr.bDbEn = HI_FALSE;
stGrpAttr.bIeEn = HI_TRUE;
stGrpAttr.bNrEn = HI_TRUE;
stGrpAttr.bHistEn = HI_FALSE;
stGrpAttr.enDieMode = VPSS_DIE_MODE_AUTO;
stGrpAttr.enPixFmt = SAMPLE_PIXEL_FORMAT;
s32Ret = SAMPLE_COMM_VPSS_Start(s32VpssGrpCnt, &stSize, VPSS_MAX_CHN_NUM,NULL);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Vpss failed!\n");
goto END_8D1_1;
}
s32Ret = SAMPLE_COMM_VI_BindVpss(enViMode);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Vi bind Vpss failed!\n");
goto END_8D1_2;
}
/******************************************
step 6: start vo HD0 (HDMI+VGA), multi-screen, you can switch mode
******************************************/
printf("start vo HD0.\n");
//HI3520D¸高清输出设备只有一个DHD0
VoDev = SAMPLE_VO_DEV_DHD0;
u32WndNum = 4;
enVoMode = VO_MODE_4MUX;
if(VIDEO_ENCODING_MODE_PAL == gs_enNorm)
{
stVoPubAttr.enIntfSync = VO_OUTPUT_1024x768_60;
}
else
{
stVoPubAttr.enIntfSync = VO_OUTPUT_1024x768_60;
}
//HI_FPGA 未定义
#ifdef HI_FPGA
stVoPubAttr.enIntfType = VO_INTF_HDMI|VO_INTF_VGA|VO_INTF_BT1120;
#else
stVoPubAttr.enIntfType = VO_INTF_HDMI|VO_INTF_VGA;
#endif
stVoPubAttr.u32BgColor = 0x000000ff;
stVoPubAttr.bDoubleFrame = HI_TRUE;
s32Ret = SAMPLE_COMM_VO_StartDevLayer(VoDev, &stVoPubAttr, gs_u32ViFrmRate);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_StartDevLayer failed!\n");
goto END_8D1_4;
}
//启动每个指定的视频输出通道VoDev=SAMPLE_VO_DEV_DHD0
s32Ret = SAMPLE_COMM_VO_StartChn(VoDev, &stVoPubAttr, enVoMode);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_StartChn failed!\n");
goto END_8D1_5;
}
/* if it's displayed on HDMI, we should start HDMI */
if (stVoPubAttr.enIntfType & VO_INTF_HDMI)
{
if (HI_SUCCESS != SAMPLE_COMM_VO_HdmiStart(stVoPubAttr.enIntfSync))
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_HdmiStart failed!\n");
goto END_8D1_5;
}
}
for(i=0;i
VoChn = i;
VpssGrp = i;
s32Ret = SAMPLE_COMM_VO_BindVpss(VoDev,VoChn,VpssGrp,VpssChn_VoHD0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start VO failed!\n");
goto END_8D1_5;
}
}
#if 1
/******************************************
step 7: start vo SD0 (CVBS) (WBC target)
******************************************/
printf("start vo SD0: wbc from hd0\n");
VoDev = SAMPLE_VO_DEV_DSD1;//这里如果使用SAMPLE_VO_DEV_DSD0不行,CVBS无视频输出
u32WndNum = 1;
enVoMode = VO_MODE_1MUX;
stVoPubAttrSD.enIntfSync = VO_OUTPUT_PAL;
stVoPubAttrSD.enIntfType = VO_INTF_CVBS;
stVoPubAttrSD.u32BgColor = 0x000000ff;
stVoPubAttrSD.bDoubleFrame = HI_FALSE;
s32Ret = SAMPLE_COMM_VO_StartDevLayer(VoDev, &stVoPubAttrSD, gs_u32ViFrmRate);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartDevLayer failed!\n");
goto END_8D1_5;
}
///启动输出设备VoDev(SAMPLE_VO_DEV_DSD1) 的所有通道
//因为enVoMode==VO_MODE_1MUX,实际只启动一个输出通道(通道0)
s32Ret = SAMPLE_COMM_VO_StartChn(VoDev, &stVoPubAttrSD, enVoMode);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartChn failed!\n");
goto END_8D1_6;
}
s32Ret = SAMPLE_COMM_VO_GetWH(VO_OUTPUT_PAL, \
&stWbcAttr.stTargetSize.u32Width, \
&stWbcAttr.stTargetSize.u32Height, \
&stWbcAttr.u32FrameRate);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_GetWH failed!\n");
goto END_8D1_6;
}
stWbcAttr.enPixelFormat = SAMPLE_PIXEL_FORMAT;
stWbcAttr.enDataSource = VO_WBC_DATASOURCE_MIXER;
/*
对高清输出设备SAMPLE_VO_DEV_DHD0 进行视频回写,设置回写参数
*/
s32Ret = HI_MPI_VO_SetWbcAttr(SAMPLE_VO_DEV_DHD0, &stWbcAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VO_SetWbcAttr failed!\n");
goto END_8D1_6;
}
s32Ret = HI_MPI_VO_EnableWbc(SAMPLE_VO_DEV_DHD0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VO_SetWbcAttr failed!\n");
goto END_8D1_7;
}
///以高清输出设备SAMPLE_VO_DEV_DHD0的通道0作为视频源
///标清输出设备VoDev(SAMPLE_VO_DEV_DSD1)的通道0作为目标进行视频回写
s32Ret = SAMPLE_COMM_VO_BindVoWbc(SAMPLE_VO_DEV_DHD0, VoDev, 0);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VO_SetWbcAttr failed!\n");
goto END_8D1_7;
}
#endif
while(1)sleep(1);/////到这一步就可以在显示器的看到VGA,HDMI,以及CVBS视频了
后面的代码省略
....
}
跟我的困惑可能有相关的部分注释我已经在代码中标识了出来
下面说下我的几点困惑:
1.在这个例子中,VGA.HDMI,以及CVBS都有输出的,其中CVBS接的显示器上的AV接口,显示器有AV1和AV2两个,
按理说不是应该只有一个AV显示吗,这里标清输出设备用的是SAMPLE_VO_DEV_DSD1,我觉得应该显示器AV2有视频才对,至少不应该AV1.AV2两个都有视频吧?
当然这里的CVBS输出的是高清设备0的视频回写
2.标清输出设备SAMPLE_VO_DEV_DSD1 ,enVoMode = VO_MODE_1MUX不是应该只输出一路(1个窗口)吗?为什么我测试的时候显示有4个窗口.
3.step7,VoDev = SAMPLE_VO_DEV_DSD1换成VoDev = SAMPLE_VO_DEV_DSD0后,显示器AV口不再显示视频,为什么?
望大家互相讨论,不吝赐教,上面哪里说的不对欢迎指正.
我来回答
回答4个
时间排序
认可量排序
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2016-12-07 19:17:26
-
2018-04-15 06:02:57
-
2015-04-09 08:25:26
-
2016-07-09 09:35:19
-
2015-04-27 15:38:38
-
2016-04-28 16:18:07
-
2017-04-29 17:26:09
-
2017-03-17 09:46:08
-
2015-01-07 17:02:24
-
2017-08-10 09:46:22
-
2015-11-10 10:55:24
-
2018-07-18 20:26:44
-
2015-11-10 10:56:45
-
2015-07-28 11:33:12
-
2020-05-06 09:29:32
-
2015-01-26 08:20:48
-
2016-06-23 15:40:05
-
2016-09-07 09:42:10
-
2015-12-07 14:13:26
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认