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.

maxBytesPerSlice in DM3730 H264 Codec not working

Other Parts Discussed in Thread: DM3730

Hi,

We are working with DVSDK 4.01 with DM3730 on beagleboard XM and wanted to use maxBytesPerSlice in H264 encoder (in codes-omap3530_4_01_00_00) to limit the slice size to be less than the MTU. The codec engine version in the SDK is 2_26_01_09.

We use H264 Extended Dynamic parameters to set the value of maxBytesPerSlice to 1300. However, this is not having any impact on the slice size. We do have the encodingPreset parameters set to XDM_USER_DEFINED.

I am attaching snippets from our code below.

Any help that you can give on this will be greatly appreciated!

Thanks

Shalini

------------------------------------

Code Snippet

/* Setting Default Values */

const VIDENC1_Params SwipeVenc1_Params_DEFAULT = {
    sizeof(VIDENC1_Params),           /* size */
    XDM_DEFAULT,                      /* encodingPreset */
    IVIDEO_LOW_DELAY,                 /* rateControlPreset */
    576,                              /* maxHeight */
    720,                             /* maxWidth */
    30000,                            /* maxFrameRate */
    5000000,                          /* maxBitRate */
    XDM_BYTE,                         /* dataEndianness */
    1,                                /* maxInterFrameInterval */
    XDM_YUV_420P,                     /* inputChromaFormat */
    IVIDEO_PROGRESSIVE,               /* inputContentType */
    XDM_CHROMA_NA                     /* reconChromaFormat */
};

const VIDENC1_DynamicParams SwipeVenc1_DynamicParams_DEFAULT = {
    sizeof(IVIDENC1_DynamicParams),   /* size */
    480,                              /* inputHeight */
    720,                             /* inputWidth */
    30000,                            /* refFrameRate */
    30000,                            /* targetFrameRate */
    4000000,                         /* targetBitRate */
    0,                               /* intraFrameInterval */
    XDM_ENCODE_AU,                    /* generateHeader */
    0,                                /* captureWidth */
    IVIDEO_NA_FRAME,                  /* forceFrame */
    1,                                /* interFrameInterval */
    0                                 /* mbDataFlag */
};

...
/* Setting Defaults for Extended Dynamic Parameters */
static void setDynamicParameterDefaults( IH264VENC_DynamicParams *pDynParams) {
                             pDynParams->qpIntra = 24 ;
                            pDynParams->qpInter = 24 ;
                            pDynParams->qpMax = 51 ;
                            pDynParams->qpMin = 0 ;
                            pDynParams->lfDisableIdc = 0 ;
                            pDynParams->quartPelDisable = 1 ;
                            pDynParams->airMbPeriod = 0 ;
                            pDynParams->maxMBsPerSlice = 0 ;
                            pDynParams->maxBytesPerSlice = 1300 ;            
                            pDynParams->sliceRefreshRowStartNumber = 0 ;
                            pDynParams->sliceRefreshRowNumber = 0 ;
                            pDynParams->filterOffsetA = 0 ;
                            pDynParams->filterOffsetB = 0 ;
                            pDynParams->log2MaxFNumMinus4 = 0 ;
                            pDynParams->chromaQPIndexOffset = 0 ;
                            pDynParams->constrainedIntraPredEnable = 0 ;
                            pDynParams->picOrderCountType = 0 ;
                            pDynParams->maxMVperMB = 1 ;
                              pDynParams->intra4x4EnableIdc = INTRA4x4_NONE ;
                            pDynParams->mvDataEnable = 0 ;
                            pDynParams->hierCodingEnable = 1 ;
                            pDynParams->streamFormat = IH264_NALU_STREAM ;
                            pDynParams->intraRefreshMethod = IH264_INTRAREFRESH_NONE ;
                            pDynParams->perceptualQuant = 0 ;
                            pDynParams->sceneChangeDet = 0 ;
                            pDynParams->numSliceASO = 0 ;
                            pDynParams->asoSliceOrder[0] = 0 ;
                            pDynParams->asoSliceOrder[1] = 0 ;
                            pDynParams->asoSliceOrder[2] = 0 ;
                            pDynParams->asoSliceOrder[3] = 0 ;
                            pDynParams->asoSliceOrder[4] = 0 ;
                            pDynParams->asoSliceOrder[5] = 0 ;
                            pDynParams->asoSliceOrder[6] = 0 ;
                            pDynParams->asoSliceOrder[7] = 0 ;
                            pDynParams->numSliceGroups = 0 ;
                            pDynParams->sliceGroupMapType = 0 ;
                            pDynParams->sliceGroupChangeDirectionFlag = 0 ;
                            pDynParams->sliceGroupChangeRate = 0 ;
                            pDynParams->sliceGroupChangeCycle = 0 ;
                            pDynParams->sliceGroupParams[0] = 0 ;
                            pDynParams->sliceGroupParams[1] = 0 ;
                            pDynParams->sliceGroupParams[2] = 0 ;
                            pDynParams->sliceGroupParams[3] = 0 ;
                            pDynParams->sliceGroupParams[4] = 0 ;
                            pDynParams->sliceGroupParams[5] = 0 ;
                               pDynParams->sliceGroupParams[6] = 0 ;
                            pDynParams->sliceGroupParams[7] = 0 ;
}

...

/******************************************************************************
 * gst_tividenc1_codec_start
 *   start codec engine
 *****************************************************************************/
static gboolean gst_tividenc1_codec_start (GstTIVidenc1 *videnc1)
{
    VIDENC1_DynamicParams dynParams   = SwipeVenc1_DynamicParams_DEFAULT;
    VIDENC1_Params        params      = SwipeVenc1_Params_DEFAULT;
    IH264VENC_Params       h264params;

...
    IH264VENC_DynamicParams iDynParams;

    params.encodingPreset    = XDM_USER_DEFINED;
   
    memcpy(&iDynParams.videncDynamicParams, &dynParams, sizeof(dynParams));
    iDynParams.videncDynamicParams.size = sizeof(IH264VENC_DynamicParams);
    setDynamicParameterDefaults(&iDynParams);

    memset(&h264params, 0, sizeof(h264params));
    memcpy(&h264params.videncParams, &params, sizeof(params));
    h264params.videncParams.size = sizeof(IH264VENC_Params);

    h264params.profileIdc = 66;
    h264params.levelIdc = IH264_LEVEL_30;
    h264params.rcAlgo = 0;
    h264params.searchRange = 64;
    
    ...

    videnc1->hVe1 = SwipeVenc1_create(videnc1->hEngine, (Char*)videnc1->codecName,
                      (VIDENC1_Params *) &h264params, (VIDENC1_DynamicParams *) &iDynParams);

    ...

}

...

/******************************************************************************
 * Venc1_create
 ******************************************************************************/
SwipeVenc1_Handle SwipeVenc1_create(Engine_Handle hEngine, Char *codecName,
                          VIDENC1_Params *params,
                          VIDENC1_DynamicParams *dynParams)
{
    SwipeVenc1_Handle            hVe;
    VIDENC1_Status          encStatus;
    XDAS_Int32              status;
    VIDENC1_Handle          hEncode;

...

    /* Create video encoder instance */
    hEncode = VIDENC1_create(hEngine, codecName, params);

...

    /* Set video encoder dynamic parameters */
    encStatus.size = sizeof(VIDENC1_Status);
    encStatus.data.buf = NULL;

    status = VIDENC1_control(hEncode, XDM_SETPARAMS, dynParams, &encStatus);

...

}

...

  • Unfortunately, we dont have codec folks available to look into this query due to lack of support. Can you migrate to 4.02 or later DVSDK and check that out. There was codec update done and probably it might work.

    regards

    Yashwant

  • Hi!

     Have your problem  be done resolved? I want to adjust some paramers about IH264VENC_DynamicParams struct 

    typedef struct IH264VENC_DynamicParams
    {
    IVIDENC1_DynamicParams videncDynamicParams;
    ih264venc_ext_dyn_prms_t s_ext;

    } IH264VENC_DynamicParams;

    and I find that the struct IH264VENC_DynamicParams's expand is  :

    typedef struct ih264venc_ext_rc_otp
    {
    XDAS_Int32 i4_size;
    XDAS_Int32 i4_init_i_qp;
    XDAS_Int32 i4_init_p_qp;
    XDAS_Int32 i4_init_b_qp;
    XDAS_Int32 i4_stuffing_disabled;
    XDAS_Int32 i4_buffer_delay;
    XDAS_Int32 i4_limit_vbv_to_std_def_buf_size;
    }ih264venc_ext_rc_otp_t;

    typedef struct ih264venc_ext_vui_otp
    {
    XDAS_Int32 i4_size;
    XDAS_Int32 i4_aspect_ratio_x;
    XDAS_Int32 i4_aspect_ratio_y;
    XDAS_Int32 i4_pixel_range;
    }ih264venc_ext_vui_otp_t;

    typedef struct ih264venc_ext_cbr_params
    {
    XDAS_Int32 i4_size;
    XDAS_Int32 i4_min_I_qp;
    XDAS_Int32 i4_max_I_qp;
    XDAS_Int32 i4_min_P_qp;
    XDAS_Int32 i4_max_P_qp;
    XDAS_Int32 i4_min_B_qp;
    XDAS_Int32 i4_max_B_qp;
    } ih264venc_ext_cbr_params_t;

    typedef struct ih264venc_ext_vbr_params
    {
    XDAS_Int32 i4_size;
    XDAS_Int32 i4_min_I_qp;
    XDAS_Int32 i4_max_I_qp;
    XDAS_Int32 i4_min_P_qp;
    XDAS_Int32 i4_max_P_qp;
    XDAS_Int32 i4_min_B_qp;
    XDAS_Int32 i4_max_B_qp;
    XDAS_Int32 i4_avg_channel_bandwidth;
    XDAS_Int32 i4_peak_channel_bandwidth;
    } ih264venc_ext_vbr_params_t;

    How to adjust the values?

    Thanks!