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.

About DM8127 MJPEG(5M) output rate

Genius 3400 points

Hi all!

DM8127 run ipnc2.8 program and in the LOW POWER USECASE .

The camera output H.264(5M)+D1+MJPEG(5M),but the mjpeg encode rate is only 1 FPS,
the output encode Statistics are as follow :

The In User Skip FPS is 10.

I modify the EncLink_doSkipFrame() function (ipnc_mcfw/mcfw/src_bios6/links_m3video/iva_enc/encLink_common.c) .

The modified codes are as follows:

Bool  EncLink_doSkipFrame(EncLink_ChObj *pChObj, Int32 chId)
{
    ......
    if (pChObj->frameStatus.inCnt > pChObj->frameStatus.outCnt)
    {
        pChObj->frameStatus.outCnt +=
        (pChObj->algObj.algDynamicParams.targetFrameRate/1000);
        /*skip this frame, return true*/
         return TRUE;
    }
    ......
}

modify to
Bool  EncLink_doSkipFrame(EncLink_ChObj *pChObj, Int32 chId)
{
    ......
    if (pChObj->frameStatus.inCnt > pChObj->frameStatus.outCnt)
    {
        pChObj->frameStatus.outCnt +=
        (pChObj->algObj.algDynamicParams.targetFrameRate/1000);
        /*skip this frame, return true*/
         //return TRUE;   //not run 
    }
    ......
}

Now the In User Skip FPS is 0, but the output rate is only 3 FPS.
the output encode Statistics are as follows:
  

The In Skip PFS is 24 FPS. How can I reduce this Skip PFS and lead output rate more than 3 FPS?

Thanks!

  • Hi Gomo.

    I am trying this in fullfuture mode 1080P,  i'm not sure if it also works the same in lowpower 5MP.

     

    Bool  EncLink_doSkipFrame(EncLink_ChObj *pChObj, Int32 chId)
    {
      static int iCounter1;
      iCounter1++;
      if(chId==2) {     return FALSE; } 
      if(chId==0) {     if (iCounter1 % 10)        return TRUE;     else        return FALSE;  }
      if(chId==1) {     if (iCounter1 % 4)        return TRUE;     else        return FALSE;  }
     }

     and i am getting this:

     

    Regards.

     

  • Hi Marko,

    I was also having this problem and solved it with your suggestion. I wanted to increase the frame rate of MJPEG stream and get rid of frame skipping. I was working with low-power mode. your solution worked perfectly. Your rock man :)

  • Hi Gomo,

    can you tell me what is your target frame rate for MJPEG 5M, and also for H264 5M and D1?

    Looks like MJPEG encoder is skipping frames because of the performance constraint on HDVICP, by default H264 encoder should have a higher priority than MJPEG.

    The changes proposed by other friends in this thread actually limits the H264 output frame rate and thus give more performance to the CH2 emcoding (MJPEG), but this may be not what you want.

  • Thanks for everyone friendly answer.

    Zhuoran Dai said:

    Hi Gomo,

    can you tell me what is your target frame rate for MJPEG 5M, and also for H264 5M and D1?

    Our target frame is 15fps, It's must output 5M MJPEG, H.264 and D1 at same time; Can DM8127 do this?

    Zhuoran Dai said:

    Looks like MJPEG encoder is skipping frames because of the performance constraint on HDVICP, by default H264 encoder should have a higher priority than MJPEG.

    Where is the setting of  encoder priority ?

    Thanks again!

  • Well, Actually there's no priority setting on the encoder, however, all streams (H264 main, H264 secondary, MJPEG) share the same process queue and when the process queue is getting full (it means the hardware encoder doesn't have enough time to encode all input frames), frames are going to be rejectted. By default, we assign the channel ID 0 to H264 main, 1 to H264 secondary and 2 to MJPEG, and every time we receive a multiplexed stream, input frames are taken through the channel ID order, so you understand why MJPEG is the most unlucky one.

    Now, the obvious way to modify this is chaging the channel ID in the multiplexed stream (for this you just need to modify the merge link input). Otherwise you can try the method proposed y Marko to have a more flexible control.

    The IVAHD is designed to support 1080P60 encoding, that means 120M pixel per second, in our triple streams use case we have realized 1080P60 + D1/30 + MJPEG/5 = 140M pixel per second. But 5M MJPEG + 5M H264 + D1 264 all at 15fps = 155M pixel per second, without counting any eventual penalty for the high resolution. If you really need this you may use the SIMCOP based MJEPG encoder available on m3vpss.

  • Thanks for your reply.

    And we modify the frame rate of sensor to output 15fps in 5M output mode. we can got 5M h.264, Mjpeg and D1 H.264, But the D1 fps is half. just like this.

    And why the D1 have half frame rata?

    Zhuoran Dai said:

    The IVAHD is designed to support 1080P60 encoding, that means 120M pixel per second, in our triple streams use case we have realized 1080P60 + D1/30 + MJPEG/5 = 140M pixel per second. But 5M MJPEG + 5M H264 + D1 264 all at 15fps = 155M pixel per second, without counting any eventual penalty for the high resolution. If you really need this you may use the SIMCOP based MJEPG encoder available on m3vpss.

    Yes, In our design, we want to output 15pfs 5M h.264 , 5M Mjpeg and D1 or CIF Mjpeg finally.  In the IPNC V2.0, it's use SIMCOP to do MJPEG encoder. So I want to know:

    1) In your next version of IPNC, Did the full feature support 5M, 8M Mjpeg output? Does it use SIMCOP to do MJPEG encode?

    2)we want to output 15pfs 5M h.264 , 5M Mjpeg and D1 or CIF Mjpeg finally, Does it can relize? What mode it's easy to modify, Low power or full feature?

    3)If we  use the SIMCOP based MJEPG encoder available on m3vpss, Can your give us some advices?

  • The D1 frame rate is halved in the camera link, by default we output 60fps for 1080P and 30fps for D1. If you are using the 2.8 RDK then there's an API on the camera link to change the output frame rate. If you are using an old version then you have to look into the camera link source code and modify it by yourself.

    Now, it looks like you already get 15fps for 5M H264 + MJPEG, probably the IVAHD performance is good enough to cover your triple streams encoding. In this case, it's better for you to keep the current design and do not use SIMCOP.

    1) We probably will not include high megapixel resolutions in the full feature mode, because we always need 1080P for the HDMI output. And we will not use SIMCOP based MJPEG encoder while IVAHD is enough, the SIMCOP performance can be used for other advanced features.

    2) Yes it can be supported. It's easier to modify the low power use case to support high megapixel resolutions.

    3) Well, the advice is do not use SIMCOP while IVAHD is enough. Otherwise you can always refer to the RDK2.0. What else you want to know?

  • Thanks for your rapidly answer.

    If the lower power mode can meet with our application, we also do not need modify to use SIMCOP.  Now we only use the Cotex A8 to 600M Hz, if we heighten  frequency to 720M Hz/900M Hz, the performace will be better.

    Another two question.

    1) DM8127 default value of frequency is:

    ARM clk: 600MHz
    DDR clk: 400MHz
    L3 clk: 200MHz
    IVA clk: 450MHz
    ISS clk: 400MHz
    DSP Switched OFF
    DSS Switched OFF

    If we modify ARM clock to 720Mhz/900Mhz, how much are the recommended frequency of others, just like DDR, ISS eg.

    2) In lower power mode, if we want to use DSP to do some process, please give some advice.

    Thanks a lot.

  • 1) There's no direct dependence between ARM and other cores' clock frequency

    2) Please set POWER_OPT_DSP_OFF := NO in Rules.make for the low power configuration, do "make sysall" and reflash the u-boot. Then you can modify the low power use case for adding DSP links.

  • Thanks for your reply.

    When meet problem, I will post issue in E2E.

    Thanks again.

  • Thanks for  .

    Zhuoran Dai said:

    The D1 frame rate is halved in the camera link, by default we output 60fps for 1080P and 30fps for D1. If you are using the 2.8 RDK then there's an API on the camera link to change the output frame rate. If you are using an old version then you have to look into the camera link source code and modify it by yourself.

    I am using the 2.8 RDK, and I modify the MultiCh_createTriStreamLowPwr() function as follows:

        /* Video Encoder Framerate */
        #ifdef IMGS_OMNIVISION_OV10630
            encPrm.chCreateParams[0].defaultDynamicParams.inputFrameRate = 30;
                    // ENC_LINK_DEFAULT_ALGPARAMS_INPUTFRAMERATE;

        #else
            encPrm.chCreateParams[0].defaultDynamicParams.inputFrameRate = 60;
              // ENC_LINK_DEFAULT_ALGPARAMS_INPUTFRAMERATE;

        #endif
        encPrm.chCreateParams[1].defaultDynamicParams.inputFrameRate = 60; // modify from 30

    But the D! In RCV FPS is still 7.

    How can I modify the code to output D1 15fps? Can you tell me to modify which file or function?

    Thanks! 

  • You need to change the output frame rate on the camera link.

    search VCAM_FRAMERATE in ti_vcam.c

  • Thanks for  .
    I can output D1 15fps.

    I modify the code (in Frame_rate_ctrl.c file) as follows:

    enc_framerate_day_1[8][1][0]=30 //from 20
    enc_framerate_day_1[8][1][0]=60 //from 20
    enc_framerate_day_1[8][1][0]=30 //from 5

    Thanks again.

  • HI all!

       The DM8127 running IPNCV2.8 can output MJPEG(5M)+H.2.64(5M)+H.264(D1) and H.2.64(1080P)+MJPEG(D1),
    We want the camera to output MJPEG(5M)+H.2.64(5M)+MJPEG(D1).  

    Does it can relize? 

    In the Appro_interface.h file define the field used by the function int GetAVData( unsigned int field, int serial, AV_DATA * ptr )
    The defined field are as follows(not all defined fields ):
    /* definition for field */

    #define AV_OP_LOCK_MJPEG 1 /**< Lock one MJPEG*/
    #define AV_OP_BOOK_MJPEG 2 /**< BOOK one MJPEG (not support now)*/
    #define AV_OP_UNLOCK_MJPEG 3 /**< Unlock one MJPEG */
    #define AV_OP_LOCK_MP4_VOL 6 /**< Lock VOL of MPEG4 */
    #define AV_OP_UNLOCK_MP4_VOL 7 /**< Unlock VOL of MPEG4 */
    #define AV_OP_LOCK_MP4 8 /**< Lock one MPEG4 frame */
    #define AV_OP_LOCK_MP4_IFRAME 9 /**< Lock one MPEG4 I frame*/
    #define AV_OP_UNLOCK_MP4 10 /**< Unlock one MPEG4 frame */
    #define AV_OP_GET_MJPEG_SERIAL 11 /**< Get latest MJPEG serial number */
    #define AV_OP_GET_MPEG4_SERIAL 12 /**< Get latest MPEG4 serial number */
    #define AV_OP_UNLOCK_MP4_CIF_VOL 17 /**< Unlock VOL of MPEG4_2 */
    #define AV_OP_LOCK_MP4_CIF 18 /**< Lock one MPEG4_2 frame */
    #define AV_OP_LOCK_MP4_CIF_IFRAME 19 /**< Lock one MPEG4_2 I frame*/
    #define AV_OP_UNLOCK_MP4_CIF 20 /**< Unlock one MPEG4_2 frame */
    #define AV_OP_GET_MPEG4_CIF_SERIAL 21 /**< Get latest MPEG4_2 serial number */

    There are only defined AV_OP_LOCK_MJPEG ,but defined AV_OP_LOCK_MP4 and AV_OP_LOCK_MP4_CIF.
    If we want to output MJPEG(5M)+MJPEG(D1), we should add define  AV_OP_LOCK_MJPEG_CIF?

    Can your give us some advices? 

  • we have got it.

    Thanks a lot.