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.

OMX Capture_encode demo

Other Parts Discussed in Thread: TVP7002

Hi,

 I am a beginner about OpenMax.

Q1

 I found in the OMX components, CTRL component is to configure external video decoder,

 such as TVP7002, which is used in DM8168 EVM.

 But now, we are designing a board using DM8168 and FPGA, without any external video decoder.

 So, in this situation, does OpenMax still work in this board?

 I mean, Can I capture images just using VFCC without CTRL components?

 

Q2

 Another question.

 I don't have 1080P or 720P video source, so I modified the capture_decode demo for 1080i capture,

 followed this post http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/131887.aspx.

 Thanks for Archith, It worked.

 Now because I don't need encode in my program, so I delete the Encode and Display part in the demo.

 And set 1 output port for dei comp to write images to files. Below is the source.

 1817.capture_encode.zip

 When I run it, Capture Component seems OK,

 FillBufferDone callback function will be called, and EmptyBufferDone function for Dei component also be called after it.

 But dei will never reach IL_ClientCbFillBufferDone callback function.

 Can anyone help me with this problem?

 

 Thank you.

 

 

Regards,

lei

  • Lei Wong said:

    Q1

     I found in the OMX components, CTRL component is to configure external video decoder,

     such as TVP7002, which is used in DM8168 EVM.

     But now, we are designing a board using DM8168 and FPGA, without any external video decoder.

     So, in this situation, does OpenMax still work in this board?

     I mean, Can I capture images just using VFCC without CTRL components?

    In the current EZSDK,out of the box, there is no support for a decoder other than TVP 7002. Please go through the below thread for details on how the support would be in releases in the future and how you could possibly work around this limitation:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/135027.aspx

     

    Lei Wong said:

    Q2

     Another question.

     I don't have 1080P or 720P video source, so I modified the capture_decode demo for 1080i capture,

     followed this post http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/131887.aspx.

     Thanks for Archith, It worked.

     Now because I don't need encode in my program, so I delete the Encode and Display part in the demo.

     And set 1 output port for dei comp to write images to files. Below is the source.

     1817.capture_encode.zip

     When I run it, Capture Component seems OK,

     FillBufferDone callback function will be called, and EmptyBufferDone function for Dei component also be called after it.

     But dei will never reach IL_ClientCbFillBufferDone callback function.

     Can anyone help me with this problem?

     

    DEI is a 3 port component 1 input and 2 output. All the three output ports have to be enabled and have to have buffers populated. I think you are not populating any or either of the output ports. You can do an Allocate Buffer on the 2 output ports and do FTB on both the output ports to populate them. Only that, queue the same buffers back into the component without passing it on to other components.

     

    Archith

  • Hi Archith,

      Thank you very much for your reply, and sorry to disturb you again.

    Q1

    Archith John Bency said:

    In the current EZSDK,out of the box, there is no support for a decoder other than TVP 7002. Please go through the below thread for details on how the support would be in releases in the future and how you could possibly work around this limitation:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/135027.aspx

      

      I read this thread, and you said

    Archith John Bency said:

    If you can ensure that the decode is pumping BT1120 embedded sync into the SoC's VIP port, then TVP comoponent is not required to be created/configured/executed. But please keep in mind that this has not been tested in the EZSDK.

      In my situation, the VIN Port of DM8168 is connected with FPGA, I mean I know the video format coming into VIN Port.

      So, the TVP component can be deleted, right? 

      In the future, when the new EZSDK with Vport driver released, can I use that driver for my board?

      I'm sorry , I am not so familiar with these.

     

    Q2

    Archith John Bency said:
    DEI is a 3 port component 1 input and 2 output. All the three output ports have to be enabled and have to have buffers populated. I think you are not populating any or either of the output ports. You can do an Allocate Buffer on the 2 output ports and do FTB on both the output ports to populate them. Only that, queue the same buffers back into the component without passing it on to other components.

      I enabled the 2 output port of DEI as you said.

      This time it stoped when Capture filled all the 6 buffer of output port.

      Dei component got the ETB message from local pipe, and called OMX_EmptyThisBuffer function with no errors.

      But I cannot see the IL_ClientCbEmptyBufferDone function be called, of course, IL_ClientCbFillBufferDone callback function also not be called.

     

     

    Regards,

    lei

      

     

  •  

    Lei Wong said:
    Dei component got the ETB message from local pipe, and called OMX_EmptyThisBuffer function with no errors.

    You need to perform FillThisBuffer calls as well on the DEI output ports. Only then would the DEI have all the buffers required to operate. After doing this, you should  be able to see Call Backs (Fill Buffer Done and EmptyBufferDone) coming along. Please have a look at the Capture_encode OMX example in the EZSDK  for more details.

    Lei Wong said:
    In the future, when the new EZSDK with Vport driver released, can I use that driver for my board?

    In the future, configuration of the video decoder of your choice would done via Linux. You would have to port the decoder driver to the framework that would be provided. Further details would be in the documentation that would be present in the package with this future release.

    Archith

  • Hi Archith,

      Thank you very much.

    Archith John Bency said:
    You need to perform FillThisBuffer calls as well on the DEI output ports.

     

      It works.

      Thanks again.

     

    Regards,

    lei

  • hi lei,

         I can't understand the sentence "You need to perform FillThisBuffer calls as well on the DEI output ports",

        Can you give some code piece for demo?

      Thanks

  • hi chris,

     I did it like this,

      for (j = 0; j < deiComp->numOutport; j++)
    {
    for (i = 0; i < (deiComp->outPortParams+j)->nBufferCountActual; i++)
    	{
    /* Pass the output buffer to the component */
    err = OMX_FillThisBuffer (deiComp->handle,
                        (deiComp->outPortParams+j)->pOutBuff[i]);
    	}
    }
    
    
    Wish could be help.
    
    
    Regards,
    Lei
  • hi lei:

        Thanks for your reply and help

        I add your code , and it seems not work

       Below is what is do:

     1.In the function Capture_Display_Example 


    pthread_attr_init (&pAppData->deiILComp->ThreadAttr);

    if (0 !=
    pthread_create (&pAppData->deiILComp->outDataStrmThrdId,
    &pAppData->deiILComp->ThreadAttr,
    IL_ClientOutputBitStreamWriteTask, pAppData))
    {
    printf ("Create_Task failed !");
    goto EXIT;
    }

    printf (" file write thread created \n ");


    pthread_attr_init (&pAppData->deiILComp->ThreadAttr);

    if (0 !=
    pthread_create (&pAppData->deiILComp->connDataStrmThrdId,
    &pAppData->deiILComp->ThreadAttr,
    IL_ClientConnInConnOutTask, pAppData->deiILComp))
    {
    printf ("Create_Task failed !");
    goto EXIT;
    }

    printf (" dei connect thread created \n ");

    pthread_attr_init (&pAppData->capILComp->ThreadAttr);

    if (0 !=
    pthread_create (&pAppData->capILComp->connDataStrmThrdId,
    &pAppData->capILComp->ThreadAttr,
    IL_ClientConnInConnOutTask, pAppData->capILComp))
    {
    printf ("Create_Task failed !");
    goto EXIT;
    }
    printf (" capture connect thread created \n ");

    if (0 !=
    pthread_create (&pAppData->disILComp->connDataStrmThrdId,
    &pAppData->disILComp->ThreadAttr,
    IL_ClientConnInConnOutTask, pAppData->disILComp))
    {
    printf ("Create_Task failed !");
    goto EXIT;
    }
    printf (" display connect thread created \n ");

    printf (" executing the application now!! \n");
    
    
    2. Thread function  IL_ClientOutputBitStreamWriteTask
    void IL_ClientOutputBitStreamWriteTask (void *threadsArg)
    {
    unsigned int dataRead = 0;
    OMX_ERRORTYPE err = OMX_ErrorNone;
    IL_CLIENT_COMP_PRIVATE *deiILComp = NULL;
    OMX_BUFFERHEADERTYPE *pBufferOut = NULL;
    static unsigned int frameCounter = 0;

    deiILComp = ((IL_Client *) threadsArg)->deiILComp;
    /* use the initial i/p buffers and make empty this buffer calls */
    err = IL_ClientEncUseInitialOutputResources (deiILComp);

    printf (" IL_ClientOutputBitStreamWriteTask \n");
    while (1)
    {
    /* Read filled buffer pointer from the pipe */
    read (deiILComp->outPortParams->opBufPipe[0],
    &pBufferOut, sizeof (pBufferOut));
    printf (" Read frame over %d \n",deiILComp->handle);
    /* write data to output file */
    /*
    fwrite (pBufferOut->pBuffer,
    sizeof (char),
    pBufferOut->nFilledLen, ((IL_Client *) threadsArg)->fOut);
    frameCounter++;
    if(frameCounter == deiILComp->numFrames)
    {
    frameCounter = 0;
    semp_post(deiILComp->eos);
    pthread_exit(deiILComp);
    }
    */

    /* Pass the input buffer to the component */
    err = OMX_FillThisBuffer (deiILComp->handle, pBufferOut);

    if (OMX_ErrorNone != err)
    {
    /* put back the frame in pipe and wait for state change */
    write (deiILComp->outPortParams->opBufPipe[1],
    &pBufferOut, sizeof (pBufferOut));
    printf (" waiting for action from IL Client \n");

    /* since in this example we are changing states in other thread it will
    return error for giving ETB/FTB calls in non-execute state. Since
    example is shutting down, we exit the thread */

    pthread_exit (deiILComp);

    }
    }

    }
    
    
    3.in function I add your code
    
    
    OMX_ERRORTYPE IL_ClientEncUseInitialOutputResources (IL_CLIENT_COMP_PRIVATE 
    *thisComp)
    {
    OMX_ERRORTYPE err = OMX_ErrorNone;
    unsigned int i = 0, j = 0;

    #if 0
    for (i = 0; i < thisComp->outPortParams->nBufferCountActual; i++)
    {
    /* Pass the output buffer to the component */
    err = OMX_FillThisBuffer (thisComp->handle,
    thisComp->outPortParams->pOutBuff[i]);
    }
    #endif

    for (j = 0; j < thisComp->numOutport; j++)
    {
    for (i = 0; i < (thisComp->outPortParams+j)->nBufferCountActual; i++)
    {
    /* Pass the output buffer to the component */
    err = OMX_FillThisBuffer (thisComp->handle,
    (thisComp->outPortParams+j)->pOutBuff[i]);
    }
    }

    return err;
    }
    
    

    my source file

    5672.src.zip

     Thanks 

  • hi lei:

        Could you tell me what's wrong with my code and where should I change the code?

      Thanks 

  • Hi chris,

    chris liu said:
    3.in function I add your code
    
    
    OMX_ERRORTYPE IL_ClientEncUseInitialOutputResources (IL_CLIENT_COMP_PRIVATE 
    *thisComp)
    {
    OMX_ERRORTYPE err = OMX_ErrorNone;
    unsigned int i = 0, j = 0;

    #if 0
    for (i = 0; i < thisComp->outPortParams->nBufferCountActual; i++)
    {
    /* Pass the output buffer to the component */
    err = OMX_FillThisBuffer (thisComp->handle,
    thisComp->outPortParams->pOutBuff[i]);
    }
    #endif

    for (j = 0; j < thisComp->numOutport; j++)
    {
    for (i = 0; i < (thisComp->outPortParams+j)->nBufferCountActual; i++)
    {
    /* Pass the output buffer to the component */
    err = OMX_FillThisBuffer (thisComp->handle,
    (thisComp->outPortParams+j)->pOutBuff[i]);
    }
    }

    return err;
    }

    Yes, I just modified my code like this, and It worked in my case.

    What are you trying to do? I didn't use VFDC component in my case.

    what is your board version and ezsdk version?

    If you can post the output message of your code, maybe I can do some help.

    Regards,

    Lei 

  • Hi lei:

          I just want to remove the encode part from the Capture_encode example in the omx demo, my sdk version is ti-ezsdk_dm816x-evm_5_03_01_15,

    and my board is 8168 evm (version F).

         The below is the message of trace :

         

     

    root@dm816x-evm:/usr/test# ls
    capture_display_a8host_debug.xv5T runCapDisply.sh
    capture_encode_a8host_debug.xv5T runCaptureEncode
    root@dm816x-evm:/usr/test# /etc/init.d/matrix-gui-e stop
    Stopping Matrix GUI application.
    root@dm816x-evm:/usr/test# cat runCapDisply.sh
    #!/bin/sh



    #
    # Turn on the ALSA Mixer
    #
    configure_alsa_mixer()
    {
    amixer sset 'Left PGA Mixer Mic3L' on
    amixer sset 'Left PGA Mixer Mic3R' on
    amixer sset 'Right PGA Mixer Mic3L' on
    amixer sset 'Right PGA Mixer Mic3R' on

    amixer cset name='PCM Playback Volume' 75%,75%
    amixer cset name='PGA Capture Volume' 75%,75%
    }



    #
    # In order to view video, the graphics plane needs to be
    # disabled. Once the video has finished playing the graphics
    # plane needs to be re-enabled.
    #
    # Call this function with 0 to disable graphics and 1 to
    # enable it.
    #
    configure_graphics()
    {
    echo $1 > /sys/devices/platform/vpss/graphics0/enabled
    echo $1 > /sys/devices/platform/vpss/graphics1/enabled
    }




    #
    # Call this function to setup and execute the demo
    #
    execute_demo()
    {
    # cd /usr/share/ti/ti-omx

    ./capture_display_a8host_debug.xv5T -m 1080p -f 60 -d 1
    }


    # Disable Graphics Plane so that Video can be seen.
    configure_graphics 0

    configure_alsa_mixer
    execute_demo

    # Enable Graphics again.
    configure_graphics 1
    root@dm816x-evm:/usr/test# ./runCapDisply.sh
    VPSS_GRPX : please open fb1 node first.
    Simple mixer control 'Left PGA Mixer Mic3L',0
    Capabilities: pswitch pswitch-joined penum
    Playback channels: Mono
    Mono: Playback [on]
    Simple mixer control 'Left PGA Mixer Mic3R',0
    Capabilities: pswitch pswitch-joined penum
    Playback channels: Mono
    Mono: Playback [on]
    Simple mixer control 'Right PGA Mixer Mic3L',0
    Capabilities: pswitch pswitch-joined penum
    Playback channels: Mono
    Mono: Playback [on]
    Simple mixer control 'Right PGA Mixer Mic3R',0
    Capabilities: pswitch pswitch-joined penum
    Playback channels: Mono
    Mono: Playback [on]
    numid=1,iface=MIXER,name='PCM Playback Volume'
    ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
    : values=96,96
    | dBscale-min=-63.50dB,step=0.50dB,mute=0
    numid=37,iface=MIXER,name='PGA Capture Volume'
    ; type=INTEGER,access=rw---R--,values=2,min=0,max=119,step=0
    : values=90,90
    | dBscale-min=0.00dB,step=0.50dB,mute=0
    output file: 罌牼X@
    bit_rate: 0
    frame_rate: 60
    num_frames: 0
    mode: 1080p
    display_id: 1
    Capture-Encode example
    ===============================
    OMX_Init completed
    UIAClient is ready to send a UIA configuration command
    UIAClient received UIA_CONFIGURE_ACK
    UIAClient is done sending requests
    UIAClient is ready to send a UIA configuration command
    UIAClient received UIA_CONFIGURE_ACK
    UIAClient is done sending requests
    openeing file
    capture compoenent is created
    control TVP compoenent is created
    Buffer Size computed: 3110400
    set input port params (width = 1920, height = 1080)enable capture output port
    got event:Enable/Disable Event
    dei compoenent is created
    set input port params (width = 1920, height = 1080)
    set output port params (width = 1920, height = 1080)set output port params (width = 1920, height = 1080)set number of channelsset input resolutionset output resolutionenable dei input port
    got event:Enable/Disable Event
    enable dei output port 0
    got event:Enable/Disable Event
    enable dei output port 1
    got event:Enable/Disable Event
    found handle 0x129350 for component OMX.TI.VPSSM3.VFDC
    got display handle
    found handle 0x12ce58 for component OMX.TI.VPSSM3.CTRL.DC
    Buffer Size computed: 4147200
    set input port params (width = 1920, height = 1080)setting input and output memory type to defaultenable input port
    got event:Enable/Disable Event
    connect call for capture-Dei
    connect call for dei-display
    got event:State changed to: OMX_StateIdle
    Capture outport buffers allocated
    got event:State changed to: OMX_StateIdle
    Capture is in IDLE state
    Dei input port use buffer done
    DEI numOutport(0) buffers allocated
    DEI numOutport(1) buffers allocated
    DEI outport buffers allocated
    got event:State changed to: OMX_StateIdle
    DEI is in IDLE state
    got event:State changed to: OMX_StateIdle
    ctrl-dc state IDLE
    display buffers allocated
    waiting for IDLE
    got event:State changed to: OMX_StateIdle
    display state IDLE
    got event:State changed to: OMX_StateExecuting
    display control state execute
    got event:State changed to: OMX_StateExecuting
    display state execute
    got event:State changed to: OMX_StateExecuting
    dei state execute
    got event:State changed to: OMX_StateExecuting
    capture state execute
    got event:State changed to: OMX_StateExecuting
    capture control ( TVP ) state execute
    file write thread created
    dei connect thread created
    capture connect thread created
    display connect thread created
    executing the application now!!
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
  • Hi chris,

    I think you don't need IL_ClientOutputBitStreamWriteTask this thread anymore in your case.

    Just try to delete these lines of ilclient.c (line 1279~1292)

     pthread_attr_init (&pAppData->deiILComp->ThreadAttr);

    if (0 !=
    pthread_create (&pAppData->deiILComp->outDataStrmThrdId,
    &pAppData->deiILComp->ThreadAttr,
    IL_ClientOutputBitStreamWriteTask, pAppData))
    {
    printf ("Create_Task failed !");
    goto EXIT;
    }

    printf (" file write thread created \n ");
    
    
    Wish it could be help.
    
    
    Regards,
    Lei
  • hi lei:

          Thanks for your reply and help!

         I comment the code and run it  , it still no out put .

       trace :

    OMX_Init completed 
    UIAClient is ready to send a UIA configuration command
    UIAClient received UIA_CONFIGURE_ACK
    UIAClient is done sending requests
    UIAClient is ready to send a UIA configuration command
    UIAClient received UIA_CONFIGURE_ACK
    UIAClient is done sending requests
    openeing file
    capture compoenent is created
    control TVP compoenent is created
    Buffer Size computed: 3110400
    set input port params (width = 1920, height = 1080)enable capture output port
    got event:Enable/Disable Event
    dei compoenent is created
    set input port params (width = 1920, height = 1080)
    set output port params (width = 1920, height = 1080)set output port params (width = 1920, height = 1080)set number of channelsset input resolutionset output resolutionenable dei input port
    got event:Enable/Disable Event
    enable dei output port 0
    got event:Enable/Disable Event
    enable dei output port 1
    got event:Enable/Disable Event
    found handle 0x129350 for component OMX.TI.VPSSM3.VFDC
    got display handle
    found handle 0x12ce58 for component OMX.TI.VPSSM3.CTRL.DC
    Buffer Size computed: 4147200
    set input port params (width = 1920, height = 1080)setting input and output memory type to defaultenable input port
    got event:Enable/Disable Event
    connect call for capture-Dei
    connect call for dei-display
    got event:State changed to: OMX_StateIdle
    Capture outport buffers allocated
    got event:State changed to: OMX_StateIdle
    Capture is in IDLE state
    Dei input port use buffer done
    DEI numOutport(0) buffers allocated
    DEI numOutport(1) buffers allocated
    DEI outport buffers allocated
    got event:State changed to: OMX_StateIdle
    DEI is in IDLE state
    got event:State changed to: OMX_StateIdle
    ctrl-dc state IDLE
    display buffers allocated
    waiting for IDLE
    got event:State changed to: OMX_StateIdle
    display state IDLE
    got event:State changed to: OMX_StateExecuting
    display control state execute
    got event:State changed to: OMX_StateExecuting
    display state execute
    got event:State changed to: OMX_StateExecuting
    dei state execute
    got event:State changed to: OMX_StateExecuting
    capture state execute
    got event:State changed to: OMX_StateExecuting
    capture control ( TVP ) state execute
    dei connect thread created
    capture connect thread created
    display connect thread created
    executing the application now!!
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928
    ClientCbFillBufferDone 1168928

  • Hi chris,

     Are you using 1080p as your video input?

     Have you tested the video source using the capture sample (Encoder include)? 

     I am sorry that I am a beginner about this part, and I cannot find where you are wrong in your code.

     And now , my board is not work so I can't try your code on my board.

     Maybe you should check your video source.

     Good luck.

    Regards,

    lei

  • Lei,

    DEI component will work only when both o/p ports are connected. So If you do now want to have encoder, you should just return the buffer received from DEI on the port where encoder is connected. Whenever encode thread was receiving EmptyThisBuffer, you can directly call EmptyBufferDone..this way without calling encoder you can have chain functional.

    Regards

    Vimal