Codec Engine 应用开发使用手册

本文档详细介绍了Codec Engine在嵌入式设备上的应用开发过程,包括ARM和DSP之间的协作,以及在Linux操作系统下的集成。通过实例解析,帮助开发者理解如何有效地利用Codec Engine进行音频和视频处理任务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Codec Engine Application Developer User's Guide

Literature Number: SPRUE67D

September 2007

IMPORTANT NOTICE

Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI's terms and conditions of sale supplied at the time of order acknowledgment.

TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI's standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed.

TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards.

TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI.

Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions.

Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.

TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications.

TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer's risk, and that they are solely responsible for  compliance with all legal and regulatory requirements in connection with such use.

TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements.

Following are URLs where you can obtain information on other Texas Instruments products and application solutions:

Products                                      Applications  
Amplifiers        amplifier.ti.com            Audio                 www.ti.com/audio 
Data Converters   dataconverter.ti.com        Automotive            www.ti.com/automotive 
DSP               dsp.ti.com                  Broadband             www.ti.com/broadband 
Interface         interface.ti.com            Digital Control       www.ti.com/digitalcontrol 
Logic             logic.ti.com                Military              www.ti.com/military 
Power Mgmt        power.ti.com                Optical Networking    www.ti.com/opticalnetwork 
Microcontrollers  microcontroller.ti.com      Security              www.ti.com/security 
RFID              www.ti-rfid.com             Telephony             www.ti.com/telephony 
Low Power Wireless www.ti.com/lpw             Video & Imaging       www.ti.com/video 
                                              Wireless              www.ti.com/wireless

 

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265

Copyright © 2007, Texas Instruments Incorporated

 

Preface

About This Book

The Codec Engine is a set of APIs that you use to instantiate and run xDAIS algorithms. A VISA interface is provided as well for interacting with xDM-compliant xDAIS algorithms. The intended audience for this document is the embedded-OS application developer treating the DSP-side of DaVinci as a black box represented by an API.

Additional Documents and Resources

You can use the following sources to supplement this user’s guide:
❏ Codec Engine Server Integrator User's Guide (SPRUED5)
❏ Codec Engine Algorithm Creator User's Guide (SPRUED6)
❏ Codec Engine Application (API) Reference Guide.  CE_INSTALL_DIR/docs/html/index.html 
❏ Configuration Reference Guide.  CE_INSTALL_DIR/xdoc/index.html
❏ Example Build and Run Instructions.  CE_INSTALL_DIR/examples/build_instructions.html
❏ xDM API Reference. XDAIS_INSTALL_DIR/docs/html/index.html 
❏ DaVinci EVM Home at Spectrum Digital:  http://c6000.spectrumdigital.com/davincievm/revc/
❏ TI Linux Community for DaVinci Processors:  http://linux.davincidsp.com
❏ xDAIS-DM (Digital Media) User Guide (SPRUEC8)
❏ TMS320 DSP Algorithm Standard Rules and Guidelines (SPRU352)
❏ TMS320 DSP Algorithm Standard API Reference (SPRU360)
❏ TMS320 DSP Algorithm Standard Developer’s Guide (SPRU424)
❏ TMS320 DSP Algorithm Standard Demonstration Application (SPRU361)

Notational Conventions

This document uses the following conventions:
❏ Program listings, program examples, and interactive displays are shown in a special typeface. Examples use a bold version of the special typeface for emphasis; interactive displays use a bold version of the special typeface to distinguish commands that you enter from items that the system displays (such as prompts, command output, error messages, etc.).
❏ Square brackets ( [ and ] ) identify an optional parameter. If you use an optional parameter, you specify the information within the brackets. Unless the square brackets are in a bold typeface, do not enter the brackets themselves.
❏ This manual uses an icon like the one to the left to identify information that is specific to a particular type of system. For example, this icon identifies information that applies if you are using Codec Engine on a dual-processor GPP+DSP system.

Trademarks

The Texas Instruments logo and Texas Instruments are registered trademarks of Texas Instruments. Trademarks of Texas Instruments include: TI, DaVinci, XDS, Code Composer, Code Composer Studio, Probe Point, Code Explorer, DSP/BIOS, RTDX, Online DSP Lab, DaVinci, TMS320, TMS320C54x, TMS320C55x, TMS320C62x, TMS320C64x, TMS320C67x, TMS320C5000, and TMS320C6000.

 

MS-DOS, Windows, and Windows NT are trademarks of Microsoft Corporation.

 

UNIX is a registered trademark of The Open Group in the United States and other countries.

 

Linux is a registered trademark of Linus Torvalds.

 

Solaris, SunOS, and Java are trademarks or registered trademarks of Sun Microsystems, Inc.

 

All other brand, product names, and service names are trademarks or registered trademarks of their respective companies or organizations.

Contents

1 Codec Engine Overview
This chapter introduces the Codec Engine.
1.1 What is the Codec Engine?
1.2 Why Should I Use It?
1.3 Where Does the Codec Engine Fit into My Architecture?
1.4 What Are the User Roles?
1.4.1 Algorithm Creator
1.4.2 Server Integrator
1.4.3 Engine Integrator
1.4.4 Application Author
1.5 Where Can I Get More Information?
2 Installation and Setup
This chapter describes steps you may need to perform for installation and setup.
2.1 Installing Codec Engine
2.2 Packages and Repositories
2.3 Directory Structure
3 Using the Sample Applications
This chapter describes how to test the sample applications provided with the Codec Engine.
3.1 Overview
3.2 Building Applications
3.3 Running Applications
4 Using the Codec Engine APIs
This chapter describes how to use the Codec Engine APIs in an application.
4.1 Overview

4.2 The Core Engine APIs
4.2.1 Codec Engine Setup Code
4.2.2 Opening an Engine
4.2.3 Closing an Engine
4.2.4 Getting Memory and CPU Information from an Engine
4.2.5 Getting Information About Algorithms Configured into an Engine
4.3 The VISA Classes: Video, Image, Speech, Audio
4.3.1 VISA API Setup Code

4.3.2 Creating an Algorithm Instance

4.3.3 Deleting an Algorithm Instance
4.3.4 Controlling an Algorithm Instance
4.3.5 Processing Data with an Algorithm Instance
4.3.6 Overriding a Remote Algorithm's Priority and Memory Requests
4.4 The Server APIs
4.4.1 Getting a Server Handle
4.4.2 Getting Memory Heap Information
4.4.3 Reconfiguring the DSP Server's Algorithm Heap
4.5 What Happens to DSP Memory Issues?
4.5.1 Buffer Handling and Shared Memory Maps
4.5.2 Memory Fragmentation
4.5.3 Cache Alignment
4.5.4 Cache Coherence
4.6 What Happens to DSP Real-Time Issues?
4.6.1 Transaction Latency
4.6.2 Multi- vs. Uni-Processor Performance
4.6.3 Local Performance
4.7 What About Codec Engine Debugging?
4.7.1 Codec Engine Debugging from the ARM on ARM+DSP Systems
4.7.2 Codec Engine Debugging on a DSP-only System
4.8 What About Software Trace?
4.8.1 Configuring TraceUtil at Design Time
4.8.2 Supporting TraceUtil in Your Application's C Code
4.8.3 Configuring the DSP Server for DSP/BIOS Logging
4.8.4 Configuring the DSP Server To Redirect Trace Output
4.8.5 Configuring TraceUtil at Application Start Time
4.8.6 Controlling Trace at Run-Time Through a Named Pipe
4.8.7 Trace Mask Values
5 Integrating an Engine
This chapter describes how the Engine Integrator should configure an Engine for use by the application developer.
5.1 Overview
5.2 A Reusable Example
5.2.1 Advanced Engine Creation
5.3 Understanding Engine Configuration Syntax
5.3.1 Framework Components Configuration

Chapter 1

Codec Engine Overview

This chapter introduces the Codec Engine.
Topic                              Page 
1.1 What is the Codec Engine? 1–2
1.2 Why Should I Use It? 1–3
1.3 Where Does the Codec Engine Fit into My Architecture?1–4
1.4 What Are the User Roles? 1–6

1.5 Where Can I Get More Information?1–10

1.1 What is the Codec Engine?

From the application developer’s perspective, the Codec Engine is a set of APIs that you use to instantiate and run xDAIS algorithms. A VISA interface is provided as well for interacting with xDM-compliant xDAIS algorithms.

 

The API is the same for all of the following situations:
❏ The algorithm may run locally (on the GPP) or remotely (on the DSP).
❏ The system may be a GPP+DSP, DSP-only, or GPP-only system.
❏ All supported GPPs and DSPs have the same API.

❏ All supported operating systems have the same API. For example, Linux, PrOS, VxWorks, DSP/BIOS, and WinCE.

 

This manual uses an icon like the one to the left to identify information that is specific to a particular type of system. For example, this icon identifies information that applies if you are using Codec Engine on a dual-processor GPP+DSP system.

 

xDM is the eXpressDSP Algorithm Interface Standard for Digital Media. It is sometimes referred to as xDAIS-DM.

 

Any xDM algorithm is compliant with the eXpressDSP Algorithm Interface Standard (xDAIS). Additionally, it implements the xDAIS-DM (xDM) interface, an extension to the xDAIS standard that provides support for digital media encoders, decoders, and codecs. The xDM specification defines APIs for digital media codecs by class, with extensions defined for video, imaging, speech, and audio codec classes.

 

The xDM interfaces divide codec algorithms into four classes: Video, Image, Speech, and Audio (VISA). VISA reflects this xDM interface. One set of APIs is provided per codec class. Thus, MP3 can be replaced with WMA without changing the application source code. Only the configuration needs to be changed.

 

The Codec Engine also supports real-time, non-intrusive visibility into codec execution. It provides APIs for accessing memory and overall CPU usage statistics and execution trace information.

 

The Codec Engine runtime is supplied in binary form. Thus, application libraries built with same Codec Engine release are always compatible.

1.2 Why Should I Use It?

The Codec Engine is designed to solve some common problems associated with developing system-on-a-chip (SoC) applications. The most significant problems include:
❏ Debugging in a heterogeneous processor environment can be painful. There are multiple debuggers and complex bootstrapping.
❏ Different implementations of the same algorithm, such as MP3, have different APIs. Changing to a more efficient algorithm involves significant recoding.
❏ Portability issues are compounded with two processors. You may want to port to a different board with a newer DSP or a newer GPP. 
❏ Some algorithms may run on either the GPP or the DSP. To balance system load, “low complexity” algorithms can run on a GPP, but the
definition of “low” changes over time. If changing the location where the algorithm runs were easy, you wouldn’t have to weigh performance issues against the difficulty of changing the application.
❏ For market success, most applications need to support multiple codecs to handle the same type of media. For example, an application might need to support three or four audio formats.

❏ Programmers with a GPP (general-purpose processor) view typically don’t want to have to learn to be DSP programmers. And, they don’t want to have to worry about a DSP’s complex memory management and DSP real-time issues. 

 

The Codec Engine addresses these problems by providing a standard software architecture and interfaces for algorithm execution. The Codec Engine is:

❏ Easy-to-use. Application developers specify what algorithm needs to be run, not how or where.
❏ Extensible and configurable. New algorithms can be added by anyone, using standard tools and techniques.
❏ Portable. The APIs are target, platform, and even codec independent.

1.3 Where Does the Codec Engine Fit into My Architecture?

The application code (or the middleware it uses) calls the Codec Engine APIs. Within the Codec Engine, the VISA APIs use stubs and skeletons to access the core engine and the actual codecs, which may be local or remote.

 

The following figure shows the general architecture of an application that uses the Codec Engine. It also shows the user roles involved in creating various portions of the application. See Section 1.4, What Are the User Roles? for more on user roles.


The application (or middleware it uses) calls the core Engine APIs and the VISA APIs. The VISA APIs use stubs to access the core engine SPIs (System Programming Interfaces) and the skeletons. The skeletons access the core engine SPIs and the VISA SPIs. The VISA SPIs access the underlying algorithms.

The following figure is a modification of the previous diagram that shows how this architecture is distributed in a GPP+DSP system. In this example, yellow portions run on the GPP, and grey portions run on the DSP. That is, the video encoder skeleton and the video encoder codecs are on the DSP and the application and video encoder stubs are on the GPP.

Since Codec Engine is flexible, alternate diagrams could be shown for GPP-only and DSP-only systems.

1.4 What Are the User Roles?

The Codec Engine has several customer use cases, from application developers to codec authors. In some cases, these roles may be played by a single person. In other development environments, a different developer may be assigned each role. This topic describes the primary roles that Codec Engine users will play.

 

Because Codec Engine is very portable and configurable and can run in many different environments, the descriptions of these roles are intentionally generalized. When applicable, specific hardware and software environments are described after the general descriptions.

 

This document describes the APIs available to the Application Author. Other documents are referenced for the other roles.

1.4.1 Algorithm Creator

The Algorithm Creator is responsible for creating an xDAIS algorithm and providing the necessary packaging to enable these algorithms to be consumed and configured by Codec Engine.

 

If the codec is xDM-compliant, Codec Engine's VISA APIs support remote execution without additional support. However, if the codec is not xDM-compliant and the codecs support remote execution, the Algorithm Creator should supply Codec Engine skeletons and stubs.

 

The Algorithm Creator uses xDAIS and the XDC Tools. Using these, the Algorithm Creator generates a codec library with the IALG and optional IDMA3 interface symbols exported. This person also creates an XDC module that implements the ti.sdo.ce.ICodec interface.

 

The Algorithm Creator hands a released Codec package to the Server Integrator. This package includes a module that implements ti.sdo.ce.ICodec, as well as the libraries that contain the algorithm's implementation.

 

The Algorithm Creator uses the following resources:
❏ Codec Engine Algorithm Creator User's Guide (SPRUED6)
❏ Codec Engine SPI Reference Guide. CE_INSTALL_DIR/docs/spi/html/index.html
❏ xDAIS-DM (Digital Media) User Guide (SPRUEC8)
❏ xDM API Reference. XDAIS_INSTALL_DIR/docs/html/index.html 
❏ TMS320 DSP Algorithm Standard Rules and Guidelines (SPRU352)
❏ TMS320 DSP Algorithm Standard API Reference (SPRU360)
❏ TMS320 DSP Algorithm Standard Developer’s Guide (SPRU424)
❏ Example codecsWhat Are the User Roles?

1.4.2 Server Integrator

To support Engines with remote codecs, a Codec Server must be created. The Codec Server integrates and configures the various components necessary to house the codecs (e.g. DSP/BIOS, Framework Components, DSP/BIOS Link drivers, codecs, Codec Engine, etc.) and generates an executable.

 

There are two configuration steps that the Codec Server Integrator must perform, one to configure DSP/BIOS (through a Tconf script) and one to configure "the rest" of the components (through XDC configuration of Framework Components, DSP/BIOS Link, Codec Engine, etc).

 

The Server Integrator receives the various Codec packages from Algorithm Creators. This person uses Codec Engine and its dependent packages (DSP/BIOS, DSKT2, etc) along with the XDC Tools to create the following:
❏ A server configuration file (.cfg) 
❏ A server DSP/BIOS configuration file (.tcf) 
❏ A simple main() routine to do minimal initialization

❏ A DSP executable created by executing the configuration scripts and compiling the output. This executable is a Codec Server.

 

The Server Integrator hands the DSP executable to the Engine Integrator (preferably as a Codec Server package. The Server Integrator should also provide a list of the codecs in the Codec Server, as well as documentation about how they've been configured (for example, thread priorities and resource configuration).

 

The Server Integrator uses the following resources:
❏ Codec Engine Server Integrator's Guide (SPRUED5)
❏ Configuration Reference Guide. CE_INSTALL_DIR/xdoc/index.html
❏ Example Codec Servers
On GPP-only and DSP-only platforms the Codec Server is not used, so this role is not required.

1.4.3 Engine Integrator

The Engine Integrator defines various Engine configurations. This includes the names of the Engines, as well as the codecs and their names within each Engine, whether each codec is local or remote relative to the application, which groups each codec should be integrated into (for environments which support resource sharing), the name of the Codec Server image if a particular Engine contains remote codecs, etc. This is done via an XDC configuration script (*.cfg).

 

This script, when run, generates code and build instructions appropriate for the configuration.

&nb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值