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.

TDA2PXEVM: Encoder generates IDR frame only once

Part Number: TDA2PXEVM

Hi,

I am using Vision SDK 03.07.00.00. I am trying to encode a 1280x720 YUV420SP video. I observe the encoder generates IDR frame once at the beginning, while I want it to repeat IDR frame in every 30 frames. Here is my encoder settings:

encPrm->format = SYSTEM_IVIDEO_H264HP;
encPrm->profile = 100;
encPrm->maxBitRate = -1;

encPrm->dataLayout = VENC_FIELD_SEPARATED;
encPrm->fieldMergeEncodeEnable = FALSE;
encPrm->enableAnalyticinfo = 0;
encPrm->enableWaterMarking = 0;
encPrm->encodingPreset = SYSTEM_XDM_USER_DEFINED;

encPrm->rateControlPreset = SYSTEM_IVIDEO_USER_DEFINED;
encPrm->enableHighSpeed = FALSE;
encPrm->enableSVCExtensionFlag = FALSE;
encPrm->numTemporalLayer = 0;
encPrm->overrideInputScanFormat= 0;
encPrm->fieldPicEncode = 0;
encPrm->IDRFrameInterval = 1;

encPrm->defaultDynamicParams.intraFrameInterval = 30;
encPrm->defaultDynamicParams.targetBitRate = 2500000;
encPrm->defaultDynamicParams.interFrameInterval = 1;
encPrm->defaultDynamicParams.mvAccuracy = SYSTEM_IVIDENC2_MOTIONVECTOR_QUARTERPEL;
encPrm->defaultDynamicParams.inputFrameRate = 30;
encPrm->defaultDynamicParams.rcAlg = VENC_RATE_CTRL_CBR;
encPrm->defaultDynamicParams.qpMin = 0;
encPrm->defaultDynamicParams.qpMax = 51;
encPrm->defaultDynamicParams.qpInit = 25;
encPrm->defaultDynamicParams.vbrDuration = 8;
encPrm->defaultDynamicParams.vbrSensitivity = 0;
encPrm->defaultDynamicParams.maxPicSizeRatioI = 30; //640

Could you please let me know if any change I have to do in the above settings?

Thanks

  • Hi Prashanth,

    I followed these threads and as per your recommendation just set following attributes:

    encPrm->format = SYSTEM_IVIDEO_H264HP;
    encPrm->profile = 100;
    encPrm->maxBitRate = -1;
    encPrm->IDRFrameInterval = 1;
    encPrm->defaultDynamicParams.intraFrameInterval = 30;
    encPrm->defaultDynamicParams.interFrameInterval = 1;

    The encoder returns following error:

    [IPU1-0] 40.157262 s: ENCODE: ERROR: ALGPROCESS FAILED (status=0xffffffff) !!!
    [IPU1-0] 40.157445 s: ENCODE: ERROR in Enclink_h264EncodeFrame.Status[-1]
    [IPU1-0] 40.190599 s: ENCODE: ERROR: ALGPROCESS FAILED (status=0xffffffff) !!!
    [IPU1-0] 40.190691 s: ENCODE: ERROR in Enclink_h264EncodeFrame.Status[-1]
    [IPU1-0] 40.223906 s: ENCODE: ERROR: ALGPROCESS FAILED (status=0xffffffff) !!!

    However, one observation if I just set following:

    encPrm->format = SYSTEM_IVIDEO_H264HP;
    encPrm->profile = 100;
    encPrm->maxBitRate = -1;
    encPrm->defaultDynamicParams.intraFrameInterval = 30;
    encPrm->defaultDynamicParams.targetBitRate = 2500000;
    encPrm->IDRFrameInterval = 1;
    encPrm->defaultDynamicParams.interFrameInterval = 1;
    encPrm->defaultDynamicParams.inputFrameRate = 30;

    I get encoded stream as follows:

    SPS PPS IDR P P P ... I P P P ... I P P P ...

    But my requirement is to get an encoded stream like this:

    SPS PPS IDR P P P ... SPS PPS IDR P P P ... SPS PPS IDR P P P ...

    Thanks

    Regards,

    Suman

     

  • Hi Suman,

    Can you print the extendedError here?

    Suman Karmakar said:

    The encoder returns following error:

    [IPU1-0] 40.157262 s: ENCODE: ERROR: ALGPROCESS FAILED (status=0xffffffff) !!!
    [IPU1-0] 40.157445 s: ENCODE: ERROR in Enclink_h264EncodeFrame.Status[-1]
    [IPU1-0] 40.190599 s: ENCODE: ERROR: ALGPROCESS FAILED (status=0xffffffff) !!!
    [IPU1-0] 40.190691 s: ENCODE: ERROR in Enclink_h264EncodeFrame.Status[-1]
    [IPU1-0] 40.223906 s: ENCODE: ERROR: ALGPROCESS FAILED (status=0xffffffff) !!!

    Yes, I got your point. There might be some parameter going wrong. Setting IDRFrameInterval = 1(which you already have done), should serve your need.

    Suman Karmakar said:

    However, one observation if I just set following:

    encPrm->format = SYSTEM_IVIDEO_H264HP;
    encPrm->profile = 100;
    encPrm->maxBitRate = -1;
    encPrm->defaultDynamicParams.intraFrameInterval = 30;
    encPrm->defaultDynamicParams.targetBitRate = 2500000;
    encPrm->IDRFrameInterval = 1;
    encPrm->defaultDynamicParams.interFrameInterval = 1;
    encPrm->defaultDynamicParams.inputFrameRate = 30;

    I get encoded stream as follows:

    SPS PPS IDR P P P ... I P P P ... I P P P ...

    But my requirement is to get an encoded stream like this:

    SPS PPS IDR P P P ... SPS PPS IDR P P P ... SPS PPS IDR P P P ...

    If you can share all the parameter(static & dynamic) used by you, we can check it.

  • Prashanth,

    I just set the following parameters other than the default one set by EncLink_CreateParams_Init():

    encPrm->format = SYSTEM_IVIDEO_H264HP;
    encPrm->profile = 100;
    encPrm->maxBitRate = -1;
    encPrm->defaultDynamicParams.intraFrameInterval = 30;
    encPrm->defaultDynamicParams.targetBitRate = 2500000;
    encPrm->IDRFrameInterval = 1;
    encPrm->defaultDynamicParams.interFrameInterval = 1;
    encPrm->defaultDynamicParams.inputFrameRate = 30; 

    And fyi, the encoder input is 1280x720 yuv420sp @30fps

    Thanks

    Regards,

    Suman

  • Suman,

    With the above parameters, I am able to encode all I as IDR frames in my standalone setup. Here are sample config file and the snap shots showing IDR frames as SPS PPS IDR P P P ... SPS PPS IDR P P P ... SPS PPS IDR P P P ...

    Can you dump and share your encoded bitstream? 


     


     

    Attached the configuration file used by me to generate above bitstream.

    sample.cfg

  • I dont know where is the gap between our setups. I am on Vision SDK 03.07.00.00 and using Video Encode Link to encode 1280x720 raw video comes from ISS M2M ISP Link. Could it be different IVA-HD firmware version? Please find attached the encoded stream dump with the above settings. 

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/Capture_5F00_1280x720_5F00_30.7z 

    Thanks

    Regards,

    Suman

  • Hi Suman,

    Can you verify the h.264 encoder version in your SDK? Latest codec version is 02.00.09.01

    Also, can you set encPrm->defaultDynamicParams.maxPicSizeRatioI = 30; //640 to default value and check? If this doesn't help you need to print & share the parameters after setting them to verify if anything is going wrong.

    I will analyse the stream and revert to you.

  • Hi Prashanth,

    I am using codec version 02.00.09.01.

    Here is the parameter values I set:

    [IPU1-0] 13.470505 s: chCreateParams [0].format = 9
    [IPU1-0] 13.470566 s: chCreateParams [0].profile = 100
    [IPU1-0] 13.470627 s: chCreateParams [0].dataLayout = 1
    [IPU1-0] 13.470719 s: chCreateParams [0].fieldMergeEncodeEnable = 0
    [IPU1-0] 13.470780 s: chCreateParams [0].enableAnalyticinfo = 0
    [IPU1-0] 13.470871 s: chCreateParams [0].enableWaterMarking = 0
    [IPU1-0] 13.471176 s: chCreateParams [0].maxBitRate = -1
    [IPU1-0] 13.471268 s: chCreateParams [0].encodingPreset = 0
    [IPU1-0] 13.471329 s: chCreateParams [0].rateControlPreset = 0
    [IPU1-0] 13.471390 s: chCreateParams [0].enableHighSpeed = 0
    [IPU1-0] 13.471481 s: chCreateParams [0].enableSVCExtensionFlag = 0
    [IPU1-0] 13.471542 s: chCreateParams [0].numTemporalLayer = 0
    [IPU1-0] 13.471634 s: chCreateParams [0].defaultDynamicParams.intraFrameInterval = 30
    [IPU1-0] 13.471725 s: chCreateParams [0].defaultDynamicParams.targetBitRate = 2500000
    [IPU1-0] 13.471817 s: chCreateParams [0].defaultDynamicParams.interFrameInterval = 1
    [IPU1-0] 13.471878 s: chCreateParams [0].defaultDynamicParams.mvAccuracy = 0
    [IPU1-0] 13.472000 s: chCreateParams [0].defaultDynamicParams.inputFrameRate = 30
    [IPU1-0] 13.472091 s: chCreateParams [0].defaultDynamicParams.rcAlg = 0
    [IPU1-0] 13.472152 s: chCreateParams [0].defaultDynamicParams.qpMin = 0
    [IPU1-0] 13.472244 s: chCreateParams [0].defaultDynamicParams.qpMax = 0
    [IPU1-0] 13.472335 s: chCreateParams [0].defaultDynamicParams.qpInit = 0
    [IPU1-0] 13.472396 s: chCreateParams [0].defaultDynamicParams.vbrDuration = 0
    [IPU1-0] 13.472488 s: chCreateParams [0].defaultDynamicParams.vbrSensitivity = 0
    [IPU1-0] 13.472579 s: chCreateParams [0].defaultDynamicParams.maxPicSizeRatioI = 640
    [IPU1-0] 13.472671 s: chCreateParams [0].overrideInputScanFormat = 0
    [IPU1-0] 13.472732 s: chCreateParams [0].fieldPicEncode = 0
    [IPU1-0] 13.472823 s: chCreateParams [0].IDRFrameInterval = 1

    Thanks

    Regards,

    Suman

     

  • Suman,

    Can you check why are the values set to 0, even after setting them to USER_DEFINED.

    ex: [IPU1-0] 13.471268 s: chCreateParams [0].encodingPreset = 0
          [IPU1-0] 13.471329 s: chCreateParams [0].rateControlPreset = 0

    Why is [IPU1-0] 13.471542 s: chCreateParams [0].numTemporalLayer = 0? Can you set it to 1.

    If you set these parameters in sample config file it should work. attaching it again 0743.sample.cfg

    If you get any error, please print the videnc2OutArgs.extendedError and share it with me.

  • Hi Prashanth,

    Its not the input settings, the issue was there in the Video Encode Link implementation inside VisionSDK 03.07.00.00 and also there in 03.08.00.00

    The user supplied "IDRFrameInterval" value is never used during encoder initialization. I added the following line at the end of enclink_codec_set_ch_alg_create_params() function in encLink_common.c, 

    rebuilt everything and it started working!

    pChAlgCreatePrm->IDRFrameInterval = pChCreatePrm->IDRFrameInterval;

    Thanks for your support!

    Regards,

    Suman 

     

  • Suman,

    Good to know its resolved. We are from codec team. Will update the same to respective team to take care of this issue.

    Thanks.