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.

Failed to encode MPEG2 on DM365 Soc

Hi All:

            I have tried to encode the MPEG2 on DM365 Soc, my DVSDK version is 2_10_01_18, and MPEG2 codec version is V01.00.00 with Build ID: 01.00.00.07.

            I have meet one issue that it will be failed with:

                     status = VIDENC1_control(pObj->hEncode, XDM_SETPARAMS, (VIDENC1_DynamicParams*)&pObj->dynamicParams, &pObj->encStatus);

              Here provide some parameters for reference:

pObj->dynamicParams.size = sizeof(pObj->dynamicParams);
pObj->dynamicParams.inputHeight = 640;
pObj->dynamicParams.inputWidth = 640;
pObj->dynamicParams.targetBitRate = 0;
pObj->dynamicParams.intraFrameInterval = 10;
pObj->dynamicParams.generateHeader = XDM_ENCODE_AU;
pObj->dynamicParams.captureWidth = 640;
pObj->dynamicParams.targetFrameRate = 30000;
pObj->dynamicParams.refFrameRate = 30000;

            Anyone who can help on this?

  • Tracy,

    Mpeg2 encoder works fine, something wrong wiht your parameter setting. Can you please privide with full static and dynamic params used for encoding ? And you are saying that the encoder is coming out with error during XDM_SETPARAMS control call, isnt it ?

     

    regards

    Yashwant

  • Hi Yashwant:

                  Appreciate for you response.

                  Yes, the encoder in alg_videnc.c coming out with error during XDM_SETPAMS control call,  here list all the related parameters for you reference:

    pObj->params.size                  = sizeof(VIDENC1_Params);
    pObj->params.encodingPreset        = XDM_HIGH_SPEED;
    pObj->params.rateControlPreset     = IVIDEO_LOW_DELAY;
    pObj->params.maxHeight             = 480;
    pObj->params.maxWidth              = 640;
    pObj->params.maxFrameRate          = 30000 ;
    pObj->params.maxBitRate            = 10000000;
    pObj->params.inputChromaFormat = XDM_YUV_420SP;
    pObj->params.dataEndianness        = XDM_BYTE;
    pObj->params.maxInterFrameInterval = 0;
    pObj->params.inputContentType      = IVIDEO_PROGRESSIVE;
    pObj->params.reconChromaFormat     = XDM_YUV_420SP;

    pObj->dynamicParams.size = sizeof(pObj->dynamicParams_mpeg2);
    pObj->dynamicParams.inputHeight         = 480;
    pObj->dynamicParams.inputWidth          = 640;
    pObj->dynamicParams.targetBitRate       = 2000000;
    pObj->dynamicParams.intraFrameInterval  = 10;
    pObj->dynamicParams.generateHeader      = XDM_ENCODE_AU;
    pObj->dynamicParams.captureWidth        = 1024; // or 0
    pObj->dynamicParams.targetFrameRate     = 30000;
    pObj->dynamicParams.refFrameRate        = 30000;

              Could you help take a quick check?

               Appreciate!

  • Seems the key is the pObj->dynamicParams.size = sizeof(pObj->dynamicParams_mpeg2);, when I tried to set the it as pObj->dynamicParams.size = sizeof(pObj->dynamicParams);, it work well.

    Because I need set the mvSADoutFlag to 1 under some case, so use extend parameters is MUST.

    Any comments on this?

    Thanks.

  • Any one who can help on this?

    Another question, can we set the dynamicParams.targetBitRate to 0 under VBR mode?

  • Tracy,

    You should set all the parameters to valid values. When you use IVIDENC1_DynamicParams the params from qpIntra to mvSADoutFlag are ignored. Refer to userguide for the valid values of IMP2VENC_DynamicParams. In case of errors videncStatus.extendedError will be set with error code. Refer to error codes in section 4.1.3 of mpeg2_encoder_dm365_userguide.pdf. This should help you in setting valid values.

    typedef struct IMP2VENC_DynamicParams
    {
      /*!
       * Mandatory fields of the DynamicParams structure - Base class
       */
      IVIDENC1_DynamicParams videncDynamicParams;

      XDAS_Int32  qpIntra;         /* default QP for I frame : QPI,  range 2 to 31 */
      XDAS_Int32  qpInter;         /* default QP for P frame, range 2 to 31        */
      XDAS_Int32  RcAlgo;          /* Rate Control Method,
                                      0: disable rate control, 4-CBR,  8-VBR       */
      XDAS_Int32  QPMax;        /* Maximum QP to be used  Range[2,31]           */
      XDAS_Int32  QPMin;     /* Minimum QP to be used  Range[2,31]           */
      XDAS_Int32  maxDelay;     /* max delay for rate control interms of ms,
                                       set it to 1000 for 1 second delay           */
      XDAS_Int32  qpInit;     /* max delay for rate control interms of ms,
                                       set it to 1000 for 1 second delay           */
      XDAS_Int32  PerceptualRC;    /* Flag to switch on/off perceptual rate control*/
      XDAS_Int32  reset_vIMCOP_every_frame; /* Reset HDVICP flag: 1 - reset: 0 - Dont reset */
      XDAS_Int32  mvSADoutFlag;    /* Flag for enable/disable MVSAD out to the app */
    } IMP2VENC_DynamicParams;

     

  • Neelakanth:

    I can encode the MPEG2 frame with the parameters above under CBR mode, when I try to encode under VBR mode with the same parameter except change the targetBitRate to 0, I will got an "loating point exception' error when I tried to another NON-ZERO value, it work well.

    How should I set the targetBitRate value under VBR mode?

    Thanks.

  • VBR or CBR will always need a non-zero target bitrate. Please use the encoder with the desired value of target bitrate when using any rate control mode. In case you want to use fixed QP, then you may leave the traget bitrate as zero.

    regards

    YD

  • Got it, Thanks, seems we must set the  traget bitrate as zero under fix QP mode.