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.

DM6467T Videnc1_process takes 22ms that don't allow 60fps at output ! How can i perform a better time process ?

Hi all,

 

I'm working on encoding a 720p60 input on my DM6467T and i have to output a 720p60 H264 encoded.

My GST pipeline is :

gst-launch  ticapturesrc ! 'video/x-raw-yuv,width=(int)1280,height=(int)720,format=(fourcc)NV16,framerate=(fraction)                 
60/1' ! TIPrepEncBuf contiguousInputFrame=TRUE ! 'video/x-raw-yuv, width=1280, h                 
eight=720, format=(fourcc)NV12' ! TIVidenc1 contiguousInputFrame=TRUE codecName=                 
h264enc engineName=codecServer encondingPreset=3 rateControlPreset=2 intraFrame=30 bitRate=1000000                 
0 framerate=60/1 ! fakesink silent=true

EncodingPreset is set to High Speed and ratecontrolpreset to CBR (i made some modification but it's corresponding to this setup).

My CE_DEBUG output for the encoding process :

@27,405,674us: [+0 T:0x41710490 S:0x4170f5dc] OC - Comm_put> Enter(queue=0x2, msg=0x4272d900)
@27,405,843us: [+0 T:0x41710490 S:0x4170f5dc] OC - Comm_put> return (0)
@27,405,968us: [+0 T:0x41710490 S:0x4170f5d4] OC - Comm_get> Enter(queue=0x10001, msg=0x4170f68c, timeout=-1)
@27,427,893us: [+0 T:0x41710490 S:0x4170f5d4] OC - Comm_get> MSGQ_get() status=0x8000, return (0)
@27,428,052us: [+0 T:0x41710490 S:0x4170f564] OC - Comm_put> Enter(queue=0x0, msg=0x4272c900)
@27,428,229us: [+0 T:0x41710490 S:0x4170f564] OC - Comm_put> return (0)
@27,428,491us: [+0 T:0x41710490 S:0x4170f55c] OC - Comm_get> Enter(queue=0x10000, msg=0x4170f5fc, timeout=-1)
@27,428,650us: [+0 T:0x41710490 S:0x4170f55c] OC - Comm_get> MSGQ_get() status=0x8000, return (0)

The encoding process takes about 22ms and for "call-enconding-sourcing" it's about 30-33ms. So i just can output at 30fps , for a latence about 200/300ms.

I tried to put a queue (to buffering) before the TIVidenc1 element and increase my fps from 30fps to 40fps but increase the latency too.

To get at 60fps i need to /2 the process time but how can perform to have a better time process ? Is it possible ?

All help will be appreciate !

regards,

Mike.

  • Hi all,

    I found some precision about the time Videnc1_process() :

    The process takes 13ms for IntraFrame and 22ms to process Inter Frame.

    Using only intra Frame makes horrible display,and adding to a queue element we can reach 60fps @ output.

    gst-launch -v ticapturesrc num-buffe                                                 
    rs=5000 ! 'video/x-raw-yuv,width=(int)1280,height=(int)720,framerate=(fraction)6                                                 
    0/1' ! TIPrepEncBuf contiguousInputFrame=TRUE ! 'video/x-raw-yuv, width=1280, he                                                 
    ight=720, format=(fourcc)NV12' ! queue ! TIVidenc1 codecName=h264enc engineName=                                                 
    codecServer rateControlPreset=3 encodingPreset=2 intraFrame=1 bitRate=4000000 fr                                                 
    amerate=60/1 ! dmaiperf print-arm-load=true engine-name=codecServer ! fakesink s                                                 
    ilent=true

    Any hints to reduce the time for inter frame encoding ?

     

    Mike

  • Hi all,

    Now, i reach a 720P60  encoded with 60fps at output of my encoder by using the h264fhdvenc codec and 1080p30 encoded with 30fps at ouput of the encoder.

    When i try to make a mpegtsmux, for encapsulation before an udpsink, i measured 6.4ms for mpegtsmux to make a packet of 188 bytes (so for a bitRate of 4 000 000 and intraframe=12, it takes about 500ms to encapsulate 12 frames). So even i"queue" this element i will have some frame drop...(and CPU goes to 100%).

     

    if someone have some idea to increase these performance, let me know !

     

  • Hello Mike,

    I also have the evaluation board of the DM6467T.

    I succeed to configure the FHD for 1080P30 encode, however didn't succeed to configure it to 720P60.

    When taking the 720P codec, it seems that it encodes at 60fps but it reports frame rate of 25 fps.

    Can you please send me the configuration of the FHD for 720P60?

     

    BRs

     

  • Hi Mordehay,

    I use the same params as the 1080p30 encode process.

    i copy all the ohter params :

        IH264FHDVENC_Params   extHDParams = {
                Venc1_Params_DEFAULT,

                66,     // profileIdc;                  66=Baseline Profile
                40,     // levelIdc;                    40=Level 4.0
                0,      // EntropyCodingMode;           0=CAVLC

     };

     and dynparams :

        IH264FHDVENC_DynamicParams extHDDynParams = {
            //Venc1_DynamicParams_DEFAULT,
                {
                    sizeof(IH264FHDVENC_DynamicParams),   /* size */
                    1920,//144;                       /* inputHeight */
                    1088,//176;                       /* inputWidth */
                    30000,                            /* refFrameRate */
                    30000,                            /* targetFrameRate */
                    20000000,//128000;                 /* targetBitRate (override in app) */
                    30,//5;                           /* intraFrameInterval */
    #ifdef SUPPRESS_TEXAS_HEADER
                    XDM_ENCODE_AU,                    /* generateHeader */
    #else
                    XDM_DECODE_AU,                    /* generateHeader */
    #endif
                    0,                                /* captureWidth */
                    IVIDEO_NA_FRAME,                  /* forceFrame */
                    0,                                /* interFrameInterval */
                    0x0                               /* mbDataFlag */
                },

    #ifdef H241_MULTISLICE
            {IH264_SLICECODING_DEFAULT, IH264_SLICEMODE_BYTES, 1400, {0}, IH264_BYTE_STREAM},
    #else
            {IH264_SLICECODING_DEFAULT, IH264_SLICEMODE_NONE, 0, {0}, IH264_BYTE_STREAM},
    #endif
            -1,     // OutBufSize                   -1=Codec defined buffer slice
            28,     // QPISlice
            28,     // QPSlice
            51,     // RateCtrlQpMax-1
            0,      // RateCtrlQpMin
            0,      // NumRowsInSlice
            0,      // LfDisableIdc
            0,      // LFAlphaC0Offset
            0,      // LFBetaOffset
            0,      // ChromaQPOffset
            0,      // SecChromaQPOffset

            /* Support for 1080 Encoder */
            0,      // PicAFFFlag;                  0 = PicAFF disabled
            IH264FHDVENC_POC_TYPE_0,      // PicOrderCountType;           0 = POC 0
            0,      // AdaptiveMBs;                 0 = No Adaptive MBs
            0,      // SEIParametersFlag;           0 = SEI switched off
            0,      // VUIParametersFlag;           0 = VUI switched off
            {0,0},  // VUIData;                     0 = XDM single buf desc
            0,      // NALUnitCallback;             0 = No callback
            1,  // SkipStartCodesInCallback;    0 = Start codes enabled
            IH264FHDVENC_4x4_IP_FRAME,              // Intra4x4EnableFlag
            0,      // BlockingCallFlag;            0 = Blocking call
            IH264FHDVENC_ME1080i,     // MESelect;                    1 = 1080i ME
            0,      // ME1080iMode;                 0 = High video quality
            0,      // MVDataFlag;                  0 = MV data disabled
            1,      // Transform8x8DisableFlag      1 = 8x8 Transforms Disabled
            IH264FHDVENC_8x8_NONE,                // Intra8x8EnableFlag
            IH264FHDVENC_ONE_FIELD_DEFAULT,       // InterlaceReferenceMode
            IH264FHDVENC_CCV_LINEDROP,           // ChromaConversionMode
            1000,    // maxDelay
            90,     // MaxSlicesSupported
        };

    Then i set them to:

            params = (VIDENC1_Params*)&extHDParams;
            dynParams = (VIDENC1_DynamicParams*)&extHDDynParams;
            params->size = sizeof(IH264FHDVENC_Params);
            params->encodingPreset = XDM_DEFAULT;
            params->maxHeight = 1088; //videnc1->height; //1088;
            params->maxWidth = 1920; // videnc1->width; //1920;
            params->maxFrameRate = 30000;
            params->maxBitRate = 10000000;
            params->dataEndianness = XDM_LE_32;
            params->maxInterFrameInterval = 0;
            params->inputChromaFormat = XDM_YUV_420SP;
            params->inputContentType = IVIDEO_PROGRESSIVE;
            params->reconChromaFormat = XDM_CHROMA_NA;
            dynParams->size = sizeof(IH264FHDVENC_DynamicParams);
            dynParams->refFrameRate = 30000;
            dynParams->forceFrame = IVIDEO_I_FRAME;
            dynParams->refFrameRate = 30000;
            dynParams->targetFrameRate = 30000;
            dynParams->targetBitRate = 10000000;
            dynParams->generateHeader = XDM_ENCODE_AU;
            dynParams->captureWidth = 0;
            dynParams->interFrameInterval = 0;
            dynParams->mbDataFlag = 0;

    I change only set :

            params->maxHeight = 720;
            params->maxWidth = 1280;

    and :

        dynParams->inputWidth    = 1280;
        dynParams->inputHeight   = 720;

    rateControlPreset = CBR; (don't remember the exact value)

    I use Gstreamer to encode my video stream, and get the fps via dmaiperf :

    gst-launch -v ticapturesrc .... ! TIPrepEncBuf ... ! queue max-size-buffer=3 ! TIVidenc1 engineName=codecServer codecName=h264fhdvenc ... ! dmaiperf print-arm-load=true ! fakesink silent=true

    Hope it help you.

    Mika

  • Thank you very much Mika, I will try it.

    One more question - do you get an indication from the Codec that it works at 720P60?

     

     

  • What do you mean ?

    In documentation i don't remember if it tells that.

    But i controlled the information at output and i get 60 frames by second with a resolution of 1280 x 720. (see my pipeline in previous post).

    I get the problem from another point :

    H264enc takes more than 16.66666ms  (1/60) to encode a frame. (about 33ms)

    h264fhdvenc takes about 13.3ms so ...

  • Understood, I see that you don't change the frame rate to 60000, you keep it 30000, correct?

    I forwared your reply to my colleagues (Michele and Michael) who work on it, they may be in touch with you. Thanks in advance,

     

  • The framerate doesn't seem to have any issue on it. I let it at 30000 and it didn't "lower" my framerate.

    No prob, you/they are welcome !

    One question for you :

    Are you using Gstreamer ?

    Mika

  • No, we are not using Gstreamer. We are using Live555.