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.

Slice Based Encoding on OMAP5

Hi,

I need to enable Slice Based Encoding for H264 Encoder on OMAP5 platform ,

The Configurations necessary to enable Slice Mode is set from OMX frameowrk. OMX layer is implemented on Android

InputPort

OMX_VIDEO_PARAM_DATASYNCMODETYPE dataSyncType

dataSync.eDataMode = OMX_Video_EntireFrame

OutPut Port

OMX_VIDEO_PARAM_DATASYNCMODETYPE dataSyncType

dataSyncType.eDataMode = OMX_Video_SliceMode;

dataSyncType.nNumDataUnits = 1;

OMX_VIDEO_CONFIG_SLICECODINGTYPE slicetype

slicetype.eSliceMode = OMX_VIDEO_SLICEMODE_AVCByteSlice;

slicetype.nSlicesize = sizeBytes;

But according OMAP5 H264 Encoder User Guide, supposed to make a getBufferFxn and PutDataFxn needs to called from app/framework part

Can anyone provide some inputs on how to make getBufferFxn and PutDataFxn from OMX layer

Regards,

Pushpa

  • Hello Pushpa,

    I suggest you taking a look on a similar thread e2e.ti.com/.../767443

    Best regards,
    Yanko
  • Hi Yanko,

    I have set the configurations accordingly as mentioned in the referred post

    /************** Encode Preset Mode *************************/

    OMX_VIDEO_PARAM_ENCODER_PRESETTYPE presetType;

    presetType.eEncodingModePreset = OMX_Video_Enc_User_Defined

    err = mOMX->setParameter(
    mNode,(OMX_INDEXTYPE) OMX_TI_IndexParamVideoEncoderPreset,
    &presetType, sizeof(presetType));

    /************************* Slice COding Type **************************/

    OMX_VIDEO_CONFIG_SLICECODINGTYPE slicetype;

    slicetype.eSliceMode = OMX_VIDEO_SLICEMODE_AVCByteSlice;
    slicetype.nSlicesize = 1000;

    err = mOMX->setConfig(
    mNode, (OMX_INDEXTYPE)OMX_TI_IndexConfigSliceSettings, &slicetype, sizeof(slicetype));
    CHECK_EQ(err, (status_t)OK);

    /************************* Data Sync Mode for Input ********************/

    OMX_VIDEO_PARAM_DATASYNCMODETYPE dataSyncMode;

    ataSyncMode.eDataMode = OMX_Video_EntireFrame;

    err = mOMX->setParameter(mNode,(OMX_INDEXTYPE)OMX_TI_IndexParamVideoDataSyncMode,
    &dataSyncMode, sizeof(dataSyncMode));

    /************************** Data Sync Mode for Output ****************/

    OMX_VIDEO_PARAM_DATASYNCMODETYPE dataSyncMode;

    ataSyncMode.eDataMode = OMX_Video_SliceMode;

    err = mOMX->setParameter(mNode,(OMX_INDEXTYPE)OMX_TI_IndexParamVideoDataSyncMode,
    &dataSyncMode, sizeof(dataSyncMode));

    Also getBufferFxn and PutBufferFxn callbacks are implemented

    But  I am getting following error during getBufferFxn call

    [CORE0]: [0][ 13.751] [ERR=853] src/OMX_H264VideoEncoderUtils.c:[1814]:Failed check: (eError == OMX_ErrorNone)
    [CORE0]: [0][ 13.751] [ERR=854] src/OMX_H264VideoEncoderUtils.c:[1814]:Returning error: OMX_ErrorInsufficientResources
    [CORE0]: [0][ 13.751] [ERR=855] src/OMX_H264VideoEncoderUtils.c:[1845]:Getop buff :Error occured =-2147479552
    [CORE0]: [0][ 13.752] [ERR=856] src/OMX_H264VideoEncoderUtils.c:[2127]:[Instance 0]:Undefined From Codec
    [CORE0]: [0][ 13.752] [ERR=857] src/OMX_H264VideoEncoderUtils.c:[2127]:[Instance 0]:IVAHD Device is not proper state to use
    [CORE0]: [0][ 13.752] [ERR=858] src/OMX_H264VideoEncoderUtils.c:[2127]:[Instance 0]:Due to Insufficient Data
    [CORE0]: [0][ 13.752] [ERR=859] src/OMX_H264VideoEncoderUtils.c:[2129]:[Instance 0]:Got error 0x80001000 from the Codec Process call
    [CORE0]: [0][ 13.752] [MNU=860] rm_plugin_res/src/rm_pluginres_ivahd.c:[722]:[IVAHD]: Init IVA_clock_check
    [CORE0]: [0][ 13.753] [ERR=861] src/OMX_H264VideoEncoder.c:[5032]:Failed check: eError == OMX_ErrorNone
    [CORE0]: [0][ 13.753] [ERR=862] src/OMX_H264VideoEncoder.c:[5032]:Returning error: eError
    [CORE0]: [0][ 13.753] [ERR=863] src/OMX_H264VideoEncoder.c:[5277]:Failed check: OMX_ErrorNone == eError
    [CORE0]: [0][ 13.753] [ERR=864] src/OMX_H264VideoEncoder.c:[5277]:Returning error: eError

  • Hello Pushpa,

    You need to set getBufferFxn and putDataFxn call back functions to send the partial output buffer to encoder and to get the slice data from encoder along with setting outputDataMode to IVIDEO_SLICEMODE.

    Slice output from OMX encoder is possible but not in low-latency mode. i,e encoder encodes full frame as a group of slices. If this is what you want this can be supported with proper setting of OMX encoder.

    Try to apply following initial configuration:

    OMX_VIDEO_PARAM_DYNAMICPARAMS dynamic_params;

    OMX_INIT_PARAM(&dynamic_params);
    dynamic_params.nPortIndex = OMX_VIDENC_OUTPUT_PORT;

    OMX_GetParameter(encoder_handle, OMX_TI_IndexParamVideoDynamicParams, &dynamic_params);

    IH264ENC_DynamicParams *h264_params = &dynamic_params.videoDynamicParams.h264EncDynamicParams;

    h264_params->sliceCodingParams.sliceCodingPreset = IH264_SLICECODING_USERDEFINED;
    h264_params->sliceCodingParams.sliceMode = IH264_SLICEMODE_BYTES;
    h264_params->sliceCodingParams.sliceUnitSize = 1300;
    h264_params->sliceCodingParams.streamFormat = IH264_BYTE_STREAM;

    OMX_SetParameter(encoder_handle, OMX_TI_IndexParamVideoDynamicParams, &dynamic_params);

    Refer to this thread - e2e.ti.com/.../726424

    Best regards,
    Yanko
  • Hi Yanko,

    Yes currently Ducati implements getBufferFxn and putDataFxn callback functions to send the partial output buffer to encoder and to get the slice data from encoder along with setting outputDataMode to IVIDEO_SLICEMODE.

    Also I have set following parameters

    h264_params->sliceCodingParams.sliceCodingPreset = IH264_SLICECODING_USERDEFINED;
    h264_params->sliceCodingParams.sliceMode = IH264_SLICEMODE_BYTES;
    h264_params->sliceCodingParams.sliceUnitSize = 1300;
    h264_params->sliceCodingParams.streamFormat = IH264_BYTE_STREAM;

    I can see from that logs that the frame is encoded with multiple slices, but fails after some 7 or 8 iterations. I have attached the logs

    1220.sbe_crash.txt

    Please let me know if anything more is needed to configure