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.

How to set h.264 extend parameters using DMAI

Dear Sir:

    I use dvsdk_dm368-evm_4_02_00_06_setuplinux,I want to set h264 extend parameters,  I am trying

to encode video in H264 BP instead of HP. This is what I am doing:


    IH264VENC_Params h264params;
    memcpy(&(h264params.videncParams), params, sizeof(IVIDENC1_Params));
    h264params.profileIdc = 66;  
    h264params.Log2MaxFrameNumMinus4 = 0;
    h264params.ConstraintSetFlag = 0;
    h264params.entropyMode = 0;
    h264params.transform8x8FlagIntraFrame = 0;
    h264params.transform8x8FlagInterFrame = 0;
    h264params.enableVUIparams = 0;
    h264params.meAlgo = 0;
    h264params.seqScalingFlag = 0;  
    h264params.encQuality = 0;
    h264params.enableARM926Tcm = 0;
    h264params.enableDDRbuff= 0;
    h264params.sliceMode = 0;
    h264params.numTemporalLayers= 0;
    h264params.svcSyntaxEnable = 0;
    h264params.outputDataMode = IH264VENC_TI_ENTIREFRAME;
    h264params.sliceFormat = 1;   
   h264params.videncParams.size = sizeof(IH264VENC_Params);

 hVe1 = Venc1_create(hEngine, args->codecName, (VIDENC1_Params*)&h264params, &dynParams);

but encoder is not creating
error:Failed to create video encoder h264

 why it's failing ?can anybody help me?

  • Hi,

    Your steps are right but looks some param setting going wrong. Can you use codec debug library and check which param setting is gone wrong?. Debug library will prints debug statements inside codec.

    You can also search other threads in this forum, they able to extend the args.

    Thanks,

    Veeranna

  • thanks,but how to open the codec debug library?

  • In dm365_h264enc_02_30_00_04_production\packages\ti\sdo\codecs\h264enc\lib directory you can see 'h264venc_ti_arm926_debug.a'. Link this lib to your application.

    Currently you will be using h264venc_ti_arm926.a lib, so use _debug.a and run and have a look at logs it prints

  • thank you very much ,it work well after I modify some parameter , and I have another question that how do I insert the sequence parameter set(SPS) and picture paramer set (PPS)befor every I frame ,so what parameter i shoud modify ,thanks

  • instead of I frame with SPS and PPS can't you use IDR frame?.

  • yes I do not use the IDR frame,so I should change the parameter,I found that I must add the 'idrFrameInterval' of 'IH264VENC_DynamicParams' in the encode so that support the IDR frame,but there are so many parameter in the struct of IH264VENC_DynamicParams,can you give me a example of parameter'value in the struct of IH264VENC_DynamicParams ? thanks

    typedef struct IH264VENC_DynamicParams
    {
      /*!
       * Mandatory fields of the DynamicParams structure - Base class
       */
      IVIDENC1_DynamicParams videncDynamicParams;
     
      /*!
       * Additional elements specific to H.264 Encoder - Extensions to base class
       */
      XDAS_Int32 sliceSize;        /*!< No. of MB rows per Slice */
      XDAS_Int32 airRate;          /*!< Adaptive Intra Refresh MB Period */
      XDAS_Int32 intraFrameQP;     /*!< Quant. param for I Slices (0-51) */
      XDAS_Int32 interPFrameQP;    /*!< Quant. Param for non - I Slices  */
      XDAS_Int32 initQ;           /*!< Initial QP for RC */
      XDAS_Int32 rcQMax;          /*!< Maximum QP to be used  Range[0,51] */
      XDAS_Int32 rcQMin;          /*!< Minimum QP to be used  Range[0,51] */
      XDAS_Int32 rcQMaxI;          /*!< Maximum QP to be used  Range[0,51] */
      XDAS_Int32 rcQMinI;          /*!< Minimum QP to be used  Range[0,51] */
      XDAS_Int32 rcAlgo;           /*!< Algorithm to be used by Rate Ctrl Scheme*/
                                   /*!< => CBR, 1 => VBR, 2 => Fixed QP, 3=> CVBR,*/
                                   /*!< 4=> FIXED_RC 5=> CBR custom1 6=> VBR custom1*/
      XDAS_Int32 maxDelay;         /*!< max delay for rate control interms of ms,*/
                                   /*!< set it to 1000 for 1 second delay  */
      XDAS_Int32 aspectRatioX;      /*!< X scale for Aspect Ratio */
      XDAS_Int32 aspectRatioY;      /*!< Y scale for Aspect Ratio */
      XDAS_Int32 lfDisableIdc;     /*!< Loop Filter enable/disable control */
      XDAS_Int32 enableBufSEI;     /*!< Enable Buffering period SEI */
      XDAS_Int32 enablePicTimSEI;  /*!< Enable Picture Timing SEI */
      XDAS_Int32 perceptualRC;     /*!< Flag for enabling/disabling PRC */
      XDAS_Int32 idrFrameInterval;  /* IDR Frame Interval */
      XDAS_Int32 mvSADoutFlag;      /* Flag for enable/disable MVSAD out to the app*/
      XDAS_Int32 resetHDVICPeveryFrame; /* Flag for resetting hdvicp */
                                        /* after every frame encode */
      XDAS_Int32 enableROI;      /*!< 0 -> do not enable ROI, 1 -> enable ROI */
      XDAS_Int32 metaDataGenerateConsume; /* Flag to indicate Generate or Consume metaData*/
      XDAS_Int32 maxBitrateCVBR;  /* Specifies the max Bitrate for CVBR RC algortihm*/
      XDAS_UInt8 interlaceRefMode;      /*!<Mode to choose between ARF/SPF/MRCF*/
                                        /*!< 0 = ARF (default mode), 1 = SPF, 2 = MRCF */
      XDAS_Int32 enableGDR;             /* Flag to enable Gradual Decoder Refresh */
      XDAS_Int32 GDRduration;           /* GDR refresh duration                   */
      XDAS_Int32 GDRinterval;           /* Interval between GDR refresh           */
      XDAS_Int32 LongTermRefreshInterval;/* Refresh period for long term reference frame */
      XDAS_Int32 UseLongTermFrame;    /* Use longterm frame as reference*/
      XDAS_Int32 SetLongTermFrame;    /* Set a frame as longterm frame for reference */
      VUIParamBuffer *VUI_Buffer;     /* Pointer to VUI buffer*/
      CustomScalingMatrix *CustomScaleMatrix_Buffer; /* CUSTOMSCALINGMATRIX*/
      XDAS_Int32  CVBRsensitivity;   /* Specifies the target bitrate used by rate control*/
                                     /* in high complexity state */  
      XDAS_Int32  CVBRminbitrate ;   /* Reserved */  
      XDAS_Int32  LBRmaxpicsize;     /* parameter controls the maximum number of bits consumed per frame*/
      XDAS_Int32  LBRminpicsize;     /* parameter controls the minimum number of bits consumed per frame */
      XDAS_Int32  LBRskipcontrol;    /* parameter configures the minimum number of frames */
                                     /*  to be encoded in a set of N frames */
      XDAS_Int32 maxHighCmpxIntCVBR;    /* Specifies the maximum duration of increased complexity */
      XDAS_Int32 disableMVDCostFactor;  /* Reserved */
      IH264VENC_TI_DataSyncPutGetFxn putDataGetSpaceFxn;   /* Pointer to callback module */
      IH264VENC_TI_DataSyncHandle    dataSyncHandle;  /* Handle to datSyncDesc */
    } IH264VENC_DynamicParams;

  • Please refer  dm365_h264enc_02_30_00_04_production\packages\ti\sdo\codecs\h264enc\apps\client standalone testapp  provided with release package(mainly h264encoderapp.c file).

    And also you can have look at codec userguide for each parameter meaning.