Page 1
MPEG4/H263 Decoder on HDVICP2 and Media Controller Based Platform User’s Guide Literature Number: SPRUGQ8 May 2018...
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.
Preface Read This First About This Manual This document describes how to install and work with Texas Instruments’ (TI) MPEG4 Advanced Simple Profile Decoder implementation on the HDVICP2 . It also provides a detailed Application Programming Interface (API) reference and information on the sample application that accompanies this component.
TMS320 DSP Algorithm Standard API Reference (literature number SPRU360) describes all the APIs that are defined by the TMS320 DSP Algorithm Interoperability Standard (also known as XDAIS) specification. ...
IDMA2 abstract interface and the ACPY2 library. eXpressDSP Digital Media (XDM) Standard API Reference (literature number SPRUEC8) The following documents describe TMS320 devices and related support tools: Design and Implementation of an eXpressDSP-Compliant DMA Manager for C6X1X (literature number SPRA789) describes a C6x1x-optimized (C6211, C6711) ACPY2 library implementation and DMA Resource Manager.
Page 6
Read This First Abbreviation Description Chip Support Library 720x576 resolutions in progressive scan Discrete Cosine Transform Direct Memory Access DMAN DMA Manager Decoded Picture Buffer Evaluation Module Global Motion Compensation HDTV High Definition Television IPCM Intra-frame Pulse Code Modulation IRES Interface standard to request and receive handles to resources Image Video Accelerator...
Read This First Text Conventions The following conventions used in this document: Text inside back-quotes (‘‘) represents pseudo-code. Program source code, function and macro names, parameters, and command line commands shown in a mono-spaced font.
The version number of the codec is included in the Title of the Release Notes that accompanies this codec. Trademarks Code Composer Studio, DSP/BIOS, eXpressDSP, TMS320, TMS320C64x, TMS320C6000, TMS320DM644x, and TMS320C64x+ are trademarks of Texas Instruments. All trademarks are the property of their respective owners.
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 ....................v Text Conventions ...................... vii Product Support......................viii Trademarks ......................viii Contents ..........................
Page 10
3.2 Frame Buffer Management by Application ............3-6 3.2.1 Frame Buffer Input and Output ................. 3-6 3.2.2 Frame Buffer Format ..................3-7 3.2.3 Frame Buffer Management by Application ............3-7 3.3 Handshaking between Application and Algorithm ..........3-8 3.4 Address Translations ..................3-9 3.5 Sample Test Application ................
Tables Table 1-1. List of Abbreviations ..................v Table 2-1. Component Directories ................2-11 Table 4-1. List of Enumerated Data Types ..............4-2 Table 6-2. Error Codes Information ................5-59 xiii...
Page 15
Chapter 1 Introduction This chapter introduces XDAIS and XDM. It also provides an overview of TI’s implementation of the MPEG4 Advanced Simple Profile Decoder on the HDVICP2 and Media Controller Based platform and its supported features. Topic Page 1.1 Overview of XDAIS, XDM and IRES 1.2 Overview of MPEG4 Advanced Simple Profile Decoder 1.3 Supported Services and Features...
The IALG interface also defines three more optional APIs algControl() , algNumAlloc() , and algMoved() . For more details on these APIs, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360). 1.1.2 XDM Overview In the multimedia application space, you have the choice of integrating any codec into your multimedia system.
Introduction (for example audio, video, image, and speech). The XDM standard defines the following two APIs: control() 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.
Introduction algorithm instance within an application framework, the algorithm and the application framework agrees on the concrete IRES resource types that requested. The framework calls the IRES interface functions, in addition to the IALG functions, to perform IRES resource initialization, activation, and deactivation.
Introduction 1.2 Overview of MPEG4 Advanced Simple Profile Decoder MPEG4 is a popular video coding algorithm enabling high quality multimedia services on a limited bandwidth network. MPEG4 standard defines several profiles and levels that specify restrictions on the bit-stream and hence limits the capabilities needed to decode the bit-streams. Each profile specifies a subset of algorithmic features that limits all decoders conforming to that profile may support.
Introduction Inter coded data: - Motion information (Motion vector) and residual error data (differential data between two frames) that is subjected to DCT and later quantized. The decoder re-constructs an Intra frame by spatial intra-prediction specified by the mode and by adding the prediction error. In case of inter coding, the decoder reconstructs the frame by adding the residual error data to the previously decoded picture, at the location specified by the motion information (Motion vector).
Introduction 1.3 Supported Services and Features This user guide accompanies TI’s implementation of MPEG4 Decoder on the HDVICP2 and Media Controller Based platform. This version of the codec has the following supported features: MPEG4 Simple profile levels 0,1,2,3,4A,5 and 6 are supported ...
Page 22
Introduction Supports multi-channel functionality Supports optional loop filter post-processing This version of the decoder does not support the following features as per the Advanced Simple Profile feature set: Support for Global Motion Compensation Support for Sub-frame level data synchronization API’s at both Input ...
Installation Overview 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-10 2.2 Installing the Component 2-10...
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 is been tested on the HDVICP2 and Media Controller based OMAP4 and DM816x DDR2 EVM REV-B hardware platforms. 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 Table 2-1 provides a description of the sub-directories created in IVAHD_001directory. Table 2-1. Component Directories Sub-Directory Description 2-11...
Page 26
Installation Overview Sub-Directory Description \algsrc\build\vM3\Obj Contains intermediate Object files generated for Media Controller (host) project \algsrc\docs Contains documents specific to the Media Controller (host) project \algsrc\inc Contains header files needed by the Media Controller (host) project and some interface files which are shared between HDVICP2 and Media Controller \algsrc\src\asm Contains assembly files needed by Media Controller (host) project...
Page 27
Installation Overview Sub-Directory Description \docs Contains user guide, and data sheet. \icont\build\icont1\Map Contains the generated map file related to icont1 project \icont\build\icont1\Obj Contains the generated object files related to icont1 project \icont\build\icont1\Out Contains the generated executable files related to icont1 project \icont\build\icont2\Map Contains the generated map file related to icont2 project \icont\build\icont2\Obj...
Page 28
Installation Overview Sub-Directory Description \icont\errorconceal\eclib\docs Contains the errorconcealment eclib module specific documents \icont\errorconceal\eclib\inc Contains the errorconcealment eclib module specific header files \icont\errorconceal\eclib\src Contains source files needed by the errorconcealment eclib. \icont\errorconceal\eclib\lib Contains library generated by the errorconcealment eclib. \icont\errorconceal\inc Contains header files. \Inc Contains XDM related header files, which allow interface to the codec library.
Installation Overview 2.3 Before Building the Sample Test Application This codec is accompanied by a sample test application. To run the sample test application, you need TI Framework Components (FC) and HDVICP2 library. This version of the codec has been validated Framework Component (FC) version 3.20.00.22.
Installation Overview XDM related header files, these are available in the <install directory>\CCStudio4.0\<fc_directory>\fctools\packages \ti\xdais directory. Memutils file for memory address translation, these are available in the <install directory>\CStudio4.0\<fc_directory>\ packages\ti\sdo\fc\memutils directory 2.3.2 Installing XDC Tools XDC Tools is required to build the test application. The test application uses the standard files like <std.h>...
Installation Overview mpeg4vdec_ti_icont2.out \algsrc\inc\ mpeg4vdec_ti_icont2_code.h \algsrc\inc\ mpeg4vdec_ti_icont2_code_debugtracelevel1.h \algsrc\inc\ mpeg4vdec_ti_icont2_code_debugtracelevel2.h \algsrc\build\vM3\make\ \lib\ mpeg4vdec_ti_host.lib Test \client\build\<TestAppDeviceNam \client\build\TestApp<DeviceName>\out Application e>\make\ \ mpeg4vdec_ti_hosttestapp.out Run the <release_package>\make.bat with “all’ as an argument to build all the projects. make.bat all This batch file will build all the projects in the above mentioned order and generate the output files as given in the table.
Installation Overview executable “mpeg4vdec_ti_hosttestapp.out” and load it in preparation for execution. Select Target > Run to execute the application for Cortex_M3_0 device. Test application will take input streams from \client\test\testvecs\input\ directory and generates outputs in \client\test\testvecs\output\ directory. Note: Order of connecting to the devices is important and it should be as mentioned in above steps.
Installation Overview 2.5 Configuration Files This codec is shipped along with: Generic configuration file (Testvecs.cfg) – specifies input configuration file. Decoder configuration file (airshow_p176x144_nv12.cfg) – specifies the configuration parameters used by the test application to configure the Decoder for given test stream. 2.5.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...
Installation Overview AppRsvd2 # 0 -> Default, reserved one for future use Note: Chroma Format supported in this codec is 420 semi-planar. That is, the chroma planes (Cb and Cr) are Interleaved. 2.6 Standards Conformance and User-Defined Inputs To check the conformance of the codec for the default input file shipped along with the codec, follow the steps as described in Section 2.4.
Page 36
Installation Overview This page is intentionally left blank 2-22...
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 by Application 3.3 Handshaking between Application and Algorithm 3.4 Address Translations 3.5 Sample Test Application 3-10...
Sample Usage 3.1 Overview of the Test Application The test application exercises the IVIDDEC3 base class of the MPEG4 Decoder library. The main test application files are mpeg4vdec_ti_hosttestapp.c and mpeg4vdec_rman_config.c. These files are available in the \Client\Test\Src directory. 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: Decoder requests only one memory buffer through algNumAlloc. This buffer is for the algorithm handle. Other memory buffer requirements are done through IRES interfaces. After successful creation of the algorithm instance, the test application does HDVICP Resource and memory buffer allocation for the algorithm. Currently, RMAN resource manager is not used.
Sample Usage Process call frame n Process call frame n+1 Host Transfer of System tasks at Host application Host Video Task HDVICP Host system Tasks tasks MB level tasks for MB level tasks for frame n+1 frame n HDVICP Busy Figure 3-2.
Sample Usage 3.1.4 Algorithm Instance Deletion Once decoding/encoding is complete, the test application frees the memory resources and deletes the current algorithm instance. The following APIs called in sequence: 1) numResourceDescriptors() - Get the number of resources and free them. If the application needs handles to the resources, it can call getResourceDescriptors() 2) algNumAlloc() - To query the algorithm about the number of memory records it used.
Sample Usage As explained above, buffer pointer cannot used as a unique identifier to keep a record of frame buffers. Any buffer given to algorithm should consider locked by algorithm, unless the buffer is returned to the application through IVIDDEC3_OutArgs->freeBufID[] . Note: BufferID returned in IVIDDEC3_OutArgs ->outputID[] is only for...
Sample Usage BUFFMGR_ReInit() - BUFFMGR_ReInit function allocates global luma and chroma buffers and allocates entire space to the first element. This element will be used in the first frame decode. After the picture, height, width, and its luma and chroma buffer requirements will get. The global luma and chroma buffers will re-initialized to other elements in the buffer array.
Sample Usage Note: Process call architecture to share Host resource among multiple threads. ISR ownership is with the Host layer resource manager – outside the codec. The actual codec routine to be executed during ISR is provided by the codec.
Sample Usage Sample settings for the macro VDMAVIEW_EXTMEM is as shown #if defined(HOST_ARM9) #define VDMAVIEW_EXTMEM (0x07FFFFFF) #elif defined(HOST_M3) #define VDMAVIEW_EXTMEM (0xFFFFFFFF) #else #define VDMAVIEW_EXTMEM (0x07FFFFFF) #endif 3.5 Sample Test Application The test application exercises the IVIDDEC3 base class of the MPEG4 Decoder.
Page 47
Sample Usage /* Always release buffers - which are released from /* the algorithm side -back to the buffer manager BUFFMGR_ReleaseBuffer((XDAS_UInt32 *)outArgs.freeBufID); while(1); /* end of Do-While loop - which decodes frames ALG_delete (handle); BUFFMGR_DeInit(); Note: This sample test application does not depict the actual function parameter or control code.
Page 48
Sample Usage This page intentionally left blank 3-12...
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-12 4.3 Interface Functions 4-30...
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. Table 4-1. List of Enumerated Data Types Group or Enumeration Class Symbolic Constant Name Description or Evaluation...
Page 51
Group or Enumeration Class Symbolic Constant Name Description or Evaluation IVIDEO_MBAFF_IDR_FRAME Intra coded MBAFF frame that used for refreshing video content. IVIDEO_FRAMETYPE_DEFAUL IVIDEO_I_FRAME Default set to IVIDEO_ContentType IVIDEO_CONTENTTYPE_NA Content type is not applicable IVIDEO_PROGRESSIVE Progressive video content IVIDEO_PROGRESSIVE_FRAM IVIDEO_INTERLACED Interlaced video content IVIDEO_INTERLACED_FRAME IVIDEO_INTERLACED_TOPFI Interlaced video content, Top field...
Page 52
Group or Enumeration Class Symbolic Constant Name Description or Evaluation IVIDEO_SKIP_IDR Skip IDR Frame Not supported with current decoder version. IVIDEO_SKIP_NONREFERENC Skip non reference frame Not supported with current decoder version.. IVIDEO_SKIP_DEFAULT IVIDEO_NO_SKIP Default set to IVIDEO_FIELD_INTERLEAVE IVIDEO_VideoLayout Buffer layout is interleaved. IVIDEO_FIELD_SEPARATED Buffer layout is field separated.
Page 53
Group or Enumeration Class Symbolic Constant Name Description or Evaluation IVIDEO_ENCODE_ONLY Encoding mode. IVIDEO_TRANSCODE_FRAME Transcode mode of operation LEVEL encode/decode) which consumes/generates transcode information at the frame level. Not supported with current decoder version. IVIDEO_TRANSRATE_FRAME Transcode mode of operation LEVEL encode/decode) which consumes/generates transcode information at the MB level.
Page 54
Group or Enumeration Class Symbolic Constant Name Description or Evaluation IVIDDEC3_DISPLAY_DELAY_ Display the frames with 8 frame delay IVIDDEC3_DISPLAY_DELAY_ Display the frames with 9 frame delay IVIDDEC3_DISPLAY_DELAY_ Display the frames with 10 frame delay IVIDDEC3_DISPLAY_DELAY_ Display the frames with 11 frame delay IVIDDEC3_DISPLAY_DELAY_ Display the frames with 12 frame...
Page 55
Group or Enumeration Class Symbolic Constant Name Description or Evaluation XDM_ChromaFormat XDM_YUV_420P YUV 4:2:0 planar. Not supported with current decoder version. XDM_YUV_422P YUV 4:2:2 planar. Not supported with current decoder version. XDM_YUV_422IBE YUV 4:2:2 interleaved (big endian). Not supported with current decoder version.
Page 56
Group or Enumeration Class Symbolic Constant Name Description or Evaluation XDM_MEMTYPE_TILEDPAGE 2D memory in page container of tiled memory space. XDM_CmdId XDM_GETSTATUS Query algorithm instance to fill Status structure XDM_SETPARAMS Set run-time dynamic parameters DynamicParams via the structure XDM_RESET Reset the algorithm. XDM_SETDEFAULT Params Initialize all fields in...
Page 57
Group or Enumeration Class Symbolic Constant Name Description or Evaluation XDM_CORRUPTEDDATA Bit 11 1 - Data problem/corruption 0 - Ignore XDM_CORRUPTEDHEADER Bit 12 1 - Header problem/corruption 0 - Ignore XDM_UNSUPPORTEDINPUT Bit 13 1 - Unsupported feature/parameter in input ...
Page 58
Group or Enumeration Class Symbolic Constant Name Description or Evaluation IMPEG4D_ERR_VIDEOPACKET Bit 7 1 - Error in Video Packet parsing 0 - Ignore IMPEG4D_ERR_MBDATA Bit 16 1 - Error in MB data parsing 0 - Ignore IMPEG4D_ERR_INVALIDPARA Bit 17 M_IGNORE...
Page 59
Group or Enumeration Class Symbolic Constant Name Description or Evaluation IMPEG4D_ERR_START_CODE_ Bit 26 NOT_PRESENT 1 - Start code for given stream is not present in case of Parse Header mode 0 - ignore IMPEG4D_ERR_VOP_TIME_IN Bit 27 CREMENT_RES_ZERO 1 - Vop time increment resolution is zero ...
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 61
filled by DMA or other hardware accelerator that does not write through the algorithm CPU), then bits in this mask should not be set. 4.2.1.2 XDM2_BufSize ║ Description This defines the union describing a buffer size. ║ Fields Field Datatype Input/ Description Output...
Page 62
Field Datatype Input/ Description Output minNumInBufs XDAS_Int32 Output Number of input buffers minNumOutBufs XDAS_Int32 Output Number of output buffers minInBufSize[XDM_ XDM2_BufSi Output Size required for each input buffer MAX_IO_BUFFERS] minOutBufSize[XDM XDM2_BufSi Output Size required for each output buffer _MAX_IO_BUFFERS] inBufMemoryType[X XDAS_Int32 Output Memory type for each input buffer...
Page 63
XDM_MEMTYPE_TILEDPAGE XDM_MEMTYPE_RAW 4.2.1.5 IVIDEO2_BufDesc ║ Description This structure defines the buffer descriptor for input and output buffers. ║ Fields Field Datatype Input/ Description Output numPlanes XDAS_Int32 Input/O Number of buffers for video planes utput Input/O numMetaPlanes XDAS_Int32 utput Number of buffers for Metadata dataLayout XDAS_Int32 Input/O...
Page 64
Field Datatype Input/ Description Output utput be repeated. Not applicable for encoders. frameStatus XDAS_Int32 Input/O Video in/out buffer status. utput Not applicable for encoders. repeatFrame XDAS_Int32 Input/O Number of times to repeat the utput displayed frame. Not applicable for encoders. contentType XDAS_Int32 Input/O...
Page 65
Fields Field Datatype Input/ Description Output Ialg IALG_Fxns Input Structure containing pointers for XDAIS interface functions. For more details, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360). *process XDAS_Int32 process() Input Pointer to the function *control XDAS_Int32 control()
Page 66
Field Datatype Input/ Description Output XDM_BYTE Default is forceChromaFormat XDAS_Int32 Input Sets the output to the specified format. Only 420 semi-planar format supported currently. For example, if the output should be in YUV 4:2:2 interleaved (little endian) format, set this field to XDM_YUV_422ILE XDM_YUV_420SP Default is...
Page 67
Field Datatype Input/ Description Output Not supported in this version of the decoder. Value should be set to 0 errorInfoMode XDAS_Int32 Input Enable/disable packet error information for input/output. Supports only one value - IVIDEO_ERRORINFO_OFF displayBufsMode XDAS_Int32 displayBufs Input Indicates the mode.
Page 68
Field Datatype Input/ Description Output Size XDAS_Int32 Input Size of the basic or extended (if being used) data structure in bytes. decodeHeader XDAS_Int32 Input Number of access units to decode, supported values are: XDM_DECODE_AU ) - Decode entire frame including all the headers XDM_PARSE_HEADER ...
Page 69
Field Datatype Input/ Description Output getDataHandle XDM_DataSy Input Handle that identifies the data sync FIFO and is ncHandle getData passed as argument to calls Not supported in this version of the decoder. Default value is NULL. putBufferFxn XDM_DataSy Input Function pointer to receive buffer at sub-frame level ncPutBuffe rFxn Not supported in this version of the decoder.
Page 70
structure in bytes. numBytes XDAS_Int32 Input Size of input data (in bytes) provided to the algorithm for decoding inputID XDAS_Int32 Input Application passes this ID to algorithm and decoder will attach this ID to the corresponding output frames. This is useful in case of re-ordering (for example, B frames).
Page 71
Field Datatype Input/ Description Output bitRate XDAS_Int32 Output Average bit-rate in bits per second contentType XDAS_Int32 Output Video content. See IVIDEO_ContentType enumeration for details. sampleAspectRatioH XDAS_Int32 Output Sample aspect ratio for height eight sampleAspectRatioW XDAS_Int32 Output Sample aspect ratio for width idth bitRange XDAS_Int32...
Page 72
Field Datatype Input/ Description Output decDynamicParams IVIDDEC3_Dynam Output Current values of the decoder's dynamic icParams parameters. Note: Algorithm sets the bit-Rate field to a default value 10485760. The algorithm can set multiple bits of extendedError to 1, depending on the error condition 4.2.1.11 IVIDDEC3_OutArgs ║...
Page 73
Field Datatype Input/ Description Output current process call. outBufsInUseFlag XDAS_Int32 outBufs Output Flag to indicate that the provided with process () outBufs call are in use. No are required to be supplied with the next process () call. displayBufsMode XDAS_Int32 Output Indicates the mode for #IVIDDEC3_OutArgs.displayBufs.
4.2.2 MPEG4 Decoder Data Structures This section describes the MPEG4 Decoder defined data structures, which are specific to MPEG4 Decoder. The MPEG4 Decoder structures can extend to define any specific parameters for supporting tools of MPEG4 Decoder. Below are the different data structure used by MPEG4 Decoder:- IMPEG4VDEC_Params ...
Page 75
Field Data Type Input/ Description Output debugTraceLevel XDAS_UInt32 Input Specifies debug trace level. Supported Range: 0 to 2. Default Value: 0 lastNFramesToLo XDAS_UInt32 Input Specifies the number of most recent frames to log in debug trace. Supported Range: 0 to10. Default Value: 0 paddingMode XDAS_UInt32...
Page 76
Field Data Type Input/ Description Output Reserved[3] XDAS_UInt32 Input Reserved for future use. 4.2.2.3 IMPEG4VDEC_InArgs ║ Description This structure defines the run-time input arguments for an MPEG4 Decoder instance object. ║ Fields Field Data Type Input/ Description Output viddec3InArgs IVIDDEC3_InArgs IVIDDEC3_InArgs Input data structure for...
Page 77
Field Data Type Input/ Description Output Reserved[3] XDAS_UInt32 Output Reserved for future use 4.2.2.5 IMPEG4VDEC_OutArgs ║ Description This structure defines the run-time output arguments for the MPEG4 Decoder instance object. ║ Fields Field Data Type Input/ Description Output viddec3OutArgs IVIDDEC3_OutArgs IVIDDEC3_OutArgs Output data structure for...
, algAlloc() , algInit() , algActivate() , algDeactivate() , and algFree() are standard XDAIS APIs. This document includes only a brief description for the standard XDAIS APIs. For more details, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360).
It always returns the same result. The algNumAlloc() API is optional. For more details, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360). ║ See Also...
Page 80
IALG_MemRec is the buffer-descriptor structure defined in ialg.h. After calling this function, memTab[] is filled up with the memory requirements of an algorithm. For more details, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360). ║ See Also...
NULL. The last argument is a pointer to a structure that defines the algorithm initialization parameters. For more details, see TMS320 DSP Algorithm Standard API Reference (literature number SPRU360). ║ See Also...
4.3.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 decoder during run-time. These controllable parameters are defined in the Status data structure (see Data Structures section for details).
Page 83
must be a valid handle for the algorithm’s instance object. Handle ║ Postconditions The following conditions are true immediately after returning from this function. If the control operation is successful, the return value from this operation is equal to IALG_EOK; otherwise it is equal to either IALG_EFAIL or an algorithm specific return value.
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. For more details, see TMS320 DSP Algorithm Standard API Reference. (literature number SPRU360). ║ See Also...
Page 86
║ Postconditions The following conditions are true immediately after returning from this function. If the process operation is successful, the return value from this operation is equal to IALG_EOK; otherwise it is equal to either IALG_EFAIL or an algorithm specific return value. After successful return from process() function, algDeavtivate() ...
Page 87
The first (and only) argument to algDeactivate() is an algorithm instance handle. This handle is used by the algorithm to identify various buffers that must be saved prior to next cycle of algActivate() and processing. For more details, see TMS320 DSP Algorithm Standard API Reference (SPRU360). ║ See Also...
The second argument is a table of memory records that describe the base address, size, alignment, type, and memory space of all buffers previously allocated for the algorithm instance. For more details, see TMS320 DSP Algorithm Standard API Reference (SPRU360). ║...
Chapter 5 Frequently Asked Questions This chapter provides answers to few frequently asked questions related to using this decoder. 5.1 Code Build and Execution Question Answer How I will be able to run the Please follow the instructions given in section 2.4 (Building and Running the Sample Test Application) codec library.
Page 90
Question Answer What kind of memory type MPEG4 Decoder supports RAW(Luma-Chroma)/TILED8Bit(luma- supported for output buffer of chroma)/TILED16bit(chroma) and TILEDPAGE (Luam -chroma) output the MPEG4 Decoder. buffers, but MPEG4 Decoder does not support change in memory type dynamically in between process call. Means if codec has been provided RAW memory for process call 1, then codec expect Raw memory for the next process call, it should not be other than RAW mem.
Chapter 6 Debug Trace Usage This section describes the debug trace feature supported by codec and its usage. 6.1 Introduction This section explains the approach and overall design that will be adopted for enabling a trace from a video codec. The primary use of Debug Trace Usage are: 1) Make the codec implementation capable of producing a trace containing details about the history of executing a particular instance of the codec...
XDAS_UInt32 paddingMode; XDAS_UInt32 enhancedDeBlockingQp XDAS_UInt32 reserved[2]; } IMPEG4VDEC_Params; 6.2.1 debugTracelevel This parameter configures the codec to dump a debug trace log 0: Disables dumping of debug trace parameters >0: Enables the dumping of debug trace parameters. Value specifies the level of debug trace information. MPEG-4 decoder supports till level 2.
extMemoryDebugTraceAddr: External memory address (as seen by Media Controller) where debug trace information is being dumped – last memory buffer requested by the codec extMemoryDebugTraceSize: External memory buffer size (in bytes) where debug trace information is being dumped - the size of last memory buffer Now the application can retrieve this information from the codec at any time by the existing GETSTATUS query through the codec’s Control API.
Appendix A Picture Format This Appendix explains picture format details for decoder. Decoder outputs YUV frames in NV 12 format. A.1 NV12 Chroma Format NV12 is YUV 420 semi-planar with two separate planes, one for Y, one for U and V interleaved. Y0,0 Y0,1 Y1,0...
Page 96
Progressive Picture Format picLumaBufferAddr imageRegion.topLeft activeRegion.topLeft ACTIVE REGION (LUMA) frameWidth maxWidth imagePitch activeRegion.bottomRight ActiveRegion and ImageRegion offsets for chroma are derived from luma offset picChromaBufferAddr ChromaXoffset = lumaX_offset & 0xfffffffe; imageRegion.bottomRight ChromaYoffset = (lumaY_offset>>1) & 0xfffffffe; imagePitch maxWidth ACTIVE REGION (CHROMA) frameWidth A-48...
Page 97
Note that for decoder in case of progressive sequence: Luma and chroma buffer addresses can be allocated independently Application shall provide this through separate buffer addresses The outermost yellow colored region is the minimum buffer that application should allocate for a given maxWidth and maxHeight ...
Page 98
Interlaced Picture Format picLumaBufferAddr = lumaTopFieldOutput imageRegion.topLeft activeRegion.topLeft Padded region imagePitch Decoded region multiple of 16x16 macroblock Display region of any integer number of pixels in horizontal and vertical direction ACTIVE REGION TOP FIELD (Luma) maxWidth frameWidth activeRegion.bottomRight imageRegion.bottomRight ACTIVE REGION BOTTOM FIELD (Luma) frameWidth ActiveRegion and ImageRegion offsets are same for top and bottom field...
Page 99
Note that for decoder in case of interlaced sequence: Luma and chroma buffers can be allocated independently Field buffer allocation cannot be independent For every pair of top and bottom field, decoder shall expect a single buffer address from the application ...
Page 100
A.4 Constraints on Buffer Allocation for Decoder maxWidth and maxHeight are inputs given by the decoder to the applications Application may not know the output format of the decoder. Therefore, application should allocate Image Buffer based on maxWidth and maxHeight ...
Appendix B Meta Data Support This version of the decoder supports writing out the MB Info data into application provided buffers. This feature can be enabled/disabled through create time parameters IVIDDEC3_Params::metadataType [IVIDEO_MAX_NUM_METADATA_PLANES] . There can be maximum 3 ( IVIDEO_MAX_NUM_METADATA_PLANES ) meta data planes possible to be supported with one instance of the decoder.
Page 104
outBufs->descs[0] -> Y plane outBufs->descs[1] -> Cb/Cr plane outBufs. outBufs->descs[2] -> Buffer allocated for MB info Also, the respective buffer pointer is copied back in the first meta-plane pointer: outArgs->decodedBufs.metadataPl aneDesc[0].buf , again the ordering of the metadata is as per the order supplied by IVIDDEC3_Params::metadataType[] inpput parameter.
Page 105
Error Map, Size in Bytes = Number of MBs in Frame Format details for Case 2 (Dumping of Error map and MB Info): Case 2a, Progressive Frame: Error Map, Size in Bytes = Number of MBs in Frame MB Info structure for all MBs, Size in Bytes = 112 * Number of MBs in Frame Case 2b, Interlaced Frame: Error Map, Size in Bytes = Number of MBs in Frame MB Info structure for all MBs, Size in Bytes = 112 * Number of MBs in Frame...
Page 106
This page intentionally left blank B-58...
Appendix C Error Handling This version of the decoder supports handling of erroneous situations while decoding. If decoder encounters errors in bit stream or any other erroneous situations, decoder shall exit grace fully without any hang or crash. In addition, decoder process call shall return IVIDDEC3_EFAIL and relevant error code will be populated in extendedError field of outArgs .
Page 108
XDM E Code Recommended App rror Error Mapping Behavior code Explanation Any syntax error If more bytes available in while parsing the bit stream, then pass it to video object layer decoder. ELSE if bytes are IMPEG4D_ERR_V XDM_CORRUPTEDHE of mpeg4 stream. not available call Flush ADER operation.
Page 109
XDM E Code Recommended App rror Error Mapping Behavior code Explanation XDM_INSUFFICI XDM_INSUFFICIEN Insufficient input Refer codec specific error ENTDATA TDATA data which causes this XDM_CORRUPTED XDM_CORRUPTEDDA Data Refer codec specific error DATA problem/corruption which causes this XDM_CORRUPTED XDM_CORRUPTEDHE Header Refer codec specific error HEADER ADER...
Page 110
XDM E Code Recommended App rror Error Mapping Behavior code Explanation etc… error bit set. End of Stream was found in this Normal Mode of Decoder - process call OR Do XDM_FLUSH, Else - IMPEG4D_ERR_S codec is in flush XDM_RESET and Next TREAM_END No XDM mapping mode...
Page 111
XDM E Code Recommended App rror Error Mapping Behavior code Explanation No valid start code present in the If more bytes available in stream, this error bit stream, then pass it to IMPEG4D_ERR_S code is mainly set decoder. ELSE if bytes are TART_CODE_NOT XDM_CORRUPTEDHE for parse header...
Page 112
This page is intentionally left blank C-64...
Appendix D Parse Header Support This version of the decoder provides support to parse just header of the bit stream. For decoder to operate in this mode Application needs to perform a XDM_SETPARAMS control call with dynamicParams-> decodeHeader = XDM_PARSE_HEADER Typical usage of this feature by the application is to understand the resolution of picture in bit stream and allocate frame buffer of size as needed by that bit stream.
Appendix E Support for Display Delay This version of decoder supports configurability to achieve desired display delay and low DDR memory footprint. It is recommended to utilize this feature only when the application is well aware of the nature of the bit stream in terms of the GOP structure. Desired display delay can be achieved by the application by setting IVIDDEC3_Params::displayDelay.
Appendix F Support for Padding type This version of decoder supports configurability to achieve desired padding process for non-multiple of 16 resolution video clips It is recommended to utilize this feature only when the application is well aware of the nature of the encode bit-stream, as there may be some ambiguity can come for decoded YUV, below is explanation of the padding types used for decoder.
Page 118
First interpretation of the padding process defined in spec (also called as DIVX style of padding) Second interpretation of the padding process defined in spec (also called as MPEG4 style of padding)
Page 119
As defined above padding processes both interpretations are correct way of doing the padding for the non-multiple of 16-resolution stream, only concern comes when encoder follow one kind of padding and decoder follow other kind of padding. So to get the perfect output, both encoder and decoder shall follow identical interpretation of the standard, any mismatch in either side, may result in visual artifacts...
Appendix G Support for Dynamic Change in Resolution This version of decoder supports handling of change in resolution in as stream. Procedure to be as follows: When decoder detects that, a change in resolution has occurred: Decoder shall send out the error code of IMPEG4D_ERR_PICSIZECHANGE Byte consumed value returned by codec shall not be inclusive of the VOL (mpeg4 video object layer) / VOP (H263 new frame sequence) beginning to new resolution.
Appendix H Support for Drop of frame This version of decoder supports handling of drop of frame (I frame drop), meaning in case first frame of sequence is dropped then codec will be through error. When decoder detects that, there is drop is frame meaning first frame not I frame then codec report error as follows: Decoder shall send out the error code of IMPEG4D_ERR_IFRAME_DROPPED Despite of reporting error as above codec will continue decoding of that frame data given to...
Page 124
This page is intentionally left blank H-10...
Appendix I Support for Decoding only Intra frames using less memory This version of decoder also supports decoding of only Intra frames from the stream. This feature is added to reduce the memory footprint requested by codec during create time. When decoder is created with this feature enabled, it shall request lesser memory during create time compared when this feature is disabled;...
Page 126
This page is intentionally left blank I-12...
Need help?
Do you have a question about the TMS320 and is the answer not in the manual?
Questions and answers