2568
- 收藏
- 点赞
- 分享
- 举报
hi3519v101 stitching 模式 拼接视频有大神调试通么??
代码如下,,是否还有什么地方需要修改的???
{
PAYLOAD_TYPE_E enPayLoad[2]= {PT_H264, PT_H265};
PIC_SIZE_E enSize[2] = {PIC_HD1080, PIC_HD1080};
VENC_GOP_ATTR_S stGopAttr;
VENC_GOP_MODE_E enGopMode[2] = {VENC_GOPMODE_NORMALP,VENC_GOPMODE_NORMALP};
HI_U32 u32Profile = 0;
VB_CONF_S stVbConf;
SAMPLE_VI_CONFIG_S stViConfig = {0};
VPSS_GRP VpssGrp;
VPSS_CHN VpssChn;
VPSS_GRP_ATTR_S stVpssGrpAttr = {0};
VPSS_CHN_ATTR_S stVpssChnAttr = {0};
VPSS_CHN_MODE_S stVpssChnMode;
VENC_CHN VencChn;
SAMPLE_RC_E enRcMode= SAMPLE_RC_CBR;
HI_S32 s32ChnNum=1;//2;
HI_S32 s32Ret = HI_SUCCESS;
HI_U32 u32BlkSize;
SIZE_S stSize;
char c;
/******************************************
step 1: init sys variable
******************************************/
memset(&stVbConf,0,sizeof(VB_CONF_S));
//SAMPLE_COMM_VI_GetSizeBySensor(&enSize[0]);
stVbConf.u32MaxPoolCnt = 128;
//printf("s32ChnNum:%d,Sensor Size:%d\n",s32ChnNum,enSize[0]);
/*video buffer*/
u32BlkSize = SAMPLE_COMM_SYS_CalcPicVbBlkSize(gs_enNorm,\
enSize[0], SAMPLE_PIXEL_FORMAT, SAMPLE_SYS_ALIGN_WIDTH);
stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[0].u32BlkCnt = 20;
u32BlkSize = SAMPLE_COMM_SYS_CalcPicVbBlkSize(gs_enNorm,\
enSize[1], SAMPLE_PIXEL_FORMAT, SAMPLE_SYS_ALIGN_WIDTH);
stVbConf.astCommPool[1].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[1].u32BlkCnt =20;
/******************************************
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_VENC_1080P_CLASSIC_0;
}
/******************************************
step 3: start vi dev & chn to capture
******************************************/
stViConfig.enViMode = SENSOR_TYPE;//SAMPLE_VI_MODE_1_D1;//
stViConfig.enRotate = ROTATE_NONE;
stViConfig.enNorm = VIDEO_ENCODING_MODE_AUTO;
stViConfig.enViChnSet = VI_CHN_SET_NORMAL;
stViConfig.enWDRMode = WDR_MODE_NONE;
stViConfig.enSnsNum = SAMPLE_SENSOR_DOUBLE;//SAMPLE_SENSOR_SINGLE;//yxw
s32Ret = SAMPLE_COMM_VI_StartVi(&stViConfig);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start vi failed!\n");
goto END_VENC_1080P_CLASSIC_1;
}
/******************************************
step 4: start vpss and vi bind vpss
******************************************/
MPP_CHN_S stSrcChn, stDestChn;
VI_STITCH_CORRECTION_ATTR_S stCorretionAttr = {0};
VI_CHN ViLeftChn = 0;
VI_CHN ViRightChn = 1;
VPSS_STITCH_BLEND_PARAM_S stStitchBlendParam = {0};
s32Ret = HI_MPI_VI_GetStitchCorrectionAttr(ViLeftChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
stCorretionAttr.stLdcAttr.bEnable = HI_TRUE;
stCorretionAttr.stLdcAttr.stAttr.s32Ratio = 200;
stCorretionAttr.stLdcAttr.stAttr.enViewType = LDC_VIEW_TYPE_ALL;
stCorretionAttr.stLdcAttr.stAttr.s32CenterXOffset = 0;
stCorretionAttr.stLdcAttr.stAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.bEnable = HI_FALSE;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterXOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32Ratio = 0;
stCorretionAttr.stPMFAttr.bEnable = HI_TRUE;
stCorretionAttr.stPMFAttr.as32PMFCoef[0] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[1] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[2] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[3] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[4] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[5] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[6] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[7] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[8] = 524288;
stCorretionAttr.stPMFAttr.stDestSize.u32Width = 1920;
stCorretionAttr.stPMFAttr.stDestSize.u32Height = 1080;
s32Ret = HI_MPI_VI_SetStitchCorrectionAttr(ViLeftChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
s32Ret = HI_MPI_VI_GetStitchCorrectionAttr(ViRightChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
stCorretionAttr.stLdcAttr.bEnable = HI_TRUE;
stCorretionAttr.stLdcAttr.stAttr.s32Ratio = 200;
stCorretionAttr.stLdcAttr.stAttr.enViewType = LDC_VIEW_TYPE_ALL;
stCorretionAttr.stLdcAttr.stAttr.s32CenterXOffset = 0;
stCorretionAttr.stLdcAttr.stAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.bEnable = HI_FALSE;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterXOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32Ratio = 0;
stCorretionAttr.stPMFAttr.bEnable = HI_TRUE;
stCorretionAttr.stPMFAttr.as32PMFCoef[0] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[1] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[2] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[3] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[4] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[5] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[6] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[7] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[8] = 524288;
stCorretionAttr.stPMFAttr.stDestSize.u32Width = 1920;
stCorretionAttr.stPMFAttr.stDestSize.u32Height = 1080;
s32Ret = HI_MPI_VI_SetStitchCorrectionAttr(ViRightChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
VpssGrp = 0;
stVpssGrpAttr.u32MaxW = 3600;
stVpssGrpAttr.u32MaxH = 1080;
stVpssGrpAttr.bIeEn = HI_FALSE;
stVpssGrpAttr.bNrEn = HI_TRUE;
stVpssGrpAttr.stNrAttr.enNrType = VPSS_NR_TYPE_VIDEO;
stVpssGrpAttr.stNrAttr.stNrVideoAttr.enNrRefSource = VPSS_NR_REF_FROM_RFR;
stVpssGrpAttr.stNrAttr.u32RefFrameNum = 2;
stVpssGrpAttr.bHistEn = HI_FALSE;
stVpssGrpAttr.bDciEn = HI_FALSE;
stVpssGrpAttr.enDieMode = VPSS_DIE_MODE_NODIE;
stVpssGrpAttr.enPixFmt = SAMPLE_PIXEL_FORMAT;
stVpssGrpAttr.bStitchBlendEn = HI_TRUE;
stVpssGrpAttr.enStitchBlendMode = VPSS_STITCH_BLEND_ADJUST;
stVpssGrpAttr.stStitchBlendAttr.u32OutWidth = 3600;
stVpssGrpAttr.stStitchBlendAttr.u32OutHeight = 1080;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[0].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[0].s32Y = 0;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[1].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[1].s32Y = 0;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[2].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[2].s32Y = 1079;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[3].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[3].s32Y = 1079;
s32Ret = SAMPLE_COMM_VPSS_StartGroup(VpssGrp, &stVpssGrpAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Vpss failed!\n");
goto END_VENC_1080P_CLASSIC_2;
}
stSrcChn.enModId = HI_ID_VIU;
stSrcChn.s32DevId = 0;
stSrcChn.s32ChnId = ViLeftChn;
stDestChn.enModId = HI_ID_VPSS;
stDestChn.s32DevId = 0;
stDestChn.s32ChnId = 0;
s32Ret = HI_MPI_SYS_Bind(&stSrcChn, &stDestChn);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
stSrcChn.enModId = HI_ID_VIU;
stSrcChn.s32DevId = 0;
stSrcChn.s32ChnId = ViRightChn;
stDestChn.enModId = HI_ID_VPSS;
stDestChn.s32DevId = 0;
stDestChn.s32ChnId = 1;
s32Ret = HI_MPI_SYS_Bind(&stSrcChn, &stDestChn);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
s32Ret = HI_MPI_VPSS_GetStitchBlendParam(VpssGrp, &stStitchBlendParam);
if (HI_SUCCESS != s32Ret)
{
return s32Ret;
}
stStitchBlendParam.stAdjustParam.u32BldRange = 10;
stStitchBlendParam.stAdjustParam.u32BldPosition = 30;
s32Ret = HI_MPI_VPSS_SetStitchBlendParam(VpssGrp, &stStitchBlendParam);
if (HI_SUCCESS != s32Ret)
{
return s32Ret;
}
VpssChn = 0;
stVpssChnMode.enChnMode = VPSS_CHN_MODE_USER;
stVpssChnMode.bDouble = HI_FALSE;
stVpssChnMode.enPixelFormat = SAMPLE_PIXEL_FORMAT;
stVpssChnMode.u32Width = 3600;
stVpssChnMode.u32Height = 1080;
stVpssChnMode.enCompressMode = COMPRESS_MODE_SEG;
memset(&stVpssChnAttr, 0, sizeof(stVpssChnAttr));
stVpssChnAttr.s32SrcFrameRate = 25;//-1;
stVpssChnAttr.s32DstFrameRate = 25;//-1;
s32Ret = SAMPLE_COMM_VPSS_EnableChn(VpssGrp, VpssChn, &stVpssChnAttr, &stVpssChnMode, HI_NULL);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Enable vpss chn failed!\n");
goto END_VENC_1080P_CLASSIC_4;
}
/******************************************
step 5: start stream venc
******************************************/
VpssGrp = 0;
VpssChn = 0;
VencChn = 0;
s32Ret = SAMPLE_COMM_VENC_GetGopAttr(enGopMode[0],&stGopAttr,gs_enNorm);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Get GopAttr failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
s32Ret = SAMPLE_COMM_VENC_Start(VencChn, enPayLoad[0],\
gs_enNorm, enSize[0], enRcMode,u32Profile,&stGopAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
//yxw
s32Ret = HI_MPI_VENC_SetMaxStreamCnt(VencChn,1);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
s32Ret = SAMPLE_COMM_VENC_BindVpss(VencChn, VpssGrp, VpssChn);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
/******************************************
step 6: stream venc process -- get stream, then save it to file.
******************************************/
s32Ret = SAMPLE_COMM_VENC_StartGetStream(s32ChnNum);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
/****live555 start*****/
live555_rtsp();
while(1)
{
sleep(10);
}
printf("please press twice ENTER to exit this sample\n");
getchar();
getchar();
//sleep(20000);
/******************************************
step 7: exit process
******************************************/
SAMPLE_COMM_VENC_StopGetStream();
END_VENC_1080P_CLASSIC_5:
VpssGrp = 0;
switch(s32ChnNum)
{
case 2:
VpssChn = 1;
VencChn = 1;
SAMPLE_COMM_VENC_UnBindVpss(VencChn, VpssGrp, VpssChn);
SAMPLE_COMM_VENC_Stop(VencChn);
case 1:
VpssChn = 0;
VencChn = 0;
SAMPLE_COMM_VENC_UnBindVpss(VencChn, VpssGrp, VpssChn);
SAMPLE_COMM_VENC_Stop(VencChn);
break;
}
SAMPLE_COMM_VI_UnBindVpss(stViConfig.enViMode);
END_VENC_1080P_CLASSIC_4: //vpss stop
VpssGrp = 0;
switch(s32ChnNum)
{
case 2:
VpssChn = 1;
SAMPLE_COMM_VPSS_DisableChn(VpssGrp, VpssChn);
case 1:
VpssChn = 0;
SAMPLE_COMM_VPSS_DisableChn(VpssGrp, VpssChn);
break;
}
END_VENC_1080P_CLASSIC_3: //vpss stop
SAMPLE_COMM_VI_UnBindVpss(stViConfig.enViMode);
END_VENC_1080P_CLASSIC_2: //vpss stop
SAMPLE_COMM_VPSS_StopGroup(VpssGrp);
END_VENC_1080P_CLASSIC_1: //vi stop
SAMPLE_COMM_VI_StopVi(&stViConfig);
END_VENC_1080P_CLASSIC_0: //system exit
SAMPLE_COMM_SYS_Exit();
return s32Ret;
}
vpss调试信息如下:
{
PAYLOAD_TYPE_E enPayLoad[2]= {PT_H264, PT_H265};
PIC_SIZE_E enSize[2] = {PIC_HD1080, PIC_HD1080};
VENC_GOP_ATTR_S stGopAttr;
VENC_GOP_MODE_E enGopMode[2] = {VENC_GOPMODE_NORMALP,VENC_GOPMODE_NORMALP};
HI_U32 u32Profile = 0;
VB_CONF_S stVbConf;
SAMPLE_VI_CONFIG_S stViConfig = {0};
VPSS_GRP VpssGrp;
VPSS_CHN VpssChn;
VPSS_GRP_ATTR_S stVpssGrpAttr = {0};
VPSS_CHN_ATTR_S stVpssChnAttr = {0};
VPSS_CHN_MODE_S stVpssChnMode;
VENC_CHN VencChn;
SAMPLE_RC_E enRcMode= SAMPLE_RC_CBR;
HI_S32 s32ChnNum=1;//2;
HI_S32 s32Ret = HI_SUCCESS;
HI_U32 u32BlkSize;
SIZE_S stSize;
char c;
/******************************************
step 1: init sys variable
******************************************/
memset(&stVbConf,0,sizeof(VB_CONF_S));
//SAMPLE_COMM_VI_GetSizeBySensor(&enSize[0]);
stVbConf.u32MaxPoolCnt = 128;
//printf("s32ChnNum:%d,Sensor Size:%d\n",s32ChnNum,enSize[0]);
/*video buffer*/
u32BlkSize = SAMPLE_COMM_SYS_CalcPicVbBlkSize(gs_enNorm,\
enSize[0], SAMPLE_PIXEL_FORMAT, SAMPLE_SYS_ALIGN_WIDTH);
stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[0].u32BlkCnt = 20;
u32BlkSize = SAMPLE_COMM_SYS_CalcPicVbBlkSize(gs_enNorm,\
enSize[1], SAMPLE_PIXEL_FORMAT, SAMPLE_SYS_ALIGN_WIDTH);
stVbConf.astCommPool[1].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[1].u32BlkCnt =20;
/******************************************
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_VENC_1080P_CLASSIC_0;
}
/******************************************
step 3: start vi dev & chn to capture
******************************************/
stViConfig.enViMode = SENSOR_TYPE;//SAMPLE_VI_MODE_1_D1;//
stViConfig.enRotate = ROTATE_NONE;
stViConfig.enNorm = VIDEO_ENCODING_MODE_AUTO;
stViConfig.enViChnSet = VI_CHN_SET_NORMAL;
stViConfig.enWDRMode = WDR_MODE_NONE;
stViConfig.enSnsNum = SAMPLE_SENSOR_DOUBLE;//SAMPLE_SENSOR_SINGLE;//yxw
s32Ret = SAMPLE_COMM_VI_StartVi(&stViConfig);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start vi failed!\n");
goto END_VENC_1080P_CLASSIC_1;
}
/******************************************
step 4: start vpss and vi bind vpss
******************************************/
MPP_CHN_S stSrcChn, stDestChn;
VI_STITCH_CORRECTION_ATTR_S stCorretionAttr = {0};
VI_CHN ViLeftChn = 0;
VI_CHN ViRightChn = 1;
VPSS_STITCH_BLEND_PARAM_S stStitchBlendParam = {0};
s32Ret = HI_MPI_VI_GetStitchCorrectionAttr(ViLeftChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
stCorretionAttr.stLdcAttr.bEnable = HI_TRUE;
stCorretionAttr.stLdcAttr.stAttr.s32Ratio = 200;
stCorretionAttr.stLdcAttr.stAttr.enViewType = LDC_VIEW_TYPE_ALL;
stCorretionAttr.stLdcAttr.stAttr.s32CenterXOffset = 0;
stCorretionAttr.stLdcAttr.stAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.bEnable = HI_FALSE;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterXOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32Ratio = 0;
stCorretionAttr.stPMFAttr.bEnable = HI_TRUE;
stCorretionAttr.stPMFAttr.as32PMFCoef[0] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[1] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[2] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[3] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[4] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[5] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[6] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[7] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[8] = 524288;
stCorretionAttr.stPMFAttr.stDestSize.u32Width = 1920;
stCorretionAttr.stPMFAttr.stDestSize.u32Height = 1080;
s32Ret = HI_MPI_VI_SetStitchCorrectionAttr(ViLeftChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
s32Ret = HI_MPI_VI_GetStitchCorrectionAttr(ViRightChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
stCorretionAttr.stLdcAttr.bEnable = HI_TRUE;
stCorretionAttr.stLdcAttr.stAttr.s32Ratio = 200;
stCorretionAttr.stLdcAttr.stAttr.enViewType = LDC_VIEW_TYPE_ALL;
stCorretionAttr.stLdcAttr.stAttr.s32CenterXOffset = 0;
stCorretionAttr.stLdcAttr.stAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.bEnable = HI_FALSE;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterXOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32CenterYOffset = 0;
stCorretionAttr.stCylindAttr.stFisheyeCylindAttr.s32Ratio = 0;
stCorretionAttr.stPMFAttr.bEnable = HI_TRUE;
stCorretionAttr.stPMFAttr.as32PMFCoef[0] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[1] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[2] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[3] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[4] = 524288;
stCorretionAttr.stPMFAttr.as32PMFCoef[5] = 0 ;
stCorretionAttr.stPMFAttr.as32PMFCoef[6] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[7] = 0;
stCorretionAttr.stPMFAttr.as32PMFCoef[8] = 524288;
stCorretionAttr.stPMFAttr.stDestSize.u32Width = 1920;
stCorretionAttr.stPMFAttr.stDestSize.u32Height = 1080;
s32Ret = HI_MPI_VI_SetStitchCorrectionAttr(ViRightChn, &stCorretionAttr);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
VpssGrp = 0;
stVpssGrpAttr.u32MaxW = 3600;
stVpssGrpAttr.u32MaxH = 1080;
stVpssGrpAttr.bIeEn = HI_FALSE;
stVpssGrpAttr.bNrEn = HI_TRUE;
stVpssGrpAttr.stNrAttr.enNrType = VPSS_NR_TYPE_VIDEO;
stVpssGrpAttr.stNrAttr.stNrVideoAttr.enNrRefSource = VPSS_NR_REF_FROM_RFR;
stVpssGrpAttr.stNrAttr.u32RefFrameNum = 2;
stVpssGrpAttr.bHistEn = HI_FALSE;
stVpssGrpAttr.bDciEn = HI_FALSE;
stVpssGrpAttr.enDieMode = VPSS_DIE_MODE_NODIE;
stVpssGrpAttr.enPixFmt = SAMPLE_PIXEL_FORMAT;
stVpssGrpAttr.bStitchBlendEn = HI_TRUE;
stVpssGrpAttr.enStitchBlendMode = VPSS_STITCH_BLEND_ADJUST;
stVpssGrpAttr.stStitchBlendAttr.u32OutWidth = 3600;
stVpssGrpAttr.stStitchBlendAttr.u32OutHeight = 1080;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[0].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[0].s32Y = 0;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[1].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[1].s32Y = 0;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[2].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[2].s32Y = 1079;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[3].s32X = 1680;
stVpssGrpAttr.stStitchBlendAttr.stOverlapPoint[3].s32Y = 1079;
s32Ret = SAMPLE_COMM_VPSS_StartGroup(VpssGrp, &stVpssGrpAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Vpss failed!\n");
goto END_VENC_1080P_CLASSIC_2;
}
stSrcChn.enModId = HI_ID_VIU;
stSrcChn.s32DevId = 0;
stSrcChn.s32ChnId = ViLeftChn;
stDestChn.enModId = HI_ID_VPSS;
stDestChn.s32DevId = 0;
stDestChn.s32ChnId = 0;
s32Ret = HI_MPI_SYS_Bind(&stSrcChn, &stDestChn);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
stSrcChn.enModId = HI_ID_VIU;
stSrcChn.s32DevId = 0;
stSrcChn.s32ChnId = ViRightChn;
stDestChn.enModId = HI_ID_VPSS;
stDestChn.s32DevId = 0;
stDestChn.s32ChnId = 1;
s32Ret = HI_MPI_SYS_Bind(&stSrcChn, &stDestChn);
if (s32Ret != HI_SUCCESS)
{
return s32Ret;
}
s32Ret = HI_MPI_VPSS_GetStitchBlendParam(VpssGrp, &stStitchBlendParam);
if (HI_SUCCESS != s32Ret)
{
return s32Ret;
}
stStitchBlendParam.stAdjustParam.u32BldRange = 10;
stStitchBlendParam.stAdjustParam.u32BldPosition = 30;
s32Ret = HI_MPI_VPSS_SetStitchBlendParam(VpssGrp, &stStitchBlendParam);
if (HI_SUCCESS != s32Ret)
{
return s32Ret;
}
VpssChn = 0;
stVpssChnMode.enChnMode = VPSS_CHN_MODE_USER;
stVpssChnMode.bDouble = HI_FALSE;
stVpssChnMode.enPixelFormat = SAMPLE_PIXEL_FORMAT;
stVpssChnMode.u32Width = 3600;
stVpssChnMode.u32Height = 1080;
stVpssChnMode.enCompressMode = COMPRESS_MODE_SEG;
memset(&stVpssChnAttr, 0, sizeof(stVpssChnAttr));
stVpssChnAttr.s32SrcFrameRate = 25;//-1;
stVpssChnAttr.s32DstFrameRate = 25;//-1;
s32Ret = SAMPLE_COMM_VPSS_EnableChn(VpssGrp, VpssChn, &stVpssChnAttr, &stVpssChnMode, HI_NULL);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Enable vpss chn failed!\n");
goto END_VENC_1080P_CLASSIC_4;
}
/******************************************
step 5: start stream venc
******************************************/
VpssGrp = 0;
VpssChn = 0;
VencChn = 0;
s32Ret = SAMPLE_COMM_VENC_GetGopAttr(enGopMode[0],&stGopAttr,gs_enNorm);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Get GopAttr failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
s32Ret = SAMPLE_COMM_VENC_Start(VencChn, enPayLoad[0],\
gs_enNorm, enSize[0], enRcMode,u32Profile,&stGopAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
//yxw
s32Ret = HI_MPI_VENC_SetMaxStreamCnt(VencChn,1);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
s32Ret = SAMPLE_COMM_VENC_BindVpss(VencChn, VpssGrp, VpssChn);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
/******************************************
step 6: stream venc process -- get stream, then save it to file.
******************************************/
s32Ret = SAMPLE_COMM_VENC_StartGetStream(s32ChnNum);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Start Venc failed!\n");
goto END_VENC_1080P_CLASSIC_5;
}
/****live555 start*****/
live555_rtsp();
while(1)
{
sleep(10);
}
printf("please press twice ENTER to exit this sample\n");
getchar();
getchar();
//sleep(20000);
/******************************************
step 7: exit process
******************************************/
SAMPLE_COMM_VENC_StopGetStream();
END_VENC_1080P_CLASSIC_5:
VpssGrp = 0;
switch(s32ChnNum)
{
case 2:
VpssChn = 1;
VencChn = 1;
SAMPLE_COMM_VENC_UnBindVpss(VencChn, VpssGrp, VpssChn);
SAMPLE_COMM_VENC_Stop(VencChn);
case 1:
VpssChn = 0;
VencChn = 0;
SAMPLE_COMM_VENC_UnBindVpss(VencChn, VpssGrp, VpssChn);
SAMPLE_COMM_VENC_Stop(VencChn);
break;
}
SAMPLE_COMM_VI_UnBindVpss(stViConfig.enViMode);
END_VENC_1080P_CLASSIC_4: //vpss stop
VpssGrp = 0;
switch(s32ChnNum)
{
case 2:
VpssChn = 1;
SAMPLE_COMM_VPSS_DisableChn(VpssGrp, VpssChn);
case 1:
VpssChn = 0;
SAMPLE_COMM_VPSS_DisableChn(VpssGrp, VpssChn);
break;
}
END_VENC_1080P_CLASSIC_3: //vpss stop
SAMPLE_COMM_VI_UnBindVpss(stViConfig.enViMode);
END_VENC_1080P_CLASSIC_2: //vpss stop
SAMPLE_COMM_VPSS_StopGroup(VpssGrp);
END_VENC_1080P_CLASSIC_1: //vi stop
SAMPLE_COMM_VI_StopVi(&stViConfig);
END_VENC_1080P_CLASSIC_0: //system exit
SAMPLE_COMM_SYS_Exit();
return s32Ret;
}
vpss调试信息如下:
我来回答
回答1个
时间排序
认可量排序
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2018-10-19 20:25:13
-
2020-04-07 11:21:47
-
2019-09-19 10:44:02
-
2018-08-20 17:10:00
-
2018-12-19 11:24:06
-
2018-12-19 11:24:29
-
2023-02-08 12:02:39
-
2017-11-13 15:29:50
-
2019-10-18 17:50:56
-
2017-11-29 19:36:43
-
2019-04-13 17:16:08
-
2019-06-13 20:17:32
-
2018-11-01 17:57:37
-
2019-10-07 20:19:34
-
2019-04-19 10:09:24
-
2018-07-25 14:36:24
-
2017-10-19 17:54:47
-
2019-03-19 16:17:31
-
2017-07-20 11:07:35
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认