SlideShare a Scribd company logo
1 of 68
Understanding
                OpenMAX-IL


Chethan Palakshamurthy – 5/5/2012
Outline
1. What is OpenMAX-IL?
2. OMXIL Entities – Core, Components and
   Ports
3. OMXIL Component Architecture
4. OMXIL Profiles – Base and Interop
5. OMXIL Component States
Outline
6.   Buffers and Buffer Headers
7.   Simple Core/Component Usage
8.   Tunneling Setup
9.   Transitions
     – Non-Tunneled
     – Tunneled

Disclaimer:
•     For simplicity, we are not considering buffer sharing and port enable/disable
•     For simplicity, we do not consider intricacies on any scenarios where states of
      components are not done togethre.
Index
1. What is OpenMAX-IL?
OpenMAX-IL

• From Khronos
OpenMAX-IL
OpenMAX™ is a royalty-free, cross-platform
API that provides comprehensive streaming
media codec and application portability by
enabling accelerated multimedia components
to be developed, integrated and programmed
across multiple operating systems and silicon
platforms. The OpenMAX API will be shipped
with processors to enable library and codec
implementers to rapidly and effectively make
use of the full acceleration potential of new
silicon - regardless of the underlying hardware
architecture.
OpenMAX-IL
• Is a cross-platform multimedia API
  – Not framework?
• C Based API
  – Very clean, concise
• Defines
  – data types [OMX_types.h]
  – APIs as functions and macros
Software Landscape
Need, Benefits
• Codecs, filters, sources, sinks etc have certain
  common characteristics, but have varied
  implementations.
  – State machine,
  – Command set, Parameters
  – Data exchange methodologies
  – API
• OpenMAX-IL standardizes such
  implementations with APIs (setup and
  communication), so that they are portable,
  benefiting – SV, ISV, OSV, OEMs
Index
1. What is OpenMAX-IL?
2. OMXIL Entities – Core, Components and Ports
OpenMAX-IL Entities
1. Core [OMX_Core.h]

2. Components [OMX_Component.h]
   a. Names, Roles
   b. Ports [OMX_Port.h]


3. {IL-Client}
Core
The OpenMAX-IL core is used for and only for -
• Dynamically loading and unloading components
• Facilitating component communication (tunneling)
• Queries about installed components and the roles
  they support
• Once loaded, the API allows the user to
  communicate directly with the component, which
  eliminates any overhead
Component
• An OpenMAX IL component is a software block which can
  produce / process / transform / consume media or
  related data

• Components can be sources, sinks, codecs, filters,
  splitters, mixers, or any other data operator
   – E.g., H264 Video decoder component

• Component could possibly represent a piece of
  hardware, a software codec, another processor, or a
  combination thereof

• OMXIL Component API and semantics are designed to be
  able to create (flexible) pipeline/graph of multiple
  components to realize varied combinations of media
  processing use cases.
Component
• Component has a name and may have 1 or more
  roles for discovery and selection based on capability
• Has input and output ports for media
  interconnection with other components and/or IL
  client
• Can be configured with parameters relevant to its
  operation
• Provides errors, asynchronous notifications, events
  to the IL client
• Has OMXIL defined state machine built-in for control
  by IL client
Component Name
• A component’s unique identifier in a system.

• Naming convention -
OMX.<vendor_name>.<vendor_specified_convention>
   – For e.g., OMX.STE.MP3Decoder.ProductXYZ


• To load, IL client can enumerate and select a
  component by name.
   – Core API: OMX_ComponentNameEnum
Component Role

• Is the behavior of component acting according to a particular
  standard or vendor-specific component definition.
    – i.e., A role is a component’s capability

• A component named OMX.CompanyXYZ.MyAudioDecoder may
  support these roles
    – audio_decoder.mp3 (mp3 decode capability)
    – audio_decoder.aac (aac decode capability)
    – audio_decoder.amr (amr decode capability)

• IL client can choose a component to load by looking for a specific
  role using
    a.   OMX_ComponentOfRoleEnum
    b.   Or, OMX_ComponentNameEnum +
         OMX_RoleOfComponent
Ports
• Components have ports as a channel to
  communicate media data with other
  component or IL client.
• Types:
  – Input, Output
  – Image, Video, Audio and Other
  – E.g., Video input port
Ports
Port communication
• Non-tunneled
  – Data buffers are exchanged between client and
    component
• Tunneled
  – Data buffers are exchanged directly between
    components, in a way as defined by standard
• Proprietary
  – Data buffers are exchanged directly between
    components, via proprietary APIs
Port communication
Ports – some terminologies
• A tunneling port is the port which it shares a tunnel with another
  component.
    – E.g., port b is the tunneling port to port a. Likewise, port a is the
      tunneling port to port b.
• An allocator port is a port that allocates its own buffers.
    – Port a is the only allocator port.
• Buffer supplier port is a port which supplies buffers to its tunneled
  port.
    – Buffers either allocated by itself (e.g., port a)
    – Or, buffers allocated by other components and shared (e.g., port c)
    – In non-tunneled comm, if IL client is supplying buffers, IL client is the
      buffer supplier.
• A sharing port is a port that re-uses buffers from another port on
  the same component.
    – E.g., port c
• A tunneling component is a component that uses at least one
  tunnel.
Ports – some terminologies


           IL Client
Index
1. What is OpenMAX-IL?
2. OMXIL Entities – Core, Components and
   Ports
3. OMXIL Component Architecture
OMXIL Component Architecture
Comp. Arch – Some new stuff

• Component handle
   – Opaque pointer to a component object in memory
   – Returned on creation of component by OMX_GetHandle
• Parameters/Configurations
   – Parameters are the static settings of a component. E.g., Number of buffers on
     a port etc
   – Configuration defines the dynamic settings of a component. For e.g.,
     complexity of post processing etc
   – APIs: OMX_GetConfig(index, valueStruct), OMX_SetConfig,
     OMX_SetParameter, OMX_GetParameter
   – It is mandatory to support some standard indices
• Commands
   – Allow IL client to control components
   – E.g., To move a component from one state to another
     OMX_SendCommand(comp_handle, OMX_CommandStateSet…)
Comp. Arch – Some new stuff

• Callbacks
   – Components are given a set of callback functions (at creation time) to provide
     asynchronous notifications/events to IL client.
   – Those are EventHandler(), FillBufferDone(),
     EmptyBufferDone()


• Event Handler
   – Component uses this to notify IL client of certain async events like completion
     of a command, Error, Port settings change etc.
Index
1. What is OpenMAX-IL?
2. OMXIL Entities – Core, Components and
   Ports
3. OMXIL Component Architecture
4. OMXIL Component Profiles – Base and
   Interop
Component profiles

• Base profile
     –   Shall support non-tunneled communication
     –   Does not support tunneled communication
     –   May support proprietary communication
     –   exists to reduce the adoption barrier for OpenMAX IL implementers by
         simplifying the implementation
• Interop profile
     – Is a superset of the base profile
     – Shall support non-tunneled and tunneled communication
     – May support proprietary communication


•   Shall  Requirement. If not met, component is not conformant to OpenMAX IL
•   Should  Not a requirement but recommended/good practice
•   May  Optional requirement
•   Will  Not a requirement
Types of Communication Supported
          Per Component Profile


 Type of Communication           Base Profile Support           Interop Profile Support
 Non-tunneled comm               Yes                            Yes
 Tunneled comm                   No                             Yes
 Proprietary comm                Yes                            Yes




NOTE:
An Interop profile compliant component may have both tunneled as well as non-tunneled
    communication
Index
1. What is OpenMAX-IL?
2. OMXIL Entities – Core, Components and
   Ports
3. OMXIL Component Architecture
4. OMXIL Component Profiles – Base and
   Interop
5. OMXIL Component States
Component States
• OpenMAX-IL identifies the states that a
  component can be in at any point of time.
  1.   Unloaded
  2.   Loaded
  3.   Idle
  4.   Waiting for Resources
  5.   Paused
  6.   Executing
Component States
• IL client shall move components from one state to another.
   – A component can perform a state transition by itself only in cases of
     error, loss of resource etc
   – IL-client is notified of such change via EventHandler
• OMXIL defines a state transition graph
• OMXIL defines what the internal state (w.r.t
  buffers/communication/processing) of the component must
  be in each state
• OMXIL defines what a component must do while transitioning
  from one to another
State Transition Graph
Component States
• Every component is first considered to be unloaded.

• The component shall be loaded through a call to the
  OpenMAX IL core – OMX_GetHandle().

• All other state transitions may then be achieved by
  communicating directly with the component.
Component States
• INVALID : unrecoverable ‘dead’ state. Can only be
  unloaded. Enters on event of fatal error.
• LOADED : component is in memory
• IDLE : Moved here from Idle. Has acquired static
  resources
• WAIT FOR RESOURCE – Intermediate between
  Loaded and Idle. Upon entering the WAIT FOR
  RESOURCE state, the component registers with a
  vendor-specific resource manager to alert it
  when resources have become available. The
  component will subsequently transition into the
  IDLE state.
Component States
• EXECUTING : state indicates data is processed and
  buffers are exchanged
• PAUSED : suspension of exchange and processing of
  buffers, with context preserved
• Transitioning from EXECUTING or PAUSED to IDLE will
  cause the context in which buffers were processed to
  be lost, which requires the start of a stream to be
  reintroduced.
• Transitioning from IDLE to LOADED will cause
  operational resources such as communication buffers
  to be lost.
Index
6. Buffers and Buffer Headers
Buffers and Buffer headers
• Buffers are raw pieces of memory that contain media or
  related data

• Buffer headers are structures that along with the buffer
  pointer, contain metadata describing the data in buffers
   – Buffer allocated size, data size, data offset etc


• Between two entities at either ends of a communication path,
  one allocates the buffers, while the other allocates buffer
  header.
   – Between two tunneled ports or
   – Between IL client and the port it interfaces with
Buffers and Buffer headers
• Data communications with components is always directed to a
  specific component port.

• Every component port shall be capable of allocating its own
  buffers or using pre-allocated buffers; one of these choices
  will usually be more efficient than the other.
Buffers and Buffer headers
Buffer communication APIs:
• OMX_EmptyThisBuffer is always called on
  input ports
  – Called by a tunneled component or IL client

• OMX_FillThisBuffer is always called with
  output ports
  – Called by a tunneled component or IL client

• EmptyBufferDone or FillBufferDone
  callbacks
  – Callback functions called by component (port) on IL
    client to notify completion of emptying or filling.
  – Used only in non-tunneled communication
Buffers and Buffer headers


          OMX_EmptyThisBuffer(compB)



 Comp A                     Comp B



          OMX_FillThisBuffer(compA)




 Buffer exchange between tunneled ports
Buffers and Buffer headers


                IL Client

                              OMX_FillThisBuffer()

OMX_CALLBACKTYPE::
FillBufferDone()




                 Camera
               Component


 Buffer exchange in non-tunneled mode
Index
6. Buffers and Buffer Headers
7. Simple Core/Component Usage
Simple Core/Component Usage
• OMXIL core is initialized with OMX_Init()
• Multiple components are chosen after enumeration
  and created with OMX_GetHandle()
   – Components are now in OMX_Loaded state.
• IL client sets relevant parameters and configurations
  of components in this state
• IL client sets up tunnels between two compatible
  ports where it deems possible using
  OMX_SetupTunnel().
• IL client moves all components from Loaded  Idle
  state using OMX_SendCommand(comp_handle,
  OMX_CommandStateSet…)
   – A notification/error is received by IL client via
     EventHandler about state change
Simple Core/Component Usage

• IL client moves all components from Idle  Executing
  state
   – Buffer exchanges begin transferring media data ‘downstream’
• For e.g., if the components are Mpeg4 demuxer, Mpeg4
  decoder and Video renderer, in OMX_Executing state,
  video frames are rendered on to the screen
• IL client is notified of ‘End of Stream’ when playback is
  done.
• IL client moves all components to OMX_Idle state
• IL client then, moves all components to OMX_Loaded state
• IL client then, calls OMX_Deinit() upon which the
  components are deleted, and core is de-initialized.
Simple Core/Component Usage


                    IL client


                         CALLBACKS




   Mpeg4            Mpeg4             Video
  Demuxer           Decoder          Renderer




    Buffer exchange between tunneled ports
Index
6. Buffers and Buffer Headers
7. Simple Core/Component Usage
8. Tunneling Setup
Tunneling setup
• IL client shall establish tunneling between two ports
  when two components are in OMX_Loaded state.
• Using OMX_SetupTunnel(compA,     outputPortNum,
  compB, inputPortNum)
• For a given tunnel, exactly one port supplies the
  buffers. The component (or port) which supplies
  buffers is decided during tunnel setup.
Tunneling setup - Protocol
• The OMX_SetupTunnel impl first calls
  CompA::ComponentTunnelRequest(setupPrefA) – the
  component of output port. CompA fills setupPrefA and
  returns.

• OMX_SetupTunnel then calls
  CompB::ComponentTunnelRequest(setupPrefA). –             the
  component of input port .
   – Now, setupPrefA is read-only for compB’s review.


• Comp B reviews setupPrefA, checks compatibility
   – If OK, decides which port would be the buffer supplier and sets the
     same on CompA with
      OMX_SetParameter(OMX_IndexParamCompBufferSupplier,
      ..)
… Buffer supplier Negotiation
• For tunneling, CompA may prefer buffer supplier to be
    Output port OR Input port OR Unspecified
    (this is part of setupPrefA)


• In any case, its up to the impl of compB to honor or disregard
  CompA’s preference.
    – CompB may call CompA->SetParameter(ParamBufferSupplier,
      BsChoice)
    – CompB’s choice may vary from one comp to the other.

• (The negotiation is not clearly specified and depends on the
  OMX_SetupTunnel implementation)
• After successful setup, IL client can override the buffer
  supplier
Tunneling – Buffer Allocation
• To set up tunneling components, the IL client
  should perform the following setup operations in
  this order:
  – Load all tunneling components and set up the tunnels
    on these components.
  – Command all tunneling components to transition
    from the loaded state to the idle state.
     Each supplier port of a non-sharing component does the
     following
      • Determine the buffer requirements of its tunneled port via
        an OMX_GetParameter call.
      • Allocate buffers according to the maximum of its own
        requirements and the requirements of the tunneled port.
      • Call OMX_UseBuffer on its tunneling port.
Index
6.   Buffers and Buffer Headers
7.   Simple Core/Component Usage
8.   Tunneling Setup
9.   Transitions
Transitions (T|NT)
• Loaded
  1. [Tunnel setup]
• Loaded to Idle:
  1. Buffer and Buffer header allocation
• Idle to Executing
  1. Start buffer exchanges
• Executing to Idle
  1. Return buffers to their owners / IL client
• Idle to loaded
  1. Owners delete buffers
  2. Owners ask tunneled ports to free related data.
Index
6.   Buffers and Buffer Headers
7.   Simple Core/Component Usage
8.   Tunneling Setup
9.   Transitions
     – Non-Tunneled
Non-tunneled - Loaded to Idle
• IL client asks component to move from loaded
  to idle
• Buffer supplier in non-tunneled mode is
  always the IL client
• IL client calls OMX_AllocateBuffer /
  OMX_UseBuffer on each port it interfaces
• Component thus has needed buffers on all
  ports and moves to Idle state.
• [Who allocates buffers is decided by IL client]
Non-tunneled - Loaded to Idle
 •   OMX_AllocateBuffer is only called in a non-tunneled mode. Allocates
     both buffer and buffer header
                                                           B21*

                                     IL Client             B22*
                                                           B23*
OMX_AllocateBuffer()                                        B24*
                                                   OMX_UseBuffer()

                                 Component


                     owns
                                                 owns


           BH11*      B11*                         BH21*
           BH12*      B12*                         BH22*
           BH13*      B13*                         BH23*
           BH14*      B14*                         BH24*
Non-tunneled – Idle to Executing
• Idle to Executing:
   – IL client asks the component to move from Idle to
     Executing state
   – Component transitions to Executing
• In Executing state…
   – IL client is entirely responsible for moving data buffers
     among components if data tunneling is not used
   – IL client calls OMX_EmptyThisBuffer on input port,
     OMX_FillThisBuffer on output port of the component.
   – Components provide feedback via FillBufferDone /
     EmptyBufferDone
   – IL client then calls OMX_EmptyThisBuffer/
     OMX_FillThisBuffer to continue buffer exchange
Non-tunneled – Executing
  •   OMX_AllocateBuffer is only called in a non-tunneled mode. Allocates
      both buffer and buffer header

                                      IL Client

1a.                                                   1b.
OMX_EmptyThisBuffer                                   OMX_FillThisBuffer
(bh* bufInHead1)                                      (bh* bufOutHead1)




          2a.EmptyBufferDone                      2a.FillBufferDone
          (bufInHead1)                            (bufOutHead1)




                                  Component
Non-tunneled – Executing to Idle
• IL client asks the component to move from Executing
  to Idle state
• Component returns buffers to IL client (buffer
  supplier) using FillBufferDone/EmptyBufferDone and
  moves to Idle state
Non-tunneled - Idle to Loaded
• IL client asks the component to move from Executing
  to Idle state
• Buffer supplier (IL client) calls OMX_FreeBuffer for
  each buffer on the non-supplier port
• Non-supplier port deletes buffer header. It also
  deletes buffer if the component had allocated it (via
  OMX_AllocateBuffer)
• Buffer supplier (IL client) deletes buffer before calling
  OMX_FreeBuffer if the buffer was allocated by the IL
  client.
• Component moves to Loaded state.
Index
6.   Buffers and Buffer Headers
7.   Simple Core/Component Usage
8.   Tunneling Setup
9.   Transitions
     – Non-Tunneled
     – Tunneled
Tunneled - Loaded to Idle
• IL client sets up tunnel between components 
  buffer supplier responsibilities are agreed.

• IL client asks each component to move from loaded
  to idle

• Component then allocates buffers for each buffer
  supplier port. Each such buffer is then forwarded to
  its tunneled port (say B) using OMX_UseBuffer call. B
  port then allocates buffer header for each buffer

• Each component allocated static resources – buffers
  and buffer headers. Then the component moves to
  Idle state.
Tunneled - Loaded to Idle
-*Allocate() is an internal function
- Red ports are allocator ports
                       OMX_UseBuffer()           OMX_UseBuffer()



           ComponentP                  ComponentQ                 ComponentR

                         Allocate()               Allocate()




         BHp1*     BHq1*                     BHr1*                        BHs1*
         BHp2*     BHq2*                     BHr2*                        BHs2*
         BHp3*     BHq3*                     BHr3*                        BHs3*
         BHp4*     BHq4*                     BHr4*                        BHs4*

       Input and output queues of components, showing buffer header possession
Tunneled – Idle to Executing
• Idle to Executing:
  – IL client asks the component to move from Idle to
    Executing state
  – Component moves to Executing state and initiates
    buffer exchanges
     • an input buffer supplier port calls OMX_FillThisBuffer
• In Executing state
  – an output buffer supplier port calls
    OMX_EmptyThisBuffer, after filling it with data

  – The buffers are then exchanged using Fill/Empty
    APIs.
Tunneled - Executing
   1a.OMX_EmptyThisBuffer()              2a.OMX_EmptyThisBuffer()



  ComponentP                 ComponentQ                  ComponentR



    1b.OMX_FillThisBuffer()               2b.OMX_FillThisBuffer()




  BHp1*                      BHq1*                        BHr1*    BHs1*
  BHp2*                      BHq2*                        BHr2*    BHs2*
  BHp3*                      BHq3*                        BHr3*    BHs3*
  BHp4*                      BHq4*                        BHr4*    BHs4*

Input and output queues of components, showing buffer header possession
Tunneled - Executing to Idle
• IL client asks each component to move from
  Executing to Idle state
• A component on such request, returns buffers to
  buffer supplier using
  OMX_EmptyThisBuffer/OMX_FillThisBuffer
• Thus all buffers get home.
• On getting all its owned buffers, a component moves
  from Executing to Idle state.
Tunneled - Idle to Loaded
• IL client asks each component to move from Loaded
  to Idle state
• A component then, deletes the buffer and then calls
  OMX_FreeBuffer on its tunneled non-supplier port.
• The non-supplier tunneled port deletes the buffer
  header.
• On deleting all buffers, each component moves to
  Loaded state

More Related Content

What's hot

Lcu14 107- op-tee on ar mv8
Lcu14 107- op-tee on ar mv8Lcu14 107- op-tee on ar mv8
Lcu14 107- op-tee on ar mv8Linaro
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
HKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEEHKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEELinaro
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Thomas Petazzoni
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh KhetanRajesh Khetan
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Introduction to Optee (26 may 2016)
Introduction to Optee (26 may 2016)Introduction to Optee (26 may 2016)
Introduction to Optee (26 may 2016)Yannick Gicquel
 
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1Linaro
 
SFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARM
SFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARMSFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARM
SFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARMLinaro
 

What's hot (20)

Lcu14 107- op-tee on ar mv8
Lcu14 107- op-tee on ar mv8Lcu14 107- op-tee on ar mv8
Lcu14 107- op-tee on ar mv8
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
HKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEEHKG18-402 - Build secure key management services in OP-TEE
HKG18-402 - Build secure key management services in OP-TEE
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh Khetan
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Introduction to Optee (26 may 2016)
Introduction to Optee (26 may 2016)Introduction to Optee (26 may 2016)
Introduction to Optee (26 may 2016)
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Android - Graphics Animation in Android
Android - Graphics Animation in AndroidAndroid - Graphics Animation in Android
Android - Graphics Animation in Android
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
SFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARM
SFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARMSFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARM
SFO15-205: OP-TEE Content Decryption with Microsoft PlayReady on ARM
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 

Similar to Understanding open max il

Transport triggered architecture
Transport triggered architectureTransport triggered architecture
Transport triggered architectureGichelle Amon
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologiesprakashk453625
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPrashant Rane
 
Mule esb and_relevant_components
Mule esb and_relevant_componentsMule esb and_relevant_components
Mule esb and_relevant_componentsPaaras Baru
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV Designing Embedded System with 8051...
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV  Designing Embedded System with 8051...SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV  Designing Embedded System with 8051...
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV Designing Embedded System with 8051...Arti Parab Academics
 
Open switches story mohamed hassan v4
Open switches story   mohamed hassan v4Open switches story   mohamed hassan v4
Open switches story mohamed hassan v4Mohamed Hassan
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxSajinvs4
 
Portets to composite applications
Portets to composite applicationsPortets to composite applications
Portets to composite applicationsSerge Huber
 
AADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design LanguageAADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design LanguageIvano Malavolta
 
200923 01en
200923 01en200923 01en
200923 01enopenrtm
 

Similar to Understanding open max il (20)

Transport triggered architecture
Transport triggered architectureTransport triggered architecture
Transport triggered architecture
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
 
Fpga & VHDL
Fpga & VHDLFpga & VHDL
Fpga & VHDL
 
Mule esb and_relevant_components
Mule esb and_relevant_componentsMule esb and_relevant_components
Mule esb and_relevant_components
 
Srilekha mule esb
Srilekha mule esbSrilekha mule esb
Srilekha mule esb
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV Designing Embedded System with 8051...
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV  Designing Embedded System with 8051...SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV  Designing Embedded System with 8051...
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT IV Designing Embedded System with 8051...
 
Open switches story mohamed hassan v4
Open switches story   mohamed hassan v4Open switches story   mohamed hassan v4
Open switches story mohamed hassan v4
 
gcdtmp
gcdtmpgcdtmp
gcdtmp
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptx
 
Python PPT 50.pptx
Python PPT 50.pptxPython PPT 50.pptx
Python PPT 50.pptx
 
Portets to composite applications
Portets to composite applicationsPortets to composite applications
Portets to composite applications
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
AADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design LanguageAADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design Language
 
200923 01en
200923 01en200923 01en
200923 01en
 
Mule esb kranthi
Mule esb kranthiMule esb kranthi
Mule esb kranthi
 
Mule esb kranthi
Mule esb kranthiMule esb kranthi
Mule esb kranthi
 
Mule esb
Mule esb Mule esb
Mule esb
 
Mule
MuleMule
Mule
 
Esb process
Esb processEsb process
Esb process
 

Recently uploaded

CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptxAneriPatwari
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxAneriPatwari
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 

Recently uploaded (20)

CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptx
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 

Understanding open max il

  • 1. Understanding OpenMAX-IL Chethan Palakshamurthy – 5/5/2012
  • 2. Outline 1. What is OpenMAX-IL? 2. OMXIL Entities – Core, Components and Ports 3. OMXIL Component Architecture 4. OMXIL Profiles – Base and Interop 5. OMXIL Component States
  • 3. Outline 6. Buffers and Buffer Headers 7. Simple Core/Component Usage 8. Tunneling Setup 9. Transitions – Non-Tunneled – Tunneled Disclaimer: • For simplicity, we are not considering buffer sharing and port enable/disable • For simplicity, we do not consider intricacies on any scenarios where states of components are not done togethre.
  • 4. Index 1. What is OpenMAX-IL?
  • 6. OpenMAX-IL OpenMAX™ is a royalty-free, cross-platform API that provides comprehensive streaming media codec and application portability by enabling accelerated multimedia components to be developed, integrated and programmed across multiple operating systems and silicon platforms. The OpenMAX API will be shipped with processors to enable library and codec implementers to rapidly and effectively make use of the full acceleration potential of new silicon - regardless of the underlying hardware architecture.
  • 7. OpenMAX-IL • Is a cross-platform multimedia API – Not framework? • C Based API – Very clean, concise • Defines – data types [OMX_types.h] – APIs as functions and macros
  • 9. Need, Benefits • Codecs, filters, sources, sinks etc have certain common characteristics, but have varied implementations. – State machine, – Command set, Parameters – Data exchange methodologies – API • OpenMAX-IL standardizes such implementations with APIs (setup and communication), so that they are portable, benefiting – SV, ISV, OSV, OEMs
  • 10. Index 1. What is OpenMAX-IL? 2. OMXIL Entities – Core, Components and Ports
  • 11. OpenMAX-IL Entities 1. Core [OMX_Core.h] 2. Components [OMX_Component.h] a. Names, Roles b. Ports [OMX_Port.h] 3. {IL-Client}
  • 12. Core The OpenMAX-IL core is used for and only for - • Dynamically loading and unloading components • Facilitating component communication (tunneling) • Queries about installed components and the roles they support • Once loaded, the API allows the user to communicate directly with the component, which eliminates any overhead
  • 13. Component • An OpenMAX IL component is a software block which can produce / process / transform / consume media or related data • Components can be sources, sinks, codecs, filters, splitters, mixers, or any other data operator – E.g., H264 Video decoder component • Component could possibly represent a piece of hardware, a software codec, another processor, or a combination thereof • OMXIL Component API and semantics are designed to be able to create (flexible) pipeline/graph of multiple components to realize varied combinations of media processing use cases.
  • 14. Component • Component has a name and may have 1 or more roles for discovery and selection based on capability • Has input and output ports for media interconnection with other components and/or IL client • Can be configured with parameters relevant to its operation • Provides errors, asynchronous notifications, events to the IL client • Has OMXIL defined state machine built-in for control by IL client
  • 15. Component Name • A component’s unique identifier in a system. • Naming convention - OMX.<vendor_name>.<vendor_specified_convention> – For e.g., OMX.STE.MP3Decoder.ProductXYZ • To load, IL client can enumerate and select a component by name. – Core API: OMX_ComponentNameEnum
  • 16. Component Role • Is the behavior of component acting according to a particular standard or vendor-specific component definition. – i.e., A role is a component’s capability • A component named OMX.CompanyXYZ.MyAudioDecoder may support these roles – audio_decoder.mp3 (mp3 decode capability) – audio_decoder.aac (aac decode capability) – audio_decoder.amr (amr decode capability) • IL client can choose a component to load by looking for a specific role using a. OMX_ComponentOfRoleEnum b. Or, OMX_ComponentNameEnum + OMX_RoleOfComponent
  • 17. Ports • Components have ports as a channel to communicate media data with other component or IL client. • Types: – Input, Output – Image, Video, Audio and Other – E.g., Video input port
  • 18. Ports
  • 19. Port communication • Non-tunneled – Data buffers are exchanged between client and component • Tunneled – Data buffers are exchanged directly between components, in a way as defined by standard • Proprietary – Data buffers are exchanged directly between components, via proprietary APIs
  • 21. Ports – some terminologies • A tunneling port is the port which it shares a tunnel with another component. – E.g., port b is the tunneling port to port a. Likewise, port a is the tunneling port to port b. • An allocator port is a port that allocates its own buffers. – Port a is the only allocator port. • Buffer supplier port is a port which supplies buffers to its tunneled port. – Buffers either allocated by itself (e.g., port a) – Or, buffers allocated by other components and shared (e.g., port c) – In non-tunneled comm, if IL client is supplying buffers, IL client is the buffer supplier. • A sharing port is a port that re-uses buffers from another port on the same component. – E.g., port c • A tunneling component is a component that uses at least one tunnel.
  • 22. Ports – some terminologies IL Client
  • 23. Index 1. What is OpenMAX-IL? 2. OMXIL Entities – Core, Components and Ports 3. OMXIL Component Architecture
  • 25. Comp. Arch – Some new stuff • Component handle – Opaque pointer to a component object in memory – Returned on creation of component by OMX_GetHandle • Parameters/Configurations – Parameters are the static settings of a component. E.g., Number of buffers on a port etc – Configuration defines the dynamic settings of a component. For e.g., complexity of post processing etc – APIs: OMX_GetConfig(index, valueStruct), OMX_SetConfig, OMX_SetParameter, OMX_GetParameter – It is mandatory to support some standard indices • Commands – Allow IL client to control components – E.g., To move a component from one state to another OMX_SendCommand(comp_handle, OMX_CommandStateSet…)
  • 26. Comp. Arch – Some new stuff • Callbacks – Components are given a set of callback functions (at creation time) to provide asynchronous notifications/events to IL client. – Those are EventHandler(), FillBufferDone(), EmptyBufferDone() • Event Handler – Component uses this to notify IL client of certain async events like completion of a command, Error, Port settings change etc.
  • 27. Index 1. What is OpenMAX-IL? 2. OMXIL Entities – Core, Components and Ports 3. OMXIL Component Architecture 4. OMXIL Component Profiles – Base and Interop
  • 28. Component profiles • Base profile – Shall support non-tunneled communication – Does not support tunneled communication – May support proprietary communication – exists to reduce the adoption barrier for OpenMAX IL implementers by simplifying the implementation • Interop profile – Is a superset of the base profile – Shall support non-tunneled and tunneled communication – May support proprietary communication • Shall  Requirement. If not met, component is not conformant to OpenMAX IL • Should  Not a requirement but recommended/good practice • May  Optional requirement • Will  Not a requirement
  • 29. Types of Communication Supported Per Component Profile Type of Communication Base Profile Support Interop Profile Support Non-tunneled comm Yes Yes Tunneled comm No Yes Proprietary comm Yes Yes NOTE: An Interop profile compliant component may have both tunneled as well as non-tunneled communication
  • 30. Index 1. What is OpenMAX-IL? 2. OMXIL Entities – Core, Components and Ports 3. OMXIL Component Architecture 4. OMXIL Component Profiles – Base and Interop 5. OMXIL Component States
  • 31. Component States • OpenMAX-IL identifies the states that a component can be in at any point of time. 1. Unloaded 2. Loaded 3. Idle 4. Waiting for Resources 5. Paused 6. Executing
  • 32. Component States • IL client shall move components from one state to another. – A component can perform a state transition by itself only in cases of error, loss of resource etc – IL-client is notified of such change via EventHandler • OMXIL defines a state transition graph • OMXIL defines what the internal state (w.r.t buffers/communication/processing) of the component must be in each state • OMXIL defines what a component must do while transitioning from one to another
  • 34. Component States • Every component is first considered to be unloaded. • The component shall be loaded through a call to the OpenMAX IL core – OMX_GetHandle(). • All other state transitions may then be achieved by communicating directly with the component.
  • 35. Component States • INVALID : unrecoverable ‘dead’ state. Can only be unloaded. Enters on event of fatal error. • LOADED : component is in memory • IDLE : Moved here from Idle. Has acquired static resources • WAIT FOR RESOURCE – Intermediate between Loaded and Idle. Upon entering the WAIT FOR RESOURCE state, the component registers with a vendor-specific resource manager to alert it when resources have become available. The component will subsequently transition into the IDLE state.
  • 36. Component States • EXECUTING : state indicates data is processed and buffers are exchanged • PAUSED : suspension of exchange and processing of buffers, with context preserved • Transitioning from EXECUTING or PAUSED to IDLE will cause the context in which buffers were processed to be lost, which requires the start of a stream to be reintroduced. • Transitioning from IDLE to LOADED will cause operational resources such as communication buffers to be lost.
  • 37. Index 6. Buffers and Buffer Headers
  • 38. Buffers and Buffer headers • Buffers are raw pieces of memory that contain media or related data • Buffer headers are structures that along with the buffer pointer, contain metadata describing the data in buffers – Buffer allocated size, data size, data offset etc • Between two entities at either ends of a communication path, one allocates the buffers, while the other allocates buffer header. – Between two tunneled ports or – Between IL client and the port it interfaces with
  • 39. Buffers and Buffer headers • Data communications with components is always directed to a specific component port. • Every component port shall be capable of allocating its own buffers or using pre-allocated buffers; one of these choices will usually be more efficient than the other.
  • 40. Buffers and Buffer headers Buffer communication APIs: • OMX_EmptyThisBuffer is always called on input ports – Called by a tunneled component or IL client • OMX_FillThisBuffer is always called with output ports – Called by a tunneled component or IL client • EmptyBufferDone or FillBufferDone callbacks – Callback functions called by component (port) on IL client to notify completion of emptying or filling. – Used only in non-tunneled communication
  • 41. Buffers and Buffer headers OMX_EmptyThisBuffer(compB) Comp A Comp B OMX_FillThisBuffer(compA) Buffer exchange between tunneled ports
  • 42. Buffers and Buffer headers IL Client OMX_FillThisBuffer() OMX_CALLBACKTYPE:: FillBufferDone() Camera Component Buffer exchange in non-tunneled mode
  • 43. Index 6. Buffers and Buffer Headers 7. Simple Core/Component Usage
  • 44. Simple Core/Component Usage • OMXIL core is initialized with OMX_Init() • Multiple components are chosen after enumeration and created with OMX_GetHandle() – Components are now in OMX_Loaded state. • IL client sets relevant parameters and configurations of components in this state • IL client sets up tunnels between two compatible ports where it deems possible using OMX_SetupTunnel(). • IL client moves all components from Loaded  Idle state using OMX_SendCommand(comp_handle, OMX_CommandStateSet…) – A notification/error is received by IL client via EventHandler about state change
  • 45. Simple Core/Component Usage • IL client moves all components from Idle  Executing state – Buffer exchanges begin transferring media data ‘downstream’ • For e.g., if the components are Mpeg4 demuxer, Mpeg4 decoder and Video renderer, in OMX_Executing state, video frames are rendered on to the screen • IL client is notified of ‘End of Stream’ when playback is done. • IL client moves all components to OMX_Idle state • IL client then, moves all components to OMX_Loaded state • IL client then, calls OMX_Deinit() upon which the components are deleted, and core is de-initialized.
  • 46. Simple Core/Component Usage IL client CALLBACKS Mpeg4 Mpeg4 Video Demuxer Decoder Renderer Buffer exchange between tunneled ports
  • 47. Index 6. Buffers and Buffer Headers 7. Simple Core/Component Usage 8. Tunneling Setup
  • 48. Tunneling setup • IL client shall establish tunneling between two ports when two components are in OMX_Loaded state. • Using OMX_SetupTunnel(compA, outputPortNum, compB, inputPortNum) • For a given tunnel, exactly one port supplies the buffers. The component (or port) which supplies buffers is decided during tunnel setup.
  • 49. Tunneling setup - Protocol • The OMX_SetupTunnel impl first calls CompA::ComponentTunnelRequest(setupPrefA) – the component of output port. CompA fills setupPrefA and returns. • OMX_SetupTunnel then calls CompB::ComponentTunnelRequest(setupPrefA). – the component of input port . – Now, setupPrefA is read-only for compB’s review. • Comp B reviews setupPrefA, checks compatibility – If OK, decides which port would be the buffer supplier and sets the same on CompA with OMX_SetParameter(OMX_IndexParamCompBufferSupplier, ..)
  • 50.
  • 51. … Buffer supplier Negotiation • For tunneling, CompA may prefer buffer supplier to be Output port OR Input port OR Unspecified (this is part of setupPrefA) • In any case, its up to the impl of compB to honor or disregard CompA’s preference. – CompB may call CompA->SetParameter(ParamBufferSupplier, BsChoice) – CompB’s choice may vary from one comp to the other. • (The negotiation is not clearly specified and depends on the OMX_SetupTunnel implementation) • After successful setup, IL client can override the buffer supplier
  • 52. Tunneling – Buffer Allocation • To set up tunneling components, the IL client should perform the following setup operations in this order: – Load all tunneling components and set up the tunnels on these components. – Command all tunneling components to transition from the loaded state to the idle state. Each supplier port of a non-sharing component does the following • Determine the buffer requirements of its tunneled port via an OMX_GetParameter call. • Allocate buffers according to the maximum of its own requirements and the requirements of the tunneled port. • Call OMX_UseBuffer on its tunneling port.
  • 53. Index 6. Buffers and Buffer Headers 7. Simple Core/Component Usage 8. Tunneling Setup 9. Transitions
  • 54. Transitions (T|NT) • Loaded 1. [Tunnel setup] • Loaded to Idle: 1. Buffer and Buffer header allocation • Idle to Executing 1. Start buffer exchanges • Executing to Idle 1. Return buffers to their owners / IL client • Idle to loaded 1. Owners delete buffers 2. Owners ask tunneled ports to free related data.
  • 55. Index 6. Buffers and Buffer Headers 7. Simple Core/Component Usage 8. Tunneling Setup 9. Transitions – Non-Tunneled
  • 56. Non-tunneled - Loaded to Idle • IL client asks component to move from loaded to idle • Buffer supplier in non-tunneled mode is always the IL client • IL client calls OMX_AllocateBuffer / OMX_UseBuffer on each port it interfaces • Component thus has needed buffers on all ports and moves to Idle state. • [Who allocates buffers is decided by IL client]
  • 57. Non-tunneled - Loaded to Idle • OMX_AllocateBuffer is only called in a non-tunneled mode. Allocates both buffer and buffer header B21* IL Client B22* B23* OMX_AllocateBuffer() B24* OMX_UseBuffer() Component owns owns BH11* B11* BH21* BH12* B12* BH22* BH13* B13* BH23* BH14* B14* BH24*
  • 58. Non-tunneled – Idle to Executing • Idle to Executing: – IL client asks the component to move from Idle to Executing state – Component transitions to Executing • In Executing state… – IL client is entirely responsible for moving data buffers among components if data tunneling is not used – IL client calls OMX_EmptyThisBuffer on input port, OMX_FillThisBuffer on output port of the component. – Components provide feedback via FillBufferDone / EmptyBufferDone – IL client then calls OMX_EmptyThisBuffer/ OMX_FillThisBuffer to continue buffer exchange
  • 59. Non-tunneled – Executing • OMX_AllocateBuffer is only called in a non-tunneled mode. Allocates both buffer and buffer header IL Client 1a. 1b. OMX_EmptyThisBuffer OMX_FillThisBuffer (bh* bufInHead1) (bh* bufOutHead1) 2a.EmptyBufferDone 2a.FillBufferDone (bufInHead1) (bufOutHead1) Component
  • 60. Non-tunneled – Executing to Idle • IL client asks the component to move from Executing to Idle state • Component returns buffers to IL client (buffer supplier) using FillBufferDone/EmptyBufferDone and moves to Idle state
  • 61. Non-tunneled - Idle to Loaded • IL client asks the component to move from Executing to Idle state • Buffer supplier (IL client) calls OMX_FreeBuffer for each buffer on the non-supplier port • Non-supplier port deletes buffer header. It also deletes buffer if the component had allocated it (via OMX_AllocateBuffer) • Buffer supplier (IL client) deletes buffer before calling OMX_FreeBuffer if the buffer was allocated by the IL client. • Component moves to Loaded state.
  • 62. Index 6. Buffers and Buffer Headers 7. Simple Core/Component Usage 8. Tunneling Setup 9. Transitions – Non-Tunneled – Tunneled
  • 63. Tunneled - Loaded to Idle • IL client sets up tunnel between components  buffer supplier responsibilities are agreed. • IL client asks each component to move from loaded to idle • Component then allocates buffers for each buffer supplier port. Each such buffer is then forwarded to its tunneled port (say B) using OMX_UseBuffer call. B port then allocates buffer header for each buffer • Each component allocated static resources – buffers and buffer headers. Then the component moves to Idle state.
  • 64. Tunneled - Loaded to Idle -*Allocate() is an internal function - Red ports are allocator ports OMX_UseBuffer() OMX_UseBuffer() ComponentP ComponentQ ComponentR Allocate() Allocate() BHp1* BHq1* BHr1* BHs1* BHp2* BHq2* BHr2* BHs2* BHp3* BHq3* BHr3* BHs3* BHp4* BHq4* BHr4* BHs4* Input and output queues of components, showing buffer header possession
  • 65. Tunneled – Idle to Executing • Idle to Executing: – IL client asks the component to move from Idle to Executing state – Component moves to Executing state and initiates buffer exchanges • an input buffer supplier port calls OMX_FillThisBuffer • In Executing state – an output buffer supplier port calls OMX_EmptyThisBuffer, after filling it with data – The buffers are then exchanged using Fill/Empty APIs.
  • 66. Tunneled - Executing 1a.OMX_EmptyThisBuffer() 2a.OMX_EmptyThisBuffer() ComponentP ComponentQ ComponentR 1b.OMX_FillThisBuffer() 2b.OMX_FillThisBuffer() BHp1* BHq1* BHr1* BHs1* BHp2* BHq2* BHr2* BHs2* BHp3* BHq3* BHr3* BHs3* BHp4* BHq4* BHr4* BHs4* Input and output queues of components, showing buffer header possession
  • 67. Tunneled - Executing to Idle • IL client asks each component to move from Executing to Idle state • A component on such request, returns buffers to buffer supplier using OMX_EmptyThisBuffer/OMX_FillThisBuffer • Thus all buffers get home. • On getting all its owned buffers, a component moves from Executing to Idle state.
  • 68. Tunneled - Idle to Loaded • IL client asks each component to move from Loaded to Idle state • A component then, deletes the buffer and then calls OMX_FreeBuffer on its tunneled non-supplier port. • The non-supplier tunneled port deletes the buffer header. • On deleting all buffers, each component moves to Loaded state