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 do modification of capture_encode sample code in omx for achieving slice mode encoding?

Hi,
   I have already run successfully capture_encode sample code on my dm8168 evm. This sample 's output is based on frame level(Output after one complete frame is encoded).But for achieving low latency, I need to implement the slice mode. By referring to the document "H264_Encoder_HDVICP2_UserGuide.pdf", I do modification below of ilclient_utils.c in capture_encode project.  
 
OMX_ERRORTYPE IL_ClientSetEncodeParams (IL_Client *pAppData)
{
... ...
#if 1
  /* before creating use set_parameters, for run-time change use set_config
     all codec supported parameters can be set using this index       */
 
  OMX_INIT_PARAM (&tDynParams);
 
  tDynParams.nPortIndex = OMX_VIDENC_OUTPUT_PORT;
 
  eError = OMX_GetParameter (pHandle, OMX_TI_IndexParamVideoDynamicParams,
                             &tDynParams);
 
  tDynParams.videoDynamicParams.h264EncDynamicParams.sliceCodingParams.sliceCodingPreset = IH264_SLICECODING_USERDEFINED;
  tDynParams.videoDynamicParams.h264EncDynamicParams.sliceCodingParams.sliceMode = IH264_SLICEMODE_MBUNIT;
  tDynParams.videoDynamicParams.h264EncDynamicParams.sliceCodingParams.sliceUnitSize = 120*1;
  tDynParams.videoDynamicParams.h264EncDynamicParams.videnc2DynamicParams.putDataFxn = &Myslicecbfunc;
  tDynParams.videoDynamicParams.h264EncDynamicParams.videnc2DynamicParams.putDataHandle = pHandle;
 
  eError = OMX_SetParameter (pHandle, OMX_TI_IndexParamVideoDynamicParams,
                             &tDynParams);
#endif
 
#if 1
 
  OMX_INIT_PARAM (&tStaticParam);
 
  tStaticParam.nPortIndex = OMX_VIDENC_OUTPUT_PORT;
   
  eError = OMX_GetParameter (pHandle, OMX_TI_IndexParamVideoStaticParams,
                             &tStaticParam);
 
 
  tStaticParam.videoStaticParams.h264EncStaticParams.videnc2Params.outputDataMode = IVIDEO_SLICEMODE;
  tStaticParam.videoStaticParams.h264EncStaticParams.videnc2Params.numOutputDataUnits = 1;
 
  eError = OMX_SetParameter (pHandle, OMX_TI_IndexParamVideoStaticParams,
                             &tStaticParam);
 
#endif  
... ...
}
 
But the program crashed when running on evm. I guess it is caused by next instruction:
tDynParams.videoDynamicParams.h264EncDynamicParams.videnc2DynamicParams.putDataHandle = pHandle;
But I do not know which handle I should pass to IVIDENC2_namicParams: putDataHandle. Can you give me help about how to implement the slice encoding mode? Thank you!

  • Zhao,

    OMX framework in ezsdk does not support slice level encoding. It is based on frame based on encoding. It will require media controller code level modification  to achieve this. Please contact your local TI contact / FAE to get more details about code access.

    Regards

    Vimal