Texas Instruments H.264 High Profile Encoder User Manual

H.264 High Profile Encoder on TMS320C6678 Platform
User’s Guide
Literature Number: SPRUHL4
December 2012
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All
semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale supplied at the time of order
acknowledgment. TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms and
conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily performed.
TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide adequate design and
operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information published by TI regarding third-party products or services does not constitute a license 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 significant portions 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. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions.
Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use of any TI components in safety-critical applications.
In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and requirements. Nonetheless, such components are subject to these terms.
No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties have executed a special agreement specifically governing such use.
Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and regulatory requirements in connection with such use.
TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.
Products Applications
Audio www.ti.com/audio Automotive & Transportation www.ti.com/automotive
Amplifiers amplifier.ti.com Communications & Telecom www.ti.com/communications
Data Converters dataconverter.ti.com Computers & Peripherals www.ti.com/computers
DLP® Products www.dlp.com Consumer Electronics www.ti.com/consumer-apps DSP dsp.ti.com Energy and Lighting www.ti.com/energyapps
Clocks and Timers www.ti.com/clocks Industrial www.ti.com/industrial
Interface interface.ti.com Medical www.ti.com/medical Logic logic.ti.com Security www.ti.com/security Power Mgmt power.ti.com Space, Avionics & Defense www.ti.com/space-avionics-defense
Microcontrollers microcontroller.ti.com Video & Imaging www.ti.com/video
RFID www.ti-rfid.com
OMAP Applications Processors www.ti.com/omap TI E2E Community e2e.ti.com
Wireless Connectivity www.ti.com/wirelessconnectivity
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright© 2012, Texas Instruments Incorporated
Preface
Read This First
About This Manual
This document describes how to install and work with Texas Instruments’ (TI) H.264 High Profile Encoder implementation on the TMS320C6678 platform. It also provides a detailed Application Programming Interface (API) reference and information on the sample application that accompanies this component.
TI’s codec implementations are based on the eXpressDSP Digital Media (XDM) standard. XDM is an extension of the eXpressDSP Algorithm Interface Standard (XDAIS).
Intended Audience
This document is intended for system engineers who want to integrate TI’s codecs with other
software to build a multimedia system based on the TMS320C6678 and Visual C. This document assumes that you are fluent in the C language, have a good working knowledge of
Digital Signal Processing (DSP), digital signal processors, and DSP applications. Good knowledge of eXpressDSP Algorithm Interface Standard (XDAIS) and eXpressDSP Digital Media (XDM) standard will be helpful.
How to Use This Manual
This document includes the following chapters:
Chapter 1 - Introduction, provides a brief introduction to the XDAIS and
XDM standards. It also provides an overview of the codec and lists its supported features.
Chapter 2 - Installation Overview, describes how to install, build, and run
the codec.
Chapter 3 - Sample Usage, describes the sample usage of the codec. Chapter 4 - API Reference, describes the data structures and interface
functions used in the codec.
Chapter 5 - Frequently Asked Questions, provides answers to few
frequently asked questions related to using this encoder.
iii
Appendix A – Debug Trace Support, describs the method to use H264
encoder debug and trace mechanism.
Appendix B - Call Back function for NAL Units, describes the Call back function that provides compressed bit-streams at NAL level.
Read This First
Related Documentation From Texas Instruments
The following documents describe TI’s DSP algorithm standards such as, XDAIS and XDM. To obtain a copy of any of these TI documents, visit the Texas Instruments website at www.ti.com.
TMS320 DSP Algorithm Standard Rules and Guidelines (literature number
SPRU352) defines a set of requirements for DSP algorithms that, if followed, allow system integrators to quickly assemble production-quality systems from one or more such algorithms.
TMS320 DSP Algorithm Standard API Reference (literature number
SPRU360) describes all the APIs that are defined by the TMS320 DSP Algorithm Interface Standard (also known as XDAIS) specification.
Technical Overview of eXpressDSP - Compliant Algorithms for DSP
Software Producers (literature number SPRA579) describes how to make algorithms compliant with the TMS320 DSP Algorithm Standard which is part of TI’s eXpressDSP technology initiative.
Using the TMS320 DSP Algorithm Standard in a Static DSP System
(literature number SPRA577) describes how an eXpressDSP-compliant algorithm may be used effectively in a static system with limited memory.
Using IRES and RMAN Framework Components for C64x+ (literature
number SPRAAI5), describes the IRES interface definition and function calling sequence.
eXpressDSP Digital Media (XDM) Standard API Reference (literature
number SPRUEC8)
Related Documentation
You can use the following documents to supplement this user guide:
ITU-T Rec. H.264 | ISO/IEC 14496-10 AVC - Draft ITU-T Recommendation
and Final Draft International Standard of Joint Video Specification
iv
Read This First
Abbreviation
Description
AIR
Adaptive Intra Fresh
API
Application Programming Interface
AVC
Advanced Video Coding
CAVLC
Context Adaptive Variable Length Coding
CIF
Common Intermediate Format
COFF
Common Object File Format
DMA
Direct Memory Access
DMAN3
DMA Manager
DSP
Digital Signal Processing
EVM
Evaluation Module
GOP
Group Of Pictures
IDR
Instantaneous Decoding Refresh
IRES
Interface for Resources
NAL
Network Abstraction Layer
PPS
Picture Parameter Set
QCIF
Quarter Common Intermediate Format
QP
Quantization Parameter
QVGA
Quarter Video Graphics Array
RMAN
Resource Manager
SPS
Sequence Parameter Set
SQCIF
Sub Quarter Common Intermediate Format
VGA
Video Graphics Array
Abbreviations
The following abbreviations are used in this document.
Table 0-1 List of Abbreviations
v
Read This First
Abbreviation
Description
XDAIS
eXpressDSP Algorithm Interface Standard
XDM
eXpressDSP Digital Media
Text Conventions
The following conventions are used in this document:
Text inside back-quotes (‘‘) represents pseudo-code. Program source code, function and macro names, parameters, and
command line commands are shown in a mono-spaced font.
Product Support
When contacting TI for support on this codec, quote the product name (H.264 High Profile Encoder on TMS320C6678 platform) and version number. The version number of the codec is included in the Title of the Release Notes that accompanies this codec.
Trademarks
Code Composer Studio, DSP/BIOS, eXpressDSP, TMS320, TMS320C64x, TMS320C6000, TMS320C6678, and TMS320C64x+ are trademarks of Texas Instruments.
All trademarks are the property of their respective owners.
vi
Contents
H.264 HIGH PROFILE ENCODER ON TMS320C6678 PLATFORM ................................................................. 1-1
READ THIS FIRST ......................................................................................................................................... III
ABOUT THIS MANUAL ......................................................................................................................................... III
INTENDED AUDIENCE .......................................................................................................................................... III
HOW TO USE THIS MANUAL ................................................................................................................................ III
RELATED DOCUMENTATION FROM TEXAS INSTRUMENTS ........................................................................................... IV
RELATED DOCUMENTATION ................................................................................................................................. IV
ABBREVIATIONS .................................................................................................................................................. V
TEXT CONVENTIONS ........................................................................................................................................... VI
PRODUCT SUPPORT ............................................................................................................................................ VI
TRADEMARKS .................................................................................................................................................... VI
CONTENTS ................................................................................................................................................. VII
FIGURES ...................................................................................................................................................... IX
TABLES ....................................................................................................................................................... XI
INTRODUCTION ........................................................................................................................................ 1-1
1.1 OVERVIEW OF XDAIS, XDM, AND IRES .....................................................................................................1-2
1.1.1 XDAIS Overview ........................................................................................................................1-2
1.1.2 XDM Overview ..........................................................................................................................1-2
1.1.3 IRES Overview ...........................................................................................................................1-3
1.2 OVERVIEW OF H.264 HIGH PROFILE ENCODER ............................................................................................1-4
1.3 SUPPORTED SERVICES AND FEATURES .........................................................................................................1-6
INSTALLATION OVERVIEW ........................................................................................................................ 2-1
2.1 SYSTEM REQUIREMENTS ..........................................................................................................................2-2
2.1.1 Hardware .................................................................................................................................2-2
2.1.2 Software ...................................................................................................................................2-2
2.2 INSTALLING THE COMPONENT ...................................................................................................................2-2
2.2.1 Installing the Component – RTSC Package ...............................................................................2-2
2.2.2 Installing the Component – Compressed archive .....................................................................2-4
2.3 BEFORE BUILDING THE ALGORITHM LIBRARY AND SAMPLE TEST APPLICATION ....................................................2-9
2.3.1 Installing XDAIS tools(XDAIS) ...................................................................................................2-9
2.3.2 Installing XDC Tools ..................................................................................................................2-9
2.3.3 Installing BIOS tools(SYS/BIOS) ..............................................................................................2-10
2.3.4 Installing Framework Component(FC) ....................................................................................2-10
2.3.5 Installing EDMA3 Low-Level Driver(LLD) ................................................................................2-10
2.3.6 Installing Inter Processor Communication (IPC) .....................................................................2-10
2.4 BUILDING THE ALGORITHM LIBRARY .........................................................................................................2-10
2.4.1 Building Algorithm Library on Visual studio ...........................................................................2-10
2.4.2 Building Algorithm Library on Code Composer Studio ...........................................................2-11
2.5 BUILDING SAMPLE TEST APPLICATION.......................................................................................................2-11
vii
2.5.1 Building Sample Test Application on Visual Studio ................................................................2-11
2.5.2 Building the Sample Test Application on Code Composer Studio – Compressed archive .......2-12
2.5.3 Building the Sample Test Application on Code Composer Studio - RTSC Package.................2-12
2.6 RUNNING SAMPLE TEST APPLICATION.......................................................................................................2-13
2.6.1 Running the Sample Test Application on Visual Studio ..........................................................2-13
2.6.2 Running the Sample Test Application on Code Composer Studio ...........................................2-14
2.7 CONFIGURATION FILES ...........................................................................................................................2-15
2.7.1 Encoder Configuration File .....................................................................................................2-15
2.8 UNINSTALLING THE COMPONENT .............................................................................................................2-18
SAMPLE USAGE ........................................................................................................................................ 3-1
3.1 OVERVIEW OF THE TEST APPLICATION.........................................................................................................3-2
3.1.1 Parameter Setup ......................................................................................................................3-3
3.1.2 Algorithm Instance Creation and Initialization ........................................................................3-3
3.1.3 Process Call...............................................................................................................................3-4
3.1.4 Algorithm Instance Deletion .....................................................................................................3-5
3.2 FRAME BUFFER MANAGEMENT .................................................................................................................3-5
3.2.1 Input Frame Buffer ...................................................................................................................3-5
API REFERENCE ......................................................................................................................................... 4-1
4.1 SYMBOLIC CONSTANTS AND ENUMERATED DATA TYPES .................................................................................4-2
4.1.1 Common XDM Data types ........................................................................................................4-2
4.1.2 Common Multi-Core Data types .............................................................................................4-24
4.2 DATA STRUCTURES ...............................................................................................................................4-28
4.2.1 Common XDM Data Structures ..............................................................................................4-28
4.2.2 Common Multi-core Data Structures .....................................................................................4-46
4.2.3 H.264 High Profile Encoder Data Structures ..........................................................................4-48
4.3 DEFAULT AND SUPPORTED VALUES OF PARAMETERS ...................................................................................4-64
4.4 INTERFACE FUNCTIONS ..........................................................................................................................4-74
4.4.1 Creation APIs ..........................................................................................................................4-75
4.4.2 Initialization API .....................................................................................................................4-77
4.4.3 Control API .............................................................................................................................4-79
4.4.4 Data Processing API ...............................................................................................................4-80
4.4.5 Termination API ......................................................................................................................4-86
FREQUENTLY ASKED QUESTIONS .............................................................................................................. 5-1
5.1 CODE BUILD AND EXECUTION ....................................................................................................................5-1
5.2 ALGORITHM RELATED ..............................................................................................................................5-1
DEBUG TRACE SUPPORT ........................................................................................................................... 5-1
A.1 DEBUG TRACE DESIGN IN ENCODER .......................................................................................................5-1
A.2 STEPS TO UTILIZE DEBUG TRACE SUPPORT IN H264 HIGH PROFILE ENCODER ..................................................5-1
CALL BACK FUNCTION FOR NAL UNITS ...................................................................................................... B-1
viii
Figures
FIGURE 1-1 XDM INTRODUCTION ...................................................................................................................1-3
FIGURE 1-2 IRES INTERFACE DEFINITION AND FUNCTION CALLING SEQUENCE ..........................................1-4
FIGURE 1-3 WORKING OF H.264 VIDEO ENCODER ........................................................................................1-5
FIGURE 2-1 COMPONENT DIRECTORY STRUCTURE IN CASE OF RTSC PACKAGE RELEASE ........................2-3
FIGURE 2-2 COMPONENT DIRECTORY STRUCTURE IN CASE OF OBJECT RELEASE ......................................2-5
FIGURE 2-3 COMPONENT DIRECTORY STRUCTURE IN CASE OF SOURCE RELEASE .....................................2-7
FIGURE 3-1 TEST APPLICATION SAMPLE IMPLEMENTATION ...........................................................................3-2
FIGURE 5-1 OVERVIEW OF CALLBACK FUNCTION. ......................................................................................... B-1
FIGURE 5-3 OVERVIEW OF COPYING .............................................................................................................. B-2
ix
This page is intentionally left blank
x
Tables
TABLE 0-1 LIST OF ABBREVIATIONS ................................................................................................................... V
TABLE 2-1 COMPONENT DIRECTORIES IN CASE OF RTSC PACKAGE RELEASE.............................................2-3
TABLE 2-2 COMPONENT DIRECTORIES IN CASE OF OBJECT RELEASE ..........................................................2-5
TABLE 2-3 COMPONENT DIRECTORIES IN CASE OF SOURCE RELEASE .........................................................2-7
TABLE 4-1 LIST OF ENUMERATED DATA TYPES .............................................................................................4-2
TABLE 4-2 H264 HIGH PROFILE ENCODER SPECIFIC ENUMERATED DATA TYPES .....................................4-11
TABLE 4-3 H264 ENCODER CONSTANTS .....................................................................................................4-21
TABLE 4-4 H.264 ENCODER ERROR STATUSES ..........................................................................................4-21
TABLE 4-5 DEFAULT AND SUPPORTED VALUES FOR IVIDENC2_PARAMS.................................................4-64
TABLE 4-6 DEFAULT AND SUPPORTED VALUES FOR IVIDENC2_DYNAMICPARAMS .................................4-66
TABLE 4-7 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_RATECONTROLPARAMS...............4-67
TABLE 4-8 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_INTERCODINGPARAMS .................4-68
TABLE 4-9 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_INTRACODINGPARAMS .................4-68
TABLE 4-10 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_SLICECODINGPARAMS...............4-69
TABLE 4-11 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_LOOPFILTERPARAMS ...............4-70
TABLE 4-12 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_VUICODINGPARAMS ..................4-70
TABLE 4-13 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_PARAMS......................................4-71
TABLE 4-14 DEFAULT AND SUPPORTED VALUES FOR IH264HPVENC_DYNAMICPARAMS .............................................4-73
xi
This page is intentionally left blank
xii
Introduction
1.1 Overview of XDAIS, XDM, and IRES
1-2
1.2 Overview of H.264 High Profile Encoder
1-4
1.3 Supported Services and Features
1-6
Chapter 1
Introduction
This chapter provides a brief introduction to XDAIS and XDM. It also provides an overview of TI’s implementation of the H.264 High Profile Encoder on the TMS320C6678 platform and its supported features.
Topic Page
1-1
Introduction
1.1 Overview of XDAIS, XDM, and IRES
TI’s multimedia codec implementations are based on the eXpressDSP Digital Media (XDM)
standard. XDM is an extension of the eXpressDSP Algorithm Interface Standard (XDAIS). IRES is the interface for management and utilization of special resource types such as hardware accelerators, certain types of memory, and DMA. This interface allows the client application to query and provide the algorithm its requested resources.
1.1.1 XDAIS Overview
An eXpressDSP-compliant algorithm is a module that implements the abstract interface IALG. The IALG API takes the memory management function away from the algorithm and places it in the hosting framework. Thus, an interaction occurs between the algorithm and the framework. This interaction allows the client application to allocate memory for the algorithm and also share memory between algorithms. It also allows the memory to be moved around while an algorithm is operating in the system. In order to facilitate these functionalities, the IALG interface defines the following APIs:
algAlloc() algInit() algActivate() algDeactivate() algFree()
The algAlloc() API allows the algorithm to communicate its memory requirements to the client application. The algInit() API allows the algorithm to initialize the memory allocated by the client application. The algFree() API allows the algorithm to communicate the memory to be freed when an instance is no longer required.
Once an algorithm instance object is created, it can be used to process data in real-time. The
algActivate() API provides a notification to the algorithm instance that one or more algorithm
processing methods is about to be run zero or more times in succession. After the processing methods have been run, the client application calls the algDeactivate() API prior to reusing any of the instance’s scratch memory.
The IALG interface also defines three more optional APIs algControl(), algNumAlloc(), and
algMoved(). For more details on these APIs, see TMS320 DSP Algorithm Standard API
Reference (literature number SPRU360).
1.1.2 XDM Overview
In the multimedia application space, you have the choice of integrating any codec into your multimedia system. For example, if you are building a video decoder system, you can use any of the available video decoders (such as MPEG4, H.263, or H.264) in your system. To enable easy integration with the client application, it is important that all codecs with similar functionality use similar APIs. XDM was primarily defined as an extension to XDAIS to ensure uniformity across different classes of codecs (for example audio, video, image, and speech). The XDM standard defines the following two APIs:
1-2
control()
Introduction
Client Application
XDAIS Interface (IALG)
TI’s Codec Algorithms
XDM Interface
Figure 1-1 XDM Introduction
process()
The control() API provides a standard way to control an algorithm instance and receive status information from the algorithm in real-time. The control() API replaces the algControl() API defined as part of the IALG interface. The process() API does the basic processing (encode/decode) of data.
Apart from defining standardized APIs for multimedia codecs, XDM also standardizes the generic parameters that the client application must pass to these APIs. The client application can define additional implementation specific parameters using extended data structures.
The following figure depicts the XDM interface to the client application.
As depicted in Figure 1-1, XDM is an extension to XDAIS and forms an interface between the client application and the codec component. XDM insulates the client application from component-level changes. Since TI’s multimedia algorithms are XDM compliant, it provides you with the flexibility to use any TI algorithm without changing the client application code. For example, if you have developed a client application using an XDM-compliant MPEG4 video decoder, then you can easily replace MPEG4 with another XDM-compliant video decoder, say H.263, with minimal changes to the client application.
For more details, see eXpressDSP Digital Media (XDM) Standard API Reference (literature number SPRUEC8).
1.1.3 IRES Overview
IRES is a generic, resource-agnostic, extendible resource query, initialization and activation interface. The application framework defines, implements, and supports concrete resource interfaces in the form of IRES extensions. Each algorithm implements the generic IRES interface, to request one or more concrete IRES resources. IRES defines standard interface functions that the framework uses to query, initialize, activate/deactivate and reallocate concrete IRES resources. To create an algorithm instance within an application framework, the algorithm and the application framework agrees on the concrete IRES resource types that are requested. The framework calls the IRES interface functions, in addition to the IALG functions, to perform IRES resource initialization, activation, and deactivation.
1-3
Introduction
The IRES interface introduces support for a new standard protocol for cooperative preemption, in addition to the IALG-style non-cooperative sharing of scratch resources. Co-operative preemption allows activated algorithms to yield to higher priority tasks sharing common scratch resources. Framework components include the following modules and interfaces to support algorithms requesting IRES-based resources:
IRES - Standard interface allowing the client application to query and
provide the algorithm with its requested IRES resources.
RMAN - Generic IRES-based resource manager, which manages
and grants concrete IRES resources to algorithms and applications. RMAN uses a new standard interface, the IRESMAN, to support run­time registration of concrete IRES resource managers.
Client applications call the algorithm’s IRES interface functions to query its concrete IRES resource
requirements. If the requested IRES resource type matches a concrete IRES resource interface supported by the application framework, and if the resource is available, the client grants the algorithm logical IRES resource handles representing the allotted resources. Each handle provides the algorithm with access to the resource as defined by the concrete IRES resource interface.
IRES interface definition and function-calling sequence is depicted in the Figure 1-2. For more details, see Using IRES and RMAN Framework Components for C64x+ (literature number SPRAAI5).
Figure 1-2 IRES Interface Definition and Function Calling Sequence
For more details, see Using IRES and RMAN Framework Components for C64x+ (literature number SPRAAI5).
1.2 Overview of H.264 High Profile Encoder
H.264 is the latest video compression standard from the ITU-T Video Coding Experts Group and the ISO/IEC Moving Picture Experts Group. H.264 provides greater compression ratios at a very low bit-rate. The new advancements and greater compression ratios available at a very low bit- rate has made devices ranging from mobile and consumer electronics to set-top boxes and digital terrestrial broadcasting to use the H.264 standard.
1-4
Introduction
Figure 1-3 depicts the working of the H.264 High Profile Encoder algorithm.
Figure 1-3 Working of H.264 Video Encoder
In H.264 Encoder, the operations are performed on set of specific N macro blocks. The selection of N depends on the availability of internal memory. The operations such as motion compensation, transform and quantization, run length encoding and inverse quantization, and inverse transform blocks are called once for all the inter macro blocks in the set of N.
The encoder is designed such that, it always tries to maximize the throughput of each unit by allowing it to perform on maximum possible number of macro blocks.
Motion Estimation is the step where encoder searches for the best match in the available reference frame(s). After quantization, contents of some blocks become zero. The H.264 Encoder keeps track of this information and passes the information of coded 4x4 blocks to inverse transform so that it can skip computation for those blocks that contains all zero co-efficients and are not coded.
The H.264 Encoder defines in-loop filtering to avoid blocks across the 4x4 block boundaries. It is the second most computational task of H.264 encoding process after motion estimation. In-loop filtering is applied on all 4x4 edges as a post-process and the operations depend upon the edge strength of the particular edge.
The H.264 Encoder applies entropy coding methods to use context based adaptivity, which in turn improves the coding performance. All the macro blocks, which belong to a slice, must be encoded in a raster scan order. Entropy coding methods such has Golomb coding, Context Adaptive Variable Length Coding (CAVLC) and Context Adaptive Binary Arthmetic Coding (CABAC). Syntax parameter, which will be used for decoding will be coded in Golomb code. CAVLC is the stage where transformed and quantized co-efficients are entropy coded using context adaptive table switching across different symbols. The syntax defined by the H264 Encoder stores the information at 4x4 block level. CABAC coding depend on context based probability model is selected. Using State and Most Probable Bit each bits of the syntax elements and residual data are encoded.
1-5
Introduction
1.3 Supported Services and Features
This user guide accompanies TI’s implementation of H.264 High Profile Encoder on the TMS320C6678 platform.
This version of the codec has the following supported features of the standard:
Supports H.264 baseline, main and high profile up to level 4.0 Supports B frame encoding Supports arbitrary video resolutions from 64x64 upto 4kx4k Supports image width and height that are multiple of 16, also supports
image width and height being non-multiple of 16
Supports progressive and field based interlace coding with different
controls as ARF(Adaptive Reference Field), MRF(Most Recent Reference Field), and SPF(Same Parity Reference Field)
Supports control to have Bottom field first for interlaced coding Supports user controlled partition size till 8x8 block for inter prediction Supports user controlled all intra modes (16x16, 8x8, and 4x4) Supports user controllable quantization parameter range, initial
quantization parameter, HRD buffer size
Supports 8x8 and 4x4 transform size Supports separate Cb and Cr Quantisation parameter control Supports multiple Scaling Matrix Preset and User Defined Scaling Matrices Supports user controlled quarter-pel interpolation and integer pel for motion
estimation
Supports in-loop filtering which can be switched off for whole picture as
well for slice boundaries
Supports unrestricted motion vector search which allows motion vectors to
be outside the frame boundary
Supports multiple slices per picture based upon number of macroblocks in
each slice
Controls the balance between encoder speed and quality by using the user
definable encoding preset option
1-6
Supports AIR (Adaptive Intra Refresh) with cyclic intra macro blocks Supports constrained intra prediction Supports user controlled all POC types: 0, 1 and 2 Supports user configurable parameters like pic_order_cnt_type,
log2_max_frame_num_minus4, and chroma_qp_index_offset
Introduction
Supports insertion of IDR frame at random point with forceFrame control Supports user controlled IDR frequency control Supports change of frame rate, and bit rate dynamically Supports user configurable Group of Pictures (GOP) length and different
GOP structures: Non-Uniform(IBBP) and Uniform(BBIBBP)
Supports byte stream format and NAL unit format. Support capability to generating only headers The other explicit features that TI’s H.264 HP Encoder provides are: eXpressDSP Digital Media (XDM IVIDENC2) interface compliant Independent of any operating system Supports only YUV420 planar color sub-sampling format Supports multi-channel functionality This version of the codec does not support the following features of the
standard:
Does not support MBAFF/PicAFF Does not support BASE CLASS only mode
1-7
2.1 System Requirements
2-2
2.2 Installing the Component
2-2
2.3 Before Building the Algorithm Library and Sample Test Application
2-9
2.4 Building the Algorithm Library
2-10
2.5 Building Sample Test Application
2-11
2.6 Running Sample Test Application
2-13
2.7 Configuration Files
2-15
2.8 Uninstalling the Component
2-18
Chapter 2
Installation Overview
This chapter provides a brief description on the system requirements and instructions for installing the codec component. It also provides information on building and running the sample test application.
Topic Page
2-1
Installation Overview
2.1 System Requirements
This section describes the hardware and software requirements for the normal functioning of the codec component.
2.1.1 Hardware
This codec has been built and tested using Code Composer Studio Version 5.1.0.09000 and sanity testing is done on Shannon (TMS320C6678) platform.
2.1.2 Software
The following are the software requirements for the normal functioning of the codec:
Development Environment: This project is developed using Code
Composer Studio version 5.1.0.09000. This project is sanity tested on Shannon (TMS320C6678) platform
Code Generation Tools: This project is compiled, assembled,
archived, and linked using C6000 Code Generation tools version 7.4.1 for C66x CPU.
2.2 Installing the Component
The codec component is released as RTSC package or compressed archive. Following sub sections details on installation along with directory structure.
2.2.1 Installing the Component – RTSC Package
The codec component is released as executable. When the excutable is run, a top-level directory called “C66x_h264hpvenc_01_00_00_00_ELF” created. Figure 2-1 shows sub directorys created and Table 2-1 provides description of sub directories from the folder “h264hpvenc”.
2-2
Installation Overview
Sub-Directory
Description
\h264hpvenc
Contains RTSC package build files along with Sample test application folders, XDM related codec interface files.
\h264hpvenc\App
Contains sample test application, which uses codec library using IVIDENC2 codec interface.
\h264hpvenc\App\Client\B uild\C66X\Map
Contains map file generated after building with 66X compiler
\h264hpvenc\App\Client\B uild\C664X\Obj
Contains intermediate Object files generated after building host test application with C66X compiler
\h264hpvenc\App\Client\B uild\C66X\Out
Contains the final application executable (.out) file generated by the sample test application.
2-3
Figure 2-1 Component Directory Structure In case of RTSC package Release
Table 2-1 Component Directories in case of RTSC package release
Installation Overview
Sub-Directory
Description
\h264hpvenc\App\Client\B uild\packages
Platform RTSC package for building Test application.
\h264hpvenc\App\Client\T est\Inc
Contains standalone test application header files
\h264hpvenc\App\Client\T est\Src\C66X
Contains standalone test application source files specific to C66x processor
\h264hpvenc\Client\Test\S rc\Common
Conatains standalone test application common source files
\h264hpvenc\App\Client \Test\TestVecs\Config
Contains sample configuration files for H264 High Profile encoder
\h264hpvenc\App\Client \Test\TestVecs\Input
Contains input test vectors
\h264hpvenc\App\Client \Test\TestVecs\Output
Contains output generated by the codec. It is empty directory as part of release
\h264hpvenc\App\Client \Test\TestVecs\Reference
Contains read-only reference output to be used for cross-checking against codec output
\h264hpvenc\Docs
Contains user guide, data sheet, release notes and software manifest
\h264hpvenc\Lib
Contains the library file named as h264hpvenc_ti.le66 for encoding the compressed video data
2.2.2 Installing the Component – Compressed archive
The codec component is released as a compressed archive. To install the codec, extract the contents of the zip file onto your local hard disk. The zip file extraction creates a top-level directory called 100.V.H264HP.E.C6678.01.00, under which directory named C6678_001 is created.
Figure 2-2 shows the sub-directories created in the C6678_001 directory in case of object release. Figure 2-3 will show directory structure in case of Source release. Only “Src” is additional in source
release compared to object only release package, remaining folders being same.
C6678_001: This package runs on TMS320C6678 platform.
2-4
Installation Overview
Sub-Directory
Description
\Client\Build\C66X\Map
Contains map file generated after building with 66X compiler
\Client\Build\C664X\Obj
Contains intermediate Object files generated after building host test application with C66X compiler
\Client\Build\C66X\Out
Contains the final application executable (.out) file generated by the sample test application.
\Client\Build\packages
Platform RTSC package for building Test application.
\Client\Build\VC\h264hpve nc_ti_vc
Contains project files to build stand alone test application for encoder on VC \Client\Test\Inc
Contains standalone test application header files
\Client\Test\Src\C66X
Contains standalone test application source files specific to C66x processor
\Client\Test\Src\Common
Conatains standalone test application common source files
Figure 2-2 Component Directory Structure In case of Object Release
Table 2-2 provides a description of the sub-directories created in the C6678_001 directory.
Table 2-2 Component Directories in case of Object release
2-5
Installation Overview
Sub-Directory
Description
\Client \Test\TestVecs\Config
Contains sample configuration files for H264 encoder
\Client \Test\TestVecs\Input
Contains input test vectors
\Client \Test\TestVecs\Output
Contains output generated by the codec. It is empty directory as part of release
\Client \Test\TestVecs\Reference
Contains read-only reference output to be used for cross-checking against codec output
\docs
Contains user guide, data sheet and release notes
\Inc
Contains XDM related header files, which allow interface to the codec library.
\Lib
Contains the library file named as h264hpvenc_ti_vc.lib,h264hpvenc_ti.le66 for encoding the compressed video data
2-6
Installation Overview
Sub-Directory
Description
\Src\Build\C66X
Contains project files needed to build codec with C66X compiler
\Src\Build\C66X\Obj
Contains intermediate Object files generated after building codec with C66X compiler
\Src\Build\VC\h264hpvenc _ti_vc_lib
Contains project files needed to build codec with Microsoft Visual studio compiler
\Src\Build\VC\Obj
Contains intermediate Object files generated after building codec with C66X compiler
\Src\Common
Contains common source files needed to build codec
\Src\Inc
Contains common header files needed to build codec
Figure 2-3 Component Directory Structure In case of Source Release
Table 2-3 below provides a description of the additional sub-directories, which are part of source release package compared to Object release directories (as in Table 2-2)
Table 2-3 Component Directories in case of Source release
2-7
Installation Overview
Sub-Directory
Description
\Src\Platform\Inc
Contains Platform specific header files ex. ECPY wrapper APIs
\Src\ISA\C66X\ASM
Contains hand written assembly files specific to C66X processor
\Src\ISA\C66X\C
Contains source files specific to the TMS320C6678 platform
\Src\ISA\C66X\CI
Contains intrinsic implementation of source files for TMS320C6678 platform
\Src\ISA\C66X\Inc
Contains header files of codec specific to TMS320C6678 platform
\Src\ISA\C66X\SA
Contains linear assembly files specific to TMS320C6678 platform
\Src\ISA\VC\C
Contains Visual studio specific C source files for encoder algorithm.
\Src\ISA\VC\Inc
Contains Visual studio specific Include files for encoder algorithm.
2-8
Installation Overview
2.3 Before Building the Algorithm Library and Sample Test Application
This codec is accompanied by a sample test application. To run the sample test application, XDAIS tools, BIOS tools, Framework Components, and XDC tools are required.
This version of the codec has been validated with XDAIS tools containing IVIDENC2 interface version
The version of the XDAIS tools required is 7.21.01.07 The version of the XDC tools required is 3.22.04.46 The version of the BIOS tools required is 6.32.5.54 The version of the Code Generation tools required is 7.4.1 The version of Framework Components required is 3.23.02.16 The version of EDMA low-level driver required is 2.11.03.03 The version of IPC tools required is 1.23.05.40 Make sure environmental variable “CG_TOOL_ROOT” is set to proper code generation tools
installation path.
2.3.1 Installing XDAIS tools(XDAIS)
XDAIS version 7.21 can be downloaded from the following website:
http://software­dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/xdais/7_21_01_07/index_FDS.html
Extract the XDAIS zip file to the same location where Code Composer Studio is installed. For example:
C:\CCStudio5.0
Set a system environment variable named XDAIS_INSTALL_DIR pointing
to <install directory>\<Xdais_directory>
2.3.2 Installing XDC Tools
XDC Tools are required to build the test application. The test application uses the standard files like <std.h> from XDC tools. The xdc tools can be downloaded and installed from the following website:
http://software­dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/3_22_04_46/index_FDS.html
Also Ensure that the environment variable XDCROOT is set to the XDC installation directory. Eg:set XDCROOT to <install directory>\<xdc_tools>
Set a system environment variable named XDC_INSTALL_DIR pointing to <install directory>\<xdc_directory>
2-9
Installation Overview
2.3.3 Installing BIOS tools(SYS/BIOS)
Unit test application uses SYS/BIOS tools to create tasks, cache programming etc. The xdc tools version 6.32.5.54 can be downloaded from the following website:
http://software­dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/sysbios/6_32_05_54 /index_FDS.html
2.3.4 Installing Framework Component(FC)
Framework Components are required for using IRES interface for EDMA3 hardware. FC tools can be downloaded and installed from the following website
http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/fc/3_23_02_16/index_FDS.html
Mare sure that FC tools are recognized as RTSC package in CCS V5 by adding installation directory path RTSC products search path in CCS V5 preferences.
Set a system environment variable named FC_INSTALL_DIR pointing to <install directory>\<fc_directory>
2.3.5 Installing EDMA3 Low-Level Driver(LLD)
EDMA3 low-level driver tools are used for configuring EDMA channels and data transfer across DDR memory to L2 memory using EDMA hardware. EDMA low-level driver can be downloaded from the following website.
http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/psp/edma3_lld/edma3-lld­bios6/02_11_03_03/index_FDS.html
Mare sure that EDMA3 LLD tools are recognized as RTSC package in CCS V5 by adding installation directory path at RTSC products search path in CCS V5 preferences.
2.3.6 Installing Inter Processor Communication (IPC)
Inter processor communication software is used to synchronize multiple cores and share data between cores via messaging. IPC software version 1.23.5.40 can be downloaded from the following website
http://software­dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/ipc/1_23_05_40/index_FDS.html
2.4 Building the Algorithm Library
Building algorithm library on Visual studio and CCS is specified in section 2.4.1 and 2.4.2 resepctively.
2.4.1 Building Algorithm Library on Visual studio
To build the algorithm library from source code in Visual Studio, follow these steps:
1) Verify that you have installed Microsoft Visual Studio 2008 Express Edition development environment. Open the source project
2-10
Loading...
+ 109 hidden pages