Stereo audio dac with usb interface, single-ended headphone output and s/pdif output (43 pages)
Summary of Contents for Texas Instruments DM365
Page 1
H.264 Base/Main/High Profile Encoder on DM365/DM368 User’s Guide Literature Number: SPRUEU9C August 2010...
Page 2
TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions Products...
Preface Read This First About This Manual This document describes how to install and work with Texas Instruments’ (TI) H.264 Base/Main/High Profile Encoder implementation on the DM365/DM368 platform. It also provides a detailed Application Programming Interface (API) reference and information on the sample application that accompanies this component.
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 (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.
Page 5
Read This First Abbreviation Description BIOS TI’s simple RTOS for DSPs CAVLC Context Adaptive Variable Length Coding CABAC Context Adaptive Binary Arithmetic Coding 720x480 or 720x576 resolutions in progressive scan Discrete Cosine Transform Double Data Rate Direct Memory Access Framework components Flexible Macro-block Ordering HD 720 or 720p 1280x720 resolution in progressive scan...
Product Support When contacting TI for support on this codec, quote the product name (H.264 Base/Main/High Profile Encoder on DM365/DM368) and version number. The version number of the codec is included in the Title of the Release Notes that accompanies this codec.
Contents 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 ......................iv Text Conventions ......................vi Product Support ......................vi Trademarks ......................... vi Contents..........................
Page 8
3.3 Cache Management by Application..............3-9 3.3.1 Cache Usage By Codec Algorithm ..............3-9 3.3.2 Cache and Memory Related Call Back Functions for Linux ......3-9 3.4 Sample Test Application..................3-11 API Reference........................4-1 4.1 Symbolic Constants and Enumerated Data Types..........4-2 4.1.1 Common XDM Symbolic Constants and Enumerated Data Types ....4-2 4.1.2 H264 Encoder Symbolic Constants and Enumerated Data Types ....4-7 4.1.3...
Tables Table 1-1. List of Abbreviations..................iv Table 2-2. Component Directories for Linux..............2-3 Table 3-1. process () Implementation................3-11 Table 4-1. List of Enumerated Data Types..............4-2...
Chapter 1 Introduction This chapter provides a brief introduction to XDAIS, XDM, and DM365 software architecture. It also provides an overview of TI’s implementation of the H.264 Base/Main/High Profile Encoder on the DM365/DM368 platform and its supported features. Topic Page 1.1 Software Architecture...
Introduction 1.1 Software Architecture DM365/DM368 codec provides XDM compliant API to the application for easy integration and management. The details of the interface are provided in the subsequent sections. DM365/DM368 is a digital multi-media system on-chip primarily used for video security, video conferencing, PMP and other related application.
API, the control is returned to the calling application only after encode or decode of one unit (frame) is completed. Since in case of DM365/DM368, the main encode or decode is carried out by the hardware accelerators, the host processor...
Introduction from which the call is made can be used by the application in process() parallel with the encode or the decode operation. To enable this, the framework provides flexibility to the application to pend the encoder task when the frame level computation is happening on coprocessor. Apart from defining standardized APIs for multimedia codecs, XDM also standardizes the generic parameters that the client application must pass to these APIs.
Introduction rman memutils EDMA3 hdvicpsync vicpsync vicp ires FCtools Figure 1-2. Framework Component Interfacing Structure. Each component is explained in detail in the following sections. 1.2.3.1 IRES and RMAN 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.
Components for C64x+ (literature number SPRAAI5). Figure 1-3. IRES Interface Definition and Function-calling Sequence. In DM365/DM368, FC manages multiple resources for smooth interaction with other algorithms and application. The resources and the utilities provided by FC are listed in this section.
1.2.3.7 ARM TCM resource manager provides access to request ARM926 TCM memory. ARM926 in DM365/DM368 has 32K TCM, which can be allocated to codec/algorithm on request. The allocation is in granularity of 1/2K blocks, which can be used as scratch memory by the codec/algorithm.
Page 20
Introduction Some important H.264 profiles and their special features are (These are feature as defined by H.264 standard, few of them may not be part of DM365/DM368 H.264 implementation): Baseline Profile: Only I and P type slices are present Only frame mode (progressive) picture types are present...
Introduction 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.
Can be configured to provide output at NAL granularity or after entire frame is encoded. Supports encoded output in NAL stream or Bytes stream format DM365/DM368 H.264 encoder can be configured in two modes: Platinum mode, which gives 1080P@30fps performance in DM368 – 432 Mhz device Version 1.1 backward compatible mode which gives performance of...
Version 2.0 - Platinum Resolution Min – 128 x 96 Min – 320 x 128 Max – 2k x 2k Max – Current (2k x 2k) Performance 720P@30fps on DM365/DM368 1080P@30fps on DM368 EDMA channels Support for Ver 1.1 – Gen1 1-11...
Page 24
Introduction This page is intentionally left blank 1-12...
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 for Linux 2.2 Installing the Component for Linux 2.3 Building and Running the Sample Test Application on Linux 2.4 Configuration Files...
Release Note 2.1.1 Hardware DM365/DM368 EVM (Set the bits 2 and 3 of switch SW4 to low(0) position and Set the bits 4 and 5 of switch SW5 to high(1) position) RS232 cable and network cable 2.1.2 Software...
Installation Overview Figure 2-5. Component Directory Structure for Linux. Table 2-2 provides a description of the sub-directories created in the dm365_h264enc_xx_xx_xx_xx_production directory. Table 2-2. Component Directories for Linux. Sub-Directory Description \package Contains files related while building the package \packages\ti\sdo\codecs\h264enc\lib Contains the codec library files on host \packages\ti\sdo\codecs\h264enc\docs Contains user guide, datasheet, and release notes \packages\ti\sdo\codecs\h264enc\apps\clie...
Installation Overview Sub-Directory Description \packages\ti\sdo\codecs\h264enc\apps\clie Contains input test vectors nt\test\testvecs\input \packages\ti\sdo\codecs\h264enc\apps\clie Contains output generated by the codec nt\test\testvecs\output \packages\ti\sdo\codecs\h264enc\apps\clie Contains read-only reference output to be used for verifying nt\test\testvecs\reference against codec output \packages\ti\sdo\codecs\h264enc\apps\clie Contains configuration parameter files nt\test\testvecs\config 2.3 Building and Running the Sample Test Application on Linux To build the sample test application in linux environment, follow these steps 1) Verify that dma library h264v_ti_dma_dm365.a exists in the...
Installation Overview 2.4.1 Generic Configuration File The sample test application shipped along with the codec uses the configuration file, Testvecs.cfg for determining the input and reference files for running the codec and checking for compliance. The testvecs.cfg file is available in the \packages\ti\sdo\codecs\h264enc\apps\client\test\testvecs\config sub- directory.
Installation Overview A sample testvecs.cfg file is as shown: For output dump mode: ..\..\..\test\testvecs\config\testparams.cfg ..\..\..\test\testvecs\input\input.yuv ..\..\..\test\testvecs\output\output.264 ..\..\..\test\testvecs\output\recon.yuv For reference bit-stream compliance test mode: ..\..\..\test\testvecs\config\testparams.cfg ..\..\..\test\testvecs\input\input.yuv ..\..\..\test\testvecs\reference\reference.264 ..\..\..\test\testvecs\output\recon.yuv 2.4.2 Encoder Configuration File The encoder configuration file, testparams.cfg contains the configuration parameters required for the encoder. The testparams.cfg file is available in the \client\test\testvecs\config sub-directory.
Page 31
Installation Overview LevelIDC = 30 # Level IDC (e.g. 20 = level 2.0) IntraPeriod = 30 # Period of I-Frames IDRFramePeriod # Period of IDR Frames FramesToEncode = 10 # Number of frames to be coded SliceSize # Size of each slice EnMeMultiPart # 1 =>...
Installation Overview 1=No Filter, 2 = Disable across Slice Boundaries To check the functionality of the codec for the inputs other than those provided with the release, change the configuration file accordingly, and follow the steps as described in Section 2.2. 2.4.3 Encoder Sample Base Param Setting The encoder can be run in base class setting.
Installation Overview 2) Copy the reference files to the \client\test\testvecs\reference sub- directory. 3) Edit the configuration file, Testvecs.cfg available in the \client\test\testvecs\config sub-directory. For details on the format of the testvecs.cfg file, see section 2.4. For each encoded frame, the application displays the message indicating the frame number.
Page 34
Installation Overview This page is intentionally left blank 2-10...
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 Handshaking Between Application and Algorithm 3.3 Cache Management by Application 3.4 Sample Test Application 3-11...
Sample Usage 3.1 Overview of the Test Application The test application exercises the base class of the H.264 IVIDENC1 Encoder library. The main test application files are h264encoderapp.c and h264encoderapp.h. These files are available in the \client\test\src and \client\test\inc sub-directories respectively. Figure 3-1 depicts the sequence of APIs exercised in the sample test application.
Sample Usage The test application is divided into four logical blocks: Parameter setup Algorithm instance creation and initialization Process call Algorithm instance deletion 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.
Sample Usage Note: DMAN3 function and IDMA3 interface is not implemented in DM365/DM368 codecs. Instead, it uses a DMA resource header file, which gives the framework the flexibility to change DMA resource to codec. 3.1.3 Process Call After algorithm instance creation and initialization, the test application does...
Sample Usage Note: The process call returns control to the application after the initial setup related tasks are completed. Application can schedule a different task to use the Host resource released free. All service requests from HDVICP are handled through interrupts. Application resumes the suspended process call after handling the last service request for HDVICP.
Sample Usage 3.2 Handshaking Between Application and Algorithm 3.2.1 Resource Level Interaction Following diagram explains the resource level interaction of the application with framework component and codecs. Application uses XDM for interacting with codecs. Similarly, it uses RMAN to grant resources to the codec.
Sample Usage 3.2.2 Handshaking Between Application and Algorithms Application provides the algorithm with its implementation of functions for the video task to move to SEM-pend state, when the execution happens in the co-processor. The algorithm calls these application functions to move the video task to SEM-pend state.
Sample Usage This function of FC implements a semaphore which goes into pend state and then the OS switches the task to another non-codec task. Interrupts from HDVICP to Host ARM926 is used to inform when the frame processing is done. HDVICP sends interrupt which maps to of ARM926 INTC.
3.3.1 Cache Usage By Codec Algorithm The codec source code and data, which runs on Host ARM926 can be placed in DDR. The host of DM365/DM368 has MMU and cache that the application can enable for better performance. Since the codec also uses DMA, there can be inherent cache coherency problems when application turns on the cache.
Page 44
Sample Usage 3.3.2.1 cacheInvalidate In cache invalidation process, the entries of the cache are deleted. This API invalidates a range of cache. Void MEMUTILS_cacheInv (Ptr addr, Int sizeInBytes) 3.3.2.2 cacheWb This API writes back cache to the cache source when it is necessary. Void MEMUTILS_cacheWb (Ptr addr, Int sizeInBytes)
Sample Usage 3.4 Sample Test Application The test application exercises the base class of the H.264 IVIDENC1 Encoder. Table 3-1. process () Implementation /* Main Function acting as a client for Video encode Call*/ /* Acquiring and intializing the resources needed to run the encoder */ iresStatus = (IRES_Status) RMAN_init();...
Page 46
Sample Usage /*----------------------------------------------------*/ iErrorFlag = H264VENC_encode ( handle, // Instance Handle - Input &inobj, // Input Buffers - Input &outobj, // Output Buffers - Output &inargs, // Input Parameters - Input &outargs // Output Parameters - Output /* Get the statatus of the Encoder using control */ H264VENC_control( handle, // Instance Handle...
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-22 4.3 H.264 Encoder ROI specific Data Structures and Enumerations 4-50 4.4 H264 Encoder Two Pass Encoder data structure 4-53...
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 Symbolic Constants and Enumerated Data Types Table 4-1.
Page 49
API Reference Group or Enumeration Class Symbolic Constant Name Description or Evaluation IVIDEO_BB_FRAME Interlaced frame, both fields are B frames. Not supported in this version of H.264 Encoder. IVIDEO_MBAFF_I_FRAME Intra coded MBAFF frame. Not supported in this version of H.264 Encoder. IVIDEO_MBAFF_P_FRAME Forward inter coded MBAFF frame.
Page 50
API Reference Group or Enumeration Class Symbolic Constant Name Description or Evaluation IVIDEO_SkipMode IVIDEO_FRAME_ENCODED Input content encoded Input content skipped, that is, not IVIDEO_FRAME_SKIPPED encoded Default value is set to IVIDEO_SKIPMODE_DEFAULT IVIDEO_FRAME_ENCODE Big endian stream. XDM_DataFormat XDM_BYTE This is the default value. XDM_LE_16 16-bit little endian stream.
Page 51
API Reference Group or Enumeration Class Symbolic Constant Name Description or Evaluation XDM_YUV_420SP YUV 420 semiplanar (Luma 1st plane, * CbCr interleaved 2nd plane) Alpha plane XDM_ARGB8888 Not supported in this version of H.264 Encoder RGB 555 color format XDM_RGB555 Not supported in this version of H.264 Encoder XDM_RGB565...
Page 52
API Reference Group or Enumeration Class Symbolic Constant Name Description or Evaluation XDM_HIGH_SPEED Set algorithm specific creation time parameters for high speed. XDM_USER_DEFINED User defined configuration using advanced parameters. Encode entire access unit. This is XDM_EncMode XDM_ENCODE_AU the default value. XDM_GENERATE_HEADER Encode only header.
API Reference Bit 0-7: Codec and implementation specific The algorithm can set multiple bits to 1 depending on the error condition. 4.1.2 H264 Encoder Symbolic Constants and Enumerated Data Types Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_Level IH264VENC_LEVEL_10 Level 1.0 identifier for H.264 Encoder...
Page 54
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_STATUS IH264VENC_ERR_MAXWIDTH maxWidth not supported. “Fatal input error” is returned in algInit instance creation stage if maxWidth in the input params exceeds H264VENC_TI_MAX_WIDTH (2048) or is less than H264VENC_TI_MIN_WIDTH H264VENC_TI_MIN_WIDTH takes value of...
Page 55
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_MAXBITRA maxBitRate not supported fatal input error is returned during algInit if maxBitRate exceed max supported value of 50000000 or is less than 0. IH264VENC_ERR_DATAENDI dataEndianness not supported fatal ANNESS input error is returned during algInit if dataEndianness is not set to...
Page 56
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_INPUTHEI inputHeight not supported fatal input error is returned in videncStatus.extendedError during XDM_SETPARAMS control call if the inputHeight in input dynamic params exceeds maxHeight or if inputHeight is less than H264VENC_TI_MIN_HEIGHT or not multiple of 2 for progressive content and not multiple of 4 for interlaced...
Page 57
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_LEVELIDC levelIdc not supported fatal input error is returned during g algInit if levelIdc is not as per IH264VENC_Level range IH264VENC_LEVEL_1b(9) to IH264VENC_LEVEL_50(50) IH264VENC_ERR_ENTROPYM entropyMode not supported, a fatal ODE_IN_BP input error is returned during algInit if entropyMode is 1 (CABAC) for...
Page 58
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_TIMESCAL timeScale not supported fatal input error is returned during algInit if timeScale is less than 0 or if timeScale * 1000 exceeds targetFrameRate. IH264VENC_ERR_NUMUNITS numUnitsInTicks not supported INTICKS fatal input error is returned during algInit if numUnitsInTicks is...
Page 59
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_SLICEFOR sliceFormat not supported fatal input error is returned during algInit if sliceFormat is not 0 or 1. IH264VENC_ERR_LEVEL_NO This fatal error is returned in T_FOUND videncStatus.extendedError during XDM_SETPARAMS control call if inputWidth, inputHeight, targetBitRate and...
Page 60
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_INTRAFRA This fatal error is returned in videncStatus.extendedError MEQP during XDM_SETPARAMS control call if intraFrameQP is less than 0 or more than 51. Control call returns IVIDENC1_EFAIL. IH264VENC_ERR_INTERPFR This fatal error is returned in videncStatus.extendedError AMEQP...
Page 61
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_LFDISABL This fatal error is returned in videncStatus.extendedError EIDC during XDM_SETPARAMS control call if lfDisableIdc is less than 0 or more than 2. Control call returns IVIDENC1_EFAIL. IH264VENC_ERR_ENABLEBU This fatal error is returned in videncStatus.extendedError FSEI...
Page 62
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_PERCEPTU This fatal error is returned in videncStatus.extendedError ALRC during XDM_SETPARAMS control call if perceptualRC is not 0 or 1. Control call returns IVIDENC1_EFAIL. This fatal error is returned in IH264VENC_ERR_IDRFRAME videncStatus.extendedError INTERVAL...
Page 63
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_IVIDENC1 This fatal error is returned in videncStatus.extendedError _DYNAMICPARAMS_SIZE_IN during a control call if dynamic param _CORRECT size is not IVIDENC1_DynamicParams or IH264VENC_DynamicParams. Control call returns IVIDENC1_EFAIL. This fatal error is returned in process IH264VENC_ERR_IVIDENC1 call if any of input handle or inBufs or _PRO CESS_ARGS_NULL...
Page 64
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_IVIDENC1 This fatal error is returned in outArgs->extendedError if buffer _INBUFS_BUFDESC descriptors in inBufs are either NULL or if their sizes are less than the frame size. Process call returns IVIDENC1_EFAIL.
Page 65
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_HANDLE_N This fatal error is returned when input handle is NULL. If the handle is NULL in algFree or algInit call this error is returned to call function. If the handle is NULL in a control call this error is returned in sStatus- >videncStatus.extendedError...
Page 66
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_MEMTABS_ This fatal error is returned when attrs of memTabs passed to ATTRS algInit are not as per the requested attrs specified in algAlloc. This fatal error is returned when IH264VENC_ERR_MEMTABS_ space of memTabs passed to SPACE...
Page 67
API Reference Group or Enumeration Symbolic Constant Name Description or Evaluation Class IH264VENC_ERR_STATUS_B This warning is returned in videncStatus.extendedError during XDM_GETVERSION control call if videncStatus.data.buf is NULL or if videncStatus.data.bufSize is insufficient to copy the library version string. The control call returns IVIDENC1_EFAIL.
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: XDM_BufDesc XDM1_BufDesc...
Page 69
API Reference 4.2.1.1 XDM_BufDesc Description ║ This structure defines the buffer descriptor for input and output buffers. Fields ║ Field Data type Input/ Description Output **bufs XDAS_Int8 Input Pointer to the vector containing buffer addresses Input Number of buffers numBufs XDAS_Int32 *bufSizes XDAS_Int32...
Page 70
API Reference capture width is same as input width. For details on capture width, see Section 4.2.1.10. For interlaced sequence, encoder ignores the input field buffers if they are stored in interleaved or non-interleaved format. But, it expects the start pointer of top or bottom field be given to it during the process call of the top or bottom fields, respectively.
Page 71
API Reference 4.2.1.5 XDM1_SingleBufDesc Description ║ This structure defines the single buffer descriptor for input and output buffers in XDM 1.0 IVIDENC1. Fields ║ Field Data type Input/ Description Output Input Pointer to a buffer address *buf XDAS_Int8 Input Size of buffer in bytes bufSize XDAS_Int32 accessMask...
Page 72
API Reference 4.2.1.7 IVIDEO1_BufDescIn Description ║ This structure defines the buffer descriptor for input video buffers. Fields ║ Field Data type Input/ Description Output numBufs XDAS_Int32 Input Number of buffers in bufDesc[] Input Width of the video frame. frameWidth XDAS_Int32 Note: It will be same as inputWidth width multiple of 16.
Page 73
API Reference Field Data type Input/ Description Output For more details, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360). Input Pointer to the function. *process XDAS_Int32 process() *control XDAS_Int32 Input Pointer to the function. control() 4.2.1.9 IVIDENC1_Params Description ║...
Page 74
API Reference Field Data type Input/ Description Output Input Endianness of input data. See dataEndianness XDAS_Int32 enumeration for details. XDM_DataFormat Default value = XDM_BYTE Input Distance from I-frame to P-frame: maxInterFrameInterv XDAS_Int32 1 - If no B-frames 2 - To insert one B-frame This parameter is not supported as B-frames are not supported.
Page 75
API Reference For example, consider you have to check if the following values are supported for level 2.0: = 480 maxHeight = 720 maxWidth The supported value for level 2.0 as per Table A.1 maxFrameSizeinMbs – Level Limits is 396. Compute the expression as: maxFrameSizeinMbs >= (480*720) / 256 The value of...
Page 76
API Reference 4.2.1.10 IVIDENC1_DynamicParams Description ║ This structure defines the run-time parameters for an algorithm instance object. Set this data structure to if you are not sure of the values to NULL, be specified for these parameters. Fields ║ Field Data type Input/ Description...
Page 77
API Reference Field Data type Input/ Description Output Input Width of input frame in pixels. Input width can be inputWidth XDAS_Int32 changed before the start of encoding within the limits of maximum width set in creation phase. must be multiples of two. inputWidth Minimum width supported by encoder is 320.
Page 78
API Reference Field Data type Input/ Description Output Input Capture width parameter enables the application captureWidth XDAS_Int32 to provide input buffers with different line width (pitch) alignment than input width. For progressive content, if the parameter is set 0 - Encoded input width is used as pitch. >= encoded input width - capture width is used as pitch.
Page 79
24 frames of data per sec. DM365/DM368 implementation of refFrameRate : This feature is not supported in targetFrameRate DM365/DM368. Hence, we make refFrameRate = . For example: targetFrameRate Capturing at 15 fps and required bitrate is 768kbps, set...
Page 80
API Reference 4.2.1.11 IVIDENC1_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. Input Identifier to attach with the corresponding inputID...
Page 81
API Reference 4.2.1.12 IVIDENC1_Status Description ║ This structure defines parameters that describe the status of an algorithm instance object. Fields ║ Field Data type Input/ Description Output Input Size of the basic or extended (if being used) size XDAS_Int32 data structure in bytes. extendedError XDAS_Int32 Output...
Page 82
API Reference Field Data type Input/ Description Output Output Output ID corresponding to the encoder buffer. outputID XDAS_Int32 This can also be used to free the corresponding image buffer for further use by the client application code. In this encoder, is set to outputID IVIDENC1_InArgs::inputID...
API Reference 4.2.2 H.264 Encoder Data Structures This section includes the following H.264 Encoder specific extended data structures: IH264VENC_Params IH264VENC_DynamicParams IH264VENC_InArgs IH264VENC_Status IH264VENC_OutArgs IH264VENC_Fxns 4.2.2.1 IH264VENC_Params Description ║ This structure defines the creation parameters and any other implementation specific parameters for a H.264 Encoder instance object. The creation parameters are defined in the XDM data structure, IVIDENC1_Params Fields...
Page 84
API Reference Field Data type Input/ Description Output Input Range for the luma and chroma pixel values pixelRange XDAS_Int32 0 – Restricted Range 1 – Full Range (0-255) Default value = 1 Input This field is reserved meAlgo XDAS_Int32 timeScale XDAS_Int32 Input Time resolution value for Picture Timing...
Page 85
API Reference Field Data type Input/ Description Output Input Flag for 8x8 Transform for P frame transform8x8FlagIn XDAS_Int32 0 – Disable terFrame 1 – Enable Default value = 0. This tool is supported only in High Profile (profileIdc = 100) seqScalingFlag XDAS_Int32 Input...
Page 86
API Reference Field Data type Input/ Description Output Input Mode for specifying slice size sliceMode XDAS_Int32 0 – No multi-slice 1 – Reserved. 2 – number of MBs per slice 3 – number of Mb rows per slice Default value = 0 Input Mode for specifying low latency interface outputDataMode...
Page 87
API Reference Multiple slices based on number of MBs per slice and number of rows per slice. Platinum mode Mode( = 2): Multiple slices based encQuality on number of rows per slice. 4.2.2.2 IH264VENC_DynamicParams Description ║ This structure defines the run-time parameters and any other implementation specific parameters for a H.264 Encoder instance object.
Page 88
API Reference Field Data type Input/ Description Output Input Maximum value of Quantization Parameter (QP) to rcQMax XDAS_Int32 be used while encoding. Valid value is 0 to 51. The value for should not be less than rcQMax rcQMin The parameter is applicable only when rate-control is enabled.
Page 89
API Reference Field Data type Input/ Description Output Input Maximum acceptable delay in milliseconds for rate maxDelay XDAS_Int32 control. Min Limit: No minimum value check Max Limit : 10000 ms It is recommended to use value greater than 100 Typical value is 1000 ms. By default, this is set to 2000 ms at the time of encoder object creation.
Page 90
API Reference Field Data type Input/ Description Output Input This flag enables dumping of MV and SAD value of mvSADoutFlag XDAS_Int32 the encoded stream. If the flag is enabled, call will request for one extra XDM_GETBUFINFO buffer to dump the MV and SAD. See note for details.
Page 91
API Reference Field Data type Input/ Description Output metaDataGenerateCo Input XDAS_Int32 Flag to enable/disable metaData Consume and nsume generate. 0: Not used. 1: Generate metaData in the current instance. 2: Consume metaData in the current instance. genenrated but not yet metaData consumed.
Page 92
API Reference = 30. This means that at every 30 intraFrameInterval frame, there will be an I frame. But at every 300 frame, an IDR frame will be placed instead of I frame. IDR frame is used for synchronization. The MV and SAD is dumped in the .
Page 93
API Reference is considered, For example, for an input with 11MBs/row, if user wants 1row/slice;then sliceSize should be 12(11+1virtualMB=12). User should take care of accounting this virtual MB while setting sliceSize. = 3 then indicates: SliceMode sliceSize Size of each slice in number rows per slice. •...
Page 94
API Reference Note: is included only when TimeStamp IH264VENC_DynamicParams- is set to 1. >EnablePicTimSEI 4.2.2.4 IH264VENC_Status Description ║ This structure defines parameters that describe the status of the H.264 Encoder and any other implementation specific parameters. The status parameters are defined in the XDM data structure, IVIDENC1_Status Fields ║...
Page 95
API Reference 4.2.2.6 IH264VENC_Fxns Description ║ This structure defines all of the operations for the H.264 Encoder instance object. Fields ║ Field Data type Input/ Description Output ividenc IVIDENC1_Fxns Output data structure for IVIDENC1_Fxns details. 4-49...
API Reference 4.3 H.264 Encoder ROI specific Data Structures and Enumerations This section includes the following H.264 Encoder ROI specific structures and enumerations: XDM_Point structure XDM_Rect structure. ROI_type enumeration. ROI_Interface structure 4.3.1.1 XDM_Point Description ║ This structure defines all the fields required to specify location of point. This will be used to specify X and Y co-ordinates of given point.
Page 97
API Reference Field Data type Input/ Description Output bottomRight XDM_Point Input This will specify the X and Y co-ordinate of bottom right point of given ROI. XDM_Point data structure for details. 4.3.1.3 ROI_type Description ║ This enumeration defines all the different types of ROI. Fields ║...
Page 98
API Reference Field Data type Input/ Description Output numOfROI XDAS_Int32 Input Number of ROI limited by MAX_ROI Input Priority of the given ROI. roiPriority XDAS_Int32 Valid values include all integers between -4 [MAX_ROI] and 4. . A higher value means that more importance will be given to the ROI compared to other regions.
API Reference 4.4 H264 Encoder Two Pass Encoder data structure In simple two pass encoding following data structures have been used MBinfo Structure MBRowInfo Structure FrameInfo_Interface Structure 4.4.1 MBinfo Description ║ This structure is used to store MB information. It contains following elements.
Page 100
API Reference 4.4.3 Frameinfo_Interface Description ║ This Structure contains buffer description of frame related Parameters which are pass from low resolution encoder to high resolution encoder. Fields ║ Field Data type Input/ Description Output Output Width of the frame in pixels. Width XDAS_UInt16 Output...
API Reference 4.5 H.264 Encoder Low latency specific Data Structures and Enumerations This section includes the following H.264 Encoder Low Latency specific structures, constant, typedefs and enumerations: IH264VENC_TI_DataSyncDesc IH264VENC_TI_MAXNUMBLOCK IH264VENC_TI_DataSyncHandle IH264VENC_TI_DataSyncPutGetFxn IH264VENC_TI_DataMode IH264VENC_TI_SliceFormat enumeration 4.5.1 Structures 4.5.1.1 IH264VENC_TI_DataSyncDesc Description ║ This structure is a descriptor for the chunk of data being transferred via callback for producing the encoded data at NAL level Fields...
API Reference 4.5.2 Constant 4.5.2.1 IH264VENC_TI_MAXNUMBLOCKS Description ║ This MACRO defines max value of numBlocks accepted by encoder when operated in IH264VNC_TI_SLICEMODE outputData mode 4.5.3 Typdef 4.5.3.1 IH264VENC_TI_DataSyncHandle Description ║ This typedefs is handle that identifies DataSync FIFO. Fields Field Data type Input/ Description...
API Reference XDAS_Int32 /* Return Status – XDM_EOK/XDM_EFAIL */ 4.5.4 Enum 4.5.4.1 IH264VENC_TI_DataMode Description ║ This enumeration is used to specify codec when to provide encoded data – after entire frame encoding or after slice encoding. Fields ║ Enumeration Class Symbolic Constant Name Description IH264VENC_TI_DataMod...
Page 104
API Reference Notes: If the is cacahed, then the application needs to take care of outBuf cacahe invalidating the data before doing any read/write operation. This is because the input/output data is always read through DMA and not CPU. Example Usage: Configuring encoder Assume slice size as 2MB row.
API Reference 4.6 Interface Functions This section describes the Application Programming Interfaces (APIs) used in the H.264 Encoder. The APIs are logically grouped into the following categories: Creation – algNumAlloc() algAlloc() Initialization – algInit() Control – control() Data processing – algActivate() process(),algDeactivate() Termination –...
API Reference 4.6.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 algNumAlloc() requires Synopsis ║...
Page 107
API Reference Name ║ – determine the attributes of all buffers that an algorithm algAlloc() requires 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[];...
API Reference 4.6.2 Initialization API Initialization API is used to initialize an instance of the algorithm. The initialization parameters are defined in the structure (see Data Params Structures section for details). Name ║ – initialize an algorithm instance algInit() Synopsis ║...
API Reference 4.6.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 data structure (see Data Structures DynamicParams section for details).
Page 110
API Reference Note: The control API can be called with base or extended DynamicParams, data structure. If you are using extended data structures, Status the third and fourth arguments must be pointers to the extended data structures respectively. Also, ensure DynamicParams Status that the...
API Reference 4.6.4 Data Processing API Data processing API is used for processing the input data. Name ║ – initialize scratch memory buffers prior to processing. algActivate() Synopsis ║ Void algActivate(IALG_Handle handle); Arguments ║ IALG_Handle handle; /* algorithm instance handle */ Return Value ║...
Page 113
API Reference The following conditions must be true prior to calling this function; otherwise, its operation is undefined. can only be called after a successful return from process() algInit() algActivate() must be a valid handle for the algorithm’s instance object. handle Buffer descriptor for input and output buffers must be valid.
API Reference 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 ║ saves any persistent information to non-scratch buffers algDeactivate() using the persistent memory that is part of the algorithm’s instance object.
Page 115
API Reference Name ║ – determine the addresses of all memory buffers used by the algFree() algorithm Synopsis ║ XDAS_Int32 algFree(IALG_Handle handle, IALG_MemRec memTab[]); Arguments ║ IALG_Handle handle; /* handle to the algorithm instance */ IALG_MemRec memTab[]; /* output array of memory records */ Return Value ║...
Page 116
API Reference This page is intentionally left blank 4-70...
Appendix A Time-Stamp Insertion The DM365/DM368 H.264 Encoder supports insertion of frame time-stamp through the Supplemental Enhancement Information (SEI) Picture Timing message. The time-stamp is useful for audio-synchronization and determining the exact timing for display of frames. The parameters coded in the SEI Picture Timing Message are also useful for testing HRD compliance.
Page 118
Time-Stamp Insertion Example 2. f = 25 k = 2 TimeScale = 2 * 25 = 50 NumUnitsInTicks = 2 units_per_frame = 1 TimeStamp = 0, 1, 2, 3, 4… Example 3. f = 15 k = 1000 TimeScale = 1000 * 15 = 15000 NumUnitsInTicks = 1000 units_per_frame = 1 TimeStamp = 0, 1, 2, 3, 4…...
Appendix B Error Description returns FATAL_ERROR for out of range/invalid input Encoder_Create() parameter values. Also, the unsupported features usage in the profiles will also result in FATAL_ERROR. List of unsupported features with respect to the profile is listed in the following table. ProfileIDC Profile Inputparam values that results in...
Page 120
Error Description This page is intentionally left blank...
This buffer is accessed using EDMA. This section describes in brief how the buffers are used. The Framework component (FC) manages the VCIP buffers using VCIP resource manager. In context of DM365/DM368, VICP buffers can be used by following algorithms: MPEG4 and JPEG running on MJCP H.264 codec running on HDVICP...
VICP Buffer Usage By Codec Figure C-1. VICP Buffers Managed By FC. The above diagram shows the buffers of VICP managed by FC. The memories shaded in green are managed by FC. The memories in red are reserved for MJCP only.
0x0000 through 0x7FFF and data from 0x10000 through 0x17FFF. In context of DM365/DM368, ARM926 DTCM can be used for the following: ARM926 for system level usage H.264 codec running on HDVICP...
Page 124
ARM926 TCM Buffer Usage By Codec This page is intentionally left blank...
Page 125
Usage Multi-pass encoding can be used to improve the quality of the H264 encoded video. This version of H264 encoder on DM365/DM368 supports simple two pass (STP) encoder. In STP encoder, two encoders run sequentially for every frame captured, first the low-resolution encoder and then the high-resolution encoder.
Page 127
XDM_SETPARAMS starting encoding at low-resolution and high resolution instance for every frame (See section 3.1.3). The following steps explains how to use STP feature of the DM365/DM368 based H264 encoder. 1) Set flag value for low and high-resolution metaDataGenerateConsume encoder to 1 and 2 respectively.
Simple Two-pass Encoding Sample Usage 9) Once the metadata is consumed and encoding is completed at high resolution encoder, set the value of flag metaDataGenerateConsume for low-resolution encoder instance to 1. Example Usage: In order to provide flexibility to generate/consume information an metaData extended dynamic parameter...
Page 129
Simple Two-pass Encoding Sample Usage Copy metadata from low-resolution to high resolution; ********************************************************** Input Buffer requirement by high resolution encoder Structure Name Buffer Size FrameInfo_Interface sizeof(FrameInfo_Interface); Inside Codec: ********************************************************** If(metaDataGenerateConsume of high resolution is 2) /* Will be used in High resolution encoder */ * Use metadata given by low resolution encoder to * take appropriate decisions.
Page 130
Simple Two-pass Encoding Sample Usage This page is intentionally left blank...
Appendix F Revision History This revision history highlights the changes made to the SPRUEU9A codec specific user guide to make it SPRUEU9B. Table F-1.Revision History for H.264 Base/Main/High Profile Encoder on DM365/DM368 Section Changes Global There are no major changes in the user guide for this release of...
Need help?
Do you have a question about the DM365 and is the answer not in the manual?
Questions and answers