CVBR VS VBR VS CBR on DM365 H264 encode

Hi All:

As we know DM365 H264 encode support several kinds of bit rate control algorithm, copy the link here:

http://processors.wiki.ti.com/index.php/DM36x_Rate_Control_Modes

I have tried the CVBR, VBR and CBR base on this guide and I found that the real bit rate is very close to the target bit rate when I try to switch the camera between simple and complex scene, it's reasonable for CBR mode, but for CVBR and VBR I suppose the bit rate should be changed base on the scene, right? In face the real bit rate will be always between 90%~110% of the target bit rate.

I have also tired use Fix Qp mode under the different scene and the bit rate in simple scene is about 500Kbps, but in complex scene, it reach to 2~4Mbps.

Is there any way to enlarge the bit rate range for CVBR and VBR mode? I think it's almost same as CBR mode.

What I want is:

1. Bit rate should be changed base on the scene, in some simple scene, the bit rate should be very low for save bandwidth.

2. The maximum bit rate should be in control, you know the bit rate is out of control under Fix Qp mode.

Any one who can help on this?

Thanks in advance!

  • Hi Tracy,

    Ideally in complex scenes VBR should take more bits than CBR. Can you please share Rate control related params?

    CVBR rcalgo has  more parameter('maxBitrateCVBR, CVBRsensitivity, CVBRminbitrate, maxHighCmpxIntCVBR) to control bits to be take for complex scenes. are you setting all params.? you need to set all parameters with default values or intended values.

    You can also customize rate control(all rcalgo's CBR, VBR, etc...) behavior by setting "LBRmaxpicsize" parameter. Please have look userguide for more info.

    Regarding bitrate control in FIXED Qp mode is not possible, it will purely based on scene. Qp is the param which will control bits, but in this mode its not allowed vary, so Fixed Qp mode behavior will be depends on video content

    Thanks,

    Veeranna

  • In reply to Veeranna Hanchinal:

    Hi Veeranna:

    Appreciate for you response, I have tried update some parameters as below under CVBR mode:

        rateControlPreset=2
        maxBitRate=12000000
        rcAlgo = 3
        airRate=0
        intraFrameQP=28
        interPFrameQP=28
        initQ=28
        rcQMax=42
        rcQMin=1
        rcQMaxI=42
        rcQMinI=1
        maxDelay=2000
        aspectRatioX=1
        aspectRatioY=1
        lfDisableIdc=0
        enableBufSEI=0
        enablePicTimSEI=0
        idrFrameInterval=10
        perceptualRC=1
        mvSADoutFlag=0
        resetHDVICPeveryFrame=2
        enableROI=1
        metaDataGenerateConsume=0
        maxBitrateCVBR=4194304
        interlaceRefMode=0
        enableGDR=0
        GDRduration=0
        GDRinterval=0
        LongTermRefreshInterval=0
        UseLongTermFrame=0
        SetLongTermFrame=0
        CustomScaleMatrix_Buffer=0
        CVBRsensitivity=8
        CVBRminbitrate=262144
        LBRmaxpicsize=250
        LBRminpicsize=0
        LBRskipcontrol=327684
        maxHighCmpxIntCVBR=30
        disableMVDCostFactor=0
        putDataGetSpaceFxn=0
        dataSyncHandle =0

    I want to make the CVBR close to Fix QP mode, which can encode at a very low bit rate when scene is simple and bitrate is high when scene is complex, any suggestion for this?
     

  • In reply to Tracy lee:

    Hi

    Please set rateControlPreset=5, set Qpmin to 8. And do you need IDR frame interval as 10( it iis very less and IDR frame will consume more bits). And are you using ROI? and also try by increasing maxBitRateCVBR. Whats the targetbitrate?

  • In reply to Veeranna Hanchinal:

    Hi Veeranna:

             Thanks for you update, I have tried the H264 encode base on your suggestion, the real bitrate will alwayed changed in 1900Kbps~2100Kbps, list the prameters for you reference:

        intraFrameInterval=0
        forceFrame=-1
        rcAlgo=5
        videncDynamicParams.forceFrame=-1
        sliceSize=45
        airRate=0
        intraFrameQP=28
        interPFrameQP=28
        initQ=28
        rcQMax=42
        rcQMin=8
        rcQMaxI=42
        intraFrameInterval=0
        targetBitRate=2000000
        forceFrame=-1
        rcAlgo=5
        videncDynamicParams.forceFrame=-1
        sliceSize=45
        airRate=0
        intraFrameQP=28
        interPFrameQP=28
        initQ=28
        rcQMax=42
        rcQMin=8
        rcQMaxI=42
        rcQMinI=8
        maxDelay=2000
        aspectRatioX=1
        aspectRatioY=1
        lfDisableIdc=0
        enableBufSEI=0
        enablePicTimSEI=0
        idrFrameInterval=60
        perceptualRC=1
        mvSADoutFlag=0
        resetHDVICPeveryFrame=2
        enableROI=1
        metaDataGenerateConsume=0
        maxBitrateCVBR=8000000
        interlaceRefMode=0
        enableGDR=0
        GDRduration=0
        GDRinterval=0
        LongTermRefreshInterval=0
        UseLongTermFrame=0
        SetLongTermFrame=0
        CustomScaleMatrix_Buffer=0
        CVBRsensitivity=8
        CVBRminbitrate=500000
        LBRmaxpicsize=250
        LBRminpicsize=0
        LBRskipcontrol=327684
        maxHighCmpxIntCVBR=30
        disableMVDCostFactor=0
        putDataGetSpaceFxn=0
        dataSyncHandle =0

    Any suggestion about this?

    Thanks.

  • In reply to Tracy lee:

    Hi Tracy,

    we wanted change rateControlPreset = 5 not rcAlgo. You need to set rateControlPreset to USER_DEFINED than only rcAlgo will have meaning. If you are setting rateControlPreset=2, means rate control Algo will be VBR. so CVBR algo is not running.

    rateControlPreset = 5 (USER_DEFINED)

    rcAlgo = 3 (CVBR)

    Please refer userguide if you have doubt on settings.

    Thanks,

    Veeranna

  • In reply to Veeranna Hanchinal:

    Hi Veeranna:

          Thanks for you quick response, the rateControlPreset is 5 in previous test (it's default value in SDK 2.6), I have tried update the rcAlgo to 3 and test again, the real bit rate is still very close to the target bit rate, copy the parameters here:

        intraFrameInterval=0
        targetBitRate=2000000
        forceFrame=-1
        rcAlgo=3
        videncDynamicParams.forceFrame=-1
        sliceSize=45
        airRate=0
        intraFrameQP=28
        interPFrameQP=28
        initQ=28
        rcQMax=42
        rcQMin=8
        rcQMaxI=42
        rcQMinI=8
        maxDelay=2000
        aspectRatioX=1
        aspectRatioY=1
        lfDisableIdc=0
        enableBufSEI=0
        enablePicTimSEI=0
        idrFrameInterval=60
        perceptualRC=1
        mvSADoutFlag=0
        resetHDVICPeveryFrame=2
        enableROI=1
        metaDataGenerateConsume=0
        maxBitrateCVBR=8000000
        interlaceRefMode=0
        enableGDR=0
        GDRduration=0
        GDRinterval=0
        LongTermRefreshInterval=0
        UseLongTermFrame=0
        SetLongTermFrame=0
        CustomScaleMatrix_Buffer=0
        CVBRsensitivity=8
        CVBRminbitrate=500000
        LBRmaxpicsize=250
        LBRminpicsize=0
        LBRskipcontrol=327684
        maxHighCmpxIntCVBR=30
        disableMVDCostFactor=0
        putDataGetSpaceFxn=0
        dataSyncHandle =0

    Attched my test scene for reference:

  • In reply to Tracy lee:

    Hi Tracy,

    Set maxHighCmpxIntCVBR=0 and change CVBRsensitivity according to your requiremnt.

    Here attaching bitrate variaiton image for maxHighCmpxIntCVBR=0 and CVBRsensitivity = 4.

    Thanks,

    Veeranna

  • In reply to Veeranna Hanchinal:

    Hi Tracy,

    Do you able to get desired behavior with CVBR?

    Thanks,

    Veeranna

  • In reply to Veeranna Hanchinal:

    Hi Veeranna:

                  Sorry for the late response, I have tried the parameters under your suggestion, when switched between the simple and complex scene, the bit rate still don't changed much(close to 2Mbps), from the attched picture, seems the real bit rate increased more than double, right? Could you share you simple and complex scene for reference?

                  Attched some parameters from debug code for reference:

        encodingPreset=1
        rateControlPreset=5,
        maxHeight=480, maxWidth=640, maxFrameRate=60000,
        maxBitRate=12000000, dataEndianness=1, maxInterFrameInterval=1,
        inputChromaFormat=9, inputContentType=0,
        reconChromaFormat=9,
        pObj->params_h264.profileIdc=66,
        pObj->params_h264.levelIdc=31,
        pObj->params_h264.Log2MaxFrameNumMinus4=0,
        pObj->params_h264.ConstraintSetFlag=0,
        pObj->params_h264.entropyMode=0,
        pObj->params_h264.transform8x8FlagIntraFrame=0,
        pObj->params_h264.transform8x8FlagInterFrame=0,
        pObj->params_h264.enableVUIparams=4,
        pObj->params_h264.meAlgo=0,
        pObj->params_h264.seqScalingFlag=0,
        pObj->params_h264.enableARM926Tcm=0,
        pObj->params_h264.enableDDRbuff=0,
        pObj->params_h264.sliceMode=0,
        pObj->params_h264.EnableLongTermFrame=0,
        pObj->params_h264.outputDataMode=1,
        pObj->params_h264.sliceFormat=1,
        pObj->params_h264.transform8x8FlagIntraFrame=0,
        pObj->params_h264.transform8x8FlagInterFrame=0,
        pObj->params_h264.seqScalingFlag=0,
        pObj->params_h264.entropyMode=0,
        pObj->params_h264.encQuality=2,
        pObj->params_h264.numTemporalLayers=0,
        pObj->params_h264.svcSyntaxEnable=0

        intraFrameInterval=0
        targetBitRate=2000000
        forceFrame=3
        rcAlgo=3
        videncDynamicParams.forceFrame=3
        sliceSize=30
        airRate=0
        intraFrameQP=28
        interPFrameQP=28
        initQ=28
        rcQMax=42
        rcQMin=8
        rcQMaxI=42
        rcQMinI=8
        maxDelay=2000
        aspectRatioX=1
        aspectRatioY=1
        lfDisableIdc=0
        enableBufSEI=0
        enablePicTimSEI=0
        idrFrameInterval=60
        perceptualRC=1
        mvSADoutFlag=0
        resetHDVICPeveryFrame=2
        enableROI=1
        metaDataGenerateConsume=0
        maxBitrateCVBR=8000000
        interlaceRefMode=0
        enableGDR=0
        GDRduration=0
        GDRinterval=0
        LongTermRefreshInterval=0
        UseLongTermFrame=0
        SetLongTermFrame=0
        CustomScaleMatrix_Buffer=0
        CVBRsensitivity=4     // Also tried 4, 6, 8
        CVBRminbitrate=500000
        LBRmaxpicsize=250
        LBRminpicsize=0
        LBRskipcontrol=327684
        maxHighCmpxIntCVBR=0
        disableMVDCostFactor=0
        putDataGetSpaceFxn=0
        dataSyncHandle =0

  • In reply to Tracy lee:

    Hi

    YUV size will be huge to upload. This YUV sequence has one person standing close to camera, and steady for some time, later he starts waving his hand and head. You can create such sequence easily.

    And are you using ROI? can you disable and try?