48-v to 3.3-v forward converter with active clamp reset using the ucc2891 active clamp current mode pwm controller (21 pages)
Summary of Contents for Texas Instruments H.264 High Profile Encoder
Page 1
H.264 High Profile Encoder on TMS320C6678 Platform User’s Guide Literature Number: SPRUHL4 December 2012...
Page 2
IMPORTANT NOTICE 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.
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.
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...
Read This First Abbreviations The following abbreviations are used in this document. Table 0-1 List of Abbreviations Abbreviation Description Adaptive Intra Fresh Application Programming Interface Advanced Video Coding CAVLC Context Adaptive Variable Length Coding Common Intermediate Format COFF Common Object File Format Direct Memory Access DMAN3 DMA Manager...
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.
Contents H.264 HIGH PROFILE ENCODER ON TMS320C6678 PLATFORM ..............1-1 READ THIS FIRST ............................III ............................BOUT ANUAL ............................NTENDED UDIENCE ..........................OW TO ANUAL ................... ELATED OCUMENTATION EXAS NSTRUMENTS ..........................ELATED OCUMENTATION ..............................BBREVIATIONS ............................ONVENTIONS ............................RODUCT UPPORT ..............................
Page 8
Common XDM Data types ......................4-2 4.1.2 Common Multi-Core Data types .....................4-24 ..........................4-28 TRUCTURES 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-64 EFAULT AND UPPORTED ALUES OF ARAMETERS ..........................4-74 NTERFACE UNCTIONS 4.4.1 Creation APIs ..........................4-75...
Figures 1-1 XDM I ........................1-3 IGURE NTRODUCTION ..........1-4 1-2 IRES I IGURE NTERFACE EFINITION AND UNCTION ALLING EQUENCE 1-3 W H.264 V ..................1-5 IGURE ORKING OF IDEO NCODER ......2-3 2-1 C RTSC IGURE OMPONENT IRECTORY TRUCTURE N CASE OF PACKAGE ELEASE 2-2 C ........2-5...
Tables 0-1 L ........................ABLE IST OF BBREVIATIONS ..........2-3 2-1 C RTSC ABLE OMPONENT IRECTORIES IN CASE OF PACKAGE RELEASE 2-2 C ............2-5 ABLE OMPONENT IRECTORIES IN CASE OF BJECT RELEASE ............2-7 2-3 C ABLE OMPONENT IRECTORIES IN CASE OF OURCE RELEASE 4-1 L .....................4-2...
Introduction 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 Overview of XDAIS, XDM, and IRES 1.2 Overview of H.264 High Profile Encoder...
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.
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.
Using IRES and RMAN Framework Components for C64x+ 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.
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.
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 ...
Page 19
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) ...
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 System Requirements 2.2 Installing the Component 2.3 Before Building the Algorithm Library and Sample Test Application 2.4 Building the Algorithm Library...
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: ...
Installation Overview Figure 2-1 Component Directory Structure In case of RTSC package Release Table 2-1 Component Directories in case of RTSC package release 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.
Installation Overview Sub-Directory Description \h264hpvenc\App\Client\B Platform RTSC package for building Test application. uild\packages \h264hpvenc\App\Client\T Contains standalone test application header files est\Inc \h264hpvenc\App\Client\T Contains standalone test application source files specific to C66x processor est\Src\C66X \h264hpvenc\Client\Test\S Conatains standalone test application common source files rc\Common \h264hpvenc\App\Client Contains sample configuration files for H264 High Profile encoder...
Installation Overview 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 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...
Page 26
Installation Overview Sub-Directory Description \Client Contains sample configuration files for H264 encoder \Test\TestVecs\Config \Client Contains input test vectors \Test\TestVecs\Input \Client Contains output generated by the codec. It is empty directory as part of release \Test\TestVecs\Output \Client Contains read-only reference output to be used for cross-checking against \Test\TestVecs\Reference codec output \docs...
Installation Overview 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 Sub-Directory Description \Src\Build\C66X...
Page 28
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...
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...
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...
Installation Overview “h264hpvenc_ti_vc_lib.vcproj” from “..\Src\Build\VC\h264hpvenc_ti_vc_lib\”. 2) This project contains two build configurations “Debug” and “Release”. “Debug” configuration will disable all the optimizations to debug the code. “Release” configuration will enable all the optimizations without exposing symbols. Please select “Debug” configuration. 3) Right click on the above project in Visual Studio IDE and select Build Project to build the algorithm library.
Installation Overview 4) Select File->Open->Project/Solution and open “h264hpvenc_ti_vc.sln” located at “..\Client\Build\VC\h264hpvenc_ti_vc\” 5) Select Build->Build solution it builds the stand alone test application 2.5.2 Building the Sample Test Application on Code Composer Studio – Compressed archive The sample test application that accompanies this codec component will run on TMS320C6678 Evaluation Module platform.
Installation Overview h264hpvenc_ti.le66: H264 HP Encoder. 2) Make sure all the tools installed and configured as specified in section 2.3. 3) Select the CCS Edit perspective in the workbench 4) Add the C66X project named “h264hpvenc_ti_c66x” through “Import Existing CCS/CCE Eclipse Project” option to the workspace. All files required for this project are available in the \h264hpvenc\App\Client\Build\C66X\ sub-directory 5) This project contains two build configurations “Debug”...
Installation Overview reference files stored in the Client\Test\TestVecs\Reference sub- directory to verify that the codec is functioning as expected. 7) On successful completion, the application displays the following messages for every display frame: "---Num Frames Encoded : <> Frame Type <> Bits<> ----" 8) The output is written to the file specified (this can then be manually compared against the reference).
Installation Overview "---Num Frames Encoded :<> Frame Type <> Bits<>Padding Bits<>---" 11) On failure, the application exits after decoding the frame in which codec failed to generate the correct result with printing the error message from which module it failed. Note: Reference file specified in “Reference”...
Page 36
Installation Overview IVIDEO_STORAGE, 1: IVIDEO_LOW_DELAY framesToEncode = 300 # Total number of frames to encode MaxWidth = 640 # Max Frame width MaxHeight = 480 # Max Frame height MaxInterFrameInterval= 3 # I to P frame distance InputChromaFormat = 1 # 1 => XDM_YUV_420P, Only 1 is supported. InputContentType = 0 # Input buffer content type, 0 ->...
Installation Overview ################################################################################## gopStructure = 0 # 0 => Open or Non uniform(IBBPBBP), 1 => Closed or Uniform (BBIBBPBB log2MaxFNumMinus4 = 0 # # sliceParams::frame_num syntax element will be reset after every (1<< (log2MaxFNumMinus4 + 4)) frames picOrderCountType = 0 # Picture order count type IDRFrameInterval = 1000 # Interval b/w two IDR frames 0=>IDR BBP I BBP I,...
Chapter 3 Sample Usage This chapter provides a detailed description of the sample test application that accompanies this codec component. Topic Page 3.1 Overview of the Test Application 3.2 Frame Buffer Management...
Sample Usage 3.1 Overview of the Test Application The test application exercises the IVIDENC2 and extended class of the H.264 High Profile Encoder library. The source files for this application are available in the \Client\Test\Src and \Client\Test\Inc sub-directories. Figure 3-1 Test Application Sample Implementation The test application is divided into four logical blocks: ...
Sample Usage 3.1.1 Parameter Setup Each codec component requires various codec configuration parameters to be set at initialization. For example, a video codec requires parameters such as video height, video width, and so on. The test application obtains the required parameters from the Encoder configuration files. In this logical block, the test application does the following: 1) Opens the configuration file, listed in TesCases.txt and reads the 2) various configuration parameters required for the algorithm.
Sample Usage 3.1.3 Process Call After algorithm instance creation and initialization, the test application does the following: 3) Sets the dynamic parameters (if they change during run-time) by calling the control() function with the XDM_SETPARAMS command. 4) Sets the input and output buffer descriptors required for the process() function call.
Sample Usage 3.1.4 Algorithm Instance Deletion Once decoding/encoding is complete, the test application must release the resources granted by the IRES resource Manager interface and delete the current algorithm instance. The following APIs are called in sequence: 1) Free all resources granted by RMAN 2) algNumAlloc() - To query the algorithm about the number of memory records it used.
Page 44
Sample Usage As shown in the table, the first frame input ID (1) is returned as a free buffer ID at the end of the third process call that is after accumulating buffers for two B frames. For the first two process calls, free buffer IDs are returned as zero.
Chapter 4 API Reference This chapter provides a detailed description of the data structures and interfaces functions used in the codec component. Topic Page 4.1 Symbolic Constants and Enumerated Data Types 4.2 Data Structures 4-28 4.3 Default and Supported Values of Parameters 4-64 4.4 Interface Functions 4-74...
API Reference 4.1 Symbolic Constants and Enumerated Data Types This section summarizes all the symbolic constants specified as either #define macros and/or enumerated C data types. For each symbolic constant, the semantics or interpretation of the same is also provided. 4.1.1 Common XDM Data types This section includes common XDM Enumerated data types: Table 4-1 List of Enumerated Data Types...
Page 47
Group or Enumeration Symbolic Constant Description or Evaluation Class Name IVIDEO_BB_FRAME Interlaced frame, both fields are B frames. IVIDEO_MBAFF_I_FRA Intra coded MBAFF frame. IVIDEO_MBAFF_P_FRA Forward inter coded MBAFF frame. IVIDEO_MBAFF_B_FRA Bi-directional inter coded MBAFF frame. IVIDEO_MBAFF_IDR_F Intra coded MBAFF frame that can be RAME used for refreshing video content.
Page 48
API Reference Group or Enumeration Symbolic Constant Description or Evaluation Class Name IVIDEO_INTERLACED_ Interlaced video content, bottom field. BOTTOMFIELD IVIDEO_RateControlPr IVIDEO_LOW_DELAY Constant Bit Rate (CBR) control for eset video conferencing. IVIDEO_STORAGE Variable Bit Rate (VBR) control for local IVIDEO_RATE_CONTRO storage (DVD) recording, L_PRESET_DEFAULT Default rate control preset value.
Page 49
Group or Enumeration Symbolic Constant Description or Evaluation Class Name IVIDEO_P_PICTURE Forward inter coded picture. IVIDEO_B_PICTURE Bi-directional inter coded picture. IVIDEO_VideoLayout IVIDEO_FIELD_INTER Buffer layout is interleaved. LEAVED IVIDEO_FIELD_SEPAR Buffer layout is field separated. ATED IVIDEO_TOP_ONLY Buffer contains only top field. IVIDEO_BOTTOM_ONLY Buffer contains only bottom field.
Page 50
API Reference Group or Enumeration Symbolic Constant Description or Evaluation Class Name XDM_AccessMode XDM_ACCESSMODE_REA Algorithm read from the buffer using the CPU. XDM_ACCESSMODE_WRI Algorithm writes to the buffer using the CPU. XDM_CmdId XDM_GETSTATUS Status Query algorithm instance to fill structure. XDM_SETPARAMS Set run-time dynamic parameters DynamicParams...
Page 51
Group or Enumeration Symbolic Constant Description or Evaluation Class Name XDM_GETBUFINFO Query algorithm instance regarding its properties of input and output buffers. The application only needs to initialize the dynamicParams.size , the status.size , and set any buffer descriptor fields (example, status.data NULL ) to...
Page 52
API Reference Group or Enumeration Symbolic Constant Description or Evaluation Class Name XDM_ChromaFormat XDM_CHROMA_NA Chroma format not applicable. XDM_YUV_420P YUV 4:2:0 planar. XDM_YUV_422P YUV 4:2:2 planar. XDM_YUV_422IBE YUV 4:2:2 interleaved (big endian). XDM_YUV_422ILE YUV 4:2:2 interleaved (little endian) XDM_YUV_444P YUV 4:4:4 planar. XDM_YUV_411P YUV 4:1:1 planar.
Page 53
Group or Enumeration Symbolic Constant Description or Evaluation Class Name XDM_HIGH_QUALITY Set algorithm specific creation time parameters for high quality. XDM_HIGH_SPEED Set algorithm specific creation time parameters for high speed. XDM_USER_DEFINED User defined configuration using XDM_PRESET_DEFAULT advanced parameters. Default value. XDM_HIGH_SPEED_MED Set algorithm specific creation time _QUALITY...
Page 54
API Reference Group or Enumeration Symbolic Constant Description or Evaluation Class Name XDM_APPLIEDCONCEAL Bit 9 MENT 1 - Applied concealment 0 - Ignore This error is applicable for decoders. It is set when the decoder was not able to decode the bit-stream, and the decoder has concealed the bit-stream error and produced the concealed output.
Page 55
Group or Enumeration Symbolic Constant Description or Evaluation Class Name XDM_UNSUPPORTEDPAR Bit 14 1 - Unsupported input parameter or configuration 0 - Ignore This error is set when the algorithm does not support certain configurable parameters. For example, if the video decoder does not support the display width feature, it will return XDM_UNSUPPORTEDPARAM...
Page 56
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264HP_LEVEL_13 H.264 Level 1.3 IH264HP_LEVEL_20 H.264 Level 2.0 IH264HP_LEVEL_21 H.264 Level 2.1 IH264HP_LEVEL_22 H.264 Level 2.2 IH264HP_LEVEL_30 H.264 Level 3.0 IH264HP_LEVEL_31 H.264 Level 3.1 IH264HP_LEVEL_32 H.264 Level 3.2 IH264HP_LEVEL_40 H.264 Level 4.0 IH264HP_LEVEL_41...
Page 57
Group or Enumeration Symbolic Constant Name Description or Evaluation Class MatrixPreset IH264HP_SCALINGMATRIX_NONE Flat scaling matrix: part of standard IH264HP_SCALINGMATRIX_DEFA (no scaling matrix) Default scaling matrix (normal contents) IH264HP_SCALINGMATRIX_STD_ Standard Default scaling matrix DEFAULT IH264HP_SCALINGMATRIX_NORM For normal contents IH264HP_SCALINGMATRIX_NOISY For noisy contents IH264HP_SCALINGMATRIX_US User defined scaling matrix provided ERDEFINED...
Page 58
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class dingPreset IH264HP_INTRACODING_DEFAU Default intra coding params. IH264HP_INTRACODING_USERD User defined intra coding params. EFINED Default value. IH264HPVENC_IntraPa These enumerations control Intra4x4 or Intra8x8 modes in I, P, and B slices. rtitionParams IH264HP_INTRA_PARTITION_N Disable Intra4x4 or Intra8x8 modes.
Page 59
Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264HP_SLICEMODE_MBUNIT Slices are controlled based upon IH264HP_SLICEMODE_DEFAULT number of macro blocks. Default slice coding mode is Single Slice per picture. IH264HPVENC_StreamF These enumerations control the type stream format. ormat IH264HP_BYTE_STREAM Bit-stream contains the start code IH264HP_STREAM_FORMAT_DEF identifier.
Page 60
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264HP_TRANSFORM_8x8 Transform blocks size is 8x8 : Valid for IH264HP_TRANSFORM_DEFAULT only High Profile. This is the default setting. IH264HPVENC_GOPStru Type of Group of Pictures (GOP) cture IH264HPVENC_GOPSTRUCTURE_ Open GOP structure: IBBPBBP NONUNIFORM Default IH264HPVENC_GOPSTRUCTURE_...
Page 61
Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264HPVENC_VIDEOFORMAT_N NTSC video format IH264HPVENC_VIDEOFORMAT_S SECAM video format ECAM IH264HPVENC_VIDEOFORMAT_M MAC video format IH264HPVENC_VIDEOFORMAT_U Unspecified video format NSPECIFIED IH264HPVENC_AspectR Enumeration for aspect ratio atioIdc IH264HPVENC_ASPECTRATIO_U Unspecified aspect ratio NSPECIFIED IH264HPVENC_ASPECTRATIO_S 1:1 (square) aspect ratio QUARE IH264HPVENC_ASPECTRATIO_1...
Page 62
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264HPVENC_ASPECTRATIO_1 160:99 aspect ratio 60_99 IH264HPVENC_ASPECTRATIO_4 aspect ratio IH264HPVENC_ASPECTRATIO_3 aspect ratio IH264HPVENC_ASPECTRATIO_2 aspect ratio IH264HPVENC_ASPECTRATIO_E Extended aspect ratio XTENDED IH264HPVENC_ColourP Indicates the chromaticity coordinates of the source primaries. rimaries IH264HP_CP_ITU_R_BT709_5 ITU-R Rec.
Page 63
Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264HP_CP_SMPTE_240M Society of Motion Picture and Television Engineers 240M (1999) (functionally the same as the value 6) IH264HP_CP_GENERIC_FILM Generic film (colour filters using Illuminant C) IH264HPVENC_Transfe Indicates the opto-electronic transfer characteristic of the source picture. rCharacteristics IH264HP_TC_ITU_R_BT709_5 ITU-R Rec.
Page 64
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264HP_TC_ITU_R_BT1361 ITU-R Rec. BT.1361 extended colour gamut system IH264HPVENC_MatrixC Describes the matrix coefficients used in deriving luma and chroma signals oefficients from the green, blue, and red primaries. IH264HP_MC_GBR Typically referred to as RGB;...
Table 4-3 H264 Encoder Constants Constant Name Value Description of Constant IVIDENC2_DEFAULTPROFILE This constant is used when a particular codec doesn't have a profile, or the application doesn't know which profile the codec should use. IVIDENC2_DEFAULTPLEVEL This constant is used when a particular codec doesn't have a level, or the application doesn't know which profile the codec should use.
Page 66
API Reference Group or Symbolic Constant Description or Evaluation Enumeration Class Name IH264HPVENC_PROF Bit 2 - Profile in-complaint transform block size. ILE_INCOMPLAINT_ TRANSFORMBLOCKSI This error is set when IH264HPVENC_Params::transformBlockSize != IH264HP_TRANSFORM_4x4 && IVIDENC2_Params::profile != IH264HP_HIGH_PROFILE. IH264HPVENC_PROF Bit 3 - Profile in-complaint, inter frame interval. ILE_INCOMPLAINT_ INTERFRAMEINTERV This error is set when B frames are used with...
Page 67
Group or Symbolic Constant Description or Evaluation Enumeration Class Name IH264HPVENC_UNSU Bit 20 - Invalid rate control parameters. PPORTED_RATECONT ROLPARAMS This error is set when any parameter of structure IH264HPVENC_RateControlParams is not in allowed range. IH264HPVENC_UNSU Bit 21 - Invalid inter coding parameters. PPORTED_INTERCOD INGPARAMS This error is set when any parameter of structure...
API Reference 4.1.2 Common Multi-Core Data types This section describes Common data types used for Multicore operations. Following data types are described in current selection. IVIDMC_TASK_e IVIDMC_SWBARR_e IVIDMC_SHMEM_KEY_e Group or Enumeration Symbolic Constant Name Value Description or Evaluation Class IVIDMC_TASK_MASTER IVIDMC_TASK_e...
Page 69
Group or Enumeration Symbolic Constant Name Value Description or Evaluation Class IVIDMC_TASK_SLAVE_7 Specific slave task ID 7. IVIDMC_TASK_SLAVE_8 Specific slave task ID 8. IVIDMC_TASK_SLAVE_9 Specific slave task ID 9. IVIDMC_SHMEMKEY_FIRST IVIDMC_SHMEM_KEY_e Shared memory Key value to get shared memory across cores/tasks.
Page 70
API Reference Group or Enumeration Symbolic Constant Name Value Description or Evaluation Class IVIDMC_SHMEM_KEY_8 Shared memory Key ID 8 IVIDMC_SHMEM_KEY_9 Shared memory Key ID 9 IVIDMC_SHMEM_KEY_10 Shared memory Key ID 10 IVIDMC_SHMEM_KEY_11 Shared memory Key ID 11 IVIDMC_SHMEM_KEY_12 Shared memory Key ID 12 IVIDMC_SHMEM_KEY_13 Shared memory Key ID 13 IVIDMC_SHMEM_KEY_14...
Page 71
Group or Enumeration Symbolic Constant Name Value Description or Evaluation Class IVIDMC_SWBARR1 Software barrier ID 1 IVIDMC_SWBARR2 Software barrier ID 2 IVIDMC_SWBARR3 Software barrier ID 3 IVIDMC_SWBARR4 Software barrier ID 4 IVIDMC_SWBARR5 Software barrier ID 5 IVIDMC_SWBARR6 Software barrier ID 6 IVIDMC_SWBARR7 Software barrier ID 7 IVIDMC_SWBARR8...
API Reference 4.2 Data Structures This section describes the XDM defined data structures that are common across codec classes. These XDM data structures can be extended to define any implementation specific parameters for a codec component. 4.2.1 Common XDM Data Structures This section includes the following common XDM data structures: XDM2_SingleBufDesc ...
Page 73
4.2.1.1 XDM2_SingleBufDesc ║ Description This structure defines the buffer descriptor for input and output buffers. ║ Fields Field Data Type Input/ Description Output *buf XDAS_Int8 Input Pointer to the buffer address memType XDAS_Int16 XDM_MemoryType Input Type of memory, See enumeration in Table 4-1 for more details usageMode XDAS_Int16 Input...
Page 74
Output Minimum number of buffer sets for buffer management Note: For H.264 High Profile Encoder, the buffer details are: Number of input buffer required is 3 for YUV 420P chroma format ( memType is XDM_MEMTYPE_RAW ) Number of output buffer required is 1 (Supported memType is ...
Page 75
4.2.1.4 IVIDEO1_BufDescIn ║ Desciption This structure defines the buffer descriptor for inputs video buffers. ║ Fields Field Data Type Input/ Description Output numBufs XDAS_Int32 bufDesc[] Input Number of buffers in frameWidth XDAS_Int32 Input Width of the video frame frameHeight XDAS_Int32 Input Height of the video frame framePitch...
Page 76
API Reference Field Data Type Input/ Description Output EO_MAX_NUM_PLANES] planeDesc tput buffer (height in lines) Valid only if pointer is not NULL. imagePitch[IVIDEO_MAX_NUM_PL XDAS_Int32 Input/Ou Image pitch for each plane ANES] tput imageRegion XDM_Rect Input/Ou Decoded image region including tput padding/encoder input image (top left and bottom right).
Page 77
Field Data Type Input/ Description Output times. This is useful for pull-down (frame/field repetition by display system) support where the display frame rate is increased without increasing the decode frame rate. Default value is 0. Not applicable for encoder reconstructed buffers. Not required for encoder input buffer contentType...
Page 78
API Reference 4.2.1.6 IVIDENC2_Fxns ║ Description This structure contains pointers to all the XDAIS and XDM interface functions. ║ Fields Field Data Type Input/ Description Output ialg IALG_Fxns Input Structure containing pointers to all the XDAIS interface functions. For more details, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360).
Page 79
Field Data Type Input/ Description Output maxWidth XDAS_Int32 Input Maximum video width to be supported in pixels. dataEndianness XDAS_Int32 Input Endianness of output data. See XDM_DataFormat enumeration in Table 4-1 for more details. maxInterFrameInterval XDAS_Int32 Input This is used for setting the maximum number of B frames between two reference frames.
Page 80
API Reference Field Data Type Input/ Description Output numInputDataUnits XDAS_Int32 Input Number of input slices/rows. inputDataMode Units depend on the such as number of slices/rows/blocks, and so on. inputDataMode Ignored if is set to full frame mode. numOutputDataUnits XDAS_Int32 Input Number of output slices/rows.
Page 81
See MaxDPB size value by referring to Table A.1 – Level Limits and make sure currDPBsize <= MaxDPB size currDPBsize (for 4:2:0 format) = (maxWidth * maxHeight)* 1.5*(1 + (maxInterFrameInterval > 1)); 4.2.1.8 IVIDENC2_DynamicParams ║ Description This structure defines the run-time parameters for an algorithm instance object. Set this data structure to NULL , if you are not sure of the values to be specified for these parameters.
Page 82
API Reference Field Data Type Input/ Description Output forceFrame XDAS_Int32 Input Force the current (immediate) frame to be encoded as a specific frame type. See IVIDEO_FrameType enumeration for more details interFrameInter XDAS_Int32 Input Number of B frames between two reference frames;...
Page 83
Field Data Type Input/ Description Output lateAcquireArg XDAS_Int32 Input Argument used during late acquire, For all control() commands other than #XDM_SETLATEACQUIREARG , this field is ignored and can therefore be set by the caller to any value. This is a identifier for a channel in multi channel scenario.
Page 84
API Reference 4.2.1.9 IVIDENC2_Inargs ║ Description This structure defines the run time input arguments for an algorithm instance object. ║ Fields Field Data Type Input/ Description Output size XDAS_Int32 Input Size of the basic or extended (if being used) data structure in bytes.
Page 85
4.2.1.10 IVIDENC2_Status ║ Description This structure defines parameters that describe the status of an algorithm instance object. ║ Fields Field Data Type Input/ Description Output size XDAS_Int32 Input Size of the basic or extended (if being used) data structure in bytes. extendedError XDAS_Int32 Output...
Page 86
API Reference Field Data Type Input/ Description Output operatingMode XDAS_Int32 Output Mode of video coding. IVIDEO_OperatingMode enumeration in Table 4-1 for details profile XDAS_Int32 Output Profile indicator of video encoder. See IH264HPVENC_Profile enumeration for details level XDAS_Int32 Output Level indicator of video encoder. IH264HPVENC_Level enumeration in Table 4-2 for details.
Page 87
Field Data Type Input/ Description Output encDynamicParams IVIDENC2_Dynam Output Dynamic parameters in use by encoder. icParams IVIDENC2_DynamicParams enumeration for more details. In case of extended dynamic parameters, Status algorithm can check the size of DynamicParams and return the parameters accordingly. 4.2.1.11 IVIDENC2_OutArgs ║...
Page 88
API Reference Field Data Type Input/ Description Output A value of zero (0) indicates an invalid ID. The first zero entry in array will indicate end of valid freeBufIDs within the array. Hence, the application can stop searching the array when it encounters the first zero entry.
Page 89
4.2.1.13 XDM_Point ║ Description This structure specifies the two dimensional point. ║ Fields Field Data Type Input/ Description Output XDAS_Int32 Input X field of the frame XDAS_Int32 Input Y field of the frame 4.2.1.14 XDM_Rect ║ Description This structure defines the region in the image that is to be encoded. ║...
API Reference Field Data Type Input/ Description Output scatteredBlocksFlag XDAS_FALSE is set to this field points directly to the start of the first block, and is not treated as a pointer to an array. scatteredBlocksFlag XDAS_TRUE is set to this field points to an array of pointers to data blocks. numBlocks XDAS_Int32 Input/Ou...
Page 91
Field Data Type Input/ Description Output shmmap_sync (*)() Input Pointer to shared memory synchronization. This function will contain programs related to cache coherency operations. Lock (*)() Input Pointer to Critical section lock function UnLock (*)() Input Pointer to Critical section unlock function ncores XDAS_Int32 Input...
API Reference 4.2.3 H.264 High Profile Encoder Data Structures This section includes the following H.264 High Profile Encoder specific extended data structures: IH264HPVENC_Params IH264HPVENC_RateControlParams IH264HPVENC_InterCodingParams IH264HPVENC_IntraCodingParams IH264HPVENC_SliceCodingParams IH264HPVENC_LoopFilterParams IH264HPVENC_DynamicParams IH264HPVENC_Inargs IH264HPVENC_Status ...
Page 93
This structure defines the creation parameters and any other implementation specific parameters for a H.264 High Profile Encoder instance object. The creation parameters are defined in the XDM data structure, IVIDENC2_Params . For the default and supported values Table 4-13.
Page 94
API Reference Field Data Type Input/ Description Output interlaceCoding XDAS_Int32 Input Controls the type of interlaced coding. Type IH264HPVENC_InterlaceCodingType enumeration in Table 4-2 for more details. gopStructure XDAS_Int32 Input Defines the type of GOP structure, uniform and non-uniform. IH264HPVENC_GOPStructure enumeration in Table 4-2 for more details. entropyCodingMo XDAS_Int32 Input...
Page 95
Note: User can control the IH264HPVENC_Params when the encodingPreset field of IVIDENC2 _ Params data structure is equal to XDM_USER_DEFINED When the encodingPreset field of IVIDENC2 _ Params data structure is equal to XDM_HIGH_QUALITY (or) XDM_HIGH_SPEED (or) XDM_DEFAULT, the following parameters are chosen by codec, and user doesn’t have any control over these parameters 1.interCodingParams 2.intraCodingParams...
Page 96
API Reference 4.2.3.2 IH264HPVENC_RateControlParams ║ Description This structure controls rate control behavior. For the default and supported values, see Table 4-7. ║ Fields Field Data Type Input/ Description Output rateControlPa XDAS_Int32 USER_DEFINED Input This preset controls the versus ramsPreset DEFAULT mode.
Page 97
Field Data Type Input/ Description Output qpOffsetB XDAS_Int32 Input Offset of B frames Quantization Parameter from P frames. qpP + qpOffsetB should be in range of [0,51] qpMaxB XDAS_Int32 Input Maximum quantization parameter for B frame(s). Range is 0 to 51. qpMinB XDAS_Int32 Input...
Page 98
API Reference IVIDENC2_Params::rateControlPreset is equal to IVIDEO_STORAGE and IVIDENC2_Params::encodingPreset is equal to IVIDEO_USER_DEFINED and rateControlParamsPreset is equal to “1” In VBR rate control algorithm, with a scene change the frame having scene change will follow qpMaxI and qpMinI irrespective of frame type The following parameters are ignored during run-time: rcAlgo ...
IVIDEO_USER_DEFINED otherwise values are set by the codec. 4.2.3.4 IH264HPVENC_IntraCodingParams ║ Description This structure defines all the operations on H.264 High Profile Encoder instance objects. For the default and supported values, see Table 4-9. ║ Fields Field Data Type Input/...
Page 100
API Reference 4.2.3.5 IH264HPVENC_SliceCodingParams ║ Description This structure contains all the parameters which controls slice encoding. For the default and supported values, see Table 4-10. ║ Fields Field Data Type Input/ Description Output sliceCodingPr XDAS_Int32 Input This preset controls the user defined versus eset default mode.
Page 101
4.2.3.6 IH264HPVENC_LoopFilterParams ║ Description This structure contains all the parameters, which controls loop filtering operations. For the default and supported values, see Table 4-11. ║ Fields Field Data Type Input/ Description Output loopfilterPre XDAS_Int32 Input This preset controls the user defined versus default mode.
Page 102
This structure defines the run-time parameters and any other implementation specific parameters for a H.264 High Profile Encoder instance object. The run-time parameters are defined in the XDM data structure, IVIDENC2_DynamicParams . For the default and supported values, see Table 4-14.
Page 103
4.2.3.9 IH264HPVENC_Status ║ Description This structure defines parameters that describe the status of the H.264 High Profile Encoder and any other implementation specific parameters. The status parameters are defined in the XDM data structure, IVIDENC2_Status . ║ Fields...
Page 104
API Reference Field Data Type Input/ Description Output loopFilterPara IH264HPVENC_Loo IH264HPVENC_LoopFilterParams Output pFilterParams data structure for details. vuiCodingParam IH264HPVENC_VUI IH264HPVENC_VUICodingParams Output CodingParams data structure for details. IDRFrameInterv XDAS_Int32 Output Interval betweenw two IDR frames, it should be and integer multiple of intraFrameInterval interlaceCodin XDAS_Int32...
Page 105
4.2.3.10 IH264HPVENC_OutArgs ║ Description This structure defines the run-time output parameters for the H.264 High Profile Encoder instance object. ║ Fields Field Data Type Input/ Description Output videnc2OutArg IVIDENC2_OutArg IVIDENC2_OutArgs Output data structure for details. 4.2.3.11 IH264HPVENC_Fxns ║ Description This structure defines all the operations on H.264 High Profile Encoder instance objects.
Page 106
API Reference Field Data Type Input/ Description Output aspectRatioIdc XDAS_Int32 aspectRatioIdc Input Encoder inserts as it is in the bit-stream. It is user's responsibility to input appropriate value. See Table E-1 of H264 standard or enum IH264HPVENC_AspectRatioIdc for valid values. aspectRatioIdc == When IH264HPVENC_ASPECTRATIO_EXTENDED(...
Page 107
Field Data Type Input/ Description Output colourPrimaries XDAS_Int32 Input This controls the colour primaries type in VUI part of bit-stream. It is user's responsibility to provide appropriate value of this. See Table E-3 H264 standard or enum IH264HPVENC_ColourPrimaries for valid values.
API Reference 4.3 Default and Supported Values of Parameters This section provides the default and supported values for the following data structures: IVIDENC2_Params IVIDENC2_DynamicParams IH264HPVENC_RateControlParams IH264HPVENC_InterCodingParams IH264HPVENC_IntraCodingParams IH264HPVENC_SliceCodingParams IH264HPVENC_LoopFilterParams IH264HPVENC_FMOCodingParams IH264HPVENC_VUICodingParams IH264HPVENC_Params ...
Page 109
Field Default Value Supported Value See Table A.1 – Level Limits in ISO/IEC 14496-10 maxBitRate for the supported values. minBitRate Any Value, See Notes as part of section 4.2.1.7 inputChromaFormat XDM_YUV_420P XDM_YUV_420P inputContentType IVIDEO_PROGRESSIV IVIDEO_PROGRESSIVE IVIDEO_INTERLACED operatingMode IVIDEO_ENCODE_ONL IVIDEO_ENCODE_ONLY profile IH264HP_HIGH_PROF...
API Reference Table 4-6 Default and Supported Values for IVIDENC2_DynamicParams Field Default Value Supported Value size sizeof(IH264HPVEN sizeof(IH264HPVENC_DynamicParams) C_DynamicParams) inputHeight 1088 [64, 4096] Should be <= maxHeight inputWidth 1920 [64, 4096] Should be <= maxWidth refFrameRate 30000 Ignore targetFrameRate 30000 >=1000 (Valid Values as per Level Limit) Target frame rate in fps * 1000.
API Reference Field Default Value Supported Value initialBufferLevel Any value between –(2^31 -10^8) to (2^31 -10^8) Equal to HRDBufferSize HRDBufferSize 2*targetBitRate for VBR Any value which is level compliant Rate Control ½*targetBitRate for CBR RateControl enablePRC [0, 1] frameSkipAfterScen [0, 1] eChange scalingMatrixPrese IH264HP_SCALINGMA...
Field Default Value Supported Value IH264HP_INTRA_PARTITION_IBSLICES IH264HP_INTRA_PARTITION_IPBSLICE IH264HP_INTRA_PARTITION_DEFAULT intraRefreshMethod IH264HP_INTRAREF IH264HP_INTRAREFRESH_NONE RESH_DEFAULT IH264HP_INTRAREFRESH_DEFAULT IH264HP_INTRAREFRESH_CYCLIC_MBS intraRefreshRate intraRefreshMethod != >=0, effective only IH264HP_INTRAREFRESH_NONE constrainedIntraPred Enable [0, 1] Table 4-10 Default and Supported Values for IH264HPVENC_SliceCodingParams Field Default Value Supported Value sliceCodingPreset...
API Reference Table 4-11 Default and Supported Values for IH264HPVENC_LoopFilterParams Field Default Value Supported Value loopfilterPreset IH264HP_LOOPFIL IH264HP_LOOPFILTER_DEFAULT TER_DEFAULT IH264HP_LOOPFILTER_USERDEFINED loopfilterDisableIDC IH264HP_DISABLE IH264HP_DISABLE_FILTER_NONE _FILTER_DEFAULT IH264HP_DISABLE_FILTER_DEFAULT IH264HP_DISABLE_FILTER_ALL_EDGES IH264HP_DISABLE_FILTER_SLICE_EDG filterOffsetA [-12, 12] even value filterOffsetB [-12, 12] even value Table 4-12 Default and Supported Values for IH264HPVENC_VUICodingParams Field Default Value...
Page 116
API Reference Field Default Value Supported Value IH264HPVENC_InterCodingParams intraCodingParams See Table 4-9 Default and Supported Values for IH264HPVENC_IntraCodingParams sliceCodingParams See Table 4-10 Default and Supported Values for IH264HPVENC_SliceCodingParams loopFilterParams See Table 4-11 Default and Supported Values for IH264HPVENC_LoopFilterParams vuiCodingParams Table 4-12 Default and Supported Values for IH264HPVENC_VUICodingParams interlaceCodingType IH264HP_INTERLA...
Page 117
Table 4-14 Default and Supported Values for IH264HPVENC_DynamicParams Field Default Value Supported Value videnc2DynamicParams See Table 4-6 Default and Supported Values for IVIDENC2_DynamicParams rateControlParams See Table 4-7 Default and Supported Values for IH264HPVENC_RateControlParams interCodingParams See Table 4-8 Default and Supported Values for IH264HPVENC_InterCodingParams intraCodingParams See Table 4-9 Default and Supported Values for...
API Reference 4.4 Interface Functions This section describes the Application Programming Interfaces (APIs) used in the H.264 High Profile Encoder. The APIs are logically grouped into the following categories: Creation – algNumAlloc() , algAlloc() Initialization – algInit() Control – control() ...
4.4.1 Creation APIs Creation APIs are used to create an instance of the component. The term creation could mean allocating system resources, typically memory. ║ Name – determine the number of buffers that an algorithm requires algNumAlloc() ║ Synopsis XDAS_Int32 algNumAlloc(Void); ║...
Page 120
API Reference ║ Name – determine the attributes of all buffers that an algorithm requires algAlloc() ║ Synopsis XDAS_Int32 algAlloc(const IALG_Params *params, IALG_Fxns **parentFxns, IALG_MemRec memTab[]); ║ Arguments IALG_Params *params; /* algorithm specific attributes */ IALG_Fxns **parentFxns;/* output parent algorithm functions */ IALG_MemRec memTab[];...
4.4.2 Initialization API Initialization API is used to initialize an instance of the algorithm. The initialization parameters are defined in the IVIDENC2_Params structure (see section 4.2 for details). ║ Name – initialize an algorithm instance algInit() ║ Synopsis XDAS_Int32 algInit(IALG_Handle handle, IALG_MemRec memTab[], IALG_Handle parent, IALG_Params *params);...
Page 122
API Reference Since there is no mechanism to return extended error code for unsupported parameters, this version of encoder returns IALG_EOK even if some parameter unsupported is set. But subsequence control/process call it returns the detailed error code ║ See Also algAlloc(), algMoved() 4-78...
4.4.3 Control API Control API is used for controlling the functioning of the algorithm instance during run-time. This is done by changing the status of the controllable parameters of the algorithm during run-time. These controllable parameters are defined in the Status data structure (see section 4.2 for details). ║...
API Reference of the extended data structure. Depending on the value set for the size field, the algorithm uses either basic or extended parameters. ║ Preconditions The following conditions must be true prior to calling this function; otherwise, its operation is undefined.
Page 125
║ Arguments IALG_Handle handle; /* algorithm instance handle */ ║ Return Value Void ║ Description initializes any of the instance’s scratch buffers using the persistent memory that is algActivate() part of the algorithm’s instance object. The first (and only) argument to algActivate() is an algorithm instance handle. This handle is used by the algorithm to identify various buffers that must be initialized prior to calling any of the algorithm’s processing methods.
Page 127
If algorithm uses DMA resources, process() can only be called after a successful return from DMAN3_init(). must be a valid handle for the algorithm’s instance object. handle Buffer descriptor for input and output buffers must be valid. ...
Page 128
API Reference update the appropriate accessMask fields. The application may utilize these returned values to manage cache. The buffers in inBufs are owned by the calling application. ║ Example See test application file, TestAppEncoder.c available in the \Client\Test\Src sub-directory. ║...
Page 129
║ Name – save all persistent data to non-scratch memory algDeactivate() ║ Synopsis Void algDeactivate(IALG_Handle handle); ║ Arguments IALG_Handle handle; /* algorithm instance handle */ ║ Return Value Void ║ Description algDeactivate() saves any persistent information to non-scratch buffers using the persistent memory that is part of the algorithm’s instance object.
API Reference 4.4.5 Termination API Termination API is used to terminate the algorithm instance and free up the memory space that it uses. ║ Name – determine the addresses of all memory buffers used by the algorithm algFree() ║ Synopsis XDAS_Int32 algFree(IALG_Handle handle, IALG_MemRec memTab[]);...
Chapter 5 Frequently Asked Questions This chapter provides answers to few frequently asked questions related to using this encoder. 5.1 Code Build and Execution Question Answer Application returns an error Ensure that input YUV file path provided is correct in encoder configuration saying “Unable to open file.
Page 132
Frequently Asked Questions Question Answer Why the output appears frozen This may happen when encoding is at very low bit-rate and many intra in video conferencing system? macro blocks are being inserted, consuming more bits leading to skip frames. Hence, the output appears frozen. Can I change bit-rate, frame rate, resolution at run time Does Encoder support check for...
Page 133
Question Answer Can frac-pel refinement of motion vectors be disabled? Can the encoder give multiple Motion vector for a macro block? rateControlPreset rateControlPreset What is control the rate control algorithm IH264HPVENC_RateControlParams ::rcAlgo ) but rateControlParamsPreset rateControlParamsPreset controls the other associated parameters .
Page 134
Frequently Asked Questions This page is intentionally left blank...
Appendix A Debug Trace Support This appendix explains the Debug Trace support details on encoder. This is to help the application to get the trace data generated by Encoder from external memory Debug Trace design in Encoder Encoder has “ debugTraceLevel ” interface to select the debug trace level. When “...
Page 136
Debug Trace Support 5) Dump the trace memory into a bin file and feed to the Debug trace parser utility in the windows PC. Debug trace parser is provided as utility along with codec release packages. 6) Debug trace parser accepts the bin file and places log information to a text file in readable format.
Appendix B Call Back function for NAL Units Call back function provides compressed bit-streams to the application at NAL unit level. It is to avoid point-to-point delay in the packed based transmission scenarios. H.264 allows dividing the bit-stream of a frame in multiple NAL units (SPS, PPS, and slices). These NAL units can be decoded independently.
Page 138
Call Back function for NAL Units Figure 5-2 Overview of copying User application defined call back function can be registered with the encoder. A run time arameter, pfNalUnitCallBack is provided as part of dynamic parameter, which can be either set to NULL or to address of the call back function.
Page 139
void H264BP_outputNalUnit( unsigned int *pNalu, unsigned int *pPacketSizeInBytes int currPacketPtr = (int)ph264PacketBitStream; int maxPacketPtr = (int)ph264PacketBitStream + sizeof(h264TotalPacketBitStream); memcpy( ph264PacketBitStream, pNalu, *pPacketSizeInBytes ); ph264PacketBitStream += *pPacketSizeInBytes; #if DEBUG if ( currPacketPtr > maxPacketPtr ) printf("bitstream too large: %i bytes\n", *pPacketSizeInBytes); #endif 2) In dynamic parameters, set the call back function pointer.
Need help?
Do you have a question about the H.264 High Profile Encoder and is the answer not in the manual?
Questions and answers