3817
- 收藏
- 点赞
- 分享
- 举报
海思提供的 vdec sample
海思提供的 vdec sample 正常跑起来应该是把264数据解析 输出到VO。我现在跑起来屏幕黑色一点反应。附修改后的代码。修改的地方都注释出来了,使用的264为 320*240 ,是sample 录制的,我感觉还是某些配置的问题。
{
VB_CONF_S stVbConf, stModVbConf;
HI_S32 i, s32Ret = HI_SUCCESS;
VDEC_CHN_ATTR_S stVdecChnAttr[VDEC_MAX_CHN_NUM];
VdecThreadParam stVdecSend[VDEC_MAX_CHN_NUM];
VPSS_GRP_ATTR_S stVpssGrpAttr[VDEC_MAX_CHN_NUM];
SIZE_S stSize, stRotateSize;
VO_DEV VoDev;
VO_LAYER VoLayer;
VO_PUB_ATTR_S stVoPubAttr;
VO_VIDEO_LAYER_ATTR_S stVoLayerAttr;
HI_U32 u32VdCnt = 1, u32GrpCnt = 1;
pthread_t VdecThread[2*VDEC_MAX_CHN_NUM];
ROTATE_E enRotate;
VIDEO_FRAME_INFO_S pstVideoFrame;
stSize.u32Width = HD_WIDTH;
stSize.u32Height = HD_HEIGHT;
stSize.u32Width = 360;// 1)自己改了大小。对应打开264的宽高
stSize.u32Height = 240;
/************************************************
step1: init SYS and common VB
*************************************************/
SAMPLE_COMM_VDEC_Sysconf(&stVbConf, &stSize);
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("init sys fail for %#x!\n", s32Ret);
goto END1;
}
/************************************************
step2: init mod common VB
*************************************************/
SAMPLE_COMM_VDEC_ModCommPoolConf(&stModVbConf, PT_H264, &stSize, u32VdCnt);
s32Ret = SAMPLE_COMM_VDEC_InitModCommVb(&stModVbConf);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("init mod common vb fail for %#x!\n", s32Ret);
goto END1;
}
/************************************************
step3: start VDEC
*************************************************/
SAMPLE_COMM_VDEC_ChnAttr(u32VdCnt, &stVdecChnAttr[0], PT_H264, &stSize);
s32Ret = SAMPLE_COMM_VDEC_Start(u32VdCnt, &stVdecChnAttr[0]);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("start VDEC fail for %#x!\n", s32Ret);
goto END2;
}
/************************************************
step4: start VPSS
*************************************************/
//stRotateSize.u32Width = stRotateSize.u32Height = MAX2(stSize.u32Width, stSize.u32Height);
stRotateSize.u32Width = stRotateSize.u32Height = MAX2(stSize.u32Width, stSize.u32Height);
stRotateSize.u32Width = 320;//改了这里
stRotateSize.u32Height = 240;
printf("stRotateSize.u32Width %d stRotateSize.u32Height %d \n",stRotateSize.u32Width,stRotateSize.u32Height);
SAMPLE_COMM_VDEC_VpssGrpAttr(u32GrpCnt, &stVpssGrpAttr[0], &stRotateSize);
//s32Ret = SAMPLE_COMM_VPSS_Start(u32GrpCnt, &stRotateSize, 1, &stVpssGrpAttr[0]);
s32Ret = SAMPLE_COMM_VPSS_Start(u32GrpCnt, &stRotateSize,1, &stVpssGrpAttr[0]);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("start VPSS fail for %#x!\n", s32Ret);
goto END3;
}
/************************************************
step5: start VO
*************************************************/
VoDev = SAMPLE_VO_DEV_DHD0;
VoLayer = SAMPLE_VO_DEV_DHD0;
#if HI_FPGA
stVoPubAttr.enIntfSync = VO_OUTPUT_1080P30;
stVoPubAttr.enIntfType = VO_INTF_VGA;
#else
stVoPubAttr.enIntfSync = VO_OUTPUT_1080P60;
stVoPubAttr.enIntfType = VO_INTF_VGA;
#endif
stVoPubAttr.enIntfSync = VO_OUTPUT_NTSC;
stVoPubAttr.enIntfType = VO_INTF_CVBS;
VoDev = SAMPLE_VO_DEV_DSD0;
VoLayer = SAMPLE_VO_LAYER_VSD0;//改了这里, 在测试vio用了这样的配置,这里也改了
s32Ret = SAMPLE_COMM_VO_StartDev(VoDev, &stVoPubAttr);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec bind vpss fail for %#x!\n", s32Ret);
goto END4_1;
}
#if 0 //关了 感觉不需要
#ifndef HI_FPGA
if (HI_SUCCESS != SAMPLE_COMM_VO_HdmiStart(stVoPubAttr.enIntfSync))
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_HdmiStart failed!\n");
goto END4_2;
}
#endif
#endif
stVoLayerAttr.bClusterMode = HI_FALSE;
stVoLayerAttr.bDoubleFrame = HI_FALSE;
stVoLayerAttr.enPixFormat = SAMPLE_PIXEL_FORMAT;
s32Ret = SAMPLE_COMM_VO_GetWH(stVoPubAttr.enIntfSync, \
&stVoLayerAttr.stDispRect.u32Width, &stVoLayerAttr.stDispRect.u32Height, &stVoLayerAttr.u32DispFrmRt);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("failed with %#x!\n", s32Ret);
goto END4_2;
}
stVoLayerAttr.stImageSize.u32Width = stVoLayerAttr.stDispRect.u32Width;
stVoLayerAttr.stImageSize.u32Height = stVoLayerAttr.stDispRect.u32Height;
s32Ret = SAMPLE_COMM_VO_StartLayer(VoLayer, &stVoLayerAttr);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartLayer fail for %#x!\n", s32Ret);
goto END4_3;
}
s32Ret = SAMPLE_COMM_VO_StartChn(VoLayer, VO_MODE_1MUX_1);//这个函数有自己改过,只是增加了一些模式,应该不影响
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec bind vpss fail for %#x!\n", s32Ret);
goto END4_4;
}
/************************************************
step6: VDEC bind VPSS
*************************************************/
for(i=0; i
{
s32Ret = SAMPLE_COMM_VDEC_BindVpss(i, i);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec bind vpss fail for %#x!\n", s32Ret);
goto END5;
}
}
/************************************************
step7: VPSS bind VO
*************************************************/
for(i=0; i
{
s32Ret = SAMPLE_COMM_VO_BindVpss(VoLayer, i, i, VPSS_CHN0);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vpss bind vo fail for %#x!\n", s32Ret);
goto END6;
}
}
/************************************************
step8: send stream to VDEC
*************************************************/
SAMPLE_COMM_VDEC_ThreadParam(u32VdCnt, &stVdecSend[0], &stVdecChnAttr[0], SAMPLE_1080P_H264_PATH);
SAMPLE_COMM_VDEC_StartSendStream(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
s32Ret = HI_MPI_VPSS_GetChnFrame(0, 0, &pstVideoFrame, -1);//为了测试加的,这里获取不成功
if(HI_SUCCESS!=s32Ret)
{
printf("HI_MPI_VPSS_GetChnFrame failed %08x\n",s32Ret);
} else {
printf("HI_MPI_VPSS_GetChnFrame ok\n");
}
/*** get the stat info of luma pix ***/
SAMPLE_COMM_VDEC_StartGetLuma(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
/*** set the rotational angle of decode pic ***/
printf("SAMPLE_TEST: set set the rotational angle of decode pic now.");
#if 0
sleep(5);
for(i=0; i
{
enRotate = ROTATE_90;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
sleep(3);
for(i=0; i
{
enRotate = ROTATE_180;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
sleep(3);
for(i=0; i
{
enRotate = ROTATE_270;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
sleep(3);
for(i=0; i
{
enRotate = ROTATE_NONE;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
#endif
/*** control the send stream thread and get luma info thread ***/
SAMPLE_COMM_VDEC_CmdCtrl(u32VdCnt, &stVdecSend[0]);
SAMPLE_COMM_VDEC_StopSendStream(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
SAMPLE_COMM_VDEC_StopGetLuma(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
END6:
for(i=0; i
{
s32Ret = SAMPLE_COMM_VO_UnBindVpss(VoLayer, i, i, VPSS_CHN0);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vpss unbind vo fail for %#x!\n", s32Ret);
}
}
END5:
for(i=0; i
{
s32Ret = SAMPLE_COMM_VDEC_UnBindVpss(i, i);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec unbind vpss fail for %#x!\n", s32Ret);
}
}
END4_4:
SAMPLE_COMM_VO_StopChn(VoLayer, VO_MODE_4MUX);
END4_3:
SAMPLE_COMM_VO_StopLayer(VoLayer);
END4_2:
#ifndef HI_FPGA
SAMPLE_COMM_VO_HdmiStop();
#endif
END4_1:
SAMPLE_COMM_VO_StopDev(VoDev);
END3:
SAMPLE_COMM_VPSS_Stop(u32GrpCnt, VPSS_CHN0);
END2:
SAMPLE_COMM_VDEC_Stop(u32VdCnt);
END1:
SAMPLE_COMM_SYS_Exit();
return s32Ret;
}
{
VB_CONF_S stVbConf, stModVbConf;
HI_S32 i, s32Ret = HI_SUCCESS;
VDEC_CHN_ATTR_S stVdecChnAttr[VDEC_MAX_CHN_NUM];
VdecThreadParam stVdecSend[VDEC_MAX_CHN_NUM];
VPSS_GRP_ATTR_S stVpssGrpAttr[VDEC_MAX_CHN_NUM];
SIZE_S stSize, stRotateSize;
VO_DEV VoDev;
VO_LAYER VoLayer;
VO_PUB_ATTR_S stVoPubAttr;
VO_VIDEO_LAYER_ATTR_S stVoLayerAttr;
HI_U32 u32VdCnt = 1, u32GrpCnt = 1;
pthread_t VdecThread[2*VDEC_MAX_CHN_NUM];
ROTATE_E enRotate;
VIDEO_FRAME_INFO_S pstVideoFrame;
stSize.u32Width = HD_WIDTH;
stSize.u32Height = HD_HEIGHT;
stSize.u32Width = 360;// 1)自己改了大小。对应打开264的宽高
stSize.u32Height = 240;
/************************************************
step1: init SYS and common VB
*************************************************/
SAMPLE_COMM_VDEC_Sysconf(&stVbConf, &stSize);
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("init sys fail for %#x!\n", s32Ret);
goto END1;
}
/************************************************
step2: init mod common VB
*************************************************/
SAMPLE_COMM_VDEC_ModCommPoolConf(&stModVbConf, PT_H264, &stSize, u32VdCnt);
s32Ret = SAMPLE_COMM_VDEC_InitModCommVb(&stModVbConf);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("init mod common vb fail for %#x!\n", s32Ret);
goto END1;
}
/************************************************
step3: start VDEC
*************************************************/
SAMPLE_COMM_VDEC_ChnAttr(u32VdCnt, &stVdecChnAttr[0], PT_H264, &stSize);
s32Ret = SAMPLE_COMM_VDEC_Start(u32VdCnt, &stVdecChnAttr[0]);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("start VDEC fail for %#x!\n", s32Ret);
goto END2;
}
/************************************************
step4: start VPSS
*************************************************/
//stRotateSize.u32Width = stRotateSize.u32Height = MAX2(stSize.u32Width, stSize.u32Height);
stRotateSize.u32Width = stRotateSize.u32Height = MAX2(stSize.u32Width, stSize.u32Height);
stRotateSize.u32Width = 320;//改了这里
stRotateSize.u32Height = 240;
printf("stRotateSize.u32Width %d stRotateSize.u32Height %d \n",stRotateSize.u32Width,stRotateSize.u32Height);
SAMPLE_COMM_VDEC_VpssGrpAttr(u32GrpCnt, &stVpssGrpAttr[0], &stRotateSize);
//s32Ret = SAMPLE_COMM_VPSS_Start(u32GrpCnt, &stRotateSize, 1, &stVpssGrpAttr[0]);
s32Ret = SAMPLE_COMM_VPSS_Start(u32GrpCnt, &stRotateSize,1, &stVpssGrpAttr[0]);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("start VPSS fail for %#x!\n", s32Ret);
goto END3;
}
/************************************************
step5: start VO
*************************************************/
VoDev = SAMPLE_VO_DEV_DHD0;
VoLayer = SAMPLE_VO_DEV_DHD0;
#if HI_FPGA
stVoPubAttr.enIntfSync = VO_OUTPUT_1080P30;
stVoPubAttr.enIntfType = VO_INTF_VGA;
#else
stVoPubAttr.enIntfSync = VO_OUTPUT_1080P60;
stVoPubAttr.enIntfType = VO_INTF_VGA;
#endif
stVoPubAttr.enIntfSync = VO_OUTPUT_NTSC;
stVoPubAttr.enIntfType = VO_INTF_CVBS;
VoDev = SAMPLE_VO_DEV_DSD0;
VoLayer = SAMPLE_VO_LAYER_VSD0;//改了这里, 在测试vio用了这样的配置,这里也改了
s32Ret = SAMPLE_COMM_VO_StartDev(VoDev, &stVoPubAttr);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec bind vpss fail for %#x!\n", s32Ret);
goto END4_1;
}
#if 0 //关了 感觉不需要
#ifndef HI_FPGA
if (HI_SUCCESS != SAMPLE_COMM_VO_HdmiStart(stVoPubAttr.enIntfSync))
{
SAMPLE_PRT("Start SAMPLE_COMM_VO_HdmiStart failed!\n");
goto END4_2;
}
#endif
#endif
stVoLayerAttr.bClusterMode = HI_FALSE;
stVoLayerAttr.bDoubleFrame = HI_FALSE;
stVoLayerAttr.enPixFormat = SAMPLE_PIXEL_FORMAT;
s32Ret = SAMPLE_COMM_VO_GetWH(stVoPubAttr.enIntfSync, \
&stVoLayerAttr.stDispRect.u32Width, &stVoLayerAttr.stDispRect.u32Height, &stVoLayerAttr.u32DispFrmRt);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("failed with %#x!\n", s32Ret);
goto END4_2;
}
stVoLayerAttr.stImageSize.u32Width = stVoLayerAttr.stDispRect.u32Width;
stVoLayerAttr.stImageSize.u32Height = stVoLayerAttr.stDispRect.u32Height;
s32Ret = SAMPLE_COMM_VO_StartLayer(VoLayer, &stVoLayerAttr);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartLayer fail for %#x!\n", s32Ret);
goto END4_3;
}
s32Ret = SAMPLE_COMM_VO_StartChn(VoLayer, VO_MODE_1MUX_1);//这个函数有自己改过,只是增加了一些模式,应该不影响
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec bind vpss fail for %#x!\n", s32Ret);
goto END4_4;
}
/************************************************
step6: VDEC bind VPSS
*************************************************/
for(i=0; i
s32Ret = SAMPLE_COMM_VDEC_BindVpss(i, i);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec bind vpss fail for %#x!\n", s32Ret);
goto END5;
}
}
/************************************************
step7: VPSS bind VO
*************************************************/
for(i=0; i
s32Ret = SAMPLE_COMM_VO_BindVpss(VoLayer, i, i, VPSS_CHN0);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vpss bind vo fail for %#x!\n", s32Ret);
goto END6;
}
}
/************************************************
step8: send stream to VDEC
*************************************************/
SAMPLE_COMM_VDEC_ThreadParam(u32VdCnt, &stVdecSend[0], &stVdecChnAttr[0], SAMPLE_1080P_H264_PATH);
SAMPLE_COMM_VDEC_StartSendStream(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
s32Ret = HI_MPI_VPSS_GetChnFrame(0, 0, &pstVideoFrame, -1);//为了测试加的,这里获取不成功
if(HI_SUCCESS!=s32Ret)
{
printf("HI_MPI_VPSS_GetChnFrame failed %08x\n",s32Ret);
} else {
printf("HI_MPI_VPSS_GetChnFrame ok\n");
}
/*** get the stat info of luma pix ***/
SAMPLE_COMM_VDEC_StartGetLuma(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
/*** set the rotational angle of decode pic ***/
printf("SAMPLE_TEST: set set the rotational angle of decode pic now.");
#if 0
sleep(5);
for(i=0; i
enRotate = ROTATE_90;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
sleep(3);
for(i=0; i
enRotate = ROTATE_180;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
sleep(3);
for(i=0; i
enRotate = ROTATE_270;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
sleep(3);
for(i=0; i
enRotate = ROTATE_NONE;
HI_MPI_VDEC_SetRotate(i, enRotate);
}
#endif
/*** control the send stream thread and get luma info thread ***/
SAMPLE_COMM_VDEC_CmdCtrl(u32VdCnt, &stVdecSend[0]);
SAMPLE_COMM_VDEC_StopSendStream(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
SAMPLE_COMM_VDEC_StopGetLuma(u32VdCnt, &stVdecSend[0], &VdecThread[0]);
END6:
for(i=0; i
s32Ret = SAMPLE_COMM_VO_UnBindVpss(VoLayer, i, i, VPSS_CHN0);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vpss unbind vo fail for %#x!\n", s32Ret);
}
}
END5:
for(i=0; i
s32Ret = SAMPLE_COMM_VDEC_UnBindVpss(i, i);
if(s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("vdec unbind vpss fail for %#x!\n", s32Ret);
}
}
END4_4:
SAMPLE_COMM_VO_StopChn(VoLayer, VO_MODE_4MUX);
END4_3:
SAMPLE_COMM_VO_StopLayer(VoLayer);
END4_2:
#ifndef HI_FPGA
SAMPLE_COMM_VO_HdmiStop();
#endif
END4_1:
SAMPLE_COMM_VO_StopDev(VoDev);
END3:
SAMPLE_COMM_VPSS_Stop(u32GrpCnt, VPSS_CHN0);
END2:
SAMPLE_COMM_VDEC_Stop(u32VdCnt);
END1:
SAMPLE_COMM_SYS_Exit();
return s32Ret;
}
我来回答
回答7个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2019-04-03 17:37:59
-
2019-08-29 11:34:22
-
2024-10-26 19:57:50
-
2017-06-20 19:16:49
-
2021-09-28 16:04:20
-
2016-07-14 18:58:05
-
2016-10-25 10:44:09
-
2019-12-04 09:46:15
-
2023-04-17 11:26:09
-
2015-05-25 21:07:40
-
2015-05-25 21:11:56
-
2017-10-12 15:46:08
-
322017-04-05 10:07:33
-
2016-09-13 10:57:47
-
2015-10-29 15:05:56
-
2016-03-18 13:47:44
-
2024-08-26 08:47:11
-
2019-01-15 09:09:49
-
2016-08-12 09:27:55
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认