天最

天最

1个粉丝

52

问答

0

专栏

2

资料

天最  发布于  2018-10-20 15:38:33
采纳率 0%
52个问答
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调试信息如下:


我来回答
回答1个
时间排序
认可量排序

qn1535097110

1个粉丝

21

问答

0

专栏

1

资料

qn1535097110 2019-01-16 13:46:38
认可0
直接用sample里面的列子就行了
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
相关问答
无更多相似问答 去提问
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区