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.

Encoder setting to give video slice output not working

Hi,

I wanted to get video output as slices instead of full frame.

From the documentation and code, I found one OMX_SetParameter which can server the purpose, IndexParamVideoDataSyncMode.

But unfortunately, only outputDataMode = IVIDEO_ENTIREFRAME is working.

Other modes like IVIDEO_SLICEMODE, IVIDEO_FIXEDLENGTH, are giving bad parameter.

I am using encoder version "ivahd_h264enc_02_00_00_09_production".

Is the other modes not supported?

Any plans to support the same.

What can be the best alternate if it is not supported.

Thanks in advance.

Regards,

Nitish James

  • Hi Nitish,

    Please make sure your application has implemented  getBufferFxn and putDataFxn call back functions to send the partial output buffer to encoder and to get the slice data from encoder.

    Refer Appendix G of H264 Encoder userGuide for low-latency data communication

    Ram

     

     

  • Hi Ram,

    As you correctly pointed out, even if OMX layer have some interface to set from ilclient, it is not implemented in the OMX layer.

    Now I have added support for the same and is in the process of validating decoder part alone.

    I have added some extra code in VLPB to give VLPB output as NAL units and it trying to feed to decoder.

    But decoder is giving InsufficientResources error while creating Decoder instance.

    Relevant LoggerSmDump is given below.

    N:Video P:1 #:00677 T:00000000dcf9784b S:OMX_TI_VIDDEC_CommandNotify::Line 3220::VDEC->Loaded to Idle Transition Begin
    N:Video P:1 #:00678 T:00000000dcf9f573 S:OMX_TI_VIDDEC_CommandNotify::Line 3229::VDEC->Before VIDDEC3_create
    N:Video P:1 #:00679 T:00000000dcff5473 S:OMX_TI_VIDDEC_CommandNotify::Line 3237::VDEC Error->VIDDEC3_create Failed
    N:Video P:1 #:00680 T:00000000dd01a629 S: OMX Error in _OMX_BASE_HandleStateTransition :: line 344
    N:Video P:1 #:00681 T:00000000dd021b71 S:Module<OMX.TI.DUCATI.VIDDEC> Leaving<_OMX_BASE_HandleStateTransition> @line<483> with error<-2147479552:ErrorInsufficientResources>
    N:Video P:1 #:00682 T:00000000dd06c7ff S:Module<OMX.TI.DUCATI.VIDDEC> Leaving<OMX_BASE_PROCESS_CmdEvent> @line<798> with error<-2147479552:ErrorInsufficientResources>
    N:Video P:1 #:00683 T:00000000dd077d35 S:Module<OMX.TI.DUCATI.VIDDEC> Leaving<OMX_BASE_CmdEventHandler> @line<480> with error<-2147479552:ErrorInsufficientResources>
    N:Video P:1 #:00684 T:00000000dd081c2f S:Module<OMX.TI.DUCATI.VIDDEC> Entering<OMX_BASE_CmdEventHandler> @line<448>
    N:Video P:1 #:00685 T:00000000dd08d919 S:Module<OMX.TI.DUCATI.VIDDEC> Leaving<OMX_BASE_CmdEventHandler> @line<480> with error<0:ErrorNone>

    I have followed the exact steps given in the H264_Decoder_Userguide.pdf.

    Can you please tell me what could be the mistake.

    In the document, there is no mention about InsufficientResources error.

    Thanks and Regards,

    Nitish James

  • Hi Nitesh,

    Have you set your decoder also to decode in slice mode as sgown below?

    decStaticParams->viddec3Params.inputDataMode = IVIDEO_FIXEDLENGTH or IVIDEO_SLICEMODE;
     decStaticParams->viddec3Params.numInputDataUnits = 8 ;

    Here also your application needs to implement getDataFxn(to get slice data) and putBuffer(to release the buffer).

    Refer the H264 decoder UserGuide Appendix I for details.

    If you have set inputDataMode = IVIDEO_SLICEMODE, decoder expects atleast 1024 bytes from getData callback. If you send just one NAL (SPS or PPS) , it will be of size max 40 bytes.

    First try setting inputDataMode = IVIDEO_FIXEDLENGTH. and update your getData function to send atleast 1024 bytes to decoder.

    By the way how are sending the slices to decoder's callback?

     

    Ram

  • Hi Ram,

    Yes. I am setting the inputDataMode = IVIDEO_SLICEMODE; and

    decStaticParams->viddec3Params.numInputDataUnits = 1;

    Any specific reason to set the same as 8?

    My intension is to generate fixed size slices from the encoder, which will send to the network as individual packets.

    In the receiving end, I want to get each packet to the decoder one by one.

    I have also implemented getDataFxn and putBuffer.

    I am sending SPS/PPS as separate packets. Since decoder expects atleast 1024, it can be an issue.

    But I am getting error while creating Video decoder. VIDDEC3_create is returning NULL handle.

    What are the conditions at which this situation can happen.

    For sending slices to decoder callback, I am filling XDM_DataSyncDesc with buffer start address and other information in getDataFxn callback.

    Still I might be missing something.

    Can tell me the situations at which VIDDEC3_create can return NULL handle, related to slice handling.

    If I am changing inputDataMode to ENTIREFRAME, it is working fine.

    Thanks and Regards,

    Nitish James

  • Hi Nitesh,

    It was my mistake. Yes, numInputDataUnits should be 1 if IiputDataMode != IVIDEO_ENTIREFRAME.

    Can you try with inputDataMode = IVIDEO_FIXEDLENGTH first.

    getDataFxn will be simple to implement this. But you need to accumulate slices till the sum of bytes is >= 1024.

    Ram

  • Nitesh,

    You can't accumulate the slices for IVDEO_FIXEDLENGTH as the decoder expects slices in contigous memory.

    With IVIDEO_SLICEMODE, you need to accumulate slices in getData Call back and when it is atleast 1024 bytes return to decoder.

    Ram

  • Ram,

    I have already tried FIXEDLENGTH mode and still getting the same issue.

    In a nutshell, VIDDEC3_create is failing if inputDataMode != IVIDEO_ENTIREFRAME

    I am using ezsdk 05.04.00.11 and decoder ivahd_h264dec_01_00_00_08_production.

    Whether other modes are supported in above version of CODEC library.

    Since it is a create time issue, I think there is no need to suspect getData callback implementation, I believe.

    Whether I am missing the initialization of some other static or dynamic parameter?

    Regards,

    Nitish James


  • Hi Ram,

    Is there any test application with slice mode enabled?

    Regards,

    Nitish James

  • Hi Nitesh,

    We have stand-alone decoder which works in slice mode. In getData callback it reads the slice sizes from a file (We have a Utility to generate a .txt file with NAL unit sizes for a given stream) and accumulates the slice sizes and once total slice size is > 1024, callback is returning to decoder

    But in real time also, we need to write getData call back in such a way that, it keeps waiting for slices if current slice size is < 1024.

    Ram

  • Hi Ram,

    I understood the issue you are mentioning.

    I have modified the code in such a way that SPS/PPS packets are merged with the next packet before feeding to decoder.

    But the problem is VIDDEC3_create itself if failing when inputDataMode != IVIDEO_ENTIREFRAME.

    So getData callback is never getting called.

    If you can tell me reason for VIDDEC3_create to fail, I will be able to proceed.

    Which codec version you have used for standalone decoder testing?

    Regards,

    Nitish James

  • Hi Nitesh,

    From the decoder source code, there could be one below condition which makes create fail when inputDataMode != IVIDEO_ENTIREFRAME.

    staticParams.viddec3Params.numInputDataUnits should be 1 and staticParams.processCallLevel should be IH264VDEC_FIELDLEVELPROCESSCALL instead of IH264VDEC_FRAMELEVELPROCESSCALL.

    Can you check with these setings?

    Ram

  • Hi Ram,

    Thanks for the reply.

    There is no variable with name processCallLevel in staticParams in the EZSDK shared with us.

    Even the macros are missing.

    I think this feature is missing in the SDK we are having.

    Any suggestion to overcome this.

    Regards,

    Nitish James

  • Hi Nitish,

    Which version of H264 decoder is integrated to ezsdk? Decoder has processCallLevel is its staticparams.

    Please refer ih264dec.h. 

    Ram

  • Nitesh,

    I thought ezsdk 5.04 has H264dec v2.x, it is using 1.x version. Yes in this version the element processCallLevel is not available.

    Make sure StaticParams->bitStreamFormat is IH264VDEC_BYTE_STREAM_FORMAT and not   IH264VDEC_NAL_UNIT_FORMAT when inptuDataMode is IVIDEO_SLICEMODE.

    Ram

  • Ram,

    It was already set to IH264VDEC_BYTE_STREAM_FORMAT.

    I even tried with IH264VDEC_NAL_UNIT_FORMAT but same result.

    If I try to get H264dec v2.x, whether the problem will be solved?

    Regards,

    Nitish James

  • Hi Ram,

     How to write getBufferFxn and putDataFxn call back functions ?Any some example?

    hjintian

  • If hjintian,

    If you have encoder and decoder packages, refer sample application, which implements these callback functions.

    For encoder 

    ivahd_h264enc_02_00_02_02_production\packages\ti\sdo\codecs\h264enc\app\Test\Src\h264enc_ti_config.c    

    and for decoder

    ivahd_h264vdec_02_00_07_00_production\packages\ti\sdo\codecs\h264vdec\app\test\src\TestAppDecSupport.c

    Ram

  • Hi Ram,

      Thank you for your reply.

      Sorry,i use ezsdk_5_05_02_00 ,not rdk.Can you give some advice about last question?How to output slices stream on omx encoder?

      Can you tell me how to set parameters on omx encode example for outputing slices stream?

      Thank you very much.

    Regards,

    tory

  • Hi Tory,

    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.

    Refer Appendix G of H264 Encoder userGuide for low-latency data communication.

    Ram

  • Hi Ram,

      Thank you for your reply.

      Can you give a example code?

      Thank you very much.

    tory

  • Hi Nitesh,

      I want to use slice based encode / decode in our streaming setup (OMX platform and H.264 codec). I am new to this. I would like to know how you implement the getDataFxn and  putDataFxn functions ?

       I know you might done this long before, but If you possible to share some code snippet, it would be greatly helpful to us ?

    Thank you,

    Hareesh