Davinci Multimedia Application Interface

Contents

Introduction

The DaVinci Multimedia Application Interface (DMAI) is a thin utility layer on top of the operating system (Linux or DSP/BIOS) and the Codec Engine (CE) to assist in quickly writing portable applications on a DaVinci platform. DMAI is used by the DVSDK demos as of DVSDK 1.40, and should make additional demo development quicker than in previous DVSDK releases.

DMAI was originally started to refactor the common DVSDK demo code to more easily support more platforms (dm355, dm6467, omap3530, dm6446 etc.) without rewriting each set of demos from scratch.

The different DMAI modules communicate using a Buffer abstraction which carries not only the actual (video, speech, audio etc.) data but also meta data describing the Buffer which is used by the Codec Engine and Linux device drivers to perform operations on the data.

DMAI does not wrap the Operating System or CE, but as the below picture shows the application can choose when to use DMAI and when to use the Operating System or Codec Engine directly:


File:dmai block.png

DMAI Block Diagram

DMAI is a functional design, meaning that the modules often describe a certain operation (frame copying using Framecopy, color conversion using Ccv, resizing using Resize etc.), but the module implementation may change between devices and operating systems depending on which peripheral device drivers and other local APIs are available.

In other words, DMAI does not abstract the peripherals themselves, it abstracts the actual operations e.g. frame copying. DMAI then implements a frame copy using the peripherals and resources at it's disposal on a particular platform (e.g. the Framecopy module is currently implemented using the resizer peripheral on dm6446, but using DMA on dm355).

DMAI is a collection of modules, and the application can pick and choose which modules to use. Since DMAI comes with source code, it can also be used as a reference on how to accomplish certain tasks using e.g. a certain device driver.


Benefits of Using DMAI

  • Portability and Reusability
    • For example The TI GStreamer plugin is built on top of DMAI. It made porting the TI GStreamer plugin to new platforms easier.
  • Consistent software interface
    • The DMAI library provides a simple software interface, but implements complex device driver and codec engine handshaking under the hood: -
      • Uses hardware acceleration where possible without requiring developers to understand the platform specific implementation.
      • Enables all VISA codecs, reducing the need to understand details and differences of xDM versions.
      • Abstracts PSP differences (FBDEV vs. V4L2).
      • Low-level details and error handling are managed for you.
  • Using DMAI, plugin code is mostly free of platform-specific code, making it extremely portable.

Example

Below is a simple DMAI example showing audio decode using an AAC decoder and the Codec Engine (no error checking). Input is an elementary stream file and output is the sound device driver:

    #include <xdc/std.h>
    #include <ti/sdo/ce/Engine.h>
    #include <ti/sdo/ce/CERuntime.h>
    #include <ti/sdo/dmai/Dmai.h>
    #include <ti/sdo/dmai/Buffer.h>
    #include <ti/sdo/dmai/Sound.h>
    #include <ti/sdo/dmai/Loader.h>
    #include <ti/sdo/dmai/ce/Adec.h> 

    Adec_Handle hAd;
    Loader_Handle hLoader;
    Buffer_Handle hOutBuf, hInBuf;
    Engine_Handle hEngine;
    Sound_Handle hSound; 

    AUDDEC_Params params = Adec_Params_DEFAULT;
    AUDDEC_DynamicParams dynParams = Adec_DynamicParams_DEFAULT;
    Loader_Attrs lAttrs = Loader_Attrs_DEFAULT;
    Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;
    Sound_Attrs sAttrs = Sound_Attrs_STEREO_DEFAULT; 

    CERuntime_init();
    Dmai_init();
    hSound = Sound_create(&sAttrs);
    hEngine = Engine_open("myengine", NULL, NULL);
    hAd = Adec_create(hEngine, "aacdec", &params, &dynParams);
    hOutBuf = Buffer_create(Adec_getOutBufSize(hAd), &bAttrs);
    lAttrs.readSize = Adec_getInBufSize(hAd);
    lAttrs.readBufSize = lAttrs.readSize * 2;
    hLoader = Loader_create("myfile.aac", &lAttrs);
    Loader_prime(hLoader, &hInBuf); 

    while (1) {
        Adec_process(hAd, hInBuf, hOutBuf);
        Sound_write(hSound, hOutBuf);
        Loader_getFrame(hLoader, hInBuf);
        if (Buffer_getUserPtr(hInBuf) == NULL) break;
    } 

    Loader_delete(hLoader);
    Buffer_delete(hOutBuf);
    Adec_delete(hAd);
    Engine_close(hEngine);
    Sound_delete(hSound);

Versions

DMAI 1.00 was released with the DVSDK 1.40 beta and only had dm6467 support.

DMAI 1.10 was released with the DVSDK 1.40 and has dm6467, dm6446 and dm355 support on ARM Linux as well as DSP/BIOS support for dm6437, dm6446 and dm6467. This version of DMAI can also be used with DVSDK 1.30 for dm6446 and dm355, but requires XDC 3.00.04 or later to support dm355.

DMAI 1.16 is a feature update, now under the BSD license, which is needed for e.g. gstreamer. Now covers all XDM codec classes. Source level compatible with previous releases (applications require recompilation).

DMAI 1.20 has OMAP3530 support added, and Davinci platforms moved to MVL 5.0.

DMAI 1.21 has TMS320DM365 support added again leveraging MVL 5.0.

DMAI 1.24 has OMAP3530 WinCE support added.

DMAI 1.27 has OMAP-L137 support added on MVL 5.0.

DMAI 2.xx is tracking the GIT kernel as opposed to MVL. See the release notes for supported targets.

Running the DMAI sample applications

There are a large number of examples in the DMAI package. These are designed to exercise: -

  • Multimedia codecs in the context of the VISA (Video, Imaging, Speech, Audio) XDM classes
  • PSP (Platform Support Package) drivers for the supported TI platforms.

For example: -

  • audio_decode_io1 - Audio test application capable of running any codec that implements the IAUDDEC1 decoder interface. "io" denotes that File I/O is used.
  • video_loopback_resize - video loopback between the capture and display device. Resizes the captured frame before displaying it. No codecs involved.

A snapshot of the various apps from DMAI 2.0 is shown below. The names are self-explanatory.

[>] dmai_2_00_01_04/packages/ti/sdo/dmai/apps$ ls
app_common.cfg    fc_common.cfg     speech_decode_io1  video_encode_io_multich1
app_common.tci    image_decode_io   speech_encode1     video_loopback
audio_decode1     image_decode_io1  speech_encode_io1  video_loopback_blend
audio_decode_io   image_encode_io   video_decode_io    video_loopback_convert
audio_decode_io1  image_encode_io1  video_decode_io2   video_loopback_copy
audio_encode1     Makefile          video_display      video_loopback_resize
audio_encode_io1  Makefile.app      video_encode_io
dmai.gel          speech_decode1    video_encode_io1

Details on how to run these apps can typically be found in the various DVSDK Getting Started Guides. For example: -

  • GSG:_OMAP35x_DVEVM_Running_the_Demos - shows how to run video_decode_io2, image_encode_io1, video_encode_io1, audio_decode_io1 etc on an OMAP35x EVM.
  • Codec Engine intro - compares the DMAI Arm-side apps to other Arm-side apps such as the DVSDK demos, detailing when to use one versus the other.

Note that if instead you are looking for an app to rapidly test various modes of a given codec the Digital_Video_Test_Bench may be a better option. This is based on the DVSDK and provides a command line interface to set/get the available codec parameters.

More information

DMAI is now hosted as an open source project on the TI GForge site. Here you can join the project (see red button on the right) in order to track and file issues. The DMAI releases are available from here.