• hi3531的h264压缩中改动波特率


    typedef struct hiVENC_ATTR_H264_CBR_S
    {
    HI_U32 u32Gop;
    HI_U32 u32StatTime;
    HI_U32 u32ViFrmRate;
    HI_FR32 fr32TargetFrmRate;
    HI_U32 u32BitRate;
    HI_U32 u32FluctuateLevel;
    } VENC_ATTR_H264_CBR_S;

    u32BitRate 平均bitrate。以kbps 为单位。
    取值范围:[2, 40960]。

    HI_S32 SAMPLE_COMM_VENC_Start(VENC_GRP VencGrp,VENC_CHN VencChn, PAYLOAD_TYPE_E enType, VIDEO_NORM_E enNorm, PIC_SIZE_E enSize, SAMPLE_RC_E enRcMode)
    {
        HI_S32 s32Ret;
        VENC_CHN_ATTR_S stVencChnAttr;
        VENC_ATTR_H264_S stH264Attr;
        VENC_ATTR_H264_CBR_S    stH264Cbr;
        VENC_ATTR_H264_VBR_S    stH264Vbr;
        VENC_ATTR_H264_FIXQP_S  stH264FixQp;
        VENC_ATTR_MJPEG_S stMjpegAttr;
        VENC_ATTR_MJPEG_FIXQP_S stMjpegeFixQp;
        VENC_ATTR_JPEG_S stJpegAttr;
        SIZE_S stPicSize;

        s32Ret = SAMPLE_COMM_SYS_GetPicSize(enNorm, enSize, &stPicSize);
         if (HI_SUCCESS != s32Ret)
        {
            SAMPLE_PRT("Get picture size failed! ");
            return HI_FAILURE;
        }
        /******************************************
         step 1: Greate Venc Group
        ******************************************/
        s32Ret = HI_MPI_VENC_CreateGroup(VencGrp);
        if (HI_SUCCESS != s32Ret)
        {
            SAMPLE_PRT("HI_MPI_VENC_CreateGroup[%d] failed with %#x! ",
                     VencGrp, s32Ret);
            return HI_FAILURE;
        }

        /******************************************
         step 2:  Create Venc Channel
        ******************************************/
        stVencChnAttr.stVeAttr.enType = enType;
        switch(enType)
        {
            case PT_H264:
            {
                stH264Attr.u32MaxPicWidth = stPicSize.u32Width;
                stH264Attr.u32MaxPicHeight = stPicSize.u32Height;
                stH264Attr.u32PicWidth = stPicSize.u32Width;/*the picture width*/
                stH264Attr.u32PicHeight = stPicSize.u32Height;/*the picture height*/
                stH264Attr.u32BufSize  = stPicSize.u32Width * stPicSize.u32Height * 2;/*stream buffer size*/
                stH264Attr.u32Profile  = 0;/*0: baseline; 1:MP; 2:HP   ? */
                stH264Attr.bByFrame = HI_TRUE;/*get stream mode is slice mode or frame mode?*/
                stH264Attr.bField = HI_FALSE;  /* surpport frame code only for hi3516, bfield = HI_FALSE */
                stH264Attr.bMainStream = HI_TRUE; /* surpport main stream only for hi3516, bMainStream = HI_TRUE */
                stH264Attr.u32Priority = 0; /*channels precedence level. invalidate for hi3516*/
                stH264Attr.bVIField = HI_FALSE;/*the sign of the VI picture is field or frame. Invalidate for hi3516*/
                memcpy(&stVencChnAttr.stVeAttr.stAttrH264e, &stH264Attr, sizeof(VENC_ATTR_H264_S));

                if(SAMPLE_RC_CBR == enRcMode)
                {
                    stVencChnAttr.stRcAttr.enRcMode = VENC_RC_MODE_H264CBR;
                    stH264Cbr.u32Gop            = (VIDEO_ENCODING_MODE_PAL== enNorm)?25:30;
                    stH264Cbr.u32StatTime       = 1; /* stream rate statics time(s) */
                    stH264Cbr.u32ViFrmRate      = (VIDEO_ENCODING_MODE_PAL== enNorm)?

    25:30;/* input (vi) frame rate */
                    stH264Cbr.fr32TargetFrmRate = (VIDEO_ENCODING_MODE_PAL== enNorm)?25:30;/* target frame rate */
                    switch (enSize)
                    {
                      case PIC_QCIF:
                        stH264Cbr.u32BitRate = 256; /* average bit rate */
                        break;
                      case PIC_QVGA:    /* 320 * 240 */
                      case PIC_CIF: 

                        stH264Cbr.u32BitRate = 512;
                           break;

                      case PIC_D1:
                      case PIC_VGA:    /* 640 * 480 */
                        stH264Cbr.u32BitRate = 1024*2;
                           break;
                      case PIC_HD720:   /* 1280 * 720 */
                        stH264Cbr.u32BitRate = 1024*3;
                        break;
                      case PIC_HD1080:  /* 1920 * 1080 */
                          stH264Cbr.u32BitRate = 1024*6;
                        break;
                      default :
                           stH264Cbr.u32BitRate = 1024*4;
                           break;
                    }

  • 相关阅读:
    删除表空间的时候遇到的问题:ORA-02429: 无法删除用于强制唯一/主键的索引
    删除
    Activity中使用getSystemService获得系统服务
    用多线程实现反应灵敏的界面(Java)
    用数组实现3个栈之固定分割(Java)
    Android小知识点20条
    Android数据库中数据文件的导出与查看
    MFC中使用CSplitterWnd分割窗口后设置视图大小的问题
    MFC中,通过preCreateWindow函数无法设置视图样式(包括窗口的大小)
    6:Node.js 路由
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5245594.html
Copyright © 2020-2023  润新知