Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

maxBytesPerSlice in DM3730 H264 Codec not working

$
0
0

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);

...

}

...


Viewing all articles
Browse latest Browse all 262198

Trending Articles