Mulitple Audio Codec Operation

Multiple Audio Codec Operation

An example multi-stream/format audio decoder test bench

1.  Introduction

The Tensilica LX2 and Diamond 330HiFi processors feature the HiFi2 engine – a set of processor extensions tuned forAudio processing. The HiFi2 engine enables Tensilica processors to efficiently support audio processing functions for professional and consumer audio devices. Tensilica also provides a rich set of libraries for the HiFi2 engine to support most common audio coding standards.

The HiFi 2 audio codec libraries implement a common API to encapsulate the complexities of DSP coding operations and simplify the application and system implementation. All audio codecs provided for HiFi2 are developed to support a common API, such that application code using one codec (such as MP3 decoder) can easily be ported to support another decoder, (such as AAC decoder). The common API also simplifies the development of application code that supports multiple codecs (i.e., Portable Media Players that support a variety of audio formats).

The HiFi2 audio codec API was developed with multi-stream processing in mind. For example, a cellular phone with MP3 playback capability may need to play a MP3 coded ring-tone while the user is listening to another MP3 music file. One method for handling multiple streams is by using a threading operating system. This approach will work fine because the Audio Codec Libraries are completely thread safe (i.e., global variables are not used). Using an operating system is also preferred when the audio processor is also used as a system controller.

However, the HiFi2 audio codecs can easily support multiple streams on “bare metal” - without any threading operating system. The HiFi2 Audio Codec API operates on a “handle” – an opaque structure that contains all information pertaining to a particular stream. This opaque structure is passed as an argument in codec API functions. Multiple streams are easily handled by simply switching the opaque structure within the codec API arguments. This inherent multi-stream support capability can result in significant cost savings in designs that use a HiFi2 enabled Tensilica processor (such as the Diamond 330HiFi) as a dedicated audio offload engine.

This application note describes multiple audio codec operation without the use of a threading operating system. This application note also covers coding principles necessary to use multiple codecs and handle multiple streams simultaneously. Other concepts covered in this application note include memory management and audio synchronization. The explanation provided assumes that the reader is already familiar with the Audio Codec API and the single stream example code provided with each codec library. Therefore, this application note only covers concepts that are not addressed by the Audio Codec Programmer’s guides or the single stream example code. Refer to any of the Audio Codec Programmer’s Guides for prerequisite information on the Audio Codec API.

A multi-stream decoding test bench is available as an XplorerDE (v2.0.1 or later) workspace project for the Diamond 330HiFi processor. You may request the test bench through your Tensilica support contact. The test bench is described in the diagram below:

Click here to read this application note

Marketing Agency