This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320DM368: Relation of H.264enc intra, IDR, GDR interval & gdrduration parameters

Part Number: TMS320DM368

When setting GDR in our encoder (DM368 IPNC, Platinum encoder 02.30.00.xx) we are getting XDM Errors "IH264VENC_ERR_GDRDURATION" even though the GDR Duration parameter is within bounds according to the encoder manual.

It seems to be related to iFrame / IDRFrame interval setting but I can find no documentation or forum posts that explain the relationship or constraints here.

Can someone explain what the Iframe/IDRframe interactions are when using GDR?

  • Hi,
    Can you please share all your encoder parameter settings and also the version of h264 encoder you are using. The latest GAed version is 02.30.00.06. You can upgrade to same from here, if you are using older versions. software-dl.ti.com/.../index_FDS.html
  • Hi,

    Fridgefreezer said:
    When setting GDR in our encoder (DM368 IPNC, Platinum encoder 02.30.00.xx) we are getting XDM Errors "IH264VENC_ERR_GDRDURATION" even though the GDR Duration parameter is within bounds according to the encoder manual.

    Make sure 

    enableGDR = 1/2 based on your use case. 

    GDRduration < GDRinterval.

    Fridgefreezer said:

    It seems to be related to iFrame / IDRFrame interval setting but I can find no documentation or forum posts that explain the relationship or constraints here.

    Can someone explain what the Iframe/IDRframe interactions are when using GDR?

    When you use GDR, I/IDE frame interval will be always 0(zero). Only 1st Frame will be I/IDR frame. 

  • OK I've updated to the latest encoder (02.30.00.06, we were using 02.30.00.04) and rebuilt, no change to the error condition.

    As soon as GDRduration > idrFrameInterval the encoder stops with Extended Error: 41028/0xA044 IH264VENC_ERR_GDRDURATION.

    Here's our VE settings (from alg_vidEnc.c):

    Input W/H 1080/1920

    TargetBitRate 8000000

    captureWidth 1920

    targ/ref Framerate 30000 / 30000

    profileIdc=66

    levelIdc=42

    .intraFrameInterval=0

    _h264.idrFrameInterval=30

    enableVUIparams=4

    rateControlPreset=5

    Log2MaxFrameNumMinus4=5

    ConstraintSetFlag=0

    entropyMode=0

    transform8x8FlagIntraFrame=0

    transform8x8FlagInterFrame=0

    enableVUIparams=4

    meAlgo=0

    seqScalingFlag=0

    enableARM926Tcm=0

    enableDDRbuff=0

    EnableLongTermFrame=0

    outputDataMode=1

    sliceMode=0

    sliceFormat=1

    encodingPreset=2

    encodingPreset=XDM_HIGH_SPEED

    encQuality=3

    numTemporalLayers=0

    svcSyntaxEnable=0

    .forceFrame=3

    sliceSize = (1080/16)*100/100

    _h264.sliceSize=67

    _h264.airRate=0

    _h264.intraFrameQP=28

    _h264.interPFrameQP=28

    _h264.initQ=28

    _h264.rcQMax=51

    _h264.rcQMin=51

    _h264.rcQMaxI=42

    _h264.rcQMinI=1

    _h264.maxDelay=2000

    _h264.aspectRatioX=1

    _h264.aspectRatioY=1

    _h264.lfDisableIdc=0

    _h264.enableBufSEI=1

    _h264.enablePicTimSEI=1

    _h264.perceptualRC=1

    _h264.mvSADoutFlag=0

    _h264.resetHDVICPeveryFrame=0

    _h264.enableROI=1

    _h264.metaDataGenerateConsume=0

    _h264.interlaceRefMode=0

    _h264.enableGDR=2

    _h264.GDRduration=31

    _h264.GDRinterval=269

    _h264.LongTermRefreshInterval=0

    _h264.UseLongTermFrame=0

    _h264.SetLongTermFrame=0

    _h264.maxBitrateCVBR=12000000

    _h264.maxHighCmpxIntCVBR=0

    _h264.CVBRsensitivity=0

    _h264.CVBRminbitrate=0

    _h264.LBRmaxpicsize=50

    _h264.LBRminpicsize=0

    _h264.LBRskipcontrol=0x50004

    _h264.disableMVDCostFactor=0

    _h264.rcAlgo=1

  • Prashanth Kumar15 said:

    When you use GDR, I/IDE frame interval will be always 0(zero). Only 1st Frame will be I/IDR frame.

    Can you clarify this statement: Are you saying the I/IDR Interval MUST BE SET TO 0, or are you saying that enabling GDR has the effect of setting them to 0?

    The H.264 Encoder userguide makes no mention of this.

  • Let me try to clarify your doubt.
    1. GDR is used to refresh the whole frame without using I-frame. Yes, I/IDR interval should be set to 0.
    2. enableGDR = 1/2 (refer user guide).
    2. When you use GDR, Only 1st Frame will be I/IDR frame. rest all will be P-frames.
    3. For Ex. lets take, GDRduration = 10, and GDRinterval = 100.
    Here       IPPPP...............P........P.............P......P.................P.....P.........
    Frame# 12345...............100...110.........200...210............300...110
    Now, every 100,200,300 will be the GDR Interval(every 100th frame). So from Frame#100-110 whole frame will be refreshed. Similarly 200-210..... and so on.

  • Thanks Prashanth, that does clarify the operation. However, I have tried setting as your example:
    enableGDR = 2
    GDRInterval = 100
    GDRDuration = 10
    IFrame = 0
    IDR = 0

    And we cannot get a stream - there is no encoder error, but my theory is that WIS-Streamer is not getting any SPS/PPS from the encoder (no IDR) so the SDP is not generated and the stream cannot start.

    If I set IDRInterval = 30, it works fine and we can stream video.
  • Hi,

    Can you share the encoded stream?

    The SPS is sent from the encoder at every GDRinterval, but PPS is not. You can try to store the SPS,PPS- NAL(only IDR frame) at your frame work, and send it at GDRintervals. For now lets keep enableGDR = 1. 

  • It looks like the issue may lie in the Appro IPNC code, it seems to rely on having an I/IDR frame to lock a GOP and start streaming. For whatever reason, when I/IDR==0 it does not get an initial I/IDR frame despite what the encoder manual says.

    If I/IDR == 0 or >200 the Appro chain fails to lock a GOP, regardless of GDR setting. For the time being I don't think we can do much about this so we'll just have to limit the user's settings to avoid problems.


    As a follow-up to this, we see I & IDR frames out of sync even if we set I=IDR=30 for example we can see sometimes the stream will be something like:

    I-P-P-P-IDR-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-I-P-P-P-IDR-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P...

    Is this expected behaviour or have we configured something wrong? Would forcing an I/IDR at encoder start force it to sync up?

  • Hi,

    Fridgefreezer said:

    As a follow-up to this, we see I & IDR frames out of sync even if we set I=IDR=30 for example we can see sometimes the stream will be something like:

    I-P-P-P-IDR-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-I-P-P-P-IDR-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P-P...

    Is this expected behaviour or have we configured something wrong? Would forcing an I/IDR at encoder start force it to sync up?

    This is not the expected behaviour!. When I=IDR you should not see I. IDR overrides I. Can you run the same settings by disabling GDR(enableGDR=0)? And share your observation.

  • Prashanth,

    I think we have identified the cause: If you have I==IDR and START / RESTART the streaming then they are in sync.

    If you modify the dynamic parameters (I, IDR, framerate, maybe some others) then it can fall out of sync. Restarting streaming gets it back.

  • Hi,

    Great to know you have route caused the issue. Thanks for closing this thread.

  • Thanks for your help!