From b483e571e0325deb94e6d5872764844d2e0e8563 Mon Sep 17 00:00:00 2001 From: Sunita Nadampalli Date: Tue, 3 Sep 2013 11:37:10 -0500 Subject: [LIBDCE] Added codec, xdais and xdctools headers This patch adds codec,xdais and xdctools headers for libdce compilation at HLOS level. Since HLOS code doesn't refer to the tools directly, this patch provides copy for all the required headers. Note# These headers need to be updated for every release if the tools versions are changed. Version Info of the added Headers: Tools: XDC version : xdctools_3_25_02_70 CE version : codec_engine_3_24_00_08 XDAIS version : xdais_7_24_00_04 IVAHD_Codecs: H.264 Dec : 02.00.13.00 MJPEG Dec : 01.00.11.01 MPEG-4 Dec : 01.00.13.00 VC-1 Dec : 01.00.00.11 MPEG-2 Dec : 01.00.12.00 SVC Dec : 00.06.00.00 H.264 Enc : 02.00.06.01 MJPEG Enc : 01.00.02.01 SVC Enc : 00.02.00.05 Change-Id: Id2307e2376d3ba0c13464c1b21cdba53d8f997f2 Signed-off-by: Sunita Nadampalli --- packages/codec_engine/ti/sdo/ce/Engine.h | 1584 +++++++++ packages/codec_engine/ti/sdo/ce/Server.h | 761 +++++ packages/codec_engine/ti/sdo/ce/ServerDefs.h | 76 + packages/codec_engine/ti/sdo/ce/ipc/Comm.h | 235 ++ packages/codec_engine/ti/sdo/ce/node/node.h | 209 ++ packages/codec_engine/ti/sdo/ce/skel.h | 137 + packages/codec_engine/ti/sdo/ce/video2/videnc2.h | 401 +++ packages/codec_engine/ti/sdo/ce/video3/viddec3.h | 396 +++ packages/codec_engine/ti/sdo/ce/visa.h | 690 ++++ .../ivahd_codecs/ti/sdo/codecs/h264enc/ih264enc.h | 3503 ++++++++++++++++++++ .../ti/sdo/codecs/h264svcenc/ih264svcenc.h | 295 ++ .../ti/sdo/codecs/h264svcvdec/ih264svcvdec.h | 443 +++ .../ti/sdo/codecs/h264vdec/ih264vdec.h | 2692 +++++++++++++++ .../ti/sdo/codecs/jpegvdec/ijpegvdec.h | 587 ++++ .../ti/sdo/codecs/mpeg2vdec/impeg2vdec.h | 509 +++ .../ti/sdo/codecs/mpeg4enc/impeg4enc.h | 1275 +++++++ .../ti/sdo/codecs/mpeg4vdec/impeg4vdec.h | 1064 ++++++ .../ivahd_codecs/ti/sdo/codecs/vc1enc/ivc1enc.h | 996 ++++++ .../ivahd_codecs/ti/sdo/codecs/vc1vdec/ivc1vdec.h | 734 ++++ packages/xdais/ti/xdais/dm/ividdec3.h | 1011 ++++++ packages/xdais/ti/xdais/dm/ividenc2.h | 937 ++++++ packages/xdais/ti/xdais/dm/ivideo.h | 829 +++++ packages/xdais/ti/xdais/dm/xdm.h | 1367 ++++++++ packages/xdais/ti/xdais/ialg.h | 762 +++++ packages/xdais/ti/xdais/xdas.h | 79 + packages/xdctools/google/targets/arm/std.h | 42 + packages/xdctools/google/targets/std.h | 78 + packages/xdctools/qnx/targets/arm/std.h | 42 + packages/xdctools/xdc/std.h | 354 ++ 29 files changed, 22088 insertions(+) create mode 100644 packages/codec_engine/ti/sdo/ce/Engine.h create mode 100644 packages/codec_engine/ti/sdo/ce/Server.h create mode 100644 packages/codec_engine/ti/sdo/ce/ServerDefs.h create mode 100644 packages/codec_engine/ti/sdo/ce/ipc/Comm.h create mode 100644 packages/codec_engine/ti/sdo/ce/node/node.h create mode 100644 packages/codec_engine/ti/sdo/ce/skel.h create mode 100644 packages/codec_engine/ti/sdo/ce/video2/videnc2.h create mode 100644 packages/codec_engine/ti/sdo/ce/video3/viddec3.h create mode 100644 packages/codec_engine/ti/sdo/ce/visa.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/h264enc/ih264enc.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/h264svcenc/ih264svcenc.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/h264svcvdec/ih264svcvdec.h create mode 100755 packages/ivahd_codecs/ti/sdo/codecs/h264vdec/ih264vdec.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/jpegvdec/ijpegvdec.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/mpeg2vdec/impeg2vdec.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/mpeg4enc/impeg4enc.h create mode 100755 packages/ivahd_codecs/ti/sdo/codecs/mpeg4vdec/impeg4vdec.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/vc1enc/ivc1enc.h create mode 100644 packages/ivahd_codecs/ti/sdo/codecs/vc1vdec/ivc1vdec.h create mode 100755 packages/xdais/ti/xdais/dm/ividdec3.h create mode 100755 packages/xdais/ti/xdais/dm/ividenc2.h create mode 100755 packages/xdais/ti/xdais/dm/ivideo.h create mode 100755 packages/xdais/ti/xdais/dm/xdm.h create mode 100755 packages/xdais/ti/xdais/ialg.h create mode 100755 packages/xdais/ti/xdais/xdas.h create mode 100644 packages/xdctools/google/targets/arm/std.h create mode 100644 packages/xdctools/google/targets/std.h create mode 100644 packages/xdctools/qnx/targets/arm/std.h create mode 100644 packages/xdctools/xdc/std.h (limited to 'packages') diff --git a/packages/codec_engine/ti/sdo/ce/Engine.h b/packages/codec_engine/ti/sdo/ce/Engine.h new file mode 100644 index 0000000..936c61f --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/Engine.h @@ -0,0 +1,1584 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== Engine.h ======== + */ + +/** + * @file ti/sdo/ce/Engine.h + * + * @brief The Codec Engine Runtime. + * + * @remarks Provides the user an interface to + * open and manipulate an Engine which can instantiate + * and communicate with XDAIS algorithms that run either + * on the local CPU or on a "remote" Server. + */ +/** + * @addtogroup CODECENGINE Codec Engine Runtime + */ + +#ifndef Engine_ +#define Engine_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include +#include + +#include /* def of size_t */ +#include /* def of FILE * */ + +/** @ingroup CODECENGINE */ +/*@{*/ + +/** + * @brief Name to pass to Diags_setMask() to enable logging for Engine + * functions. + * + * @par Example Usage: + * The following code turns on all Log statements in the Engine + * module. + * @code + * Diags_setMask(Engine_MODNAME "+EX1234567"); + * @endcode + * + * @remarks Using Diags_setMask() to enable Engine Logging must be called + * after CERuntime_init() (which creates and initializes the + * Engine trace mask) to have any effect. + */ +#define Engine_MODNAME "ti.sdo.ce.Engine" + +/** + * @brief Opaque handle to an engine. + */ +typedef struct Engine_Obj *Engine_Handle; + +/** + * @brief Engine error code + */ +typedef Int Engine_Error; + +#define Engine_EOK 0 /**< Success. */ +#define Engine_EEXIST 1 /**< Name does not exist. */ +#define Engine_ENOMEM 2 /**< Unable to allocate memory. */ +#define Engine_EDSPLOAD 3 /**< Unable to load the DSP. */ +#define Engine_ENOCOMM 4 /**< Unable to create a comm connection to + * the DSP. + */ +#define Engine_ENOSERVER 5 /**< Unable to locate the server on the DSP. */ +#define Engine_ECOMALLOC 6 /**< Unable to allocate communication buffer. */ +#define Engine_ERUNTIME 7 /**< Internal engine runtime failure. */ +#define Engine_ECODECCREATE 8 /**< Creation of the Codec failed. */ +#define Engine_ECODECSTART 9 /**< Start of the Codec failed. For codecs + * which are implemented as a thread, this + * implies that the codec thread of execution + * failed to start. + */ +#define Engine_EINVAL 10 /**< Bad paramater passed to method. */ +#define Engine_EBADSERVER 11 /**< Incompatible server specified. */ +#define Engine_ENOTAVAIL 12 /**< Service not available. */ +#define Engine_EWRONGSTATE 13 /**< Call can not be made at this time. */ +#define Engine_EINUSE 14 /**< Call can't be made at this time because + * a required name/resource is in use. + */ +#define Engine_ENOTFOUND 15 /**< Entity was not found. */ +#define Engine_ETIMEOUT 16 /**< Timeout-based operation timed out. */ + +/** @cond INTERNAL */ + +/** + * @brief Opaque handle to a node. + */ +typedef struct Engine_NodeObj *Engine_Node; + +/** + * @brief Special value for timeout parameter of Engine_callWait() + */ +#define Engine_FOREVER Comm_FOREVER + +/** @endcond */ + +/** + * @brief Attributes of an Engine + * + * @sa Engine_initAttrs(). + * @sa Engine_open(). + */ +typedef struct Engine_Attrs { + String procId; /**< id of the processor that runs the server; only + * needed in the case that there's more than one + * processor that can provide the same server. + */ +} Engine_Attrs; + +/** + * @brief Properties of an Engine algorithm + * + * @sa Engine_getAlgInfo() + */ +typedef struct Engine_AlgInfo { + Int algInfoSize; /**< Size of this structure. */ + String name; /**< Name of algorithm. */ + String *typeTab; /**< Inheritance hierarchy. */ + Bool isLocal; /**< If TRUE, run locally. */ +} Engine_AlgInfo; + +/** + * @brief Properties of an Engine algorithm. + * + * @remarks This structure is identical to Engine_AlgInfo except that the + * @c typeTab array of strings is replaced by a single string + * called @c types. The string, @c types, represents a ';' + * separated list of inheritance hierarchies of the algorithm, + * for example, + * "ti.sdo.ce.video.IVIDDEC;ti.sdo.ce.test.xvideo.IVIDE". + * + * @sa Engine_getAlgInfo2() + */ +typedef struct Engine_AlgInfo2 { + Int algInfoSize; /**< Size of this structure. */ + String name; /**< Name of algorithm. */ + String types; /**< Inheritance hierarchy. */ + Bool isLocal; /**< If TRUE, run locally. */ +} Engine_AlgInfo2; + +/** + * @brief Default engine attributes. + * + * @deprecated Engine_ATTRS is no longer recommended. Please use + * Engine_initAttrs() instead. + * + * @sa Engine_initAttrs() + */ +extern Engine_Attrs Engine_ATTRS; /**< Default attrs. */ + +/** @cond INTERNAL */ + +typedef Int Engine_Ctrl; + +#define Engine_CEXIT 0 +#define Engine_MAXSEGNAMELENGTH 32 + +/** @endcond */ + +/** + * @brief Engine Cacheable Memory types. + * + * @enumWarning + */ +typedef enum Engine_CachedMemType { + Engine_USECACHEDMEM_DEFAULT = -1, /**< Use default cache setting */ + Engine_USECACHEDMEM_NONCACHED = 0, /**< Use non-cached memory */ + Engine_USECACHEDMEM_CACHED = 1 /**< Use cached memory */ +} Engine_CachedMemType; + + +/* + * ======== Engine_AlgDesc ======== + */ +/** + * @brief Descriptor for an alg. This object can be passed to + * @c Engine_addAlg(), to dynamically add an alg to an engine. + * + * @sa Engine_initAlgDesc() + * @sa Engine_addAlg() + */ +typedef struct Engine_AlgDesc { + /** + * @brief The name of the algorithm. This is used by the application + * when instantiating an instance of the algorithm through one + * of the VISA APIs. + */ + String name; + + NODE_Uuid uuid; /**< Id of alg if running on remote target. No need + * to set this field. + */ + + /** + * @brief The address of the XDAIS alg function table. + * All XDAIS algorithms must define an IALG_Fxns structure that + * contains implementations of the IALG methods. This field + * is simply the address of this structure. + */ + IALG_Fxns *fxns; + + /** + * @brief The address of the IDMA3_Fxns function table, if the algorithm + * uses DMA. If the algorithm does not use DMA, this field should + * set to NULL. + * @idmaDeprecated + */ + Ptr idmaFxns; + + String *typeTab; /**< inheritance hierarchy - Do not modify. */ + + /** + * @brief If true, the algorithm will be instantiated on the + * "local" CPU. Otherwise the server will create an + * instance of the algorithm. + */ + Bool isLocal; + + /** + * @brief This id specifies which resource sharing group that this + * alg will be placed into. This 'group' concept + * is used by the framework to ensure algorithms in the + * same group don't pre-empt each other and corrupt the + * shared resources. + * This parameter will be ignored if @c isLocal is FALSE. + */ + Int groupId; + + Int rpcProtocolVersion; /**< Protocol version. Do not modify */ + + /** + * @brief Address of the XDAIS alg IRES Interface function table + * All XDAIS algorithms that use an IRES resource must define an + * IRES_Fxns structure containing the pointers to functions + * implementatng the IRES interface. + * If the algorithm does not use an IRES resource this field + * should be set to NULL. + */ + Ptr iresFxns; + + /** + * @brief Codec class configuration data, if any. + */ + Void *codecClassConfig; + + /** + * @brief Indicates the type of memory the alg's memory requests will + * be allocated from. + * The alg's memory will be allocated from cached memory, if + * memType = Engine_USECACHEDMEM_CACHED, + * from non-cached memory, if + * memType = Engine_USECACHEDMEM_NONCACHED, + * Otherwise, if + * memType = Engine_USECACHEDMEM_DEFAULT, + * memory allocations will be determined by the value of + * ti_sdo_ce_alg_Algorithm_useCache (cached, if TRUE, non-cached, + * if FALSE). + * + * @sa Engine_CachedMemType + */ + Engine_CachedMemType memType; /**< Memory type for alg's mem reqs. */ + + /** + * @brief A string idicating the type(s) of algorithm this is. + * This should be a ';' separated string of inherited types. + * In most cases, @c types will just be set to the VISA type + * defined in the Codec Engine algorithm interface header + * file included by the algorithm, depending on the XDM interface + * the algorithm implements. + * + * For example, if the algorithm implements the ISPHDEC1 + * interface as defined by XDM, @c types should be set + * to + * @c SPHDEC1_VISATYPE + * (defined as "ti.sdo.ce.speech1.ISPHDEC1" in the header file + * ti/sdo/ce/speech1/sphdec1.h). + * + * Another example to illustrate multiple typss specified in + * @c typss, if the algorithm implements the (made-up) + * interface, ti.sdo.ce.test.xvideo.IVIDE, which in turn + * implements the IVIDDEC interface, we could then set @c types + * to + * VIDDEC_VISATYPE";ti.sdo.ce.test.xvideo.IVIDE" + * or + * "ti.sdo.ce.test.xvideo.IVIDE;"VIDDEC_VISATYPE + */ + String types; +} Engine_AlgDesc; + + +/** + * @brief Name of function that a dynamically loaded codec must supply. + */ +#define Engine_GETALGDESCFXN "GetEngineAlgDesc" + +/* + * ======== Engine_DllAlgDesc ======== + * An alg that will be dynamically loaded must have a descriptor of this type. + */ +/** + * @brief Descriptor for a dynamically loaded alg. A dynamic library + * for a codec must export a function that fills in a structure + * of this type. + * + * @sa Engine_GetAlgDescFxn + */ +typedef struct Engine_DllAlgDesc { + /** + * @brief Pointer to codec's IALG_Fxns. This can not be NULL. + */ + IALG_Fxns *fxns; + + /** + * @brief Pointer to codec's IDMA3_Fxns table. If the codec does not + * use DMA, this should be NULL. + */ + Ptr idmaFxns; + + /** + * @brief Pointer to codec's IRES_Fxns function table. This should be + * NULL if the codec does not implement the IRES_Fxns. + */ + Ptr iresFxns; + + /** + * @brief Inheritance hierarchy of codec. This is a ';' separated + * string that lists the interfaces inherited by the code. For + * example: + * + * "ti.sdo.ce.speech1.ISPHDEC1" + * + * or, in the case where a test IVIDE interface inherits IVIDDEC: + * + * "ti.sdo.ce.video.IVIDDEC;ti.sdo.ce.test.xvideo.IVIDE" + * + */ + String types; + + /** + * @brief codec class config data, if any. + * + * @todo Figure out what this is. + */ + Void *codecClassConfig; +} Engine_DllAlgDesc; + + +/* + * ======== Engine_GetAlgDescFxn ======== + * A dynamically loaded codec library must supply a function of this type to + * get properties of the library's algorithm. + */ +/** + * @brief Prototype of function that must be supplied by a dynamic + * codec library to fill in a @c Engine_DllAlgDesc structure. + * + * @remarks This function will be called by @c Engine_addAlg() to fill + * in the dynamic codec's descriptor. + * + * @sa Engine_DllAlgDesc + */ +typedef Int (*Engine_GetAlgDescFxn)(Engine_DllAlgDesc *dllAlgDesc); + + +/* + * ======== Engine_Desc ======== + */ +/** + * @brief This structure is passed to @c Engine_add(), and contains + * parameters to specify an engine. + * + * @sa Engine_add() + * @sa Engine_open() + */ +typedef struct Engine_Desc { + String name; /**< Name of the Engine + * + * @remarks This must not be NULL + */ + Engine_AlgDesc *algTab; /**< No longer used, set to NULL */ + String remoteName; /**< Name of Server image, if applicable + * + * @remarks If this Engine has no remote + * algorithms, this can be NULL. + * + * @remarks On SysLink-based systems, this + * is the name of a file, and is + * passed unchanged to + * ProcMgr_load(). + */ + String memMap; /**< Name of a file containing the slave + * memory map + * + * @remarks If this Engine has no remote + * algorithms, this can be NULL. + * + * @remarks If the remote algorithms are + * on a Server whos MMU is not + * enabled, this can be NULL. + * + * @remarks The format of this file matches + * the SysLink format described at + * http://processors.wiki.ti.com/index.php/SysLink_MMU_Support + * + * @remarks If useExtLoader is FALSE, this + * field can be NULL. + */ + Bool useExtLoader; /**< Indicates whether the Server containing + * any remote algorithms will be loaded using + * an external loader (e.g. SysLink's + * slaveloader) + * + * @remarks If @c useExtLoader is TRUE, + * Engine_open() will not load + * the slave. + * + * @remarks If @c useExtLoader is FALSE, + * Engine_open() will load the + * Server with the file specified + * by @c remoteName. + */ + Int numAlgs; /**< No longer used, set to zero */ + Int heapId; /**< No longer used, set to zero */ +} Engine_Desc; + + +/** @cond INTERNAL */ + +/* + * ======== Engine_AlgCreateAttrs ======== + */ +typedef struct Engine_AlgCreateAttrs { + Bool useExtHeap; /**< Use a single external heap for alg's + * memory requests if TRUE, otherwise attempt + * to honor the alg's algAlloc() function for + * memory heap assignments. + */ + Int priority; /**< Alg instance priority (-1: use value from + * configuration). */ +} Engine_AlgCreateAttrs; + + +/* + * ======== Engine_Config ======== + */ +typedef struct Engine_Config { + Engine_Desc *engineTab; + String localEngine; +} Engine_Config; + +/* + * ======== Engine_MemStat ======== + * This structure must match Server_MemStat. + */ +typedef struct Engine_MemStat { + Char name[Engine_MAXSEGNAMELENGTH + 1]; /* Name of memory segment */ + Uint32 base; /* Base address of memory segment */ + Uint32 size; /* Original size of the memory segment. */ + Uint32 used; /* Number of bytes used. */ + Uint32 maxBlockLen; /* Size of the largest contiguous free block. */ +} Engine_MemStat; + +/* Default alg create attributes */ +extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS; + +/* + * ======== Engine_config ======== + */ +extern Engine_Config Engine_config; + +/** @endcond */ + + +/* + * ======== Engine_addStubFxns ======== + */ +/** + * @brief Register stub functions through which a remote algorithm + * can be called + * + * @param[in] fxnsName The name of the stub function table (e.g. + * "UNIVERSAL_STUBS") + * @param[in] fxns Address of stub function table + * (e.g. &UNIVERSAL_STUBS) + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @remarks This service is not necessary if you configure your Engine + * at build/config time using Engine.createFromServer(). + * When using Engine.createFromServer(), the appropriate + * alg-specific stubs are added to the system automatically. + * + * @remarks When on an RTOS (e.g. SYS/BIOS), the stubs registered are + * available to all Engines in the system. When on a HLOS + * (e.g. Linux, WinCE), the stubs registered are available to + * all Engines in the calling application's process. + * + * @remarks The symbol passed to the @c fxns argument can often be found + * in the class-specific VISA header file (e.g. UNIVERSAL_STUBS + * is declared in ti/sdo/ce/universal/universal.h). + * + * @remarks For example, to register "UNIVERSAL_STUBS" for use by an + * IUNIVERSAL-compliant algorithm at runtime, you can + * do the following: + * @code + * #include + * #include + * + * Engine_register("UNIVERSAL_STUBS", + * (IALG_Fxns *)&UNIVERSAL_STUBS); + * @endcode + * + * @retval Engine_EOK Success. + * @retval Engine_ENOMEM Memory allocation failed. + * + * @sa Engine_open() + */ +extern Engine_Error Engine_addStubFxns(String fxnsName, IALG_Fxns *fxns); + +/* + * ======== Engine_add ======== + */ +/** + * @brief Add an Engine to the database of engines that can be opened with + * Engine_open() + * + * @param[in] pDesc The handle of an Engine Descriptor object. + * Before setting the fields of pDesc, it must + * first be initialized with @c Engine_initDesc(). + * + * @retval Engine_EINVAL Bad parameter passed, such as @c pDesc = NULL, + * or @c pDesc->name = NULL. + * @retval Engine_EINUSE An engine with the name @c pDesc->name already + * exists. + * @retval Engine_ENOMEM A memory allocation failed. + * @retval Engine_EOK Success. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If the return value is Engine_EOK, Engine_open() can be + * called with @c pDesc->name. + * + * @par Example Usage: + * @code + * #include + * + * Engine_Desc desc; + * + * Engine_initDesc(&desc); + * + * desc.name = "myEngine"; + * desc.remoteName = "myServer.x64P"; + * Engine_add(&desc); + * @endcode + * + * @sa Engine_remove() + * @sa Engine_open() + */ +extern Engine_Error Engine_add(Engine_Desc *pDesc); + +/* + * ======== Engine_addAlg ======== + */ +/** + * @brief Dynamically add an algorithm to an Engine. + * + * @remarks If the Engine has not been opened, the name of the Engine is + * used, otherwise, a handle to the opened Engine. If the Engine + * has been opened, the added alg will only be accessible to the + * caller of this function. Either one or the other, but not + * both, of @c name and @c engine should be non-NULL. + * + * @param[in] name The name of the engine. @c name is + * specified in the engine configuration, or + * the name of an engine added with + * @c Engine_add(). This can only be non-NULL if + * the engine is not opened, otherwise, use + * an engine handle and set @c name to NULL. + * @param[in] engine The handle of an engine returned by + * Engine_open(). If @c engine is non-NULL, set + * @c name to NULL. + * @param[in] location String identifying the location of the + * algorithm. Often this is a file name, but for + * systems without a file system, it may be a + * system-specific string identifier. This may + * be NULL if the algorithm is built into the + * executable. + * @param[in] pAlgDesc Parameters describing the algorithm being + * added. Before setting the fields of this + * structure, it should first be initialized + * with @c Engine_initAlgDesc(), to set all + * fields to default values. + * If location is non-NULL (a dynamic library), + * then the following fields of pAlgDesc must + * be specified: + * pAlgDesc->name + * pAlgDesc->isLocal + * pAlgDesc->groupId + * All other Engine_AlgDesc fields will be + * from the dynamic library. + * If location is NULL (not a dynamic library), + * the user must set the following fields of + * pAlgDesc: + * pAlgDesc->name + * pAlgDesc->fxns + * pAlgDesc->idmaFxns, if applicable + * pAlgDesc->iresFxns, if applicable + * pAlgDesc->isLocal + * pAlgDesc->groupId + * pAlgDesc->types + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @pre @c engine is a valid (non-NULL) engine handle which is + * in the open state. + * + * @remarks If there is an existing algorithm in the engine already named + * @c name, an error will be returned. + * + * @retval Engine_EOK Success. + * @retval Engine_EINUSE The Engine @c name is non-NULL, and the + * Engine is open. + * @retval Engine_EINVAL @c pAlgDesc or @c pAlgDesc->name is NULL. + * @retval Engine_EINVAL Both @c name and @c engine are NULL. Ensure + * one of these is non-NULL. + * @retval Engine_EINVAL Both @c name and @c engine are non-NULL. + * Ensure that one of these is NULL. + * @retval Engine_EEXIST There is no engine with the given name. + * @retval Engine_EINUSE The name of the alg in @c pAlgDesc->name is + * already in use. + * @par Example Usage: + * @code + * #include + * + * Engine_AlgDesc desc; + * + * Engine_initAlgDesc(&desc); + * + * desc.groupId = 2; + * desc.isLocal = TRUE; + * desc.fxns = &UNIVERSALCOPY_TI_IUNIVERSALCOPY; + * desc.idmaFxns = NULL; + * desc.iresFxns = NULL; + * desc.memType = Engine_USECACHEDMEM_DEFAULT; + * desc.types = UNIVERSAL_VISATYPE; + * + * status = Engine_addAlg("myEngine", NULL, NULL, &desc); + * + * @endcode + * + * @sa Engine_initAlgDesc() + * @sa Engine_open() + * @sa Engine_removeAlg() + */ +extern Engine_Error Engine_addAlg(String name, Engine_Handle engine, + String location, Engine_AlgDesc *pAlgDesc); + +/* + * ======== Engine_removeAlg ======== + */ +/** + * @brief Dynamically remove an algorithm that was added to an Engine + * with Engine_addAlg(). + * + * @remarks The same values of the parameters @c name and @c engine that + * were passed to Engine_addAlg() should be used here. In + * particular, if @c name was used to add the alg, all handles to + * the engine must be closed before calling Engine_removeAlg(). + * + * + * @param[in] name The name of the engine or NULL, that was + * passed to Engine_addAlg(). + * @param[in] engine The handle to an engine, previously acquired + * by a call to Engine_open(), or NULL, that was + * used in Engine_addAlg(). + * @param[in] algName Name of the algorithm to remove. + * + * @retval Engine_EOK Success. + * @retval Engine_EEXIST The engine @c name does not exist. + * @retval Engine_ENOTFOUND @c algName could not be found in @c engine. + * @retval Engine_EINUSE The Engine @c name is still open. + * + * @sa Engine_open() + * @sa Engine_addAlg() + */ +extern Engine_Error Engine_removeAlg(String name, Engine_Handle engine, + String algName); + +/** @cond INTERNAL */ + +/* + * ======== Engine_call ======== + */ +extern Int Engine_call(Engine_Node node, Comm_Msg *msg); + +/* + * ======== Engine_callAsync ======== + */ +extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg); + +/* + * ======== Engine_callWait ======== + */ +extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout); + +/* + * ======== Engine_ctrlNode ======== + */ +extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code); + +/** @endcond */ + +/* + * ======== Engine_close ======== + */ +/** + * @brief Close an Engine + * + * @param[in] engine The handle to an engine, previously acquired + * by a call to Engine_open(). + * + * @pre @c engine must not be referenced by any algorithm instance + * objects; i.e., you must first delete all algorithm instances + * associated with @c engine before closing it. + * + * @pre @c engine is a valid (non-NULL) engine handle which is + * in the open state. + * + * @sa Engine_open() + */ +extern Void Engine_close(Engine_Handle engine); + +/** @cond INTERNAL */ +/* + * ======== Engine_createNode ======== + */ +/** + * @brief Create a remote algorithm + * + * @param[in] engine The handle to an engine, previously acquired + * by a call to Engine_open(). + * @param[in] name Name of the algorithm to create. + * @param[in] msgSize Size of the internal message required to + * communicate with the remote algorithm. + * @param[in] nodeAttrs Creation parameters for the remote algorithm. + * @param[in] attrs Attributes used by the framework for creating + * the remote algorithm. + * + * @pre @c engine is a valid (non-NULL) engine handle which is + * in the open state. + * + * @remarks Engine_createNode2() was added after Engine_createNode() to + * support more use cases. Engine_createNode() is a wrapper + * around Engine_createNode2(), and is maintained for compatibility. + * + * @retval NULL Failure + * @retval non-NULL A handle to the created remote algorithm. + * + * @sa Engine_createNode2() + * @sa Engine_deleteNode() + */ +extern Engine_Node Engine_createNode(Engine_Handle engine, String name, + size_t msgSize, IALG_Params *nodeAttrs, Engine_AlgCreateAttrs *attrs); + + +/* + * ======== Engine_createNode2 ======== + */ +/** + * @brief Create a remote algorithm + * + * @param[in] engine The handle to an engine, previously acquired + * by a call to Engine_open(). + * @param[in] name Name of the algorithm to create. + * @param[in] msgSize Size of the internal message required to + * communicate with the remote algorithm. + * @param[in] nodeAttrs Creation parameters for the remote algorithm. + * @param[in] nodeAttrsSize Size of @c nodeAttrs. + * @param[in] attrs Attributes used by the framework for creating + * the remote algorithm. + * + * @pre @c engine is a valid (non-NULL) engine handle which is + * in the open state. + * + * @remarks Engine_createNode() is the preferred method to create remote + * algorithms. However, some algorithm interfaces incorrectly + * fail to provide a size field of type "Int" as the first field + * in their creation parameters, which the XDAIS spec defines. + * This service allows the creation of remote algorithms where the + * size of the creation params is specified "some other way" than + * the XDAIS spec defines. + * + * @retval NULL Failure + * @retval non-NULL A handle to the created remote algorithm. + * + * @sa Engine_createNode() + * @sa Engine_deleteNode() + */ +extern Engine_Node Engine_createNode2(Engine_Handle engine, String name, + size_t msgSize, IALG_Params *nodeAttrs, Int nodeAttrsSize, + Engine_AlgCreateAttrs *attrs); + + +/* + * ======== Engine_deleteNode ======== + */ +extern Void Engine_deleteNode(Engine_Node node); + +/* + * ======== Engine_getAlgMemRecs ======== + */ +/** + * @brief Get the IALG_MemRecs used by an algorithm + * + * @param[in] node Handle to an algorithm instance. + * @param[out] memTab Location to store the IALG_MemRecs. + * @param[in] size Maximum number of IALG_MemRecs to put in memTab array. + * @param[out] numRecs Actual number of IALG_MemRecs copied into memTab array. + * + * @retval Engine_EOK Success. + * @retval Engine_ERUNTIME Failure. + * + * @sa Engine_getAlgNumRecs() + */ +extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size, + Int *numRecs); + +/* + * ======== Engine_getAlgNumRecs ======== + */ +/** + * @brief Get the number of IALG_MemRecs used by a remote algorithm + * + * @param[in] node Handle to an algorithm instance. + * @param[out] numRecs Location to store the number of IALG_MemRecs used. + * + * @retval Engine_EOK Success. + * @retval Engine_ERUNTIME Failure. + * + * @sa Engine_getAlgMemRecs() + */ +extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs); + +/* + * ======== Engine_getConstName ======== + */ +extern String Engine_getConstName(Engine_Handle engine, String name, + String type); + +/* + * ======== Engine_getFxns ======== + */ +extern IALG_Fxns *Engine_getFxns(Engine_Handle svr, String name, String type, + Bool *isLocal, Ptr *idmaFxns, Ptr *iresFxns, Int *groupId, + Engine_CachedMemType *memType); + +/* + * ======== Engine_getMemId ======== + */ +extern Int Engine_getMemId(Engine_Handle engine); + +/* + * ======== Engine_getLocalEngine ======== + */ +extern Engine_Handle Engine_getLocalEngine(Void); + +/* + * ======== Engine_getEngine ======== + */ +extern Engine_Handle Engine_getEngine(Engine_Node node); + +/* + * ======== Engine_getMemStat ======== + */ +extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum, + Engine_MemStat *stat); + +/* + * ======== Engine_getNumMemSegs ======== + */ +extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs); + +/* + * ======== Engine_getNumEngines ======== + */ +extern Int Engine_getNumEngines(); + +/* + * ======== Engine_getProcId ======== + */ +extern String Engine_getProcId(Engine_Handle engine); + +/* + * ======== Engine_hasServer ======== + */ +extern Bool Engine_hasServer(Engine_Handle engine); + +/* + * ======== Engine_init ======== + */ +extern Void Engine_init(Void); + + +/** @endcond */ + +/* + * ======== Engine_initAlgDesc ======== + */ +/** + * @brief Initialize an Engine_AlgDesc structure with default values. + * + * @param[in] pAlgDesc Location of Engine_AlgDesc object to initialize. + * The fields of pAlgDesc will be set to the following: + * + * pAlgDesc->name = NULL; + * pAlgDesc->uuid.data = 0; + * pAlgDesc->fxns = NULL; + * pAlgDesc->idmaFxns = NULL; + * pAlgDesc->typeTab = NULL; + * pAlgDesc->isLocal = TRUE; + * pAlgDesc->groupId = 0; + * pAlgDesc->rpcProtocolVersion = 0; + * pAlgDesc->iresFxns = NULL; + * pAlgDesc->codecClassConfig = NULL; + * pAlgDesc->memType = Engine_USECACHEDMEM_DEFAULT; + * pAlgDesc->types = NULL; + * + * @sa Engine_addAlg() + */ +extern Void Engine_initAlgDesc(Engine_AlgDesc *pAlgDesc); + +/* + * ======== Engine_initAttrs ======== + */ +/** + * @brief Initialize an Engine_Attrs structure with default values. + * + * @param[in] pAttrs Location of Engine_Attrs object to initialize. + * + * @sa Engine_open() + */ +extern Void Engine_initAttrs(Engine_Attrs *pAttrs); + +/* + * ======== Engine_initDesc ======== + */ +/** + * @brief Initialize an Engine_Desc structure with default values. + * + * @param[in] pDesc Location of Engine_Desc object to initialize. + * The fields of pDesc will be set to the following: + * + * pDesc->name = NULL; + * pDesc->remoteName = NULL; + * pDesc->heapId = 0; + * + * @sa Engine_add() + */ +extern Void Engine_initDesc(Engine_Desc *pDesc); + +/** @cond INTERNAL */ + +/* + * ======== Engine_getRemoteVisa ======== + */ +extern UInt32 Engine_getRemoteVisa(Engine_Node node); + +/* + * ======== Engine_getCodecClassConfig ======== + */ +extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name, + String type); + +/* + * ======== Engine_getNodeQueues ======== + */ +extern Void Engine_getNodeQueues(Engine_Node node, Comm_Id *stdIn, Comm_Handle *stdOut); + + +/* + * ======== Engine_initFromServer ======== + */ +extern Engine_Error Engine_initFromServer(Engine_Handle engine); + + +/* + * ======== Engine_redefineHeap ======== + */ +extern Engine_Error Engine_redefineHeap(Server_Handle server, String name, + Uint32 base, Uint32 size); + +/* + * ======== Engine_releaseTraceToken ======== + */ +extern Bool Engine_releaseTraceToken(Server_Handle server); + +/* + * ======== Engine_requestTraceToken ======== + */ +extern Engine_Error Engine_requestTraceToken(Server_Handle server); + +/* + * ======== Engine_restoreHeap ======== + */ +extern Engine_Error Engine_restoreHeap(Server_Handle server, String name); + +/** @endcond */ + +/* + * ======== Engine_open ======== + */ +/** + * @brief Open an Engine + * + * The handle returned may be used to create one or more instances of an + * algorithm contained in the specified Engine. + * + * An Engine may be opened more than once; each open returns a unique + * handle that can be used to create algorithm instances or get status of the + * Engine. + * + * Engine handles must not be concurrently accessed by multiple threads; each + * thread must either obtain its own handle (via Engine_open()) or explicitly + * serialize access to a shared handle. + * + * @param[in] name The name of the engine to open. @c name is + * specified in the engine configuration. + * @param[in] attrs Attributes for the open engine. + * @param[out] ec Optional output error code + * + * @retval NULL An error has occurred. + * @retval non-NULL The handle to the opened engine. + * + * @pre @c name is a non-NULL string. + * + * @pre @c name is a valid, pre-configured name of an engine. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If the return handle is NULL and @c ec is non-NULL, @c *ec + * is set to a non-zero value indicating the cause of the failure. + * + * @post If @c ec is non-NULL, the Engine_Error value is set to one of + * the following values: + * - #Engine_EOK success + * - #Engine_EEXIST name does not exist + * - #Engine_ENOMEM can't allocate memory + * - #Engine_EDSPLOAD can't load the DSP + * - #Engine_ENOCOMM can't create a comm connection to DSP + * - #Engine_ENOSERVER can't locate the server on the DSP + * - #Engine_ECOMALLOC can't allocate communication buffer + * + * @sa Engine_close() + * @sa Engine_add() + * @sa Engine_remove() + */ +extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs, + Engine_Error *ec); + +/* + * ======== Engine_fwriteTrace ======== + */ +/** + * @brief Write Server's trace buffer to specifed file stream + * + * @param[in] engine The handle to the opened engine. + * + * @param[in] prefix A string to prepend to each line output; this + * allows one to easily identify trace from the + * server from the application's trace, for + * example. + * @param[in] out A open FILE stream used to output the + * Server's trace characters. + * + * @retval Integer number of characters copied to the specified + * FILE stream. + * + * @pre @c engine is a valid (non-NULL) engine handle and the engine + * is in the open state. + * + * @post In the event a negative value is returned, + * Engine_getLastError() will return one of the following values: + * - #Engine_ERUNTIME Either an internal runtime error + * occured or the underlying server + * error occured. + * - #Engine_EINUSE Server trace resource is already in use. + */ +extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out); + +/* + * ======== Engine_getAlgInfo ======== + */ +/** + * @brief Get details of an algorithm configured into an engine + * + * @param[in] name The name of the engine. @c name is + * specified in the engine configuration. + * @param[out] algInfo Structure to store algorithm details. The + * @c algInfoSize field of this structure must + * be set to @c sizeof(Engine_AlgInfo) by the + * application. + * @param[out] index The index of the algorithm to get the information. + * + * @retval Engine_EOK Success. + * @retval Engine_EEXIST There is no engine with the given name. + * @retval Engine_ENOTFOUND @c index is greater than or equal to the + * total number of algorithms configured for + * the engine, or @c index < 0. + * @retval Engine_EINVAL The value of @c algInfoSize passed to this + * function does not match the CE library's + * @c sizeof(Engine_AlgInfo). + * + * @pre @c name is a non-NULL string. + * + * @pre @c algInfo is non-NULL. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If @c name is a valid engine name and 0 <= @c index < the + * total number of algorithms configured for the engine, then + * @c algInfo will contain the information for the engine's + * ith (i = @c index) algorithm. + * + * @sa Engine_getNumAlgs() + */ +extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo, + Int index); + +/* + * ======== Engine_getAlgInfo2 ======== + */ +/** + * @brief Get details of an algorithm. + * + * @param[in] name The name of the engine. @c name is + * specified in the engine configuration. This + * may be NULL if @c engine contains a valid + * engine handle. + * @param[in] engine The handle of an engine returned by Engine_open(). + * If this is NULL, only information for a static + * alg can be obtained. + * @param[out] algInfo2 Structure to store algorithm details. The + * @c algInfoSize field of this structure must + * be set to @c sizeof(Engine_AlgInfo2) by the + * application. + * @param[out] index The index of the algorithm to get the information. + * + * @retval Engine_EOK Success. + * @retval Engine_EEXIST There is no engine with the given name. + * @retval Engine_ENOTFOUND @c index is greater than or equal to the + * total number of algorithms configured for + * the engine, or @c index < 0. + * @retval Engine_EINVAL The value of @c algInfoSize passed to this + * function does not match the CE library's + * @c sizeof(Engine_AlgInfo2). + * + * @pre @c name is a non-NULL string or @c engine is non-NULL. + * + * @pre @c algInfo2 is non-NULL. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If @c name is a valid engine name and 0 <= @c index < the + * total number of algorithms configured for the engine, then + * @c algInfo2 will contain the information for the engine's + * ith (i = @c index) algorithm. + * + * @remarks This service supports algorithms statically configured into + * an Engine at build/config time, or algorithms that have been + * dynamically added to an opened engine. If the Engine has not + * been opened yet, the name of the Engine is used to get the + * statically configured alg. If the Engine has been opened, the + * Engine handle can be used to get either information for a + * statically configured alg, or a remote alg that was added when + * the server was queried during Engine_open(). + * + * @sa Engine_getNumAlgs2(). + */ +extern Engine_Error Engine_getAlgInfo2(String name, Engine_Handle engine, + Engine_AlgInfo2 *algInfo2, Int index); + + +/** @cond INTERNAL */ +/* + * ======== Engine_getCpuLoad ======== + */ +/** + * @brief Get Server's cpu usage in percent + * + * @deprecated This service has been replaced by Server_getCpuLoad() + * to better indicate that this API is not intended for + * obtaining the current processor's CPU load, rather it + * obtains the CPU load of a remote Server. + * + * @param[in] engine The handle to the opened engine. + * + * @retval integer between 0-100 indicating percentage + * of time the Server is processing measured + * over a period of approximately 1 second. If + * the load is unavailable, a negative value is + * returned. + * + * @pre @c engine is a valid (non-NULL) engine handle and the engine + * is in the open state. + * + * @post In the event a negative value is returned, + * Engine_getLastError() will return one of the following values: + * - #Engine_ERUNTIME Either an internal runtime error + * occured or the underlying server + * error occured. + * - #Engine_ENOTAVAIL The CPU load can not be computed. + * + * @sa Server_getCpuLoad() + */ +extern Int Engine_getCpuLoad(Engine_Handle engine); + +/** @endcond */ + + +/* + * ======== Engine_getDesc ======== + */ +/** + * @brief Fill in an Engine_Desc structure with the values of the + * Engine descriptor for an Engine. + * + * @param[in] name The name of the Engine. @c name is + * specified in the engine configuration or a + * a name that was passed to @c Engine_add(). + * @param[out] desc The structure where the descriptor of the + * Engine specified by @c name will be copied to. + * + * @retval Engine_EOK Success. + * @retval Engine_EEXIST There is no engine with the given name. + * + * @pre @c name is a non-NULL string. + * + * @pre @c desc is non-NULL. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If @c name is a valid engine name, then desc will contain + * the descriptor of the engine @c name. + * + * @sa Engine_setDesc(). + */ +extern Engine_Error Engine_getDesc(String name, Engine_Desc *desc); + +/* + * ======== Engine_getLastError ======== + */ +/** + * @brief Get error code of the last failed operation + * + * @param[in] engine The handle to the opened engine. + * + * @retval error code (Engine_Error) of the last failed + * engine operation. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @pre @c engine is a valid (non-NULL) engine handle and the engine + * is in the open state. + */ +extern Engine_Error Engine_getLastError(Engine_Handle engine); + +/* + * ======== Engine_getName ======== + */ +/** + * @brief Get the name of an opened engine + * + * @param[in] engine The handle to the opened engine. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @retval NULL An error has occurred. + * @retval non-NULL The name of the opened engine. + */ +extern String Engine_getName(Engine_Handle engine); + + +/* + * ======== Engine_getNumAlgs ======== + */ +/** + * @brief Get the number of algorithms configured into an Engine + * + * @param[in] name The name of the Engine. @c name is + * specified in the engine configuration. + * @param[out] numAlgs The number of algorithms that are configured + * in the given engine. + * + * @retval Engine_EOK Success. + * @retval Engine_EEXIST There is no engine with the given name. + * + * @pre @c name is a non-NULL string. + * + * @pre @c numAlgs is non-NULL. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If @c name is a valid engine name, then numAlgs will contain + * the number of algorithms configured for the given engine. + * + * @sa Engine_getAlgs(). + */ +extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs); + +/* + * ======== Engine_getNumAlgs2 ======== + */ +/** + * @brief Get the number of algorithms statically configured into an engine + * or the total number of algorithms both statically configured and + * dynamically added through server information when the engine was + * opened. + * + * @param[in] name The name of the engine. @c name is + * specified in the engine configuration. @c name + * can be NULL, if @c engine is a valid + * Engine_Handle. + * @param[in] engine The handle of an engine returned by + * Engine_open(). If @c engine is NULL, @c name + * must be non-NULL, and only the number of + * statically configured algorithms will be + * returned in @c numAlgs. + * specified in the engine configuration. + * @param[out] numAlgs The number of algorithms that are configured + * in the given engine. + * + * @retval Engine_EOK Success. + * @retval Engine_EEXIST There is no engine with the given name. + * + * @pre @c name is a non-NULL string or @c engine is non-NULL. + * + * @pre @c numAlgs is non-NULL. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If @c name is a valid engine name, then numAlgs will contain + * the number of algorithms configured for the given engine. + * + * @remarks If the engine has a server, but was not configured with + * Engine.createFromServer() number of remote algorithms (if any) + * that were statically configured into the engine, will be + * counted twice: once for the static alg table, and once for + * the information queried from the server. + * + * @sa Engine_getAlgs(). + */ +extern Engine_Error Engine_getNumAlgs2(String name, Engine_Handle engine, + Int *numAlgs); + +/* + * ======== Engine_getServer ======== + */ +/** + * @brief Get handle to an Engine's Server + * + * This function returns the handle to an Engines server, that can be used + * with Server APIs to obtain information from and control the remote DSP + * server. + * + * @param[in] engine The handle to the opened engine. + * + * @retval Handle to engine's server. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @pre @c engine is a valid (non-NULL) engine handle and the engine + * is in the open state. + */ +extern Server_Handle Engine_getServer(Engine_Handle engine); + + +/* + * ======== Engine_getUsedMem ======== + */ +/** + * @brief Get Server's total memory usage + * + * @deprecated This service has been replaced by Server_getMemStat() + * to better indicate that this API is not intended for + * obtaining the current processor's memory statistics, + * rather it obtains the memory statistics of a remote + * Server. Also, Server_getMemStat() provides more granularity + * than Engine_getUsedMem(). + * + * @param[in] engine The handle to the opened engine. + * + * @retval Total amount of used memory (in MAUs). If the amount is not + * available, 0 is returned and the reason can be retrieved via + * Engine_getLastError(). + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @pre @c engine is a valid (non-NULL) engine handle and the engine + * is in the open state. + * + * @post in the event that 0 is returned, Engine_getLastError() will + * return one of the following values: + * - #Engine_ERUNTIME Either an internal runtime error + * occured or the underlying server + * error occured. + * - #Engine_ENOTAVAIL The memory usage can not be computed. + */ +extern UInt32 Engine_getUsedMem(Engine_Handle engine); + + +/* + * ======== Engine_remove ======== + */ +/** + * @brief Remove an engine from the list of engines that can be opened + * + * @param[in] engineName The name of the engine to be removed. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @pre @c engineName is non-NULL. + * + * @retval Engine_EINUSE The engine cannot be removed because + * an instance of it is still opened. + * @retval Engine_EEXIST No engine by this name exists. + * @retval Engine_EOK Success. + * + * @sa Engine_add() + */ +extern Engine_Error Engine_remove(String engineName); + + +/* + * ======== Engine_setDesc ======== + */ +/** + * @brief Set values for an Engine's descriptor. This function should + * only be called when the Engine has not yet been opened. + * + * @param[in] name The name of the Engine. @c name is + * specified in the engine configuration or a + * a name that was passed to @c Engine_add(). + * @param[in] desc The structure where descriptor values for the + * Engine specified by @c name will be copied + * from. + * + * @retval Engine_EOK Success. + * @retval Engine_EEXIST There is no engine with the given name. + * @retval Engine_EINUSE The Engine @c name has already been opened. + * + * @pre @c name is a non-NULL string. + * + * @pre @c desc is non-NULL. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @post If @c name is a valid engine name, then the desscriptor for + * the engine @c name will have been updated with values from + * @c desc. + * + * @remarks Use @c Engine_getDesc() to fill in the descriptor, override + * the fields you want to change, and then pass the descriptor + * to Engine_setDesc(). + * Only the following fields of the Engine_Desc are allowed to + * be modified: + * @c memMap + * @c useExtLoader + * @c heapId + * + * @sa Engine_getDesc(). + */ +extern Engine_Error Engine_setDesc(String name, Engine_Desc *desc); + + +/* + * ======== Engine_setTrace ======== + */ +/** + * @brief Set Server's trace mask + * + * @param[in] engine The handle to the opened engine. + * @param[in] mask Trace mask, e.g. "*=01234567" + * + * @retval Engine_ENOSERVER No server for this engine. + * @retval Engine_EINUSE Trace resource is already in use. + * @retval Engine_ERUNTIME Internal runtime error has occurred. + * + * @pre As with all Codec Engine API's, CERuntime_init() must have + * previously been called. + * + * @pre @c engine is a valid (non-NULL) engine handle and the engine + * is in the open state. + * + * @remarks This only sets the trace for a remote server. To change + * the trace mask for the application-side of the framework, + * use Diags_setMask(), or Diags_setMaskMeta(). + * + * @sa xdc.runtime.Diags + */ +extern Int Engine_setTrace(Engine_Handle engine, String mask); + + +/** @cond INTERNAL */ + +/* + * ======== Engine_getDesc ======== + * Internal for testing. + */ +extern Engine_Desc *_Engine_getDesc(Int i); + +/** @endcond */ + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:03; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/Server.h b/packages/codec_engine/ti/sdo/ce/Server.h new file mode 100644 index 0000000..447c3ef --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/Server.h @@ -0,0 +1,761 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== Server.h ======== + * DSP Server module + * + * APIs for accessing information from remote server. + */ + +/** + * @file ti/sdo/ce/Server.h + * + * @brief The Codec Engine Server Interface. Provides the user an + * inteface to open and manipulate a Server which contains + * remote algorithms. + */ +/** + * @addtogroup ti_sdo_ce_Server Codec Engine Server Interface + */ +#ifndef ti_sdo_ce_Server_ +#define ti_sdo_ce_Server_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include + +#include /* def of FILE * */ + +/** @ingroup ti_sdo_ce_Server */ +/*@{*/ + +/** + * @brief Name to pass to Diags_setMask() to enable logging for Server + * functions. For example, + * Diags_setMask(Server_MODNAME"+EX1234567"); + * turns on all Log statements in this module. + * Diags_setMask() must be called after initialization to take + * effect. + */ +#define Server_MODNAME "ti.sdo.ce.Server" + +/** + * @brief Maximum number of characters used in memory segment names. + */ +#define Server_MAXSEGNAMELENGTH 32 + +/** + * @brief Server error code + */ +typedef enum Server_Status { + Server_EOK = 0, /**< Success. */ + Server_ENOSERVER = 1, /**< Engine has no server. */ + Server_ENOMEM = 2, /**< Unable to allocate memory. */ + Server_ERUNTIME = 3, /**< Internal runtime failure. */ + Server_EINVAL = 4, /**< Bad value passed to function. */ + Server_EWRONGSTATE =5, /**< Server is not in the correct state to + * execute the requested function. */ + Server_EINUSE = 6, /**< Server call did not succeed because a + * because a required resource is in use. */ + Server_ENOTFOUND = 7, /**< An entity was not found */ + Server_EFAIL = 8, /**< Unknown failure */ + Server_ENOTSUPPORTED = 9 /**< API not supported for given parameters. */ +} Server_Status; + +/* + * ======== Server_AlgDesc ======== + */ +typedef struct Server_AlgDesc { + /** + * @brief The name of the algorithm. This is used by the application + * when instantiating an instance of the algorithm through one + * of the VISA APIs. + */ + String name; + + /** + * @brief The address of the XDAIS alg function table. + * + * @remarks + * All XDAIS algorithms must define an IALG_Fxns structure that + * contains implementations of the IALG methods. This field + * is simply the address of this structure. + */ + IALG_Fxns *fxns; + + /** + * @brief The address of the IDMA3_Fxns function table, if the algorithm + * uses DMA. If the algorithm does not use DMA, this field should + * set to NULL. Valid for local algorithm only. + */ + Ptr idmaFxns; + + /** + * @brief If true, the algorithm will be instantiated on the + * "local" CPU. Otherwise the server will create an + * instance of the algorithm. + */ + Bool isLocal; + + /** + * @brief This id specifies which resource sharing group that this + * alg will be placed into. + * + * @remarks + * This 'group' concept is used by the framework for sharing + * resources. Algorithms in the same group share resources, and + * therefore, must not run at the same time. If you assign the + * same groupId to multiple algorithms, these algorithms must + * not pre-empt eachother, or the shared resources may be + * corrupted. + * When server algorithms are configured statically in a .cfg + * file, if the @c groupId parameter for the algorithm has + * not been set, the configuration process assigns the @c groupId + * will be assigned automatically, based on the priority that + * the algorithm will run at. However, when Server_addAlg() is + * used to dynamically add the algorithm to the server, you must + * ensure that the @c groupId is appropriately. If two algorithms + * will run at the same time, you must assign them different + * group Ids. + * + * Algorithms in different groups do not share resources. + * + * @sa http://processors.wiki.ti.com/index.php/Codec_Engine_GroupIds + */ + Int groupId; + + /** + * @brief Address of the XDAIS alg IRES Interface function table. + * + * @remarks + * All XDAIS algorithms that use an IRES resource must define an + * IRES_Fxns structure containing the pointers to functions + * implementatng the IRES interface. + * If the algorithm does not use an IRES resource this field + * should be set to NULL. + */ + Ptr iresFxns; + + /* + * Currently not used. + * Codec class configuration data for stub side, if any. We + * generate this structure for both sides, although it is + * currently only used in the skeletons. + */ + Void *stubsCodecClassConfig; + + /** + * @brief Codec class configuration data, if any. + */ + Void *codecClassConfig; + + /* + * Currently not used. + * Indicates the type of memory the alg's memory requests will + * be allocated from. + * The alg's memory will be allocated from cached memory, if + * memType = Engine_USECACHEDMEM_CACHED, + * from non-cached memory, if + * memType = Engine_USECACHEDMEM_NONCACHED, + * Otherwise, if + * memType = Engine_USECACHEDMEM_DEFAULT, + * memory allocations will be determined by the value of + * ti_sdo_ce_alg_Algorithm_useCache (cached, if TRUE, non-cached, + * if FALSE). + * + * @sa Engine_CachedMemType + */ + Engine_CachedMemType memType; /**< Memory type for alg's mem reqs. */ + + /** + * @brief A string idicating the type(s) of algorithm this is. + * This should be a ';' separated string of inherited types. + * + * @remarks + * In most cases, @c types will just be set to the VISA type + * defined in the Codec Engine algorithm interface header + * file included by the algorithm, depending on the XDM interface + * the algorithm implements. + * + * For example, if the algorithm implements the ISPHDEC1 + * interface as defined by XDM, @c types should be set + * to + * @c SPHDEC1_VISATYPE + * (defined as "ti.sdo.ce.speech1.ISPHDEC1" in the header file + * ti/sdo/ce/speech1/sphdec1.h). + * + * Another example to illustrate multiple typss specified in + * @c typss, if the algorithm implements the (made-up) + * interface, ti.sdo.ce.test.xvideo.IVIDE, which in turn + * implements the IVIDDEC interface, we could then set @c types + * to + * VIDDEC_VISATYPE";ti.sdo.ce.test.xvideo.IVIDE" + * or + * "ti.sdo.ce.test.xvideo.IVIDE;"VIDDEC_VISATYPE + */ + String types; + + /** + * @brief A string idicating the name of the stub functions. This is + * needed by remote apps that call Engine_initFromServer(). + */ + String stubFxnsName; + + /** + * @brief The skel functions needed to invoke the alg remotely + */ + SKEL_Fxns *skelFxns; + + /** + * @brief The priority the alg will run at. + */ + Int priority; + + /** + * @brief Algorithm stack size. + */ + Int stackSize; + + /* + * Currently not used. + * Memory heap for algorithm stack. + */ + Int stackSeg; +} Server_AlgDesc; + +/** + * @brief Information for a memory heap of a remote DSP server. + * + * @remarks Sizes are given in DSP data MAUs. + * @sa Server_getMemStat(). + * + */ +typedef struct Server_MemStat { + Char name[Server_MAXSEGNAMELENGTH + 1]; /**< Name of memory heap. */ + Uint32 base; /**< Base address of the memory segment. */ + Uint32 size; /**< Original size of the memory segment. */ + Uint32 used; /**< Number of bytes used. */ + Uint32 maxBlockLen; /**< Length of the largest contiguous free block. */ +} Server_MemStat; + + +/* + * ======== Server_addAlg ======== + */ +/** + * @brief Dynamically add an algorithm to a Server. + * + * @param[in] server The handle of a server returned by + * Engine_getServer(). Set to NULL when adding + * a local algorithm to the server. In the + * future, this handle will be used to + * dynamically add algorithms to a remote server. + * @param[in] location String identifying the location of the + * algorithm. Often this is a file name, but for + * systems without a file system, it may be a + * system-specific string identifier. This may + * be NULL if the algorithm is built into the + * executable. Currently not supported - set to + * NULL. + * @param[in] pAlgDesc Parameters describing the algorithm being + * added. Before setting the fields of this + * structure, it should first be initialized + * with @c Server_initAlgDesc(), to set all + * fields to default values. + * + * The user must set the following fields of + * pAlgDesc: + * pAlgDesc->name + * pAlgDesc->fxns + * pAlgDesc->idmaFxns, if applicable + * pAlgDesc->iresFxns, if applicable + * + * pAlgDesc->groupId + * pAlgDesc->priority + * pAlgDesc->stackSize + * + * pAlgDesc->types + * pAlgDesc->stubFxnsName + * pAlgDesc->skelFxns + * + * Currently, adding only local algorithms is + * supported, so the default value of TRUE can + * be used for: + * pAlgDesc->isLocal + * + * @pre As with all Codec Server API's, CERuntime_init() must have + * previously been called. + * + * @remarks If adding a local algorithm to a server that is built with + * BIOS, this function must be called after CERuntime_init() + * has been called, but before BIOS_start(). This is necessary + * to ensure that the algorithm will be visible to the remote + * app that loaded the server. + * + * @remarks If adding a remote algorithm to a remote server, the server + * handle for the opened Engine must be used. The server handle + * is obtained by calling Engine_getServer() with the handle of + * the opened engine. + * In this case, the added algorithm will only be accessible to + * the caller of this function. + * Adding a remote algorithm is not yet supported. + * + * @remarks If there is an existing algorithm in the server already named + * @c name, an error will be returned. + * + * @retval Server_EOK Success. + * @retval Server_EINVAL @c pAlgDesc or @c pAlgDesc->name is NULL. + * @retval Server_EINUSE The name of the alg in @c pAlgDesc->name is + * already in use. + * @retval Server_ENOTSUPPORTED @c pAlgDesc->isLocal = FALSE is currently + * not supported. + * + * @par Example Usage: + * @code + * #include + * + * Server_AlgDesc desc; + * + * Server_initAlgDesc(&desc); + * + * desc.groupId = 2; + * desc.isLocal = TRUE; + * desc.fxns = &UNIVERSALCOPY_TI_IUNIVERSALCOPY; + * desc.idmaFxns = NULL; + * desc.iresFxns = NULL; + * desc.priority = 2; + * desc.stackSize = 0x2000; + * desc.types = UNIVERSAL_VISATYPE; + * desc.stubFxnsName = "UNIVERSAL_STUBS"; + * desc.skelFxns = &UNIVERSAL_SKEL; + * + * status = Server_addAlg(NULL, NULL, &desc); + * + * @endcode + * + * @sa Server_AlgDesc + * @sa Server_initAlgDesc() + * @sa Engine_getServer() + */ +extern Server_Status Server_addAlg(Server_Handle server, String location, + Server_AlgDesc *pAlgDesc); + + +/* + * ======== Server_connectTrace ======== + */ +/** + * @brief Connect to server for purposes of collecting + * trace and/or LOG data. + * + * @param[in] server Server handle obtained from Engine_getServer(). + * + * @param[in] token Address to store connection token. This token + * should be specified in the companion call to + * Server_disconnectTrace(). + * + * @retval Server_EOK Success, trace token was acquired. + * @retval Server_EINUSE A connection for server trace is already + * established. + * @retval Server_ERUNTIME An internal runtime error occurred. + * + * @pre @c server is non-NULL. + * @pre @c token is non-NULL. + * + * @sa Server_disconnectTrace(). + * + */ +extern Server_Status Server_connectTrace(Server_Handle server, Int * token); + +/* + * ======== Server_disconnectTrace ======== + */ +/** + * @brief Disconnect from server when finished collecting + * trace and/or LOG data. + * + * @param[in] server Server handle obtained from Engine_getServer(). + * + * @param[in] token Connection token (as obtained from earlier, + * companion call to Server_connectTrace()). + * + * @retval Server_EOK Success. + * @retval Server_ERUNTIME An internal runtime error occurred. + * + * @pre @c server is non-NULL. + * + * @sa Server_connectTrace(). + * + */ +extern Server_Status Server_disconnectTrace(Server_Handle server, Int token); + +/* + * ======== Server_fwriteTrace ======== + */ +/** + * @brief Write Server's trace buffer to specifed file stream + * + * @param[in] server Server handle, obtained from Engine_getServer(). + * + * @param[in] prefix A string to prepend to each line output; this + * allows one to easily identify trace from the + * server from the application's trace, for + * example. + * @param[in] out An open FILE stream used to output the + * Server's trace characters. + * + * @retval Integer number of characters copied to the specified + * FILE stream. + * + * @pre @c server is non-NULL. + * @pre @c Corresponding engine is in the open state. + * + * @post In the event a negative value is returned, + * Engine_getLastError() will return the value: + * - #Engine_ERUNTIME Either an internal runtime error + * occured or the underlying server + * error occured. + */ +extern Int Server_fwriteTrace(Server_Handle server, String prefix, FILE *out); + +/* + * ======== Server_getCpuLoad ======== + */ +/** + * @brief Get Server's CPU usage in percent. + * + * @param[in] server Server handle, obtained from Engine_getServer(). + * + * @retval Integer between 0-100 indicating percentage + * of time the Server is processing measured + * over a period of approximately 1 second. If + * the load is unavailable, a negative value is + * returned. + * + * @pre @c server is non-NULL. + * + * @post In the event a negative value is returned, + * Engine_getLastError() will return one of the following values: + * - #Engine_ERUNTIME Either an internal runtime error + * occured or an underlying server + * error occured. + * - #Engine_EINVAL The Server handle is not valid. + * + */ +extern Int Server_getCpuLoad(Server_Handle server); + +/* + * ======== Server_getMemStat ======== + */ +/** + * @brief Get information on a memory heap segment of a remote DSP server. + * + * @param[in] server Server handle obtained from Engine_getServer(). + * @param[in] segNum The heap number of a segment on the DSP. + * @param[out] memStat Structure to store memory segment information. + * + * @retval Server_EOK Success. + * @retval Server_ENOTFOUND @c segNum is out of range. + * @retval Server_ERUNTIME Internal runtime error occurred. + * + * @pre @c server is non-NULL. + * @pre @c memStat is non-NULL. + * + * @post On success, memStat will contain information about the memory + * heap @c segNum on the DSP. + * + * @sa Server_getNumMemSegs(). + * + * @remarks This API only returns statistics for BIOS HeapMem heaps + * that have been statically configured into the server. + */ +extern Server_Status Server_getMemStat(Server_Handle server, Int segNum, + Server_MemStat *memStat); + +/* + * ======== Server_getNumMemSegs ======== + */ +/** + * @brief Get the number of memory heap segments of a remote DSP server. + * + * @param[in] server Server handle obtained from Engine_getServer(). + * @param[out] numSegs The number of heap segments of the DSP server. + * + * @retval Server_EOK Success. + * @retval Server_ERUNTIME Internal runtime error occurred. + * @retval Server_ENOSERVER Engine has no server. + * + * @pre @c server is non-NULL. + * @pre @c numSegs is non-NULL. + * + * @post On success, numSegs will contain the number of memory heaps + * on the DSP. + * + * @sa Server_getMemStat(). + * + * @remarks This API returns only the number of BIOS HeapMem heaps that + * have been statically configured into the server. + */ +extern Server_Status Server_getNumMemSegs(Server_Handle server, Int *numSegs); + +/** @cond INTERNAL */ +/* + * ======== Server_init ======== + */ +extern Void Server_init(Void); +/** @endcond */ + +/* + * ======== Server_initAlgDesc ======== + */ +/** + * @brief Initialize an Server_AlgDesc structure with default values. + * + * @param[in] pAlgDesc Location of Server_AlgDesc object to initialize. + * The fields of pAlgDesc will be set to the following: + * @code + * pAlgDesc->name = NULL; + * pAlgDesc->uuid.data = 0; + * pAlgDesc->fxns = NULL; + * pAlgDesc->idmaFxns = NULL; + * pAlgDesc->typeTab = NULL; + * pAlgDesc->isLocal = TRUE; + * pAlgDesc->groupId = 0; + * pAlgDesc->iresFxns = NULL; + * pAlgDesc->codecClassConfig = NULL; + * pAlgDesc->priority = 1; + * pAlgDesc->stackSize = 1024; + * pAlgDesc->types = NULL; + * pAlgDesc->stubFxnsName = NULL; + * pAlgDesc->skelFxns = NULL; + * + * Unused fields below are initialized to the + * following: + * + * pAlgDesc->rpcProtocolVersion = 0; + * pAlgDesc->memType = Engine_USECACHEDMEM_DEFAULT; + * pAlgDesc->stackSeg = 0; + * + * @endcode + * + * @sa Server_addAlg() + */ +extern Void Server_initAlgDesc(Server_AlgDesc *pAlgDesc); + +/* + * ======== Server_redefineHeap ======== + */ +/** + * @brief Set the base address and size of a remote DSP server heap. + * + * @remarks + * This API is used to move and/or resize a named heap of the remote DSP + * server. The address passed to this API is a DSP address and the + * memory from @c base to @c base + @c size must be contiguous in physical + * memory. The size of the heap should be given in DSP MADUs (minimum + * addressable data units). + * The name of the heap can be at most #Server_MAXSEGNAMELENGTH + * characters long. + * + * For example, in the case of DM644x, suppose that an application wants + * to allocate a block of memory on the GPP to be used by the DSP server + * for the memory segment named "DDRALGHEAP". A block of physically + * contiguous memory could be obtained by Memory_alloc() and the + * corresponding DSP address obtained with + * Memory_getBufferPhysicalAddress(). This DSP address and the size + * of the block could then be passed to Server_redefineHeap(). + * For example: + * + * @code + * Server_redefineHeap(server, "DDRALGHEAP", base, size); + * @endcode + * + * This function can only be called when there is no memory currently + * allocated in the heap (since the heap cannot be changed if it is being + * used). + * + * @param[in] server Server handle obtained from Engine_getServer(). + * @param[in] name Name of heap to be redefined. + * @param[in] base Base address for algorithm heap. + * @param[in] size Size (DSP MADUs) of new heap. + * + * @retval Server_EOK Success. + * @retval Server_ERUNTIME Internal runtime error occurred. + * @retval Server_ENOTFOUND No heap with the specified name was found. + * @retval Server_EINVAL Changing to the new base and size would + * cause an overlap with another heap. + * @retval Server_EINUSE Memory is currently allocated in the heap. + * + * @pre @c server is non-NULL. + * @pre @c base is a DSP address of a physically contiguous + * block of memory. + * @pre @c base is aligned on an 8-byte boundary. + * + * @post On success, the server's algorithm heap base will have been + * set to @c base, and the size will have been set to @c size. + * + * @sa Server_restoreHeap(). + * + * @remarks This API is not supported in Codec Engine 3.20. + */ +extern Server_Status Server_redefineHeap(Server_Handle server, String name, + Uint32 base, Uint32 size); + +#if 0 +/* + * ======== Server_removeAlg ======== + */ +/* + * Currently not implemented. + * + * @brief Dynamically remove an algorithm that was added to a Server + * with Server_addAlg(). + * + * @remarks The same values of the parameters @c name and @c server that + * were passed to Server_addAlg() should be used here. In + * particular, if @c name was used to add the alg, all handles to + * the engine named @c name must be closed before calling + * Server_removeAlg(). + * + * + * @param[in] name The name of the engine or NULL, that was + * passed to Server_addAlg(). Set to NULL for now. + * Currently, only the default "local" engine is + * supported. + * @param[in] server The handle to a server, previously acquired + * by a call to Engine_getServer(), or NULL. + * Set to NULL for now. In the future, this will + * be used to dynamically remove remote + * algorithms from a server. + * @param[in] algName Name of the algorithm to remove. + * + * @retval Server_EOK Success. + * @retval Server_ENOTFOUND The server's underlying engine, @c name, + * does not exist. + * @retval Server_ENOTFOUND @c algName could not be found in the + * server's underlying engine table. + * @retval Server_EINUSE The server's underlying engine, @c name, + * is still open. + * + * @sa Server_addAlg() + */ +extern Server_Status Server_removeAlg(String name, Server_Handle server, + String algName); +#endif + +/* + * ======== Server_restoreHeap ======== + */ +/** + * @brief Set the base address and size of a remote DSP server heap + * back to their original values. + * + * This function resets the base address and size of a named heap of + * the remote server, back to their values before the first call to + * Server_redefineHeap() was made. The name of the heap can be at most + * #Server_MAXSEGNAMELENGTH characters long, otherwise this function + * will return #Server_ENOTFOUND. + * + * As with Server_redefineHeap(), this function can only be called when + * no memory is currently allocated from the heap (as the heap cannot be + * changed if it is being used). + * + * @param[in] server Server handle obtained through Engine_getServer(). + * @param[in] name Name of the heap to be restored. + * + * @retval Server_EOK Success. + * @retval Server_ERUNTIME Internal runtime error occurred. + * @retval Server_ENOTFOUND No heap with the specified name was found. + * @retval Server_EINVAL Changing back to the original base and size + * would cause an overlap with another heap. + * @retval Server_EINUSE Memory is currently allocated in the heap. + * + * @pre @c server is non-NULL. + * + * @post On success, the server's algorithm heap base and size will + * have been reset to their original value. + * + * @sa Server_redefineHeap(). + * + * @remarks This API is not supported in Codec Engine 3.20. + */ +extern Server_Status Server_restoreHeap(Server_Handle server, String name); + +/* + * ======== Server_setTrace ======== + */ +/** + * @brief Set Server's trace mask + * + * @param[in] server Server handle obtained through Engine_getServer(). + * @param[in] mask Trace mask, e.g. "*=01234567" + * + * @retval Server_EOK Success. + * @retval Server_EINUSE A connection for server trace is already + * established. + * @retval Server_ENOSERVER No server for the engine. + * @retval Server_ERUNTIME Internal runtime error occurred. + * + * @pre @c server is non-NULL. + * @pre @c Corresponding engine is in the open state. + * + * @remarks This only sets the trace for a remote server. To change + * the trace mask for the application-side of the framework, + * use Diags_setMask or Diags_setMaskMeta. + * + * @sa xdc.runtime.Diags + */ +extern Int Server_setTrace(Server_Handle server, String mask); + +/*@}*/ /* ingroup */ + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:03; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/ServerDefs.h b/packages/codec_engine/ti/sdo/ce/ServerDefs.h new file mode 100644 index 0000000..ec773e0 --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/ServerDefs.h @@ -0,0 +1,76 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== ServerDefs.h ======== + * Defs for Server module + */ + +/** + * @file ti/sdo/ce/ServerDefs.h + * + * @brief The Codec Engine Server Definitions. + */ +/** + * @addtogroup ti_sdo_ce_Server Codec Engine Server Interface + */ +#ifndef ti_sdo_ce_ServerDefs_ +#define ti_sdo_ce_ServerDefs_ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Opaque handle to the server for an engine. + */ +typedef struct Server_Obj *Server_Handle; + + +/*@}*/ /* ingroup */ + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:03; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/ipc/Comm.h b/packages/codec_engine/ti/sdo/ce/ipc/Comm.h new file mode 100644 index 0000000..2e3877c --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/ipc/Comm.h @@ -0,0 +1,235 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== Comm.h ======== + */ +#ifndef ti_sdo_ce_ipc_Comm_ +#define ti_sdo_ce_ipc_Comm_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Name to pass to Diags_setMask() to enable logging for Comm + * functions. For example, + * Diags_setMask(Comm_MODNAME"+EX1234567"); + * turns on all Log statements in this module. + * Diags_setMask() must be called after initialization to take + * effect. + */ +#define Comm_MODNAME "ti.sdo.ce.ipc.Comm" + +#define Comm_GTNAME "OC" + +/* + * ======== Comm_MSGSIZE ======== + * Maximum size of communication buffers, defined by the configuration + * parameter in Global.xdc. + */ +extern UInt32 Comm_MSGSIZE; + +typedef UInt32 Comm_Id; + +/* + * ======== Comm_Handle ======== + */ +typedef struct Comm_Obj *Comm_Handle; + +/* + * ======== Comm_QType ======== + */ +typedef enum { + Comm_PEND, + Comm_CALL +} Comm_QType; + +/* + * ======== Comm_CallFxn ======== + */ +typedef Void (*Comm_CallFxn)(Ptr callHandle); + +/* + * ======== Comm_Attrs ======== + */ +typedef struct Comm_Attrs { + Comm_QType type; + Ptr callHandle; + Comm_CallFxn callFxn; +} Comm_Attrs; + +extern Comm_Attrs Comm_ATTRS; /* default attrs */ + +/* + * ======== Comm_MsgHeader ======== + * Comm header must be defined, but its fields are irrelevant for the user + * Note: this header must be larger than all underlying msgq implementations + * (which require a header to maintain message control/transport information) + */ +typedef struct Comm_MsgHeader { + UInt32 reserved[2]; /* reserved[0] doubles as "next" in the linked list */ + UInt32 size; /* UInt32 msgSize; */ + UInt16 reserved1; /* UInt16 flags; */ + UInt16 msgId; /* UInt16 msgId; */ + UInt16 reserved3; /* UInt16 dstId; */ + UInt16 reserved4; /* UInt16 dstProc; */ + UInt16 reserved5; /* UInt16 replyId; */ + UInt16 reserved6; /* UInt16 replyProc; */ + UInt16 reserved7; /* UInt16 srcProc; */ + UInt16 reserved8; /* UInt16 heapId; */ + UInt16 reserved9; /* UInt16 seqNum; */ + UInt32 reserved10; /* UInt32 reserved; */ +} Comm_MsgHeader, *Comm_Msg; + +/* + * ======== Comm_INVALIDMSGQ ======== + */ +#define Comm_INVALIDMSGQ 0xFFFF +#define Comm_INVALIDHANDLE NULL + +/* + * ======== error status codes ======== + */ +#define Comm_EOK 0 +#define Comm_EFAIL 1 +#define Comm_ETIMEOUT 2 + +/* + * ======== timeout values ======== + */ +#define Comm_FOREVER ((UInt)-1) +#define Comm_POLL ((UInt)0) + +/* + * ======== Comm_locate ======== + * Locate an existing communication queue + */ +extern Int Comm_locate(String queueName, Comm_Id *msgqId); + +/* + * ======== Comm_alloc ======== + * Allocate a message that can be sent to a communication queue + */ +extern Int Comm_alloc(UInt16 poolId, Comm_Msg *msg, UInt16 size); + +/* + * ======== Comm_free ======== + * Free a previously allocated (Comm_alloc) message + */ +extern Int Comm_free(Comm_Msg msg); + +/* + * ======== Comm_put ======== + * Send message to specified communication queue + */ +extern Int Comm_put(Comm_Id msgqId, Comm_Msg msg); + +/* + * ======== Comm_get ======== + * Recieve a message from the specified queue + */ +extern Int Comm_get(Comm_Handle comm, Comm_Msg *msg, UInt timeout); + +/* + * ======== Comm_getMsgSize ======== + * Get size of the specified message + */ +extern Int Comm_getMsgSize(Comm_Msg msg); + +/* + * ======== Comm_getSrcQueue ======== + * Get id of sender queue from message + */ +extern Int Comm_getSendersId(Comm_Msg msg, Comm_Id *msgqId); + +/* + * ======== Comm_getId ======== + * Get MessageQ_QueueId from MessageQ_Handle + */ +extern Comm_Id Comm_getId(Comm_Handle comm); + +/* + * ======== Comm_staticMsgInit ======== + * Initialize fields of a static Comm_Msg. + */ +extern Void Comm_staticMsgInit(Comm_Msg msg, UInt32 size); + +/* + * ======== Comm_setSrcQueue ======== + * Put id of sender queue into message + */ +extern Void Comm_setReplyToHandle(Comm_Msg msg, Comm_Handle comm); + +/* + * ======== Comm_create ======== + * Create a new communication queue + */ +extern Comm_Handle Comm_create(String queueName, Comm_Attrs *myAttrs); + +/* + * ======== Comm_delete ======== + * its evil twin, the delete() function + */ +extern Void Comm_delete(Comm_Handle msgq); + +/* + * ======== Comm_init ======== + */ +extern Bool Comm_init(Void); + +/* + * ======== Comm_exit ======== + */ +extern Void Comm_exit(Void); + +/* + * ======== Comm_release ======== + */ +extern Int Comm_release(Comm_Id msgqId); + + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce.ipc; 2, 0, 1,3; 6-13-2013 00:15:57; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/node/node.h b/packages/codec_engine/ti/sdo/ce/node/node.h new file mode 100644 index 0000000..b71b9d1 --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/node/node.h @@ -0,0 +1,209 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== node.h ======== + * NODE module definitions. + */ +/** + * @file ti/sdo/ce/node/node.h + * + * @brief The Codec Engine Internal NODE API. + */ +/** + * @addtogroup ti_sdo_ce_NODE CE NODE API + */ + +#ifndef ti_sdo_ce_node_NODE_ +#define ti_sdo_ce_node_NODE_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup ti_sdo_ce_NODE */ +/*@{*/ + +/** @cond INTERNAL */ + +#define NODE_FOREVER (UInt)-1 /* infinite timeout (Comm_FOREVER) */ +#define NODE_TOGPP 0 /* GPP is the destination for message */ + +typedef struct NODE_Obj *NODE_EnvPtr; /* pointer to a node's environment */ + +typedef struct NODE_Config { + Int OBJSEG; /* allocate node instances from this MEM seg id */ + Int MSGQPOOLID; /* Segment to allocate message frames */ + Int FIXEDMSGSIZE; /* if >0, size NODE must use with Comm_alloc */ +} NODE_Config; + +extern NODE_Config *NODE; + +/* + * ======== NODE_Cmd ======== + */ +typedef struct NODE_Cmd { + Int id; + UArg arg1; + UArg arg2; +} NODE_Cmd; + +#define NODE_CCALL 0 /* "normal" call command id */ +#define NODE_CEXIT 1 /* exit command id */ + +/* + * ======== NODE_MsgHeader ======== + */ +typedef struct NODE_MsgHeader { + Comm_MsgHeader header; + NODE_Cmd cmd; +} NODE_MsgHeader; + +/* + * ======== NODE_Msg ======== + */ +typedef struct NODE_MsgHeader *NODE_Msg; + +/** + * @brief NODE error code + */ +typedef Int NODE_Status; + +#define NODE_EOK 0 /**< Success. */ +#define NODE_EOUTOFMEMORY 1 /**< Unable to allocate memory. */ +#define NODE_ERESOURCE 2 /**< Unable to obtain a necessary resource. */ +#define NODE_ETASK 3 /**< Unable to create a task. */ +#define NODE_EFAIL 4 /**< General error. */ + +/* The Node UUID structure */ +typedef struct NODE_Uuid { + UInt32 data; +} NODE_Uuid; + +/* + * ======== NODE_allocMsgBuf ======== + * Allocate a data buffer whose descriptor will be passed to the GPP within + * a message. + * + * Parameters: + * node: Node's environment. + * size: Size of buffer, in DSP MAUs. + * align: Buffer alignment. + * + * Returns: + * On Success: Address of the allocated buffer. + * On Failure: NULL. + * + */ +extern Ptr NODE_allocMsgBuf(NODE_EnvPtr node, UInt size, UInt align); + + +/* + * ======== NODE_freeMsgBuf ======== + * Free a data buffer previously allocated with NODE_allocMsgBuf. + * + * Parameters: + * node: Node's environment. + * addr: Address of the data buffer. + * size: Size of the allocated buffer, in DSP MAUs. + * + * Returns: + * On Success: TRUE. + * On Failure: FALSE. A failure occurs when the specified address does + * not reside in the memory segment used for allocations by + * NODE_allocMsgBuf(). + * + */ +extern Bool NODE_freeMsgBuf(NODE_EnvPtr node, Ptr addr, UInt size); + + +/* + * ======== NODE_getPri ======== + * Retrieve the task priority of a node. + * + * Parameters: + * node: Node's environment. + * + * Returns: + * taksPriority: the task priority set for the node + * + * Constraints: + * none + * + * Requires: + * node != NULL + * + */ +extern UInt NODE_getPri(NODE_EnvPtr node); + +/* + * ======== NODE_init ======== + */ +extern Void NODE_init(Void); + +/* + * ======== NODE_exit ======== + */ +extern Void NODE_exit(Void); + +/* + * ======== NODE_uuidMatch ======== + * + * Determine whether a uuid matches another. + * + */ +static inline Bool NODE_uuidMatch(NODE_Uuid *uuid1, NODE_Uuid *uuid2) +{ + return (uuid1->data == uuid2->data); +} + +/** @endcond */ + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce.node; 1, 0, 0,3; 6-13-2013 00:16:28; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/skel.h b/packages/codec_engine/ti/sdo/ce/skel.h new file mode 100644 index 0000000..58cde54 --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/skel.h @@ -0,0 +1,137 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== skel.h ======== + */ +/** + * @file ti/sdo/ce/skel.h + * + * @brief The Codec Engine System Programming Interface (SPI) for + * skeleton developers. + */ +/** + * @addtogroup ti_sdo_ce_SKEL CE Skeleton SPI + */ + +#ifndef ti_sdo_ce_SKEL_ +#define ti_sdo_ce_SKEL_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** @ingroup ti_sdo_ce_SKEL */ +/*@{*/ + +/** + * @brief Prototype for a skeleton's call() implementation + * + * @param[in] handle A handle to the current skeleton. + * @param[in] msg A message sent by the algorithm's stub + */ +typedef VISA_Status (*SKEL_CALLFXN)(VISA_Handle handle, VISA_Msg msg); + +/** + * @brief Prototype for a skeleton's create() API. + * + * @param[in] reserved Reserved. + * @param[in] name Name of the algorithm to create. + * @param[in] params Creation parameters for the algorithm. + * + * @retval NULL Error, unable to create the algorithm. + * @retval non-NULL Handle to the successfully created algorithm. + */ +typedef VISA_Handle (*SKEL_CREATEFXN)(Void *reserved, String name, + Void *params); + +/** + * @brief Prototype for a skeleton's destroy() API. + * + * @param[in] handle A handle to the current skeleton. + * @param[in] msg A message sent by the algorithm's stub + */ +typedef Void (*SKEL_DESTROYFXN)(VISA_Handle handle); + + +/* + * ======== SKEL_Fxns ======== + */ +/** + * @brief Table of functions defining the interface of a skeleton. + */ +typedef struct SKEL_Fxns { + SKEL_CALLFXN call; /**< A skeleton's "call" implementation. */ + SKEL_CREATEFXN apiCreate; /**< A skeleton's "create" API. */ + SKEL_DESTROYFXN apiDestroy; /**< A skeleton's "destroy" API. */ +} SKEL_Fxns; + +/** @cond INTERNAL */ + +/** + * @brief Cache policies for managing i/o buffers. + */ +#define SKEL_LOCALBUFFERINVWB 0 +#define SKEL_WBINVALL 1 +#define SKEL_CACHENONE 2 + +/** + * @brief Cache policy that will be used by all skeletons for managing + * i/o buffers. This is auto-generated by Server.xdt. + */ +extern Int ti_sdo_ce_Server_skelCachingPolicy; + +#define SKEL_cachingPolicy ti_sdo_ce_Server_skelCachingPolicy + + +/** @endcond */ + + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _SKEL_ */ +/* + * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:04; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/video2/videnc2.h b/packages/codec_engine/ti/sdo/ce/video2/videnc2.h new file mode 100644 index 0000000..9f4041c --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/video2/videnc2.h @@ -0,0 +1,401 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== videnc2.h ======== + */ +/** + * @file ti/sdo/ce/video2/videnc2.h + * + * @brief The VIDENC2 video encoder interface. Provides the user an + * interface to create and interact with XDAIS algorithms that are + * compliant with the XDM-defined IVIDENC2 video encoder + * interface. + */ +/** + * @defgroup ti_sdo_ce_video2_VIDENC2 VIDENC2 - Video Encoder Interface + * + * This is the VIDENC2 video encoder interface. Several of the data + * types in this API are specified by the XDM IVIDENC2 interface; please see + * the XDM documentation for those details. + */ + +#ifndef ti_sdo_ce_video2_VIDENC2_ +#define ti_sdo_ce_video2_VIDENC2_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include +#include +#include + +/** @ingroup ti_sdo_ce_video2_VIDENC2 */ +/*@{*/ + +#define VIDENC2_EOK IVIDENC2_EOK /**< @copydoc IVIDENC2_EOK */ +#define VIDENC2_EFAIL IVIDENC2_EFAIL /**< @copydoc IVIDENC2_EFAIL */ + +/** @copydoc IVIDENC2_EUNSUPPORTED */ +#define VIDENC2_EUNSUPPORTED IVIDENC2_EUNSUPPORTED + +#define VIDENC2_ETIMEOUT VISA_ETIMEOUT /**< @copydoc VISA_ETIMEOUT */ +#define VIDENC2_FOREVER VISA_FOREVER /**< @copydoc VISA_FOREVER */ + + +/** + * @brief The VISA type + */ +#define VIDENC2_VISATYPE "ti.sdo.ce.video2.IVIDENC2" + +/** + * @brief Name of stub functions. Use this name when registering the + * VIDENC2_STUBS functions with Engine_addStubFxns. + * + * @sa Engine_addStubFxns + */ +#define VIDENC2_STUBSNAME "VIDENC2_STUBS" + + +/** + * @brief Opaque handle to a VIDENC2 codec. + */ +typedef VISA_Handle VIDENC2_Handle; + +/* The following are just wrapper typedefs */ + +/** @copydoc IVIDENC2_Params */ +typedef struct IVIDENC2_Params VIDENC2_Params; + +/** @copydoc IVIDENC2_InArgs */ +typedef IVIDENC2_InArgs VIDENC2_InArgs; + +/** @copydoc IVIDENC2_OutArgs */ +typedef IVIDENC2_OutArgs VIDENC2_OutArgs; + +/** @copydoc IVIDENC2_Cmd */ +typedef IVIDENC2_Cmd VIDENC2_Cmd; + +/** @copydoc IVIDENC2_DynamicParams */ +typedef IVIDENC2_DynamicParams VIDENC2_DynamicParams; + +/** @copydoc IVIDENC2_Status */ +typedef IVIDENC2_Status VIDENC2_Status; + +/** @cond INTERNAL */ + +/** + * @brief An implementation of the skel interface; the skeleton side + * of the stubs. + */ +extern SKEL_Fxns VIDENC2_SKEL; + +/** + * @brief Implementation of the IVIDENC interface that is run remotely. + */ +extern IVIDENC2_Fxns VIDENC2_STUBS; + +/** @endcond */ + +/** + * @brief Definition of IVIDENC2 codec class configurable parameters + * + * @sa VISA_getCodecClassConfig() + */ +typedef struct IVIDENC2_CodecClassConfig { + Bool manageInBufsPlaneDescCache[IVIDEO_MAX_NUM_PLANES]; + Bool manageInBufsMetaPlaneDescCache[IVIDEO_MAX_NUM_METADATA_PLANES]; + Bool manageOutBufsCache[XDM_MAX_IO_BUFFERS]; +} IVIDENC2_CodecClassConfig; + + +/* + * ======== VIDENC2_control ======== + */ +/** + * @brief Execute the control() method in this instance of a video + * encoder algorithm. + * + * @param[in] handle Handle to a created video encoder instance. + * @param[in] id Command id for XDM control operation. + * @param[in] params Runtime control parameters used for encoding. + * @param[out] status Status info upon completion of encode operation. + * + * @pre @c handle is a valid (non-NULL) video encoder handle + * and the video encoder is in the created state. + * + * @retval #VIDENC2_EOK Success. + * @retval #VIDENC2_EFAIL Failure. + * @retval #VIDENC2_EUNSUPPORTED The requested operation + * is not supported. + * + * @remark This is a blocking call, and will return after the control + * command has been executed. + * + * @remark If an error is returned, @c status->extendedError may + * indicate further details about the error. See + * #VIDENC2_Status::extendedError for details. + * + * @sa VIDENC2_create() + * @sa VIDENC2_delete() + * @sa IVIDENC2_Fxns::process() + */ +extern Int32 VIDENC2_control(VIDENC2_Handle handle, VIDENC2_Cmd id, + VIDENC2_DynamicParams *params, VIDENC2_Status *status); + + +/* + * ======== VIDENC2_create ======== + */ +/** + * @brief Create an instance of a video encoder algorithm. + * + * Instance handles must not be concurrently accessed by multiple threads; + * each thread must either obtain its own handle (via VIDENC2_create()) or + * explicitly serialize access to a shared handle. + * + * @param[in] e Handle to an opened engine. + * @param[in] name String identifier of the type of video encoder + * to create. + * @param[in] params Creation parameters. + * + * @retval NULL An error has occurred. + * @retval non-NULL The handle to the newly created video encoder + * instance. + * + * @remarks @c params is optional. If it's not supplied, codec-specific + * default params will be used. + * + * @remark Depending on the configuration of the engine opened, this + * call may create a local or remote instance of the video + * encoder. + * + * @codecNameRemark + * + * @sa Engine_open() + * @sa VIDENC2_delete() + */ +extern VIDENC2_Handle VIDENC2_create(Engine_Handle e, String name, + VIDENC2_Params *params); + + +/* + * ======== VIDENC2_delete ======== + */ +/** + * @brief Delete the instance of a video encoder algorithm. + * + * @param[in] handle Handle to a created video encoder instance. + * + * @remark Depending on the configuration of the engine opened, this + * call may delete a local or remote instance of the video + * encoder. + * + * @pre @c handle is a valid (non-NULL) handle which is + * in the created state. + * + * @post All resources allocated as part of the VIDENC2_create() + * operation (memory, DMA channels, etc.) are freed. + * + * @sa VIDENC2_create() + */ +extern Void VIDENC2_delete(VIDENC2_Handle handle); + + +/* + * ======== VIDENC2_process ======== + */ +/** + * @brief Execute the process() method in this instance of a video + * encoder algorithm. + * + * @param[in] handle Handle to a created video encoder instance. + * @param[in] inBufs A buffer descriptor containing input buffers. + * @param[out] outBufs A buffer descriptor containing output buffers. + * @param[in] inArgs Input Arguments. + * @param[out] outArgs Output Arguments. + * + * @pre @c handle is a valid (non-NULL) video encoder handle + * and the video encoder is in the created state. + * + * @retval #VIDENC2_EOK Success. + * @retval #VIDENC2_EFAIL Failure. + * @retval #VIDENC2_EUNSUPPORTED The requested operation + * is not supported. + * + * @remark Since the VIDENC2 decoder contains support for asynchronous + * buffer submission and retrieval, this API becomes known as + * synchronous in nature. + * + * @remark This is a blocking call, and will return after the data + * has been encoded. + * + * @remark The buffers supplied to VIDENC2_process() may have constraints + * put on them. For example, in dual-processor, shared memory + * architectures, where the codec is running on a remote + * processor, the buffers may need to be physically contiguous. + * Additionally, the remote processor may place restrictions on + * buffer alignment. + * + * @remark If an error is returned, @c outArgs->extendedError may + * indicate further details about the error. See + * #VIDENC2_OutArgs::extendedError for details. + * + * @sa VIDENC2_create() + * @sa VIDENC2_delete() + * @sa VIDENC2_control() + * @sa VIDENC2_processAsync() + * @sa VIDENC2_processWait() + * @sa IVIDENC2_Fxns::process() - the reflected algorithm interface, + * which may contain further usage + * details. + */ +extern Int32 VIDENC2_process(VIDENC2_Handle handle, IVIDEO2_BufDesc *inBufs, + XDM2_BufDesc *outBufs, VIDENC2_InArgs *inArgs, + VIDENC2_OutArgs *outArgs); + + +/* + * ======== VIDENC2_processAsync ======== + */ +/** + * @brief Perform asynchronous submission to this instance of a video + * decoder algorithm. + * + * @param[in] handle Handle to a created video decoder instance. + * @param[in] inBufs A buffer descriptor containing input buffers. + * @param[out] outBufs A buffer descriptor containing output buffers. + * @param[in] inArgs Input Arguments. + * @param[out] outArgs Output Arguments. + * + * @pre @c handle is a valid (non-NULL) video decoder handle + * and the video decoder is in the created state. + * + * @retval #VIDENC2_EOK Success. + * @retval #VIDENC2_EFAIL Failure. + * @retval #VIDENC2_EUNSUPPORTED Unsupported request. + * + * @remark This API is the asynchronous counterpart to the process() + * method. It allows for buffer and argument submission without + * waiting for retrieval. A response is retrieved using the + * VIDENC2_processWait() API. + * + * @remark The buffers supplied to VIDENC2_processAsync() may have + * constraints put on them. For example, in dual-processor, + * shared memory architectures, where the codec is running on a + * remote processor, the buffers may need to be physically + * contiguous. Additionally, the remote processor may place + * restrictions on buffer alignment. + * + * @sa VIDENC2_create() + * @sa VIDENC2_delete() + * @sa VIDENC2_control() + * @sa VIDENC2_process() + * @sa VIDENC2_processWait() + * @sa IVIDENC2_Fxns::process() + */ +extern XDAS_Int32 VIDENC2_processAsync(VIDENC2_Handle handle, + IVIDEO2_BufDesc *inBufs, XDM2_BufDesc *outBufs, + IVIDENC2_InArgs *inArgs, IVIDENC2_OutArgs *outArgs); + + +/* + * ======== VIDENC2_processWait ======== + */ +/** + * @brief Wait for a return message from a previous invocation of + * VIDENC2_processAsync() in this instance of an video decoder + * algorithm. + * + * @param[in] handle Handle to a created video decoder instance. + * @param[in] inBufs A buffer descriptor containing input buffers. + * @param[out] outBufs A buffer descriptor containing output buffers. + * @param[in] inArgs Input Arguments. + * @param[out] outArgs Output Arguments. + * @param[in] timeout Amount of "time" to wait (from 0 -> #VIDENC2_FOREVER) + * + * @pre @c handle is a valid (non-NULL) video decoder handle + * and the video decoder is in the created state. + * + * @retval #VIDENC2_EOK Success. + * @retval #VIDENC2_EFAIL Failure. + * @retval #VIDENC2_EUNSUPPORTED Unsupported request. + * @retval #VIDENC2_ETIMEOUT Operation timed out. + * + * @remark This is a blocking call, and will return after the data + * has been decoded. + * + * @remark "Polling" is supported by using a timeout of 0. Waiting + * forever is supported by using a timeout of #VIDENC2_FOREVER. + * + * @remark There must have previously been an invocation of the + * VIDENC2_processAsync() API. + * + * @remark The buffers supplied to VIDENC2_processAsync() may have + * constraints put on them. For example, in dual-processor, + * shared memory architectures, where the codec is running on a + * remote processor, the buffers may need to be physically + * contiguous. Additionally, the remote processor may place + * restrictions on buffer alignment. + * + * @sa VIDENC2_create() + * @sa VIDENC2_delete() + * @sa VIDENC2_control() + * @sa VIDENC2_process() + * @sa VIDENC2_processAsync() + */ +extern XDAS_Int32 VIDENC2_processWait(VIDENC2_Handle handle, + IVIDEO2_BufDesc *inBufs, XDM2_BufDesc *outBufs, IVIDENC2_InArgs *inArgs, + IVIDENC2_OutArgs *outArgs, UInt timeout); + + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce.video2; 1, 0, 3,3; 6-13-2013 00:20:38; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/video3/viddec3.h b/packages/codec_engine/ti/sdo/ce/video3/viddec3.h new file mode 100644 index 0000000..0272755 --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/video3/viddec3.h @@ -0,0 +1,396 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== viddec3.h ======== + */ +/** + * @file ti/sdo/ce/video3/viddec3.h + * + * @brief The VIDDEC3 video decoder interface. Provides the user an + * interface to create and interact with XDAIS algorithms that are + * compliant with the XDM-defined IVIDDEC3 video decoder + * interface. + */ +/** + * @defgroup ti_sdo_ce_video3_VIDDEC3 VIDDEC3 - Video Decoder Interface + * + * This is the VIDDEC3 video decoder interface. Several of the data + * types in this API are specified by the XDM IVIDDEC3 interface; please see + * the XDM documentation for those details. + */ + +#ifndef ti_sdo_ce_video3_VIDDEC3_ +#define ti_sdo_ce_video3_VIDDEC3_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include +#include +#include + +/** @ingroup ti_sdo_ce_video3_VIDDEC3 */ +/*@{*/ + +#define VIDDEC3_EOK IVIDDEC3_EOK /**< @copydoc IVIDDEC3_EOK */ +#define VIDDEC3_EFAIL IVIDDEC3_EFAIL /**< @copydoc IVIDDEC3_EFAIL */ + +/**< @copydoc IVIDDEC3_EUNSUPPORTED */ +#define VIDDEC3_EUNSUPPORTED IVIDDEC3_EUNSUPPORTED + +#define VIDDEC3_ETIMEOUT VISA_ETIMEOUT /**< @copydoc VISA_ETIMEOUT */ +#define VIDDEC3_FOREVER VISA_FOREVER /**< @copydoc VISA_FOREVER */ + +/** + * @brief The VISA type + */ +#define VIDDEC3_VISATYPE "ti.sdo.ce.video3.IVIDDEC3" + +/** + * @brief Name of stub functions. Use this name when registering the + * VIDDEC3_STUBS functions with Engine_addStubFxns. + * + * @sa Engine_addStubFxns + */ +#define VIDDEC3_STUBSNAME "VIDDEC3_STUBS" + + +/** + * @brief Opaque handle to a VIDDEC3 codec. + */ +typedef VISA_Handle VIDDEC3_Handle; + +/** @copydoc IVIDDEC3_Params */ +typedef struct IVIDDEC3_Params VIDDEC3_Params; + +/** @copydoc IVIDDEC3_InArgs */ +typedef IVIDDEC3_InArgs VIDDEC3_InArgs; + +/** @copydoc IVIDDEC3_OutArgs */ +typedef IVIDDEC3_OutArgs VIDDEC3_OutArgs; + +/** @copydoc IVIDDEC3_Cmd */ +typedef IVIDDEC3_Cmd VIDDEC3_Cmd; + +/** @copydoc IVIDDEC3_DynamicParams */ +typedef IVIDDEC3_DynamicParams VIDDEC3_DynamicParams; + +/** @copydoc IVIDDEC3_Status */ +typedef IVIDDEC3_Status VIDDEC3_Status; + + +/** @cond INTERNAL */ + +/** + * @brief An implementation of the skel interface; the skeleton side + * of the stubs. + */ +extern SKEL_Fxns VIDDEC3_SKEL; + +/** + * @brief Implementation of the IVIDDEC3 interface that is run remotely. + */ +extern IVIDDEC3_Fxns VIDDEC3_STUBS; + +/** @endcond */ + +/** + * @brief Definition of IVIDDEC3 codec class configurable parameters + * + * @sa VISA_getCodecClassConfig() + */ +typedef struct IVIDDEC3_CodecClassConfig { + Bool manageInBufsCache [ XDM_MAX_IO_BUFFERS ]; + Bool manageOutBufsCache [ XDM_MAX_IO_BUFFERS ]; +} IVIDDEC3_CodecClassConfig; + + +/* + * ======== VIDDEC3_control ======== + */ +/** + * @brief Execute the control() method in this instance of a video + * decoder algorithm. + * + * @param[in] handle Handle to a created video decoder instance. + * @param[in] id Command id for XDM control operation. + * @param[in] params Runtime control parameters used for decoding. + * @param[out] status Status info upon completion of decode operation. + * + * @pre @c handle is a valid (non-NULL) video decoder handle + * and the video decoder is in the created state. + * + * @retval #VIDDEC3_EOK Success. + * @retval #VIDDEC3_EFAIL Failure. + * @retval #VIDDEC3_EUNSUPPORTED Unsupported request. + * + * @remark This is a blocking call, and will return after the control + * command has been executed. + * + * @remark If an error is returned, @c status->extendedError may + * indicate further details about the error. See #XDM_ErrorBit + * for details. + * + * @sa VIDDEC3_create() + * @sa VIDDEC3_delete() + * @sa IVIDDEC3_Fxns::process() + */ +extern Int32 VIDDEC3_control(VIDDEC3_Handle handle, VIDDEC3_Cmd id, + VIDDEC3_DynamicParams *params, VIDDEC3_Status *status); + + +/* + * ======== VIDDEC3_create ======== + */ +/** + * @brief Create an instance of a video decoder algorithm. + * + * Instance handles must not be concurrently accessed by multiple threads; + * each thread must either obtain its own handle (via VIDDEC3_create) or + * explicitly serialize access to a shared handle. + * + * @param[in] e Handle to an opened engine. + * @param[in] name String identifier of the type of video decoder + * to create. + * @param[in] params Creation parameters. + * + * @retval NULL An error has occurred. + * @retval non-NULL The handle to the newly created video decoder + * instance. + * + * @remark @c params is optional. If it's not supplied, codec-specific + * default params will be used. + * + * @remark Depending on the configuration of the engine opened, this + * call may create a local or remote instance of the video + * decoder. + * + * @codecNameRemark + * + * @sa Engine_open() + * @sa VIDENC3_delete() + */ +extern VIDDEC3_Handle VIDDEC3_create(Engine_Handle e, String name, + VIDDEC3_Params *params); + + +/* + * ======== VIDDEC3_delete ======== + */ +/** + * @brief Delete the instance of a video decoder algorithm. + * + * @param[in] handle Handle to a created video decoder instance. + * + * @remark Depending on the configuration of the engine opened, this + * call may delete a local or remote instance of the video + * decoder. + * + * @pre @c handle is a valid (non-NULL) handle which is + * in the created state. + * + * @post All resources allocated as part of the VIDDEC3_create() + * operation (memory, DMA channels, etc.) are freed. + * + * @sa VIDDEC3_create() + */ +extern Void VIDDEC3_delete(VIDDEC3_Handle handle); + + +/* + * ======== VIDDEC3_process ======== + */ +/** + * @brief Execute the process() method in this instance of a video + * decoder algorithm. + * + * @param[in] handle Handle to a created video decoder instance. + * @param[in] inBufs A buffer descriptor containing input buffers. + * @param[out] outBufs A buffer descriptor containing output buffers. + * @param[in] inArgs Input Arguments. + * @param[out] outArgs Output Arguments. + * + * @pre @c handle is a valid (non-NULL) video decoder handle + * and the video decoder is in the created state. + * + * @retval #VIDDEC3_EOK Success. + * @retval #VIDDEC3_EFAIL Failure. + * @retval #VIDDEC3_EUNSUPPORTED Unsupported request. + * + * @remark Since the VIDDEC3 decoder contains support for asynchronous + * buffer submission and retrieval, this API becomes known as + * synchronous in nature. + * + * @remark This is a blocking call, and will return after the data + * has been decoded. + * + * @remark The buffers supplied to VIDDEC3_process() may have constraints + * put on them. For example, in dual-processor, shared memory + * architectures, where the codec is running on a remote + * processor, the buffers may need to be physically contiguous. + * Additionally, the remote processor may place restrictions on + * buffer alignment. + * + * @remark If an error is returned, @c outArgs->extendedError may + * indicate further details about the error. See #XDM_ErrorBit + * for details. + * + * @sa VIDDEC3_create() + * @sa VIDDEC3_delete() + * @sa VIDDEC3_control() + * @sa VIDDEC3_processAsync() + * @sa VIDDEC3_processWait() + * @sa IVIDDEC3_Fxns::process() + */ +extern Int32 VIDDEC3_process(VIDDEC3_Handle handle, XDM2_BufDesc *inBufs, + XDM2_BufDesc *outBufs, VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs); + + +#if 0 /* async not yet supported */ + +/* + * ======== VIDDEC3_processAsync ======== + */ +/** + * @brief Perform asynchronous submission to this instance of a video + * decoder algorithm. + * + * @param[in] handle Handle to a created video decoder instance. + * @param[in] inBufs A buffer descriptor containing input buffers. + * @param[out] outBufs A buffer descriptor containing output buffers. + * @param[in] inArgs Input Arguments. + * @param[out] outArgs Output Arguments. + * + * @pre @c handle is a valid (non-NULL) video decoder handle + * and the video decoder is in the created state. + * + * @retval #VIDDEC3_EOK Success. + * @retval #VIDDEC3_EFAIL Failure. + * @retval #VIDDEC3_EUNSUPPORTED Unsupported request. + * + * @remark This API is the asynchronous counterpart to the process() + * method. It allows for buffer and argument submission without + * waiting for retrieval. A response is retrieved using the + * VIDDEC3_processWait() API. + * + * @remark The buffers supplied to VIDDEC3_processAsync() may have + * constraints put on them. For example, in dual-processor, + * shared memory architectures, where the codec is running on a + * remote processor, the buffers may need to be physically + * contiguous. Additionally, the remote processor may place + * restrictions on buffer alignment. + * + * @sa VIDDEC3_create() + * @sa VIDDEC3_delete() + * @sa VIDDEC3_control() + * @sa VIDDEC3_process() + * @sa VIDDEC3_processWait() + * @sa IVIDDEC3_Fxns::process() + */ +extern XDAS_Int32 VIDDEC3_processAsync(VIDDEC3_Handle handle, + XDM1_BufDesc *inBufs, XDM_BufDesc *outBufs, + VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs); + +/* + * ======== VIDDEC3_processWait ======== + */ +/** + * @brief Wait for a return message from a previous invocation of + * VIDDEC3_processAsync() in this instance of an video decoder + * algorithm. + * + * @param[in] handle Handle to a created video decoder instance. + * @param[in] inBufs A buffer descriptor containing input buffers. + * @param[out] outBufs A buffer descriptor containing output buffers. + * @param[in] inArgs Input Arguments. + * @param[out] outArgs Output Arguments. + * @param[in] timeout Amount of "time" to wait (from 0 -> VIDDEC3_FOREVER) + * + * @pre @c handle is a valid (non-NULL) video decoder handle + * and the video decoder is in the created state. + * + * @retval #VIDDEC3_EOK Success. + * @retval #VIDDEC3_EFAIL Failure. + * @retval #VIDDEC3_EUNSUPPORTED Unsupported request. + * @retval #VIDDEC3_ETIMEOUT Operation timed out. + * + * @remark This is a blocking call, and will return after the data + * has been decoded. + * + * @remark "Polling" is supported by using a timeout of 0. Waiting + * forever is supported by using a timeout of VIDDEC3_EFOREVER. + * + * @remark There must have previously been an invocation of the + * VIDDEC3_processAsync() API. + * + * @remark The buffers supplied to VIDDEC3_processAsync() may have + * constraints put on them. For example, in dual-processor, + * shared memory architectures, where the codec is running on a + * remote processor, the buffers may need to be physically + * contiguous. Additionally, the remote processor may place + * restrictions on buffer alignment. + * + * @sa VIDDEC3_create() + * @sa VIDDEC3_delete() + * @sa VIDDEC3_control() + * @sa VIDDEC3_process() + * @sa VIDDEC3_processAsync() + */ +extern XDAS_Int32 VIDDEC3_processWait(VIDDEC3_Handle handle, + XDM1_BufDesc *inBufs, XDM_BufDesc *outBufs, + VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs, UInt timeout); + +#endif + + +/*@}*/ /* ingroup */ + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce.video3; 1, 0, 0,3; 6-13-2013 00:21:02; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/codec_engine/ti/sdo/ce/visa.h b/packages/codec_engine/ti/sdo/ce/visa.h new file mode 100644 index 0000000..820a734 --- /dev/null +++ b/packages/codec_engine/ti/sdo/ce/visa.h @@ -0,0 +1,690 @@ +/* + * Copyright 2013 by Texas Instruments Incorporated. + * + */ + +/* + * Copyright (c) 2013, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * ======== visa.h ======== + */ +/** + * @file ti/sdo/ce/visa.h + * + * @brief The Codec Engine System Programming Interface. Provides + * system developers with services necessary to implement + * stubs and skeletons. + */ +/** + * @addtogroup ti_sdo_ce_VISA_GEN VISA - Alg-independent user APIs + * + * Codec Engine Algorithm-independent shared definitions and services. + */ +/** + * @addtogroup ti_sdo_ce_VISA_STUB VISA - CE Stub SPIs + * + * Codec Engine System Programming Interface (SPI) for stub implementors. + */ +/** + * @addtogroup ti_sdo_ce_VISA_API VISA - CE interface SPIs + * + * Codec Engine System Programming Interface (SPI) for class interface + * implementors. + */ + +#ifndef ti_sdo_ce_VISA_ +#define ti_sdo_ce_VISA_ + +#include /* for size_t */ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief VISA result data type + * @ingroup ti_sdo_ce_VISA_GEN + */ +typedef Int VISA_Status; + +/** + * @brief Success. + * @ingroup ti_sdo_ce_VISA_GEN + */ +#define VISA_EOK 0 + +/** + * @brief Internal runtime error. + * @ingroup ti_sdo_ce_VISA_GEN + */ +#define VISA_ERUNTIME -1 + +/** + * @brief General system error. + * @ingroup ti_sdo_ce_VISA_GEN + */ +#define VISA_EFAIL -2 + +/** + * @brief The API is not suported for the given system configuration. + * @ingroup ti_sdo_ce_VISA_GEN + */ +#define VISA_EUNSUPPORTED -3 + +/** + * @brief Timeout occurred. + * @ingroup ti_sdo_ce_VISA_GEN + */ +#define VISA_ETIMEOUT -100 + +/** + * @brief Special value for timeout parameter indicating never timeout. + * @ingroup ti_sdo_ce_VISA_GEN + */ +#define VISA_FOREVER Engine_FOREVER + +/** + * @brief Name to pass to Diags_setMask() to enable logging for VISA + * functions. For example, + * Diags_setMask(VISA_MODNAME"+EX1234567"); + * turns on all Log statements in this module. + * Diags_setMask() must be called after initialization to take + * effect. + */ +#define VISA_MODNAME "ti.sdo.ce.VISA" + +/** + * @brief Opaque handle to a node. + */ +typedef struct VISA_Obj *VISA_Handle; + +/** + * @brief VISA message header. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @remarks This must be the first field in a message + */ +typedef struct VISA_MsgHeader { + NODE_MsgHeader header; + Int cmd; /**< Command id */ + VISA_Status status; /**< Return status */ +} VISA_MsgHeader; + +/* + * ======== VISA_Msg ======== + */ +typedef VISA_MsgHeader *VISA_Msg; + +/* + * ======== VISA_allocMsg ======== + */ +/** + * @brief Obtain an algorithm instance's message. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @param[in] visa Handle to an algorithm instance. + * + * @retval NULL General system error + * @retval non-NULL The remote algorithm's message. + * + * @remarks This is typically called by an algorithm class' stub. + * + * @sa VISA_allocMsg() + */ +extern VISA_Msg VISA_allocMsg(VISA_Handle visa); + +/* + * ======== VISA_call ======== + */ +/** + * @brief Invoke the operation specified in the message and wait for + * it to complete. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @param[in] visa Handle to an algorithm instance. + * @param[out] msg The remote algorithm's message, + * to be sent to the skeleton. + * + * @remarks This is typically called by an algorithm class' stub. + * + * @retval VISA_EOK Success + * @retval VISA_ERUNTIME General system error + * + * @sa VISA_callAsync() + */ +extern VISA_Status VISA_call(VISA_Handle visa, VISA_Msg *msg); + +/* + * ======== VISA_callAsync ======== + */ +/** + * @brief Invoke the operation specified in the message and return + * without waiting for it to complete. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @param[in] visa Handle to an algorithm instance. + * @param[out] msg The remote algorithm's message, + * to be sent to the skeleton. + * + * @remarks This is typically called by an algorithm class' stub. + * + * @retval VISA_EOK Success + * @retval VISA_ERUNTIME General system error + * + * @sa VISA_wait() + * @sa VISA_call() + */ +extern VISA_Status VISA_callAsync(VISA_Handle visa, VISA_Msg *msg); + +/* + * ======== VISA_wait ======== + */ +/** + * @brief Wait for the oldest operation from a command specified with + * VISA_callAsync() to complete. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @param[in] visa Handle to an algorithm instance. + * @param[out] msg Placeholder for the remote algorithm's return message, + * retrieved from the skeleton. + * @param[in] timeout Amount of "time" to wait ("time" depends on underlying + * mechanism, such as that used with MSGQ_Get()). + * + * @remarks This is typically called by an algorithm class' stub. + * + * @retval VISA_EOK Success + * @retval VISA_ERUNTIME General system error + * @retval VISA_ETIMEOUT Operation timed out + * + * @sa VISA_callAsync() + */ +extern VISA_Status VISA_wait(VISA_Handle visa, VISA_Msg *msg, UInt timeout); + +/* + * ======== VISA_freeMsg ======== + */ +/** + * @brief Release an algorithm instance's message. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @param[in] visa Handle to an algorithm instance. + * @param[in] msg Message to free, obtained through a call to + * VISA_allocMsg(). + * + * @retval NULL General system error + * @retval non-NULL The remote algorithm's message. + * + * @remarks This is typically called by an algorithm class' stub. + * + * @sa VISA_allocMsg() + */ +extern Void VISA_freeMsg(VISA_Handle visa, VISA_Msg msg); + + +/** @ingroup ti_sdo_ce_VISA_API */ +/*@{*/ + +/* + * ======== VISA_create ======== + */ +/** + * @brief Create a new instance of an algorithm. + * + * @param[in] engine Handle to an engine in which the algorithm has been + * configured. + * @param[in] name Name of the algorithm to create. @c name is + * specified in the engine configuration. + * @param[in] params Creation parameters. + * @param[in] msgSize Size of the message which will be allocated in + * the event that this algorithm is configured to + * run remotely. + * @param[in] type String name of the "type" of algorithm. + * + * @retval NULL General failure. + * @retval non-NULL Handle to an algorithm instance. + * + * @remarks @c type must match the package/module name of the + * interface which the algorithm implements. For example, the VISA + * interface shipped with CE to support XDM video + * decoders is named "ti.sdo.ce.video.IVIDDEC". That is, + * the module IVIDDEC is in the package "ti.sdo.ce.video". + * You will, by definition, find a file named IVIDDEC.xdc in the + * ti.sdo.ce.video package. + * + * @remarks When calling VISA_create(), a string comparison is done + * between the @c type parameter and the actual name of the + * module (described in the previous paragraph). If these strings + * don't match exactly, VISA_create() will fail. + * + * @sa VISA_delete() + */ +extern VISA_Handle VISA_create(Engine_Handle engine, String name, + IALG_Params *params, size_t msgSize, String type); + +/* + * ======== VISA_delete ======== + */ +/** + * @brief Delete an instance of an algorithm. + * + * @param[in] visa Handle to an algorithm instance to delete. + * + * @sa VISA_create() + */ +extern Void VISA_delete(VISA_Handle visa); + + +/* + * ======== VISA_create2 ======== + */ +/** + * @brief Create a new instance of an algorithm. + * + * @param[in] engine Handle to an engine in which the algorithm has been + * configured. + * @param[in] name Name of the algorithm to create. @c name is + * specified in the engine configuration. + * @param[in] params Creation parameters. + * @param[in] paramsSize Size of @c params. + * @param[in] msgSize Size of the message which will be allocated in + * the event that this algorithm is configured to + * run remotely. + * @param[in] type String name of the "type" of algorithm. + * + * @retval NULL General failure. + * @retval non-NULL Handle to an algorithm instance. + * + * @remarks @c type must match the package/module name of the + * interface which the algorithm implements. For example, the VISA + * interface shipped with CE to support XDM video + * decoders is named "ti.sdo.ce.video.IVIDDEC". That is, + * the module IVIDDEC is in the package "ti.sdo.ce.video". + * You will, by definition, find a file named IVIDDEC.xdc in the + * ti.sdo.ce.video package. + * + * @remarks When calling VISA_create2(), a string comparison is done + * between the @c type parameter and the actual name of the + * module (described in the previous paragraph). If these strings + * don't match exactly, VISA_create2() will fail. + * + * @remarks VISA_create() is the preferred method to create algorithms. + * VISA_create2() is provided to enable creation of algorithms + * which violate the XDAIS spec and do not have a @c size + * field of type "Int" as the first field of @c params. + * + * @sa VISA_create() + * @sa VISA_delete() + */ +extern VISA_Handle VISA_create2(Engine_Handle engine, String name, + IALG_Params *params, Int paramsSize, size_t msgSize, String type); + + +/* + * ======== VISA_enter ======== + */ +/** + * @brief Enter an algorithm's critical section. This must be called + * before any of the algorithm's IALG_Fxns are invoked. + * + * @param[in] visa Handle to an algorithm instance. + * + * @remarks This is typically called by an algorithm class' application API. + * + * @remarks This call has the same semantics as IALG's activate fxn. + * + * @sa VISA_exit() + */ +extern Void VISA_enter(VISA_Handle visa); + +/* + * ======== VISA_exit ======== + */ +/** + * @brief Leave an algorithm's critical section. This must be called + * after the API has completed calling an algorithm's IALG_Fxns. + * + * @param[in] visa Handle to an algorithm instance. + * + * @remarks This call has the same semantics as IALG's de-activate fxn. + * + * @sa VISA_enter() + */ +extern Void VISA_exit(VISA_Handle visa); + +/* + * ======== VISA_getAlgHandle ======== + */ +/** + * @brief Obtains an algorithm's handle. This is the handle required + * to be passed to the algorithm's IALG_Fxns. + * + * @param[in] visa Handle to an algorithm instance. + * + * @retval NULL General system error + * @retval non-NULL The remote algorithm's message. + * + * @remarks This is typically called by an algorithm class' application API. + * + * @sa VISA_getAlgFxns() + */ +extern Ptr VISA_getAlgHandle(VISA_Handle visa); + +/* + * ======== VISA_getAlgorithmHandle ======== + */ +/** + * @brief Obtains an algorithm's handle. If the algorithm is local, this is the + * handle that can be passed to Algorithm APIs, not to the IALG_Fxns. + * + * @param[in] visa Handle to an algorithm instance. + * + * @retval NULL General system error + * @retval non-NULL The Algorithm handle. + * + * @remarks This is used internally. + * + * @sa VISA_getAlgHandle() + */ +extern Ptr VISA_getAlgorithmHandle(VISA_Handle visa); + +/* + * ======== VISA_getAlgFxns ======== + */ +/** + * @brief Get implementation functions for this algorithm + * + * @param[in] visa Handle to an algorithm instance. + * + * @retval NULL An error has occurred. + * @retval non-NULL The algorithm's IALG_Fxns. + * + * @remarks This is typically called by an algorithm class' application API. + * + * @remarks Both local and remote implementations return a non-NULL + * pointer. However, the IALG_Fxns functions may be NULL. + * + * @remarks In the case of a local algorithm, the algorithm's IALG_Fxns + * returned. In the case of a remote algorithm, its stubs are + * returned. In either case, the handle passed as the first arg + * to the IALG_Fxns must be the value returned by + * VISA_getAlgHandle(). + * + * @sa VISA_getAlgHandle() + */ +extern IALG_Fxns *VISA_getAlgFxns(VISA_Handle visa); + +/*@}*/ /* ingroup */ + +/* + * ======== VISA_getAlgMemRecs ======== + */ +/** + * @brief Get the IALG_MemRec memory assigned to an algorithm instance + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @param[in] visa Handle to an algorithm instance. + * @param[out] memTab Location to store the IALG_MemRecs. + * @param[in] size Maximum number of IALG_MemRecs to put in memTab array. + * @param[out] numRecs Actual number of IALG_MemRecs copied into memTab array. + * + * @remarks Any algorithm instance handle (e.g. VIDDEC2_Handle, + * AUDDEC1_Handle, etc), can be cast to a @c visa handle. + * + * @par Example: + * + * @code + * AUDDEC1_Handle decoder; + * + * decoder = AUDDEC1_create(...); + * + * ... likely use VISA_getAlgNumRecs() to alloc enough mem... + * + * VISA_getAlgMemRecs((VISA_Handle)decoder, ...); + * @endcode + * + * @retval #VISA_EOK Success. + * @retval #VISA_EFAIL Failure. + * + * @sa VISA_getAlgNumRecs() + */ +extern VISA_Status VISA_getAlgMemRecs(VISA_Handle visa, IALG_MemRec *memTab, + Int size, Int *numRecs); + +/* + * ======== VISA_getAlgNumRecs ======== + */ +/** + * @brief Get the number of IALG_MemRecs assigned to an algorithm. + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @param[in] visa Handle to an algorithm instance. + * @param[out] numRecs Location to store the number of IALG_MemRecs used. + * + * @remarks Any algorithm instance handle (e.g. VIDDEC2_Handle, + * AUDDEC1_Handle, etc), can be cast to a @c visa handle. + * + * @par Example: + * + * @code + * Int numRecs; + * AUDDEC1_Handle decoder; + * + * decoder = AUDDEC1_create(...); + * + * VISA_getAlgNumRecs((VISA_Handle)decoder, &numRecs); + * @endcode + * + * @retval #VISA_EOK Success. + * @retval #VISA_EFAIL Failure. + * + * @sa VISA_getAlgMemRecs() + */ +extern VISA_Status VISA_getAlgNumRecs(VISA_Handle visa, Int *numRecs); + + +/* + * ======== VISA_getContext ======== + */ +/** + * @brief Get optional context parameter. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @param[in] visa Handle to an algorithm instance. + * @param[out] pContext Location to store context. + * + * @pre @c visa must be a valid algorithm instance handle. + * + * @pre @c pContext must be a valid pointer. + * + * @remarks The VISA_setContext() / VISA_getContext() pair does not + * work across processors. That is, the context can only be + * stored and retrieved on the local processor. + * + * @sa VISA_setContext() + */ +extern Void VISA_getContext(VISA_Handle visa, UInt32 * pContext); + +/* + * ======== VISA_getCodecClassConfig ======== + */ +/** + * @brief Get codec-specific values for the VISA class-specific + * (or codec-specific if the codec doesn't extend VISA) stub-and/ + * or-skeleton configuration data (that some classes have) + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @param[in] visa Handle to an algorithm instance. + * + * @retval address of the codec class config data structure, or NULL if + * codec class config data not defined for the codec; the format + * of the structure is class-specific, and the data in it is codec- + * specific + * + * @pre @c visa must be a valid algorithm instance handle. + */ +extern Ptr VISA_getCodecClassConfig(VISA_Handle visa); + + +/* + * ======== VISA_getMaxMsgSize ======== + */ +/** + * @brief Returns max size of messages allocated by VISA_allocMsg() + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @retval maxMsgSize Max size of messages allocated by + * VISA_allocMsg() + * + * @remarks This is typically called by an algorithm class' stub. + * + * @sa VISA_allocMsg() + */ +extern UInt VISA_getMaxMsgSize(VISA_Handle visa); + +/* + * ======== _VISA_init ======== + */ +/** + * @brief Ininitilize VISA module. + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @remarks This is typically called by CERuntime_init(). + * + * @sa _VISA_exit() + */ +extern Void _VISA_init(Void); + +/* + * ======== _VISA_exit ======== + */ +/** + * @brief Exit VISA module. + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @remarks This is typically called by CERuntime_exit(). + * + * @sa _VISA_init() + */ +extern Void _VISA_exit(Void); + + +/* + * Semi-internal variable generatd by Settings.xdt - used in the following + * inline + */ +extern Bool VISA_checked; + +/* + * ======== VISA_isChecked ======== + */ +/** + * @brief Indicates whether VISA libraries were built with + * debug + additional checking enabled + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @retval false VISA libraries with no debug/checking are used + * @retval true VISA libraries with debug/checking are used + * + * @remarks This is typically called by an algorithm class' stub. + * + * @sa VISA_allocMsg() + */ +static inline Bool VISA_isChecked(Void) +{ + return (VISA_checked); +} + +/* + * ======== VISA_setContext ======== + */ +/** + * @brief Set optional context parameter. + * + * @ingroup ti_sdo_ce_VISA_STUB + * + * @param[in] visa Handle to an algorithm instance. + * @param[in] context Context. + * + * @pre @c visa must be a valid algorithm instance handle. + * + * @remarks The VISA_setContext() / VISA_getContext() pair does not + * work across processors. That is, the context can only be + * stored and retrieved on the local processor. + * + * @sa VISA_getContext() + */ +extern Void VISA_setContext(VISA_Handle visa, UInt32 context); + +/* + * ======== VISA_isLocal ======== + */ +/** + * @brief Indicates whether VISA codecs run on a remote or local CPU. + * + * @ingroup ti_sdo_ce_VISA_GEN + * + * @retval FALSE VISA codecs run on remote CPU + * @retval TRUE VISA codecs run on local CPU + * + * @remarks This is typically called by an algorithm class' stub. + */ +extern Bool VISA_isLocal(VISA_Handle visa); + +#ifdef __cplusplus +} +#endif + +#endif +/* + * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:04; /db/atree/library/trees/ce/ce-w08/src/ xlibrary + + */ + diff --git a/packages/ivahd_codecs/ti/sdo/codecs/h264enc/ih264enc.h b/packages/ivahd_codecs/ti/sdo/codecs/h264enc/ih264enc.h new file mode 100644 index 0000000..979c1df --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/h264enc/ih264enc.h @@ -0,0 +1,3503 @@ +/* + ******************************************************************************* + * + * HDVICP2.0 Based H.264 HP Encoder + * + * "HDVICP2.0 Based H.264 HP Encoder" is software module developed on TI's + * HDVICP2 based SOCs. This module is capable of compressing a 4:2:0 Raw + * video into a high/main/baseline profile bit-stream. Based on ISO/IEC + * 14496-10." + * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ + * ALL RIGHTS RESERVED + ******************************************************************************* +*/ + +/** + ****************************************************************************** + * @file ih264enc.h + * + * @brief IH264ENC Interface Header + * + * @author Pramod Kumar Swami (pramods@ti.com) + * + * @version 0.1 - Nov 30,2008 : Initial Version [Pramod] + * + * @version 0.2 - March 16,2009 [Pramod] + * A. Name change of interface file ih264venc.h to ih264enc.h + * B.Change the name of macros/enums + * MAXNUMSLCGPS --> IH264ENC_MAXNUMSLCGPS + * MAX_NUM_SLICE_START_OFFSET --> IH264ENC_MAX_NUM_SLICE_START_OFFSET + * IH264ENC_GOPSTRUCTURE_OPEN --> IH264ENC_GOPSTRUCTURE_NONUNIFORM + * IH264ENC_GOPSTRUCTURE_CLOSE --> IH264ENC_GOPSTRUCTURE_UNIFORM + * C. Definition of IH264ENC_BufferLevel changed from buffer to time + * D. mbMetaDataEnable is defined + * E. Following information (fields/definition) is newly added + * IH264ENC_VERSION_LENGTH : For getting the encoder version via Control + * method + * meta data support (IH264ENC_MAX_SEI_METADTA_BUFSIZE) + * Support and definition of Error Codes + * Enum for level 3.0 and 3.1 was missing added + * Poc type 1 enum added + * Support for NALU masks: no change in definition + * Few more enumeration added for IH264ENC_VUICodingPreset, + * IH264ENC_VideoFormat and IH264ENC_AspectRatioIdc + * IH264ENC_VUICodingParams structure parameter added to creation + * time parameters + * New enumeration added to IH264ENC_InterlaceCodingType: MRF, SPF + * + * @version 0.3 - November 2009 [Pramod] + * A. Added interface for force SKIP, it is temporarily here and will be + * used from base class of IVIDENC later + * B. Added user defined scaling matrix bit in input meta data + * @version 0.4 - Feb 2010 [Deepak] + * Addition of error bit(IH264ENC_ErrorBit : bit 7) for max bit rate + * voilation scenario in tighter RC scenario + * @version 0.5 - Mar 2010 [Kumar] : Added more enumerations to have all + * levels supported by H264 standard to make it future proof. + * @version 0.6 - Apr 2010 [Kumar] : Added error bit for checking + * hdvicp state IH264ENC_IMPROPER_HDVICP2_STATE + * @version 0.7 - Jun 2010 : [Nirmal, Pramod] Changed default value of + * BufferLevel since its is not good for + * low delay applications (IR: SDOCM00071692) + * @version 0.8 - Apr 2010 [Uday] : Modified the definition of initial + * buffer level from taking in descrete values to continuas values + * @version 0.9 - May 2010 [Uday] : converted the reserve parameter for + * enabling GMV in SEI to dedicated parameter + * + * @version 0.10 - May 2010 [Uday] : Extended the outArgs to return the + * initial buffer level + * @version 0.11 -Jun 2010 [Uday] : Added interface constraint set flags + * @version 0.12 - Aug 2010 [Nirmal] : Added data elements for static MB + * count support + * @version 0.13 -Aug 2010 [Girish Murthy] : Added interface for + * RCDO profile support + * @ version 0.14 -Sep 2010 [Kumar] : Defined a bit for + * IH264ENC_MAX_BYTES_VOILATION_IN_SLICEMODE_BYTES + * @ version 0.15 -Sep 2010 [Kumar] : Added a new extenetd parameter for + * algorithm creation enableLongTermRefFrame + * @version 0.16- Sept 2010[Girish]: Support for PRC and partial frame + * skip control + * @version 0.17 Sep 2010 : Added flag to control the insertion of + * HRD parameters in VUI part of bit-stream[Nirmal] + * @version 0.18 Sep2010 : Added error bit IH264ENC_DATASYNCH_RUN_TIME_ERROR + * multiplexed with IH264ENC_UNSUPPORTED_FMOCODINGPARAMS + * @version 0.19 Sep2010 : Added IH264ENC_FramePackingParams structure + * required for encoding the frame packing SEI + * @version 0.20 Sep 2010 : [Gajanan] Added IH264ENC_StereoInfoParams + * Structure for Steroe Video Coding + * parameters and StereoInfoPreset enums. + * @version 0.21 Apr 2011 : [Kumar] Added support for new long- + * trem frame referencing scheme + * IH264ENC_LTRP_REFERTOP_PROACTIVE + * @version 0.22 June 2011: Inroduction of new preset + * IH264_INTERCODING_MED_SPEED_HIGH_QUALITY for + * inter coding preset. + * @version 0.23 July 2011: Added discardSavedBits in RateControl structure + * SDOCM00082533 + * @version 0.24 July 2011: Added structures and enum for ROI support.[Gajanan] + * @version 1.0 Dec 2011: Added parameter for HRD compliance control[Girish] + * @version 1.1 Dec 2011: Added frameSkipThMulQ5 & vbvUseLevelThQ5 in + * RateControl structure for CBR quality improvement + * [Karthick] + * @version 1.2 Jan 2012: Renamed MAX_ROI macro as IH264ENC_MAX_ROI + * [Harris] + * @version 1.3 Mar 2012: Added a parameter enableErrorCheck in + * IH264ENC_ProcessParamsList.[Santoshkumar S K] + * @version 1.4 May 2012: Changed parameter name. Replaced + * inArgs->lateAcquireArg by inArgs->processId. + * [Santoshkumar S K] + * @version 1.5 May 2012: SDOCM00091641 : Added temporalId parameter to + * IH264ENC_OutArgs.This holds the Temporal + * layer Id of current frame in H-P encoding. + * (for base layer value is 0)[Santoshkumar S K] + * @version 1.6 Aug 2012: Redundant exposure of GDR configuration + * parameters as a part of Extended Dynamic structure + * are removed(SDOCM00095027)[Santoshkumar S K] + * @version 1.7 Sep 2012: Default value of scalingmatrixPreset is changed + * from NONE(0) to NORMAL(1)[Santoshkumar S K] + * @version 1.8 Feb 2013: Fix for OMAPS00288660: Ducati returns an error + * when setting a slice size larger than 32768. + * Fix : sliceUnitSize parameter's data type is changed + * from XDAS_Int16 to XDAS_Int32 [Santoshkumar S K] + * @version 1.9 Mar 2013: a. Added IH264ENC_ExtErrBits enum structure to fix + * SDOCM00099577(Encoder does not give refined error + * codes in case of creation fail or run time parameter + * set fail) + * b. Parameter extErrorCode[] is added in + * IH264ENC_Status and IH264ENC_OutArgs structure + * [Santoshkumar S K] + ***************************************************************************** +*/ + +/** + * @defgroup HDVICP2H264 IH264ENC_TI (V7M) + * @ingroup m3 + * + * The IH264ENC_TI interface enables encoding in H264 format + * + */ + +#ifndef _IH264ENC_H_ /* --{ */ + +#define _IH264ENC_H_ + +#include +#include + +/** @ingroup HDVICP2H264 */ +/*@{*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the macros define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/** + Maximum number of slice groups supported by H.264 Encoder +*/ +#define IH264ENC_MAXNUMSLCGPS (2) + +/** + Maximum Number of slice start points +*/ +#define IH264ENC_MAX_NUM_SLICE_START_OFFSET (3) + +/** maximum size for SEI_USER_DATA_UNREGISTERED SEI message */ +#define IH264ENC_MAX_SEI_METADTA_BUFSIZE (0x3FF) + +/** + Length of the version string. The memory to get version + number is owned by application +*/ +#define IH264ENC_VERSION_LENGTH (64) + +/** + control method commands +*/ +#define IH264ENC_GETSTATUS XDM_GETSTATUS +#define IH264ENC_SETPARAMS XDM_SETPARAMS +#define IH264ENC_RESET XDM_RESET +#define IH264ENC_FLUSH XDM_FLUSH +#define IH264ENC_SETDEFAULT XDM_SETDEFAULT +#define IH264ENC_GETBUFINFO XDM_GETBUFINFO + +/** + Maximum number of ROIs supported inside the frame. +*/ +#define IH264ENC_MAX_ROI 36 + +typedef IVIDENC2_Cmd IH264ENC_Cmd; + +/** + Macro to set particular NAL bit in the nal unit mask +*/ +#define IH264ENC_SET_NALU(naluPresentMask, NALU) \ + { \ + naluPresentMask = ((naluPresentMask) | (1 << IH264_NALU_TYPE_##NALU));\ + } + +/** + Macro to clear particular NAL bit in the nal unit mask +*/ +#define IH264ENC_CLEAR_NALU(naluPresentMask, NALU) \ + { \ + naluPresentMask = ((naluPresentMask) & (~(1 << IH264_NALU_TYPE_##NALU)));\ + } + +/** + Macro to get particular NAL bit in the nal unit mask +*/ +#define IH264ENC_GET_NALU(naluPresentMask, NALU)\ + ((naluPresentMask) & (1 << IH264_NALU_TYPE_##NALU)) + + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the Enumeration define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/** + * @enum IH264ENC_ErrorBit + * @brief error informations of IVAHD H264 encoder implementation by TI. + * + * @remarks When an internal error occurs, the algorithm will return + * an error return value (e.g. EFAIL, EUNSUPPORTED) + * + * @remarks The value of each enum is the bit which is set. + * + * @remarks Bits 8-15 are defined by XDM and hence not used by codec + * implementation. + * rest all bits are used. XDM defined error bits are also active. + * + * @remarks The algorithm can set multiple bits to 1 based on conditions. + * e.g. it will set bits #XDM_FATALERROR (fatal) and + * #XDM_UNSUPPORTEDPARAM (unsupported params) in case + * of unsupported run time parameters. + * + */ + +typedef enum { + IH264ENC_LEVEL_INCOMPLAINT_PARAMETER = 0, + /**< Bit 0 - level incomplaint parameters. + * @remarks This error is applicable when some parameters are set + * which are not meeting the limit defined by H.264 standard + * Table A-1 Level limits. It can be categorized under + * following category : + * IH264ENC_LEVEL_INCOMPLAINT_RESOLUTION : Invalid width/height + * IH264ENC_LEVEL_INCOMPLAINT_HRDBUFSZIE : Invalid HrdBufferSize + * IH264ENC_LEVEL_INCOMPLAINT_BITRATE : Invalid Bit Rate + * IH264ENC_LEVEL_INCOMPLAINT_MBSPERSECOND : Invalid FrameRate/ + * resolution + * IH264ENC_LEVEL_INCOMPLAINT_DPBSIZE : Invalid DPB size + * For above 5 situations, only a signle bit (bit-0) is set as true + */ + + IH264ENC_PROFILE_INCOMPLAINT_CONTENTTYPE = 1, + /**< Bit 1 - Profile incomplaint content type. + * @remarks This error is applicable when + * IVIDENC2_Params::inputContentType is not set as + * IVIDEO_PROGRESSIVE but IVIDENC2_Params::profile is set + * as IH264_BASELINE_PROFILE + */ + + IH264ENC_PROFILE_INCOMPLAINT_FMO_SETTING = 2, + /**< Bit 2 - Profile incomplaint FMO setting. + * @remarks This error is applicable when FMO is enabled but + * IVIDENC2_Params::profile is not set as IH264_BASELINE_PROFILE + */ + + IH264ENC_PROFILE_INCOMPLAINT_TRANSFORMBLOCKSIZE = 3, + /**< Bit 3 - Profile incomplaint transform block size. + * @remarks This error is set when + * IH264ENC_Params::transformBlockSize != IH264_TRANSFORM_4x4 && + * IVIDENC2_Params::profile != IH264_HIGH_PROFILE + */ + + IH264ENC_PROFILE_INCOMPLAINT_INTERFRAMEINTERVAL = 4, + /**< Bit 4 - Profile incomplaint interframeInterval. + * @remarks This error is set when B frames are used with + * IH264_BASELINE_PROFILE + */ + + IH264ENC_PROFILE_INCOMPLAINT_SCALINGMATRIXPRESET = 5, + /**< Bit 5 - Profile incomplaint scaling matrix setting. + * @remarks This error is set when scaling matrix is used + * without IH264_HIGH_PROFILE + */ + + IH264ENC_PROFILE_INCOMPLAINT_ENTROPYCODINGMODE = 6, + /**< Bit 6 - Profile incomplaint entropy coding mode setting. + * @remarks This error is set when cabac is used + * without IH264_HIGH_PROFILE/MAIN profile + */ + + IH264ENC_MAX_BYTES_VOILATION_IN_SLICEMODE_BYTES = 6, + /**< Bit 6 - If number of bytes encoded in any of the + * slice in the currently encoded picture is crossing + * maximum unbit size then this bit will be set + * @remarks This error bit is shared between the + * create time parameter entropy coding mode + * + */ + + IH264ENC_MAX_BIT_RATE_VOILATION = 7, + /**< Bit 7 - Max bits for one Unit Voilation + * @remarks When max bit rate is enabled by user, + * than it is possible that codec might not be able + * honor max bit rate. This bit is set when bits consumed + * in one unit ( 1 sec) is more than the allocated as per the + * given max bit rate. If the frame rate is N , and if the + * max bit rate is voilated in M th frame than this bit will + * get set for frame M to N. + */ + IH264ENC_IMPROPER_HDVICP2_STATE = 16, + /**< Bit 16 - Device is not proper state to use. + */ + + IH264ENC_IMPROPER_STREAMFORMAT = 17, + /**< Bit 17 - stream format is not proper + * @remarks This error is set when streamFormat is set as + * IH264_NALU_STREAM but data synch is not enabled for putdata + */ + + IH264ENC_IMPROPER_POCTYPE = 18, + /**< Bit 18 - poc type is not proper + * @remarks This error is set when poc type 2 is used in + * presense of non reference frames + */ + + IH264ENC_IMPROPER_DATASYNC_SETTING = 19, + /**< Bit 19 - data synch settings are not proper + * @remarks This error is set when encoder is asked to operate + * at sub frame level but the call back function pointer is NULL + */ + + IH264ENC_UNSUPPORTED_VIDENC2PARAMS = 20, + /**< Bit 20 - Invalid videnc2 parameters + * @remarks This error is set when any parameter of struct + * IVIDENC2_Params is not in allowed range + */ + + IH264ENC_UNSUPPORTED_RATECONTROLPARAMS = 21, + /**< Bit 21 - Invalid rate control parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_RateControlParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_INTERCODINGPARAMS = 22, + /**< Bit 22 - Invalid inter coding parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_InterCodingParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_INTRACODINGPARAMS = 23, + /**< Bit 23 - Invalid Intra coding parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_IntraCodingParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_NALUNITCONTROLPARAMS = 24, + /**< Bit 24 - Invalid nal unit coding parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_NALUControlParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_SLICECODINGPARAMS = 25, + /**< Bit 25 - Invalid slice coding parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_SliceCodingParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_LOOPFILTERPARAMS = 26, + /**< Bit 26 - Invalid loop filter related parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_LoopFilterParams is not in allowed range + */ + IH264ENC_DATASYNCH_RUN_TIME_ERROR = 27, + /**< Bit 27 is muxed with incorrect FMO paramters setting. + * This will be set when codec inside IVAHD encounters + * erroneous situation, like + * a) when number of NALs in 1Kb of data is more than 8 + * b) when the blocks provided through getBuf call is not + * sufficient for all the NALs in one oage of SL2 stream. + */ + IH264ENC_UNSUPPORTED_N_FRAME_PROCESSCALL_PARAMS = 27, + /**< Bit 27 is also muxed with incorrect paramters setting in + * N frame process call scenario + */ + IH264ENC_UNSUPPORTED_FMOCODINGPARAMS = 27, + /**< Bit 27 - Invalid fmo parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_FMOCodingParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_VUICODINGPARAMS = 28, + /**< Bit 28 - Invalid vui coding parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_VUICodingParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_H264ENCPARAMS = 29, + /**< Bit 29 - Invalid Create time extended parameters + * @remarks This error is set when any parameter of struct + * IH264ENC_Params is not in allowed range + */ + + IH264ENC_UNSUPPORTED_VIDENC2DYNAMICPARAMS = 30, + /**< Bit 30 - Invalid base class dyanmic paaremeters during control + * @remarks This error is set when any parameter of struct + * IVIDENC2_DynamicParams is not in allowed range + */ + + IH264ENC_UNSUPPORTED_H264ENCDYNAMICPARAMS = 31 + /**< Bit 31 - Invalid exteded class dyanmic paaremeters during control + * @remarks This error is set when any parameter of struct + * IH264ENC_DynamicParams (excluding embedded structures) is not in + * allowed range + */ + +} IH264ENC_ErrorBit; + +/** + * @enum IH264ENC_ExtErrBits + * @brief Sub extended error informations of IVAHD H264 encoder + * implementation by TI. + * + * @remarks When an internal error occurs, the algorithm will return + * an error return value (e.g. EFAIL, EUNSUPPORTED). Apart from + * this information, encoder returns extended error codes which + * helps to get refined error. For eg Error + * IH264ENC_UNSUPPORTED_VIDENC2DYNAMICPARAMS can be returned by + * many sub conditions which is not enough for the user + * to trace his parameter settings. But the sub extended error + * codecs as mentioned in the below enum gives finer and refined + * error information.These error bits are unique for each fail in + * param settings. The algorithm can set multiple bits based on + * conditions.e.g. it will set bits # + * IH264ENC_EXTERROR_CREATE_INTERLACE_TYPE (for wrong interlace + * coding type) and #IH264ENC_EXTERROR_CREATE_LTRP (for wrong + * LTRP settings) & etc. + * These bits are set in structure IH264ENC_Status::extErrorCode[] + * and/or structure IH264ENC_OutArgs::extErrorCode[] + */ +typedef enum { + IH264ENC_EXTERROR_ACTIVEREGION = 0, + /** Bit 0 Active frame region dimensions are not matching with the + * encoding frame dimensions + */ + IH264ENC_EXTERROR_ANALYTICINFO_BUFFERSIZE = 1, + /** Bit 1 Analytic Info buffer size provided is less than that of + * requested + */ + IH264ENC_EXTERROR_BITRATE = 2, + /* Bit 2 – target bit rate set is more than max bit rate */ + IH264ENC_EXTERROR_BITSTREAM_BUFFERSIZE = 3, + /** Bit 3 Output bitstream buffer size provided is less than that of + * requested. And this validation is done only if + * IVIDENC2_DynamicParams::ignoreOutbufSizeFlag is 0. Application has a + * flexibility of the not honoring this size by setting ignoreOutbufSizeFlag + * to 1 + */ + IH264ENC_EXTERROR_CAPTUREWIDTH_FORCEFRAME_LTRP_QPEL = 4, + /** Bit 4 This bit is set if any of the below conditions is set + * a. The size of dynamic params structure set is not of base class and + * nor even extended class + * b. Encoding dimensions are out of range + * c. Target bit rate less than minimum bt rate or frame rate is less than 0 + * d. Generate header mode other than XDM_ENCODE_AU and XDM_GENERATE_HEADER + * e. User forced frame other than IDR/NA frame + * f. Wrong settings in interframe or intraFrame intervals + * g. Incorrect settings in motion vector accuracy settings + * If this bit is set, correspondingly IH264ENC_EXTERROR_RESOLUTION_BITRATE_ + * FRMINTERVAL_GENHEADER is also set + */ + IH264ENC_EXTERROR_CONTROLCALL_CMD = 5, + /** Bit 5 Encoder control call is made with an incorrect command option + */ + IH264ENC_EXTERROR_CREATE_ENTROPY_PROFILE = 6, + /** Bit 6 Entropy coding mode set is CABAC for Base line profile which is + * not supported + */ + IH264ENC_EXTERROR_CREATE_GOPSTRUCT_LOG2MAX_INTRAINTERVAL = 7, + /** Bit 7 This bit is set when + * a. Parameters transformBlockSize, entropyCodingMode, log2MaxFNumMinus4, + * maxIntraFrameInterval, IDRFrameInterval, gopStructure are out of range. + * b. LTRP is enabled for interlaced coding type + * If this bit is set, correspondingly IH264ENC_EXTERROR_CREATE_TXBLKSIZE_ + * ENTROPY_POC_LTRP is also set + */ + IH264ENC_EXTERROR_CREATE_HPLAYERS = 8, + /** Bit 8 Hierarchal layers set is out of range i.e., numTemporalLayer + * set is less tha 0 or more than 4 + */ + IH264ENC_EXTERROR_CREATE_HPLAYERS_BFRAME = 9, + /** Bit 9 Hierarchal coding is enabled for 'B Frames which is not supported + */ + IH264ENC_EXTERROR_CREATE_HPLAYERS_POC = 10, + /** Bit 10 Picture Order Count(POC) type 1 is enabled for Hierarchal layer + * coding which is not supported + */ + IH264ENC_EXTERROR_CREATE_HPLAYERS_REFPICMRKING = 11, + /** Bit 11 - Longterm Referencing (MMCO commands) is not enabled for + * Hierarchal layer coding i.e., referencePicMarking is other than + * IH264_LONG_TERM_PICTURE for Hierarchal layer coding which is + * not supported + */ + IH264ENC_EXTERROR_CREATE_INTERLACE_TYPE = 12, + /** Bit 12 In interlaced encoding, interlace coding type set is out + * of supported values + */ + IH264ENC_EXTERROR_CREATE_LTRP = 13, + /** Bit 13 LTRP option (enableLongTermRefFrame) set is out of allowed ranges + */ + IH264ENC_EXTERROR_CREATE_LTRP_HP = 14, + /** Bit 14 LTRP option IH264ENC_LTRP_REFERTOP_PROACTIVE is enabled for + * Hierarchal layer coding which is not supported + */ + IH264ENC_EXTERROR_CREATE_LTRP_PERIOD = 15, + /** Bit 15 - When LTRP is enabled for Hierarchal layer coding (H-P) then + * LTRPPeriod set should be multiple of subGop length + */ + IH264ENC_EXTERROR_CREATE_LVL_DPBSIZE = 16, + /** Bit 16 Current DPB size set is more than the max DPB size allowed + * in this level. Current DPB size is calculated using formaula + * (maxWidth * maxHeight * 1.5 * max_num_ref_frames) + */ + IH264ENC_EXTERROR_CREATE_POC_BFRAME = 17, + /** Bit 17 Picture Order Count(POC) type 2 is set for B frames which + * is not supported + */ + IH264ENC_EXTERROR_CREATE_RCDO_PROFILE = 18, + /** Bit 18 RCDO is allowed only for Baseline profile. + */ + IH264ENC_EXTERROR_CREATE_TXBLKSIZE_ENTROPY_POC_LTRP = 19, + /** Bit 19 This bit is set when + * a. Parameters transformBlockSize, entropyCodingMode, log2MaxFNumMinus4, + * maxIntraFrameInterval, IDRFrameInterval, gopStructure are out of range. + * b. LTRP is enabled for interlaced coding type + * If this bit is set, correspondingly IH264ENC_EXTERROR_CREATE_GOPSTRUCT + * _LOG2MAX_INTRAINTERVAL is also set + */ + IH264ENC_EXTERROR_CREATE_TXBLKSIZE_PROFILE = 20, + /** Bit 20 Transform Block size IH264_TRANSFORM_8x8 is allowed only in + * High profile. + */ + IH264ENC_EXTERROR_DATASYNC_GETFN_PTRNULL = 21, + /** Bit 21 getBufferFxn is a function pointer used to get buffer. This + * function gets called in Data synch flow. This error bit is set if + * this function pointer is NULL + */ + IH264ENC_EXTERROR_DATASYNC_MBUNIT_SLICESIZE = 22, + /** Bit 22 This bit is set if + * a. User has enabled call back notification at slice level and + * b. Encoder slice mode selected is IH264_SLICEMODE_MBUNIT and + * c. Slice Unit size(number of MBs per slice) set is less than + * minimum MBs per slices. Minimum MBs per slice is (TotalMbsInPic/63) + */ + IH264ENC_EXTERROR_DATASYNC_MODE_BFRAME = 23, + /** Bit 23 Data sync, inputDataMode is not set to IVIDEO_ENTIREFRAME in + * presence of B frames. In B cases we allow processing entire frames + * and not any mode + */ + IH264ENC_EXTERROR_DATASYNC_MODE_FNPTRNULL = 24, + /** Bit 24 This bit is set if + * a. Data sync, outputDataMode is IVIDEO_FIXEDLENGTH or IVIDEO_SLICEMODE + * and putDataFxn is NULL + * OR + * b. Data sync, inputDataMode is IVIDEO_NUMROWS and getDataFxn is NULL + */ + IH264ENC_EXTERROR_DATASYNC_MODE_H241_FNPTRNULL = 25, + /** Bit 25 In H241 flow, if user is interested in call back notification + * at slice level then he has to provide function address in getBufferFxn + * function pointer else this bit is set + */ + IH264ENC_EXTERROR_DATASYNC_MODE_MINBITRATE = 26, + /** Bit 26 minBitRate should be 0 if data sync, outputDataMode is + * VIDEO_FIXEDLENGTH or IVIDEO_SLICEMODE + */ + IH264ENC_EXTERROR_DATASYNC_OUTPUTDATAEXCEED = 27, + /** Bit 27 Encoded output data size has exceeded the available buffer + * size + */ + IH264ENC_EXTERROR_DATASYNC_UNITS = 28, + /** Bit 28 Data sync, numOutputDataUnits are out of allowed ranges in + * case of outputDataMode not equal to IVIDEO_ENTIREFRAME + */ + IH264ENC_EXTERROR_DYNAMIC_SRCHCENTRE = 29, + /** Bit 29 GMV, search centre x/y are out of allowed range + */ + IH264ENC_EXTERROR_DYNAMICPARAMS_PTRNULL = 30, + /** Bit 30 In encoder control call with command option XDM_SETPARAMS, + * IVIDENC2_DynamicParams structure pointer is NULL + */ + IH264ENC_EXTERROR_EARLYEXIT = 31, + /** Bit 31 Early exit called because Frame processing is not completed + * at IVAHD side + */ + IH264ENC_EXTERROR_FIFO_EMPTY_NOPROCESS = 32, + /** Bit 32 In Flush process calls, no more buffers are locked and + * hence process call cannot be made further this point + */ + IH264ENC_EXTERROR_FILLERBYTES_NEGATIVE = 33, + /** Bit 33 This bit set indicates that the filler bytes size to be put + * in bitstream to meet bit stream constraint is negative. Filler data + * negative indiactes that bits consumed in current unit till now has + * crossed the maximum limit.So inform to the user by seeting appropirate bit + */ + IH264ENC_EXTERROR_FMO_PRESET = 34, + /** Bit 34 FMO coding preset is other than default. + * FMO is not supported in this release + */ + IH264ENC_EXTERROR_FRMPACKING_PRESET = 35, + /** Bit 35 Frame packing preset is not in allowed range + */ + IH264ENC_EXTERROR_FRMPACKING_TYPE_INPCONTENT = 36, + /** Bit 36 This bit is set if + * a.Frame packing is enabled for interlaced cases + * b.Frame packing preset is user defined and frame packing type is more + * than 4 (IH264_FRAMEPACK_TOP_BOTTOM) + */ + IH264ENC_EXTERROR_FRMRATE_NUMUNITSINTICKS = 37, + /** Bit 37 Level incompliant MBs per second + */ + IH264ENC_EXTERROR_GENHEADER_BITSTREAM_BUFFERSIZE = 38, + /** Bit 38 In process call with XDM_GENERATE_HEADER mode, output + * buffer size provided should be minimum of 0x100 bytes + * (to hold SPS and PPS) + */ + IH264ENC_EXTERROR_HANDLE_BUFDESCRIPTORS_PTRNULL = 39, + /** Bit 39 Pointer of handle or inBufs or outBufs structure may be NULL + */ + IH264ENC_EXTERROR_HIGHSPEED_BFARME = 40, + /** Bit 40 High speed encoding feature is not supported for B frames. + */ + IH264ENC_EXTERROR_HIGHSPEED_MEALGO_TXBLKSIZE_PROFILE = 41, + /** Bit 41 This bit is set if, in High speed encoding mode + * a. Transform block size is 4x4 for High profile case + * OR + * b. Transform block size is 8x8 and non High profile cases + */ + IH264ENC_EXTERROR_HIGHSPEED_PARTIALSKIP_INTRAREFRESHMETHOD= 42, + /** Bit 42 This bit is set if, in High speed encoding mode + * a. Transform block size is 4x4 for High profile case + * OR + * b. Transform block size is 8x8 and non High profile cases + * OR + * c. Partial Frame skip is enabled + * OR + * d. Intra refresh method is other than default + * If this bit is set, correspondingly IH264ENC_EXTERROR_HIGHSPEED_ + * TXBLKSIZE_PROFILE is also set + */ + IH264ENC_EXTERROR_HIGHSPEED_TXBLKSIZE_PROFILE = 43, + /** Bit 43 This bit is set if, in High speed encoding mode + * a. Transform block size is 4x4 for High profile case + * OR + * b. Transform block size is 8x8 and non High profile cases + * OR + * c. Partial Frame skip is enabled + * OR + * d. Intra refresh method is other than default + * If this bit is set, correspondingly IH264ENC_EXTERROR_HIGHSPEED_ + * PARTIALSKIP_INTRAREFRESHMETHOD is also set + */ + IH264ENC_EXTERROR_INARGS_BASECLASS_WATERMARKENABLE = 44, + /** Bit 44 Water Marking feature of the encoder is enabled and inArgs + * structure is base class. If inArgs structure is base class we cannot + * access the input key that has to used in water marking algo. + * So please use extended class of inArgs and pass the input key + */ + IH264ENC_EXTERROR_INARGS_CONTROL = 45, + /** Bit 45 The control parameter passed as part of inArgs structure is + * out of allowed range + */ + IH264ENC_EXTERROR_INARGS_OUTARGS_SIZE = 46, + /** Bit 46 The size parameter as part of inArgs or outArgs structure does + * not match base class not even extended class + */ + IH264ENC_EXTERROR_INARGS_PTRNULL = 47, + /** Bit 47 inArgs structure pointer passed in the process call is NULL + */ + IH264ENC_EXTERROR_INPCONTENT_TYPE = 48, + /** Bit 48 Input data content type value is wrong or input data chroma + * format is not YUV420 + */ + IH264ENC_EXTERROR_INPUT_BUFFERID = 49, + /** Bit 49 inputId as part of inArgs structure is 0 + */ + IH264ENC_EXTERROR_INPUTBUF_MEMTYPE = 50, + /** Bit 50 memType value set in the plane descriptors of inBufs structure + * is falling out of allowed values + */ + IH264ENC_EXTERROR_INPUTBUF_PTR_SIZE_NULL = 51, + /** Bit 51 - buf value(buffer pointer) or bufSize.bytes set in the plane + * descriptors of inBufs structure is NULL + */ + IH264ENC_EXTERROR_INTER_HIGHSPEED_MVPERMB = 52, + /** Bit 52 This bit is set if, in High speed encoding mode + * a. B frames are enabled + * OR + * b. Motion vector accuracy is not a Quarter pel (mvAccuracy != + * IVIDENC2_MOTIONVECTOR_QUARTERPEL) + * OR + * c. Motion vectors per macroblock is not 1 + * (minBlockSizeP != IH264_BLOCKSIZE_16x16) + * If this bit is set, correspondingly IH264ENC_EXTERROR_INTER_HIGHSPEED + * _QPEL_FRAMEINTERVAL is also set + */ + IH264ENC_EXTERROR_INTER_HIGHSPEED_QPEL_FRAMEINTERVAL = 53, + /** Bit 53 This bit is set if, in High speed encoding mode + * a. B frames are enabled + * OR + * b. Motion vector accuracy is not a Quarter pel (mvAccuracy != + * IVIDENC2_MOTIONVECTOR_QUARTERPEL) + * OR + * c. Motion vectors per macroblock is not 1 + * (minBlockSizeP != IH264_BLOCKSIZE_16x16) + * If this bit is set, correspondingly IH264ENC_EXTERROR_INTER_HIGHSPEED + * _MVPERMB is also set + */ + IH264ENC_EXTERROR_INTER_MVPERMB = 54, + /** Bit 54 Motion vectors per MB set is not in allowed range. + * minBlockSizeP/B is not equal to IH264_BLOCKSIZE_16x16 and not even + * IH264_BLOCKSIZE_8x8 + */ + IH264ENC_EXTERROR_INTER_PRESET = 55, + /** Bit 55 interCoding preset value is out of allowed range + */ + IH264ENC_EXTERROR_INTER_SRCHRGN_SKIPMVBIAS = 56, + /** Bit 56 searchRangeHorP/B or searchRangeVerP/B or skipMVCodingBias + * values are out of allowed range + */ + IH264ENC_EXTERROR_INTERLACE_DATALAYOUT = 57, + /** Bit 57 In interlaced encoding cases, dataLayout value set as part + * of inBufs structure is not IVIDEO_FIELD_INTERLEAVED and not even + * IVIDEO_FIELD_SEPARATED + */ + IH264ENC_EXTERROR_INTRA_CBCR8X8 = 58, + /** Bit 58 This bit is set if, + * a. intraCodingPreset is not a default + * AND + * b. chromaIntra8x8Enable is enabled + * AND + * c. chromaComponentEnable value is falling out of allowed range + * Please refer IH264ENC_ChormaComponent for more details + */ + IH264ENC_EXTERROR_INTRA_GDR_BFRAME_INPCONTENT_RATE = 59, + /** Bit 59 This bit is set if, in GDR enabled cases + * a. Interlaced encoding is enabled + * b. B frames are enabled + * c. GDR overlap rows is less than 0 or more than intraRefresh rate + */ + IH264ENC_EXTERROR_INTRA_GDR_REFRESHRATE = 60, + /** Bit 60 gdrOverlapRowsBtwFrames is more than intraRefreshRate + */ + IH264ENC_EXTERROR_INTRA_INTER_FRMINTERVAL = 61, + /** Bit 61 intraFrame interval is not a multiple of interFrame interval + */ + IH264ENC_EXTERROR_INTRA_LEVEL_MODE = 62, + /** Bit 62 - lumaIntra8x8Enable is enabled for profile other than + * IH264_HIGH_PROFILE + */ + IH264ENC_EXTERROR_INTRA_PRESET = 63, + /** Bit 63 intraCoding preset is out of allowed range + */ + IH264ENC_EXTERROR_INTRA_REFRESHMETHOD = 64, + /** Bit 64 intraRefreshMethod value is out of allowed range + */ + IH264ENC_EXTERROR_INTRA_REFRESHMETHOD_RATE = 65, + /** Bit 65 intraRefreshRate is less than or equal to 0 for + * intraRefreshMethod value other than default + */ + IH264ENC_EXTERROR_INTRA_REFRESHRATE = 66, + /** Bit 66 - intraRefreshRate is less than 0 for GDR enabled cases + */ + IH264ENC_EXTERROR_IVAHD_BADRESET = 67, + /** Bit 67 HDVICP reset is not proper + */ + IH264ENC_EXTERROR_IVAHD_BADSTATE = 68, + /** Bit 68 HDVICP is not in standby state + */ + IH264ENC_EXTERROR_IVAHD_RELEASE = 69, + /** Bit 69 HDVICP release fail. This occurs if HDVICP is not in + * standby state during release time + */ + IH264ENC_EXTERROR_LEVEL_INPCONTENT = 70, + /** Bit 70 level less than or equal to IH264_LEVEL_20 for interlaced + * encoding + */ + IH264ENC_EXTERROR_LEVELLIMIT_RESOLUTION = 71, + /** Bit 71 encoding resolutions/frame_dimensions are more than that + * of level allowed range + */ + IH264ENC_EXTERROR_LOOPFILTER_OFFST_LFIDC = 72, + /** Bit 72 loop filter preset is not a default and loopfilterDisableIDC, + * filterOffsetA/B is/are out of allowed range or filterOffsetA/B is odd + * value + */ + IH264ENC_EXTERROR_LOOPFILTER_PRESET = 73, + /* Bit 73 loop filter preset is out of allowed range + */ + IH264ENC_EXTERROR_LUMA_INPUTBUF_MEMTYPE = 74, + /** Bit 74 memType value set in the plane descriptors of inBufs + * structure corresponding to Luma data is XDM_MEMTYPE_TILED32 or + * XDM_MEMTYPE_TILED16. Allowed value is only XDM_MEMTYPE_TILED8 for + * Luma container + */ + IH264ENC_EXTERROR_METADATA_NUMBUFFERS = 75, + /** Bit 75 Number of meta data planes (corresponding to + * IH264_USER_DEFINED_SCALINGMATRIX and IH264_SEI_USER_DATA_UNREGISTERED) + * provided is not equal to inBufs->numMetaPlanes + */ + IH264ENC_EXTERROR_METADATABUF_MEMTYPE = 76, + /** Bit 76 - memType value set in the meta data plane descriptors of + * inBufs structure is not equal to XDM_MEMTYPE_ROW or XDM_MEMTYPE_TILEDPAGE + */ + IH264ENC_EXTERROR_METADATAPLANE_WGTTABLESIZE = 77, + /** Bit 77 In case of user defined scaling matrix, payload_size + * (bufSize.bytes) provided as part of meta data plane descriptors of inBufs + * structure is less the size of weightTable + * (inBufs->metadataPlaneDesc[index].bufSize.bytes) < + * (sizeof(sH264WgtTables_t)) + */ + IH264ENC_EXTERROR_METADATATYPES = 78, + /** Bit 78 metadataType[] are other than the supported values + */ + IH264ENC_EXTERROR_MULITCHNL_BFRAME_NOTSUPPORTED = 79, + /** Bit 79 This bit is set if B frames are enabled in multi Frame + * process call + */ + IH264ENC_EXTERROR_MULITCHNL_CHNLNUMEXCEEDED = 80, + /** Bit 80 This bit is set if number of channels to be processed are + * more that of maximum supported in multi Frame process call + */ + IH264ENC_EXTERROR_MULITCHNL_DATASYNC = 81, + /** Bit 81 This bit is set if data sync is enabled in multi Frame process + * call + */ + IH264ENC_EXTERROR_MULITCHNL_FRMPCK_STEREOIINFO = 82, + /** Bit 82 - This bit is set if framePackingPreset or stereoInfoPreset is + * enabled in multi Frame process call + */ + IH264ENC_EXTERROR_MULITCHNL_GENHEADER_NOTSUPPORTED = 83, + /** Bit 83 - This bit is set if frame process mode is XDM_GENERATE_HEADER + * in multi Frame process call + */ + IH264ENC_EXTERROR_MULITCHNL_MINBITRATE_NOTSUPPORTED = 84, + /** Bit 84 - This bit is set if minBitRate value is more than 0 in multi + * Frame process call + */ + IH264ENC_EXTERROR_MULITCHNL_MVPERMB = 85, + /** Bit 85 This bit is set if motion vectors per MB (minBlockSizeP) + * is not same for all the channels submitted in multi Frame process call + */ + IH264ENC_EXTERROR_NALU_GOLDENSPS = 86, + /** Bit 86 In all NALU preset masks, SPS_WITH_VUI bit is to be set or + * has to be reset. Setting of this bit in few masks and resetting in others + * is not allowed + */ + IH264ENC_EXTERROR_NALU_PRESET = 87, + /** Bit 87 NALU control preset is out of allowed range + */ + IH264ENC_EXTERROR_NALU_SPS_VUI = 88, + /** Bit 88 SEI NALU bit is set in a mask and SPS_WITH_VUI is not + * set in that particular mask + */ + IH264ENC_EXTERROR_NOCLEANEXIT = 89, + /** Bit 89 Early return because M3 has done early abort + */ + IH264ENC_EXTERROR_NUM_INPUT_OUTPUT_BUFS = 90, + /** Bit 90 There has to atleast 2 input buffers (inBufs->numPlanes : + * 1 Luma and 1 CbCr) and 1 output buffer (outBufs->numBufs : bit stream). + * This bit is set if this condition is not satisfied + */ + IH264ENC_EXTERROR_OUTPUTBUF_MEMTYPE = 91, + /** Bit 91 This bit is set if + * a. output bitstream buffers memory type is not XDM_MEMTYPE_ROW or + * not XDM_MEMTYPE_TILEDPAGE + * OR + * b. output buffers memory type is out of allowed range + */ + IH264ENC_EXTERROR_OUTPUTBUF_PTR_SIZE_NULL = 92, + /** Bit 92 This bit is set if output data sync is not enabled and + * bitstream buffer pointer is NULL or buffer.bytes is 0 + */ + IH264ENC_EXTERROR_OUTPUTDATASIZE_EXCEEDED = 93, + /** Bit 93 - Encoded output data size has exceeded the available buffer size + */ + IH264ENC_EXTERROR_PRESET_ENC_RATECTRL_LVL = 94, + /** Bit 94 This bit is set if + * a. encodingPreset is out of allowed range + * b. rateControlPreset is out of allowed range + * c. profile and level out of allowed range + * d. data sync mode out of allowed range + * e. inputChromaFormat, inputContentType,operatingMode, + * maxInterFrameInterval, maxHeight, maxWidth and dataEndianness are + * out of allowed range + * If this bit is set, correspondingly IH264ENC_EXTERROR_PROFILE_DATASYNC + * _INPCONTENT_RES is also set + */ + IH264ENC_EXTERROR_PROFILE_BFRAME = 95, + /** Bit 95 B frames are enabled for baseline profile + */ + IH264ENC_EXTERROR_PROFILE_DATASYNC_INPCONTENT_RES = 96, + /** Bit 96 This bit is set if + * a. encodingPreset is out of allowed range + * b. rateControlPreset is out of allowed range + * c. profile and level out of allowed range + * d. data sync mode out of allowed range + * e. inputChromaFormat, inputContentType,operatingMode, + * maxInterFrameInterval, maxHeight, maxWidth and dataEndianness are + * out of allowed range + * If this bit is set, correspondingly IH264ENC_EXTERROR_PRESET_ENC_RATECTRL + * _LVL is also set + */ + IH264ENC_EXTERROR_PROFILE_INPCONTENT = 97, + /** Bit 97 interlaced encoding is enabled for baseline profile + */ + IH264ENC_EXTERROR_RATECTRL_BFRAMEPICSIZE = 98, + /** Bit 98 rate control, minPicSizeRatioB value is out of allowed range + */ + IH264ENC_EXTERROR_RATECTRL_CBCRQPINDEX_INITBUFLVL = 99, + /** Bit 99 rate control,chromaQPIndexOffset initialBufferLevel are out + * of allowed range + */ + IH264ENC_EXTERROR_RATECTRL_HRDBUFFER_LVLEXCEED = 100, + /** Bit 100 rate control, HRDBufferSize is falling out of level decided + * minimum and maximum limit + */ + IH264ENC_EXTERROR_RATECTRL_IFRAME_QP = 101, + /** Bit 101 rate control, qpI is not falling in the range [qpMinI, qpMaxI] + */ + IH264ENC_EXTERROR_RATECTRL_IFRAMEPICSIZE = 102, + /** Bit 102 rate control, minPicSizeRatioI value is out of allowed range + */ + IH264ENC_EXTERROR_RATECTRL_IPBFRAME_QP = 103, + /** Bit 103 rate control, Qp values set for I, P and B frames are + * falling out allowed values + */ + IH264ENC_EXTERROR_SCLMATRIX_METADATA = 104, + /** Bit 104 Scaling matrix preset is user defined + * (IH264_SCALINGMATRIX_USERDEFINED_SPSLEVEL or IH264_SCALINGMATRIX_ + * USERDEFINED_PPSLEVEL) and meta data is not enabled for user defined + * scaling matrix + */ + IH264ENC_EXTERROR_RATECTRL_PARAMSPRESET = 105, + /** Bit 105 rate control, rateControlParamsPreset is out of allowed range + */ + IH264ENC_EXTERROR_RATECTRL_PBFRAME_QP = 106, + /** Bit 106 rate control, Qp values for P or B frames are out of + * range[minQp, maxQp] + */ + IH264ENC_EXTERROR_RATECTRL_PFRAMEPICSIZE = 107, + /** Bit 107 rate control, minPicSizeRatioP value is out of allowed range + */ + IH264ENC_EXTERROR_RATECTRL_PRESET_BFRAME_INPCONTENT = 108, + /** Bit 108 - IVIDEO_LOW_DELAY rateControlPreset is not supported for + * interlaced encoding and for B frame cases + */ + IH264ENC_EXTERROR_RATECTRL_PROFILE_SCALINGMTRX = 109, + /** Bit 109 scaling matrix preset is out of range or scaling matrix preset + * is other than user defined for profile not equal to IH264_HIGH_PROFILE + */ + IH264ENC_EXTERROR_RATECTRL_RCALGO = 110, + /** Bit 110 rate control, rcAlgo is out of allowed range + */ + IH264ENC_EXTERROR_RATECTRL_RCALGO_INTERLACE_OR_BFRAME = 111, + /** Bit 111 - RATECONTROL_PRC_LOW_DELAY rcAlgo is not supported for + * interlaced encoding and for B frame cases + */ + IH264ENC_EXTERROR_RATECTRL_SKIPDISTWNDW = 112, + /** Bit 112 This bit is set if + * a. rcAlgo is RATECONTROL_PRC_LOW_DELAY + * AND + * b. skip distribution window length (skipDistributionWindowLength) or + * number of skip frames in distribution window specified are out of + * allowed range + */ + IH264ENC_EXTERROR_RATECTRL_VBR = 113, + /** Bit 113 rate control, with CVBR settings, VBR duration (VBRDuration) + * or VBR sensitivity (VBRsensitivity) are out of allowed range + */ + IH264ENC_EXTERROR_RESOLUTION_BITRATE_FRMINTERVAL_GENHEADER= 114, + /** Bit 114 This bit is set if any of the below conditions is set + * a. The size of dynamic params structure set is not of base class and + * nor even extended class + * b. Encoding dimensions are out of range + * c. Target bit rate less than minimum bt rate or frame rate is less than 0 + * d. Generate header mode other than XDM_ENCODE_AU and XDM_GENERATE_HEADER + * e. User forced frame other than IDR/NA frame + * f. Wrong settings in interframe or intraFrame intervals + * g. Incorrect settings in motion vector accuracy settings + * If this bit is set, correspondingly IH264ENC_EXTERROR_CAPTUREWIDTH_ + * FORCEFRAME_LTRP_QPEL is also set + */ + IH264ENC_EXTERROR_ROI_COORDINATES = 115, + /** Bit 115 ROI co-ordinates provided are not proper. x/y may be less + * than 0 or more than frame dimensions. Also please see that Top.x + * should be less than Bottom.x and Top.y should be less than bottom.y + * for all co-ordinates + */ + IH264ENC_EXTERROR_ROI_NUMBERROIS = 116, + /** Bit 116 Number of ROI regions set are out of allowed range + */ + IH264ENC_EXTERROR_ROI_PRIORITY = 117, + /** Bit 117 ROI priority (roiPriority) provided are out of allowed range. + * This check is done with rate control enabled cases + */ + IH264ENC_EXTERROR_ROI_QP = 118, + /** Bit 118 - ROI priority (roiPriority) provided are out of allowed range. + * This check is done with rate control disabled cases. + * Here roiPriority holds the Qp values of the ROI regions + */ + IH264ENC_EXTERROR_ROI_TYPE = 119, + /** Bit 119 ROI types (roiType) provided are out of allowed range + */ + IH264ENC_EXTERROR_SLICE_NONE_DATASYNC = 120, + /** Bit 120 data sync call back notification is enabled for every + * slice (outputDataMode == IVIDEO_SLICEMODE)and slice level encoding + * is disabled (sliceMode == IH264_SLICEMODE_NONE) + */ + IH264ENC_EXTERROR_SLICE_H241_ENTROPY_INTERFRAME_INTERLACE = 121, + /** Bit 121 This bit is set if H241 is enabled and + * a. Width provided is less than that being supported in H241 cases + * OR + * b. Interlaced encoding is enabled + * OR + * c. Entropy coding mode is CABAC + * OR + * d. B frames are enabled + * OR + * e. Slice unit size in bytes (sliceUnitSize) provided is loess that being + * supported + * If this bit is set, correspondingly IH264ENC_EXTERROR_SLICE_H241_ + * WIDTH_SLICESIZE is also set + */ + IH264ENC_EXTERROR_SLICE_STRMFORMAT_DATASYNC = 122, + /** Bit 122 stream format IH264_NALU_STREAM is supported only with default + * slice mode and datasync option as IVIDEO_SLICEMODE + */ + IH264ENC_EXTERROR_SLICE_H241_WIDTH_SLICESIZE = 123, + /** Bit 123 This bit is set if H241 is enabled and + * a. Width provided is less than that being supported in H241 cases + * OR + * b. Interlaced encoding is enabled + * OR + * c. Entropy coding mode is CABAC + * OR + * d. B frames are enabled + * OR + * e. Slice unit size in bytes (sliceUnitSize) provided is loess that being + * supported + */ + IH264ENC_EXTERROR_SLICE_MODE_SIZE = 124, + /** Bit 124 This bit is set if + * a. Slice mode is SLICEMODE_MBUNIT and slice size provided is more than + * size of the frame or slice size is less than 6 + * OR + * b. Slice mode is SLICEMODE_OFFSET and sliceOffset0 is more than + * sliceOffset1 or sliceOffset1 is more than sliceoffset2 + */ + IH264ENC_EXTERROR_SLICE_PRESET = 125, + /** Bit 125 slice coding preset is out of allowed range + */ + IH264ENC_EXTERROR_SLICE_STRMFORMAT = 126, + /** Bit 126 stream format provided is out of allowed range + */ + IH264ENC_EXTERROR_STATUS_PTRNULL = 127, + /** Bit 127 status structure pointer passed in the encoder control call is + * NULL + */ + IH264ENC_EXTERROR_STATUS_SIZE = 128, + /** Bit 128 - The size of status params structure set is not of base class + * and nor even extended class + */ + IH264ENC_EXTERROR_STEREO_INPCONTENT = 129, + /** Bit 129 stereo info preset is enabled for progressive encoding which + * is not supported in this version of encoder + */ + IH264ENC_EXTERROR_STEREO_PRESET = 130, + /** Bit 130 stereo info preset set is out of allowed range + */ + IH264ENC_EXTERROR_VERSION_BUFFER_NULL_OR_SIZE = 131, + /** Bit 131 data buffer pointer as part of status structure is NULL. + * This buffer is used to place the version number of encoder. + * OR + * The data size as part of status structure is less than the size + * required to place an version number + */ + IH264ENC_EXTERROR_VUI_NUMUNITSINTICKS = 132, + /** Bit 132 VUI coding preset is user defined and the parameter + * numUnitsInTicks as part of vuiCodingParams is less than 0 + */ + IH264ENC_EXTERROR_VUI_PRESET = 133, + /** Bit 133 VUI coding preset set is out of allowed range + */ + IH264ENC_NUM_OUTPUT_BUFS_ANALYTICINFO = 134, + /** Bit 134 Analytic info is enabled and the buffer to store analytic + * info is not provided i.e., (outBufs->numBufs < 2 AND enableAnalyticinfo) + */ + IH264ENC_EXTERROR_NUM_MAXBITS, + /** Maximum number of sub extended error bits + */ + IH264ENC_EXTERROR_NUM_MAXWORDS = ((IH264ENC_EXTERROR_NUM_MAXBITS + 31) / 32) + /** Each word can hold 32 error bits, so max words are calculated as above + */ +}IH264ENC_ExtErrBits; + +/** + * @enum IH264ENC_Level + * @brief Level Identifier for H.264 Encoder +*/ +typedef enum { + IH264_LEVEL_10 = 10, /**< Level 1.0 */ + IH264_LEVEL_1b = 9, /**< Level 1.b */ + IH264_LEVEL_11 = 11, /**< Level 1.1 */ + IH264_LEVEL_12 = 12, /**< Level 1.2 */ + IH264_LEVEL_13 = 13, /**< Level 1.3 */ + IH264_LEVEL_20 = 20, /**< Level 2.0 */ + IH264_LEVEL_21 = 21, /**< Level 2.1 */ + IH264_LEVEL_22 = 22, /**< Level 2.2 */ + IH264_LEVEL_30 = 30, /**< Level 3.0 */ + IH264_LEVEL_31 = 31, /**< Level 3.1 */ + IH264_LEVEL_32 = 32, /**< Level 3.2 */ + IH264_LEVEL_40 = 40, /**< Level 4.0 */ + IH264_LEVEL_41 = 41, /**< Level 4.1 */ + IH264_LEVEL_42 = 42, /**< Level 4.2 */ + IH264_LEVEL_50 = 50, /**< Level 5.0 */ + IH264_LEVEL_51 = 51 /**< Level 5.1 */ + +} IH264ENC_Level; + + +/** + * @enum IH264ENC_Profile + * @brief Profile Identifier for H.264 Encoder +*/ +typedef enum { + IH264_BASELINE_PROFILE = 66, /**< BaseLine Profile */ + IH264_MAIN_PROFILE = 77, /**< Main Profile */ + IH264_EXTENDED_PROFILE = 88, /**< Extended Profile */ + IH264_HIGH_PROFILE = 100, /**< High Profile */ + IH264_DEFAULT_PROFILE = IH264_HIGH_PROFILE, /**< Default Profile */ + IH264_HIGH10_PROFILE = 110, /**< High 10 Profile */ + IH264_HIGH422_PROFILE = 122, /**< High 4:2:2 Profile */ + IH264SVC_BASELINE_PROFILE = 83, /**< SVC Baseline Profile */ + IH264SVC_HIGH_PROFILE = 86 /**< SVC High Profile */ +} IH264ENC_Profile; + +/** + * @enum IH264ENC_MetadataType + * @brief Meta Data for H.264 encoder + + The way to pass meta data to encode is via inBufs to the encoder during + process call. + The way to get meta data from encode is via outBufs of the encoder during + process call. + + When application request the buffer infos via control call with + XDM_GETBUFINFO, encoder should count a buffer to have meta data at + input/output level for this purpose. If for some metadata size is not known + by encoder then it should return size =-1 so that application can + allocate as per its knowledge. Same way for some meta-data application + might not provide the size to codec via XDM2_SingleBufDesc.bufSize.bytes, + in that case application can set it to -1. The meta data which has size + field in its format, uses size of buffer from that field only. + Example: User want to insert SEI_USER_DATA_UNREGISTERED meta data at each + IDR picture, the following steps should be followed + + 1. Create the encoder object with IVIDENC2_Params::metadataType[0] = + IH264_SEI_USER_DATA_UNREGISTERED and metadataType[1] and metadataType[2] + = IVIDEO_METADATAPLANE_NONE + + Also have IH264ENC_SET_NALU(naluPresentMaskIDRPicture, SEI) + 2. Call Control function with XDM_GETBUFINFO. Encoder should return one + additional input buffer as required. size of the buffer will be -1 as + encoder doesn't know the size + 3. Application should have a memory allocated for this meta data and pass on + to the encoder via IVIDEO2_BufDesc *inBufs->numMetaPlanes = 1 + +----------------+ + inBufs->metadataPlaneDesc[index].buf = pBuffer ; ---> | size | payLoad | + inBufs->metadataPlaneDesc[index].bufSize.bytes = -1 ; +----------------+ + since the meta-data format includes size field, encoder will read size from + there and utilize it. + + index of metadataPlaneDesc is the index of metaDataType which is holding + the particular meta data type. In this example metadataType[0] is holding + IH264_SEI_USER_DATA_UNREGISTERED so index = 0 of metadataPlaneDesc points + to IH264_SEI_USER_DATA_UNREGISTERED specific meta data +*/ + +typedef enum { + IH264_SEI_USER_DATA_UNREGISTERED = XDM_CUSTOMENUMBASE, + /**< H.264 allows inserting SEI message for any user data. refer section + * D.1.6 of H.264 standard. + * By setting this value to any if IVIDENC2_Params::metadataType[i] + * user can provide its user data SEI to be inserted + * in H.264 bit-stream + * The format of user data is as below + * typedef struct { + * U32 size; only lower 10-bits are considered + * U08 payload[]; number of bytes for payload is indicated by first + * 32 bit field size + * } + * The picture which uses this metadata will be decided by naluPresentMask::SEI + * bit. Example + * if SEI bit of only naluPresentMaskStartOfSequence is set to 1 then this meta + * data will be used only during start of sequence + * Encoder can accept maximum size of this meta data as 1023 bytes < 1K. + * Only lower 10-bits of size field is used by encoder + */ + + IH264_REGION_OF_INTEREST, + /**< Not defined yet the format but this field is to control the encoder to + * accept ROI data as input + */ + + IH264_USER_DEFINED_SCALINGMATRIX + /**< H.264 allows inserting user defined scaling matrices. + * By setting this value to any if IVIDENC2_Params::metadataType[i] + * user can provide its user data SEI to be inserted in H.264 bit-stream + * The format of user data is as below + * typedef struct { + * U32 size; only lower 10-bits are considered + * U08 payload[]; number of bytes for payload is indicated by first + * 32 bit field size + * } + * format of payload is for scaling matrix is defined in User GUide + */ +} IH264ENC_MetadataType; + +/** + * @enum IH264ENC_Control + * @brief Diffrent types of controls for encoding frame + * Eg: refere long term reference frame + */ + +typedef enum { + IH264ENC_CTRL_REFER_LONG_TERM_FRAME = XDM_CUSTOMENUMBASE, + /**< Refere long term reference frame (I/IDR frames) when + * IH264ENC_LTRPScheme is IH264ENC_LTRP_REFERTOIDR + */ + IH264ENC_CTRL_NOWRITE_NOREFUPDATE, + /**< Current frame is a non-referencing P frame and do + * not update the reference frame for this frame. Applicable + * when IH264ENC_LTRPScheme is IH264ENC_LTRP_REFERTOP_PROACTIVE + */ + IH264ENC_CTRL_WRITE_NOREFUPDATE, + /**< Current frame is a referencing P frame and do + * not update the reference frame for this frame. Applicable + * when IH264ENC_LTRPScheme is IH264ENC_LTRP_REFERTOP_PROACTIVE + */ + IH264ENC_CTRL_NOWRITE_REFUPDATE, + /**< Current frame is a non-referencing P frame and + * update the reference frame for this frame. Applicable + * when IH264ENC_LTRPScheme is IH264ENC_LTRP_REFERTOP_PROACTIVE + */ + IH264ENC_CTRL_WRITE_REFUPDATE, + /**< Current frame is a referencing P frame and + * update the reference frame for this frame. Applicable + * when IH264ENC_LTRPScheme is IH264ENC_LTRP_REFERTOP_PROACTIVE + */ + IH264ENC_CTRL_START_GDR + /**< Current frame is a choosen to start the GDR activity. Applicable + * when intraRefreshMethod is IH264_INTRAREFRESH_GDR + */ +} IH264ENC_Control; + +/** + * @enum IH264ENC_LTRPScheme + * @brief Diffrent types of long term-frame referencing scheme + * Eg: Mark all the I frames as long term-reference frame + */typedef enum { + IH264ENC_LTRP_NONE = 0, + /**< No longterm refernce frame in the sequnce + */ + IH264ENC_LTRP_REFERTO_PERIODICLTRP = 1, + /**< Mark frames as long-term reference frame with the period given + * by LTRPPeriod of IH264ENC_Params and + * based on the frame control IH264ENC_Control, refer to + * the long-term reference frame . + */ + IH264ENC_LTRP_REFERTOP_PROACTIVE =2, + /**< Two long term frames are supported in this schme and + * long-term index marking and refernce frame update is done based + * the IH264ENC_Control values + */ + IH264ENC_LTRP_REFERTOP_REACTIVE = 3 + /**< Mark frames as long-term reference frame with the period given + * by LTRPPeriod of IH264ENC_Params. + * At any point of time there will be 2 long-term frames and + * based on the frame control IH264ENC_Control, refer to + * the last long-term reference frame . + */ +}IH264ENC_LTRPScheme; + +/** + * @enum IH264ENC_PicOrderCountType + * @brief Picture Order Count Type Identifier for H.264 Encoder +*/ +typedef enum { + IH264_POC_TYPE_0 = 0, /**< POC type 0 */ + IH264_POC_TYPE_DEFAULT = IH264_POC_TYPE_0, /**< Default poc type */ + IH264_POC_TYPE_1 = 1, /**< POC type 1 */ + IH264_POC_TYPE_2 = 2, /**< POC type 2 */ + IH264_POC_TYPE_MAX + +} IH264ENC_PicOrderCountType; + + +/** + + @enum IH264ENC_ScalingMatPreset + @brief These enumerations control the type of scaling matrix picked up + by encoder + +*/ +typedef enum { + IH264_SCALINGMATRIX_NONE = 0, + /**< Default Scaling matrix (No scaling) */ + IH264_SCALINGMATRIX_NORMAL = 1, + /**< Flat Scaling matrix: part of standard (NO Scaling Matrix) */ + IH264_SCALINGMATRIX_DEFAULT = IH264_SCALINGMATRIX_NORMAL, + /**< For normal contents */ + IH264_SCALINGMATRIX_NOISY = 2, + /**< For noisy contents */ + IH264_SCALINGMATRIX_STD_DEFAULT = 3, + /**< Default Scaling Matrix provided by H.264 standard */ + IH264_SCALINGMATRIX_USERDEFINED_SPSLEVEL = 4, + /**< User defined SM at SPS level*/ + IH264_SCALINGMATRIX_USERDEFINED_PPSLEVEL = 5, + /**< User defined SM at PPS level*/ + IH264_SCALINGMATRIX_MAX + +} IH264ENC_ScalingMatPreset; + + +/** + + @enum IH264ENC_RateControlAlgo + @brief These enumerations control the type of rateControl algo to be picked + up by encoder. Only useful if IVIDENC2::rateControlPreset is set as + IVIDEO_USER_DEFINED + +*/ +typedef enum { + IH264_RATECONTROL_PRC = 0, /**< Perceptual Rate Control, + * controls the QP @ MB level + */ + IH264_RATECONTROL_PRC_LOW_DELAY = 1, /** Low Delay Rate Control */ + IH264_RATECONTROL_DEFAULT = IH264_RATECONTROL_PRC /** Default rcAlgo is PRC */ + +} IH264ENC_RateControlAlgo; + + +/** + + @enum IH264ENC_FrameQualityFactor + @brief These enumerations control the quality factor b/w two types of frames + For example if user want I frame Quality to be given more importance + than P frame, one can define it to be higher quality factor + +*/ +typedef enum { + IH264_QUALITY_FACTOR_1 = 0, /**< Same Quality factor + * b/w two types of frame + */ + IH264_QUALITY_FACTOR_DEFAULT = IH264_QUALITY_FACTOR_1, + /**< Default Quality factor + * to be used by encoder + */ + IH264_QUALITY_FACTOR_2 = 1, /**< High Quality factor to + * one frame type b/w two types + of frame + */ + IH264_QUALITY_FACTOR_3 = 2, /**< Higher Quality factor to + one frame type b/w two types of frame + */ + IH264_QUALITY_FACTOR_MAX + +} IH264ENC_FrameQualityFactor; + + + +/** + + @enum IH264ENC_RateControlParamsPreset + @brief These enumerations control the RateControl Params + +*/ + +typedef enum { + IH264_RATECONTROLPARAMS_DEFAULT = 0, + /**< Default Rate Control params */ + IH264_RATECONTROLPARAMS_USERDEFINED = 1, + /**< User defined Rate Control params */ + IH264_RATECONTROLPARAMS_EXISTING = 2, + /**< Keep the Rate Control params as existing. This is + * useful because during control call if user don't want + * to chnage the Rate Control Params + */ + IH264_RATECONTROLPARAMS_MAX + +} IH264ENC_RateControlParamsPreset; + +/** + + @enum IH264ENC_InterCodingPreset + @brief These enumerations control the type of inter coding + +*/ + +typedef enum { + IH264_INTERCODING_DEFAULT = 0, /**< Default Inter coding params */ + IH264_INTERCODING_USERDEFINED = 1, /**< User defined inter coding params */ + IH264_INTERCODING_EXISTING = 2, /**< Keep the inter coding params as + * existing. This is useful because + * during control call if user don't + * want to chnage the inter coding Params + */ + IH264_INTERCODING_MED_SPEED_HIGH_QUALITY = 3, /**< Med Speed High Quality*/ + IH264_INTERCODING_HIGH_SPEED = 4, /**< High Speed Preset*/ + IH264_INTERCODING_MAX + +} IH264ENC_InterCodingPreset; + +/** + + @enum IH264ENC_MeAlgoMode + @brief These enumerations control the mealgo selected + +*/ + +typedef enum { + IH264ENC_MOTIONESTMODE_NORMAL = 0, /**< Normal meAlgo */ + IH264ENC_MOTIONESTMODE_HIGH_SPEED = 1, /**< meAlgo for HIGH SPEED */ + IH264ENC_MOTIONESTMODE_DEFAULT = IH264ENC_MOTIONESTMODE_NORMAL, + /**< Default meAlgo */ + IH264ENC_MOTIONESTMODE_MAX + +} IH264ENC_MeAlgoMode; + +/** + + @enum IH264ENC_IntraCodingBias + @brief These enumerations control the number of intra Mbs to be encoded + +*/ + +typedef enum { + IH264ENC_INTRACODINGBIAS_NORMAL = 0, + /**< Normal number of intra Mbs */ + IH264ENC_INTRACODINGBIAS_HIGH_SPEED = 12, + /**< intra Mbs restricted for HIGH SPEED */ + IH264ENC_INTRACODINGBIAS_DEFAULT = IH264ENC_INTRACODINGBIAS_NORMAL, + /**< Default intra codign bias */ + IH264ENC_INTRACODINGBIAS_MAX + +} IH264ENC_IntraCodingBias; + +/** + + @enum IH264ENC_InterBlockSize + @brief These enumerations are defined for minimum Inter block size + +*/ + +typedef enum { + IH264_BLOCKSIZE_16x16 = 0, /**< 16x16 Block size */ + IH264_BLOCKSIZE_DEFAULT = IH264_BLOCKSIZE_16x16, /**< Default block size */ + IH264_BLOCKSIZE_8x8 = 1, /**< 8x8 Block size */ + IH264_BLOCKSIZE_4x4 = 2, /**< 4x4 Block size */ + IH264_BLOCKSIZE_MAX + +} IH264ENC_InterBlockSize; + +/** + + @enum IH264ENC_BiasFactor + @brief Encoder uses bias b/w two possible chices for lot of decisions. + It is to control the mild/strong ness of the biasing + +*/ +typedef enum { + IH264_BIASFACTOR_LOW = 0, + /**< Low biasing */ + IH264_BIASFACTOR_MEDIUM = 1, + /**< Normal/Med biasing */ + IH264_BIASFACTOR_NORMAL = IH264_BIASFACTOR_MEDIUM, + /**< Normal/Med biasing */ + IH264_BIASFACTOR_DEFAULT = IH264_BIASFACTOR_MEDIUM, + /**< Default :Normal/Med biasing*/ + IH264_BIASFACTOR_HIGH = 2, + /**< High biasing */ + IH264_BIASFACTOR_MILD = 4, /**< Mild biasing */ + IH264_BIASFACTOR_ADAPTIVE = 5, /**< Adaptive biasing */ + IH264_BIASFACTOR_MAX +} IH264ENC_BiasFactor; + + +/** + + @enum IH264ENC_IntraRefreshMethods + @brief Refresh method Type Identifier for H.264 Encoder + +*/ + +typedef enum { + IH264_INTRAREFRESH_NONE = 0, /**< Doesn't insert forcefully intra + macro blocks */ + IH264_INTRAREFRESH_DEFAULT = IH264_INTRAREFRESH_NONE, + /**< Default intra refresh is OFF */ + IH264_INTRAREFRESH_CYCLIC_MBS, /**< Insters intra macro blocks in a + * cyclic fashion cyclic interval is + * equal to intraRefreshRate + */ + IH264_INTRAREFRESH_CYCLIC_SLICES, /**< Insters Intra Slices(Row based) in + * a cyclic fashion: + * cyclic interval is equal to + * intraRefreshRate + */ + IH264_INTRAREFRESH_RDOPT_MBS, /**< position of intra macro blocks is + * intelligently chosen by encoder, + * but the number of forcely coded + * intra macro blocks in a frame is + * gaurnteed to be equal to + * totalMbsInFrame/intraRefreshRate + */ + IH264_INTRAREFRESH_GDR, /**< Instead of a sudden Intra Refresh + * of entire frame, the frame is refreshed + * Gradualy over a duration (which is con- + * figerable) of frames with refresh + * happening by Intra coded rows scanning + *from top to bottom of the scene/picture. + */ + IH264_INTRAREFRESH_MAX + +} IH264ENC_IntraRefreshMethods; + +/** + + @enum IH264ENC_ChormaComponent + @brief These enumerations control the selction of chroma component to perfom + chroma intra estimation + +*/ +typedef enum { + IH264_CHROMA_COMPONENT_CB_CR_BOTH = 0, /**< BOth Cb and Cr component */ + IH264_CHROMA_COMPONENT_CR_ONLY = 1, /**< Only Cr Component */ + IH264_CHROMA_COMPONENT_DEFAULT = IH264_CHROMA_COMPONENT_CR_ONLY, + /**< Default is Only Cr Component */ + IH264_CHROMA_COMPONENT_MAX + +} IH264ENC_ChormaComponent; + + +/** + + @enum IH264ENC_IntraCodingPreset + @brief These enumerations control the type of intra coding + +*/ + +typedef enum { + IH264_INTRACODING_DEFAULT = 0, /**< Default intra coding params */ + IH264_INTRACODING_USERDEFINED = 1, /**< User defined intra coding params */ + IH264_INTRACODING_EXISTING = 2, + IH264_INTRACODING_HIGH_SPEED = 3, /**< High Speed intra Coding Preset */ + IH264_INTRACODING_MAX + +} IH264ENC_IntraCodingPreset; + +/** + + @enum IH264ENC_NALUnitType + @brief These enumerations define the NALU type supported by H.264 + +*/ +typedef enum { + IH264_NALU_TYPE_UNSPECIFIED = 0, + /**< Unspecified Slice Type */ + IH264_NALU_TYPE_SLICE = 1, + /**< slice of a non-IDR picture */ + IH264_NALU_TYPE_SLICE_DP_A = 2, + /**< Coded slice data partition A */ + IH264_NALU_TYPE_SLICE_DP_B = 3, + /**< Coded slice data partition B */ + IH264_NALU_TYPE_SLICE_DP_C = 4, + /**< Coded slice data partition C */ + IH264_NALU_TYPE_IDR_SLICE = 5, + /**< slice of an IDR picture */ + IH264_NALU_TYPE_SEI = 6, + /**< Supplemental enhancement information */ + IH264_NALU_TYPE_SPS = 7, + /**< Sequence parameter set */ + IH264_NALU_TYPE_PPS = 8, + /**< Picture parameter set */ + IH264_NALU_TYPE_AUD = 9, + /**< Access unit delimiter */ + IH264_NALU_TYPE_EOSEQ = 10, + /**< End of sequence */ + IH264_NALU_TYPE_EOSTREAM = 11, + /**< End of stream */ + IH264_NALU_TYPE_FILLER = 12, + /**< Filler data */ + IH264_NALU_TYPE_SPS_WITH_VUI = 13, + /**< Sequence parameter set with VUI */ + IH264_NALU_TYPE_USER_DATA_UNREGD_SEI = 14, + /**< User Data unregsitered SEI */ + IH264_NALU_TYPE_SSPS = 15, + /**< Sub-Sequence Parameter Set for SVC */ + IH264_NALU_TYPE_CODED_SLICE_IN_SCALABLE_EXTN = 20 + /**< Coded Slice in Scalable Extn for SVC */ + +} IH264ENC_NALUnitType; + + +/** + + @enum IH264ENC_NALUControlPreset + @brief These enumerations define the control mechanism for insertion of + different NALU types at different point in video sequence + +*/ + +typedef enum { + IH264_NALU_CONTROL_DEFAULT = 0, /**< Default NALU insertion */ + IH264_NALU_CONTROL_USERDEFINED = 1, /**< User defined NALU insertion */ + IH264_NALU_CONTROL_MAX + +} IH264ENC_NALUControlPreset; + +/** + + @enum IH264ENC_SliceCodingPreset + @brief These enumerations control the type of slice coding + +*/ + +typedef enum { + IH264_SLICECODING_DEFAULT = 0, + /**< Default slice coding params */ + IH264_SLICECODING_USERDEFINED = 1, + /**< User defined slicecoding params */ + IH264_SLICECODING_EXISTING = 2, + /**< Keep the slice coding params as existing */ + /**< This is useful because during control call */ + /**< if user don't want to chnage the sliceCodingParams */ + IH264_SLICECODING_MAX + +} IH264ENC_SliceCodingPreset; + +/** + + @enum IH264ENC_SliceMode + @brief These enumerations control the type of slice coding + +*/ + +typedef enum { + IH264_SLICEMODE_NONE = 0, + IH264_SLICEMODE_DEFAULT = IH264_SLICEMODE_NONE, + /**< Default slice coding mode is MB based */ + IH264_SLICEMODE_MBUNIT = 1, + /**< Slices are controlled based upon number of Macroblocks */ + IH264_SLICEMODE_BYTES = 2, + /**< Slices are controlled based upon number of bytes */ + IH264_SLICEMODE_OFFSET = 3, + /**< Slices are controlled based upon user defined offset in + * unit of Rows + */ + IH264_SLICEMODE_MAX + +} IH264ENC_SliceMode; + +/** + + @enum IH264ENC_StreamFormat + @brief These enumerations control the type stream format + +*/ +typedef enum { + IH264_BYTE_STREAM = 0, + /**< bit-stream contains the start code identifier*/ + IH264_STREAM_FORMAT_DEFAULT = IH264_BYTE_STREAM, + /**< Default slice coding mode is byte-stream */ + IH264_NALU_STREAM = 1, + /**< bit-stream doesn't contain the start code identifier */ + IH264_STREAM_FORMAT_MAX +}IH264ENC_StreamFormat; + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/** + * @enum IH264ENC_LoopFilterPreset + * @brief These enumerations control the type of slice coding +*/ + +typedef enum { + IH264_LOOPFILTER_DEFAULT = 0, /**< Default loop-filtering params */ + IH264_LOOPFILTER_USERDEFINED = 1, /**< User defined loop-filtering params */ + IH264_LOOPFILTER_MAX +} IH264ENC_LoopFilterPreset; + +/** + + @enum IH264ENC_LoopFilterDisableIDC + @brief Control Parameter to disable loop filter at different places + +*/ +typedef enum { + IH264_DISABLE_FILTER_NONE = 0, + /**< Enable filtering of all the edges */ + IH264_DISABLE_FILTER_DEFAULT = IH264_DISABLE_FILTER_NONE, + /**< Default is Loop filter enabled */ + IH264_DISABLE_FILTER_ALL_EDGES, + /**< Disable filtering of all the edge */ + IH264_DISABLE_FILTER_SLICE_EDGES, + /**< Disable filtering of slice edges */ + IH264_DISABLE_FILTER_MAX +} IH264ENC_LoopFilterDisableIDC; + +/** + + @enum IH264ENC_SliceGroupMapType + @brief Slice group map type defined by H.264 standard + +*/ + +typedef enum { + IH264_INTERLEAVED_SLICE_GRP = 0, + /**< 0 : Interleaved Slice Group */ + IH264_DISPERSED_SLICE_GRP = 1, + /**< 1 : Dispersed Slice Group */ + IH264_FOREGRND_WITH_LEFTOVER_SLICE_GRP = 2, + /**< 2 : ForeGround with Left Over */ + IH264_BOX_OUT_SLICE_GRP = 3, + /**< 3 : Box Out */ + IH264_RASTER_SCAN_SLICE_GRP = 4, + /**< 4 : Raster Scan */ + IH264_SLICE_GRP_MAP_DEFAULT = IH264_RASTER_SCAN_SLICE_GRP, + /**< Default*/ + IH264_WIPE_SLICE_GRP = 5, + /**< 5 : Wipe slice group */ + IH264_EXPLICIT_SLICE_GRP = 6 + /**< 6 : Explicit Slice gropup map */ +} IH264ENC_SliceGroupMapType; + +/** + + @enum IH264ENC_SliceGroupChangeDirection + @brief Different Scan /rotation oreder + +*/ + +typedef enum { + IH264_RASTER_SCAN = 0, + /**< 0 : Raster scan order */ + IH264_CLOCKWISE = 0, + /**< 0 : Clockwise (used for BOX OUT FMO Params)*/ + IH264_RIGHT = 0, + /**< 0 : RIGHT (Used for Wipe FMO type) */ + IH264ENC_SLICEGROUP_CHANGE_DIRECTION_DEFAULT = IH264_RASTER_SCAN, + /**< Default */ + IH264_REVERSE_RASTER_SCAN = 1, + /**< 1 : Reverse Raster Scan Order */ + IH264_COUNTER_CLOCKWISE = 1, + /**< 1 : Counter Clockwise (used for BOX OUT + * FMO Params) + */ + IH264_LEFT = 1 + /**< 1 : LEFT (Used for Wipe FMO type) */ +} IH264ENC_SliceGroupChangeDirection; + +/** + + @enum IH264ENC_FMOCodingPreset + @brief Preset to define FMO coding type + +*/ + +typedef enum { + IH264_FMOCODING_NONE = 0, /**< 0 : NO FMO */ + IH264_FMOCODING_DEFAULT = IH264_FMOCODING_NONE, /**< 0 : NO FMO */ + IH264_FMOCODING_USERDEFINED = 1 /**< 1 : User defined FMO parameters */ + +} IH264ENC_FMOCodingPreset; + + +/** + + @enum IH264ENC_VUICodingPreset + @brief Defines the Preset for VUI coding + +*/ + +typedef enum { + IH264_VUICODING_DEFAULT = 0, /**< Default VUI Parameters. Note that + * Enable/Disable of VUI is via + * nalUnitControlParams + */ + IH264_VUICODING_USERDEFINED = 1, /**< 1 : User defined VUI parameters*/ + IH264_VUICODING_MAX /**< Max VUI Coding enum */ + +} IH264ENC_VUICodingPreset; + + +/** + + @enum IH264ENC_VideoFormat + @brief Defines different video formats + +*/ +typedef enum { + IH264ENC_VIDEOFORMAT_COMPONENT, /**< component video format */ + IH264ENC_VIDEOFORMAT_PAL, /**< PAL video format */ + IH264ENC_VIDEOFORMAT_NTSC, /**< NTSC video format */ + IH264ENC_VIDEOFORMAT_SECAM, /**< SECAM video format */ + IH264ENC_VIDEOFORMAT_MAC, /**< MAC video format */ + IH264ENC_VIDEOFORMAT_UNSPECIFIED /**< Unspecified video format*/ +} IH264ENC_VideoFormat; + +/** + + @enum IH264ENC_StereoInfoPreset + @brief Defines the Preset for Stereo Video Info coding*/ + +typedef enum { + IH264_STEREOINFO_DISABLE = 0, /* StereoVideoCoding is disable */ + IH264_STEREOINFO_ENABLE_DEFAULT = 1, /* Default Stereo Video Info + Parameters enabled. */ + IH264_STEREOINFO_ENABLE_USERDEFINED = 2, /* User defined Stereo Video Info + parameters enabled */ + IH264_STEREOINFO_MAX /* Max Stereo Video Info enum */ + +} IH264ENC_StereoInfoPreset; + +/** + + @enum IH264ENC_FramePackingPreset + @brief Defines the Preset for Frame packing SEI coding*/ + +typedef enum { + IH264_FRAMEPACK_SEI_DISABLE = 0, /* Frame packing SEI is disable */ + IH264_FRAMEPACK_SEI_ENABLE_DEFAULT = 1, /* Default Frame packing SEI + Parameters enabled. */ + IH264_FRAMEPACK_SEI_USERDEFINED = 2, /* User defined SFrame packing + SEIparameters enabled */ + IH264_FRAMEPACK_SEI_MAX /* Max Stereo Video Info enum */ + +} IH264ENC_FramePackingPreset; + +/** + + @enum IH264ENC_FramePackingType + @brief Defines the type of packing arrangement for + Frame packing SEI coding +*/ + +typedef enum { + IH264_FRAMEPACK_CHECKERBOARD = 0, + IH264_FRAMEPACK_COLUMN_INTERLEAVING = 1, + IH264_FRAMEPACK_ROW_INTERLEAVING = 2, + IH264_FRAMEPACK_SIDE_BY_SIDE = 3, + IH264_FRAMEPACK_TOP_BOTTOM = 4, + IH264_FRAMEPACK_TYPE_DEFAULT = IH264_FRAMEPACK_SIDE_BY_SIDE, + IH264_FRAMEPACK_TYPE_MAX + +} IH264ENC_FramePackingType; + +/** + + @enum IH264ENC_AspectRatioIdc + @brief Defines aspect ratio IDs + +*/ +typedef enum { + IH264ENC_ASPECTRATIO_UNSPECIFIED, /**< Unspecified aspect ratio */ + IH264ENC_ASPECTRATIO_SQUARE, /**< 1:1 (square) aspect ratio */ + IH264ENC_ASPECTRATIO_12_11, /**< 12:11 aspect ratio */ + IH264ENC_ASPECTRATIO_10_11, /**< 10:11 aspect ratio */ + IH264ENC_ASPECTRATIO_16_11, /**< 16:11 aspect ratio */ + IH264ENC_ASPECTRATIO_40_33, /**< 40:33 aspect ratio */ + IH264ENC_ASPECTRATIO_24_11, /**< 24:11 aspect ratio */ + IH264ENC_ASPECTRATIO_20_11, /**< 20:11 aspect ratio */ + IH264ENC_ASPECTRATIO_32_11, /**< 32:11 aspect ratio */ + IH264ENC_ASPECTRATIO_80_33, /**< 80:33 aspect ratio */ + IH264ENC_ASPECTRATIO_18_11, /**< 18:11 aspect ratio */ + IH264ENC_ASPECTRATIO_15_15, /**< 15:15 aspect ratio */ + IH264ENC_ASPECTRATIO_64_33, /**< 64:33 aspect ratio */ + IH264ENC_ASPECTRATIO_160_99, /**< 160:99 aspect ratio */ + IH264ENC_ASPECTRATIO_4_3, /**< 4:3 aspect ratio */ + IH264ENC_ASPECTRATIO_3_2, /**< 3:2 aspect ratio */ + IH264ENC_ASPECTRATIO_2_1, /**< 2:1 aspect ratio */ + IH264ENC_ASPECTRATIO_EXTENDED = 255 /**< Extended aspect ratio */ + +} IH264ENC_AspectRatioIdc; + +/** + + @enum IH264ENC_EntropyCodingMode + @brief Defines the different entropy code mode + +*/ +typedef enum { + IH264_ENTROPYCODING_CAVLC = 0, /**< CAVLC coding + type + */ + IH264_ENTROPYCODING_DEFAULT = IH264_ENTROPYCODING_CAVLC, /**< Default is + CAVLC coding type + */ + IH264_ENTROPYCODING_CABAC = 1, /**< CABAC coding + type + */ + IH264_ENTROPYCODING_MAX +} IH264ENC_EntropyCodingMode; + +/** + + @enum IH264ENC_TransformBlockSize + In H264 Intra macro block's transform size depends upon the Intra mode, + so this applies to inter macroblocks only + +*/ +typedef enum { + IH264_TRANSFORM_4x4 = 0, /**< Transform blocks + size is 4x4 */ + IH264_TRANSFORM_8x8 = 1, /**< Transform blocks + * size is 8x8 : + * Valid for only + * High Profile + */ + IH264_TRANSFORM_ADAPTIVE = 2, /**< Adaptive transform + * block size : + * encoder decides + * as per content + */ + IH264_TRANSFORM_DEFAULT = IH264_TRANSFORM_ADAPTIVE, /**< Default is adaptive + * based upon content + */ + IH264_TRANSFORM_MAX + +} IH264ENC_TransformBlockSize; + + + +/** + + @enum IH264ENC_GOPStructure + @brief + When B frames are used (InterFrameInterval > 1) then the arrangement of + frames can be different + + GOP structure in display order as indicated below + If contentType = Frame + IH264ENC_GOPSTRUCTURE_NONUNIFORM : IBBPBBP. . + IH264ENC_GOPSTRUCTURE_UNIFORM : BBIBBPBB. . + If contentType = Field + IH264ENC_GOPSTRUCTURE_NONUNIFORM : IPBBBBPBBBB + IH264ENC_GOPSTRUCTURE_UNIFORM : BBBBIPBBBBPPBBBB + +*/ + +typedef enum { + IH264ENC_GOPSTRUCTURE_NONUNIFORM = 0, + /**< Open Gop structure : IBBPBBP */ + IH264ENC_GOPSTRUCTURE_DEFAULT = IH264ENC_GOPSTRUCTURE_NONUNIFORM, + /**< Default is open gop structure */ + IH264ENC_GOPSTRUCTURE_UNIFORM = 1, + /**< Close Gop structure : BBIBBPBB*/ + IH264ENC_GOPSTRUCTURE_MAX + +} IH264ENC_GOPStructure; + + +/** + + @enum IH264ENC_BiasFactor + @brief Encoder uses bias b/w two possible chices for lot of decisions. + It is to control the mild/strong ness of the biasing + +*/ +typedef enum { + IH264_INTERLACE_PICAFF = 0, + /**< PicAFF type of interlace coding */ + IH264_INTERLACE_MBAFF = 1, + /**< MBAFF type of interlace coding */ + IH264_INTERLACE_FIELDONLY = 2, + /**< Field only coding with fixed partiy scheme */ + IH264_INTERLACE_FIELDONLY_MRF = IH264_INTERLACE_FIELDONLY, + /**< Use Most recent field for refernece*/ + IH264_INTERLACE_FIELDONLY_ARF = 3, + /**< Field only coding where codec decides the partiy of of the field to + * be used based upon content (adaptive) */ + IH264_INTERLACE_DEFAULT = IH264_INTERLACE_FIELDONLY_ARF, + /**< Default : adaptive partiy for reference*/ + IH264_INTERLACE_FIELDONLY_SPF = 4, + /**< Use same parity field for refernece */ + + IH264_INTERLACE_MAX +} IH264ENC_InterlaceCodingType; +/** + @enum IH264ENC_NumTemporalLayer + @brief Define different Temporal Layers +*/ +typedef enum { + /* Only Base Layer */ + IH264_TEMPORAL_LAYERS_1 = 1, + + /* Base Layer + Temporal Layer */ + IH264_TEMPORAL_LAYERS_2 = 2, + + /* Base Layer + 2Temporal Layers */ + IH264_TEMPORAL_LAYERS_3 = 3, + + /* Base Layer + 3Temporal Layers */ + IH264_TEMPORAL_LAYERS_4 = 4, + + /* Maximum Temporal Layer Supported*/ + IH264_TEMPORAL_LAYERS_MAX = IH264_TEMPORAL_LAYERS_4 + +} IH264ENC_NumTemporalLayer; + +/** + @enum IH264ENC_RoiType + @brief Defines the different ROI types +*/ +typedef enum { + IH264_FACE_OBJECT = 0, + /**< Face type of ROI object */ + IH264_BACKGROUND_OBJECT = 1, + /**< Background type of ROI object */ + IH264_FOREGROUND_OBJECT = 2, + /**< Foreground type of ROI object */ + IH264_DEFAULT_OBJECT = 3, + /**< Default type of ROI object */ + IH264_PRIVACY_MASK = 4 + /**< Privacy mask type of ROI object */ +} IH264ENC_RoiType; + +/** + @enum IH264ENC_SvcExtensionFlag + @brief Define SVC Extension Flag +*/ +typedef enum { + /*Svc Extension Flag Disabled*/ + IH264_SVC_EXTENSION_FLAG_DISABLE = 0, + /*Svc Extension Flag Enabled*/ + IH264_SVC_EXTENSION_FLAG_ENABLE = 1, + /*Svc Extension Flag Enabled with EC Flexibility*/ + IH264_SVC_EXTENSION_FLAG_ENABLE_WITH_EC_FLEXIBILITY = 2 + +} IH264ENC_SvcExtensionFlag; + +/** + @enum IH264ENC_ReferencePicMarking + @brief Define Reference Picture Marking +*/ +typedef enum { + /* ReferencePicMarking is Short-term picutre(Sliding Window) */ + IH264_SHORT_TERM_PICTURE = 0, + /* ReferencePicMarking is Long-term picutre(MMCO Commands) */ + IH264_LONG_TERM_PICTURE = 1 + +} IH264ENC_ReferencePicMarking; +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the structures define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/** + + @struct IH264ENC_RateControlParams + @brief This structure contains all the parameters which controls Rate + Control behavior + + @param rateControlParamsPreset : + regarded @ IH264ENC_DynamicParams::rateControlParams + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_RATECONTROLPARAMS_DEFAULT + @param scalingMatrixPreset : + ignored @ IH264ENC_DynamicParams::rateControlParams + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_SCALINGMATRIX_DEFAULT + + @param rcAlgo : ignored @ IH264ENC_DynamicParams::rateControlParams + This defines the rate control algorithm to be used. Only useful + if IVIDENC2::rateControlPreset is set as IVIDEO_USER_DEFINED + + @param qpI : regarded @ IH264ENC_DynamicParams::rateControlParams + Initial Quantization Parameter for I/IDR frames. + Valid Range is [-1, 51] + -1 : Auto Initialization else other wise Initial QP. + when rateControlPreset = IVIDEO_NONE, this quantization parameter is + used by the whole video frame/field + + @param qpMaxI : regarded @ IH264ENC_DynamicParams::rateControlParams + Maximum Quantization Parameter for I/IDR frame(s). Range [0 , 51]. + Useful to control a minimum quality level + + @param qpMinI : regarded @ IH264ENC_DynamicParams::rateControlParams + Minimum Quantization Parameter for I/IDR frame(s). Range [0 , 51]. + Useful to control a maximum bit-rate level + + @param qpP : regarded @ IH264ENC_DynamicParams::rateControlParams + Initial Quantization Parameter for P frames. Valid Range is [-1, 51] + -1 : Auto Initialization else other wise Initial QP. + when rateControlPreset = IVIDEO_NONE, this quantization parameter is + used by the whole video frame/field + + @param qpMaxP : regarded @ IH264ENC_DynamicParams::rateControlParams + Maximum Quantization Parameter for inter frame(s). Range [0 , 51]. + Useful to control a minimum quality level + + @param qpMinP : regarded @ IH264ENC_DynamicParams::rateControlParams + Minimum Quantization Parameter for inter frame(s). Range [0 , 51]. + Useful to control a maximum bit-rate level + + @param qpOffsetB : regarded @ IH264ENC_DynamicParams::rateControlParams + Offset of B frames Quantization Parameter from P frames. + Valid Range is [-1, 51] + -1 : Auto Initialization else other wise user provided offset + if after adding the qpOffsetB into qp of P frame it exceeds 51 then + it is clipped to 51 + when rateControlPreset = IVIDEO_NONE, this offset parameter is + used by the whole video frame/field + + @param qpMaxB : regarded @ IH264ENC_DynamicParams::rateControlParams + Maximum Quantization Parameter for B frame(s). Range [0 , 51]. + Useful to control a minimum quality level + + @param qpMinB : regarded @ IH264ENC_DynamicParams::rateControlParams + Minimum Quantization Parameter for B frame(s). Range [0 , 51]. + Useful to control a maximum bit-rate level + + @param allowFrameSkip : regarded @ IH264ENC_DynamicParams::rateControlParams + Controls Frame Skip. + non-zero means frames can be skipped to achieve target bit-rate + zero means frame can never be skipped + + @param removeExpensiveCoeff : + regarded @ IH264ENC_DynamicParams::rateControlParams + Flag to Remove high frequency expensive coeffecients + + @param chromaQPIndexOffset : + ignored @ IH264ENC_DynamicParams::rateControlParams + Specifies offset to be added to luma QP for addressing QPC values + table for chroma components. + Valid value is between -12 and 12, (inclusive) + + @param IPQualityFactor : ignored @ IH264ENC_DynamicParams::rateControlParams + This provides configurality to control I frame Quality wrt to P frame. + Higher Quality factor means I frame quality is given higher + improtance compared to P frame. + Refer IH264ENC_FrameQualityFactor for possible values + + @param initialBufferLevel : + ignored @ IH264ENC_DynamicParams::rateControlParams + Initial Buffer level for HRD compliance. It informs that Hypothtical + decoder can start after how much time. The value taken is the + obsolute value of the HRD buffer size For example if user want + Hypothtical decoder to start taking out data from HRD buffer after + half second then it should set initialBufferLevel = half of the + HRD buffer size that is programmed. + + @param HRDBufferSize : regarded @ IH264ENC_DynamicParams::rateControlParams + Hypothetical Reference Decoder Buffer Size. This size controls the + frame skip logic of the encoder. for low delay applications this + size should be small. Unit of this variable is bits + + @param minPicSizeRatio : regarded @ IH264ENC_DynamicParams::rateControlParams + This ratio is used to compute minimum picture size + in the following manner, + minPicSize = averagePicSize >> minPicSizeRatio + allowed values 1 to 4, Setting this to 0 will enable + encoder chosen ratio. + Note that this is guided value to rate control to + determine min picture size and encoder may not + strictly follow this + @param maxPicSizeRatio : regarded @ IH264ENC_DynamicParams::rateControlParams + To determines ratio for max picture size + This ratio is used to compute maximum picture size + in the following manner, + maxPicSize = averagePicSize * maxPicSizeRatio + allowed values 2 to 30.Setting this to 0 and 1 + will enable encoder chosen ratio. + Note that this is guided value to rate control + to determine max picture size and encoder may not + strictly follow this. + + @param enablePRC : regarded @ IH264ENC_DynamicParams::rateControlParams + This flag is used to control allowing PRC in the + frame + + @param enablePartialFrameSkip : regarded @ IH264ENC_DynamicParams:: + rateControlParams + This flag is used to control allowing partial frame + skip in the frame + @param reserved : 16 bit word, kept to not change the foot print + @param VBRDuration : During over which statistics during interval are + collected to switch bit-rate states.Increasing this + value will make VBR wait for longer time before + switching bit-rate state + @param VBRsensitivity : Specifies the target bitrate used by rate control in + high complexity state. + @param skipDistributionWindowLength : Number of frames over which the skip + frames can be distributed + @param numSkipInDistributionWindow : Number of skips allowed within the + distribution window + @param reservedRC + Some part is kept reserved to add parameters later without + changing the foot print of interface memory + + @todo More parameters to be added : delay (VBV), PRC related etc.. + + +*/ + +typedef struct IH264ENC_RateControlParams { + XDAS_Int8 rateControlParamsPreset; + XDAS_Int8 scalingMatrixPreset; + XDAS_Int8 rcAlgo; + XDAS_Int8 qpI; + XDAS_Int8 qpMaxI; + XDAS_Int8 qpMinI; + XDAS_Int8 qpP; + XDAS_Int8 qpMaxP; + XDAS_Int8 qpMinP; + XDAS_Int8 qpOffsetB; + XDAS_Int8 qpMaxB; + XDAS_Int8 qpMinB; + XDAS_Int8 allowFrameSkip; + XDAS_Int8 removeExpensiveCoeff; + XDAS_Int8 chromaQPIndexOffset; + XDAS_Int8 IPQualityFactor; + XDAS_Int32 initialBufferLevel; + XDAS_Int32 HRDBufferSize; + XDAS_Int16 minPicSizeRatioI; + XDAS_Int16 maxPicSizeRatioI; + XDAS_Int16 minPicSizeRatioP; + XDAS_Int16 maxPicSizeRatioP; + XDAS_Int16 minPicSizeRatioB; + XDAS_Int16 maxPicSizeRatioB; + XDAS_Int8 enablePRC; + XDAS_Int8 enablePartialFrameSkip; + XDAS_Int8 discardSavedBits; + XDAS_Int8 reserved; + XDAS_Int32 VBRDuration; + XDAS_Int8 VBRsensitivity; + XDAS_Int16 skipDistributionWindowLength; + XDAS_Int16 numSkipInDistributionWindow; + XDAS_Int8 enableHRDComplianceMode; + XDAS_Int32 frameSkipThMulQ5; + XDAS_Int32 vbvUseLevelThQ5; + XDAS_Int32 reservedRC[3]; + +} IH264ENC_RateControlParams; + +/** + @struct ROI_Interface + @brief This structure defines the ROI input parameters required by Encoder. + @param listROI: + List of ROIs with their x and y co-ordinates + @param roiType: + Type of each ROI + @param numOfROI: + Number of ROIs passed to codec + @param roiPriority: + Priority of each ROI +*/ +typedef struct IH264ENC_RoiInput { + XDM_Rect listROI[IH264ENC_MAX_ROI]; + XDAS_Int8 roiType[IH264ENC_MAX_ROI]; + XDAS_Int8 numOfROI; + XDAS_Int32 roiPriority[IH264ENC_MAX_ROI]; +}IH264ENC_RoiInput; + +/** + + @struct IH264ENC_InterCodingParams + @brief This structure contains all the parameters which controls Inter MBs + coding behavior + @param interCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_INTERCODING_DEFAULT + @param searchRangeHorP :regarded @ IH264ENC_DynamicParams::interCodingParams + Horizontal Search Range for P frames + @param searchRangeVerP :regarded @ IH264ENC_DynamicParams::interCodingParams + Vertical Search Range for P frames + @param searchRangeHorB :regarded @ IH264ENC_DynamicParams::interCodingParams + Horizontal Search Range for B frames + @param searchRangeVerB :regarded @ IH264ENC_DynamicParams::interCodingParams + Vertical Search Range for B frames + @param interCodingBias :regarded @ IH264ENC_DynamicParams::interCodingParams + Bias Control for having a macro block coded as inter vs Intra + Refer IH264ENC_BiasFactor for possible values + @param skipMVCodingBias :regarded @ IH264ENC_DynamicParams::interCodingParams + Bias Control for having a macro block use skip MV vs regular MV + refer IH264ENC_BiasFactor for possible values + @param minBlockSizeP : regarded @ IH264ENC_DynamicParams::interCodingParams + minimum block size for P frames. Refer IH264ENC_InterBlockSize + enumeration to see the valid values + @param minBlockSizeB : regarded @ IH264ENC_DynamicParams::interCodingParams + minimum block size for B frames. Refer IH264ENC_InterBlockSize + enumeration to see the valid values + +*/ + +typedef struct IH264ENC_InterCodingParams { + XDAS_Int8 interCodingPreset; + XDAS_Int16 searchRangeHorP; + XDAS_Int16 searchRangeVerP; + XDAS_Int16 searchRangeHorB; + XDAS_Int16 searchRangeVerB; + XDAS_Int8 interCodingBias; + XDAS_Int8 skipMVCodingBias; + XDAS_Int8 minBlockSizeP; + XDAS_Int8 minBlockSizeB; + XDAS_Int8 meAlgoMode; + +} IH264ENC_InterCodingParams; + +/** + + @struct IH264ENC_IntraCodingParams + @brief This structure contains all the parameters which controls Intra + encoding + + @param intraCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + INTRA_CODING_DEFAULT other wise INTRA_CODING_USER_DEFINED + @param lumaIntra4x4Enable + This parameter controls the Luma Intra4x4 encoding in video encoder. A + bit-field is given for each Luma intra4x4 mode as shown below. This + field is H.264 specific HOR_UP|VERT_LEFT|HOR_DOWN| + VERT_RIGHT|DIAG_DOWN_RIGHT|DIAG_DOWN_LEFT|DC|HOR|VER + Set/ reset particular bit to enable/disable that mode + (0=disable, 1=enable). DC (bit-2)is don't care + @param lumaIntra8x8Enable + This parameter controls the Luma Intra8x8 encoding in video encoder. A + bit-field is given for each Luma intra8x8 mode as shown below. + HOR_UP|VERT_LEFT|HOR_DOWN|VERT_RIGHT|DIAG_DOWN_RIGHT|DIAG_DOWN_LEFT| + DC|HOR|VER Set/ reset particular bit to enable/disable that + mode (0=disable, 1=enable) DC (bit-2)is don't care + Example : 139(decimal) ==> 0x8B =>> 010001011 (bits) ==> + HOR, VER, VERT_LEFT + are enabled and DC is always enabled + @param lumaIntra16x16Enable + This parameter controls the Luma Intra16x16 encoding in video encoder. + A bit-field is given for each Luma intra16x16 mode as shown below. + PLANE|DC|HOR|VER + Set/ reset particular bit to enable/disable that + mode (0=disable, 1=enable). DC (bit-2)is don't care + @param chromaIntra8x8Enable + This parameter controls the chroma Intra8x8 encoding in video encoder. + A bit-field is given for each chroma intra8x8 mode as shown below. + PLANE|VER|HOR|DC + Set/ reset particular bit to enable/disable + that mode (0=disable, 1=enable) DC (bit-0)is don't care + @param chromaComponentEnable + This parameter controls the chroma Intra prediction search. User + can choose to perfom chroma intra estimation for both Cb and Cr + samples or only on Cr samples. For more details + refer IH264ENC_ChormaComponent + @param intraRefreshMethod + Mechanism to do intra Refresh, see IH264ENC_IntraRefreshMethods + for valid values + @param intraRefreshRate + Rate at which intra Refresh is done, This rate is specified as + One IntraMB per # MBs. For example if rate is 20 it means that + there has to be one intra MB(s) per 20 Mbs. + When intraRefreshMethod == IH264_INTRAREFRESH_GDR, this parameter + is treated/interpreted number of rows to be intra refreshed per + frame. + + @param gdrOverlapRowsBtwFrames + Defines the Overlap of the Intra Refresh Region between successive + frame in case the intraRefreshMethod == IH264_INTRAREFRESH_GDR or + else treated to be don't care. + Again gdrOverlapRowsBtwFrames should be less than intraRefreshRate. + + @param constrainedIntraPredEnable + Controls the intra macroblock coding in P slices. + Valid values are [0,non-zero] + +*/ + +typedef struct IH264ENC_IntraCodingParams { + XDAS_Int8 intraCodingPreset; + XDAS_Int16 lumaIntra4x4Enable; + XDAS_Int16 lumaIntra8x8Enable; + XDAS_Int8 lumaIntra16x16Enable; + XDAS_Int8 chromaIntra8x8Enable; + XDAS_Int8 chromaComponentEnable; + XDAS_Int8 intraRefreshMethod; + XDAS_Int16 intraRefreshRate; + XDAS_Int16 gdrOverlapRowsBtwFrames; + XDAS_Int16 constrainedIntraPredEnable; + XDAS_Int8 intraCodingBias; +} IH264ENC_IntraCodingParams; + + +/** + + @struct IH264ENC_NALUControlParams + @brief This structure contains all the parameters which define the + control mechanism for insertion of different NALU types at + different point in video sequence + + @param naluControlPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_NALU_CONTROL_DEFAULT other wise IH264_NALU_CONTROL_USERDEFINED + @param naluPresentMaskStartOfSequence + This parameter controls the insertion of different NALU at Start of + Sequence + A bit-field is given for each NALU type as shown below. This field is +\n ---------------------------------------------------------------------\n +\n 7| 6| 5| 4| 3| 2| 1| 0 \n +\n SPS|SEI|IDR_SLICE|SLICE_DP_C|SLICE_DP_B|SLICE_DP_A|SLICE|UNSPECIFIED \n +\n ---------------------------------------------------------------------\n +\n---------------------------------------------- +\n 14| 13| 12| 11| 10| 9| 8| +\n UD_SEI|SPS_VUI|FILLER|EOSTREAM|EOSEQ|AUD|PPS| +\n---------------------------------------------- + Set/ reset particular bit to enable/disable that insertion of that + NALU (0=disable, 1=enable) + UNSPECIFIED (bit-0), SLICE_DP_A(bit-2), SLICE_DP_B(bit-3), + SLICE_DP_C(bit-4), IDR_SLICE(bit-5), EOSEQ (bit-10) and + EOSTREAM (bit-11) are don't care and assumed to be zero . + SPS (bit-7), PPS(bit-8) are don't care and assumed to be one . + @param naluPresentMaskIDRPicture + This parameter controls the insertion of different NALU at IDR picture + A bit-field is given for each NALU type as shown below. This field is +\n ---------------------------------------------------------------------\n +\n 7| 6| 5| 4| 3| 2| 1| 0 \n +\n SPS|SEI|IDR_SLICE|SLICE_DP_C|SLICE_DP_B|SLICE_DP_A|SLICE|UNSPECIFIED \n +\n ---------------------------------------------------------------------\n +\n---------------------------------------------- +\n 14| 13| 12| 11| 10| 9| 8| +\n UD_SEI|SPS_VUI|FILLER|EOSTREAM|EOSEQ|AUD|PPS| +\n---------------------------------------------- + Set/ reset particular bit to enable/disable that insertion of that + NALU (0=disable, 1=enable) + UNSPECIFIED (bit-0), SLICE_DP_A(bit-2), SLICE_DP_B(bit-3), + SLICE_DP_C(bit-4), IDR_SLICE(bit-5), EOSEQ (bit-10) and + EOSTREAM (bit-11) are don't care and assumed to be zero . + @param naluPresentMaskIntraPicture + This parameter controls the insertion of different NALU at I picture + A bit-field is given for each NALU type as shown below. This field is +\n ---------------------------------------------------------------------\n +\n 7| 6| 5| 4| 3| 2| 1| 0 \n +\n SPS|SEI|IDR_SLICE|SLICE_DP_C|SLICE_DP_B|SLICE_DP_A|SLICE|UNSPECIFIED \n +\n ---------------------------------------------------------------------\n +\n---------------------------------------------- +\n 14| 13| 12| 11| 10| 9| 8| +\n UD_SEI|SPS_VUI|FILLER|EOSTREAM|EOSEQ|AUD|PPS| +\n---------------------------------------------- + Set/ reset particular bit to enable/disable that insertion of that + NALU (0=disable, 1=enable) + UNSPECIFIED (bit-0), SLICE_DP_A(bit-2), SLICE_DP_B(bit-3), + SLICE_DP_C(bit-4), IDR_SLICE(bit-5), EOSEQ (bit-10) and + EOSTREAM (bit-11) are don't care and assumed to be zero . + @param naluPresentMaskNonIntraPicture + This parameter controls the insertion of different + NALU at NON intra picture + A bit-field is given for each NALU type as shown below. This field is +\n ---------------------------------------------------------------------\n +\n 7| 6| 5| 4| 3| 2| 1| 0 \n +\n SPS|SEI|IDR_SLICE|SLICE_DP_C|SLICE_DP_B|SLICE_DP_A|SLICE|UNSPECIFIED \n +\n ---------------------------------------------------------------------\n +\n---------------------------------------------- +\n 14| 13| 12| 11| 10| 9| 8| +\n UD_SEI|SPS_VUI|FILLER|EOSTREAM|EOSEQ|AUD|PPS| +\n---------------------------------------------- + Set/ reset particular bit to enable/disable that insertion of that + NALU (0=disable, 1=enable) + UNSPECIFIED (bit-0), SLICE_DP_A(bit-2), SLICE_DP_B(bit-3), + SLICE_DP_C(bit-4), IDR_SLICE(bit-5), EOSEQ (bit-10) and + EOSTREAM (bit-11) are don't care and assumed to be zero . + @param naluPresentMaskEndOfSequence + This parameter controls the insertion of different NALU at End of Seq + A bit-field is given for each NALU type as shown below. This field is +\n ---------------------------------------------------------------------\n +\n 7| 6| 5| 4| 3| 2| 1| 0 \n +\n SPS|SEI|IDR_SLICE|SLICE_DP_C|SLICE_DP_B|SLICE_DP_A|SLICE|UNSPECIFIED \n +\n ---------------------------------------------------------------------\n +\n---------------------------------------------- +\n 14| 13| 12| 11| 10| 9| 8| +\n UD_SEI|SPS_VUI|FILLER|EOSTREAM|EOSEQ|AUD|PPS| +\n---------------------------------------------- + Set/ reset particular bit to enable/disable that insertion of that + NALU (0=disable, 1=enable) + UNSPECIFIED (bit-0), SLICE_DP_A(bit-2), SLICE_DP_B(bit-3), + SLICE_DP_C(bit-4), SPS_VUI (bit-13), FILLER (bit-12), AUD(bit-9), + PPS(bit-8), SPS(bit-7), SEI(bit-6), IDR_SLICE(bit-5), SLICE (bit-1) + are don't care and assumed to be zero . + +*/ + +typedef struct IH264ENC_NALUControlParams { + XDAS_Int16 naluControlPreset; + XDAS_Int16 naluPresentMaskStartOfSequence; + XDAS_Int16 naluPresentMaskIDRPicture; + XDAS_Int16 naluPresentMaskIntraPicture; + XDAS_Int16 naluPresentMaskNonIntraPicture; + XDAS_Int16 naluPresentMaskEndOfSequence; + +} IH264ENC_NALUControlParams; + +/** + + @struct IH264ENC_SliceCodingParams + @brief This structure contains all the parameters which controls Slice + encoding + + @param sliceCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_SLICECODING_DEFAULT + + @param sliceMode : regarded @ IH264ENC_DynamicParams::sliceCodingParams + This defines the control mechanism to split a picture in slices. + It can be either MB based or bytes based + + @param sliceUnitSize : regarded @ IH264ENC_DynamicParams::sliceCodingParams + The meaning of this parameter depends upon sliceMode. + sliceMode == IH264_SLICEMODE_MBUNIT then this + parameter informs the number of Macroblocks in one slice + sliceMode == IH264_SLICEMODE_BYTES then this + parameter informs the number of bytes in one slice + sliceMode == IH264_SLICEMODE_OFFSET then this + parameter informs the number of offset information provided by user. + Actual offset are provided with sliceStartOffset + + @param sliceStartOffset[IH264ENC_MAX_NUM_SLICE_START_OFFSET] : regarded @ + IH264ENC_DynamicParams::sliceCodingParams row numbering is assumed to + start from 0. Enteris in this array must have numbers in ascending + order. first slice of the picture is always starting from 0th row + of the picture so 0th entry is the offset of second slice in picture + Ex 1 : sliceStartRowNum[0] = 25 , + sliceStartRowNum[1] = 30, sliceStartRowNum[2] = 40 + will result into 4 slices starting from row# 0, 25, 30 and 40 + Ex 2 : sliceStartRowNum[0] = 25 , sliceStartRowNum[1] = 70, + sliceStartRowNum[2] = 60 is invalid + Ex 3 : sliceStartRowNum[0] = 25 , sliceStartRowNum[1] = 50, + sliceStartRowNum[2] = 100 + will result into 3 slices starting from row# 0, 25 and 50 + {if number of rows in picture < (100 + 1) } + + + @param streamFormat : ignored @ IH264ENC_DynamicParams::sliceCodingParams + Controls the type of stream : byte stream format or NALU format + refer IH264ENC_StreamFormat for possible values + +*/ + +typedef struct IH264ENC_SliceCodingParams { + XDAS_Int8 sliceCodingPreset; + XDAS_Int16 sliceMode; + XDAS_Int32 sliceUnitSize; + XDAS_Int8 sliceStartOffset[IH264ENC_MAX_NUM_SLICE_START_OFFSET]; + XDAS_Int8 streamFormat; + +} IH264ENC_SliceCodingParams; + + +/** + + @struct IH264ENC_LoopFilterParams + @brief This structure contains all the parameters which controls loop + filtering operations + + @param loopfilterPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_SLICECODING_DEFAULT + @param loopfilterDisableIDC + Controls H.264 loop filter disabling options + @param filterOffsetA + alpha offset for loop filter [-12, 12] even number + @param filterOffsetB + beta offset for loop filter [-12, 12] even number + + +*/ +typedef struct IH264ENC_LoopFilterParams { + XDAS_Int8 loopfilterPreset; + XDAS_Int8 loopfilterDisableIDC; + XDAS_Int8 filterOffsetA; + XDAS_Int8 filterOffsetB; + +} IH264ENC_LoopFilterParams; + +/** + + @struct IH264ENC_FMOCodingParams + @brief This structure contains all the parameters which controls FMO behavior + + @param fmoCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_FMOCODING_DEFAULT + @param numSliceGroups + Total Number of slice groups, valid enteries are [0,8] + @param sliceGroupMapType + For Valid enteries see IH264ENC_SliceGroupMapType + @param sliceGroupChangeDirectionFlag + Only valid when sliceGroupMapType is equal to + IH264_RASTER_SCAN_SLICE_GRP, + IH264_WIPE_SLICE_GRP or IH264_WIPE_SLICE_GRP. + For valid values refer IH264ENC_SliceGroupChangeDirection + @param sliceGroupChangeRate + Only valid when sliceGroupMapType is equal to + IH264_RASTER_SCAN_SLICE_GRP, + IH264_WIPE_SLICE_GRP or IH264_WIPE_SLICE_GRP + valid values are : [0, factor of number of Mbs in a row] + @param sliceGroupChangeCycle + Only valid when sliceGroupMapType is equal to + IH264_RASTER_SCAN_SLICE_GRP, + IH264_WIPE_SLICE_GRP or IH264_WIPE_SLICE_GRP + Valid values can be 0 to numMbsRowsInPicture, also constrained by + sliceGroupChangeRate*sliceGroupChangeCycle < totalMbsInFrameOnly valid + when sliceGroupMapType is equal to IH264_RASTER_SCAN_SLICE_GRP. + valid values are : [0, factor of number of Mbs in a row] + @param sliceGroupParams[IH264ENC_MAXNUMSLCGPS] + This field is useful in case of sliceGroupMapType equal to either + IH264_INTERLEAVED_SLICE_GRP or IH264_FOREGRND_WITH_LEFTOVER_SLICE_GRP + In both cases it has different meaning: + In case of IH264_INTERLEAVED_SLICE_GRP: + The i-th entery in this array is used to specify the number of + consecutive slice group macroblocks to be assigned to the i-th slice + group in raster scan order of slice group macroblock units. + Valid values are 0 to totalMbsInFrame again constrained by sum of + all the elements shouldn't exceed totalMbsInFrame + In case of IH264_FOREGRND_WITH_LEFTOVER_SLICE_GRP: + First entry in the array specify the start position of foreground + region in terms of macroblock number, valid values are + [0, totalMbsInFrame-1] + Second entry in the array specify the end position of foreground + region in terms of macroblock number, valid values are + [0, totalMbsInFrame-1] with following constrains: + endPos > startPos && endPos%mbsInOneRow > startPos%mbsInOneRow + + @todo Review this structure and see all the fields are sufficient enough + + +*/ + +typedef struct IH264ENC_FMOCodingParams { + XDAS_Int8 fmoCodingPreset; + XDAS_Int8 numSliceGroups; + XDAS_Int8 sliceGroupMapType; + XDAS_Int8 sliceGroupChangeDirectionFlag; + XDAS_Int8 sliceGroupChangeRate; + XDAS_Int16 sliceGroupChangeCycle; + XDAS_Int16 sliceGroupParams[IH264ENC_MAXNUMSLCGPS]; +} IH264ENC_FMOCodingParams; + + +/** + + @struct IH264ENC_VUICodingParams + @brief This structure contains all the parameters which controls VUI + parameters. Refer Annex E of the H.264 standard for more details + of VUI and parameters + @param vuiCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IH264_VUICODING_DEFAULT + @param aspectRatioInfoPresentFlag + This controls the insertion of aspect ratio information in VUI part + of bit-stream + zero : No aspect ratio related information is transmitted + non-zero : aspect ratio related information is transmitted + @param aspectRatioIdc + Encoder inserts aspectRatioIdc as it is in the bit-stream. It is + user's responsibility to feed appropriate value of this. + Refer Table E-1 of H264 standard (or enum IH264ENC_AspectRatioIdc) + for valid values of this. + when aspectRatioIdc == IH264ENC_ASPECTRATIO_EXTENDED(255), encoder + will look at IVIDENC2_DynamicParams::sampleAspectRatioHeightand + IVIDENC2_DynamicParams::sampleAspectRatioWidth and use them as + sar_height and sar_width respectively. aspectRatioIdc is left to + user to provide correct value. + if aspectRatioInfoPresentFlag ==0 then encoder ignores + this parameter + @param videoSignalTypePresentFlag + This controls the insertion of video signal type in VUI part of + bit-stream + zero : No video signal related information is transmitted + non-zero : video signal related information is transmitted + @param videoFormat + Encoder inserts videoFormat(lower 3 bits) as it is in the bit-stream. + It is user's responsibility to feed appropriate value of this. + Refer Table E-2 H264 standard (or enum IH264ENC_VideoFormat) + for valid values of this. + @param videoFullRangeFlag + zero: video range is not full{0, 255} ; non-zero: video range is full + @param timingInfoPresentFlag + This controls the insertion of timing info related parameters in + VUI part of bit-stream + @param hrdParamsPresentFlag + This controls the insertion of HRD parameters in + VUI part of bit-stream + @param numUnitsInTicks + This controls the insertion of numUnitsInTicks parameter in + VUI part of bit-stream. + Valid values are [1, targetFrameRate] + If this parameter is set by user then the targetFrameRate + has multiplication factor of numUnitInTicks instead of 1000 +*/ + +typedef struct IH264ENC_VUICodingParams { + XDAS_Int8 vuiCodingPreset; + XDAS_UInt8 aspectRatioInfoPresentFlag; + XDAS_UInt8 aspectRatioIdc; + XDAS_UInt8 videoSignalTypePresentFlag; + XDAS_UInt8 videoFormat; + XDAS_UInt8 videoFullRangeFlag; + XDAS_UInt8 timingInfoPresentFlag; + XDAS_UInt8 hrdParamsPresentFlag; + XDAS_UInt32 numUnitsInTicks; + + +} IH264ENC_VUICodingParams; + +/** + + @struct IH264ENC_StereoInfoParams + @brief This structure contains all the parameters which have Stereo + Video info for SEI message. + @param stereoInfoPreset + This Preset controls the Enable/Disable of stereo video coding & + if its enable then controls the USER_DEFINED vs DEFAULT mode. + If User is not aware about following fields, it should be set + as IH264_STEREOINFO_ENABLE_DEFAULT. + 0 :Stereo Video Coding is Disabled. + 1 :Default stereo video information parameters . + 2 :User defined steroe video information pamameters. + @remarks - When stereo video coding is enabled then input content type + (coding type) should be Interlaced coding. + @param topFieldIsLeftViewFlag + This indicates the top & bottom field in video coded sequence + as a left view or right view + non-zero :top fields in the coded video sequence represent a left view & the + bottom fields in the coded video sequence represent a right view. + zero :vice-versa. + @param viewSelfContainedFlag + This controls the Left/Right view should Refer/NotRefer to + Left/Right view. + zero :Leftview can refer to Rightview or Leftview & Rightview can refer to + Leftview or Rightview. + i.e.Possible values for left_view_self_contained_flag = 0 && + right_view_self_contained_flag = 0 in bit-stream. + non-zero:Leftview cannot refer to Rightview & Rightview cannot refer to + Leftview. + i.e Possible values for left_view_self_contained_flag = 1 && + right_view_self_contained_flag = 1 in bit-stream. + @remarks - This viewSelfContainedFlag overrides the interlaceCodingType. + viewSelfContainedFlag == 0 forces interlaceCodingType = ARF + viewSelfContainedFlag == 1 forces interlaceCodingType = SPF +*/ +typedef struct IH264ENC_StereoInfoParams { + XDAS_UInt8 stereoInfoPreset; + XDAS_UInt8 topFieldIsLeftViewFlag; + XDAS_UInt8 viewSelfContainedFlag; +}IH264ENC_StereoInfoParams; + +/** + + @struct IH264ENC_FramePackingSEIParams + @brief This structure contains all the parameters for Frame packing + SEI message. + @param framePackingPreset + This Preset controls the Enable/Disable of Frame packing + SEI message encoding.If its enable then controls + the USER_DEFINED vs DEFAULT mode. + If User is not aware about following fields, it should be set + as IH264_FRAMEPACK_SEI_ENABLE_DEFAULT. + 0 :Frame packing SEI is Disabled. + 1 :Default Frame packing SEI parameters . + 2 :User defined Frame packing SEI information pamameters. + @remarks - When Frame packing SEI coding is enabled then input content + type (coding type) should be Progressive coding. + @param framePackingType + indicates the type of packing arrangement of the frames as + specified standard. Refer IH264ENC_FramePackingType + @param frame0PositionX + location of the upper left sample of frame 0 (Left view) in + horizontal direction. Allowed values are [0,15]. Only lower + 4 bits of this parameter are significant. + @param frame0PositionY + location of the upper left sample of frame 0 (Left view) in + vertical direction. Allowed values are [0,15]. Only lower + 4 bits of this parameter are significant. + @param frame1PositionX + location of the upper left sample of frame 1 (Right view) in + horizontal direction. Allowed values are [0,15]. Only lower + 4 bits of this parameter are significant. + @param frame1PositionY + location of the upper left sample of frame 1 (Right view) in + vertical direction. Allowed values are [0,15]. Only lower + 4 bits of this parameter are significant. + @param reservedByte + reserved byte that needs to be encoded as part of SEI message + "frame_packing_arrangement_reserved_byte" + User should set it to 0 as current standard (March 2010) allows + only 0 of this value. This is kept for future provisions. + +*/ +typedef struct IH264ENC_FramePackingSEIParams { + XDAS_UInt8 framePackingPreset; + XDAS_UInt8 framePackingType; + XDAS_UInt8 frame0PositionX; + XDAS_UInt8 frame0PositionY; + XDAS_UInt8 frame1PositionX; + XDAS_UInt8 frame1PositionY; + XDAS_UInt8 reservedByte; +}IH264ENC_FramePackingSEIParams; + +/** + + @struct IH264ENC_SVCCodingParams + @brief This structure contains all the parameters which controls SVC + parameters. Refer Annex G of the H.264 standard for more details + of SVC and parameters + + @param svcExtensionFlag + This parameter configures the codec put SVC extensions in the + bit-stream. For normal H.264 operation this Flag needs to be ZERO + (default value). For Encoder instance to encode SSPS, Prefix-NALU, + Coded Slice in the bit-stream, this flag needs to be set. + + Allowed Values are [0,1,2] + + 0 - Disables all SVC features/syntaxes and rest of the structure + is not read/respected. + 1 - Encodes the required SVC related syntaxes of the layer for + which H.264 Codec has been instantiated. + 2 - Encoder the required SVC related syntaxes of the layer for + which H.264 Codec has been instantiated + Only in this mode, the JSVM error concealment will work on + encoded bitstreams as in this mode even Spatial/CGS is also + coded the MGS way (i.e. by setting + adaptive_xxx_prediction_flag and + default_xxxx_prediction_flag to zero). + + @param dependencyID + This parameter tell whether the current instance is for Base layer + or for enhancement layer and also conveys Layer ID Info. This field + is respected only when svcExtensionFlag is set. For configuring the + encoder instance for BL then this parameter should be ZERO. For + configuring the encoder instance for EL, this parameter should hold + the value of the layer ID. + + @param qualityID + This parameter tells Quality ID of the layer that the current instance + of encoder is going to encode. + This field is respected only when svcExtensionFlag is set. For + configuring the encoder instance for BL then this parameter should be + ZERO. + + @param enhancementProfileID + This parameter conveys the enhancement encoder instance like what + should be the profile ID to be encoded in the Sub-Sequence Parameter + Set (SSPS).This parameter is dont care when, the svcExtensionFlag is + not set.Possible values are IH264SVC_BASELINE_PROFILE (83) or + IH264SVC_HIGH_PROFILE (86) + @param layerIndex + This parameter conveys the enhancement encoder instance like what + should be the pic_parameter_set_id and seq_parameter_set_id to be + encoded in the Picture Parameter Set (PPS) and Sub-Sequence Parameter + Set (SSPS). layerIndex is dont care or treated to be ZERO when + svcExtensionFlag is not enabled. + @param refLayerDQId + This parameter conveys the the DQ Id of the ReferenceLayer. + +*/ + +typedef struct IH264ENC_SVCCodingParams { + XDAS_UInt8 svcExtensionFlag; + XDAS_UInt8 dependencyID; + XDAS_UInt8 qualityID; + XDAS_UInt8 enhancementProfileID; + XDAS_UInt8 layerIndex; + XDAS_Int8 refLayerDQId; + +} IH264ENC_SVCCodingParams; + +/**< + + @struct IH264ENC_Params + @brief This structure defines the Create time parameters for all + H264ENC objects + + @param videnc2Params must be followed for all video encoders. + Base class create params + @param rateControlParams Controls all Rate Control related parameters + @param interCodingParams Controls all Inter coding related parameters + @param intraCodingParams Controls all Intra coding related parameters + + @param nalUnitControlParams Controls the insertion of different NALUs at + different access points in video sequence + @param sliceCodingParams Controls all Slice coding related parameters + @param loopFilterParams Controls the in-loop filtering process + @param fmoCodingParams Controls the FMO behavior + @param vuiCodingParams Controls the VUI (Video Usability Information) + parameters. Refer Annex E for more details of + @param stereoInfoParams Controls the Stereo Video Information for SEI + NAL Unit. + @param framePackingSEIParams This structure contains all the parameters + for Frame packing SEI message. + @param svcCodingParams Controls the SVC coding parameters + + @param interlaceCodingType Controls the type of interlaced coding, refer + IH264ENC_InterlaceCodingType for more details + @param bottomFieldIntra This field is valid only for interlaced sequences + 0 = Bottom field of the first I frame in the GOP encoded as + P field. + non-zero = Bottom field of the first I frame in the GOP encoded as I + field. + + @param IDRFrameInterval Interval b/w two IDR frames, unit of this + parameter is intraFrameInterval + Ex: 0 : Only first I frame as IDR + 1 : All I frames are IDR. + 2 : 1 out of 2 I frames are IDR starting from first I frame + -ve values are not allowed. + + @param gopStructure Defines the gop structure type: + uniform/non-uniform. For more information refer + IH264ENC_GOPStructure + @param entropyCodingMode Controls the entropy coding type, see + IH264ENC_EntropyCodingMode for allowed values + @param transformBlockSize Tranform Block size. Refer + IH264ENC_TransformBlockSize + + @param log2MaxFNumMinus4 Limits the maximum frame number in the bit-stream + to (1<< (log2MaxFNumMinus4 + 4)) Range[0,12] + @param picOrderCountType Picture Order count type Valid values refer + IH264ENC_PicOrderCountType + @param enableWatermark This Parameter Enables or disables Water Mark + SEI message in the bit stream + 0 Disable, Non-Zero - Enable + @param pConstantMemory + This pointer points to the the memory area where constants are + located. It has to be in DDR addressable space by vDMA. This is + use ful to allow relocatable constants for the applications which + doesn't use M3 as host. Actual memory controller/allocator + is on another master processor. If this is set to NULL then + encoder assumes that all constants are pointed by symbol + H264ENC_TI_ConstData + + + @param maxIntraFrameInterval + This parameter contains the maximum Intra Frame interval. It is used + to reduce the memory requirement of refernce Buffers. Because for all + I frame/field configuration the reference frame buffers are not + required + @remarks For example, this field will be: + - 0 - Only first frame to be intra + coded. e.g. IPPPPPP... + - 1 - No inter frames (all intra + frames). + - 2 - Consecutive IPIPIP... sequence (if + no B frames). + - 3 - IPPIPP... or IPBIPBI... and so on. + + @param debugTraceLevel + This parameter configures the codec to dump a debug trace log + + @param lastNFramesToLog + This parameter configures the codec to maintain a history of last + N frames/pictures + + @param enableAnalyticinfo + This parameter configures the codec to expose analytic info like + MVs and SAD parameters + @param enableGMVSei + This Parameter Enable or disable the TI specific GMV SEI message + in the bit stream + 0 Disable, Non-Zero - Enable + + @param constraintSetFlags + Used to modify the values of constraint set flags that + are coded in te bit stream. The syntax of of this + flag is as follows + RESVD|RESVD|RESVD|PRESET|CST_0|CST_1|CST_2|CST_3 + if preset is set to zero then, CST flags are set by the + encoder internally. if preset is 1 then encoder takes the + preset values given by the user and encodes themin the + bit stream. Note that there are no error checks are placed + on the user defined values. + @param enableRCDO + This paramter is used to enable encoding a bit stream compliant to + Reduced Complexity Decoding Operations (RCDO) profile + + @param enableLongTermRefFrame + This paramter is used to enable support of long term reference frame. + Enabling this bit will instruct encoder to keep the recently marked + long-term frame in its refernce buffer list. So it increases the DDR + foot print by one or two frame buffers depends on the LTRPScheme used. + + @param LTRPPeriod + This parameter is used to specify the long-term reference frame + marking interval. This parameter is in use when + enableLongTermRefFrame = IH264ENC_LTRP_REFERTOP_REACTIVE or + IH264ENC_LTRP_REFERTO_PERIODICLTRP. + + @param numTemporalLayer + This parameter controls the temporal Levels in bit-stream. + 1 - Only Base Layer available in bit-stream. + 2 - Maximum Temporal Level 1 in bit-stream + 3 - Maximum Temporal Level 2 in bit-stream + 4 - Maximum Temporal Level 3 in bit-stream + @remarks - numTemporalLayer = 0 is not supported & its erroneous case. + + @param referencePicMarking + This parameter used to control the Reference Picture Marking + For any non-zero value means Long-term Picture (MMCO Commands) + 0 - Short-term Picture (Sliding Window) + 1 - Long-term Picture ( MMCO Commands) + @param reservedParams + Some part is kept reserved to add parameters later without + changing the foot print of interface object memory + + @todo + More parameters need to be added for Hieririchal frames, + error resilience options, SEI/VUI parameter options, Analytic exposure + from encoder like MVs and SAD parameters + + +*/ + +typedef struct { + IVIDENC2_Params videnc2Params; + IH264ENC_RateControlParams rateControlParams; + IH264ENC_InterCodingParams interCodingParams; + IH264ENC_IntraCodingParams intraCodingParams; + IH264ENC_NALUControlParams nalUnitControlParams; + IH264ENC_SliceCodingParams sliceCodingParams; + IH264ENC_LoopFilterParams loopFilterParams; + IH264ENC_FMOCodingParams fmoCodingParams; + IH264ENC_VUICodingParams vuiCodingParams; + IH264ENC_StereoInfoParams stereoInfoParams; + IH264ENC_FramePackingSEIParams framePackingSEIParams; + IH264ENC_SVCCodingParams svcCodingParams; + XDAS_Int8 interlaceCodingType; + XDAS_Int8 bottomFieldIntra; + XDAS_Int8 gopStructure; + XDAS_Int8 entropyCodingMode; + XDAS_Int8 transformBlockSize; + XDAS_Int8 log2MaxFNumMinus4; + XDAS_Int8 picOrderCountType; + /* XDAS_Int8 mbMetaDataEnable ; */ + XDAS_Int8 enableWatermark; + XDAS_Int32 IDRFrameInterval; + XDAS_Int32 pConstantMemory; + XDAS_Int32 maxIntraFrameInterval; + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + XDAS_Int8 enableAnalyticinfo; + XDAS_Int8 enableGMVSei; + XDAS_Int8 constraintSetFlags; + XDAS_Int8 enableRCDO; + XDAS_Int32 enableLongTermRefFrame; + XDAS_Int32 LTRPPeriod; + XDAS_Int8 numTemporalLayer; + XDAS_Int8 referencePicMarking; + XDAS_Int32 reservedParams[3]; +} IH264ENC_Params; + + +/**< + + @struct IH264ENC_Status + @brief This structure informs back the status of H264 encoder and tells the + value of each control parameter + + @param videnc2Status must be followed for all video encoders. + Base class status + + @param rateControlParams Controls all Rate Control related parameters + @param interCodingParams Controls all Inter coding related parameters + @param intraCodingParams Controls all Intra coding related parameters + + @param nalUnitControlParams Controls the insertion of different NALUs at + different access points in video sequence + @param sliceCodingParams Controls all Slice coding related parameters + @param loopFilterParams Controls the in-loop filtering process + @param fmoCodingParams Controls the FMO behavior + @param vuiCodingParams Controls the VUI (Video Usability Information) + parameters. Refer Annex E for more details + of VUI and parameters + @param stereoInfoParams Controls the Stereo Video Information for SEI + NAL Unit. + @param framePackingSEIParams This structure contains all the parameters + for Frame packing SEI message. + @param svcCodingParams Controls the SVC behavior + @param interlaceCodingType Controls the type of interlaced coding, refer + IH264ENC_InterlaceCodingType for more details + @param bottomFieldIntra This field is valid only for interlaced sequences + 0 = Bottom field of the first I frame in the GOP + encoded as P field. + non-zero = Bottom field of the first I frame in + the GOP encoded as I field. + @param gopStructure Defines the gop structure type: Open/Close. + For more information refer IH264ENC_GOPStructure + @param entropyCodingMode Controls the entropy coding type, see + IH264ENC_EntropyCodingMode for allowed values + @param transformBlockSize Tranform Block size. Refer + IH264ENC_TransformBlockSize + + @param log2MaxFNumMinus4 Limits the maximum frame number in the bit-stream + to (1<< (log2MaxFNumMinus4 + 4)) Range[0,12] + @param picOrderCountType Picture Order count type Valid values refer + IH264ENC_PicOrderCountType + @param enableWatermark This Parameter Enables or disables Water Mark + SEI message in the bit stream + 0 Disable, Non-Zero - Enable + @param IDRFrameInterval Interval b/w two IDR frames, it should be and + integer multiple of intraFrameInterval + + @param maxIntraFrameInterval + This parameter contains the maximum Intra Frame interval. It is used + to reduce the memory requirement of refernce Buffers. Because for all + I frame/field configuration the reference frame buffers are not + required + @remarks For example, this field will be: + - 0 - Only first frame to be intra + coded. e.g. IPPPPPP... + - 1 - No inter frames (all intra + frames). + - 2 - Consecutive IPIPIP... sequence (if + no B frames). + - 3 - IPPIPP... or IPBIPBI... and so on. + + @param debugTraceLevel + This parameter configures the codec to dump a debug trace log + + @param lastNFramesToLog + This parameter configures the codec to maintain a history of last + N frames/pictures + + @param enableAnalyticinfo + This parameter configures the codec to expose analytic info like + MVs and SAD parameters + + @param enableGMVSei + This Parameter Enable or disable the TI specific GMV SEI message + in the bit stream + 0 Disable, Non-Zero - Enable + + @param constraintSetFlags + Used to modify the values of constraint set flags that + are coded in te bit stream. The syntax of of this + flag is as follows + RESVD|RESVD|RESVD|PRESET|CST_0|CST_1|CST_2|CST_3 + if preset is set to zero then, CST flags are set by the + encoder internally. if preset is 1 then encoder takes the + preset values given by the user and encodes themin the + bit stream. Note that there are no error checks are placed + on the user defined values. + + @param enableRCDO + This paramter is used to enable encoding a bit stream compliant to + Reduced Complexity Decoding Operations (RCDO) profile + + @param enableLongTermRefFrame + This paramter is used to enable support of long term reference frame. + Enabling this bit will instruct encoder to keep the recently marked + long-term frame in its refernce buffer list. So it increases the DDR + foot print by one or two frame buffers depends on the LTRPScheme used. + + @param LTRPPeriod + This parameter is used to specify the long-term reference frame + marking interval. This parameter is in use when + enableLongTermRefFrame = IH264ENC_LTRP_REFERTOP_REACTIVE or + IH264ENC_LTRP_REFERTO_PERIODICLTRP. + + @param searchCenter seacrh Center for motion estimation + @param enableStaticMBCount Flag to indicate enable/disable Static MB count + support + @param extMemoryDebugTraceAddr This parameter reports the external + memory address (as seen by M3) where debug trace + information is being dumped + @param extMemoryDebugTraceSize This parameter reports the external + memory buffer size (in bytes) where debug trace + information is being dumped + @param numTemporalLayer This parameter controls the temporal Levels in + bit-stream. + @param referencePicMarking This parameter used to control the Reference + Picture Marking. + @param extErrorCode This parameter carries the sub extended error bits + set by encoder. Application/user can look into + these bits to correct his configuration. +*/ + +typedef struct { + IVIDENC2_Status videnc2Status; + + IH264ENC_RateControlParams rateControlParams; + IH264ENC_InterCodingParams interCodingParams; + IH264ENC_IntraCodingParams intraCodingParams; + IH264ENC_NALUControlParams nalUnitControlParams; + IH264ENC_SliceCodingParams sliceCodingParams; + IH264ENC_LoopFilterParams loopFilterParams; + IH264ENC_FMOCodingParams fmoCodingParams; + IH264ENC_VUICodingParams vuiCodingParams; + IH264ENC_StereoInfoParams stereoInfoParams; + IH264ENC_FramePackingSEIParams framePackingSEIParams; + IH264ENC_SVCCodingParams svcCodingParams; + + XDAS_Int8 interlaceCodingType; + XDAS_Int8 bottomFieldIntra; + XDAS_Int8 gopStructure; + XDAS_Int8 entropyCodingMode; + XDAS_Int8 transformBlockSize; + XDAS_Int8 log2MaxFNumMinus4; + XDAS_Int8 picOrderCountType; + XDAS_Int8 enableWatermark; + XDAS_Int32 IDRFrameInterval; + XDAS_Int32 maxIntraFrameInterval; + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + XDAS_Int8 enableAnalyticinfo; + XDAS_Int8 enableGMVSei; + XDAS_Int8 constraintSetFlags; + XDAS_Int8 enableRCDO; + XDAS_Int32 enableLongTermRefFrame; + XDAS_Int32 LTRPPeriod; + XDM_Point searchCenter; + XDAS_Int8 enableStaticMBCount; + XDAS_UInt32 *extMemoryDebugTraceAddr; + XDAS_Int8 numTemporalLayer; + XDAS_Int8 referencePicMarking; + XDAS_UInt32 extMemoryDebugTraceSize; + XDAS_Int8 enableROI; + XDAS_UInt32 extErrorCode[IH264ENC_EXTERROR_NUM_MAXWORDS]; +} IH264ENC_Status; + +/**< This structure must be the first field of all H264ENC instance objects */ +typedef struct IH264ENC_Obj { + struct IH264ENC_Fxns *fxns; +} IH264ENC_Obj; + +/**< This handle is used to reference all H264ENC instance objects */ +typedef struct IH264ENC_Obj *IH264ENC_Handle; + +/**numEntries > 1). + 2.Suggested value for this flag is 0 to have better performance + @params processParams : An array holding the process parameters viz., + handle,InArgs,outArgs etc of the channel(s) to be processed. + + */ + +typedef struct { + XDAS_Int32 numEntries; + XDAS_Int32 enableErrorCheck; + IH264ENC_ProcessParams processParams[IH264ENC_MAX_LENGTH_PROCESS_LIST]; +} IH264ENC_ProcessParamsList; + +/**< + + @struct IH264ENC_Fxns + @brief This structure defines of the operations on H264ENC objects + + @params IVIDENC2_Fxns : It is instance of base class. It contains all + function table + @params processMulti : pointer to the Function H264ENC_TI_encodemulti + +*/ +typedef struct IH264ENC_Fxns { + IVIDENC2_Fxns ividenc; + XDAS_Int32 (*processMulti)(IH264ENC_ProcessParamsList *processList); + +} IH264ENC_Fxns; + +#ifdef __cplusplus +} +#endif + +/*@}*/ /* ingroup HDVICP2H264 */ + +#endif /* _IH264ENC_H_ --} */ + +/* ========================================================================*/ +/* End of file : ih264enc.h */ +/*-------------------------------------------------------------------------*/ +/* Copyright (c) 2009 Texas Instruments, Incorporated. */ +/* All Rights Reserved. */ +/* ========================================================================*/ + diff --git a/packages/ivahd_codecs/ti/sdo/codecs/h264svcenc/ih264svcenc.h b/packages/ivahd_codecs/ti/sdo/codecs/h264svcenc/ih264svcenc.h new file mode 100644 index 0000000..ac4702a --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/h264svcenc/ih264svcenc.h @@ -0,0 +1,295 @@ +/* +******************************************************************************** + * HDVICP2.0 Based SVC Baseline Encoder + * + * "HDVICP2.0 Based SVC Baseline Encoder" is software module developed on TI's + * HDVICP2 based SOCs. This module is capable of compressing a 4:2:0 Raw + * video into a SVC baseline profile bit-stream. Based on ISO/IEC + * 14496-10." + * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ + * ALL RIGHTS RESERVED +******************************************************************************** +*/ +/** + ****************************************************************************** + * @file ih264svcenc.h + * + * @brief IH264SVCENC Interface Header + * + * @author: Venugopala Krishna (venugopala@ti.com) + * + * @version 0.0 (Apr 2010) : Initial version created + ***************************************************************************** +*/ + +/** + * @defgroup HDVICP2SVC IH264SVCENC_TI (V7M) + * @ingroup m3 + * + * The ISVCENC_TI interface enables encoding in SVC format + * + */ + +#ifndef _IH264SVCENC_H_ //--{ + +#define _IH264SVCENC_H_ + +#include +#include + +#include "ih264enc.h" + +/** @ingroup HDVICP2SVC */ +/*@{*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the macros define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/** + * Maximum number of instances of H.264 embedded inside SVC +*/ +#define IH264SVCENC_MAX_NUM_MULTI_INSTANCE (9) + +/** + Length of the version string. The memory to get version + number is owned by application +*/ +#define IH264SVCENC_VERSION_LENGTH (64) + + +/** + control method commands +*/ +#define IH264SVCENC_GETSTATUS XDM_GETSTATUS +#define IH264SVCENC_SETPARAMS XDM_SETPARAMS +#define IH264SVCENC_RESET XDM_RESET +#define IH264SVCENC_FLUSH XDM_FLUSH +#define IH264SVCENC_SETDEFAULT XDM_SETDEFAULT +#define IH264SVCENC_GETBUFINFO XDM_GETBUFINFO + +typedef IVIDENC2_Cmd IH264SVCENC_Cmd; + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the Enumeration define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/** + * @enum IH264SVCENC_ErrorBit + * @brief error informations of IVAHD SVC encoder implementation by TI. + * + * @remarks When an internal error occurs, the algorithm will return + * an error return value (e.g. EFAIL, EUNSUPPORTED) + * + * @remarks The value of each enum is the bit which is set. + * + * @remarks Bits 8-15 are defined by XDM and hence not used by codec + * implementation. + * rest all bits are used. XDM defined error bits are also active. + * + * @remarks The algorithm can set multiple bits to 1 based on conditions. + * e.g. it will set bits #XDM_FATALERROR (fatal) and + * #XDM_UNSUPPORTEDPARAM (unsupported params) in case + * of unsupported run time parameters. + * + */ + +typedef enum { + IH264SVCENC_LEVEL_INCOMPLAINT_PARAMETER = 0 + /**< Bit 0 - level incomplaint parameters. + * @remarks This error is applicable when some parameters are set + * which are not meeting the limit defined by H.264 standard + * Table A-1 Level limits. It can be categorized under + * following category : + * IH264ENC_LEVEL_INCOMPLAINT_RESOLUTION : Invalid width/height + * IH264ENC_LEVEL_INCOMPLAINT_HRDBUFSZIE : Invalid HrdBufferSize + * IH264ENC_LEVEL_INCOMPLAINT_BITRATE : Invalid Bit Rate + * IH264ENC_LEVEL_INCOMPLAINT_MBSPERSECOND : Invalid FrameRate/ + * resolution + * IH264ENC_LEVEL_INCOMPLAINT_DPBSIZE : Invalid DPB size + * For above 5 situations, only a signle bit (bit-0) is set as true + */ + +} IH264SVCENC_ErrorBit; + +/** + * @enum ISVCENC_Level + * @brief Level Identifier for H.264 Encoder +*/ +typedef enum { + IH264SVC_LEVEL_10 = 10 /**< Level 1.0 */ + +} IH264SVCENC_Level; + + + +/**< + * @struct IH264SVCENC_Params + * @brief This structure defines the Create time parameters for all + * H264SVCENC objects + * @param h264Params Create Parameters (Extended Class) of the H264 Encoder. + * As defined in the interface file (ih264enc.h) of H264 Encoder. + * + * @param inBufIndex Conveys how inBufs passed in the process is mapped to + * different layers/instances of Encoder. + * + * @param numberOfLayers Conveys number of layers to be encoded. This field is used + * in reading the number of entries of h264Params, inBufIndex etc. + * + * @param avcMode If numberOfLayers is set to be ONE, this flag determines whether + * generated Bitstream be SVC or AVC. Non-Zero means AVC or if ZERO its + * SVC. NOTE: This field is don't care if numberOfLayers is greater than ONE. + * +*/ + +typedef struct { + IH264ENC_Params h264Params[IH264SVCENC_MAX_NUM_MULTI_INSTANCE]; + XDAS_Int8 inBufIndex[IH264SVCENC_MAX_NUM_MULTI_INSTANCE]; + XDAS_UInt8 numberOfLayers; + XDAS_UInt8 avcMode; + +} IH264SVCENC_Params; + + +/**< + * + * @struct IH264SVCENC_Status + * @brief This structure informs back the status of SVC encoder and tells the + * value of each control parameter + * @param h264Status Status Parameters (Extended Class) of the H264 Encoder. + * As defined in the interface file (ih264enc.h) of H264 Encoder. + * + * @param videnc2Status IVIDENC2 Class Status Parameter given out by SVC Encoder after collating, + * information from different encoding layers/instances. + * + * @param numberOfLayers Conveys the information for how many number of layers encoding the SVC + * Encoder is configured. This field is used in reading the number of + * entries of h264Status etc. + * + * @param avcMode If numberOfLayers is set to be ONE, this flag determines whether + * generated Bitstream be SVC or AVC. Non-Zero means AVC or if ZERO its + * SVC. NOTE: This field is don't care if numberOfLayers is greater than ONE. + * +*/ + +typedef struct { + IVIDENC2_Status videnc2Status; + IH264ENC_Status h264Status[IH264SVCENC_MAX_NUM_MULTI_INSTANCE]; + + XDAS_UInt8 numberOfLayers; + XDAS_UInt8 avcMode; + +} IH264SVCENC_Status; + +/**< This structure must be the first field of all SVCENC instance objects */ +typedef struct IH264SVCENC_Obj { + struct IH264SVCENC_Fxns *fxns; +} IH264SVCENC_Obj; + +/**< This handle is used to reference all SVCENC instance objects */ +typedef struct IH264SVCENC_Obj *IH264SVCENC_Handle; + +/** + * + * @brief SVCVDEC Interface Header file. + * + * This File contains the interface structures and Macro definition + * required for integrating the H264VDEC. + * + * @author: Ashish Singh + * + * @version 0.1 (Apr 2010) : Base version borrowed from h264 universal decoder + * + * @version 0.2 (Apr 2010) : Implemented the interface structure for svc dec + * + * @version 0.3 (Sep 2010) : Added review comments and added one new default + * dynemic parameter [Ashish Singh ] + * + * @version 0.4 (Jan 2011) : Added error concealment mode exteded parameter + * in create time parameter and defined the enum + * for concealment modes [Ashish Singh] + * + * @version 0.5 (March 2011): Added spatial error concealment mode in enum + * define for concealment modes[Ashish Singh] + * + * @version 0.6 (April 2011): Added some more extended parametrs and also + * added some reserve parametrs in status/create + * dynemic structures [Ashish Singh] + * @version 0.7 (April 2011): Added one unregistred SSEI message for TI + * SVC encoder encoded stream[Ashish Singh] + * + ****************************************************************************** +*/ + +#ifndef IH264SVCVDEC_ +#define IH264SVCVDEC_ + +#include +#include +#include +#include + + +/** + * Macro defined for maximum scalable layer in access unit supported by codec + */ +#define IH264SVCVDEC_MAX_NUM_LAYER 0x9 +/** + * Macro defined for getting out the version of the encoder written + * Unregistred User SSEI messages + */ +#define VERSION_FIELD 0x4 +/** + ****************************************************************************** + * @struct IH264SVCVDEC_Obj + * + * @brief Modules object definition. This structure must be the first field + * of all H264SVCVDEC instance objects + * + * @param fxns : Structure type defining all functions necessary to + * implement the IH264VDEC interface. + ****************************************************************************** +*/ +typedef struct IH264SVCVDEC_Obj { + struct IH264SVCVDEC_Fxns *fxns; +} IH264SVCVDEC_Obj; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_Status + * + * @brief This structure defines parameters that describe the status of the + * SVC Decoder and any other implementation specific parameters. + * The status parameters are defined in the XDM data structure, + * IVIDDEC3_Status + * + * @param h264SvcDecStatusParams : array to hold the status of each layer in + * scalable stream + * @param viddec3Status : XDM Base class status structure + * + * @param errConcealmentMode : Error Concealment applied by H.264SVC + * Decoder + * @param numLayersPresent : Number of scalable layers present in AU + * + * @param layerDID : Array to store the spatial layer ID's + * present in AU + * @param layerTID : Array to store the Temporal layer ID + * present in AU + * @param layerQID : Array to store the Quality layer ID's + * present in AU + * @param reserved : Reserve for future uses + * + ****************************************************************************** +*/ +typedef struct IH264SVCVDEC_Status { + IH264VDEC_Status h264SvcDecStatusParams; + IVIDDEC3_Status viddec3Status; + XDAS_UInt32 errConcealmentMode; + XDAS_UInt32 numLayersPresent; + XDAS_Int32 layerDID[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_Int32 layerTID[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_Int32 layerQID[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt32 reserved[3]; +} IH264SVCVDEC_Status; + + +/** +****************************************************************************** +* @struct IH264SVCVDEC_Params +* +* @brief This structure defines the creation parameters for all H264SVCVDEC +* objects inside H264SVCVDEC object. This structure includes the +* xdm baseclass creation parameters and any other implementation +* specific parameters for SVC Decoder instance object. +* +* @param svcDecLayerParams : array to hold the init time parameter of +* each layer in scalable stream +* @param disablePreParsing : Flag for disable or enable the pre- +* Parsing of the svc stream +* +* @param reserved : Reserve for future uses +****************************************************************************** +*/ + +typedef struct IH264SVCVDEC_Params { + IH264VDEC_Params h264SvcDecLayerParams; + XDAS_UInt32 disablePreParsing; + XDAS_UInt32 reserved[3]; +} IH264SVCVDEC_Params; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_DynamicParams + * + * @brief This structure defines the run-time parameters and any other + * implementation specific parameters for an SVC instance object. + * The base run-time parameters are defined in the XDM data structure, + * IVIDDEC3_DynamicParams. + * + * @param h264SvcDecDynamicParams : array to store the hold the dynemic para + * meter for each layer of scalable stream + * + * @param reserved : Reserve for future uses + * + ****************************************************************************** +*/ + +typedef struct IH264SVCVDEC_DynamicParams { + IH264VDEC_DynamicParams h264SvcDecDynamicParams; + XDAS_UInt32 reserved[3]; +} IH264SVCVDEC_DynamicParams; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_InArgs + * + * @brief This structure defines the run-time input arguments for an H264 + * instance object (ISVCH264VDEC::process) + * + * @param viddec3InArgs : InArgs structure SVC Object + ****************************************************************************** +*/ +typedef struct IH264SVCVDEC_InArgs { + IH264VDEC_InArgs h264SvcDecLayerInArgs; +} IH264SVCVDEC_InArgs; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_OutArgs + * + * @brief This structure defines the run time output arguments for + * ISVCH264VDEC::process function + * + * @param svcDecLayerOutArgs : OutArgs structure SVC Object + ****************************************************************************** +*/ + +typedef struct IH264SVCVDEC_OutArgs { + IH264VDEC_OutArgs h264SvcDecLayerOutArgs; +} IH264SVCVDEC_OutArgs; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_Fxns + * + * @brief This structure contains pointers to all the XDAIS and XDM interface + * functions + * + * @param ividdec3 : This structure contains pointers to all the XDAIS and + * XDM interface functions + ****************************************************************************** +*/ +typedef struct IH264SVCVDEC_Fxns { + IVIDDEC3_Fxns ividdec3; +} IH264SVCVDEC_Fxns; + +/* + * IH264SVCVDEC_Handle + * This handle is used to reference all H264SVCVDEC instance objects + */ +typedef struct IH264SVCVDEC_Obj *IH264SVCVDEC_Handle; + +/* + * IH264SVCVDEC_Cmd + * This structure defines the control commands for the IMP4VENC module. + */ +typedef IVIDDEC3_Cmd IH264SVCVDEC_Cmd; + +/* + * IH264SVCVDEC_PARAMS + * Default parameter values for H264SVCVDEC instance objects + */ +extern IH264SVCVDEC_Params IH264SVCVDEC_PARAMS; +/* + * IH264SVCVDEC_TI_DYNAMICPARAMS + * Default dynamic parameter values for H264SVCVDEC instance objects + */ +extern IH264SVCVDEC_DynamicParams IH264SVCVDEC_TI_DYNAMICPARAMS; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_Scalability_TI_Info + * + * @brief This structure contains svc dec supported SEI message syntax + * elements + * + * @param parsed_flag :1 - Indicates that in the current process call, c + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * + * @param num_layers_minus1:(num_layers_minus1 + 1)specifies the number of + * scalable layers for which information is provided + * in the scalability information SEI message + * @param layer_id : specifies the layer identifier of the i-th + * scalable layer specified in the scalability information + * SEI message + * @param priority_id : indicates an upper bound for the priority_id values + * of the current scalable layer representation + * @param dependency_id : is equal to the values of dependency_id,of the VCL + * NAL units of the current scalable layer. + * @param quality_id :is equal to the values of quality_id,of the VCL + * NAL units of the current scalable layer. + * @param temporal_id :is equal to the values of temporal_id,of the VCL + * NAL units of the current scalable layer. + * @param bitrate_info_present_flag: specifies that the bit rate + * information for the current scalable + * layer representation is present/ + * not present in the + * scalability information SEI message + * @param frm_rate_info_present_flag:specifies that the frame rate + * information for the current scalable + * layer representation is present/not + * present in the scalability information + * SEI message + * @param frm_size_info_present_flag: specifies that the frame size + * information for the current scalable + * layer representation is present/not + * present in the scalability information + * SEI message + * @param avg_bitrate: indicates the average bit rate of the representation of + * the current scalable layer + * @param max_bitrate_layer:indicates an upper bound for the bit rate of the + * current scalable layer in any fixed size time + * window + * @param max_bitrate_layer_representation: indicates an upper bound for the + * bit rate of the current scalable + * layer representation in any fixed + * size time window + * @param max_bitrate_calc_window: specifies the size of the time window that + * is used for calculating the upper bounds + * for the bit rate of the current scalable + * layer + * @param constant_frm_rate_idc: indicates whether the frame rate of the + * current scalable layer representation is + * constant + * @param avg_frm_rate:indicates the average frame rate, in units of frames + * per 256 seconds, of the representation of the current scalable + * layer + * @param frm_width_in_mbs_minus1: indicate the width of the decoded pictures + * for the current scalable layer + * representation + * @param frm_height_in_mbs_minus1:indicate the height of the decoded + * pictures for the current scalable + * layer representation + * + ****************************************************************************** +*/ + +typedef struct IH264SVCVDEC_Scalability_TI_Info { + XDAS_UInt32 parsed_flag; + XDAS_UInt32 num_layers_minus1; + XDAS_UInt32 layer_id[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 priority_id[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 dependency_id[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 quality_id[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 temporal_id[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 bitrate_info_present_flag[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 frm_rate_info_present_flag[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 frm_size_info_present_flag[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt16 avg_bitrate[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt16 max_bitrate_layer[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt16 max_bitrate_layer_representation[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt16 max_bitrate_calc_window[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt16 constant_frm_rate_idc[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt16 avg_frm_rate[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt32 frm_width_in_mbs_minus1[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt32 frm_height_in_mbs_minus1[IH264SVCVDEC_MAX_NUM_LAYER]; +}IH264SVCVDEC_Scalability_TI_Info; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_UnRegSeiMessages_TI_Info + * + * @brief This structure contains Unregistred sei message encoded by the + * Texas Instruments svc netra encoder + * + * @param parsed_flag :1 - Indicates that in the current process call, c + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * + * @param layerOffset: array to store offset of the position of the scalable + * layer(SPS/SSPS/PPS/SLICE) encoded in + * current access unit + * + * @param layerSize: array to store the encoded each layer size + * + * @param num_layers: Number of layers encoded in the current access unit + * + * @param dependency_id: array to store the spatial layer ID + * + * @param quality_id: array to store the quality layer ID + * + * @param idr_flag : array to store the idr_flag info for each layer present + * in access unit + * + * @param ti_specific_unregiSeiMessage_version : + * version of the unregiustred sei message + * write by encoder for improving the decoder + * performance + * + * @param ti_specific_unregiMessagesFlag: Flag to tells that unregistred + * sei meesage is present in the stream + * + ****************************************************************************** +*/ + +typedef struct IH264SVCVDEC_UnRegSeiMessages_TI_Info { + XDAS_UInt32 parsed_flag; + XDAS_UInt32 layerOffset[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt32 layerSize[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt16 num_layers; + XDAS_UInt8 dependency_id[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 quality_id[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 idr_flag[IH264SVCVDEC_MAX_NUM_LAYER]; + XDAS_UInt8 ti_specific_unregiSeiMessage_version; + XDAS_UInt8 ti_specific_unregiSeiMessagesFlag; +}IH264SVCVDEC_UnRegSeiMessages_TI_Info; + +/** + ****************************************************************************** + * @struct IH264SVCVDEC_SSeiMessages + * + * @brief This structure contains all the supported SEI msg by svc decoder + * + * @param parsed_flag :1 - Indicates that in the current process call, c + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * + * @param scalability_info : structure instance for scalabality info SEI + * messages + * + ****************************************************************************** +*/ + +typedef struct IH264SVCVDEC_SSeiMessages { + XDAS_UInt32 parsed_flag; + IH264SVCVDEC_Scalability_TI_Info scalability_info; + IH264SVCVDEC_UnRegSeiMessages_TI_Info unregistersei_info; +}IH264SVCVDEC_SSeiMessages; + + +/** + ****************************************************************************** + * @enum IH264VDEC_errConcealmentMode + * @brief This enum indicates whether to apply error concealment or not + * + ****************************************************************************** +*/ +typedef enum { + IH264SVCVDEC_NO_CONCEALMENT = 0, + /** + * do not apply error concealment + */ + IH264SVCVDEC_APPLY_H264_ERRCONCEALMENT, + /** + * apply error concealment of h264 decoder + */ + IH264SVCVDEC_APPLY_SVC_ERRCONCEALMENT, + /** + * apply error concealment of svc decoder + */ + IH264SVCVDEC_APPLY_SVC_SPATIAL_ERRCONCEALMENT + /** + * apply error concealment of svc decoder + */ + +} IH264SVCVDEC_errConcealmentMode; + +/** + ****************************************************************************** + * @enum IH264SVCVDEC_preParsingMode + * @brief This enum indicates whether to enable or disable preparsing + * + ****************************************************************************** +*/ +typedef enum { + + IH264SVCVDEC_ENABLE_PREPARSING = 0, + /** + * Enable the preparsing, mostaly in error prone scenario + */ + IH264SVCVDEC_DISABLE_PREPARSING = 1 + /** + * Disalbe the preparsing, for video survilence scenarion, where + * drop of frame/slice don't happens + */ +}IH264SVCVDEC_preParsingMode; + + +#endif /* IH264SVCVDEC_ */ + diff --git a/packages/ivahd_codecs/ti/sdo/codecs/h264vdec/ih264vdec.h b/packages/ivahd_codecs/ti/sdo/codecs/h264vdec/ih264vdec.h new file mode 100755 index 0000000..187ca72 --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/h264vdec/ih264vdec.h @@ -0,0 +1,2692 @@ +/* +******************************************************************************* + * HDVICP2.0 Based H.264 HP Decoder + * + * "HDVICP2.0 Based H.264 HP Decoder" is a software module developed on TI's + * HDVICP2 based SOCs. This module is capable of decoding a compressed + * high/main/baseline profile H.264 bit-stream into a YUV 4:2:0 Raw video. + * Based on "ISO/IEC 14496-10". + * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ + * ALL RIGHTS RESERVED +******************************************************************************* +*/ + +/** +******************************************************************************* + * @file ih264vdec.h + * + * @brief H264VDEC Interface Header file. + * + * This File contains the interface structures and Macro definition + * required for integrating the H264VDEC. + * + * @author: Pavan Shastry (pavanvs@ti.com) + * + * @version 0.1 (Jan 2008) : Base version borrowed from DSP RnD + * @version 0.2 (Oct 2009) : Code commenting/cleanup. + * [Keshav] + * @version 0.3 (Sep 2010) : Added new structure IH264VDEC_SeiFramePacking + * and also added the new element frame_packing + * to the structure IH264VDEC_SeiMessages + * [Ramkumar] + * @version 0.4 (Sep 2010) : Added review comments and added one new default + * dynemic parameter [Ashish Singh ] + * @version 0.5 (Nov 2010) : Added new elements in status and params for + * debug trace [Resmi] + * @version 0.6 (Nov 2010) : Changes for indicating gaps in frame_num to app + * [Resmi] + * @version 0.7 (Dec 2010) : Extending the create param structure to accomodate + * configurability feature for the detection + * of CABAC and IPCM alignment errors. + * [Ramakrishna Adireddy] + * @version 0.8 (Dec 2010) : Extending the array size for registered and + * un-registered SEI and added a flag in each SEI + * message to indicate the overflow. + * [Ramakrishna Adireddy] + * @version 0.9 (Jan 2011) : Added new common str for storing up the Data + * elements required by SVC decoder + * [Ashish] + * @version 1.0(June 2011) : Added enableDualOutput param and enum for dualYuv + * support. + * [Vijay Kumar Yadav] + * @version 1.1(June 2011) : Added parameter required for dualYuv EC. + * [Vijay] + * @version 1.2 (Oct 2011) : Gaps in frame number enhancements + * [Ramakrishna Adireddy] + * @version 1.3 (Oct 2011) : Added WaterMark parameters. + * [Suresh Reddy] + * @version 1.4 (July 2012): Added new create time param to support decoding + * of specific frame types as requested by + * application [Mahantesh] +****************************************************************************** +*/ +#ifndef IH264VDEC_ +#define IH264VDEC_ + +#include +#include + +#define IH264VDEC_MAX_LENGTH_PROCESS_LIST (24) + +/** + ****************************************************************************** + * @struct IH264VDEC_Obj + * + * @brief Module’s object definition. This structure must be the first field + * of all H264VDEC instance objects + * + * @param fxns : Structure type defining all functions necessary to + * implement the IH264VDEC interface. + ****************************************************************************** +*/ +typedef struct IH264VDEC_Obj +{ + struct IH264VDEC_Fxns *fxns; +} IH264VDEC_Obj; + +/** + ****************************************************************************** + * @struct IH264VDEC_Status + * + * @brief This structure defines parameters that describe the status of the + * H264 Decoder and any other implementation specific parameters. + * The status parameters are defined in the XDM data structure, + * IVIDDEC3_Status + * + * @param viddec3Status : XDM Base class status structure (see ividdec3.h) + * + * @param svcTargetLayerDID : SVC Spatial target layer ID,need to set if svc + * codec flag is on else default set to 0. + * + * @param svcTargetLayerQID : SVC Quality target layer ID,need to set if svc + * codec flag is on else default set to 0. + * + * + * @param svcTargetLayerTID : SVC Temporal target layer ID,need to set if svc + * codec flag is on else default set to 0. + * + * @param debugTraceLevel: This parameter reports the debug trace level + * configured for the codec + * + * @param lastNFramesToLog: This parameter reports the number of last N + * pictures for which history has been maintained + * + * @param extMemoryDebugTraceAddr: This parameter reports the external + * memory address (as seen by M3) where debug trace + * information is being dumped + * + * @param extMemoryDebugTraceSize: This parameter reports the external + * memory buffer size(in bytes) where debug trace + * information is being dumped + * + * @param gapInFrameNum: This parameter reports the gap in frame_num + * observed in the current frame. It is overloaded + * with details of two things. + * LSB 1-bit [0:0]: Indicates whether SPS allows frame + * num gaps. + * Rest 31-bits [31:1]: Indicates the gap observed + * + * @param spsMaxRefFrames: This parameter reports max reference frames + * that get used for decoding of a given stream. + * If SPS is not parsed, this gives out the value + * based on level & resolution set in create time + * params. Otherwise, it gives out the parsed value + * + * @param enableDualOutput : This Parameter tells whether Dual output is + * enable or not. If enable then application needs + * to provide two extra buffer (one for DualLuma + * and another for DualChroma. + * + * @param reserved[2] : Left reserve for future purpose + * + ****************************************************************************** +*/ +typedef struct IH264VDEC_Status +{ + IVIDDEC3_Status viddec3Status; + XDAS_Int32 svcTargetLayerDID; + XDAS_Int32 svcTargetLayerTID; + XDAS_Int32 svcTargetLayerQID; + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + XDAS_UInt32 *extMemoryDebugTraceAddr; + XDAS_UInt32 extMemoryDebugTraceSize; + XDAS_UInt32 gapInFrameNum; + XDAS_UInt32 spsMaxRefFrames; + XDAS_UInt32 enableDualOutput; + XDAS_UInt32 reserved[2]; +} IH264VDEC_Status; + + /** + ****************************************************************************** + * @struct IH264VDEC_Params + * + * @brief This structure defines the creation parameters for all H264VDEC + * objects. This structure includes the xdm baseclass creation + * parameters and any other implementation specific parameters for + * H264 Decoder instance object. + * + * @param viddec3Params : XDM Baselass create time parameters. + * (see ividdec3.h) + * @param dpbSizeInFrames: Number of frames required by the DPB + * (Decoded Picture Buffer). This is the DPB size + * in number of frames. Also, See the enum + * IH264VDEC_dpbNumFrames. + * @param pConstantMemory : This pointer points to the the memory area where + * constants are located. Default value is NULL in + * which case, codec puts the constants in a + * default section. + * It has to be in DDR addressable space by + * vDMA. This is useful to allow relocatable + * constants for the applications which doesn't use + * M3 as host. Actual memory controller/allocator + * is on another master processor. + * If this is set to NULL then decoder assumes + * that all constants are pointed by symbol + * H264VDEC_TI_ConstData + * + * @param bitStreamFormat : Input bit stream format. Input bits stream can + * be IH264VDEC_NAL_UNIT_FORMAT or + * IH264VDEC_BYTE_STREAM_FORMAT. See the enum + * IH264VDEC_bitStreamFormat for details. + * The decoder supports IH264VDEC_BYTE_STREAM_FORMAT + * in both datasync mode and non datasync mode + * (i.e inputDataMode = IVIDEO_ENTIREFRAME). + * But the IH264VDEC_NAL_UNIT_FORMAT is supported + * only in datasync mode, i.e only when + * inputDataMode = IH264VDEC_NALUNIT_SLICEMODE. + * + * @param errConcealmentMode : If this is set to 1, it means that the YUV + * buffer passed in current process call needs + * concealment. If this is set to 0, it means that + * the YUV buffer passed in current process call + * does not concealment. Note that whether decoder + * actually performed the concealment or not is + * indicated by XDM_APPLIEDCONCEALMENT bit in + * extended error field + * + * @param temporalDirModePred: Parameter to enable/disable temporal direct + * Prediction mode. 0: Disable, 1:Enable + * If this Parameter is disabled set to 0), and + * if the B slice uses temporal direct mode, + * then the codec returns error for that slice. + * + * @param svcExtensionFlag : If required to decode SVC streams , set flag + * ON else default set to IH264SVCVDEC_EXT_FLAG + * + * @param svcTargetLayerDID : SVC Spatial target layer ID,need to read if svc + * codec flag (svcExtensionFlag)is on else default + * set to IH264SVCVDEC_TARGET_DEFAULT_DID. + * + * @param svcTargetLayerQID : SVC Quality target layer ID,need to read if svc + * codec flag (svcExtensionFlag) is on else default + * set to IH264SVCVDEC_TARGET_DEFAULT_QID. + * + * + * @param svcTargetLayerTID : SVC Temporal target layer ID,need to read if svc + * codec flag (svcExtensionFlag)is on else default + * set to IH264SVCVDEC_TARGET_DEFAULT_TID. + * + * @param presetLevelIdc : Level to which decoder has to be configured by the + * application + * + * @param presetProfileIdc : Profile to which decoder has to be configured by + * the application. Currently unused inside codec. + * + * @param detectCabacAlignErr: This parameter configures the cabac alignment + * error detection + * + * @param detectIPCMAlignErr: This parameter configures the IPCM alignment + * error detection + * + * @param debugTraceLevel: This parameter configures the debug trace level + * for the codec + * + * @param lastNFramesToLog: This parameter configures the codec to maintain + * a history of last N frames/pictures + * + * @param enableDualOutput : This Parameter tells whether Dual output is + * enable or not. If enable then application needs + * to provide two extra buffer (one for DualLuma + * and another for DualChroma. + * + * @param processCallLevel : Flag to select field/frame level process call + * + * @param enableWatermark : This Parameter tells whether watermark is + * enabled or not. + * + * @param decodeFrameType : Flag to decoder from application to request + * decoding of only I & IDR or IP or all frame types. + * Setting of IVIDDEC3_DynamicParams::frameSkipMode = + * IVIDEO_SKIP_PB or IVIDEO_SKIP_B could have been + * used for this purpose but it is defined at dynamic + * level, whereas the intention of this parameter is + * to have create time indication to codec for lesser + * memory foot print request. Hence this new parameter + * is defined. + ****************************************************************************** +*/ +typedef struct IH264VDEC_Params +{ + IVIDDEC3_Params viddec3Params; + XDAS_Int32 dpbSizeInFrames; + XDAS_Int32 pConstantMemory; + XDAS_Int32 bitStreamFormat; + XDAS_UInt32 errConcealmentMode; + XDAS_Int32 temporalDirModePred; + XDAS_UInt32 svcExtensionFlag; + XDAS_Int32 svcTargetLayerDID; + XDAS_Int32 svcTargetLayerTID; + XDAS_Int32 svcTargetLayerQID; + XDAS_Int32 presetLevelIdc; + XDAS_Int32 presetProfileIdc; + XDAS_UInt32 detectCabacAlignErr; + XDAS_UInt32 detectIPCMAlignErr; + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + XDAS_UInt32 enableDualOutput; + XDAS_Int32 processCallLevel; + XDAS_UInt32 enableWatermark; + XDAS_UInt32 decodeFrameType; +} IH264VDEC_Params; +/** + ****************************************************************************** + * @struct IH264VDEC_DynamicParams + * + * @brief This structure defines the run-time parameters and any other + * implementation specific parameters for an H.264 instance object. + * The base run-time parameters are defined in the XDM data structure, + * IVIDDEC3_DynamicParams. + * + * @param viddec3DynamicParams : XDM Base class dynamic structure + * (see ividdec3.h) + * + * @param deblockFilterMode : indicates the mode of deblocking filter + * (see enum IH264VDEC_deblockFilterMode) + * + * @param svcTargetLayerDID : SVC Spatial target layer ID,need to read if svc + * codec flag is on else default set to + * IH264SVCVDEC_TARGET_DEFAULT_DID. + * + * @param svcTargetLayerQID : SVC Quality target layer ID,need to read if svc + * codec flag is on else default set to + * IH264SVCVDEC_TARGET_DEFAULT_QID. + * + * + * @param svcTargetLayerTID : SVC Temporal target layer ID,need to read if svc + * codec flag is on else default set to + * IH264SVCVDEC_TARGET_DEFAULT_TID. + * + * @param svcELayerDecode : Flag to set for enhancement layer decode, + * defaultvalue is IH264VDEC_DISABLE_ELAYERDECODE + * + * @param reserved[3] : Left reserve for future purpose + * + ****************************************************************************** +*/ +typedef struct IH264VDEC_DynamicParams +{ + IVIDDEC3_DynamicParams viddec3DynamicParams; + XDAS_Int32 deblockFilterMode; + XDAS_Int32 svcTargetLayerDID; + XDAS_Int32 svcTargetLayerTID; + XDAS_Int32 svcTargetLayerQID; + XDAS_Int32 svcELayerDecode; + XDAS_Int32 reserved[3]; +} IH264VDEC_DynamicParams; + +/** + ****************************************************************************** + * @struct IH264VDEC_InArgs + * + * @brief This structure defines the run-time input arguments for an H264 + * instance object (IH264VDEC::process) + * + * @param viddec3InArgs : XDM Base class InArgs structure (see ividdec3.h) + * + * @param lateAcquireArg : XDM Base class InArgs structure (see ividdec3.h) + ****************************************************************************** +*/ +typedef struct IH264VDEC_InArgs +{ + IVIDDEC3_InArgs viddec3InArgs; + XDAS_Int32 lateAcquireArg; +} IH264VDEC_InArgs; +/** + ****************************************************************************** + * @struct IH264VDEC_OutArgs + * + * @brief This structure defines the run time output arguments for + * IH264VDEC::process function + * + * @param viddec3OutArgs : XDM Base class OutArgs structure (see ividdec3.h) + * + * @param decryptedKey : This variable contains watermark decrypted key. + ****************************************************************************** +*/ +typedef struct IH264VDEC_OutArgs +{ + IVIDDEC3_OutArgs viddec3OutArgs; + XDAS_UInt32 decryptedKey; +} IH264VDEC_OutArgs; + +/* + * ======== IH264VDEC_Handle ======== + * This handle is used to reference all H264VDEC instance objects + */ +typedef struct IH264VDEC_Obj *IH264VDEC_Handle; + +/** + ****************************************************************************** + * @struct IH264VDEC_ProcessParams + * + * @brief This structure defines the container for holding the channel + * information. + * + * @param handle : Handle for the channel. + * @param inBufs : Input Buffers for the Channel. + * @param outBufs : Output Buffers for the Channel. + * @param inArgs : Input Arguments for the Channel. + * @param outArgs : Output Arguments for the Channel. + ****************************************************************************** +*/ +typedef struct IH264VDEC_ProcessParams +{ + IH264VDEC_Handle handle; + XDM2_BufDesc *inBufs; + XDM2_BufDesc *outBufs; + IVIDDEC3_InArgs *inArgs; + IVIDDEC3_OutArgs *outArgs; +} IH264VDEC_ProcessParams; + +/** + ****************************************************************************** + * @struct IH264VDEC_ProcessParamsList + * + * @brief This structure defines the container for holding the N channel + * information. + * + * @param numEntries : Number of channels in the given container. + * @param processParams : Array holding the Process Parameters. + ****************************************************************************** +*/ +typedef struct IH264VDEC_ProcessParamsList +{ + XDAS_Int32 numEntries ; + IH264VDEC_ProcessParams processParams[IH264VDEC_MAX_LENGTH_PROCESS_LIST]; +} IH264VDEC_ProcessParamsList ; + +/** + ****************************************************************************** + * @struct IH264VDEC_Fxns + * + * @brief This structure contains pointers to all the XDAIS and XDM interface + * functions + * + * @param ividdec3 : This structure contains pointers to all the XDAIS and + * XDM interface functions + ****************************************************************************** +*/ +typedef struct IH264VDEC_Fxns +{ + IVIDDEC3_Fxns ividdec3; + XDAS_Int32 (*processMulti) (IH264VDEC_ProcessParamsList *processList); +} IH264VDEC_Fxns; + + + +/* + * ======== IH264VDEC_Cmd ======== + * This structure defines the control commands for the IMP4VENC module. + */ +typedef IVIDDEC3_Cmd IH264VDEC_Cmd; + +/* + * ======== IH264VDEC_PARAMS ======== + * Default parameter values for H264VDEC instance objects + */ +extern const IH264VDEC_Params IH264VDEC_PARAMS; +/* + * ======== IH264VDEC_DYNAMICPARAMS ======== + * Default dynamic parameter values for H264VDEC instance objects + */ +extern const IH264VDEC_DynamicParams IH264VDEC_TI_DYNAMICPARAMS; + + +/** + ****************************************************************************** + * @enum IH264VDEC_deblockFilterMode + * @brief This enum indicates the mode of deblocking filter + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DEBLOCK_DISABLE_NONE = 0, + /** + * Perform deblocking across all edges + */ + IH264VDEC_DEBLOCK_DISABLE_ALL, + /** + * Disable deblocking across all edges + */ + IH264VDEC_DEBLOCK_DISABLE_SLICE_EDGE, + /** + * Disable deblocking only at slice edges. Internal to slice, + * edges are deblocked. + */ + IH264VDEC_DEBLOCK_DEFAULT + /** + * Perform deblocking as controlled by disable_deblocking_filter_idc of + * the bitstream + */ +} IH264VDEC_deblockFilterMode; + +/** + ****************************************************************************** + * @enum IH264VDEC_temporalDirModePred + * @brief This enum indicates whether or not to decode slices with + * temporal direct prediction + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DISABLE_TEMPORALDIRECT = 0, + /** + * Do not decode slice with temporal direct + */ + IH264VDEC_ENABLE_TEMPORALDIRECT + /** + * Decode slice with temporal direct + */ +} IH264VDEC_temporalDirModePred; + +/** + ****************************************************************************** + * @enum IH264VDEC_detectCabacAlignErr + * @brief This enum indicates whether or not to detect the cabac + * alignment errors in MB-decoding + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DISABLE_CABACALIGNERR_DETECTION = 0, + /** + * Do not detect the CABAC alignment errors + */ + IH264VDEC_ENABLE_CABACALIGNERR_DETECTION + /** + * Detect the CABAC alignment errors + */ +} IH264VDEC_detectCabacAlignErr; + +/** + ****************************************************************************** + * @enum IH264VDEC_detectIPCMAlignErr + * @brief This enum indicates whether or not to detect the IPCM + * alignment errors in MB-decoding + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DISABLE_IPCMALIGNERR_DETECTION = 0, + /** + * Do not detect the IPCM alignment errors + */ + IH264VDEC_ENABLE_IPCMALIGNERR_DETECTION + /** + * Detect the IPCM alignment errors + */ +} IH264VDEC_detectIPCMAlignErr; + +/** + ****************************************************************************** + * @enum IH264VDEC_errConcealmentMode + * @brief This enum indicates whether to apply error concealment or not + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_NO_CONCEALMENT = 0, + /** + * do not apply error concealment + */ + IH264VDEC_APPLY_CONCEALMENT + /** + * apply error concealment + */ +} IH264VDEC_errConcealmentMode; + +/** + ****************************************************************************** + * @enum IH264VDEC_LevelId + * + * @brief This enum indicates preset level numbers for H.264 Decoder + * + * The application should set the level in the create time parameters. + ****************************************************************************** +*/ +typedef enum { + IH264VDEC_LEVEL1 = 0, + /** 0: Level 1 + */ + IH264VDEC_LEVEL1B, + /** 1: Level 1.b + */ + IH264VDEC_LEVEL11, + /** 2: Level 1.1 + */ + IH264VDEC_LEVEL12, + /** 3: Level 1.2 + */ + IH264VDEC_LEVEL13, + /** 4: Level 1.3 + */ + IH264VDEC_LEVEL2, + /** 5: Level 2 + */ + IH264VDEC_LEVEL21, + /** 6: Level 2.1 + */ + IH264VDEC_LEVEL22, + /** 7: Level 2.2 + */ + IH264VDEC_LEVEL3, + /** 8: Level 3 + */ + IH264VDEC_LEVEL31, + /** 9: Level 3.1 + */ + IH264VDEC_LEVEL32, + /** 10: Level 3.2 + */ + IH264VDEC_LEVEL4, + /** 11: Level 4 + */ + IH264VDEC_LEVEL41, + /** 12: Level 4.1 + */ + IH264VDEC_LEVEL42, + /** 13: Level 4.2 + */ + IH264VDEC_LEVEL5, + /** 14: Level 5 + */ + IH264VDEC_LEVEL51, + /** 15: Level 5.1 + */ +IH264VDEC_MAXLEVELID = IH264VDEC_LEVEL51 + /** 15: Maximum Level ID that can be configured + */ +} IH264VDEC_LevelId; + +/** + ****************************************************************************** + * @enum IH264VDEC_ProfileId + * + * @brief This enum indicates preset profiles for H.264 Decoder + * + * The application should set the profile in the create time parameters. + * In the current implementation, the codec ignores this value. + ****************************************************************************** +*/ +typedef enum { + IH264VDEC_PROFILE_BASELINE = 0, + /** 0: Baseline profile + */ + IH264VDEC_PROFILE_MAIN, + /** 1: Main profile + */ + IH264VDEC_PROFILE_HIGH, + /** 2: High profile + */ + IH264VDEC_PROFILE_ANY + /** 3: As decoded from the bitstream. This is needed to pass compliance. + */ +} IH264VDEC_ProfileId; + +/** + ****************************************************************************** + * @enum IH264VDEC_debugTraceLevel + * + * @brief This enum indicates the debug trace levels for H.264 Decoder + * + * The application should set this in the create time parameters. + ****************************************************************************** +*/ +typedef enum { + IH264VDEC_DEBUGTRACE_LEVEL0 = 0, + /** 0: Debug Trace Level 0 + */ + IH264VDEC_DEBUGTRACE_LEVEL1, + /** 1: Debug Trace Level 1 + */ + IH264VDEC_DEBUGTRACE_LEVEL2, + /** 2: Debug Trace Level 2 + */ + IH264VDEC_DEBUGTRACE_LEVEL3 + /** 2: Debug Trace Level 3 + */ +} IH264VDEC_debugTraceLevel; + +/** + ****************************************************************************** + * @enum IH264VDEC_MetadataType + * @brief This enum indicates Meta Data types for H.264 Decoder + * + * The way to get meta data from decoder is via outBufs of the decoder during + * process call. + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_PARSED_SEI_DATA = XDM_CUSTOMENUMBASE, + /** Write out Parsed SEI data + * By setting to this value(for IVIDDEC3_Params::metadataType[i]) + * the codec can can provide the parsed SEI metadata + */ + + IH264VDEC_ENCODED_SEI_DATA, + /** Write out Encoded (compressed) SEI data + * + */ + + IH264VDEC_PARSED_VUI_DATA, + /** Write out Parsed VUI data + * By setting to this value(for IVIDDEC3_Params::metadataType[i]) + * the codec can can provide the parsed VUI metadata + */ + IH264VDEC_ENCODED_VUI_DATA + /** Write out Encoded (compressed) VUI data + * + */ + +} IH264VDEC_MetadataType; + +/** + ****************************************************************************** + * @enum IH264VDEC_DataMode + * @brief Describes the input slice format provided to decoder. + * This enumeration type is used by App to specify codec + * input slice format (NAL/Bytestream) type + * + ****************************************************************************** +*/ + +typedef enum +{ + IH264VDEC_NALUNIT_MODE = XDM_CUSTOMENUMBASE + /** data in NAL stream format + * + */ +} IH264VDEC_DataMode; + +/** + ****************************************************************************** + * @enum IH264VDEC_bitStreamFormat + * @brief Input bit stream format provided to decoder. + * This enumeration type is used by App to specify codec + * input bit stream format (NAL/Bytestream) type + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_BYTE_STREAM_FORMAT = 0, + /** Input data is in Byte stream format (stream with start code). + * + */ + IH264VDEC_NAL_UNIT_FORMAT + /** Input data is in NAL stream format (No start code) + * + */ +} IH264VDEC_bitStreamFormat; + +/** + ****************************************************************************** + * @enum IH264VDEC_mbErrStatus + * @brief This enum indicates if a MB was in error or not + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_MB_NOERROR = 0, + /** + * MB was non-erroneous + */ + IH264VDEC_MB_ERROR = 1 + /** + * MB was erroneous + */ +} IH264VDEC_mbErrStatus; + +/** + ****************************************************************************** + * @enum IH264VDEC_ErrorBit + * @brief H.264 Error Codes: Delaration of h264 decoder specific Error + * Codes. + * @details Error status is communicated trough a 32 bit word. In this, + * Error Bits 8 to 15 are used to indicate the XDM error bits. See + * XDM_ErrorBit definition in xdm.h. Other bits in a 32 bit word + * can be used to signal any codec specific errors. The staructure + * below enumerates the H264 decoder specific error bits used. + * The algorithm can set multiple bits to 1 depending on the error + * condition + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_ERR_NOSLICE = 0, + /**< + * Bit 0 + * 1 - No error-free slice header detected in the frame + * 0 - Ignore + */ + IH264VDEC_ERR_SPS, + /**< + * Bit 1 + * 1 - Error in SPS parsing + * 0 - Ignore + */ + IH264VDEC_ERR_PPS, + /**< + * Bit 2 + * 1 - Error during PPS parsing + * 0 - Ignore + */ + IH264VDEC_ERR_SLICEHDR, + /**< + * Bit 3 + * 1 - Error in slice header parsing + * 0 - Ignore + */ + IH264VDEC_ERR_MBDATA, + /**< + * Bit 4 + * 1 - Error in MB data parsing + * 0 - Ignore + */ + IH264VDEC_ERR_UNAVAILABLESPS, + /**< + * Bit 5 + * 1 - SPS rferred in the header is not available. + * 0 - Ignore + */ + IH264VDEC_ERR_UNAVAILABLEPPS, + /**< + * Bit 6 + * 1 - PPS rferred in the header is not available + * 0 - Ignore + */ + IH264VDEC_ERR_INVALIDPARAM_IGNORE, + /**< + * Bit 7 + * 1 - Invalid Parameter + * 0 - Ignore + */ + IH264VDEC_ERR_UNSUPPFEATURE = 16, + /**< + * Bit 16 + * 1 - Unsupported feature + * 0 - Ignore + */ + IH264VDEC_ERR_METADATA_BUFOVERFLOW, + /**< + * Bit 17 + * 1 - SEI Buffer overflow detected + * 0 - Ignore + */ + IH264VDEC_ERR_STREAM_END, + /**< + * Bit 18 + * 1 - End of stream reached + * 0 - Ignore + */ + IH264VDEC_ERR_NO_FREEBUF, + /**< + * Bit 19 + * 1 - No free buffers available for reference storing reference frame + * 0 - Ignore + */ + IH264VDEC_ERR_PICSIZECHANGE, + /**< + * Bit 20 + * 1 - Change in resolution detected + * 0 - Ignore + */ + IH264VDEC_ERR_UNSUPPRESOLUTION, + /**< + * Bit 21 + * 1 - Unsupported resolution by the decoder + * 0 - Ignore + */ + IH264VDEC_ERR_NUMREF_FRAMES, + /**< + * Bit 22 + * 1 - maxNumRefFrames parameter is not compliant to stream properties + * (does not comply to stream requirements). + * 0 - Ignore + */ + IH264VDEC_ERR_INVALID_MBOX_MESSAGE, + /**< + * Bit 23 + * 1 - Invalid (unexpected) mail box message received by M3 or IVAHD + * 0 - Ignore + */ + IH264VDEC_ERR_DATA_SYNC, + /**< + * Bit 24 + * 1 - In datasync enable mode, the input supplied is wrong + * 0 - Ignore + */ + IH264VDEC_ERR_MISSINGSLICE, + /**< + * Bit 25 + * 1 - Missing slice in a frame + * 0 - Ignore + */ + IH264VDEC_ERR_INPUT_DATASYNC_PARAMS, + /**< + * Bit 26 + * 1 - Input datasync enable mode, the input parameter is wrong + * 0 - Ignore + */ + IH264VDEC_ERR_HDVICP2_IMPROPER_STATE, + /**< + * Bit 27 + * 1 - IVAHD standby failed or couldn't turn-on/off the IP's clock + * or HDVICP reset failed. + * 0 - Ignore + */ + IH264VDEC_ERR_TEMPORAL_DIRECT_MODE, + /**< + * Bit 28 + * 1 - Temporal direct mode is present in the bits stream + * when disableTemporalDirect parameter (create time) is set. + * 0 - Ignore + */ + IH264VDEC_ERR_DISPLAYWIDTH, + /**< + * Bit 29 + * 1 - DisplayWidth is less than the Image width + Padded width. + * 0 - Ignore + */ + IH264VDEC_ERR_NOHEADER, + /**< + * Bit 30 + * 1 - Indicates that no SPS/PPS header is decoded in the current + * process call. + * (or) It indicates that watermark SEI data is unavailable even though + * watermark parameter is enabled. + * 0 - Ignore + */ + IH264VDEC_ERR_GAPSINFRAMENUM + /**< + * Bit 31 + * 1 - Indicates that a gap is detected in frame_num for a stream with + * gaps_in_frame_num_value_allowed_flag 1 in SPS. + * 0 - Ignore + */ +} IH264VDEC_ErrorBit; +/** + ****************************************************************************** + * @enum IH264VDEC_svcExtension + * @brief This enum indicates whether or not to support SVC extension + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DISABLE_SVCEXTENSION = 0, + /** + * Do not support SVC extension + */ + IH264VDEC_ENABLE_SVCEXTENSION + /** + * Support SVC extension + */ +} IH264VDEC_svcExtension; + +/** + ****************************************************************************** + * @enum IH264VDEC_eLayerDecodeMode + * @brief This enum indicates whether or not to support decoding of + * enhancement layer + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DISABLE_ELAYERDECODE = 0, + /** + * Decode base layer only. Do not decode enhancement layer + */ + IH264VDEC_ENABLE_ELAYERDECODE + /** + * Support decoding of enhancement layer + */ +} IH264VDEC_ELAYERDECODEMODE; + + +/** + ****************************************************************************** + * @enum IH264VDEC_dependancyLayerIds + * @brief This enum indicates the dependancy layer IDs. + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_TARGET_DID_DEFAULT = -1, + /** + * Default dependancy layer ID. + */ + IH264VDEC_TARGET_DID_ZERO = 0, + /** + * Dependancy layer ID = 0 + */ + IH264VDEC_TARGET_DID_ONE, + /** + * Dependancy layer ID = 1 + */ + IH264VDEC_TARGET_DID_TWO, + /** + * Dependancy layer ID = 2 + */ + IH264VDEC_TARGET_DID_THREE, + /** + * Dependancy layer ID = 3 + */ + IH264VDEC_TARGET_DID_FOUR, + /** + * Dependancy layer ID = 4 + */ + IH264VDEC_TARGET_DID_FIVE, + /** + * Dependancy layer ID = 5 + */ + IH264VDEC_TARGET_DID_SIX, + /** + * Dependancy layer ID = 6 + */ + IH264VDEC_TARGET_DID_SEVEN, + /** + * Dependancy layer ID = 7 + */ + IH264VDEC_TARGET_DID_MAX = + IH264VDEC_TARGET_DID_SEVEN + /** + * Dependancy layer max ID = 7 + */ + } IH264VDEC_dependancyLayerIds; + +/** + ****************************************************************************** + * @enum IH264VDEC_temporalLayerIds + * @brief This enum indicates the temporal layer IDs for svc. + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_TARGET_TID_DEFAULT = -1, + /** + * Default Temporal layer ID. + */ + IH264VDEC_TARGET_TID_ZERO = 0, + /** + * Temporal layer ID = 0 + */ + IH264VDEC_TARGET_TID_ONE, + /** + * Temporal layer ID = 1 + */ + IH264VDEC_TARGET_TID_TWO, + /** + * Temporal layer ID = 2 + */ + IH264VDEC_TARGET_TID_THREE, + /** + * Temporal layer ID = 3 + */ + IH264VDEC_TARGET_TID_FOUR, + /** + * Temporal layer ID = 4 + */ + IH264VDEC_TARGET_TID_FIVE, + /** + * Temporal layer ID = 5 + */ + IH264VDEC_TARGET_TID_SIX, + /** + * Temporal layer ID = 6 + */ + IH264VDEC_TARGET_TID_SEVEN, + /** + * Temporal layer ID = 7 + */ + IH264VDEC_TARGET_TID_MAX = + IH264VDEC_TARGET_TID_SEVEN + /** + * Temporal layer max ID = 7 + */ + } IH264VDEC_temporalLayerIds; + +/** + ****************************************************************************** + * @enum IH264VDEC_qualityLayerIds + * @brief This enum indicates the quality layer IDs for svc. + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_TARGET_QID_DEFAULT = -1, + /** + * Default Quality layer ID. + */ + IH264VDEC_TARGET_QID_ZERO = 0, + /** + * Quality layer ID = 0 + */ + IH264VDEC_TARGET_QID_ONE, + /** + * Quality layer ID = 1 + */ + IH264VDEC_TARGET_QID_TWO, + /** + * Quality layer ID = 2 + */ + IH264VDEC_TARGET_QID_THREE, + /** + * Quality layer ID = 3 + */ + IH264VDEC_TARGET_QID_FOUR, + /** + * Quality layer ID = 4 + */ + IH264VDEC_TARGET_QID_FIVE, + /** + * Quality layer ID = 5 + */ + IH264VDEC_TARGET_QID_SIX, + /** + * Quality layer ID = 6 + */ + IH264VDEC_TARGET_QID_SEVEN, + /** + * Quality layer ID = 7 + */ + IH264VDEC_TARGET_QID_EIGHT, + /** + * Quality layer max ID = 8 + */ + IH264VDEC_TARGET_QID_NINE, + /** + * Quality layer max ID = 9 + */ + IH264VDEC_TARGET_QID_TEN, + /** + * Quality layer max ID = 10 + */ + IH264VDEC_TARGET_QID_ELEVEN, + /** + * Quality layer max ID = 11 + */ + IH264VDEC_TARGET_QID_TWELVE, + /** + * Quality layer max ID = 12 + */ + IH264VDEC_TARGET_QID_THIRTEEN, + /** + * Quality layer max ID = 13 + */ + IH264VDEC_TARGET_QID_FOURTEEN, + /** + * Quality layer max ID = 14 + */ + IH264VDEC_TARGET_QID_FIFTEEN, + /** + * Quality layer max ID = 15 + */ + IH264VDEC_TARGET_QID_MAX = + IH264VDEC_TARGET_QID_FIFTEEN + /** + * Quality layer max ID = 15 + */ +} IH264VDEC_qualityLayerIds; + +/** + ****************************************************************************** + * @enum IH264VDEC_seiOverFlowFlag + * @brief This enum indicates user data reg/unreg SEI overFlowFlag values + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_PAYLOAD_NO_OVERFLOW = 0, + /** + * Indicates there is no overflow occured in user data reg or unreg sei + */ + IH264VDEC_PAYLOAD_OVERFLOW + /** + * Indicates there is a overflow in user data reg or unreg sei + */ +} IH264VDEC_seiOverFlowFlag; + +/** + ****************************************************************************** + * @enum IH264VDEC_enableDualOutput + * @brief This enum is used to enable/disable dual output feature + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DUALOUTPUT_DISABLE = 0, + /** + * Indicates that dual output is disabled + */ + IH264VDEC_DUALOUTPUT_ENABLE, + /** + * Indicates that dual output is enabled + */ + IH264VDEC_DUALOUTPUTALIGN_ENABLE + /** + * Indicates that dual output is enabled and has 16-byte alignment + */ +} IH264VDEC_enableDualOutput; + +/** + ****************************************************************************** + * @enum IH264VDEC_processCallLevel + * @brief This enum indicates whether process call is done at a field + * level or frame level + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_FIELDLEVELPROCESSCALL = 0, + /** + * Indicates that process call should be at field level + */ + IH264VDEC_FRAMELEVELPROCESSCALL + /** + * Indicates that process call should be at frame level + */ +} IH264VDEC_processCallLevel; + +/** + ****************************************************************************** + * @enum IH264VDEC_enableWaterMark + * @brief This enum is used to enable/disable Watermark feature + * + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_WATERMARK_DISABLE = 0, + /** + * Indicates that Watermark is disabled + */ + IH264VDEC_WATERMARK_ENABLE + /** + * Indicates that Watermark is enabled + */ +} IH264VDEC_enableWaterMark; + +/** + ****************************************************************************** + * @enum IH264VDEC_decodeFrameType + * @brief This enum is used to request decoder to decode only I, IP or ALL + * frame types + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DECODE_ALL = 0, + /** + * Indicates that all type of frames decoding is enabled + */ + IH264VDEC_DECODE_IP_ONLY = 1, + /** + * Indicates that only I/IDR and P frames decoding is enabled + */ + IH264VDEC_DECODE_I_ONLY = 2 + /** + * Indicates that only I/IDR frames decoding is enabled + */ +} IH264VDEC_decodeFrameType; + +/** + * Macro definitions required for SEI support: HRD sequence parameter set + */ +#define IH264VDEC_MAXCPBCNT 32 + +/** + * Macro definitions required for SEI support: HRD sequence parameter set + */ +#define IH264VDEC_MAXUSERDATA_PAYLOAD 300 + +/** + ****************************************************************************** + * @struct IH264VDEC_HrdParams + * + * @brief This structure contains the HRD parameter elements. + * + * @param cpb_cnt_minus1 : Number of alternative CPB specifications in the + * bit-stream + * @param bit_rate_scale : Together with bit_rate_value[i], it specifies the + * maximum input bit-rate for the ith CPB. + * @param cpb_size_scale : Together with cpb_size_value[i], specifies the + * maximum CPB size for the ith CPB. + * @param bit_rate_value_minus1[IH264VDEC_MAXCPBCNT] :Maximum input bitrate + * for the ith CPB + * @param cpb_size_value_minus1[IH264VDEC_MAXCPBCNT] :Maximum CPB size for the + * ith CPB + * @param vbr_cbr_flag[IH264VDEC_MAXCPBCNT] :Specifies the ith CPB is operated + * in Constant Bit-rate mode or variable bit-rate mode + * @param initial_cpb_removal_delay_length_minus1 :Length in bits of + * initial_cpb_removal_length syntax element + * @param cpb_removal_delay_length_minus1 :Length in bits of + * cpb_removal_delay_length syntax element + * @param dpb_output_delay_length_minus1 :Length in bits of + * dpb_output_delay_length syntax element + * @param time_offset_length : Length in bits of time_offset syntax element + ****************************************************************************** +*/ +typedef struct IH264VDEC_HrdParams +{ + XDAS_UInt32 cpb_cnt_minus1; + XDAS_UInt8 bit_rate_scale; + XDAS_UInt8 cpb_size_scale; + XDAS_UInt32 bit_rate_value_minus1[IH264VDEC_MAXCPBCNT]; + XDAS_UInt32 cpb_size_value_minus1[IH264VDEC_MAXCPBCNT]; + XDAS_UInt8 vbr_cbr_flag[IH264VDEC_MAXCPBCNT]; + XDAS_UInt8 initial_cpb_removal_delay_length_minus1; + XDAS_UInt8 cpb_removal_delay_length_minus1; + XDAS_UInt8 dpb_output_delay_length_minus1; + XDAS_UInt8 time_offset_length; +} IH264VDEC_HrdParams; + +/** + ****************************************************************************** + * @struct IH264VDEC_SVCVuiParams + * + * @brief This structure contains VUI message syntax elements for scalable + * video stream + * + * @param parsed_flag :1 - Indicates that in the current process call, c + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * + * @param svc_vui_ext_num_entries_minus1:(svc_vui_ext_num_entries_minus1 + 1) + * specifies the number of information + * entries that are present in the SVC + * VUI parameters extension syntax + * structure + * @param svc_vui_ext_dependency_id:indicate the max value of DId for the + * i-th subset of coded video sequences + * @param svc_vui_ext_quality_id:indicate the max value of QId for the + * i-th subset of coded video sequences + * @param svc_vui_ext_temporal_id: indicate the max value of TId for the + * i-th subset of coded video sequences + * @param svc_vui_ext_timing_info_present_flag: Flag to tells that + * svc_vui_ext_num_units_in_tick, + * svc_vui_ext_time_scale, + * svc_vui_ext_fixed_frame_rate_flag + * are present for current coded + * sequence or not. + * @param svc_vui_ext_num_units_in_tick: specifies the value of + * num_units_in_tick + * @param svc_vui_ext_time_scale: specifies the value of time_scale + * @param svc_vui_ext_fixed_frame_rate_flag: specifies the value of + * fixed_frame_rate_flag + * @param svc_vui_ext_nal_hrd_parameters_present_flag:specifies the + * value of nal_hrd_parameters_present_flag + * @param svc_vui_ext_vcl_hrd_parameters_present_flag: ] specifies the + * value of vcl_hrd_parameters_present_flag + * @param svc_vui_ext_low_delay_hrd_flag: specifies the value + * of low_delay_hrd_flag + * @param svc_vui_ext_pic_struct_present_flag: specifies the value + * of pic_struct_present_flag + * + ****************************************************************************** +*/ + +typedef struct sIH264VDEC_SVCVuiParams +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt16 svc_vui_ext_num_entries_minus1; + XDAS_UInt16 svc_vui_ext_dependency_id; + XDAS_UInt16 svc_vui_ext_quality_id; + XDAS_UInt16 svc_vui_ext_temporal_id; + XDAS_UInt16 svc_vui_ext_timing_info_present_flag; + XDAS_UInt32 svc_vui_ext_num_units_in_tick; + XDAS_UInt32 svc_vui_ext_time_scale; + XDAS_UInt16 svc_vui_ext_fixed_frame_rate_flag; + XDAS_UInt16 svc_vui_ext_nal_hrd_parameters_present_flag; + XDAS_UInt16 svc_vui_ext_vcl_hrd_parameters_present_flag; + XDAS_UInt16 svc_vui_ext_low_delay_hrd_flag; + XDAS_UInt16 svc_vui_ext_pic_struct_present_flag; +} IH264VDEC_SVCVuiParams; + +/** + ****************************************************************************** + * @struct IH264VDEC_VuiParams + * + * @brief This structure contains the VUI Sequence Parameter elements. + * + * @param parsed_flag :1 - Indicates that in the current process call, c + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param aspect_ratio_info_present_flag :Indicates whether aspect ratio idc + * is present or not. + * @param aspect_ratio_idc : Aspect ratio of Luma samples + * @param sar_width : Horizontal size of sample aspect ratio + * @param sar_height : Vertical size of sample aspect ratio + * @param overscan_info_present_flag : Cropped decoded pictures are suitable + * for display or not. + * @param overscan_appropriate_flag : Overscan_appropriate_flag + * @param video_signal_type_present_flag : Flag indicates whether + * video_format, video_full_range_flag and colour_description_present_ + * flag are present or not + * @param video_format :Video format indexed by a table. For example,PAL/NTSC + * @param video_full_range_flag : Black level, luma and chroma ranges. It + * should be used for BT.601 compliance + * @param colour_description_present_flag:Indicates whether colour_primaries, + * transfer_characteristics and matrix_coefficients are present. + * @param colour_primaries :Chromaticity co-ordinates of source primaries + * @param transfer_characteristics :Opto-electronic transfer characteristics + * of the source picture + * @param matrix_coefficients :Matrix coefficients for deriving Luma and + * chroma data from RGB components. + * @param chroma_location_info_present_flag : Flag indicates whether + * chroma_sample_loc_type_top field and chroma_sample_loctype + * bottom_field are present. + * @param chroma_sample_loc_type_top_field : Location of chroma_sample top + * field + * @param chroma_sample_loc_type_bottom_field :Location of chroma_sample + * bottom field + * @param timing_info_present_flag :Indicates whether num_units_in_tick, + * time_scale, and fixed_frame_rate_flag are present. + * @param num_units_in_tick :Number of units of a clock that corresponds to 1 + * increment of a clock tick counter + * @param time_scale :Indicates actual increase in time for 1 increment of a + * clock tick counter + * @param fixed_frame_rate_flag :Indicates how the temporal distance between + * HRD output times of any two output pictures is constrained + * @param nal_hrd_parameters_present_flag :Indicates whether + * nal_hrd_parameters are present + * @param nal_hrd_pars : NAL HRD Parameters + * @param vcl_hrd_parameters_present_flag :Indicates whether + * vcl_hrd_parameters are present + * @param vcl_hrd_pars : VCL HRD Parameters + * @param low_delay_hrd_flag :HRD operational mode as in Annex C of the + * standard + * @param pic_struct_present_flag :Indicates whether picture timing SEI + * messages are present + * @param bitstream_restriction_flag :Indicates if the bit-stream restriction + * parameters are present + * @param motion_vectors_over_pic_boundaries_flag :Specifies whether motion + * vectors can point to regions outside the picture boundaries + * @param max_bytes_per_pic_denom :Maximum number of bytes not exceeded by + * the sum of sizes of all VCL NAL units of a single coded picture + * @param max_bits_per_mb_denom :Maximum number of bits taken by any coded MB + * @param log2_max_mv_length_vertical :Maximum value of any motion vector’s + * vertical component + * @param log2_max_mv_length_horizontal :Maximum value of any motion vector’s + * horizontal component + * @param max_dec_frame_reordering : + * @param num_reorder_frames :Maximum number of frames that need to be + * re-ordered + * @param max_dec_frame_buffering :Size of HRD decoded buffer (DPB) in terms + * of frame buffers + * @param svcVuiParams : struct instance of vui parameters for svc + * + ****************************************************************************** +*/ +typedef struct IH264VDEC_VuiParams +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt8 aspect_ratio_info_present_flag; + XDAS_UInt32 aspect_ratio_idc; + XDAS_UInt32 sar_width; + XDAS_UInt32 sar_height; + XDAS_UInt8 overscan_info_present_flag; + XDAS_UInt8 overscan_appropriate_flag; + XDAS_UInt8 video_signal_type_present_flag; + XDAS_UInt8 video_format; + XDAS_UInt8 video_full_range_flag; + XDAS_UInt8 colour_description_present_flag; + XDAS_UInt8 colour_primaries; + XDAS_UInt8 transfer_characteristics; + XDAS_UInt8 matrix_coefficients; + XDAS_UInt8 chroma_location_info_present_flag; + XDAS_UInt32 chroma_sample_loc_type_top_field; + XDAS_UInt32 chroma_sample_loc_type_bottom_field; + XDAS_UInt8 timing_info_present_flag; + XDAS_UInt32 num_units_in_tick; + XDAS_UInt32 time_scale; + XDAS_UInt8 fixed_frame_rate_flag; + XDAS_UInt8 nal_hrd_parameters_present_flag; + IH264VDEC_HrdParams nal_hrd_pars; + XDAS_UInt8 vcl_hrd_parameters_present_flag; + IH264VDEC_HrdParams vcl_hrd_pars; + XDAS_UInt8 low_delay_hrd_flag; + XDAS_UInt8 pic_struct_present_flag; + XDAS_UInt8 bitstream_restriction_flag; + XDAS_UInt8 motion_vectors_over_pic_boundaries_flag; + XDAS_UInt32 max_bytes_per_pic_denom; + XDAS_UInt32 max_bits_per_mb_denom; + XDAS_UInt32 log2_max_mv_length_vertical; + XDAS_UInt32 log2_max_mv_length_horizontal; + XDAS_UInt32 max_dec_frame_reordering; + XDAS_UInt32 num_reorder_frames; + XDAS_UInt32 max_dec_frame_buffering; + IH264VDEC_SVCVuiParams svcVuiParams; +} IH264VDEC_VuiParams; + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiUserDataRegITUT + * + * @brief This structure contains the user data SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param num_payload_bytes :Specifies the size of the payload + * @param itu_t_t35_country_code : A byte having a value specified as a + * country code by ITU-T Recommendation T.35 Annex A + * @param itu_t_t35_country_code_extension_byte :A byte having a value + * specified as a country code by ITU-T Recommendation T.35 Annex B + * @param itu_t_t35_payload_byte[] : A byte containing data registered as + * specified by ITU-T Recommendation T.35. + * @param dataOverflowFlag: This indicates if pay load data is more than the + * array size i.e., IH264VDEC_MAXUSERDATA_PAYLOAD. + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiUserDataRegITUT +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 num_payload_bytes; + XDAS_UInt8 itu_t_t35_country_code; + XDAS_UInt8 itu_t_t35_country_code_extension_byte; + XDAS_UInt8 itu_t_t35_payload_byte[IH264VDEC_MAXUSERDATA_PAYLOAD]; + XDAS_UInt8 dataOverflowFlag; +} IH264VDEC_SeiUserDataRegITUT; + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiUserDataUnReg + * + * @brief This structure contains the user data SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param num_payload_bytes :Specifies the size of the payload + * @param uuid_iso_iec_11578 :Value specified as a UUID according to the + * procedures of ISO/IEC 11578:1996 Annex A. + * @param user_data_payload_byte :Byte containing data having syntax and + * semantics as specified by the UUID generator. + * @param dataOverflowFlag: This indicates if pay load data is more than the + * array size i.e., IH264VDEC_MAXUSERDATA_PAYLOAD. + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiUserDataUnReg +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 num_payload_bytes; + XDAS_UInt8 uuid_iso_iec_11578[16]; + XDAS_UInt8 user_data_payload_byte[IH264VDEC_MAXUSERDATA_PAYLOAD]; + XDAS_UInt8 dataOverflowFlag; +} IH264VDEC_SeiUserDataUnReg; + + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiBufferingPeriod + * + * @brief This structure contains the buffering period SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param seq_parameter_set_id :Specifies the sequence parameter set that + * contains the sequence HRD attributes + * @param nal_cpb_removal_delay :Specifies the delay for the indexed NAL CPB + * between the time of arrival in the CPB of the first bit of the + * coded data associated with the access unit associated with the + * buffering period SEI message and the time of removal from the CPB + * of the coded data associated with the same access unit, for the + * first buffering period after HRD initialization. + * @param nal_cpb_removal_delay_offset :Used for the indexed NAL CPB in + * combination with the cpb_removal_delay to specify the initial + * delivery time of coded access units to the CPB + * @param vcl_cpb_removal_delay :Specifies the delay for the indexed VCL CPB + * between the time of arrival in the CPB of the first bit of the + * coded data associated with the access unit associated with the + * buffering period SEI message and the time of removal from the CPB + * of the coded data associated with the same access unit, for the + * first buffering period after HRD initialization. + * @param vcl_cpb_removal_delay_offset :Used for the indexed VCL CPB in + * combination with the cpb_removal_delay to specify the initial + * delivery time of coded access units to the CPB + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiBufferingPeriod +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 seq_parameter_set_id; + XDAS_UInt32 nal_cpb_removal_delay[IH264VDEC_MAXCPBCNT]; + XDAS_UInt32 nal_cpb_removal_delay_offset[IH264VDEC_MAXCPBCNT]; + XDAS_UInt32 vcl_cpb_removal_delay[IH264VDEC_MAXCPBCNT]; + XDAS_UInt32 vcl_cpb_removal_delay_offset[IH264VDEC_MAXCPBCNT]; +}IH264VDEC_SeiBufferingPeriod; +/** + ****************************************************************************** + * @struct IH264VDEC_SeiPanScanRect + * + * @brief This structure contains the pan scan rectangle SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param pan_scan_rect_id :Specifies an identifying number that may be used + * to identify the purpose of the pan-scan rectangle + * @param pan_scan_rect_cancel_flag :Equal to 1 indicates that the SEI + * message cancels the persistence of any previous pan-scan + * rectangle SEI message in output order. + * pan_scan_rect_cancel_flag equal to 0 indicates that + * pan-scan rectangle information follows. + * @param pan_scan_cnt_minus1 :Specifies the number of pan-scan rectangles + * that are present in the SEI message + * @param pan_scan_rect_left_offset :Specifies as signed integer quantities + * in units of one-sixteenth sample spacing relative to the luma + * sampling grid, the location of the pan-scan rectangle + * @param pan_scan_rect_right_offset :Specifies as signed integer quantities + * in units of one-sixteenth sample spacing relative to the luma + * sampling grid, the location of the pan-scan rectangle + * @param pan_scan_rect_top_offset : Top offset + * @param pan_scan_rect_bottom_offset : Bottom offset + * @param pan_scan_rect_repetition_period :Specifies the persistence of the + * pan-scan rectangle SEI message and may specify a picture order + * count interval within which another pan-scan rectangle SEI message + * with the same value of pan_scan_rect_id or the end of the coded + * video sequence shall be present in the bit-stream + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiPanScanRect +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 pan_scan_rect_id; + XDAS_UInt32 pan_scan_rect_cancel_flag; + XDAS_UInt32 pan_scan_cnt_minus1; + XDAS_Int32 pan_scan_rect_left_offset[3]; + XDAS_Int32 pan_scan_rect_right_offset[3]; + XDAS_Int32 pan_scan_rect_top_offset[3]; + XDAS_Int32 pan_scan_rect_bottom_offset[3]; + XDAS_UInt32 pan_scan_rect_repetition_period; +} IH264VDEC_SeiPanScanRect; + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiProgRefineStart + * + * @brief This structure contains the progressive refinement start SEI msg + * elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param progressive_refinement_id :Specifies an identification number for + * the progressive refinement operation. + * @param num_refinement_steps_minus1 :Specifies the number of reference + * frames in the tagged set of consecutive coded pictures + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiProgRefineStart +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 progressive_refinement_id; + XDAS_UInt32 num_refinement_steps_minus1; +} IH264VDEC_SeiProgRefineStart; +/** + ****************************************************************************** + * @struct IH264VDEC_SeiProgRefineEnd + * + * @brief TThis structure contains the progressive refinement end SEI msg + * elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param progressive_refinement_id :Specifies an identification number for + * the progressive refinement operation. + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiProgRefineEnd +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 progressive_refinement_id; +} IH264VDEC_SeiProgRefineEnd; +/** + ****************************************************************************** + * @struct IH264VDEC_SeiRecoveryPointInfo + * + * @brief This structure contains the sRecovery Point Info SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param exact_match_flag :Indicates whether decoded pictures at and + * subsequent to the specified recovery point in output order derived + * by starting the decoding process at the access unit associated with + * the recovery point SEI message, will be an exact match to the + * pictures that would be produced by starting the decoding process + * at the location of a previous IDR access unit in the NAL unit stream. + * @param recovery_frame_cnt :Specifies the recovery point of output pictures + * in output order + * @param broken_link_flag :Indicates the presence or absence of a broken + * link in the NAL unit stream + * @param changing_slice_group_idc :Indicates whether decoded pictures are + * correct or approximately correct in content at and subsequent to + * the recovery point in output order when all macro-blocks of the + * primary coded pictures are decoded within the changing slice group + * period. + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiRecoveryPointInfo +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 recovery_frame_cnt; + XDAS_UInt32 exact_match_flag; + XDAS_UInt32 broken_link_flag; + XDAS_UInt32 changing_slice_group_idc; +} IH264VDEC_SeiRecoveryPointInfo; + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiPictureTiming + * + * @brief This structure contains the picture timing SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param NumClockTs : + * @param cpb_removal_delay :Specifies how many clock ticks to wait after + * removal from the CPB of the access unit associated with the + * most recent buffering period SEI message before removing from + * the buffer the access unit data associated with the picture + * timing SEI message. + * @param dpb_output_delay : Used to compute the DPB output time of the + * picture. + * @param pic_struct : Indicates whether a picture should be displayed as + * a frame or field + * @param clock_time_stamp_flag[4]:1 - Indicates number of clock timestamp + * syntax elements present and follow immediately + * 0 – Indicates associated clock timestamp syntax + * elements not present + * @param ct_type[4] : Indicates the scan type(interlaced or progressive) + * of the source material + * @param nuit_field_based_flag[4] : Used to calculate the clockTimestamp + * @param counting_type[4] : Specifies the method of dropping values of + * n_frames + * @param full_timestamp_flag[4] : 1 - Specifies that the n_frames syntax + * element is followed by seconds_value, + * minutes_value, and hours_value. + * 0 - Specifies that the n_frames syntax + * element is followed by seconds_flag + * @param discontinuity_flag[4] : Indicates whether the difference between + * the current value of clockTimestamp and the value of + * clockTimestamp computed from the previous clockTimestamp in + * output order can be interpreted as the time difference between + * the times of origin or capture of the associated frames or + * fields. + * @param cnt_dropped_flag[4] : Specifies the skipping of one or more + * values of n_frames using the counting method + * @param n_frames[4] : Specifies the value of nFrames used to compute + * clockTimestamp. + * @param seconds_flag[4] : equal to 1 specifies that seconds_value and + * minutes_flag are present when + * full_timestamp_flag is equal to 0. + * @param minutes_flag[4] : equal to 1 specifies that minutes_value and + * hours_flag are present when full_timestamp_flag + * is equal to 0 and seconds_flag is equal to 1. + * @param hours_flag[4] : equal to 1 specifies that hours_value is + * present when full_timestamp_flag is equal to 0 + * and seconds_flag is equal to 1 and minutes_flag + * is equal to 1. + * @param seconds_value[4] : Specifies the value of sS used to compute + * clockTimestamp. + * @param minutes_value[4] : Specifies the value of mM used to compute + * clockTimestamp. + * @param hours_value[4] : Specifies the value of tOffset used to compute + * clockTimestamp + * @param time_offset[4] : Specifies the value of tOffset used to compute + * clockTimestamp + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiPictureTiming +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 NumClockTs; + XDAS_UInt32 cpb_removal_delay; + XDAS_UInt32 dpb_output_delay; + XDAS_UInt32 pic_struct; + XDAS_UInt32 clock_time_stamp_flag[4]; + XDAS_UInt32 ct_type[4]; + XDAS_UInt32 nuit_field_based_flag[4]; + XDAS_UInt32 counting_type[4]; + XDAS_UInt32 full_timestamp_flag[4]; + XDAS_UInt32 discontinuity_flag[4]; + XDAS_UInt32 cnt_dropped_flag[4]; + XDAS_UInt32 n_frames[4]; + XDAS_UInt32 seconds_flag[4]; + XDAS_UInt32 minutes_flag[4]; + XDAS_UInt32 hours_flag[4]; + XDAS_UInt32 seconds_value[4]; + XDAS_UInt32 minutes_value[4]; + XDAS_UInt32 hours_value[4]; + XDAS_Int32 time_offset[4]; +}IH264VDEC_SeiPictureTiming; +/** + ****************************************************************************** + * @struct IH264VDEC_SeiFullFrameFreezeRep + * + * @brief This structure contains the full frmae freeze repetition SEI msg + * elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param full_frame_freeze_repetition_period :Specifies the persistence of + * the full-frame freeze SEI message + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiFullFrameFreezeRep +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 full_frame_freeze_repetition_period; +} IH264VDEC_SeiFullFrameFreezeRep; + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiFullFrameFreezeRel + * + * @brief This structure contains frame freeze release SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param payloadSize : Size of the frame_freeze_release payload + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiFullFrameFreezeRel +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 payloadSize; +} IH264VDEC_SeiFullFrameFreezeRel; + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiStereoVideoInfo + * + * @brief This structure contains stereo video information SEI msg elements + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param field_views_flag : 1 - indicates that all pictures in the current + * coded video sequence are fields + * 0 - indicates that all pictures in the current + * coded video sequence are frames. + * @param top_field_is_left_view_flag : + * 1 - top field is a left view. + * 0 - topfield is right view. + * @param current_frame_is_left_view_flag : + * 1 - current frame is left view. + * 0 - current frame is right view. + * @param next_frame_is_second_view_flag : + * 1 - current picture and a next picture in + * output order form a stereo video pair. + * 0 - current picture and a previous picture in + * output order form a stereo video pair. + * @param left_view_self_contained_flag : + * 1 - it will not use right view as a reference + * picture for inter prediction + * 0 - it may use right view as a reference + * picture for inter prediction. + * @param right_view_self_contained_flag : + * 1 - it will not use left view as a reference + * picture for inter prediction + * 0 - it may use left view as a reference + * picture for inter prediction. + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiStereoVideoInfo +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 field_views_flag; + XDAS_UInt32 top_field_is_left_view_flag; + XDAS_UInt32 current_frame_is_left_view_flag; + XDAS_UInt32 next_frame_is_second_view_flag; + XDAS_UInt32 left_view_self_contained_flag; + XDAS_UInt32 right_view_self_contained_flag; +} IH264VDEC_SeiStereoVideoInfo; + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiFramePacking + * + * @brief This structure contains frame packing arrangement SEI msg elements + * + * @param frame_packing_arrangement_id : + * contains an identifying number that may be used to identify + * the usage of the frame packing arrangement SEI message. + * @param frame_packing_arrangement_cancel_flag : + * 1 - equal to 1 indicates that the frame packing arrangement + * SEI message cancels the persistence of any previous frame + * packing arrangement SEI message in output order. + * 0 - indicates that frame packing arrangement info follows + * @param frame_packing_arrangement_type : + * indicates the type of packing arrangement of the frames + * @param quincunx_sampling_flag : + * 1 - indicates that each color component plane of each + * constituent frame is quincunx sampled + * 0 - indicates that each color component plane of each + * constituent frame is not quincunx sampled + * @param content_interpretation_type : + * 1 - frame 0 being associated with the left view and frame 1 + * being associated with the right view + * 2 - frame 0 being associated with the right view and frame 1 + * being associated with the left view + * @param spatial_flipping_flag : + * 1 - spatial flipping is enabled for any one of the frame + * constituent, if frame_packing_arrangement_type is 3 or 4. + * 0 - spatial flipping is disabled for any one of the frame + * constituent, if frame_packing_arrangement_type is 3 or 4. + * @param frame0_flipped_flag : + * 1 - frame 0 is spatially flipped + * 0 - frame 1 is spatially flipped + * @param field_views_flag : + * 1 - indicates that all pictures in the current coded video + * sequence are coded as complementary field pairs. + * 0 - indicates that all pictures in the current coded video + * sequence are coded as frame. + * @param current_frame_is_frame0_flag : + * 1 - indicates that the current decoded frame is constituent + * frame 0 and the next decoded frame in output order + * is constituent frame 1. + * 0 - indicates that the current decoded frame is constituent + * frame 1 and the next decoded frame in output order + * is constituent frame 0. + * @param frame0_self_contained_flag : + * 1 - indicates that the constituent frame 0 is dependent on + * constituent frame 1 in decoding process + * 0 - indicates that the constituent frame 0 may dependent on + * constituent frame 1 in decoding process + * @param frame1_self_contained_flag : + * 1 - indicates that the constituent frame 1 is dependent on + * constituent frame 0 in decoding process + * 0 - indicates that the constituent frame 1 may dependent on + * constituent frame 0 in decoding process + * @param frame0_grid_position_x : + * specifies the horizontal location of the upper left + * sample of constituent frame 0 in the units of one + * sixteenth of the luma samples + * @param frame0_grid_position_y : + * specifies the vertical location of the upper left + * sample of constituent frame 0 in the units of one + * sixteenth of the luma samples + * @param frame1_grid_position_x : + * specifies the horizontal location of the upper left + * sample of constituent frame 1 in the units of one + * sixteenth of the luma samples + * @param frame1_grid_position_y : + * specifies the vertical location of the upper left + * sample of constituent frame 1 in the units of one + * sixteenth of the luma samples + * @param frame_packing_arrangement_reserved_byte : + * reserved for the future use. + * @param frame_packing_arrangement_repetition_period : + * specifies the persistence of the frame packing arrangement + * SEI message and may specify a frame order count interval + * within which another frame packing arrangement SEI message + * with the same value of frame_packing_arrangement_id or the + * end of the coded video sequence shall be present in the + * bitstream. + * @param frame_packing_arrangement_extension_flag : + * 0 - indicates that no additional data follows within the + * frame packing arrangement SEI message. + * 1 - Reserved for the future use. + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiFramePacking +{ + XDAS_UInt32 parsed_flag; + XDAS_UInt32 frame_packing_arrangement_id; + XDAS_UInt32 frame_packing_arrangement_repetition_period; + XDAS_UInt8 frame_packing_arrangement_cancel_flag; + XDAS_UInt8 frame_packing_arrangement_type; + XDAS_UInt8 quincunx_sampling_flag; + XDAS_UInt8 content_interpretation_type; + XDAS_UInt8 spatial_flipping_flag; + XDAS_UInt8 frame0_flipped_flag; + XDAS_UInt8 field_views_flag; + XDAS_UInt8 current_frame_is_frame0_flag; + XDAS_UInt8 frame0_self_contained_flag; + XDAS_UInt8 frame1_self_contained_flag; + XDAS_UInt8 frame0_grid_position_x; + XDAS_UInt8 frame0_grid_position_y; + XDAS_UInt8 frame1_grid_position_x; + XDAS_UInt8 frame1_grid_position_y; + XDAS_UInt8 frame_packing_arrangement_reserved_byte; + XDAS_UInt8 frame_packing_arrangement_extension_flag; +} IH264VDEC_SeiFramePacking; + + +/** + ****************************************************************************** + * @struct IH264VDEC_SeiMessages + * + * @brief This structure contains all the supported SEI msg objects + * + * @param parsed_flag :1 - Indicates that in the current process call, + * contents of the structure is updated + * 0 - Indicates contents of the structure is not updated + * @param full_frame_freeze : Full-frame freeze SEI message + * @param full_frame_freeze_release :Cancels the effect of any full-frame + * freeze SEI message sent with pictures that precede the current + * picture in the output order. + * @param prog_refine_start :Specifies the beginning of a set of consecutive + * coded pictures that is labeled as the current picture followed + * by a sequence of one or more pictures of refinement of the + * quality of the current picture, rather than as a representation + * of a continually moving scene. + * @param prog_refine_end : Specifies end of progressive refinement. + * @param user_data_registered :Message contains user data registered as + * specified by ITU-T Recommendation T.35 + * @param user_data_unregistered :Message contains unregistered user data + * identified by a UUID + * @param buffering_period_info :Message specifies the buffering period + * @param pan_scan_rect :Message specifies the coordinates of a rectangle + * relative to the cropping rectangle of the sequence parameter set + * @param recovery_pt_info :The recovery point SEI message assists a decoder + * in determining when the decoding process will produce acceptable + * pictures for display after the decoder initiates random access or + * after the encoder indicates a broken link in the sequence. + * @param pic_timing :Specifies timing information regarding cpb delays, dpb +* output delay, and so on. + * @param stereo_video_info :stereo video information SEI message consist of + * pair of picture forming stereo view content. + ****************************************************************************** +*/ +typedef struct IH264VDEC_SeiMessages +{ + XDAS_UInt32 parsed_flag; + IH264VDEC_SeiFullFrameFreezeRep full_frame_freeze; + IH264VDEC_SeiFullFrameFreezeRel full_frame_freeze_release; + IH264VDEC_SeiProgRefineStart prog_refine_start; + IH264VDEC_SeiProgRefineEnd prog_refine_end; + IH264VDEC_SeiUserDataRegITUT user_data_registered; + IH264VDEC_SeiUserDataUnReg user_data_unregistered; + IH264VDEC_SeiBufferingPeriod buffering_period_info; + IH264VDEC_SeiPanScanRect pan_scan_rect; + IH264VDEC_SeiRecoveryPointInfo recovery_pt_info; + IH264VDEC_SeiPictureTiming pic_timing; + IH264VDEC_SeiStereoVideoInfo stereo_video_info; + IH264VDEC_SeiFramePacking frame_packing; +} IH264VDEC_SeiMessages; + +/** + ****************************************************************************** + * @struct IH264VDEC_MbxTraceData + * + * @brief This structure holds the elements that describe the attributes of + * traced data. + * + * @param userId : Indicates whose data getting logged. + * @param message : Indicates the message type that's been used at given + * user ID. + * @param rwMode : Indicates mode in which the MBx is accessed. + * @param rsvd : Reserved byte to add any new attribute in future. + * + ****************************************************************************** +*/ +typedef struct IH264VDEC_MbxTraceData +{ + XDAS_UInt8 userId; + XDAS_UInt8 message; + XDAS_UInt8 rwMode; + XDAS_UInt8 rsvd; +}IH264VDEC_MbxTraceData; + +/** + * Macro to indicate the max number of samples + * that we capture in the log. +*/ +#define NUM_MBX_TRACE_ELEMENTS 300 + +/** + ****************************************************************************** + * @struct IH264VDEC_ProfileInfo + * + * @brief This structure contains elements related to profiling information + * This Structure is used to get some codec internal cycles and not + * to be used for any system level profiling. + * + * @param hostPreIva : Cycles spent by M3 before giving control to IVAHD. + * This gives M3 cycles alone that are spent before IVAHD + * starts doing any thing for a given process call. + * @param preMbLoop : Cycles spent before entering MB Loop + * @param inMbLoop : Cycles in the MB Loop + * @param postMbLoop : Cycles spent after the MB Loop execution + * @param hostPostIva : Cycles spent after getting control back to Host from + * IVAHD. This gives M3 cycles alone that are spent + * after IVAHD gives control back to M3 + * @param ivahdTotalCycles : Total cycles on IVAHD + * @param sliceTask : per slice cycles spent; Array size set to the stream + * "Combined_CABAC_07_HD_10.1.26l" + * @param noOfSlices : Number of lices in the picture + ****************************************************************************** +*/ +typedef struct IH264VDEC_ProfileInfo +{ + XDAS_UInt32 hostPreIva; + XDAS_UInt32 preMbLoop; + XDAS_UInt32 inMbLoop; + XDAS_UInt32 postMbLoop; + XDAS_UInt32 hostPostIva; + XDAS_UInt32 ivahdTotalCycles; + XDAS_UInt32 sliceTask[136]; + XDAS_UInt32 noOfSlices; + IH264VDEC_MbxTraceData mbxTraceArray[NUM_MBX_TRACE_ELEMENTS]; + XDAS_UInt16 mbxtraceIdx; +} IH264VDEC_ProfileInfo; + +/** + ****************************************************************************** + * @struct _sErrConcealStr + * @brief This str holds up the required Info for implementing the SCV EC, + * this will get updated by H.264 decoder while decoding the SVC + * Base/Target Layers + * + * @param CurrMbInfoBufPointer :Base Address of the current decoded frame + * MB Info buffer + * + * @param CurrMbStatusBufPointer: Base Address of the current decoded frame + * MB staus buffer pointer + * + * @param currFrameY : Base Address of the current decoded Luma + * frame buffer pointer (physical pointer) + * + * @param currFrameUV : Base Address of the current decoded Chroma + * frame buffer pointer (physical pointer) + * + * @param refConclY : Base Address of the ref decoded Luma + * frame buffer pointer (virtual pointer) + * + * @param refConclUV : Base Address of the ref decoded Chroma + * frame buffer pointer (virtual pointer) + * + * @param TilerBaseAddress : TBA vaule for the VDMA + * + * @param pSliceInfoFlags : Flag to enable slice info + * + * @param ref_width : Resultant Horizontal LUMA picture size + * after Pad size addition on both Left + * & Right sides. This gets used as + * stride during vDMA programming. + * In case of TILER,the stride is fixed, + * independant of Picture width, and + * only changes with TILER mode. + * + * @param ref_width_c : Resultant Horizontal CHROMA picture size + * after Pad size addition on both Left & + * Right sides. + * + * + * @param ref_frame_height : In case of Interlaced streams,the picure + * store is different i.e., store each field + * by applying PAD on top & bottom lines. + * Hence the picture height will be Height + * plus four times the Pad size. This + * variable holds this resultant value. + * + * @param mb_width : Picture width in terms of Macroblocks + * + * @param mb_height : Picture height in terms of Macroblocks. + * + * @param image_width : Image width of the decoded frame + * + * @param image_width : Image height of the decoded frame + * + * @param frameType : Frame type of the current frame. + * + * @param picaff_frame : Flag to indicate whether current picture + * is of Frame type & referring to Field + * picture as reference. + * + * @param mb_aff_frame_flag : Flag to indicate whether the current + * decoding picture is MBAFF type. + * + * @param field_pic_flag : Flag to indicate whether the current + * decoding picture is field type. + * + * @param bottom_field_flag : This parameter equal to 1 specifies that + * the slice is part of a coded bottom field. + * bottom_field_flag equalto 0 specifies + * that the picture is a coded top field. + * + * @param nonPairedFieldPic : Flag to indicate Non paired field picture. + * + * @param prev_pic_bottom_field : this variable Indicates if the previous + * picture was a bottom field or not (a Flag) + * + * @param currFrameYDual : Base Address of the current decoded Luma + * frame buffer pointer (physical pointer) + * for dual yuv output. + * + * @param currFrameUVDual : Base Address of the current decoded Chroma + * frame buffer pointer (physical pointer) + * for dual yuv output. + * + * @param ref_widthDual : Resultant Horizontal LUMA picture size + * after Pad size addition on both Left + * & Right sides. This gets used as + * stride during vDMA programming. + * In case of TILER,the stride is fixed, + * independant of Picture width, and + * only changes with TILER mode. + * + * @param ref_width_cDual : Resultant Horizontal CHROMA picture size + * after Pad size addition on both Left & + * Right sides. + * + ****************************************************************************** +*/ + +typedef struct _sErrConcealStr +{ + XDAS_Int32 ErrConcealmentEnable; + XDAS_Int32 CurrMbInfoBufPointer; + XDAS_Int32 CurrMbStatusBufPointer; + XDAS_Int32 CurrMbInfoIresBufPointer; + XDAS_Int32 currFrameY; + XDAS_Int32 currFrameUV; + XDAS_Int32 refConclY; + XDAS_Int32 refConclUV; + XDAS_UInt32 TilerBaseAddress; + XDAS_UInt16 ref_width; + XDAS_UInt16 ref_width_c; + XDAS_UInt16 ref_frame_height; + XDAS_UInt16 mb_width; + XDAS_UInt16 mb_height; + XDAS_UInt16 image_width; + XDAS_UInt16 image_height; + XDAS_UInt8 frameType; + XDAS_UInt8 picaff_frame; + XDAS_UInt8 mb_aff_frame_flag; + XDAS_UInt8 field_pic_flag; + XDAS_UInt8 bottom_field_flag; + XDAS_UInt8 nonPairedFieldPic; + XDAS_UInt8 prev_pic_bottom_field; + XDAS_Int32 currFrameYDual; + XDAS_Int32 currFrameUVDual; + XDAS_UInt16 ref_widthDual; + XDAS_UInt16 ref_width_cDual; + XDAS_UInt16 rsvd[2]; +}sErrConcealStr; + +/** + * Size of sliceinfo flags - We have two slice info flag arrays in SL2, one + * for ECD3 and the other for MC3. ECD3 flag is one bit per MB. Since Maximum + * supported number of MBs in a frame for Low resolution is 128 x 128 = 16384, + * and for High resolution 270*256 = 69120. So we need 16384/8 = 2048 bytes + * for Low resolution and 69120/8 = 8640 for High resolution to store slice + * info flag array for ECD3. But for the MC3 array, we always make the next + * bit also as 1 to enable loading into ping and pong memories of MCBUF. + * So we need an extra bit for the MC3 array, to avoid buffer overflow when + * the last MB is a new slice. To keep the next SL2 buffer in 16-byte aligned + * position (some buffers need it) we round the size to next multiple of 16, + * i.e., 2064 and 8656 for Low and High resolutions respectively. + * As we are maintaining only one decoder image in M3, we define + * SLICEINFO_FLAGSIZE as 8656 (maximum among 2064 and 8656). +*/ +#define SLICEINFO_FLAGSIZE_HIGHRES 8656 +#define SLICEINFO_FLAGSIZE_LOWRES 2064 + +/** + ****************************************************************************** + * @struct _sErrConcealLayerStr + * @brief This str holds up the required Info for implementing the SCV EC, + * this will get updated by H.264 decoder while decoding the SVC + * Base/Target Layers + * + * @param svcEcStr : structure instance of sSVCErrConcealStr + * + * @param pSliceInfoFlags : Array to store the sliceInfo flag + * + * + ****************************************************************************** +*/ +typedef struct _sErrConcealLayerStr +{ + sErrConcealStr sECStr; + XDAS_UInt8 pSliceInfoFlags[SLICEINFO_FLAGSIZE_HIGHRES]; +}sErrConcealLayerStr; + +/** + ****************************************************************************** + * @enum IH264VDEC_dpbNumFrames + * @brief This enum can be used to choose the DPB Size in number + * number of frames. + * @details + ****************************************************************************** +*/ +typedef enum +{ + IH264VDEC_DPB_NUMFRAMES_AUTO = -1, + /**< + * Allow the decoder to choose the number of reference frames based on the + * stream information. + */ + IH264VDEC_DPB_NUMFRAMES_0 = 0, + /**< + * Number of frames required is 0 + */ + IH264VDEC_DPB_NUMFRAMES_1 = 1, + /**< + * Number of frames required is 1 + */ + IH264VDEC_DPB_NUMFRAMES_2 = 2, + /**< + * Number of frames required is 2 + */ + IH264VDEC_DPB_NUMFRAMES_3 = 3, + /**< + * Number of frames required is 3 + */ + IH264VDEC_DPB_NUMFRAMES_4 = 4, + /**< + * Number of frames required is 4 + */ + IH264VDEC_DPB_NUMFRAMES_5 = 5, + /**< + * Number of frames required is 5 + */ + IH264VDEC_DPB_NUMFRAMES_6 = 6, + /**< + * Number of frames required is 6 + */ + IH264VDEC_DPB_NUMFRAMES_7 = 7, + /**< + * Number of frames required is 7 + */ + IH264VDEC_DPB_NUMFRAMES_8 = 8, + /**< + * Number of frames required is 8 + */ + IH264VDEC_DPB_NUMFRAMES_9 = 9, + /**< + * Number of frames required is 9 + */ + IH264VDEC_DPB_NUMFRAMES_10 = 10, + /**< + * Number of frames required is 10 + */ + IH264VDEC_DPB_NUMFRAMES_11 = 11, + /**< + * Number of frames required is 11 + */ + IH264VDEC_DPB_NUMFRAMES_12 = 12, + /**< + * Number of frames required is 12 + */ + IH264VDEC_DPB_NUMFRAMES_13 = 13, + /**< + * Number of frames required is 13 + */ + IH264VDEC_DPB_NUMFRAMES_14 = 14, + /**< + * Number of frames required is 14 + */ + IH264VDEC_DPB_NUMFRAMES_15 = 15, + /**< + * Number of frames required is 15 + */ + IH264VDEC_DPB_NUMFRAMES_16 = 16, + /**< + * Number of frames required is 16 + */ + IH264VDEC_DPB_NUMFRAMES_DEFAULT = IH264VDEC_DPB_NUMFRAMES_AUTO + /**< + * Allow the decoder to choose the number of reference frames based on the + * stream information. + */ +} IH264VDEC_dpbNumFrames; + +/** + ****************************************************************************** + * @enum IH264VDEC_SVCErrConcealMode + * @brief Describes the error concealment mode ID for SVC codec + * This enumeration type is used by svc app to specify codec + * to concealment mode + * + ****************************************************************************** +*/ + +typedef enum +{ + IH264VDEC_SETERRCONCEALMODE = 15 + /** SVC error concealment mode ID + * + */ +} IH264VDEC_SVCErrConcealMode; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_CommonInfo + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_CommonInfo +{ + XDAS_UInt32 codec_type:8; + XDAS_UInt32 fmt_type:8; + XDAS_UInt32 mb_ll_avail:1; + XDAS_UInt32 mb_ul_avail:1; + XDAS_UInt32 mb_uu_avail:1; + XDAS_UInt32 mb_ur_avail:1; + XDAS_UInt32 pic_bound_l:1; + XDAS_UInt32 pic_bound_u:1; + XDAS_UInt32 pic_bound_r:1; + XDAS_UInt32 pic_bound_b:1; + XDAS_UInt32 first_mb_flag:1; + XDAS_UInt32 error_flag:1; + XDAS_UInt32 zero:6; + XDAS_UInt32 zeroes:16; + XDAS_UInt32 mb_addr:16; + +} IH264VDEC_TI_CommonInfo; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_MotionVector + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_MotionVector +{ + XDAS_Int16 x; + XDAS_Int16 y; +} IH264VDEC_TI_MotionVector; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_CabacContext + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_CabacContext +{ + IH264VDEC_TI_MotionVector mvd_l0[4]; + IH264VDEC_TI_MotionVector mvd_l1[4]; + +} IH264VDEC_TI_CabacContext; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_TotalCoefLuma + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_TotalCoefLuma +{ + XDAS_UInt8 right[3]; + XDAS_UInt8 bottom_right; + XDAS_UInt8 bottom[3]; + XDAS_UInt8 zero; +} IH264VDEC_TI_TotalCoefLuma; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_TotalCoefChroma + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_TotalCoefChroma +{ + XDAS_UInt8 right_cb; + XDAS_UInt8 bottom_right_cb; + XDAS_UInt8 bottom_cb; + XDAS_UInt8 zero; + XDAS_UInt8 right_cr; + XDAS_UInt8 bottom_right_cr; + XDAS_UInt8 bottom_cr; + XDAS_UInt8 zero1; +} IH264VDEC_TI_TotalCoefChroma; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_CavlcContext + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_CavlcContext +{ + unsigned long long zeroes[2]; + IH264VDEC_TI_TotalCoefLuma total_coef_luma; + IH264VDEC_TI_TotalCoefChroma total_coef_chroma; + +} IH264VDEC_TI_CavlcContext; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_IntraPredMode + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_IntraPredMode +{ + XDAS_UInt32 ipred_mode0:4; + XDAS_UInt32 ipred_mode1:4; + XDAS_UInt32 ipred_mode2:4; + XDAS_UInt32 ipred_mode3:4; + XDAS_UInt32 ipred_mode4:4; + XDAS_UInt32 ipred_mode5:4; + XDAS_UInt32 ipred_mode6:4; + XDAS_UInt32 ipred_mode7:4; + XDAS_UInt32 ipred_mode8:4; + XDAS_UInt32 ipred_mode9:4; + XDAS_UInt32 ipred_mode10:4; + XDAS_UInt32 ipred_mode11:4; + XDAS_UInt32 ipred_mode12:4; + XDAS_UInt32 ipred_mode13:4; + XDAS_UInt32 ipred_mode14:4; + XDAS_UInt32 ipred_mode15:4; + +} IH264VDEC_TI_IntraPredMode; + + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_MbPredType + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_MbPredType +{ + XDAS_UInt32 mbskip:1; + XDAS_UInt32 tr8x8:1; + XDAS_UInt32 mb_field:1; + XDAS_UInt32 cond_mbskip:1; + XDAS_UInt32 c_ipred_mode:2; + XDAS_UInt32 zero:1; + XDAS_UInt32 end_of_slice:1; + XDAS_UInt32 mb_y_mod2:1; + XDAS_UInt32 zero1:7; + XDAS_UInt32 refidx_equal_flag_l0:1; + XDAS_UInt32 refidx_equal_flag_l1:1; + XDAS_UInt32 mv_equal_flag_l0:1; + XDAS_UInt32 mv_equal_flag_l1:1; + XDAS_UInt32 zeroes:4; + XDAS_UInt32 mb_type:8; + XDAS_UInt8 sub_mb_type[4]; + +} IH264VDEC_TI_MbPredType; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_QpCbp + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_QpCbp +{ + XDAS_UInt32 cbp; + XDAS_UInt8 qp_y; + XDAS_UInt8 qp_cb; + XDAS_UInt8 qp_cr; + XDAS_UInt8 zero; +} IH264VDEC_TI_QpCbp; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_RefPicControl + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_RefPicControl +{ + XDAS_UInt8 refidx[4]; + XDAS_UInt8 refpicid[4]; + +} IH264VDEC_TI_RefPicControl; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_MvBidirectional16 + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_MvBidirectional16 +{ + IH264VDEC_TI_MotionVector mv_forward[16]; + IH264VDEC_TI_MotionVector mv_backward[16]; +} IH264VDEC_TI_MvBidirectional16; + + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_MvBidirectional4 + * + * @brief + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_MvBidirectional4 +{ + IH264VDEC_TI_MotionVector mv_forward[4]; + IH264VDEC_TI_MotionVector mv_backward[4]; + +} IH264VDEC_TI_MvBidirectional4; + +/** + ****************************************************************************** + * @struct IH264VDEC_TI_MbInfo + * + * @brief This structure details the data format for MB information shared to + * application. This helps application to understand all fields + * the way codec uses MB info internally. This structure is of size + * 208 Bytes. + * + * @param info : This elements gives details about the MB placement in the + * frame. + * + * @param cabac: This field holds the context data for a CABAC coded MB + * + * @param cavlc: This field holds the context data for a CAVLC coded MB + * + * @param ipred_mode: This field holds information of intra prediction modes + * at 4x4 level, for intra coded MB. + * + * @param mb_pred_type: This indicates prediction specific details for inter + * coded MB + * + * @param qp_cbp: This gives coded & QP informations for both LUMA & CHROMA + * components of a Macro Block. + * + * @param l0_ref_pic_control: Informs all details about reference indices + * at 8x8 block level in L0 direction + * + * @param l1_ref_pic_control: Informs all details about reference indices + * at 8x8 block level in L1 direction + * + * @param mv_forward: Lists all Motion vectors at 4x4 level in L0 direction + * + * @param bidirectional16: Lists all Motion vectors at 4x4 level in both + * directions + * + * @param bidirectional4: Lists all Motion vectors at 8x8 level in both + * directions + * + ****************************************************************************** +*/ +typedef struct _IH264VDEC_TI_MbInfo +{ + IH264VDEC_TI_CommonInfo info; + + union { + IH264VDEC_TI_CabacContext cabac; + IH264VDEC_TI_CavlcContext cavlc; + } IH264VDEC_TI_context; + + IH264VDEC_TI_IntraPredMode ipred_mode; + IH264VDEC_TI_MbPredType mb_pred_type; + IH264VDEC_TI_QpCbp qp_cbp; + IH264VDEC_TI_RefPicControl l0_ref_pic_control; + IH264VDEC_TI_RefPicControl l1_ref_pic_control; + + union { + IH264VDEC_TI_MotionVector mv_forward[16]; + IH264VDEC_TI_MvBidirectional16 bidirectional16; + IH264VDEC_TI_MvBidirectional4 bidirectional4; + } IH264VDEC_TI_motion_vecs; + +} IH264VDEC_TI_MbInfo; + +#endif /* IH264VDEC_ */ diff --git a/packages/ivahd_codecs/ti/sdo/codecs/jpegvdec/ijpegvdec.h b/packages/ivahd_codecs/ti/sdo/codecs/jpegvdec/ijpegvdec.h new file mode 100644 index 0000000..bea0d1c --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/jpegvdec/ijpegvdec.h @@ -0,0 +1,587 @@ +/* +******************************************************************************** +* HDVICP2.0 Based JPEG Decoder +* +* "HDVICP2.0 Based JPEG Decoder" is software module developed on +* TI's HDVICP2 based SOCs. This module is capable of generating a raw image +* by de-compressing/decoding a jpeg bit-stream based on ISO/IEC IS 10918-1. +* Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ +* ALL RIGHTS RESERVED +******************************************************************************** +*/ + +/** +******************************************************************************** +* @file ijpegvdec.h +* +* @brief This file provides definisions for the interface handles. +* +* @author Odanaka +* +* @version 0.0 (Dec 2008) : Created the initial version. +* +* @version 0.1 (Dec 2009) : Added extended dynamic paramters[Chetan] +* +* @version 0.2 (Feb 2010) : Coding Guidelines[Chetan] +* +* @version 0.3 (July 2010) : Added Error Robustness Error Codes[Chetan] +* +* @version 0.4 (Sept 2010) : Added Error Robustness Error Codes for Data Sync +* [Chetan] +* +* @version 0.5 (Nov 2010) : Added support for Slice level decoding[Chetan] +* +* @version 0.6 (Feb 2011) : Added error codes for unsupported features [Chetan] +* +* @version 0.7 (Sep 2011) : Exposed default static/dynamic params [Naidu] +* +* @version 0.8 (Sep 2011) : Added error codes for un-supported resolutions +* [Naidu] +* +* @version 0.9 (Oct 2012) : Added parameter rangeReduction in extended Dynamic +* parameters to support Limited Pixel range feature. +* [Santoshkumar S K] +* +* @version 1.0 (Mar 2013) : Added support for slice switch + input datasync +* [Veeranna/Chetan] +******************************************************************************* +*/ + +/*----------------------compilation control switches -------------------------*/ +#ifndef _IJPEGVDEC_ +#define _IJPEGVDEC_ + +/******************************************************************************* +* INCLUDE FILES +*******************************************************************************/ +/* -------------------- system and platform files ----------------------------*/ +#include +#include +#include +#include +#include + +/*----------------------program files ----------------------------------------*/ + +/******************************************************************************* +* PUBLIC DECLARATIONS Defined here, used elsewhere +*******************************************************************************/ +/*-----------------------data declarations -----------------------------------*/ + + +/** +******************************************************************************* +* @enum ethumbnailMode +* +* @brief Enumerator which defines all the different types of thumbnail +* supported. +* +* @remarks IJPEGVDEC_THUMBNAIL_JFIF : Decode and output thumbnail +* available with JFIF marker +* +* @remarks IJPEGVDEC_THUMBNAIL_EXIF : Decode and output thumbnail +* available with EXIF marker +* +* @remarks IJPEGVDEC_THUMBNAIL_DOWNSAMPLE : Decode the image and +* downsample it toprovide it as thumbnail output +* +******************************************************************************* +*/ +typedef enum { + IJPEGVDEC_THUMBNAIL_JFIF = 1, + IJPEGVDEC_THUMBNAIL_EXIF = 2, + IJPEGVDEC_THUMBNAIL_DOWNSAMPLE = 3 +}ethumbnailMode; + +/** +******************************************************************************* +* @enum edownSamplingFactor +* +* @brief Enumerator which defines the factor with which the downsampling +* needs to be carried out. This applies to both Horizontal +* and vertical dimentions +* +* @remarks IJPEGVDEC_NODOWNSAMPLE : No Down Sample. +* +* @remarks IJPEGVDEC_DOWNSAMPLEBY2 : Downscale by 2 +* +* @remarks IJPEGVDEC_DOWNSAMPLEBY4 : Downscale by 4 +* +* +******************************************************************************* +*/ +typedef enum { + IJPEGVDEC_NODOWNSAMPLE = 1, + IJPEGVDEC_DOWNSAMPLEBY2 = 2, + IJPEGVDEC_DOWNSAMPLEBY4 = 4 +} edownSamplingFactor; + +/** +******************************************************************************* +* @enum eFrameErrorConcealment +* +* @brief Enumerator which defines values to ENABLE or DISABLE +* Error Concealment +* +* @remarks IJPEGVDEC_EC_DISABLE : Disable Error concealment +* +* @remarks IJPEGVDEC_EC_ENABLE : Enable Error Concealment +* +* +******************************************************************************* +*/ +typedef enum { + IJPEGVDEC_EC_DISABLE = 0, + IJPEGVDEC_EC_ENABLE +}eFrameErrorConcealment; + +/** +******************************************************************************* +* @struct IJPEGVDEC_Fxns +* +* @brief This structure defines all of the operations on jpgVDEC objects. +* +* @param ividdec : handle to the all function of the operations +* on IVIDDEC3 objects +* +******************************************************************************* +*/ +typedef struct { + IVIDDEC3_Fxns ividdec; +} IJPEGVDEC_Fxns; + +/** +******************************************************************************* +* @struct IJPEGVDEC_Obj +* +* @brief This structure must be the first field of all jpgVDEC instance +* objects +* +* @param fxns : Handle to extented jpeg video decoder library interface +* functions +* +******************************************************************************* +*/ +typedef struct { + IJPEGVDEC_Fxns *fxns; +} IJPEGVDEC_Obj; + +/** +******************************************************************************* +* @struct IJPEGVDEC_Handle +* +* @brief This handle is used to reference all jpgVDEC instance objects +* +******************************************************************************* +*/ +typedef IJPEGVDEC_Obj *IJPEGVDEC_Handle; + +/** +******************************************************************************* +* @struct IJPEGVDEC_Status +* +* @brief Status structure defines the parameters that can be changed or +* read during real-time operation of the alogrithm. +* +* @param viddecStatus : Handle to base class status struture which defines +* the all run time parameters. +* +* @param extendedErrorCode0 : Extended Error Code0 returned by decoder +* +* @param extendedErrorCode1 : Extended Error Code1 returned by decoder +* +* @param extendedErrorCode2 : Extended Error Code2 returned by decoder +* +* @param extendedErrorCode3 : Extended Error Code3 returned by decoder +* +* @param debugTraceLevel : DebugTrace level being used by decoder +* +* @param lastNFramesToLog : Number of frames of debug data decoder is +* dumping trace buffer +* +* @param extMemoryDebugTraceAddr : Trace buffer base address in external memory +* +* @param extMemoryDebugTraceSize : Size of Trace buffer in external memory +* +******************************************************************************* +*/ +typedef struct { + /*--------------------------------------------------------------------------*/ + /*Base Class */ + /*--------------------------------------------------------------------------*/ + IVIDDEC3_Status viddecStatus; + + /*--------------------------------------------------------------------------*/ + /*Extended Error Code0 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode0; + + /*--------------------------------------------------------------------------*/ + /*Extended Error Code1 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode1; + + /*--------------------------------------------------------------------------*/ + /*Extended Error Code2 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode2; + + /*--------------------------------------------------------------------------*/ + /*Extended Error Code3 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode3; + + /*--------------------------------------------------------------------------*/ + /*DebugTrace level being used by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 debugTraceLevel; + + /*--------------------------------------------------------------------------*/ + /*Number of frames of debug data decoder is dumping trace buffer */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 lastNFramesToLog; + + /*--------------------------------------------------------------------------*/ + /* Trace buffer base address in external memory */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 *extMemoryDebugTraceAddr; + + /*--------------------------------------------------------------------------*/ + /* Size of Trace buffer in external memory */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extMemoryDebugTraceSize; + +} IJPEGVDEC_Status; + +/** +******************************************************************************* +* @struct IJPEGVDEC_Cmd +* +* @brief The Cmd enumeration defines the control commands for the JPEG +* video decoder control method. +* +******************************************************************************* +*/ +typedef IVIDDEC3_Cmd IJPEGVDEC_Cmd; + +/** +******************************************************************************* +* @struct IJPEGVDEC_Params +* +* @brief This structure defines the creation parameters for all +* jpgVDEC objects +* +* @param viddecParams : Defines the creation time parameters for +* all IVIDDEC3 instance objects. +* +* @param ErrorConcealmentON : Enable/Disable Error Concealment +* +* @param debugTraceLevel : Enable/Disable Error Concealment +* +* @param lastNFramesToLog : Number of frames to log history for debugTrace +* +* @param sliceSwitchON : ENABLE/DISABLE Slice Switching feature. +* +* @param numSwitchPerFrame : Number of Switches in a Frame. +* +* @param numRestartMarkerPerSwitch : Number of Restart Marker(slices) to +* decode in one process call or in one switch. +* +******************************************************************************* +*/ +typedef struct { + /*--------------------------------------------------------------------------*/ + /*Base Class */ + /*--------------------------------------------------------------------------*/ + IVIDDEC3_Params viddecParams; + + /*--------------------------------------------------------------------------*/ + /*Enable/Disable Error Concealment */ + /* enumeration 'eFrameErrorConcealment' can be used to set this value */ + /*--------------------------------------------------------------------------*/ + XDAS_Int32 ErrorConcealmentON; + + /*--------------------------------------------------------------------------*/ + /*Debug trace Level */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 debugTraceLevel; + + /*--------------------------------------------------------------------------*/ + /*Number of frames to log history for debugTrace */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 lastNFramesToLog; + + /*--------------------------------------------------------------------------*/ + /* ENABLE/DISABLE Slice Switching feature. */ + /* enumeration 'eSliceSwitch' can be used to set this value */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 sliceSwitchON; + + /*--------------------------------------------------------------------------*/ + /* Number of Switches in a Frame. This is valid only when sliceSwitchON is */ + /* enabled , when disabled , its dont care. */ + /* Application tells how many switches should happen in a frame , codec has */ + /* to decide how to handle each process call ( how many slices) and it has */ + /* process "numSwitchInFrame " process calls only */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 numSwitchPerFrame; + + /*--------------------------------------------------------------------------*/ + /* Application tells a number meaning codec has to decode this much slices */ + /* or restart markers and come out of process call. Here each switch can */ + /*have N number of restart marker ( N should be greater than or equal to 1).*/ + /* Once codec process call is done , application will give again the next */ + /* number and application will handle till all the slices in the frame have */ + /* been decoded. */ + /* This paramter is valid only when "sliceSwitchON" is enabled */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 numRestartMarkerPerSwitch; + +} IJPEGVDEC_Params; + +/** +******************************************************************************* +* @struct IJPEGVDEC_DynamicParams +* +* @brief This structure defines the run time parameters for all +* jpgVDEC objects +* +* @param viddecDynamicParams : Defines the run time parameters for +* all IVIDDEC3 instance objects. +* +* @param decodeThumbnail : Decode the ThumNail and provide the output for +* display. +* +* @param thumbnailMode : Specifies which thumbnail to decode. If none of +* the markers (JFIF and EXIF) have thumbnail image, +* use IJPEGVDEC_THUMBNAIL_DOWNSAMPLE. Refer to +* thumbnailMode enumeration +* +* @param downsamplingFactor : If decodeThumbnail is enabled and +* thumbnailMode is set to +* IJPEGVDEC_THUMBNAIL_DOWNSAMPLE, +* downsamplingFactor is used as scaling factor +* for ThumNail output +* If decodeThumbnail is disabled, this parameter +* is used as scaling factor for display buffer +* output. Refer to edownSamplingFactor +* +* @param streamingCompliant : If an Input Image is Non-Interleaved , +* Application has to set this params to "0" +* (DISABLE) , if it is Interleaved , value will +* be "1" (ENABLE). This Paramater along with +* ForceChromaFormat determines whether we +* have to give Planar Buffers from GetBufinfo. +* +* @param rangeReduction : Parameter is used to enable/disable +* limited Pixel Range feature. +* +******************************************************************************* +*/ +typedef struct { + IVIDDEC3_DynamicParams viddecDynamicParams; + + + XDAS_Int32 decodeThumbnail; + + XDAS_Int32 thumbnailMode; + + XDAS_Int32 downsamplingFactor; + + XDAS_Int32 streamingCompliant; + + XDAS_Int32 rangeReduction; + +} IJPEGVDEC_DynamicParams; + +/** +******************************************************************************* +* @struct IJPEGVDEC_InArgs +* +* @brief This structure defines the run time input arguments for all VIDDEC +* objects. +* +* @param viddecInArgs : Defines the input arguments for all +* IVIDDEC3 instance process function. +* +******************************************************************************* +*/ +typedef struct { + IVIDDEC3_InArgs viddecInArgs; +}IJPEGVDEC_InArgs; + +/** +******************************************************************************* +* @struct IJPEGVDEC_OutArgs +* +* @brief This structure defines the run time output arguments for VIDDEC +* objects.This structure may be extended by individual codec +* implementation allowing customization with vendor specific +* parameters. +* +* @param viddecOutArgs : Defines the output arguments for all +* IVIDDEC3 instance process function. +* +* @param IsGrayFlag : This is set if the input to the decoder is a grayscale +* image. For 420 and Gray scale images, the output chroma +* format is 420SP. This flag will differentiate the MCU +* size required in output data sync usage. If IsGrayFlag +* is set to 1, the row size is 8xWidth otherwise rowsize +* is 16xWidth +* +* @param bytesConsumedForPartialBuffer : In case of SliceSwitch & only input +* data sync are enabled, whenever the +* switch happens, this parameter +* represents the number of bytes consumed +* by codec in last consumed buffer as it +* may be partially consumed +* +******************************************************************************* +*/ +typedef struct { + IVIDDEC3_OutArgs viddecOutArgs; + XDAS_UInt32 IsGrayFlag; + XDAS_UInt32 bytesConsumedForPartialBuffer; +}IJPEGVDEC_OutArgs; + + +typedef enum { + IJPEGDEC_ERR_UNSUPPORTED_VIDDEC3PARAMS = 0, + IJPEGDEC_ERR_UNSUPPORTED_VIDDEC3DYNAMICPARAMS = 1, + IJPEGDEC_ERR_UNSUPPORTED_JPEGDECDYNAMICPARAMS = 2, + IJPEGDEC_ERR_NOSLICE = 3, + IJPEGDEC_ERR_MBDATA = 4, + IJPEGDEC_ERR_STANDBY = 5, + IJPEGDEC_ERR_INVALID_MBOX_MESSAGE = 6, + IJPEGDEC_ERR_HDVICP_RESET = 7, + IJPEGDEC_ERR_HDVICP_WAIT_NOT_CLEAN_EXIT = 16, + IJPEGDEC_ERR_FRAME_HDR = 17, + IJPEGDEC_ERR_SCAN_HDR = 18, + IJPEGDEC_ERR_HUFF_TBL_HDR = 19, + IJPEGDEC_ERR_QUANT_TBL_HDR = 20, + IJPEGDEC_ERR_OUTCHROMAFORMAT = 21, + IJPEGDEC_ERR_UNSUPPORTED_MARKER = 22, + IJPEGDEC_ERR_THUMBNAIL = 23, + IJPEGDEC_ERR_IRES_HANDLE = 24, + IJPEGDEC_ERR_DYNAMIC_PARAMS_HANDLE = 25, + + /* Error Codes of Data Sync */ + IJPEGDEC_ERR_DATASYNC = 26, + IJPEGDEC_ERR_DOWNSAMPLE_INPUT_FORMAT = 27, + IJPEGDEC_ERR_NOT_SUPPORTED_FEATURE = 28, + IJPEGDEC_ERR_NOT_SUPPORTED_RESOLUTION = 29 + +}IJPEGDEC_ExtendedErrorCodes; + +typedef enum { + JPEG_DECODE_THUMBNAIL_ERROR = 0, + JPEG_DYNAMIC_PARAMS_HANDLE_ERROR, + JPEG_THUMBNAIL_MODE_ERROR, + JPEG_DOWNSAMPLING_FACTOR_ERROR, + JPEG_STREAMING_COMPLIANT_ERROR, + JPEG_NON_INTERLEAVED_STREAMING_COMPLIANT_ERROR, + JPEG_DECODE_HEADER_ERROR, + JPEG_DISPLAY_WIDTH_ERROR, + JPEG_DYNAMIC_PARAMS_SIZE_ERROR, + JPEG_NULL_INSTANCE_HANDLE_ERROR, + JPEG_NULL_INARGS_POINTER_ERROR, + JPEG_NULL_OUTARGS_POINTER_ERROR, + JPEG_NULL_INPUT_BUF_DESC_ERROR, + JPEG_NULL_OUTPUT_BUF_DESC_ERROR, + JPEG_INVALID_INARGS_SIZE, + JPEG_INVALID_OUTARGS_SIZE, + JPEG_NULL_INPUT_BUFFER_POINTER_ERROR, + JPEG_NULL_OUTPUT_BUF_DESC_POINTER_ERROR, + JPEG_INVALID_NUM_OF_INPUT_BUFFERS_ERROR, + JPEG_INVALID_INPUT_BYTES_ERROR, + JPEG_INVALID_INPUT_BUFFER_MEMORY_TYPE_ERROR, + JPEG_INVALID_NUM_OF_OUTPUT_BUFFERS_ERROR, + JPEG_NULL_OUTPUT_BUFFER_POINTER0_ERROR, + JPEG_INVALID_OUTPUT_BUFFER0_SIZE_ERROR, + JPEG_INVALID_OUTPUT_BUFFER0_MEMTYPE_ERROR, + JPEG_NULL_OUTPUT_BUFFER_POINTER1_ERROR, + JPEG_INVALID_OUTPUT_BUFFER1_SIZE_ERROR, + JPEG_INVALID_OUTPUT_BUFFER1_MEMTYPE_ERROR, + JPEG_NULL_OUTPUT_BUFFER_POINTER2_ERROR, + JPEG_INVALID_OUTPUT_BUFFER2_SIZE_ERROR, + JPEG_INVALID_OUTPUT_BUFFER2_MEMTYPE_ERROR, + JPEG_INVALID_INPUT_ID_ERROR, + JPEG_NUM_VDMA_DESC_EXCEEDS_ERROR, + JPEG_INVALID_SOI_MARKER_ERROR, + JPEG_INVALID_MARKER_SEG_LENGTH_ERROR, + JPEG_NON_STANDARD_MARKER_CODE_ERROR, + JPEG_INVALID_QUANT_TABLE_TYPE_ERROR, + JPEG_QUANT_TABLE_BYTES_READ_ERROR, + JPEG_INVALID_HUFFMAN_TABLE_TYPE_ERROR, + JPEG_HUFFMAN_CODE_LENGTH_SIZE_EXCEED_ERROR, + JPEG_HUFFMAN_TABLE_MARKER_SEG_SIZE_ERROR, + JPEG_HUFFMAN_TABLE_BYTES_READ_ERROR, + JPEG_INVALID_SAMPLE_PRECISION_ERROR, + JPEG_INVALID_NUM_COMPONENTS_ERROR, + JPEG_FRAME_HDR_BYTES_READ_ERROR, + JPEG_NOT_SUPPORTED_FORMAT_ERROR, + JPEG_ARITHMETIC_DECODING_NOT_SUPPORTED_MARKER_ERROR, + JPEG_PROG_DECODING_NOT_SUPPORTED_MARKER_ERROR, + JPEG_LOSSLESS_DECODING_NOT_SUPPORTED_MARKER_ERROR, + JPEG_DIFFERENTIAL_DECODING_NOT_SUPPORTED_MARKER_ERROR, + JPEG_JFIF_THUMBNAIL_IDENTIFIER_ERROR, + JPEG_JFIF_THUMBNAIL_BYTES_READ_ERROR, + JPEG_JFIF_EXTN_NO_SOI_ERROR, + JPEG_JFIF_NOT_SUPPORTED_FEATURE_ERROR, + JPEG_FORCECHROMA_OUTPUTCHROMA_FORMAT_MISMATCH_ERROR, + JPEG_INVALID_VERT_SCAN_FREQ_ERROR, + JPEG_INVALID_HORI_SCAN_FREQ_ERROR, + JPEG_INVALID_QUANT_DEST_SELECTOR_ERROR, + JPEG_DC_ENTROPY_CODING_DEST_ERROR, + JPEG_AC_ENTROPY_CODING_DEST_ERROR, + JPEG_ECD_VLD_OUT_OF_TABLE_ERROR, + JPEG_ECD_RESTART_INTERVAL_ERROR, + JPEG_ECD_BLOCK_COEFF_NUM_ERROR, + JPEG_GET_DATA_SYNC_NULL_FUNC_POINTER_ERROR, + JPEG_PUT_DATA_SYNC_NULL_FUNC_POINTER_ERROR, + JPEG_HDVICP_ACQUIRE_AND_CONFIGURE_ERROR, + JPEG_NULL_ALGORITHM_HANDLE_ERROR, + JPEG_GETVERSION_NULL_BUF_POINTER_ERROR, + JPEG_IRES_RESOURCE_DESC_ERROR, + JPEG_IRES_RESOURCE_DESC_HANDLE_ERROR, + JPEG_NULL_STATUS_DATA_BUF, + JPEG_EXCEED_BYTES_CONSUMED_ERROR, + + /* Extended Error Codes for Data Sync */ + JPEG_INPUT_DATASYNC_NUMBLOCKS_ERROR, + JPEG_INPUT_DATASYNC_BUFF_POINTER_ERROR, + JPEG_INPUT_DATASYNC_BLOCKSIZE_ERROR, + JPEG_INPUT_DATASYNC_NOT_VALID, + + JPEG_OUTPUT_DATASYNC_NUMBLOCKS_ERROR, + + JPEG_SLICE_LEVEL_INPUT_NO_RST_MARKER_ERROR, + JPEG_DOWNSAMPLING_IN_NON_TILED_ERROR, + JPEG_DOWNSAMPLING_NOT_SUPPORTED_FORMAT_ERROR, + JPEG_DOWNSAMPLING_NOT_SUPPORTED_FEATURE_ERROR, + JPEG_THUMBNAIL_NOT_SUPPORTED_FEATURE_ERROR, + + /* Extended Error Codes for Unsupported Resolution */ + JPEG_NOT_SUPPORTED_WIDTH_ERROR, + JPEG_NOT_SUPPORTED_HEIGHT_ERROR, + JPEG_DECODE_LIMITED_PIXEL_RANGE_ERROR +}IjpegVDEC_ErrorStatus; +/* + * ======== IJPEGVDEC_Params ======== + * Default parameter values for JPEGVDEC instance objects + */ +extern const IJPEGVDEC_Params JPEGVDEC_TI_Static_Params; +/* + * ======== IJPEGVDEC_DynamicParams ======== + * Default dynamic parameter values for JPEGVDEC instance objects + */ +extern const IJPEGVDEC_DynamicParams JPEGVDEC_TI_DynamicParams; +/* ------------------------------ macros ------------------------------------ */ + +/**************************************************************** +* PRIVATE DECLARATIONS Defined here, used only here +****************************************************************/ +/*--------data declarations -----------------------------------*/ + +#endif /* _IJPEGVDEC_ */ + diff --git a/packages/ivahd_codecs/ti/sdo/codecs/mpeg2vdec/impeg2vdec.h b/packages/ivahd_codecs/ti/sdo/codecs/mpeg2vdec/impeg2vdec.h new file mode 100644 index 0000000..246fc98 --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/mpeg2vdec/impeg2vdec.h @@ -0,0 +1,509 @@ +/* +******************************************************************************** +* HDVICP2.0 Based MPEG-2 MP Decoder +* +* "HDVICP2.0 Based MPEG-2 MP Decoder" is software module developed on TI's +* HDVICP2 based SOCs. This module is capable of generating a raw 4:2:0 video +* data by de-compressing/decoding a main/simple profile bit-stream based on +* ISO/IEC 13818-2. +* Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ +* ALL RIGHTS RESERVED +******************************************************************************** +*/ + +/** +******************************************************************************** +* @file impeg2vdec.h +* +* @brief This file provides definisions for the interface(API) parameters. +* +* @author Prashanth +* +* @version 0.0 (July 2008) : Created [Prashanth] +* @version 0.1 (Dec 2009) : Added extended dynamic paramters[Deepa] +* @version 0.2 (Feb 2010) : Coding Guidelines[Deepa] +* @version 0.3 (July 2010) : Error robustness added. +* [Deepa Nagendra]. +* @version 0.4 (Aug 2010) : Debug trace implementation. +* [Deepa Nagendra]. +* @version 0.5 (Aug 2010) : Error Concealment support. +* [Deepa Nagendra]. +* @version 0.6 (Dec 2011) : Default structures are exposed in interface file +* and macros are differenciated with codec name. +* [Naidu]. +* @version 0.6 (July 2012) : Added extended error codes for errors incase +* referenceframe is not available while decoding +* after flush and SEEK [Naidu]. +* @version 0.7 (May 2013) : eFrameErrorConcealment structure is differenciated +* with codec name [Naidu] +******************************************************************************** +*/ +/* ---------------------- compilation control switches ---------------------- */ + +#ifndef _IMPEG2VDEC_ +#define _IMPEG2VDEC_ + + +/******************************************************************************* +* INCLUDE FILES +*******************************************************************************/ +/* ---------------------- system and platform files ------------------------- */ +#include +#include +#include +#include +#include +/* --------------------------- program files -------------------------------- */ + +/******************************************************************************* +* PUBLIC DECLARATIONS Defined here, used elsewhere +*******************************************************************************/ +/*-----------------------data declarations -----------------------------------*/ + + +/******************************************************************************* +* PRIVATE DECLARATIONS Defined here, used only here +*******************************************************************************/ +/*-----------------------data declarations -----------------------------------*/ + +/*-----------------------function prototypes ---------------------------------*/ + +/** +******************************************************************************** +* @struct IMPEG2VDEC_Obj +* +* @brief This structure must be the first field of all Mpeg2vdec instance +* objects +* +* @param fxns : Handle to extented mpeg2 video decoder library +* interface functions +* +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_Obj { + struct IMPEG2VDEC_Fxns *fxns; +} IMPEG2VDEC_Obj; + +/** +******************************************************************************** +* @struct IMPEG2VDEC_Handle +* +* @brief This handle is used to reference all Mpeg2vdec instance objects +* +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_Obj *IMPEG2VDEC_Handle; + +/** +******************************************************************************** +* @struct IMPEG2VDEC_Status +* +* @brief Status structure defines the parameters that can be changed or +* read during real-time operation of the alogrithm. +* +* @param viddecStatus : Handle to base class status struture which +* defines the all run time parameters. +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_Status { + IVIDDEC3_Status viddecStatus; + /* Extended Error Code0 returned by decoder */ + XDAS_UInt32 extendedErrorCode0; + /* Extended Error Code1 returned by decoder */ + XDAS_UInt32 extendedErrorCode1; + /* Extended Error Code2 returned by decoder */ + XDAS_UInt32 extendedErrorCode2; + /* Extended Error Code3 returned by decoder */ + XDAS_UInt32 extendedErrorCode3; + + XDAS_UInt32 debugTraceLevel; + + XDAS_UInt32 lastNFramesToLog; + + XDAS_UInt32 *extMemoryDebugTraceAddr; + + XDAS_UInt32 extMemoryDebugTraceSize; + +} IMPEG2VDEC_Status; + +/** +* @brief The Cmd enumeration defines the control commands for the MPEG2 +* video decoder control method. +*/ +typedef IVIDDEC3_Cmd IMPEG2VDEC_Cmd; + +/** +******************************************************************************** +* @struct IMPEG2VDEC_Params +* +* @brief This structure defines the creation parameters for all +* mpeg2VDEC objects +* +* @param viddecParams : Defines the creation time parameters for +* all IVIDDEC1 instance objects. +* +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_Params { + + IVIDDEC3_Params viddecParams; + XDAS_Int32 ErrorConcealmentON; + XDAS_Int32 outloopDeBlocking; + + /*--------------------------------------------------------------------------*/ + /*Debug trace Level */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 debugTraceLevel; + + /*--------------------------------------------------------------------------*/ + /*History of last N frames */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 lastNFramesToLog; + +} IMPEG2VDEC_Params; + +/** +******************************************************************************** +* @struct IMPEG2VDEC_DynamicParams +* +* @brief This structure defines the run time parameters for all +* Mpeg2vdec objects +* +* @param viddecDynamicParams : Defines the run time parameters for +* all IVIDDEC3 instance objects. +* +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_DynamicParams { + /*Base class Parameters*/ + IVIDDEC3_DynamicParams viddecDynamicParams; + + /*--------------------------------------------------------------------------*/ + /* gotoNextIFrame : If enabled, during process call skips decoding of all */ + /* non I frames. Enable seekFrameEnd to get the bytes */ + /* consumed for each non I frame */ + /*--------------------------------------------------------------------------*/ + XDAS_Int32 gotoNextIFrame; + /*--------------------------------------------------------------------------*/ + /* skipBFrame : If enabled, skips decoding of all B frames. */ + /* Enable seekFrameEnd to get the bytes consumed for the */ + /* B-frames */ + /*--------------------------------------------------------------------------*/ + XDAS_Int32 skipBFrame; + /*--------------------------------------------------------------------------*/ + /* skipCurrFrame : If enabled, skips decoding of current frame */ + /* Enable seekFrameEnd to get the bytes consumed for the */ + /* Current frame */ + /*--------------------------------------------------------------------------*/ + XDAS_Int32 skipCurrFrame; + /*--------------------------------------------------------------------------*/ + /* seekFrameEnd : If enabled along with any SkipFrame option, prcoess call */ + /* returns the bytesconsumed for the frame w/o decoding the */ + /* frame */ + /*--------------------------------------------------------------------------*/ + XDAS_Int32 seekFrameEnd; + +} IMPEG2VDEC_DynamicParams; + +/** +******************************************************************************** +* @struct IMPEG2VDEC_InArgs +* +* @brief This structure defines the runtime input arguments for all VIDDEC +* objects. +* +* @param viddecInArgs : Defines the input arguments for all IVIDDEC3 +* instance process function. +* +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_InArgs { + + IVIDDEC3_InArgs viddecInArgs; + +}IMPEG2VDEC_InArgs; + +/** +******************************************************************************** +* @struct IMPEG2VDEC_OutArgs +* +* @brief This structure defines the run time output arguments for VIDDEC +* objects. +* +* @param viddecOutArgs : Defines the output arguments for all IVIDDEC3 +* instance process function. +* +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_OutArgs { + IVIDDEC3_OutArgs viddecOutArgs; +}IMPEG2VDEC_OutArgs; + +/** +******************************************************************************** +* @struct IMPEG2VDEC_Fxns +* +* @brief This structure defines all of the operations on Mpeg2vdec objects. +* +* @param ividdec : handle to the all function of the operations on +* IVIDDEC3 objects +* +******************************************************************************** +*/ +typedef struct IMPEG2VDEC_Fxns { + IVIDDEC3_Fxns ividdec; +} IMPEG2VDEC_Fxns; + +/** + * Error concealment can be enabled or disabled through create time parameter. +*/ +typedef enum { + IMPEG2VDEC_EC_DISABLE = 0, + IMPEG2VDEC_EC_ENABLE +} IMPEG2VDEC_FrameErrorConcealment; + + +/** + * Flag to deblock enable + */ +#define IMPEG2VDEC_DEBLOCK_ENABLE (1) + +/** + * Flag to deblock disable + */ +#define IMPEG2VDEC_DEBLOCK_DISABLE (0) + +/** +* Number of MemTab required if Deblock is Off +*/ +#define IMPEG2VDEC_NUM_MEMTABS_DEBLOCK_OFF (0) + +/** +* Number of memtab required if deblock is on and it will be maximum +* resource required by codec +*/ +#define IMPEG2VDEC_NUM_MEMTABS_DEBLOCK_ON (6) + +/** + * The error codes correspond to the 32-bit extended error parameter passed + * through outargs and get sttus. The error have been categorised to the below + * 32 groups and the respective bit is set on error occurrence. + */ +typedef enum { + IMPEG2VDEC_ERR_UNSUPPORTED_VIDDEC3PARAMS = 0, + IMPEG2VDEC_ERR_UNSUPPORTED_VIDDEC3DYNAMICPARAMS, + IMPEG2VDEC_ERR_UNSUPPORTED_MPEG2DECDYNAMICPARAMS, + IMPEG2VDEC_ERR_IMPROPER_DATASYNC_SETTING, + + IMPEG2VDEC_ERR_NOSLICE, + IMPEG2VDEC_ERR_SLICEHDR, + IMPEG2VDEC_ERR_MBDATA, + IMPEG2VDEC_ERR_UNSUPPFEATURE, + + IMPEG2VDEC_ERR_STREAM_END = 16, + IMPEG2VDEC_ERR_UNSUPPRESOLUTION, + IMPEG2VDEC_ERR_STANDBY, + IMPEG2VDEC_ERR_INVALID_MBOX_MESSAGE, + + IMPEG2VDEC_ERR_HDVICP_RESET, + IMPEG2VDEC_ERR_HDVICP_WAIT_NOT_CLEAN_EXIT, + IMPEG2VDEC_ERR_SEQHDR, + IMPEG2VDEC_ERR_GOP_PICHDR, + + IMPEG2VDEC_ERR_SEQLVL_EXTN, + IMPEG2VDEC_ERR_PICLVL_EXTN, + IMPEG2VDEC_ERR_TRICK_MODE, + IMPEG2VDEC_ERR_PICSIZECHANGE, + + IMPEG2VDEC_ERR_SEMANTIC, + IMPEG2VDEC_ERR_DECODE_EXIT, + IMPEG2VDEC_ERR_IRES_RESHANDLE, + IMPEG2VDEC_ERR_IRES_RESDESC + +}IMPEG2VDEC_ExtendedErrorCodes; + +/** + * The enum corresponds to the 4 32-bit words used to pass the error codes to + * the application in the extended parameters of status stucture through the + * getstatus command. Each bit is set for an error which falls under one of + * the groups in the outargs 32 bvits. + */ +typedef enum { + MPEG2_ECD_ILLEGAL_EOM=0, + MPEG2_ECD_ILLEGAL_EOB, + MPEG2_ECD_ILLEGAL_MP1_ESCAPE_LVL, + MPEG2_ECD_ILLEGAL_MP2_ESCAPE_LVL, + + MPEG2_ECD_ILLEGAL_MARKER_CONCEAL, + MPEG2_ECD_ILLEGAL_MBTYPE_D_PIC, + MPEG2_ECD_ILLEGAL_DCT_COEFF, + MPEG2_ECD_ILLEGAL_CBP, + + MPEG2_ECD_ILLEGAL_MOTION_CODE, + MPEG2_ECD_ILLEGAL_MB_TYPE, + MPEG2_ECD_ILLEGAL_MB_ADDR_INCR, + MPEG2_ECD_ILLEGAL_EOS, + + MPEG2_ECD_ILLEGAL_QUANT_SCALE_CODE, + MPEG2_ECD_ILLEGAL_SLICE_START_POS, + MPEG2_ECD_ILLEGAL_START_CODE_SEARCH, + MPEG2_ECD_ILLEGAL_DC_COEFF_OVFL, + + MPEG2_DYNAMIC_PARAMS_HANDLE_ERROR, + MPEG2_STATUS_HANDLE_ERROR, + MPEG2_DYNAMIC_PARAMS_SIZE_ERROR, + MPEG2_STATUS_SIZE_ERROR, + + MPEG2_DECODE_HEADER_ERROR, + MPEG2_DISPLAY_WIDTH_ERROR, + MPEG2_FRAME_SKIP_MODE_ERROR, + MPEG2_NEW_FRAME_FLAG_ERROR, + + MPEG2_GOTO_IFRAME_ERROR, + MPEG2_SKIP_BFRAME_ERROR, + MPEG2_SKIP_CURRENTFRAME_ERROR, + MPEG2_SEEK_FRAMEEND_ERROR, + + MPEG2_NULL_STATUS_DATA_BUF, + MPEG2_INSUFFICIENT_STATUS_DATA_BUF, + MPEG2_NULL_INARGS_POINTER_ERROR, + MPEG2_INARGS_SIZE_ERROR, + + MPEG2_INVALID_INPUT_BYTES_ERROR, + MPEG2_INVALID_INPUT_ID_ERROR, + MPEG2_DECODER_NOT_INITIALIZED_ERROR, + MPEG2_NULL_INPUT_BUF_DESC_ERROR, + + MPEG2_NULL_INPUT_BUFFER_POINTER_ERROR, + MPEG2_INVALID_INPUT_BUFFER_SIZE_ERROR, + MPEG2_INVALID_NUM_OF_INPUT_BUFFERS_ERROR, + MPEG2_EXCESS_NUM_OF_INPUT_BUFFERS_ERROR, + + MPEG2_INVALID_INPUT_BUFFER_MEMTYPE_ERROR, + MPEG2_NULL_OUTARGS_POINTER_ERROR, + MPEG2_INVALID_OUTARGS_SIZE, + MPEG2_NULL_OUTPUT_BUF_DESC_POINTER_ERROR, + + MPEG2_NULL_OUTPUT_BUF_DESC_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER0_POINTER_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER0_SIZE_ERROR, + MPEG2_INVALID_NUM_OF_OUTPUT_BUFFERS_ERROR, + + MPEG2_INVALID_OUTPUT_BUFFER0_MEMTYPE_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER0_ALIGNMENT_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER1_POINTER_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER1_SIZE_ERROR, + + MPEG2_INVALID_OUTPUT_BUFFER1_MEMTYPE_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER1_ALIGNMENT_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER2_POINTER_ERROR, + MPEG2_INVALID_OUTPUT_BUFFER2_SIZE_ERROR, + + MPEG2_INVALID_OUTPUT_BUFFER2_MEMTYPE_ERROR, + MPEG2_INVALID_BUFFER_USAGE_MODE, + MPEG2_SEQ_HDR_INVALID_FRAME_WIDTH, + MPEG2_SEQ_HDR_INVALID_FRAME_HEIGHT, + + MPEG2_SEQ_HDR_INVALID_ASPECT_RATIO, + MPEG2_SEQ_HDR_INVALID_FRAME_RATE_CODE, + MPEG2_INVALID_INTRA_QUANT_MAT, + MPEG2_INVALID_NON_INTRA_QUANT_MAT, + + MPEG2_SEQ_HDR_INVALID_INTRA_ESCAPE_BIT, + MPEG2_SEQ_HDR_INVALID_PROFILE, + MPEG2_SEQ_HDR_INVALID_LEVEL, + MPEG2_SEQ_HDR_INVALID_RESOLUTION_FORLVL, + + MPEG2_SEQ_HDR_INVALID_CHROMA_FORMAT, + MPEG2_SEQ_HDR_INVALID_LOW_DELAY, + MPEG2_SEQ_DSP_INVALID_VIDEO_FORMAT, + MPEG2_SEQ_DSP_INVALID_COLOUR_PRIM, + + MPEG2_SEQ_DSP_INVALID_TRF_CHARS, + MPEG2_SEQ_DSP_INVALID_MAT_COEFFS, + MPEG2_GOP_HDR_INVALID_DROP_FLAG, + MPEG2_GOP_HDR_INVALID_HOUR, + + MPEG2_GOP_HDR_INVALID_MIN, + MPEG2_GOP_HDR_INVALID_SEC, + MPEG2_GOP_HDR_INVALID_TIME_CODE_PICTURES, + MPEG2_GOP_HDR_INVALID_BROKEN_LINK, + + MPEG2_PIC_HDR_INVALID_TEMP_REF, + MPEG2_PIC_HDR_INVALID_PIC_TYPE, + MPEG2_PIC_HDR_INVALID_VBV_DELAY, + MPEG1_PIC_HDR_INVALID_FWD_FCODE, + + MPEG1_PIC_HDR_INVALID_BWD_FCODE, + MPEG2_PIC_HDR_INVALID_FCODE, + MPEG2_PIC_HDR_INVALID_PIC_STRUCTURE, + MPEG2_PIC_HDR_INVALID_FIELD_COMB, + + MPEG2_PIC_HDR_INVALID_TFF, + MPEG2_PIC_HDR_INVALID_FPFD, + MPEG2_PIC_HDR_INVALID_RFF, + MPEG2_PIC_HDR_INVALID_PROG_FLAG, + + MPEG2_QUANT_EXT_INVALID_LOAD_CHROMA_INTRA_FLAG, + MPEG2_QUANT_EXT_INVALID_LOAD_CHROMA_NON_INTRA_FLAG, + MPEG2_INVALID_EXTN_CODE, + MPEG2_SEQ_HDR_MISSING, + + MPEG2_NO_PICTURE_ENCODED_ERROR, + MPEG2_SEQ_EXT_MISSING, + MPEG2_PIC_CODING_EXT_MISSING, + MPEG2_SEQ_DISP_EXT_MISSING, + + MPEG2_GOP_FIRST_FRAME_NOT_I, + MPEG2_SCALABILITY_NOT_SUPPORTED, + MPEG2_END_OF_SEQ_DETECTED, + MPEG2_PIC_HDR_RFF_FRAME_RATE_MISMATCH, + + MPEG2_PIC_HDR_INVALID_DC_PRECISION, + MPEG2_INVALID_FRAME_RATE, + MPEG2_INVALID_BIT_RATE, + MPEG2_FRAME_SKIPPED, + + MPEG2_REF_FRAME_SKIPPED, + MPEG2_NO_REF_TO_FLUSH, + MPEG2_EXCESS_INPUT_BYTES, + MPEG2_ALL_MBS_NOT_DECODED, + + MPEG2_NO_REF_PFRAME, + MPEG2_NO_REF_BFRAME + +}Impeg2VDEC_ErrorStatus; + +/* + * ======== IMPEG2VDEC_PARAMS ======== + * Default parameter values for MPEG2VDEC instance objects + */ +extern const IMPEG2VDEC_Params MPEG2VDEC_TI_Static_Params; +/* + * ======== IMPEG2VDEC_IVDEC_DYNAMICPARAMS ======== + * Default dynamic parameter values for MPEG2VDEC instance objects + */ +extern const IMPEG2VDEC_DynamicParams MPEG2VDEC_TI_DynamicParams; +/* ------------------------ function prototypes ----------------------------- */ +/******************************************************************************* +* PRIVATE DECLARATIONS Defined here, used only here +*******************************************************************************/ +/* ------------------------ data declarations ------------------------------- */ +/* ----------------------- function prototypes ------------------------------ */ + +/* ------------------------------ macros ------------------------------------ */ +/*----------------------------------------------------------------------------*/ +/* Extending control method commands */ +/*----------------------------------------------------------------------------*/ +#define IMPEG2VDEC_GETSTATUS XDM_GETSTATUS +#define IMPEG2VDEC_SETPARAMS XDM_SETPARAMS +#define IMPEG2VDEC_RESET XDM_RESET +#define IMPEG2VDEC_FLUSH XDM_FLUSH +#define IMPEG2VDEC_SETDEFAULT XDM_SETDEFAULT +#define IMPEG2VDEC_GETBUFINFO XDM_GETBUFINFO +#define IMPEG2VDEC_GETVERSION XDM_GETVERSION +#define IMPEG2VDEC_GETCONTEXTINFO XDM_GETCONTEXTINFO +#define IMPEG2VDEC_GETDYNPARAMSDEFAULT XDM_GETDYNPARAMSDEFAULT + +#endif /* __IMPEG2VDEC__ */ + diff --git a/packages/ivahd_codecs/ti/sdo/codecs/mpeg4enc/impeg4enc.h b/packages/ivahd_codecs/ti/sdo/codecs/mpeg4enc/impeg4enc.h new file mode 100644 index 0000000..b53daad --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/mpeg4enc/impeg4enc.h @@ -0,0 +1,1275 @@ +/* +******************************************************************************** + * HDVICP2.0 Based MPEG4 SP Encoder + * + * "HDVICP2.0 Based MPEG4 SP Encoder" is software module developed on TI's + * HDVICP2 based SOCs. This module is capable of compressing a 4:2:0 Raw + * video into a simple profile bit-stream. Based on ISO/IEC 14496-2." + * + * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ + * ALL RIGHTS RESERVED +******************************************************************************** +*/ +/** +******************************************************************************** + * @file + * + * @brief Interface header file for MPEG4 SP Encoder + * + * @author: Venugopala Krishna + * + * @version 0.0 (Feb 2009) : Initial version. + * [Venugopala Krishna] + * @version 0.1 (Apr 2009) : Updated version. + * [Radhesh Bhat] + * @version 0.2 (April 2013) : Enum added for create time param - + * insertGOVHdrBeforeIframe - to support VOL + * encoding for every I-frame [Mahantesh] + ******************************************************************************* +*/ + +/* -------------------- compilation control switches -------------------------*/ +#ifndef IMPEG4ENC_ +#define IMPEG4ENC_ + +/** + * @defgroup HDVICP2MPEG4 IMPEG4ENC_TI (V7M) + * @ingroup m3 + * + * The IMPEG4ENC_TI interface enables encoding in MPEG-4 format + * + */ + +/** @ingroup HDVICP2MPEG4 */ +/*@{*/ + +/*-------------------------------------------*/ +/* typecasting of control method commands */ +/*-------------------------------------------*/ +#define IMPEG4ENC_GETSTATUS XDM_GETSTATUS +#define IMPEG4ENC_SETPARAMS XDM_SETPARAMS +#define IMPEG4ENC_RESET XDM_RESET +#define IMPEG4ENC_FLUSH XDM_FLUSH +#define IMPEG4ENC_SETDEFAULT XDM_SETDEFAULT +#define IMPEG4ENC_GETBUFINFO XDM_GETBUFINFO + +/** +* MPEG4 Simple profile IDC +*/ +#define MPEG4_SIMPLE_PROFILE_IDC 3 + +/******************************************************************************* +* INCLUDE FILES +*******************************************************************************/ +/* -------------------- system and platform files ----------------------------*/ + +/*--------------------- program files ----------------------------------------*/ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* +* PUBLIC DECLARATIONS Defined here, used elsewhere +*******************************************************************************/ +/*---------------------- data declarations -----------------------------------*/ + +/******************************************************************************* +* PRIVATE DECLARATIONS Defined here, used only here +*******************************************************************************/ +/*---------------------- data declarations -----------------------------------*/ +/*---------------------- function prototypes ---------------------------------*/ + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_ErrorBit + * @brief error informations of IVAHD MPEG4 encoder implementation by TI. + * + * @remarks When an internal error occurs, the algorithm will return + * an error return value (e.g. EFAIL, EUNSUPPORTED) + * + * @remarks The value of each enum is the bit which is set. + * + * @remarks Bits 8-15 are defined by XDM and hence not used by codec + * implementation. rest all bits are used. + * XDM defined error bits are also active. + * + * @remarks The algorithm can set multiple bits to 1 based on conditions. + * e.g. it will set bits #XDM_FATALERROR (fatal) and + * #XDM_UNSUPPORTEDPARAM (unsupported params) in case + * of unsupported run time parameters. + * + ******************************************************************************* +*/ +typedef enum { + IMPEG4ENC_LEVEL_INCOMPLAINT_PARAMETER = 0, + /**< Bit 0 - level incomplaint parameters. + * @remarks This error is applicable when some parameters are set + * which are not meeting the limits set by MPEG4 standard + */ + + IMPEG4ENC_PROFILE_INCOMPLAINT_CONTENTTYPE = 1, + /**< Bit 1 - Profile incomplaint content type. + * @remarks This error is applicable when + * IVIDENC2_Params::inputContentType is not set as + * IVIDEO_PROGRESSIVE but IVIDENC2_Params::profile is set + * as IMPEG4_SIPPLE_PROFILE + */ + + IMPEG4ENC_IMPROPER_HDVICP2_STATE = 16, + /**< Bit 16 - Device is not proper state to use. + */ + + IMPEG4ENC_WARNING_H263_PLUS_CUSTOM_SOURCE_FORMAT = 17, + /**< Bit 17 - Indication that the input resolution given to codec + * is custom source format supported in H.263+ not the + * standard resolutions supported with H263 baseline or + * MPEG4 with short video header. + */ + + IMPEG4ENC_ERROR_BITSTREAM_MEMORY_INSUFFICIENT = 18, + /**< Bit 18 - Indication that the buffer given to codec from + * getBuffer function is insufficient so that codec + * cannot continue encoding. It means that if return value + * from getBuffer function is -1, then this bit gets set + * by the codec. This is the situation where application + * might not be able to provide memory to codec. + */ + + IMPEG4ENC_IMPROPER_DATASYNC_SETTING = 19, + /**< Bit 19 - data synch settings are not proper + * @remarks This error is set when encoder is asked to operate + * at sub frame level but the call back function pointer + * is NULL + */ + + IMPEG4ENC_UNSUPPORTED_VIDENC2PARAMS = 20, + /**< Bit 20 - Invalid videnc2 parameters + * @remarks This error is set when any parameter of struct + * IVIDENC2_Params is not in allowed range + */ + + IMPEG4ENC_UNSUPPORTED_RATECONTROLPARAMS = 21, + /**< Bit 21 - Invalid rate control parameters + * @remarks This error is set when any parameter of struct + * IMPEG4ENC_RateControlParams is not in allowed range + */ + + IMPEG4ENC_UNSUPPORTED_INTERCODINGPARAMS = 22, + /**< Bit 22 - Invalid inter coding parameters + * @remarks This error is set when any parameter of struct + * IMPEG4ENC_InterCodingParams is not in allowed range + */ + + IMPEG4ENC_UNSUPPORTED_INTRACODINGPARAMS = 23, + /**< Bit 23 - Invalid Intra coding parameters + * @remarks This error is set when any parameter of struct + * IMPEG4ENC_IntraCodingParams is not in allowed range + */ + + IMPEG4ENC_UNSUPPORTED_SLICECODINGPARAMS = 25, + /**< Bit 25 - Invalid slice coding parameters + * @remarks This error is set when any parameter of struct + * IMPEG4ENC_SliceControlParams is not in allowed range + */ + + IMPEG4ENC_UNSUPPORTED_MPEG4ENCPARAMS = 29, + /**< Bit 29 - Invalid Create time extended parameters + * @remarks This error is set when any parameter of struct + * IMPEG4ENC_CreateParams is not in allowed range + */ + + IMPEG4ENC_UNSUPPORTED_VIDENC2DYNAMICPARAMS = 30, + /**< Bit 30 - Invalid base class dyanmic parameters during control + * @remarks This error is set when any parameter of struct + * IVIDENC2_DynamicParams is not in allowed range + */ + + IMPEG4ENC_UNSUPPORTED_MPEG4ENCDYNAMICPARAMS = 31 + /**< Bit 31 -Invalid extended class dyanmic parameters during control + * @remarks This error is set when any parameter of struct + * IMPEG4ENC_DynamicParams (excluding embedded structures) + * is not in allowed range + */ + +} IMPEG4ENC_ErrorBit; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_Level + * @brief Enum for MPEG-4 Simple profile levels + * + * @remarks allowed levels are 0, 0b, 1, 2, 3, 4a & 5 + * + ******************************************************************************* +*/ +typedef enum { + IMPEG4ENC_SP_LEVEL_0 = 0, /**< MPEG4 Simple Profile Level 0 */ + + IMPEG4ENC_SP_LEVEL_0B = 9, /**< MPEG4 Simple Profile Level 0b*/ + + IMPEG4ENC_SP_LEVEL_1 = 1, /**< MPEG4 Simple Profile Level 1 */ + + IMPEG4ENC_SP_LEVEL_2 = 2, /**< MPEG4 Simple Profile Level 2 */ + + IMPEG4ENC_SP_LEVEL_3 = 3, /**< MPEG4 Simple Profile Level 3 */ + + IMPEG4ENC_SP_LEVEL_4A = 4, /**< MPEG4 Simple Profile Level 4a*/ + + IMPEG4ENC_SP_LEVEL_5 = 5, /**< MPEG4 Simple Profile Level 5 */ + + IMPEG4ENC_SP_LEVEL_6 = 6 /**< MPEG4 Simple Profile Level 6 */ + +} IMPEG4ENC_Level; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_H263Level + * @brief Enum for H.263 base profile levels + * + * @remarks allowed levels are 10,20,30,40, 45, 50, 60 and 70 + * + ******************************************************************************* +*/ +typedef enum { + IMPEG4ENC_H263_LEVEL_10 = 10, /**< H263 Baseline Profile Level 10 */ + + IMPEG4ENC_H263_LEVEL_20 = 20, /**< H263 Baseline Profile Level 20 */ + + IMPEG4ENC_H263_LEVEL_30 = 30, /**< H263 Baseline Profile Level 30 */ + + IMPEG4ENC_H263_LEVEL_40 = 40, /**< H263 Baseline Profile Level 40 */ + + IMPEG4ENC_H263_LEVEL_45 = 45, /**< H263 Baseline Profile Level 45 */ + + IMPEG4ENC_H263_LEVEL_50 = 50, /**< H263 Baseline Profile Level 50 */ + + IMPEG4ENC_H263_LEVEL_60 = 60, /**< H263 Baseline Profile Level 60 */ + + IMPEG4ENC_H263_LEVEL_70 = 70 /**< H263 Baseline Profile Level 70 */ +} IMPEG4ENC_H263Level; + +/** + ******************************************************************************* + * @enum IMPEG4ENC_PixelRange + * @brief pixel/video range enum + * + * @remarks + * + ******************************************************************************* +*/ + +typedef enum { + /** + * Y varies from 16 to 235 and Cb/Cr varies from 16 to 240 + */ + IMPEG4ENC_PR_16_235 = 0, + + /** + * Y/Cb/Cr varies from 0 to 255 + */ + IMPEG4ENC_PR_0_255 = 1, + + IMPEG4ENC_PR_DEFAULT = IMPEG4ENC_PR_0_255 + +} IMPEG4ENC_PixelRange; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_SceneChangeAlgo + * @brief Enum for enabling or disabling scene change detection algo + * + * @remarks + * + ******************************************************************************* +*/ + +typedef enum { + /** + * Disables the scene change detection algorithm + */ + IMPEG4ENC_SCDA_DISABLE = 0, + + /** + * Enables the scene change detection algorithm + */ + IMPEG4ENC_SCDA_ENABLE = 1, + + IMPEG4ENC_SCDA_DEFAULT = IMPEG4ENC_SCDA_ENABLE + +} IMPEG4ENC_SceneChangeAlgo; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_RateControlParamsPreset + * @brief These enumerations control the RateControl Params + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + IMPEG4_RATECONTROLPARAMS_DEFAULT = 0, /**< Default RC params */ + + IMPEG4_RATECONTROLPARAMS_USERDEFINED = 1, /**< User defined RC params*/ + + /** + * Keep the Rate Control params as existing. + * This is useful because during control call if user don't want to chnage + * the Rate Control Params + */ + IMPEG4_RATECONTROLPARAMS_EXISTING = 2, + + + IMPEG4_RATECONTROLPARAMS_MAX + +} IMPEG4ENC_RateControlParamsPreset; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_RateControlAlgoPreset + * @brief These enumerations control the RateControl Algorithm + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + /** + * Fixed QP + */ + IMPEG4_RATECONTROLALGO_NONE = 0, + + /** + * VBR Rate Control Algorithm + */ + IMPEG4_RATECONTROLALGO_VBR = 1, + + /** + * CBR Rate Control Algorithm -- Low Delay + */ + IMPEG4_RATECONTROLALGO_CBR = 2, + + IMPEG4_RATECONTROLALGO_MAX + +} IMPEG4ENC_RateControlAlgoPreset; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_InterCodingPreset + * @brief These enumerations control the type of inter coding + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + + /** + * Default Inter coding params + */ + + IMPEG4_INTERCODING_DEFAULT = 0, + + /** + * User defined inter coding params + */ + IMPEG4_INTERCODING_USERDEFINED = 1, + + + /** + * Keep the inter coding params as existing + */ + IMPEG4_INTERCODING_EXISTING = 2, + + IMPEG4_INTERCODING_MAX + +} IMPEG4ENC_InterCodingPreset; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_InterBlockSize + * @brief These enumerations control the block size of each MB in encoding + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + /** + * 16x16 Block size + */ + IMPEG4_BLOCKSIZE_16x16 = 0, + + /** + * 8x8 Block size + */ + IMPEG4_BLOCKSIZE_8x8 = 1, + + /** + * Default block size + */ + IMPEG4_BLOCKSIZE_DEFAULT = IMPEG4_BLOCKSIZE_8x8, + + IMPEG4_BLOCKSIZE_MAX = 2 + +} IMPEG4ENC_InterBlockSize; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_IntraRefreshMethods + * @brief Refresh method Type Identifier for MPEG4 Encoder + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + + /** + * Doesn't insert forcefully any intra macro blocks + */ + IMPEG4_INTRAREFRESH_NONE = 0, + /** + * Inserts intra macro blocks in a cyclic fashion + * cyclic interval is equal to intraRefreshRate + */ + IMPEG4_INTRAREFRESH_CYCLIC_MBS, + + /** + * Inserts Intra Rows in a cyclic fashion + * Number of Rows equal to intraRefreshRate + */ + IMPEG4_INTRAREFRESH_CYCLIC_ROWS, + + /** + * Mandatory Intra Refresh -- evenly distributes number of INTRA MBs over + * frames. + */ + IMPEG4_INTRAREFRESH_MANDATORY, + + /** + * position of intra macro blocks is intelligently chosen by encoder, but the + * number of forcely coded intra macro blocks in a frame is gaurnteed to be + * equal to totalMbsInFrame/intraRefreshRate. + * This method is not implemented currently. + */ + IMPEG4_INTRAREFRESH_RDOPT_MBS + +} IMPEG4ENC_IntraRefreshMethods; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_IntraCodingPreset + * @brief These enumerations control the type of intra coding + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + /** + * Default intra coding params + */ + IMPEG4_INTRACODING_DEFAULT = 0, + + /** + * User defined intra coding params + */ + IMPEG4_INTRACODING_USERDEFINED = 1, + IMPEG4_INTRACODING_MAX + +} IMPEG4ENC_IntraCodingPreset; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_SliceCodingPreset + * @brief These enumerations control the type of slice coding + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + /** + * Default slice coding params + */ + IMPEG4_SLICECODING_DEFAULT = 0, + + /** + * User defined slicecoding params + */ + IMPEG4_SLICECODING_USERDEFINED = 1, + + /** + * Keep the slice coding params as existing + * This is useful because during control call if user don't want to chnage + * the sliceCodingParams + */ + IMPEG4_SLICECODING_EXISTING = 2, + IMPEG4_SLICECODING_MAX + +} IMPEG4ENC_SliceCodingPreset; + + +/** + ******************************************************************************* + * @enum IMPEG4ENC_SliceMode + * @brief These enumerations control the mode of slice coding + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + IMPEG4_SLICEMODE_NONE = 0, + + /** + * Default slice coding mode is MB based + */ + IMPEG4_SLICEMODE_DEFAULT = IMPEG4_SLICEMODE_NONE, + + /** + * Slices are controlled based upon number of Macroblocks + */ + IMPEG4_SLICEMODE_MBUNIT = 1, + + /** + * Slices are controlled based upon number of bits consumed + */ + IMPEG4_SLICEMODE_BITS = 2, + IMPEG4_SLICEMODE_MAX + +} IMPEG4ENC_SliceMode; + +/** + ******************************************************************************* + * @enum IMPEG4ENC_nonMultiple16RefPadMethod + * @brief These enumerations captures different methods of padding the Ref + * frame when dimension is non multiple of 16. + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + /** + * Method as suggested by DivX spec. + */ + IMPEG4_PAD_METHOD_DIVX = 0, + + /** + * Method as suggested by MPEG4 spec. + */ + IMPEG4_PAD_METHOD_MPEG4 = 1, + + /** + * Default mode is MPEG4 suggested way. + */ + IMPEG4_PAD_METHOD_DEFAULT = IMPEG4_PAD_METHOD_MPEG4, + IMPEG4_PAD_METHOD_MAX + +} IMPEG4ENC_nonMultiple16RefPadMethod; + + +/** + + @enum IMPEG4ENC_AspectRatioIdc + @brief Defines aspect ratio IDs + +*/ +typedef enum { + IMPEG4ENC_ASPECTRATIO_SQUARE = 1, /**< 1:1 (square) aspect ratio */ + IMPEG4ENC_ASPECTRATIO_12_11, /**< 12:11 aspect ratio */ + IMPEG4ENC_ASPECTRATIO_10_11, /**< 10:11 aspect ratio */ + IMPEG4ENC_ASPECTRATIO_16_11, /**< 16:11 aspect ratio */ + IMPEG4ENC_ASPECTRATIO_40_33, /**< 40:33 aspect ratio */ + IMPEG4ENC_ASPECTRATIO_EXTENDED = 15 /**< Extended aspect ratio */ + +} IMPEG4ENC_AspectRatioIdc; + +/** + ******************************************************************************* + * @enum IMPEG4ENC_InsertGOVHdrBeforeIframe + * @brief These enumerations capture encoding of GOV and VOL for every I-frame + * + * @remarks + * + ******************************************************************************* +*/ +typedef enum { + /** + * GOV and VOL are not encoded for every I-frame. Default + */ + IMPEG4_NO_GOV_NO_VOL = 0, + + /** + * Only GOV is encoded for every I-frame + */ + IMPEG4_ENCODE_GOV_ONLY = 1, + + /** + * Only VOL is encoded for every I-frame + */ + IMPEG4_ENCODE_VOL_ONLY = 2, + + /** + * Both GOV and VOL are encoded for every I-frame + */ + IMPEG4_ENCODE_VOL_AND_GOV = 3 + +} IMPEG4ENC_InsertGOVHdrBeforeIframe; +/** + ******************************************************************************* + * @struct IMPEG4ENC_Cmd + * @brief This structure defines the control commands for the IMP4VENC module + * + ******************************************************************************* +*/ +typedef IVIDENC2_Cmd IMPEG4ENC_Cmd; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_Obj + * @brief This structure must be the first field of all MPEG4ENC instance + * objects + * + * @param fxns - is a pointer to IMPEG4ENC_Fxns structure which includes the + * below function pointers + * IALG_Fxns + * Void algActivate(IALG_Handle handle) + * Int algAlloc(const IALG_Params *params, + * struct IALG_Fxns **parentFxns, IALG_MemRec *memTab) + * Void algControl(IALG_Handle handle, IALG_Cmd cmd, + * IALG_Status *status) + * Void algDeactivate(IALG_Handle handle) + * Int algFree(IALG_Handle handle, IALG_MemRec *memTab) + * Int algInit(IALG_Handle handle, const IALG_MemRec *memTab, + * IALG_Handle parent, const IALG_Params *params) + * Void algMoved(IALG_Handle handle, const IALG_MemRec *memTab, + * IALG_Handle parent, const IALG_Params *params) + * Int algNumAlloc(Void) + * + * XDAS_Int32 process(IVIDENC2_Handle handle, IVIDEO2_BufDesc *inBufs, + * XDM2_BufDesc *outBufs, IVIDENC2_InArgs *inArgs, + * IVIDENC2_OutArgs *outArgs) + * + * XDAS_Int32 control(IVIDENC2_Handle handle, IVIDENC2_Cmd id, + * IVIDENC2_DynamicParams *params, IVIDENC2_Status *status) + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_Obj { + struct IMPEG4ENC_Fxns *fxns; +} IMPEG4ENC_Obj; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_Handle + * @brief This handle is used to reference all MPEG4ENC instance objects + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_Obj *IMPEG4ENC_Handle; + +/** + ******************************************************************************* + * @struct IMPEG4ENC_RateControlParams + * @brief This structure contains all the parameters which controls Rate + * Control behavior + * + * @param rateControlParamsPreset : + * if this is IMPEG4_RATECONTROLPARAMS_DEFAULT the algorithm loads the + * default rate control parameters. + * if this is IMPEG4_RATECONTROLPARAMS_USERDEFINED the algorithm loads + * the user defined rate control parameters. if user is not aware of + * the floowing parameters it should be set to this enumeration. + * if this is IMPEG4_RATECONTROLPARAMS_EXISTING the algorithm loads + * the default rate control parameters. + * + * @param rcAlgo : + * if this is IMPEG4_RATECONTROLALGO_NONE the algorithm uses the fixed + * qpI/qpP depending on the Frame + * if this is IMPEG4_RATECONTROLALGO_PLR the algorithm uses the + * PLR algorithm for QP Selection and bitrate achievement + * + * @param qpI : + * Initial Quantization Parameter for I frames. Valid Range is [1, 31]. + * when rateControlPreset = IVIDEO_NONE, this quantization parameter is + * used by the I frame encoding + * + * @param qpP : + * Initial Quantization Parameter for P frames. Valid Range is [1, 31] + * when rateControlPreset = IVIDEO_NONE, this quantization parameter is + * used by the P frame encoding + * + * @param seIntialQP : + * when rcAlgo is anything other than IMPEG4_RATECONTROLALGO_NONE, + * frame encoding start with seIntialQP value. + * When the user does not have understanding of what to set, set to 0, + * so the Codec internally decides intelligently the initial QP to be + * used. + * + * @param qpMax : + * Maximum Quantization Parameter. Range [1, 31]. Useful to control + * a minimum quality level + * + * @param qpMin : + * Minimum Quantization Parameter. Range [1, 31]. Useful to control + * a maximum bit-rate level + * + * @param enablePerceptualQuantMode : + * perceptual quantization is enabled or diasabled. It varies the Qp at + * MB level instead of row level to improve the perceptual quality of + * video. + * 1 for enable + * 0 for disable + * + * @param allowFrameSkip : + * This enables the Frame Skip Feature looking at the VBV Fullness. + * This should be enabled when Low Delay Mode is enabled. + * 2 for enabling early frame skip + * 1 for enabling late frame skip + * 0 for disabling frame skip + * @param initialBufferLevel : + * Initial buffer level for VBV compliance. It informs that + * hypothetical decoder can start depending on the fullness of the + * VBV buffer. Default value is 0, where codec will internally + * calculate the value based on the RC algo type + * @param vbvBufferSize : + * Virtual Buffer Verifier buffer size. This size controls the frame + * skip logic of the encoder. For low delay applications this size + * should be small. This size is in bits. + * Default value is 0, where codec will internally calculate the + * value based on the RC algo type. + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_RateControlParams { + XDAS_Int32 rateControlParamsPreset; + XDAS_Int32 rcAlgo; + XDAS_Int32 qpI; + XDAS_Int32 qpP; + XDAS_Int32 seIntialQP; + XDAS_Int32 qpMax; + XDAS_Int32 qpMin; + XDAS_Int32 enablePerceptualQuantMode; + XDAS_Int32 allowFrameSkip; + XDAS_Int32 initialBufferLevel; + XDAS_Int32 vbvBufferSize; + XDAS_Int32 qpMinIntra; +} IMPEG4ENC_RateControlParams; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_InterCodingParams + * @brief This structure contains all the parameters which controls Inter MBs + * coding behavior + * + * @param interCodingPreset : + * This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + * not aware about following fields, it should be set as + * IMPEG4_INTERCODING_DEFAULT + * + * @param searchRangeHorP : + * Horizontal Search Range for ME algo, range is [16, 144] + * + * @param searchRangeVerP : + * Vertical Search Range for ME algo, range is [16, 32] + * + * @param globalOffsetME : + * This variable is used to control ME search algorithm to improve + * video quality by doing ME around Temporal average MV. + * 1 for Enable + * 0 for Disable + * + * @param earlySkipThreshold : + * Threshold to use for early skip determination + * The Inter SAD is compared against this Threshold for early skip + * selection + * + * @param enableThresholdingMethod : + * Thresholding cost Method is used by CALC3 suppress expensive + * coefficients.Thresholding cost Method is used to set a block to be + * not_coded if the block has very few small amplitude coeffs. + * + * @param minBlockSizeP : minimum block size for P frames. + * Refer IMPEG4ENC_InterBlockSize enumeration to see the valid values + * if this variable takes value of IMPEG4_BLOCKSIZE_8x8 a MB in P Frame + * can have 4 Motion Vectors one for each 8x8 MB to + * improve video quality (not necessarily). This mode is used only for + * MPEG-4. This Field is neglected or read as Disable for H263 encoding. + * Set + * IMPEG4_BLOCKSIZE_8x8 for 4MV + * else only 1MV + * + * @param enableRoundingControl : + * When enabled reduces the IDCT drift + * 1 for Enable + * 0 for Disable + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_InterCodingParams { + XDAS_Int32 interCodingPreset; + XDAS_Int32 searchRangeHorP; + XDAS_Int32 searchRangeVerP; + XDAS_UInt32 globalOffsetME; + XDAS_Int32 earlySkipThreshold; + XDAS_Int32 enableThresholdingMethod; + XDAS_UInt32 minBlockSizeP; + XDAS_UInt32 enableRoundingControl; + +} IMPEG4ENC_InterCodingParams; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_IntraCodingParams + * @brief This structure contains all the parameters which controls Intra + * encoding + * + * @param intraCodingPreset : + * This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + * not aware about following fields, it should be set as + * IMPEG4_INTERCODING_DEFAULT + * + * @param intraRefreshMethod : + * Intra Refresh methods, this can be any one of the + * IMPEG4ENC_IntraRefreshMethods enumeration. + * refer IMPEG4ENC_IntraRefreshMethods enumeration above. + * + * @param intraRefreshRate : + * if intraRefreshMethod is IMPEG4_INTRAREFRESH_CYCLIC_MBS, this value + * represents madulo cyclic MBs value. MPEG4 Encoder encodes a + * macro block as Intra after every intraRefreshRate number of macro + * blocks.if intraRefreshMethod is IMPEG4_INTRAREFRESH_CYCLIC_ROWS, + * this value represents number if rows which are intra. MPEG4 Encoder + * encodes those many rows as intra every frame and the location of + * intra rows moves in cyclic fashion. + * This variable is ignored if intraRefreshMethod is + * IMPEG4_INTRAREFRESH_NONE. + * + * @param acpredEnable : + * AC prediction + * 0 for Disable + * 1 for Enable + * + * @param insertGOVHdrBeforeIframe : + * inserts GOV Header before I Frame if enabled + * 0 for Disable + * 1 for Enable + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_IntraCodingParams { + XDAS_Int32 intraCodingPreset; + XDAS_UInt32 intraRefreshMethod; + XDAS_UInt32 intraRefreshRate; + XDAS_UInt32 acpredEnable; + XDAS_UInt32 insertGOVHdrBeforeIframe; + XDAS_UInt32 enableDriftControl; + +} IMPEG4ENC_IntraCodingParams; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_sliceCodingParams + * @brief This structure contains all the parameters which controls Intra + * encoding + * + * @param sliceCodingPreset : + * This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + * not aware about following fields, it should be set as + * IMPEG4_INTERCODING_DEFAULT + * + * @param sliceMode : + * This defines the control mechanism to split a picture in slices. + * It can be either MB based or bits based and takes the enum + * IMPEG4ENC_SliceMode + * + * @param sliceUnitSize : + * The meaning of this parameter depends upon sliceMode. + * sliceMode == IMPEG4_SLICEMODE_MBUNIT then this + * parameter informs the number of Macroblocks in one slice + * sliceMode == IMPEG4_SLICEMODE_BITS then this + * parameter informs the number of bits in one slice in MPEG4 + * jargon resyncIntervalInBits + * sliceMode == IMPEG4_SLICEMODE_NONE then this + * parameter is not respected + * + * @param gobInterval : + * insert GOB header after every n GOBs + * This field is only used for H263 + * gobInterval range is [0, Max GOB Number-1] + * + * @param useHec : + * Use Header extension code [0-2] + * 0 for Disable + * 1 Include HEC for only First GobHeader + * 2 Include HEC for for all GobHeader + * + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_sliceCodingParams { + XDAS_Int32 sliceCodingPreset; + XDAS_Int32 sliceMode; + XDAS_Int32 sliceUnitSize; + XDAS_UInt32 gobInterval; + XDAS_UInt32 useHec; + +} IMPEG4ENC_sliceCodingParams; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_DynamicParams + * @brief This structure defines the dynamic parameters for MPEG4ENC objects + * + * @param videnc2DynamicParams : + * refer IVIDENC2_DynamicParams in ividenc2.h file + * + * @param rateControlParams : + * refer IMPEG4ENC_RateControlParams structure above + * + * @param interCodingParams : + * refer IMPEG4ENC_InterCodingParams structure above + * + * @param sliceCodingParams : + * refer IMPEG4ENC_sliceCodingParams structure above + * + * @param aspectRatioIdc : + * defines the value of pixel aspect ratio + * See Table 6-12 of standard spec for aspect ratio details + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_DynamicParams { + IVIDENC2_DynamicParams videnc2DynamicParams; + IMPEG4ENC_RateControlParams rateControlParams; + IMPEG4ENC_InterCodingParams interCodingParams; + IMPEG4ENC_sliceCodingParams sliceCodingParams; + XDAS_UInt32 aspectRatioIdc; +}IMPEG4ENC_DynamicParams; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_DynamicParams + * @brief Default dynamic parameter values for MPEG4ENC instance objects + * if user defined dynamic parameters are not given to the encoder then + * encoder uses this default dynamic parameters (which can be found in + * impeg4enc.c file) for encoding. + * + ******************************************************************************* +*/ +extern IMPEG4ENC_DynamicParams MPEG4ENC_TI_DYNAMICPARAMS; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_Params + * @brief This structure defines the creation parameters for MPEG4ENC objects + * + * @param videnc2Params : + * Defines creation time parameters for all IVIDENC2 instance objects. + * refer IVIDENC2_Params structure in ividenc2.h file + * + * @param rateControlParams : + * refer IMPEG4ENC_RateControlParams structure above + * + * @param interCodingParams : + * refer IMPEG4ENC_InterCodingParams structure above + * + * @param intraCodingParams : + * refer IMPEG4ENC_IntraCodingParams structure above + * + * @param sliceCodingParams : + * refer IMPEG4ENC_sliceCodingParams structure above + * + * @param useDataPartitioning : + * Controls data partitioning for MPEG4 Encoder. + * This mode is automatically disabled when short video header is + * enabled + * 0 for Disable + * 1 for Enable + * + * @param useRvlc : + * Use Reversible Variable Length Coding. + * MPEG4 Encoder expects Data Partitioning to be enabled when RVLC is + * enabled or else it returns error. + * This mode is automatically disabled when short video header is + * enabled + * 0 for Disable + * 1 for Enable + * + * @param useShortVideoHeader : + * short video header / h263 base line profile + * MPEG4 Encoder automatically disable the 4 MV, Data Partitioning, + * RVLC modes and reset resync interval in bits (disable H.241 flow) + * 0 for Disable + * 1 for Enable + * + * @param vopTimeIncrementResolution : + * resolution of vop_time_increment bit-stream syntax element, + * number of ticks/sec + * + * @param nonMultiple16RefPadMethod : + * Controls the way the padding is done for Ref Frame when Height is + * non-multiple of 16. + * Follows the enum IMPEG4ENC_nonMultiple16RefPadMethod + * IMPEG4_PAD_METHOD_DIVX - VLC, DIVx way of padding + * IMPEG4_PAD_METHOD_MPEG4 - MPEG4 Standard specific way of padding + * default value is IMPEG4_PAD_METHOD_MPEG4. + * + * @param pixelRange :video_range=0 :Y from 16 to 235, Cb and Cr from 16 to 240; + * video_range=1 : Y from 0 to 255,Cb and Cr from 0 to 255. + * + * @param enableSceneChangeAlgo : Parameter to enable or disable scene change + * algorithm. + * @param useVOS : VOS header insertion, 0 = off, 1 = on + * @param enableMONA : enable MONA settings 0 = off, 1 = on + * @param enableAnalyticinfo : enable MV and SAD access to user + * 0 = off, 1 = on + * + * @param debugTraceLevel : Indicates level of debug trace info to be + * dumped. + * Disabled if this value is zero. + * + * @param lastNFramesToLog : Indicates no. of frames for which debug trace + * info to be dumped. Valid only if debugTraceLevel + * is non zero. + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_Params { + IVIDENC2_Params videnc2Params; + IMPEG4ENC_RateControlParams rateControlParams; + IMPEG4ENC_InterCodingParams interCodingParams; + IMPEG4ENC_IntraCodingParams intraCodingParams; + IMPEG4ENC_sliceCodingParams sliceCodingParams; + + XDAS_UInt32 useDataPartitioning; + XDAS_UInt32 useRvlc; + XDAS_UInt32 useShortVideoHeader; + XDAS_UInt32 vopTimeIncrementResolution; + XDAS_UInt32 nonMultiple16RefPadMethod; + XDAS_UInt32 pixelRange; + XDAS_UInt32 enableSceneChangeAlgo; + XDAS_UInt32 useVOS; + XDAS_UInt32 enableMONA; + XDAS_Int32 enableAnalyticinfo; + + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + +} IMPEG4ENC_Params; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_Params + * @brief Default parameter values for MPEG4ENC instance objects + * if user defined parameters are not given to the encoder then + * encoder uses this default parameters (which can be found in + * impeg4enc.c file) for encoding. + * + ******************************************************************************* +*/ +extern IMPEG4ENC_Params MPEG4ENC_TI_PARAMS; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_Status + * @brief Status structure defines the parameters that can be changed or read + * during real-time operation of the alogrithm. + * + * @param videnc2Status : + * Status of the MPEG4 encoder along with error information, if any. + * refer IVIDENC2_Status structure in ividenc2.h file + * + * @param rateControlParams : + * refer IMPEG4ENC_RateControlParams structure above + * + * @param interCodingParams : + * refer IMPEG4ENC_InterCodingParams structure above + * + * @param intraCodingParams : + * refer IMPEG4ENC_IntraCodingParams structure above + * + * @param sliceCodingParams : + * refer IMPEG4ENC_sliceCodingParams structure above + * + * @param useDataPartitioning : + * Use data partitioning + * 0 for Disable + * 1 for Enable + * + * @param useRvlc : + * Use Reversible Variable Length Coding + * 0 for Disable + * 1 for Enable + * + * @param useShortVideoHeader : + * short video header / h263 base line profile + * 0 for Disable + * 1 for Enable + * @param vopTimeIncrementResolution :Resolution of vop_time_increment + * bit-stream syntax element, + * number of ticks/sec. + * + * @param nonMultiple16RefPadMethod : Controls the way the padding is done + * for Ref Frame when Height is + * Non-multiple of 16. + * @param pixelRange : Pixel range to be put in header + * See IMPEG4VENC_PixelRange enumeration for details. + * + * @param enableSceneChangeAlgo : + * Scene change detection algorithm. + * 0 for Disable + * 1 for Enable + * @param useVOS : VOS header insertion, 0 = off, 1 = on + * @param enableMONA : enable MONA settings 0 = off, 1 = on + * @param enableAnalyticinfo : enable MV and SAD access to user + * 0 = off, 1 = on + * + * @param debugTraceLevel : + * 0 Disable dumping debug data + * 1-4 enable dumping debug data + * + * @param lastNFramesToLog : No. of frame for which debug trace info to be + * dumped. + * + * @param extMemoryDebugTraceAddr : External memory address where debug trace + * info is dunped + * + * @param extMemoryDebugTraceSize : Size of the debug trace info in the + * external memory. + * + ******************************************************************************* +*/ +typedef struct { + IVIDENC2_Status videnc2Status; + IMPEG4ENC_RateControlParams rateControlParams; + IMPEG4ENC_InterCodingParams interCodingParams; + IMPEG4ENC_IntraCodingParams intraCodingParams; + IMPEG4ENC_sliceCodingParams sliceCodingParams; + + XDAS_UInt32 useDataPartitioning; + XDAS_UInt32 useRvlc; + XDAS_UInt32 useShortVideoHeader; + XDAS_UInt32 vopTimeIncrementResolution; + XDAS_UInt32 nonMultiple16RefPadMethod; + XDAS_UInt32 pixelRange; + XDAS_UInt32 enableSceneChangeAlgo; + XDAS_UInt32 useVOS; + XDAS_UInt32 enableMONA; + XDAS_Int32 enableAnalyticinfo; + + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + XDAS_UInt32 *extMemoryDebugTraceAddr; + XDAS_UInt32 extMemoryDebugTraceSize; + +} IMPEG4ENC_Status; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_InArgs + * @brief This structure defines the runtime input arguments for + * IMPEG4ENC::process function + * + * @param videnc2InArgs : + * Parameters common to video encoders + * refer IVIDENC2_InArgs structure in ividenc2.h file + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_InArgs { + IVIDENC2_InArgs videnc2InArgs; +} IMPEG4ENC_InArgs; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_OutArgs + * @brief This structure defines the run time output arguments for + * IMPEG4ENC::process function + * + * @param videnc2OutArgs : + * output parameters from the IMPEG4ENC::process call + * refer IVIDENC2_OutArgs structure in ividenc2.h file + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_OutArgs { + IVIDENC2_OutArgs videnc2OutArgs; +} IMPEG4ENC_OutArgs; + + +/** + ******************************************************************************* + * @struct IMPEG4ENC_Fxns + * @brief This structure defines all of the operations on MPEG4ENC objects + * + * @param ividenc : + * refer IVIDENC2_Fxns structure in ividenc2.h file + * + ******************************************************************************* +*/ +typedef struct IMPEG4ENC_Fxns { + IVIDENC2_Fxns ividenc; /* IMPEG4ENC extends IVIDENC */ +} IMPEG4ENC_Fxns; + +/** + ****************************************************************************** + * @struct IMPEG4ENC_DataSyncDesc + * @brief This structure is an extension of XDM_DataSyncDesc to provide add- + * itional information required for Mode B Packetization according to + * RFC2190. + * + * @param mbAddr: this is a pointer to an array of FIrst MB Addresses in diff + * packets. + * @param gobNumber: this is a pointer to an array of GOB Number of first Mb + * in different packets + * @param quantScale: this is a pointer to an array of Quant values of first + * Mb in different packets + * @param mv: this is a pointer to an array of MV of first MB in different + * packets. Note: the MV is in half-pel reolution as required in + * RFC2190. + ****************************************************************************** +*/ +typedef struct IMPEG4ENC_DataSyncDesc { + XDM_DataSyncDesc dataSyncDesc; + XDAS_UInt16 *mbAddr; + XDAS_UInt16 *gobNumber; + XDAS_UInt16 *quantScale; + XDAS_UInt32 *mv; +} IMPEG4ENC_DataSyncDesc; + +#ifdef __cplusplus +} +#endif /* extern "C" */ + +/*@}*/ /* ingroup HDVICP2MPEG4 */ + +#endif /* IMPEG4ENC_ */ + diff --git a/packages/ivahd_codecs/ti/sdo/codecs/mpeg4vdec/impeg4vdec.h b/packages/ivahd_codecs/ti/sdo/codecs/mpeg4vdec/impeg4vdec.h new file mode 100755 index 0000000..0147bac --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/mpeg4vdec/impeg4vdec.h @@ -0,0 +1,1064 @@ +/* +******************************************************************************** +* HDVICP2.0 Based MPEG4 ASP Decoder +* +* "HDVICP2.0 Based MPEG4 ASP Decoder" is software module developed on TI's +* HDVICP2 based SOCs. This module is capable of decode a 4:2:0 Raw +* video stream of Advanced/Simple profile and also H.263 bit-stream. +* Based on ISO/IEC 14496-2:2003." +* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ +* ALL RIGHTS RESERVED +******************************************************************************** +*/ + +/** +******************************************************************************** +* @file +* +* @brief This file provides definisions for the interface handles. +* +* @author: Ashish Singh (ashish.singh@ti.com) +* +* @version 0.0 (June 2009) : Base version created [Ashish] +* +* @version 0.1 (Apr 2010) : Review Comments Added [Ananya] +* +* @version 0.2 (oct 2010) : cleared doxygen warning and fixed VOP non coded +* related bugs. +* +* @version 0.3 (Nov 2010) : Modified the error bit 20. +* +* @version 0.4 (Dec 2010) : Removed the sorenson support and compile time +* parameter _DEBUGTRACE. [Nitesh] +* +* @version 0.5 (May 2011) : Added one more create time parameter paddingMode +* to support the padding of non multiple of +* 16 resolution clips, along with this removed some +* un-neccesary code from interface file [Ashish] + +* @version 0.6 (July 2011): rename the error code to have alignment of the error +* codes related mpeg4 [Ashish] +* +* @version 0.7 (Sep 2011): rename the error codes and also introduced more +* error code as IMPEG4D_ERR_FRAME_DROPPED etc. +* allocated some reserve space in all interface str +* for future uses. [Ashish] +* +* @version 0.8 (Oct 2011): renamed the enum macros to appropriate uses cases. +* removed unwanted enum from the inetrface file. +* added debug trace level enum to interface file +* [Ashish] +* +* @version 0.9 (Mar 2012) : Added create time params & enums to support Enhanced +* deblocking feature [Mahantesh] +* +* @version 1.0 (May 2012) : MB Info format structure added [Mahantesh] +* +* @version 0.9 (July 2012): Added create time params, enums & Macros to support +* only I frame decoding [Mahantesh] +******************************************************************************* +*/ + +/* -------------------- compilation control switches ---------------------- */ + +#ifndef _IMPEG4VDEC_H_ +#define _IMPEG4VDEC_H_ + +/**************************************************************************** +* INCLUDE FILES +*****************************************************************************/ +/* -------------------- system and platform files ------------------------- */ +/* ------------------------- program files -------------------------------- */ + +#include +#include +#include +#include + + +/**************************************************************************** +* EXTERNAL REFERENCES NOTE : only use if not found in header file +*****************************************************************************/ +/* ------------------------ data declarations ----------------------------- */ +/* ----------------------- function prototypes ---------------------------- */ + +/**************************************************************************** +* PUBLIC DECLARATIONS Defined here, used elsewhere +*****************************************************************************/ +/* ----------------------- data declarations ------------------------------ */ +/** +* Macro defined for Offset version length +*/ +#define IMPEG4DEC_VERSION_LENGTH 53 +/** +******************************************************************************* +* @struct IMPEG4VDEC_Obj +* +* @brief This structure must be the first field of all mp4VDEC instance +* objects +* +* @param fxns +* Handle to extented mpeg4 video decoder library interface functions +* +* @note None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_Obj +{ + struct IMPEG4VDEC_Fxns *fxns; +} IMPEG4VDEC_Obj; + +/** +******************************************************************************* +* @struct IMPEG4VDEC_Handle +* +* @brief This handle is used to reference all mp4VDEC instance objects +* +* @note None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_Obj *IMPEG4VDEC_Handle; + +/** +******************************************************************************* +* @struct IMPEG4VDEC_Status +* +* @brief Status structure defines the parameters that can be changed or +* read during real-time operation of the alogrithm. +* +* @param viddec3Status +* Handle to base class status struture which defines the all +* run time parameters. +* +* @param lastNFramesToLog +* element to set the number of frame traces required before the +* current frame decoded +* +* @param extMemoryDebugTraceAddr +* External memory address where codec dumps the debug trace logs +* +* @param extMemoryDebugTraceSize +* size of the debug trace logs dump by codec in external memory +* +* @param reserved[3] +* allocted reserve space for future uses +* +* @note None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_Status +{ + IVIDDEC3_Status viddec3Status; + + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + XDAS_UInt32 *extMemoryDebugTraceAddr; + XDAS_UInt32 extMemoryDebugTraceSize; + XDAS_UInt32 reserved[3]; +} IMPEG4VDEC_Status; + +/** +******************************************************************************* +* @struct IMPEG4VDEC_Cmd +* +* @brief The Cmd enumeration defines the control commands for the MPEG4 +* video decoder control method. +* +* @note None +******************************************************************************** +*/ +typedef IVIDDEC3_Cmd IMPEG4VDEC_Cmd; + +/** +******************************************************************************* +* @struct IMPEG4VDEC_Params +* +* @brief This structure defines the creation parameters for all +* mp4VDEC objects +* +* @param viddecParams +* Defines the creation time parameters for +* all IVIDDEC3 instance objects. +* +* @param outloopDeBlocking +* Flag for Optional deBlock filter ON or Enhanced filtering ON +* +* @param errorConcealmentEnable +* flag to set error concealment feature-set on or off +* +* @param sorensonSparkStream +* Flag reserved for future usage for sorenson spark stream +* +* @param debugTraceLevel +* element to set the debug trace level, codec will give trace +* info base on tarce level +* +* @param lastNFramesToLog +* element to set the number of frame traces required before the +* current frame decoded +* +* @param paddingMode +* Flag to set the padding type used by codec for non multiple +* for 16 resolution clips +* +* @param enhancedDeBlockingQp +* QP value to be used for filtering all edges +* +* @param decodeOnlyIntraFrames +* Flag to indicate codec to decode only I frames from bitstream +* +* @param reserved +* allocted reserve space for future uses +* +* @note None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_Params +{ + IVIDDEC3_Params viddec3Params; + XDAS_Int32 outloopDeBlocking; + XDAS_Int32 errorConcealmentEnable; + XDAS_Int32 sorensonSparkStream; + XDAS_UInt32 debugTraceLevel; + XDAS_UInt32 lastNFramesToLog; + XDAS_UInt32 paddingMode; + XDAS_UInt32 enhancedDeBlockingQp; + XDAS_UInt32 decodeOnlyIntraFrames; + XDAS_UInt32 reserved; +} IMPEG4VDEC_Params; + +extern IMPEG4VDEC_Params IMPEG4VDEC_PARAMS; + +/** +******************************************************************************* +* @struct IMPEG4VDEC_DynamicParams +* +* @brief This structure defines the run time parameters for all +* mp4VDEC objects +* +* @param viddecDynamicParams +* Defines the run time parameters for +* all IVIDDEC3 instance objects. +* +* @param reserved[3] +* allocted reserve space for future uses + +* @see None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_DynamicParams +{ + IVIDDEC3_DynamicParams viddec3DynamicParams; + XDAS_UInt32 reserved[3]; +} IMPEG4VDEC_DynamicParams; + +extern IMPEG4VDEC_DynamicParams IMPEG4VDEC_TI_DYNAMICPARAMS; +/** +******************************************************************************* +* @struct IMPEG4VDEC_InArgs +* +* @brief This structure defines the run time input arguments for all VIDDEC +* objects.This structure may be extended by individual codec +* implementation allowing customization with vendor specific +* parameters. +* +* @param viddec3InArgs +* Defines the input arguments for all IVIDDEC3 instance +* process function. +* +* @see None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_InArgs +{ + IVIDDEC3_InArgs viddec3InArgs; +}IMPEG4VDEC_InArgs; + +/** +******************************************************************************* +* @struct IMPEG4VDEC_OutArgs +* +* @brief This structure defines the run time output arguments for VIDDEC +* objects.This structure may be extended by individual codec +* implementation allowing customization with vendor specific +* parameters. +* +* @param viddec3OutArgs +* Defines the output arguments for all IVIDDEC3 instance +* process function. + +* @param vopTimeIncrementResolution +* VOP Time increamnet resolution info present in mpeg4 stream + +* @param vopTimeIncrement +* VOP Time increment info present in mpeg4 stream +* +* @param mp4ClosedGov +* Flag to get to know info about closed_gov +* +* @param mp4BrokenLink +* Flag to get to know info about mpeg4 broken link +* +* @note None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_OutArgs +{ + IVIDDEC3_OutArgs viddec3OutArgs; + XDAS_Int32 vopTimeIncrementResolution; + XDAS_Int32 vopTimeIncrement; + XDAS_Int32 mp4ClosedGov; + XDAS_Int32 mp4BrokenLink; +}IMPEG4VDEC_OutArgs; + +/** +******************************************************************************* +* @enum IMPEG4VDEC_ErrorBit +* +* @brief Mpeg4 Error Codes: Delaration of mpeg4 decoder specific Error +* Codes. +* @details Error status is communicated through a 32 bit word. In this, +* Error Bits 8 to 15 are used to indicate the XDM error bits. See +* XDM_ErrorBit definition in xdm.h. Other bits in a 32 bit word +* can be used to signal any codec specific errors. The staructure +* below enumerates the mpeg4 decoder specific error bits used. +* The algorithm can set multiple bits to 1 depending on the error +* condition +* +******************************************************************************** +*/ +typedef enum +{ + IMPEG4D_ERR_VOS = 0, + /**< +* Bit 0 +* 1 - No Video Object Sequence detected in the frame +* 0 - Ignore +*/ + + IMPEG4D_ERR_VO, + /**< +* Bit 1 +* 1 - Incorrect Video Object type +* 0 - Ignore +*/ + + IMPEG4D_ERR_VOL, + /**< +* Bit 2 +* 1 - Error in Video Object Layer detected +* 0 - Ignore +*/ + + IMPEG4D_ERR_GOV, + /**< +* Bit 3 +* 1 - Error in Group of Video parsing +* 0 - Ignore +*/ + + IMPEG4D_ERR_VOP, + /**< +* Bit 4 +* 1 - Error in Video Object Plane parsing +* 0 - Ignore +*/ + + IMPEG4D_ERR_SHORTHEADER, + /**< +* Bit 5 +* 1 - Error in short header parsing +* 0 - Ignore +*/ + + IMPEG4D_ERR_GOB, + /**< +* Bit 6 +* 1 - Error in GOB parsing +* 0 - Ignore +*/ + + IMPEG4D_ERR_VIDEOPACKET, + /**< +* Bit 7 +* 1 - Error in Video Packet parsing +* 0 - Ignore +*/ + + IMPEG4D_ERR_MBDATA = 16 , + /**< +* Bit 16 +* 1 - Error in MB data parsing +* 0 - Ignore +*/ + + IMPEG4D_ERR_INVALIDPARAM_IGNORE, + /**< +* Bit 17 +* 1 - Invalid Parameter +* 0 - Ignore +*/ + + IMPEG4D_ERR_UNSUPPFEATURE, + /**< +* Bit 18 +* 1 - Unsupported feature +* 0 - Ignore +*/ + + IMPEG4D_ERR_STREAM_END, + /**< +* Bit 19 +* 1 - End of stream reached +* 0 - Ignore +*/ + + IMPEG4D_ERR_VALID_HEADER_NOT_FOUND, + /**< +* Bit 20 +* 1 - Vaild header not found.i.e (VOL/VOP not found) +* 0 - Ignore +*/ + + IMPEG4D_ERR_UNSUPPRESOLUTION, + /**< +* Bit 21 +* 1 - Unsupported resolution by the decoder +* 0 - Ignore +*/ + + IMPEG4D_ERR_BITSBUF_UNDERFLOW, + /**< +* Bit 22 +* 1 - The stream buffer has underflowed +* 0 - Ignore +*/ + + IMPEG4D_ERR_INVALID_MBOX_MESSAGE, + /**< +* Bit 23 +* 1 - Invalid (unexpected) mail boX message recieved by IVAHD +* 0 - Ignore +*/ + IMPEG4D_ERR_NO_FRAME_FOR_FLUSH, + /**< +* Bit 24 +* 1 - Codec does not have any frame for flushing out to application +* 0 - Ignore +*/ + IMPEG4D_ERR_VOP_NOT_CODED, + /**< +* Bit 25 +* 1 - Given vop is not codec +* 0 - Ignore +*/ + IMPEG4D_ERR_START_CODE_NOT_PRESENT, + /**< +* Bit 26 +* 1 - Start code for given stream is not present in case of Parse Header +* Mode +* 0 - Ignore +*/ + IMPEG4D_ERR_VOP_TIME_INCREMENT_RES_ZERO, + /**< +* Bit 27 +* 1 - Unsupported time increment resolution by the decoder +* 0 - Ignore +*/ + IMPEG4D_ERR_PICSIZECHANGE, + /**< +* Bit 28 +* 1 - resolution gets change in between process call +* 0 - Ignore +*/ + IMPEG4D_ERR_UNSUPPORTED_H263_ANNEXS, + /**< +* Bit 29 +* 1 - Unsupported annexs of the H263 +* 0 - Ignore +*/ + IMPEG4D_ERR_HDVICP2_IMPROPER_STATE, + /**< +* Bit 30 +* 1 - HDVCIP is not in correct state +* 0 - Ignore +*/ + IMPEG4D_ERR_IFRAME_DROPPED + /**< +* Bit 31 +* 1 - Current frame is lost,no frame is present for decode +* 0 - Ignore +*/ + +} IMPEG4VDEC_ErrorBit; + +/** +****************************************************************************** +* @enum IMPEGVDEC_MetadataType +* @brief This enum indicates Meta Data types for MPEG4 ASP Decoder +* +* @remarks The way to get meta data from decoder is via outBufs of the +* decoder during process call. +****************************************************************************** +*/ + +typedef enum +{ + IMPEGVDEC_PARSED_MB_INFO_DATA = XDM_CUSTOMENUMBASE, + IMPEGVDEC_PARSED_MB_ERROR_INFO_DATA, + IMPEGVDEC_PARSED_ALFA_DATA +} IMPEGVDEC_MetadataType; + +/** +******************************************************************************* +* @enum _IMPEG4MemDescription +* @brief MemDescription of IVAHD MPEG4 ASP Decoder implementation by TI. +* +* @remarks this enum explain the type of memory required by mpeg4 ASP decoder +* +******************************************************************************* +*/ + +typedef enum _IMPEG4MemDescription +{ + IMPEG4VDEC_OBJECT, + /** +* this memory type is allocated by alg_alloc call & this is allocated +* for handle of decoder +*/ + IMPEG4VDEC_DEBUG_TRACE_BUF, + /**< +* Memtab for debug trace parameter storage +*/ + IMPEG4VDEC_COLOC_PMBDATA, + + /** +* Number of MemTab required if no-Deblock and no-B colocated MB info +* required +*/ + IMPEG4VDEC_COLOC_BMBDATA , + /** +* this memory type is allocated by IRES & this is for storing the colocated +* MB data for B Frame +*/ + IMPEG4VDEC_DEBLOCK_OFF_TOTAL_MEMTABS, + /** +* Number of MemTab required if Deblock is Off required +*/ + IMPEG4VDEC_LUMARECON_DATA_BUF0 = IMPEG4VDEC_DEBLOCK_OFF_TOTAL_MEMTABS, + /** +* this memory type is allocated by IRES & this is for storing the decoded +* Luma data for Recon Frame used in case of Deblock Enable +*/ + IMPEG4VDEC_LUMARECON_DATA_BUF1, + /** +* this memory type is allocated by IRES & this is for storing the decoded +* Luma data for Recon Frame used in case of Deblock Enable +*/ + IMPEG4VDEC_LUMARECON_DATA_BUF2, + /** +* this memory type is allocated by IRES & this is for storing the decoded +* Luma data for Recon Frame used in case of Deblock Enable +*/ + IMPEG4VDEC_CHROMARECON_DATA_BUF0, + /** +* this memory type is allocated by IRES & this is for storing the decoded +* Chroma data for Recon Frame used in case of Deblock Enable +*/ + IMPEG4VDEC_CHROMARECON_DATA_BUF1, + /** +* this memory type is allocated by IRES & this is for storing the decoded +* Chroma data for Recon Frame used in case of Deblock Enable +*/ + IMPEG4VDEC_CHROMARECON_DATA_BUF2, + /** +* this memory type is allocated by IRES & this is for storing the decoded +* Chroma data for Recon Frame used in case of Deblock Enable +*/ + + IMPEG4VDEC_DEBLOCK_ON_TOTAL_MEMTABS, + /** +* Number of memtab required if deblock is on and it will be maximum +* resource required by codec +*/ + IMPEG4VDEC_MAX_MEMTABS = IMPEG4VDEC_DEBLOCK_ON_TOTAL_MEMTABS + /** +* Maximum number of memtab required +*/ +}IMEPG4VDEC_MemDescription; + +/* +* Number of 1D resource required by codec from IRES +*/ +#define IMEPG4VDEC_TOTAL_1D_OBJECTS 0x4 +/* +* Number of 2D resource required by codec from IRES when filtering is off +*/ +#define IMEPG4VDEC_MIN_2D_OBJECTS 0x0 +/* +* Number of 2D resource required by codec from IRES when filtering is on +*/ +#define IMEPG4VDEC_MAX_2D_OBJECTS 0x6 +/* +* Number of 1D resource required by codec from IRES +*/ +#define IMEPG4VDEC_TOTAL_1D_OBJECTS_DECODE_ONLY_I_FRAMES 0x3 +/* +* Number of 1D resource required by codec from IRES when +* decodeOnlyIntraframes = 1 +*/ +#define IMPEG4VDEC_DEBLOCK_OFF_TOTAL_MEMTABS_DECODE_ONLY_I_FRAMES 0x3 +/* +* Number of memtab required if deblock is on and decodeOnlyIntraframes = 1, +* and it will be maximum resource required by codec +*/ +#define IMPEG4VDEC_DEBLOCK_ON_TOTAL_MEMTABS_DECODE_ONLY_I_FRAMES 0x5 +/* +* Number of 2D resource required by codec from IRES when filtering is on and +* decodeOnlyIntraframes = 1 +*/ +#define IMEPG4VDEC_MAX_2D_OBJECTS_DECODE_ONLY_I_FRAMES 0x2 +/* +* Luma recon buffer index in memory resource handle array +*/ +#define IMPEG4VDEC_LUMARECON_DATA_BUF0_DECODE_ONLY_I_FRAMES 0x3 +/* +* Chroma recon buffer index in memory resource handle array +*/ +#define IMPEG4VDEC_CHROMARECON_DATA_BUF0_DECODE_ONLY_I_FRAMES 0x4 +/** +******************************************************************************* +* @struct IMPEG4VDEC_Fxns +* +* @brief This structure defines all of the operations on mp4VDEC objects. +* +* @param ividdec3 +* handle to the all function of the operations on IVIDDEC3 objects +* +* @see None +******************************************************************************** +*/ +typedef struct IMPEG4VDEC_Fxns +{ + IVIDDEC3_Fxns ividdec3; +} IMPEG4VDEC_Fxns; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_FrameFlushState + * @brief This enum indicates whether to frame needs to flush or not + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_FLUSH_DISABLE = 0, + /** + * Flag to set the frame flush is disable + */ + IMPEG4VDEC_FLUSH_ENABLE + /** + * Flag to set the frame flush is Enable + */ +}IMPEG4VDEC_FrameFlushState; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_ColocatedBFrameMBinfoStoreMode + * @brief This enum indicates whether to Application needs co-located + * MB data or not + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_STORE_COLOCATED_BMBINFO_DISABLE = 0, + /** + * Flag to set the co-located MB info disable + */ + IMPEG4VDEC_STORE_COLOCATED_BMBINFO_ENABLE + /** + * Flag to set the co-located MB info enable + */ +}IMPEG4VDEC_ColocatedBFrameMBinfoStoreMode; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_OptionalDeBlkMode + * @brief This enum indicates whether deblock need to be done or not + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_DEBLOCK_DISABLE = 0, + /** + * Flag to set the de-block disable + */ + IMPEG4VDEC_DEBLOCK_ENABLE, + /** + * Flag to set the de-block enable + */ + IMPEG4VDEC_ENHANCED_DEBLOCK_ENABLE + /** + * Flag to set the de-block enable for 8x8 edges of all Macroblocks + * including its top & left edges. + */ +}IMPEG4VDEC_OptionalDeBlkMode; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_EnhancedDeblockQp + * @brief This enum the MIN & MAX values that QP can take while filering + * for all edges is enabled + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_DEBLOCK_QP_MIN = 1, + /** + * Indicates min QP value when fitering all edges is enabled + */ + IMPEG4VDEC_DEBLOCK_QP_MAX = 31 + /** + * Indicates max QP value when fitering all edges is enabled + */ +}IMPEG4VDEC_EnhancedDeblockQp; +/** + ****************************************************************************** + * @enum IMPEG4VDEC_ErrorConcealmentMode + * @brief This enum indicates whether to apply error concealment or not + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_EC_DISABLE = 0, + /** + * Flag to set error concealement disable + */ + IMPEG4VDEC_EC_ENABLE + /** + * Flag to error concealment enable + */ +}IMPEG4VDEC_ErrorConcealmentMode; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_PaddingModeForNonMultipleOf16Res + * @brief These enumerations captures different methods of padding the Ref + * frame when dimension is non multiple of 16. + * + ****************************************************************************** +*/ +typedef enum +{ + /** + * Method as suggested by DivX spec. + */ + IMPEG4VDEC_DIVX_MODE_PADDING = 0, + /** + * Method as suggested by MPEG4 spec. + */ + IMPEG4VDEC_MPEG4_MODE_PADDING = 1 , + /** + * Default mode is DIVX suggested way. + */ + IMPEG4VDEC_DEFAULT_MODE_PADDING = IMPEG4VDEC_DIVX_MODE_PADDING +} IMPEG4VDEC_PaddingModeForNonMultipleOf16Res; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_debugTraceLevel + * @brief These enumerations captures different debug trace level supported by + * codec. + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_DEBUGTRACE_LEVEL0 = 0, + /** 0: Debug Trace Level 0 + */ + IMPEG4VDEC_DEBUGTRACE_LEVEL1, + /** 1: Debug Trace Level 1 + */ + IMPEG4VDEC_DEBUGTRACE_LEVEL2, + /** 2: Debug Trace Level 2 + */ + IMPEG4VDEC_DEBUGTRACE_MAXLEVEL = IMPEG4VDEC_DEBUGTRACE_LEVEL2 + /** 2: Max level of debug trace + */ +}IMPEG4VDEC_DebugTraceLevel; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_DecodeOnlyIntraFrames + * @brief This enum indicates whether codec should decode only I frames + * or all frames + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_DECODE_ONLY_I_FRAMES_DISABLE = 0, + /** + * Flag to set error concealement disable + */ + IMPEG4VDEC_DECODE_ONLY_I_FRAMES_ENABLE + /** + * Flag to error concealment enable + */ +}IMPEG4VDEC_DecodeOnlyIntraFrames; + +/** + ****************************************************************************** + * @enum IMPEG4VDEC_FrameToLog + * @brief These enumerations captures the max number of frame for which codec + * will dump debug trace. + * + ****************************************************************************** +*/ +typedef enum +{ + IMPEG4VDEC_MINNUM_OF_FRAME_LOGS = 0, + /** 0: minimum number of frames for which debug trace would be + * dump. + */ + IMPEG4VDEC_MAXNUM_OF_FRAME_LOGS = 10 + /** 10:max number of frames for which debug trace would be + * dump. + */ +}IMPEG4VDEC_FrameToLog; + +/** + ****************************************************************************** + * @struct IMPEG4VDEC_TI_CommonInfo + * + * @brief This structure defines the common fields in MB info + * + ****************************************************************************** +*/ +typedef struct _IMPEG4VDEC_TI_CommonInfo +{ + XDAS_UInt32 codec_type:8; + XDAS_UInt32 fmt_type:8; + XDAS_UInt32 mb_ll_avail:1; + XDAS_UInt32 mb_ul_avail:1; + XDAS_UInt32 mb_uu_avail:1; + XDAS_UInt32 mb_ur_avail:1; + XDAS_UInt32 pic_bound_l:1; + XDAS_UInt32 pic_bound_u:1; + XDAS_UInt32 pic_bound_r:1; + XDAS_UInt32 pic_bound_b:1; + XDAS_UInt32 first_mb_flag:1; + XDAS_UInt32 error_flag:1; + XDAS_UInt32 zero:6; + XDAS_UInt32 zeroes:16; + XDAS_UInt32 mb_addr:16; + +} IMPEG4VDEC_TI_CommonInfo; + +/** + ****************************************************************************** + * @struct IMPEG4VDEC_TI_CodecSpecificWordSix + * + * @brief This structure defines codec specific fields in MB info + * + ****************************************************************************** +*/ +typedef struct _IMPEG4VDEC_TI_CodecSpecificWordSix +{ + XDAS_UInt32 pred_mode:3; + XDAS_UInt32 zero7:9; + XDAS_UInt32 pred_type:2; + XDAS_UInt32 gob_frame_id:2; + XDAS_UInt32 gob_number:5; + XDAS_UInt32 gob_header_empty:1; + XDAS_UInt32 forward_top_field_reference:1; + XDAS_UInt32 forward_bottom_field_reference:1; + XDAS_UInt32 backward_top_field_reference:1; + XDAS_UInt32 backward_bottom_field_reference:1; + XDAS_UInt32 header_extension_code:1; + XDAS_UInt32 zero6:5; + XDAS_UInt32 pattern_code:6; + XDAS_UInt32 zero5:2; + XDAS_UInt32 intra_dc_vlc_thr:3; + XDAS_UInt32 zero4:5; + XDAS_UInt32 not_coded:1; + XDAS_UInt32 dct_type:1; + XDAS_UInt32 ac_pred_flag:1; + XDAS_UInt32 cond_skip_flag:1; + XDAS_UInt32 use_intra_dc_vlc:1; + XDAS_UInt32 end_of_texture:1; + XDAS_UInt32 zero3:2; + XDAS_UInt32 vop_fcode_forward:3; + XDAS_UInt32 zero2:1; + XDAS_UInt32 vop_fcode_backward:3; + XDAS_UInt32 zero1:1; + +} IMPEG4VDEC_TI_CodecSpecificWordSix; + +/** + ****************************************************************************** + * @struct IMPEG4VDEC_TI_CodecSpecificWordSix + * + * @brief This structure defines codec specific fields in MB info + * + ****************************************************************************** +*/ +typedef struct _IMPEG4VDEC_TI_CodecSpecificWordSeven +{ + XDAS_UInt32 dc_scaler_luma:6; + XDAS_UInt32 zero4:10; + XDAS_UInt32 dc_scaler_chroma:5; + XDAS_UInt32 zero3:11; + XDAS_UInt32 quant_c:5; + XDAS_UInt32 zero2:19; + XDAS_UInt32 quantiser_scale:5; + XDAS_UInt32 zero1:3; + +} IMPEG4VDEC_TI_CodecSpecificWordSeven; + +/** + ****************************************************************************** + * @struct IMPEG4VDEC_TI_MotionVector + * + * @brief This structure defines format of Motion Vectors as present in MBinfo + * + ****************************************************************************** +*/ +typedef struct _IMPEG4VDEC_TI_MotionVector +{ + XDAS_Int16 x; + XDAS_Int16 y; +} IMPEG4VDEC_TI_MotionVector; + +/** + ****************************************************************************** + * @struct IMPEG4VDEC_TI_MvBidirectional4 + * + * @brief This structure defines Motion Vectors at 8x8 level in both + * directions + * + ****************************************************************************** +*/ +typedef struct _IMPEG4VDEC_TI_MvBidirectional4 +{ + IMPEG4VDEC_TI_MotionVector mv_forward[4]; + IMPEG4VDEC_TI_MotionVector mv_backward[4]; + +} IMPEG4VDEC_TI_MvBidirectional4; + +/** + ****************************************************************************** + * @struct IMPEG4VDEC_TI_MbInfo + * + * @brief This structure details the data format for MB information shared to + * application. This helps application to understand all fields + * the way codec uses MB info internally. This structure is of size + * 112 Bytes. + * + * @param info : This elements gives details about the MB placement in the + * frame. + * + * @param IQedDCY2: This field holds the Inverse Quantized DC for Y2 MB + * + * @param IQedDCY3: This field holds the Inverse Quantized DC for Y3 MB + * + * @param IQedDCY2: This field holds the Inverse Quantized DC for Cb MB + * + * @param IQedDCY3: This field holds the Inverse Quantized DC for Cr MB + * + * @param IQedDCY1: This field holds the Inverse Quantized DC for Y1 MB + * + * @param zeroes1[3]: This field is set to 0 + * + * @param DP_DC_Y0: If data partition = 1, this field contains DC coefficient + * values for Y0 MB + * + * @param DP_DC_Y1: If data partition = 1, this field contains DC coefficient + * values for Y1 MB + * + * @param DP_DC_Y2: If data partition = 1, this field contains DC coefficient + * values for Y2 MB + * + * @param DP_DC_Y3: If data partition = 1, this field contains DC coefficient + * values for Y3 MB + * + * @param DP_DC_Cb: If data partition = 1, this field contains DC coefficient + * values for Cb MB + * + * @param DP_DC_Cr: If data partition = 1, this field contains DC coefficient + * values for Cr MB + * + * @param Reserved: Reserved field + * + * @param zeroes2[2]: This field is set to 0 + * + * @param codecSpecificinfoWordSix: Codec specific fields + * + * @param codecSpecificinfoWordSeven: Codec specific fields + * + * @param zeroes3[4]: This field is set to 0 + * + * @param mv_forward_backward: Lists all Motion vectors at 4x4 level in L0 & + * L1 direction. First 4 MVs in L0 next 4 MVs in + * L1 direction. + * + * @param bidirectional4: Lists all Motion vectors at 8x8 level in both + * directions + ****************************************************************************** +*/ +typedef struct _IMPEG4VDEC_TI_MbInfo +{ + IMPEG4VDEC_TI_CommonInfo info; + + XDAS_Int16 IQedDCY2; + XDAS_Int16 IQedDCY3; + XDAS_Int16 IQedDCCb; + XDAS_Int16 IQedDCCr; + + XDAS_Int16 IQedDCY1; + XDAS_Int16 zeroes1[3]; + + XDAS_Int16 DP_DC_Y0; + XDAS_Int16 DP_DC_Y1; + XDAS_Int16 DP_DC_Y2; + XDAS_Int16 DP_DC_Y3; + + XDAS_Int16 DP_DC_Cb; + XDAS_Int16 DP_DC_Cr; + XDAS_Int32 Reserved; + + XDAS_Int32 zeroes2[2]; + + IMPEG4VDEC_TI_CodecSpecificWordSix codecSpecificinfoWordSix; + + IMPEG4VDEC_TI_CodecSpecificWordSeven codecSpecificinfoWordSeven; + + XDAS_Int32 zeroes3[4]; + + union { + IMPEG4VDEC_TI_MotionVector mv_forward_backward[8]; + IMPEG4VDEC_TI_MvBidirectional4 bidirectional4; + } IMPEG4VDEC_TI_motion_vecs; + + +} IMPEG4VDEC_TI_MbInfo; + +#endif /*_IMPEG4VDEC_H_*/ + + + + + + + + + + + + + diff --git a/packages/ivahd_codecs/ti/sdo/codecs/vc1enc/ivc1enc.h b/packages/ivahd_codecs/ti/sdo/codecs/vc1enc/ivc1enc.h new file mode 100644 index 0000000..83e61b9 --- /dev/null +++ b/packages/ivahd_codecs/ti/sdo/codecs/vc1enc/ivc1enc.h @@ -0,0 +1,996 @@ +/* + ******************************************************************************* + * + * HDVICP2.0 Based VC1 Encoder + * + * "HDVICP2.0 Based VC1 Encoder" is software module developed on TI's + * HDVICP2 based SOCs. This module is capable of compressing a 4:2:0 Raw + * video into a simple/main/advanced profile bit-stream. Based on SMPTE 421M." + * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ + * ALL RIGHTS RESERVED + ******************************************************************************* +*/ + +/*! + ***************************************************************************** + * @file ivc1enc.h + * + * @brief Interface header file + * + * @version 0.1 (Nov 2011) : Initial version [Prasad] + * + ***************************************************************************** + */ + +#ifndef _IVC1ENC_H_ +#define _IVC1ENC_H_ + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the macros define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/** + Maximum Number of slice start points +*/ +#define IVC1ENC_MAX_NUM_SLICE_START_OFFSET (3) +/** + Length of the version string. The memory to get version + number is owned by application +*/ +#define IVC1ENC_VERSION_LENGTH (64) + +/** + control method commands +*/ +#define IVC1ENC_GETSTATUS XDM_GETSTATUS +#define IVC1ENC_SETPARAMS XDM_SETPARAMS +#define IVC1ENC_RESET XDM_RESET +#define IVC1ENC_FLUSH XDM_FLUSH +#define IVC1ENC_SETDEFAULT XDM_SETDEFAULT +#define IVC1ENC_GETBUFINFO XDM_GETBUFINFO + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the Enumeration define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/** + * @enum IVC1ENC_ErrorBit + * @brief error informations of IVAHD VC1 encoder implementation by TI. +*/ +typedef enum { + IVC1ENC_LEVEL_INCOMPLIANT_PARAMETER = 0, + /**< Bit 0 - level incomplaint parameters. + * @remarks This error is applicable when some parameters are set + * which are not meeting the limit defined by the VC1 standard. + * Level limits can be categorized under + * following category : + * IVC1ENC_LEVEL_INCOMPLIANT_RESOLUTION : Invalid width/height + * IVC1ENC_LEVEL_INCOMPLIANT_HRDBUFSZIE : Invalid HrdBufferSize + * IVC1ENC_LEVEL_INCOMPLIANT_BITRATE : Invalid Bit Rate + * For above 3 situations, only a signle bit (bit-0) is set as true + */ + IVC1ENC_PROFILE_INCOMPLIANT_CONTENTTYPE = 1, + /**< Bit 1 - Profile incomplaint content type. + * @remarks This error is applicable when + * IVIDENC2_Params::inputContentType is set as + * IVIDEO_INTERLACED but IVIDENC2_Params::profile is not set + * as IVC1_ADVANCED_PROFILE + */ + IVC1ENC_PROFILE_INCOMPLIANT_INTERFRAMEINTERVAL = 4, + /**< Bit 4 - Profile incomplaint interframeInterval. + * @remarks This error is set when B frames are used with + * IVC1_SIMPLE_PROFILE + */ + IVC1ENC_MAX_BIT_RATE_VIOLATION = 7, + /**< Bit 7 - Max bits for one Unit Voilation + * @remarks When max bit rate is enabled by user, + * than it is possible that codec might not be able + * honor max bit rate. This bit is set when bits consumed + * in one unit ( 1 sec) is more than the allocated as per the + * given max bit rate. If the frame rate is N , and if the + * max bit rate is voilated in M th frame than this bit will + * get set for frame M to N. + */ + IVC1ENC_IMPROPER_HDVICP2_STATE = 16, + /**< Bit 16 - HDVICP2 is not in proper state. + */ + /*IVC1ENC_IMPROPER_STREAMFORMAT = 17, */ + /**< Bit 17 - stream format is not proper + * @remarks This error is set when streamFormat is set + * other than or + */ + IVC1ENC_UNSUPPORTED_VIDENC2PARAMS = 20, + /**< Bit 20 - Invalid videnc2 parameters + * @remarks This error is set when any parameter of struct + * IVIDENC2_Params is not in allowed range + */ + IVC1ENC_UNSUPPORTED_RATECONTROLPARAMS = 21, + /**< Bit 21 - Invalid rate control parameters + * @remarks This error is set when any parameter of struct + * IVC1ENC_RateControlParams is not in allowed range + */ + IVC1ENC_UNSUPPORTED_INTERCODINGPARAMS = 22, + /**< Bit 22 - Invalid inter coding parameters + * @remarks This error is set when any parameter of struct + * IVC1ENC_InterCodingParams is not in allowed range + */ + IVC1ENC_UNSUPPORTED_INTRACODINGPARAMS = 23, + /**< Bit 23 - Invalid Intra coding parameters + * @remarks This error is set when any parameter of struct + * IVC1ENC_IntraCodingParams is not in allowed range + */ + IVC1ENC_UNSUPPORTED_SLICECODINGPARAMS = 25, + /**< Bit 25 - Invalid slice coding parameters + * @remarks This error is set when any parameter of struct + * IVC1ENC_SliceCodingParams is not in allowed range + */ + IVC1ENC_UNSUPPORTED_LOOPFILTERPARAMS = 26, + /**< Bit 26 - Invalid loop filter related parameters + * @remarks This error is set when any parameter of struct + * IVC1ENC_LoopFilterParams is not in allowed range + */ + IVC1ENC_UNSUPPORTED_VC1ENCPARAMS = 29, + /**< Bit 29 - Invalid Create time extended parameters + * @remarks This error is set when any parameter of struct + * IVC1ENC_Params is not in allowed range + */ + IVC1ENC_UNSUPPORTED_VIDENC2DYNAMICPARAMS = 30, + /**< Bit 30 - Invalid base class dyanmic paaremeters during control + * @remarks This error is set when any parameter of struct + * IVIDENC2_DynamicParams is not in allowed range + */ + IVC1ENC_UNSUPPORTED_VC1ENCDYNAMICPARAMS = 31 + /**< Bit 31 - Invalid exteded class dynamic parameters during control + * @remarks This error is set when any parameter of struct + * IVC1ENC_DynamicParams (excluding embedded structures) is not in + * allowed range + */ +} IVC1ENC_ErrorBit; + +/** + * @enum IVC1ENC_Level + * @brief Level Identifier for VC1 Encoder +*/ +typedef enum { + IVC1_SP_LOW = 0, /**< Simple Profile Level Low */ + IVC1_SP_MED = 2, /**< Simple Profile Level Medium */ + IVC1_MP_LOW = 0, /**< Main Profile Level Low */ + IVC1_MP_MED = 2, /**< Main Profile Level Medium */ + IVC1_MP_HIGH = 4, /**< Main Profile Level High */ + IVC1_AP_L0 = 0, /**< Advanced Profile Level L0 */ + IVC1_AP_L1 = 1, /**< Advanced Profile Level L1 */ + IVC1_AP_L2 = 2, /**< Advanced Profile Level L2 */ + IVC1_AP_L3 = 3, /**< Advanced Profile Level L3 */ + IVC1_AP_L4 = 4 /**< Advanced Profile Level L4 */ + +} IVC1ENC_Level; + + +/** + * @enum IVC1ENC_Profile + * @brief Profile Identifier for VC1 Encoder +*/ +typedef enum { + IVC1_SIMPLE_PROFILE = 0, /**< Simple Profile */ + IVC1_MAIN_PROFILE = 1, /**< Main Profile */ + IVC1_ADVANCED_PROFILE = 3 /**< Advanced Profile */ + +} IVC1ENC_Profile; + +/** + + @enum IVC1ENC_RateControlParamsPreset + @brief These enumerations control the RateControl Params + +*/ + +typedef enum { + IVC1_RATECONTROLPARAMS_DEFAULT = 0, + /**< Default Rate Control params */ + IVC1_RATECONTROLPARAMS_USERDEFINED = 1, + /**< User defined Rate Control params */ + IVC1_RATECONTROLPARAMS_EXISTING = 2, + /**< Keep the Rate Control params as existing. This is + * useful because during control call if user doesn't want + * to change the Rate Control Params + */ + IVC1_RATECONTROLPARAMS_MAX + +} IVC1ENC_RateControlParamsPreset; + +/** + + @enum IVC1ENC_RateControlAlgo + @brief These enumerations control the type of rateControl algo to be picked + up by encoder. Only useful if IVIDENC2::rateControlPreset is set as + IVIDEO_USER_DEFINED + +*/ +typedef enum { + IVC1_RATECONTROL_PRC = 0, /**< Perceptual Rate Control, + * controls the QP @ MB level + */ + IVC1_RATECONTROL_PRC_LOW_DELAY = 1, /** Low Delay Rate Control */ + IVC1_RATECONTROL_DEFAULT = IVC1_RATECONTROL_PRC /** Default rcAlgo is PRC */ + +} IVC1ENC_RateControlAlgo; + +/** + + @enum IVC1ENC_InterCodingPreset + @brief These enumerations control the type of inter coding + +*/ + +typedef enum { + IVC1_INTERCODING_DEFAULT = 0, /**< Default Inter coding params */ + IVC1_INTERCODING_USERDEFINED = 1, /**< User defined inter coding params */ + IVC1_INTERCODING_EXISTING = 2, /**< Keep the inter coding params as + * existing. This is useful because + * during control call if user don't + * want to change the inter coding Params + */ + IVC1_INTERCODING_MAX + +} IVC1ENC_InterCodingPreset; + +/** + + @enum IVC1ENC_InterBlockSize + @brief These enumerations are defined for minimum Inter block size + +*/ + +typedef enum { + IVC1_BLOCKSIZE_16x16 = 0, /**< 16x16 Block size */ + IVC1_BLOCKSIZE_DEFAULT = IVC1_BLOCKSIZE_16x16, /**< Default block size */ + IVC1_BLOCKSIZE_8x8 = 1, /**< 8x8 Block size */ + IVC1_BLOCKSIZE_4x4 = 2, /**< 4x4 Block size */ + IVC1_BLOCKSIZE_MAX + +} IVC1ENC_InterBlockSize; + +/** + + @enum IVC1ENC_IntraRefreshMethods + @brief Refresh method Type Identifier for VC1 Encoder + +*/ + +typedef enum { + IVC1_INTRAREFRESH_NONE = 0, /**< Doesn't insert forcefully intra + macro blocks */ + IVC1_INTRAREFRESH_DEFAULT = IVC1_INTRAREFRESH_NONE, + /**< Default intra refresh is OFF */ + IVC1_INTRAREFRESH_CYCLIC_MBS, /**< Insters intra macro blocks in a + * cyclic fashion cyclic interval is + * equal to intraRefreshRate + */ + IVC1_INTRAREFRESH_CYCLIC_SLICES, /**< Insters Intra Slices(Row based) in + * a cyclic fashion: + * cyclic interval is equal to + * intraRefreshRate + */ + IVC1_INTRAREFRESH_RDOPT_MBS, /**< position of intra macro blocks is + * intelligently chosen by encoder, + * but the number of forcely coded + * intra macro blocks in a frame is + * guaranteed to be equal to + * totalMbsInFrame/intraRefreshRate + */ + IVC1_INTRAREFRESH_MAX + +} IVC1ENC_IntraRefreshMethods; + +/** + + @enum IVC1ENC_IntraCodingPreset + @brief These enumerations control the type of intra coding + +*/ + +typedef enum { + IVC1_INTRACODING_DEFAULT = 0, /**< Default intra coding params */ + IVC1_INTRACODING_USERDEFINED = 1, /**< User defined intra coding params */ + IVC1_INTRACODING_MAX + +} IVC1ENC_IntraCodingPreset; + +/** + @enum IVC1ENC_SliceCodingPreset + @brief These enumerations control the type of slice coding + Slice coding is allowed only in Advanced profile. +*/ + +typedef enum { + IVC1_SLICECODING_DEFAULT = 0, + /**< Default slice coding params */ + IVC1_SLICECODING_USERDEFINED = 1, + /**< User defined slicecoding params */ + IVC1_SLICECODING_EXISTING = 2, + /**< Keep the slice coding params as existing */ + /**< This is useful because during control call */ + /**< if user don't want to change the sliceCodingParams */ + IVC1_SLICECODING_MAX + +} IVC1ENC_SliceCodingPreset; + +/** + @enum IVC1ENC_SliceMode + @brief These enumerations control the type of slice coding + Slice coding is allowed only in Advanced profile. +*/ + +typedef enum { + IVC1_SLICEMODE_NONE = 0, + IVC1_SLICEMODE_DEFAULT = IVC1_SLICEMODE_NONE, + /**< Default slice coding mode is disabled */ + IVC1_SLICEMODE_ROWS = 1, + /**< Slices are controlled based upon number of Rows */ + IVC1_SLICEMODE_OFFSET = 2, + /**< Slices are controlled based upon user defined offset in + * unit of Rows + */ + IVC1_SLICEMODE_MAX + +} IVC1ENC_SliceMode; + +/** + + @enum IVC1ENC_StreamFormat + @brief These enumerations control the type of stream format + Only applicable for simple and main profile streams. +*/ +typedef enum { + IVC1_RAW_FORMAT = 0, + /**< bit-stream does not contain the RCV headers */ + IVC1_RCV1_FORMAT = 1, + /**< bit-stream contain the RCV headers in Version 1 format */ + IVC1_RCV2_FORMAT = 2, + /**< bit-stream contain the RCV headers in Version 2 format */ + IVC1_STREAM_FORMAT_DEFAULT = IVC1_RCV2_FORMAT, + /**< Default stream format is RCV2 format */ + IVC1_STREAM_FORMAT_MAX +} IVC1ENC_StreamFormat; + +/** + * @enum IVC1ENC_LoopFilterPreset + * @brief These enumerations control the loop filter params +*/ + +typedef enum { + IVC1_LOOPFILTER_DEFAULT = 0, /**< Default loop-filtering params */ + IVC1_LOOPFILTER_USERDEFINED = 1, /**< User defined loop-filtering params */ + IVC1_LOOPFILTER_MAX +} IVC1ENC_LoopFilterPreset; + +/** + + @enum IVC1ENC_LoopFilterDisableIDC + @brief Control Parameter to enable or disable loop filter + +*/ +typedef enum { + IVC1_DISABLE_FILTER_NONE = 0, + /**< Enable filtering of all the edges */ + IVC1_DISABLE_FILTER_DEFAULT = IVC1_DISABLE_FILTER_NONE, + /**< Default is Loop filter enabled */ + IVC1_DISABLE_FILTER_ALL_EDGES, + /**< Disable filtering of all the edges */ + IVC1_DISABLE_FILTER_MAX +} IVC1ENC_LoopFilterDisableIDC; + +/** + + @enum IVC1ENC_GOPStructure + @brief + When B frames are used (InterFrameInterval > 1) then the arrangement of + frames can be different + + GOP structure in display order as indicated below + If contentType = Frame + IVC1ENC_GOPSTRUCTURE_NONUNIFORM : IBBPBBP. . + IVC1ENC_GOPSTRUCTURE_UNIFORM : BBIBBPBB. . + If contentType = Field + IVC1ENC_GOPSTRUCTURE_NONUNIFORM : IPBBBBPBBBB + IVC1ENC_GOPSTRUCTURE_UNIFORM : BBBBIPBBBBPPBBBB + +*/ + +typedef enum { + IVC1ENC_GOPSTRUCTURE_NONUNIFORM = 0, + /**< Open Gop structure : IBBPBBP */ + IVC1ENC_GOPSTRUCTURE_DEFAULT = IVC1ENC_GOPSTRUCTURE_NONUNIFORM, + /**< Default is open gop structure */ + IVC1ENC_GOPSTRUCTURE_UNIFORM = 1, + /**< Close Gop structure : BBIBBPBB*/ + IVC1ENC_GOPSTRUCTURE_MAX + +} IVC1ENC_GOPStructure; + +/** + + @enum IVC1ENC_BiasFactor + @brief Encoder uses bias b/w two possible choices for lot of decisions. + It is to control the mild/strongness of the biasing + +*/ +typedef enum { + IVC1_BIASFACTOR_LOW = 0, + /**< Low biasing */ + IVC1_BIASFACTOR_MEDIUM = 1, + /**< Normal/Med biasing */ + IVC1_BIASFACTOR_NORMAL = IVC1_BIASFACTOR_MEDIUM, + /**< Normal/Med biasing */ + IVC1_BIASFACTOR_DEFAULT = IVC1_BIASFACTOR_MEDIUM, + /**< Default :Normal/Med biasing*/ + IVC1_BIASFACTOR_HIGH = 2, + /**< High biasing */ + IVC1_BIASFACTOR_MILD = 4, /**< Mild biasing */ + IVC1_BIASFACTOR_ADAPTIVE = 5, /**< Adaptive biasing */ + IVC1_BIASFACTOR_MAX +} IVC1ENC_BiasFactor; + + +/** + * @enum IVC1ENC_InterlaceCodingType + * @brief Profile Identifier for VC1 Encoder +*/ +typedef enum { + IVC1_INTERLACE_PICAFF = 0, + /**< PicAFF type of interlace coding */ + IVC1_INTERLACE_FIELDONLY = 2, + /**< Field only coding with fixed partiy scheme */ + IVC1_INTERLACE_FIELDONLY_MRF = IVC1_INTERLACE_FIELDONLY, + /**< Use Most recent field for refernece */ + IVC1_INTERLACE_FIELDONLY_ARF = 3, + /**< codec decides the partiy of of the field to + * be used based upon content (adaptive) */ + IVC1_INTERLACE_DEFAULT = IVC1_INTERLACE_FIELDONLY_ARF, + /**< Default : adaptive partiy for reference */ + IVC1_INTERLACE_FIELDONLY_SPF = 4, + /**< Use same parity field for refernece */ + IVC1_INTERLACE_MAX + +} IVC1ENC_InterlaceCodingType; + +/** + + @enum IVC1ENC_FrameQualityFactor + @brief These enumerations control the quality factor b/w two types of frames + For example if user want I frame Quality to be given more importance + than P frame, one can define it to be higher quality factor + +*/ +typedef enum { + IVC1_QUALITY_FACTOR_1 = 0, /**< Same Quality factor + * b/w two types of frame + */ + IVC1_QUALITY_FACTOR_DEFAULT = IVC1_QUALITY_FACTOR_1, + /**< Default Quality factor + * to be used by encoder + */ + IVC1_QUALITY_FACTOR_2 = 1, /**< High Quality factor to + * one frame type b/w two types + of frame + */ + IVC1_QUALITY_FACTOR_3 = 2, /**< Higher Quality factor to + one frame type b/w two types of frame + */ + IVC1_QUALITY_FACTOR_MAX + +} IVC1ENC_FrameQualityFactor; + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* Definition of all the structures define by this interafce */ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/** + + @struct IVC1ENC_RateControlParams + @brief This structure contains all the parameters which controls Rate + Control behavior + + @param rateControlParamsPreset : + regarded @ IVC1ENC_DynamicParams::rateControlParams + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IVC1_RATECONTROLPARAMS_DEFAULT + + @param rcAlgo : ignored @ IVC1ENC_DynamicParams::rateControlParams + This defines the rate control algorithm to be used. Only useful + if IVIDENC2::rateControlPreset is set as IVIDEO_USER_DEFINED + + @param qpI : regarded @ IVC1ENC_DynamicParams::rateControlParams + Initial Quantization Parameter for I frames. + Valid Range is [-1,31] + 1 : Auto Initialization else other wise Initial QP. + when rateControlPreset = IVIDEO_NONE, this quantization parameter is + used by the whole video frame/field + + @param qpMaxI : regarded @ IVC1ENC_DynamicParams::rateControlParams + Maximum Quantization Parameter for I frame(s). Range [-1,31] + Useful to control a minimum quality level + + @param qpMinI : regarded @ IVC1ENC_DynamicParams::rateControlParams + Minimum Quantization Parameter for I frame(s). Range [-1,31] + Useful to control a maximum bit-rate level + + @param qpP : regarded @ IVC1ENC_DynamicParams::rateControlParams + Initial Quantization Parameter for P frames. Valid Range is [-1,31] + 1 : Auto Initialization else other wise Initial QP. + when rateControlPreset = IVIDEO_NONE, this quantization parameter is + used by the whole video frame/field + + @param qpMaxP : regarded @ IVC1ENC_DynamicParams::rateControlParams + Maximum Quantization Parameter for inter frame(s). Range [-1,31] + Useful to control a minimum quality level + + @param qpMinP : regarded @ IVC1ENC_DynamicParams::rateControlParams + Minimum Quantization Parameter for inter frame(s). Range [-1,31] + Useful to control a maximum bit-rate level + + @param qpOffsetB : regarded @ IVC1ENC_DynamicParams::rateControlParams + Offset of B frames Quantization Parameter from P frames. + Valid Range is [-1,31] + 1 : Auto Initialization else other wise user provided offset + if after adding the qpOffsetB into qp of P frame it exceeds 31 then + it is clipped to 31 + when rateControlPreset = IVIDEO_NONE, this offset parameter is + used by the whole video frame/field + + @param qpMaxB : regarded @ IVC1ENC_DynamicParams::rateControlParams + Maximum Quantization Parameter for B frame(s). Range [-1,31] + Useful to control a minimum quality level + + @param qpMinB : regarded @ IVC1ENC_DynamicParams::rateControlParams + Minimum Quantization Parameter for B frame(s). Range [-1,31] + Useful to control a maximum bit-rate level + + @param IPQualityFactor : ignored @ IVC1ENC_DynamicParams::rateControlParams + This provides configurality to control I frame Quality wrt to P frame. + Higher Quality factor means I frame quality is given higher + improtance compared to P frame. + Refer IVC1ENC_FrameQualityFactor for possible values + + @param initialBufferLevel : + ignored @ IVC1ENC_DynamicParams::rateControlParams + Initial Buffer level for HRD compliance. It informs that Hypothtical + decoder can start after how much time. The value taken is the + obsolute value of the HRD buffer size For example if user want + Hypothtical decoder to start taking out data from HRD buffer after + half second then it should set initialBufferLevel = half of the + HRD buffer size that is programmed. + + @param HRDBufferSize : regarded @ IVC1ENC_DynamicParams::rateControlParams + Hypothetical Reference Decoder Buffer Size. This size controls the + frame skip logic of the encoder. for low delay applications this + size should be small. Unit of this variable is bits + + @param minPicSizeRatio : regarded @ IVC1ENC_DynamicParams::rateControlParams + This ratio is used to compute minimum picture size + in the following manner, + minPicSize = averagePicSize >> minPicSizeRatio + allowed values 1 to 4, Setting this to 0 will enable + encoder chosen ratio. + Note that this is guided value to rate control to + determine min picture size and encoder may not + strictly follow this + @param maxPicSizeRatio : regarded @ IVC1ENC_DynamicParams::rateControlParams + To determines ratio for max picture size + This ratio is used to compute maximum picture size + in the following manner, + maxPicSize = averagePicSize * maxPicSizeRatio + allowed values 2 to 30.Setting this to 0 and 1 + will enable encoder chosen ratio. + Note that this is guided value to rate control + to determine max picture size and encoder may not + strictly follow this. + + @param enablePRC : regarded @ IVC1ENC_DynamicParams::rateControlParams + This flag is used to control allowing PRC in the frame + + @param enablePartialFrameSkip : regarded @ + IVC1ENC_DynamicParams::rateControlParams + This flag is used to control allowing partial frame + skip in the frame + @param reserved : 16 bit word, kept to not change the foot print + + @param reservedRC + Some part is kept reserved to add parameters later without + changing the foot print of interface memory + + @todo More parameters to be added : delay (VBV), PRC related etc.. + +*/ + +typedef struct IVC1ENC_RateControlParams { + XDAS_Int8 rateControlParamsPreset; + XDAS_Int8 rcAlgo; + XDAS_Int8 qpI; + XDAS_Int8 qpMaxI; + XDAS_Int8 qpMinI; + XDAS_Int8 qpP; + XDAS_Int8 qpMaxP; + XDAS_Int8 qpMinP; + XDAS_Int8 qpOffsetB; + XDAS_Int8 qpMaxB; + XDAS_Int8 qpMinB; + XDAS_Int8 IPQualityFactor; + XDAS_Int32 initialBufferLevel; + XDAS_Int32 HRDBufferSize; + XDAS_Int16 minPicSizeRatio; + XDAS_Int16 maxPicSizeRatio; + XDAS_Int8 enablePRC; + XDAS_Int8 enablePartialFrameSkip; + XDAS_Int8 discardSavedBits; + XDAS_Int16 reserved; + XDAS_Int32 reservedRC[3]; +} IVC1ENC_RateControlParams; + +/** + + @struct IVC1ENC_InterCodingParams + @brief This structure contains all the parameters which controls Inter MBs + coding behavior + @param interCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IVC1_INTERCODING_DEFAULT + @param searchRangeHorP :regarded @ IVC1ENC_DynamicParams::interCodingParams + Horizontal Search Range for P frames + @param searchRangeVerP :regarded @ IVC1ENC_DynamicParams::interCodingParams + Vertical Search Range for P frames + @param searchRangeHorB :regarded @ IVC1ENC_DynamicParams::interCodingParams + Horizontal Search Range for B frames + @param searchRangeVerB :regarded @ IVC1ENC_DynamicParams::interCodingParams + Vertical Search Range for B frames + @param minBlockSize :regarded @ IVC1ENC_DynamicParams::interCodingParams + minimum block size for P and B frames. Refer IVC1ENC_InterBlockSize + enumeration to see the valid values + @param skipMVCodingBias:regarded @ IVC1ENC_DynamicParams::interCodingParams + Bias Control for having a macro block use skip MV vs regular MV + refer IVC1ENC_BiasFactor for possible values +*/ + +typedef struct IVC1ENC_InterCodingParams { + XDAS_Int8 interCodingPreset; + XDAS_Int16 searchRangeHorP; + XDAS_Int16 searchRangeVerP; + XDAS_Int16 searchRangeHorB; + XDAS_Int16 searchRangeVerB; + XDAS_Int8 minBlockSize; + XDAS_Int8 skipMVCodingBias; + +} IVC1ENC_InterCodingParams; + +/** + @struct IVC1ENC_IntraCodingParams + @brief This structure contains all the parameters which controls Intra + encoding + + @param intraCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + INTRA_CODING_DEFAULT other wise INTRA_CODING_USER_DEFINED + @param intraRefreshMethod + Mechanism to do intra Refresh, see IVC1ENC_IntraRefreshMethods + for valid values + @param disableACPrediction + Flag to disable AC prediction + @param intraRefreshRate + Rate at which intra Refresh is done, This rate is specified as + One IntraMB per # MBs. For example if rate is 20 it means that + there has to be one intra MB(s) per 20 Mbs +*/ + +typedef struct IVC1ENC_IntraCodingParams { + XDAS_Int8 intraCodingPreset; + XDAS_Int8 intraRefreshMethod; + XDAS_Int8 disableACPrediction; + XDAS_Int16 intraRefreshRate; + +} IVC1ENC_IntraCodingParams; + +/** + + @struct IVC1ENC_SliceCodingParams + @brief This structure contains all the parameters which controls Slice + encoding + + @param sliceCodingPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IVC1_SLICECODING_DEFAULT + + @param sliceMode : regarded @ IVC1ENC_DynamicParams::sliceCodingParams + This defines the control mechanism to split a picture in slices. + It can be either MB based or bytes based + + @param sliceUnitSize : regarded @ IVC1ENC_DynamicParams::sliceCodingParams + parameter informs the number of offset information provided by user. + Actual offset are provided with sliceStartOffset + + @param insertPicParamsinSlice: Whether to insert picture header at the start + of each slice. + + @param sliceStartOffset[IVC1ENC_MAX_NUM_SLICE_START_OFFSET] : regarded @ + IVC1ENC_DynamicParams::sliceCodingParams row numbering is assumed to + start from 0. Entries in this array must have numbers in ascending + order. First slice of the picture is always starting from 0th row + of the picture so 0th entry is the offset of second slice in picture + Ex 1 : sliceStartRowNum[0] = 25 , + sliceStartRowNum[1] = 30, sliceStartRowNum[2] = 40 + will result into 4 slices starting from row# 0, 25, 30 and 40 + Ex 2 : sliceStartRowNum[0] = 25 , sliceStartRowNum[1] = 70, + sliceStartRowNum[2] = 60 is invalid + Ex 3 : sliceStartRowNum[0] = 25 , sliceStartRowNum[1] = 50, + sliceStartRowNum[2] = 100 + will result into 3 slices starting from row# 0, 25 and 50 + {if number of rows in picture < (100 + 1) } +*/ + +typedef struct IVC1ENC_SliceCodingParams { + XDAS_Int8 sliceCodingPreset; + XDAS_Int16 sliceMode; + XDAS_Int16 sliceUnitSize; + XDAS_Int8 insertPicParamsinSlice; + XDAS_Int8 sliceStartOffset[IVC1ENC_MAX_NUM_SLICE_START_OFFSET]; + +} IVC1ENC_SliceCodingParams; + +/** + + @struct IVC1ENC_LoopFilterParams + @brief This structure contains all the parameters which controls loop + filtering operations + + @param loopfilterPreset + This Preset controls the USER_DEFINED vs DEFAULT mode. if User is + not aware about following fields, it should be set as + IVC1_LOOPFILTER_DEFAULT + @param loopfilterDisableIDC + Controls VC-1 loop filter disabling options + +*/ +typedef struct IVC1ENC_LoopFilterParams { + XDAS_Int8 loopfilterPreset; + XDAS_Int8 loopfilterDisableIDC; + +} IVC1ENC_LoopFilterParams; + + +/**< This structure must be the first field of all VC1ENC instance objects */ +typedef struct IVC1ENC_Obj { + struct IVC1ENC_Fxns *fxns; +} IVC1ENC_Obj; + +/**< + + @struct IVC1ENC_Params + @brief This structure defines the Create time parameters for all + VC1ENC objects + + @param videnc2Params must be followed for all video encoders. + Base class create params + @param rateControlParams Controls all Rate Control related parameters + @param interCodingParams Controls all Inter coding related parameters + @param intraCodingParams Controls all Intra coding related parameters + @param sliceCodingParams Controls all Slice coding related parameters + @param loopFilterParams Controls the in-loop filtering process + + @param interlaceCodingType Controls the type of interlaced coding, refer + IVC1ENC_InterlaceCodingType for more details + @param bottomFieldIntra This field is valid only for interlaced sequences + 0 = Bottom field of the first I frame in the GOP encoded as + P field. + non-zero = Bottom field of the first I frame in the GOP encoded as I + field. + + @param gopStructure Defines the gop structure type: + uniform/non-uniform. For more information refer + IVC1ENC_GOPStructure + @param streamFormat Controls the stream format to enable/disable + headers. + @param pConstantMemory This pointer points to the the memory area where + constants are located. If this is set to NULL + then encoder assumes that all constants are + pointed by symbol VC1ENC_TI_ConstData + + @param maxIntraFrameInterval + This parameter contains the maximum Intra Frame + interval. It is used to reduce the memory + requirement of refernce Buffers. Because for all + I frame/field configuration the reference frame + buffers are not required + @param reservedParams Some part is kept reserved to add parameters + later without changing the foot print of + interface object memory +*/ + +typedef struct IVC1ENC_Params { + IVIDENC2_Params videnc2Params; + IVC1ENC_RateControlParams rateControlParams; + IVC1ENC_InterCodingParams interCodingParams; + IVC1ENC_IntraCodingParams intraCodingParams; + IVC1ENC_SliceCodingParams sliceCodingParams; + IVC1ENC_LoopFilterParams loopFilterParams; + + XDAS_Int8 interlaceCodingType; + XDAS_Int8 bottomFieldIntra; + XDAS_Int8 gopStructure; + XDAS_Int8 streamFormat; + XDAS_Int32 pConstantMemory; + XDAS_Int32 maxIntraFrameInterval; + XDAS_Int32 reservedParams[4]; + +} IVC1ENC_Params; + + +/**< + + @struct IVC1ENC_Status + @brief This structure informs back the status of VC1 encoder and tells the + value of each control parameter + + @param videnc2Status : must be followed for all video encoders. + : Base class status + @param rateControlParams : Controls all Rate Control related parameters + @param interCodingParams : Controls all Inter coding related parameters + @param intraCodingParams : Controls all Intra coding related parameters + @param sliceCodingParams : Controls all Slice coding related parameters + @param loopFilterParams : Controls the in-loop filtering process + + @param interlaceCodingType : Controls the type of interlaced coding + @param bottomFieldIntra : This field valid only for interlaced sequences + 0 = Bottom field of the first I frame in the + GOP encoded as P field. + non-zero = Bottom field of the first I frame in + the GOP encoded as I field. + @param gopStructure : Defines the gop structure type: Open/Close. + @param maxIntraFrameInterval: This parameter contains the maximum Intra Frame + interval. It is used to reduce the memory + requirement of refernce Buffers. Because for + all I frame/field configuration the reference + frame buffers are not required + @param searchCenter : seacrh Center for motion estimation + @param reservedStatus : Some part is kept reserved to add parameters + later without changing the foot print of + interface memory +*/ + +typedef struct IVC1ENC_Status { + IVIDENC2_Status videnc2Status; + IVC1ENC_RateControlParams rateControlParams; + IVC1ENC_InterCodingParams interCodingParams; + IVC1ENC_IntraCodingParams intraCodingParams; + IVC1ENC_SliceCodingParams sliceCodingParams; + IVC1ENC_LoopFilterParams loopFilterParams; + + XDAS_Int8 interlaceCodingType; + XDAS_Int8 bottomFieldIntra; + XDAS_Int8 gopStructure; + XDAS_Int32 maxIntraFrameInterval; + XDM_Point searchCenter; + XDAS_Int32 reservedStatus[4]; + +} IVC1ENC_Status; + +/**< + + @struct IVC1ENC_DynamicParams + @brief This structure defines the run time parameters for all VC1ENC objects + + @param videnc2DynamicParams must be followed for all video encoders + @param rateControlParams Controls all Rate Control related parameters. + only few are supported to be changed as + part @ Control call. Refer + IVC1ENC_RateControlParams to find out + @param interCodingParams Controls all inter MB coding related parameters. + only few are supported to be changed as + part @ Control call. Refer interCodingParams to + find out + @param sliceCodingParams Controls all Slice coding related parameters. + only few are supported to be changed as + part @ Control call. + Refer sliceCodingParams to find out + @param searchCenter seacrh Center for motion estimation. + XDM_Point.x == 0xFFFF means ignore searchCenter + @param reservedDynParams Some part is kept reserved to add parameters + later without changing the foot print of + interface memory +*/ + +typedef struct IVC1ENC_DynamicParams { + + IVIDENC2_DynamicParams videnc2DynamicParams; + IVC1ENC_RateControlParams rateControlParams; + IVC1ENC_InterCodingParams interCodingParams; + IVC1ENC_SliceCodingParams sliceCodingParams; + XDM_Point searchCenter; + XDAS_Int32 reservedDynParams[4]; + +} IVC1ENC_DynamicParams; + +/**< + + @struct IVC1ENC_InArgs + @brief This structure defines the input argument being passed to + VC1 encoder + + @param videnc2InArgs : It is instance of base class. It contains all + the necessary info required run time parameters for + all VC1ENC objects + +*/ +typedef struct IVC1ENC_InArgs { + + IVIDENC2_InArgs videnc2InArgs; + +} IVC1ENC_InArgs; + +/**< + + @struct IVC1ENC_OutArgs + @brief This structure defines the outpur argument being generated from VC1 + encoder + + @param videnc2OutArgs : It is instance of base class. It contains all + the necessary info encoder should produce + @param vbvBufferLevel: This variable tells the buffer level at the end of + every picture from decoder perspective.the value + populated in this variable is latest for every + process call +*/ +typedef struct IVC1ENC_OutArgs { + + IVIDENC2_OutArgs videnc2OutArgs; + XDAS_Int32 vbvBufferLevel; +} IVC1ENC_OutArgs; + +/**< + + IVC1ENC_Cmd:This structure defines of the control commands for VC1ENC objects +*/ + +typedef IVIDENC2_Cmd IVC1ENC_Cmd; + +/**< + + @struct IVC1ENC_Fxns + @brief This structure defines of the operations on VC1ENC objects + + @param IVIDENC2_Fxns : It is instance of base class. It contains all + function table + +*/ +typedef struct IVC1ENC_Fxns { + IVIDENC2_Fxns ividenc; + +} IVC1ENC_Fxns; + + +/** +#include +#include + +/******************************************************************************* +* MACROS +*******************************************************************************/ + +/* + * Some of the operations performed by the control call + */ +#define IVC1VDEC_GETSTATUS XDM_GETSTATUS +#define IVC1VDEC_SETPARAMS XDM_SETPARAMS +#define IVC1VDEC_RESET XDM_RESET +#define IVC1VDEC_FLUSH XDM_FLUSH +#define IVC1VDEC_SETDEFAULT XDM_SETDEFAULT +#define IVC1VDEC_GETBUFINFO XDM_GETBUFINFO + +/* + * Macro defining the minimum version length of VC-1 decoder + */ +#define IVC1DEC_VERSION_LENGTH (200) + + +/******************************************************************************* +* PUBLIC DECLARATIONS Note: Defined here, used elsewhere +*******************************************************************************/ + +typedef enum +{ + /* Error bit for unsupported VIDDEC3PARAMS */ + IVC1DEC_ERR_UNSUPPORTED_VIDDEC3PARAMS = 0, + /* Error bit for unsupported VIDDEC3 Dynamic PARAMS */ + IVC1DEC_ERR_UNSUPPORTED_VIDDEC3DYNAMICPARAMS, + /* Error bit for unsupported VC1 VIDDEC3 Dynamic PARAMS */ + IVC1DEC_ERR_UNSUPPORTED_VC1DECDYNAMICPARAMS, + /* Error bit for improper data sync setting */ + IVC1DEC_ERR_IMPROPER_DATASYNC_SETTING, + /* Error bit for no slice */ + IVC1DEC_ERR_NOSLICE, + /* Error bit for slice header corruption */ + IVC1DEC_ERR_SLICEHDR, + /* Error bit for MB data corruption */ + IVC1DEC_ERR_MBDATA, + /* Error bit for unsupported VC1 feature */ + IVC1DEC_ERR_UNSUPPFEATURE, + /* Error bit for end of steam */ + IVC1DEC_ERR_STREAM_END = 16, + /* Error bit for unsupported resolution */ + IVC1DEC_ERR_UNSUPPRESOLUTION, + /* Error bit for IVAHD standby */ + IVC1DEC_ERR_STANDBY, + /* Error bit for invalid mailbox message */ + IVC1DEC_ERR_INVALID_MBOX_MESSAGE, + /* Error bit for sequence header corruption */ + IVC1DEC_ERR_SEQHDR, + /* Error bit for entry point header corruption */ + IVC1DEC_ERR_ENTRYHDR, + /* Error bit for picture header corruption */ + IVC1DEC_ERR_PICHDR, + /* Error bit for Ref picture Buffer */ + IVC1DEC_ERR_REF_PICTURE_BUFFER, + /* Error bit if there is no sequence header start code */ + IVC1DEC_ERR_NOSEQUENCEHEADER, + /* Error bit for invalid values of input/output buffer descriptors */ + IVC1DEC_ERR_BUFDESC = 30, + /* Error bit for picture size change. It will be set for a multiresolution */ + /* Stream */ + IVC1DEC_ERR_PICSIZECHANGE = 31 + +}Ivc1VDEC_ExtendedCommonErrorCodes; + +/** +******************************************************************************** + * @enum IVC1VDEC_ERROR_STATUS + * + * @brief This enum defines the 128 codec specific error status bits + * in VC-1 decoder. + * + * @note None: + * +******************************************************************************** +*/ +typedef enum +{ + /* Error bit for invalid dynamic params structure size */ + VC1_DYNAMIC_PARAMS_SIZE_ERROR = 0, + /* Error bit for decode header only mode */ + VC1_DECODE_HEADER_ERROR, + /* Error bit for invalid display width */ + VC1_DISPLAY_WIDTH_ERROR, + /* Error bit for invalid frame skip mode */ + VC1_FRAME_SKIP_MODE_ERROR, + /*Error bit for new frame flag */ + VC1_NEW_FRAME_FLAG_ERROR, + /* Error bit for datasync mode */ + VC1_PUT_DATA_FXN_ERROR, + /* Error bit for datasync mode */ + VC1_PUT_DATA_HANDLE_ERROR, + /* Error bit for datasync mode */ + VC1_GET_DATA_FXN_ERROR, + /* Error bit for datasync mode */ + VC1_GET_DATA_HANDLE_ERROR, + /* Error bit for datasync mode */ + VC1_PUT_BUFFER_FXN_ERROR, + /* Error bit for datasync mode */ + VC1_PUT_BUFFER_HANDLE_ERROR, + /* Error bit for late acquire argument */ + VC1_LATE_ACQUIRE_ARG_ERROR, + /* Error bit for inargs pointers */ + VC1_NULL_INARGS_POINTER_ERROR, + /* Error bit for inargs size */ + VC1_INARGS_SIZE_ERROR, + /* Error bit for invalid input bytes */ + VC1_INVALID_INPUT_BYTES_ERROR, + /* Error bit for invalid input bytes in flush mode */ + VC1_INVALID_INPUT_BYTES_IN_FLUSH_MODE_ERROR, + /* Error bit for invalid input ID */ + VC1_INVALID_INPUT_ID_ERROR, + /* Error bit for NULL instance handle */ + VC1_NULL_INSTANCE_HANDLE_ERROR, + /* Error bit if decoder is not initialized */ + VC1_DECODER_NOT_INITIALIZED_ERROR, + /* Error bit for invalid input buffer descriptor */ + VC1_INVALID_INPUT_BUF_DESC_ERROR, + /* Error bit for invalid input buffer pointer */ + VC1_INVALID_INPUT_BUFFER_POINTER_ERROR, + /* Error bit for invalid input buffer size */ + VC1_INVALID_INPUT_BUFFER_SIZE_ERROR, + /* Error bit for invalid number of input buffer */ + VC1_INVALID_NUM_OF_INPUT_BUFFERS_ERROR, + /* Error bit for excess number of input buffers */ + VC1_EXCESS_NUM_OF_INPUT_BUFFERS_ERROR, + /* Error bit for invalid memory type of input buffer */ + VC1_INVALID_INPUT_BUFFER_MEMTYPE_ERROR, + /* Error bit for invalid outargs pointer */ + VC1_INVALID_OUTARGS_POINTER_ERROR, + /* Error bit for invalid outargs size */ + VC1_INVALID_OUTARGS_SIZE, + /* Error bit for invalid output buffer descriptor pointer */ + VC1_INVALID_OUTPUT_BUF_DESC_POINTER_ERROR, + /* Error bit for invalid output buffer descriptor */ + VC1_INVALID_OUTPUT_BUF_DESC_ERROR, + /* Error bit for invalid output buffer */ + VC1_INVALID_NUM_OF_OUTPUT_BUFFERS_ERROR, + /* Error bit for invalid luma output buffer pointer */ + VC1_INVALID_OUTPUT_BUFFER0_POINTER_ERROR, + /* Error bit for invalid luma output buffer size */ + VC1_INVALID_OUTPUT_BUFFER0_SIZE_ERROR, + /* Error bit for invalid luma output buffer memory type */ + VC1_INVALID_OUTPUT_BUFFER0_MEMTYPE_ERROR, + /* Error bit for invalid chroma output buffer pointer */ + VC1_INVALID_OUTPUT_BUFFER1_POINTER_ERROR, + /* Error bit for invalid chroma output buffer size */ + VC1_INVALID_OUTPUT_BUFFER1_SIZE_ERROR, + /* Error bit for invalid chroma output buffer memory type */ + VC1_INVALID_OUTPUT_BUFFER1_MEMTYPE_ERROR, + /* Error bit for invalid output buffer2 pointer */ + VC1_INVALID_OUTPUT_BUFFER2_POINTER_ERROR, + /* Error bit for invalid output buffer2 size */ + VC1_INVALID_OUTPUT_BUFFER2_SIZE_ERROR, + /* Error bit for invalid output buffer2 memory type */ + VC1_INVALID_OUTPUT_BUFFER2_MEMTYPE_ERROR, + /* Error bit for invalid buffre usage mode */ + VC1_INVALID_BUFFER_USAGE_MODE, + /* Error bit for invalid tiled width for output buffer0 */ + VC1_INVALID_OUTPUT_BUFFER0_TILED_WIDTH_ERROR, + /* Error bit for invalid tiled height for output buffer0 */ + VC1_INVALID_OUTPUT_BUFFER0_TILED_HEIGHT_ERROR, + /* Error bit for invalid tiled width for output buffer1 */ + VC1_INVALID_OUTPUT_BUFFER1_TILED_WIDTH_ERROR, + /* Error bit for invalid tiled height for output buffer1 */ + VC1_INVALID_OUTPUT_BUFFER1_TILED_HEIGHT_ERROR, + /* Error bit for invalid tiled width for output buffer2 */ + VC1_INVALID_OUTPUT_BUFFER2_TILED_WIDTH_ERROR, + /* Error bit for invalid tiled height for output buffer2 */ + VC1_INVALID_OUTPUT_BUFFER2_TILED_HEIGHT_ERROR, + /* Error bit for invalid ref picture buffer */ + VC1_INVALID_REF_PICTURE_BUFFER, + /* Error bit for invalid profile */ + VC1_SEQ_HDR_INVALID_PROFILE = 64, + /* Error bit for invalid invalid level bits */ + VC1_SEQ_HDR_INVALID_LEVEL, + /* Error bit for invalid color diff format */ + VC1_SEQ_HDR_INVALID_COLORDIFF_FORMAT, + /* Error bit for invalid max coded width */ + VC1_SEQ_HDR_INVALID_MAX_CODED_WIDTH, + /* Error bit for invalid max code height */ + VC1_SEQ_HDR_INVALID_MAX_CODED_HEIGHT, + /* Error bit for invalid reserved bits */ + VC1_SEQ_HDR_INVALID_RESERVED, + /* Error bit for invalid aspect ratio */ + VC1_SEQ_HDR_INVALID_ASPECT_RATIO, + /* Error bit for invalid frame rate numerator bits */ + VC1_SEQ_HDR_INVALID_FRAMERATENR, + /* Error bit for invalid frame rate denominator bits */ + VC1_SEQ_HDR_INVALID_FRAMERATEDR, + /* Error bit for invalid color prim bits */ + VC1_SEQ_HDR_INVALID_COLOR_PRIM, + /* Error bit for invalid transfer character bits */ + VC1_SEQ_HDR_INVALID_TRANSFER_CHAR, + /* Error bit for invalid matrix coefficient bits */ + VC1_SEQ_HDR_INVALID_MATRIX_COEF, + /* Error bit for invalid loop filter bits */ + VC1_SEQ_HDR_INVALID_LOOPFILTER, + /* Error bit for invalid FASTUVMC bits */ + VC1_SEQ_HDR_INVALID_FASTUVMC, + /* Error bit for invalid Extended MV bits */ + VC1_SEQ_HDR_INVALID_EXTENDED_MV, + /* Error bit for invalid DQUANT bits */ + VC1_SEQ_HDR_INVALID_DQUANT, + /* Error bit for invalid sync marker bits */ + VC1_SEQ_HDR_INVALID_SYNCMARKER, + /* Error bit for invalid rang reduction bits */ + VC1_SEQ_HDR_INVALID_RANGERED, + /* Error bit for invalid max number of B frame bits */ + VC1_SEQ_HDR_INVALID_MAXBFRAMES, + /* Error bit for invalid DQUANT in entry point header */ + VC1_ENTRY_PNT_HDR_INVALID_DQUANT, + /* Error bit for invalid coded width */ + VC1_ENTRY_PNT_HDR_INVALID_CODED_WIDTH, + /* Error bit for invalid coded height */ + VC1_ENTRY_PNT_HDR_INVALID_CODED_HEIGHT, + /* Error bit for invalid PTYPE */ + VC1_PIC_HDR_INVALID_PTYPE, + /* Error bit for invalid PQINDEX */ + VC1_PIC_HDR_INVALID_PQINDEX, + /* Error bit for invalid MVRANGE */ + VC1_PIC_HDR_INVALID_MVRANGE, + /* Error bit for invalid RESPIC */ + VC1_PIC_HDR_INVALID_RESPIC, + /* Error bit for invalid FCM bits */ + VC1_PIC_HDR_INVALID_FCM, + /* Error bit for invalid RNDCTRL bits */ + VC1_PIC_HDR_INVALID_RNDCTRL, + /* Error bit for invalid MVMODE bits */ + VC1_PIC_HDR_INVALID_MVMODE, + /* Error bit for invalid DMVRANGE bits */ + VC1_PIC_HDR_INVALID_DMVRANGE, + /* Error bit for invalid BFRACTION bits */ + VC1_PIC_HDR_INVALID_BFRACTION, + /* Error bit for invalid REFDIST bits */ + VC1_PIC_HDR_INVALID_REFDIST, + /* Error bit for invalid number of MBs in a picture */ + VC1_ERR_MBNUMB, + /* Error bit for invalid SCALERES bits */ + VC1_ERR_SCALERES, + /* Error bit for invalid ALTPQUANT bits */ + VC1_ERR_ALTPQUANT, + /* Error bit for invalid ABSPQ bits */ + VC1_VOPDQUANT_INVALID_ABSPQ, + /* Error bit for invalid slice address bits */ + VC1_SLC_HDR_INVALID_SLICE_ADDR, + /* Error bit for improper IVAHD reset */ + VC1_IMPROPER_RESET, + /* Error bit for improper standby */ + VC1_IMPROPER_STANDBY, + /* Error bit MB error */ + VC1_ECD_MB_ERROR, + /* No Sequence header start code */ + VC1_NO_SEQUENCE_STARTCODE + +}IVC1VDEC_ERROR_STATUS; + + + +/** +******************************************************************************** +* +* @enum IVC1VDEC_mbErrStatus +* +* @brief This enum indicates if a MB was in error or not +* +******************************************************************************** +**/ +typedef enum + +{ + /* MB was non-erroneous */ + IVC1VDEC_MB_NOERROR = 0, + /* MB was erroneous */ + IVC1VDEC_MB_ERROR = 1 + +} IVC1VDEC_mbErrStatus; + +/** +******************************************************************************** +* @struct IVC1VDEC_TI_MbInfo +* +* @brief MB information structure that is written out by the IVA-HD hardware. +* +* @note None: +* +******************************************************************************** +*/ +typedef struct IVC1VDEC_TI_MbInfo +{ + /* MB address */ + XDAS_UInt8 mb_addr; + /* Error flag */ + XDAS_UInt8 error_flag; + /* First MB flag */ + XDAS_UInt8 first_mb_flag; + /* Picture bound */ + XDAS_UInt8 pic_bound_b; + /* Upper picture bound */ + XDAS_UInt8 pic_bound_u; + /* Right picture bound */ + XDAS_UInt8 pic_bound_r; + /* Left picture bound */ + XDAS_UInt8 pic_bound_l; + /* Availability of upper right MB */ + XDAS_UInt8 mb_ur_avail; + /* Availability of upper MB */ + XDAS_UInt8 mb_uu_avail; + /* Availability of upper left MB */ + XDAS_UInt8 mb_ul_avail; + /* Availability of left MB */ + XDAS_UInt8 mb_ll_avail; + /* Macroblock header format type */ + XDAS_UInt8 fmt_type; + /* Codec type */ + XDAS_UInt8 codec_type; + /* Indicates DC values of each Y block in current MB */ + XDAS_UInt8 dc_coef_q_y[4]; + /* Indicates DC values of Cr block in current MB */ + XDAS_UInt8 dc_coef_q_cr; + /* Indicates DC values of Cb block in current MB */ + XDAS_UInt8 dc_coef_q_cb; + /* Block type of cr block */ + XDAS_UInt8 block_type_cr; + /* Block type of cb block */ + XDAS_UInt8 block_type_cb ; + /* Block types of luma */ + XDAS_UInt8 block_type_y[4]; + /* In decoding, if the current macroblock is the last macroblock in a slice,*/ + /* ECD sets 1 to this field during executing the macroblock. Otherwise, ECD */ + /* sets 0 to this field */ + XDAS_UInt8 end_of_slice; + /* 1 : allow skipping current MB if CBP = 0 */ + XDAS_UInt8 cond_skip_flag; + /* Skipped / non skipped MB */ + XDAS_UInt8 skip; + /* 1 indicates that overlap filtering is in use for the macroblock. */ + XDAS_UInt8 overlap; + /* 1 indicates that AC prediction is in use for the macroblock */ + XDAS_UInt8 acpred; + /* Denotes inter-prediction direction for the macroblock in B-picture */ + XDAS_UInt8 b_picture_direction; + /* Denotes the number of motion vectors. */ + XDAS_UInt8 mv_mode; + /* 1 indicates that the field transform is in use for the macroblock. */ + XDAS_UInt8 fieldtx ; + /* 1 indicates that field inter-prediction is in use */ + XDAS_UInt8 mv_type; + /* Equals the reference frame distance */ + XDAS_UInt8 refdist; + /* 1 indicates that macroblock quantizer-scale (MQUANT) overflows */ + XDAS_UInt8 mquant_overflow; + /* Equals the quantizer-scale for the macroblock */ + XDAS_UInt8 quant; + /* 1 indicates that 0.5 shall be added to PQUANT in calculation of */ + /* quantizer-scale. This field is valid for decoding only. */ + XDAS_UInt8 halfqp; + /* Equals the DC coefficient step size which is derived from MQUANT in the */ + /* bit-stream */ + XDAS_UInt8 dc_step_size; + /* Denotes the coded sub-block pattern for cr block */ + XDAS_UInt8 cbp_cr ; + /* Denotes the coded sub-block pattern for cb block */ + XDAS_UInt8 cbp_cb; + /* Denotes the coded sub-block pattern for luma blocks */ + XDAS_UInt8 cbp_y[3]; + /* Denotes the backward reference field picture */ + XDAS_UInt8 mv_bw_ref_y[4]; + /* Denotes the forward reference field picture */ + XDAS_UInt8 mv_fw_ref_y[3] ; + /* Unclipped forward motion vector for luma */ + XDAS_UInt8 mv_fw_y[4][4] ; + /* Unclipped backward motion vector for luma */ + XDAS_UInt8 mv_bw_y[1][1]; + /* Unclipped backward motion vector for chroma */ + XDAS_UInt8 mv_bw_c[2] ; + /* Unclipped forward motion vector for chroma */ + XDAS_UInt8 mv_fw_c[2] ; + /* Clipped forward motion vector for luma */ + XDAS_UInt8 cmv_fw_y[4][4] ; + /* Clipped backward motion vector for luma */ + XDAS_UInt8 cmv_bw_y[4][4] ; + /* Clipped forward motion vector for chroma */ + XDAS_UInt8 cmv_fw_c[4][4] ; + /* Clipped backward motion vector for chroma */ + XDAS_UInt8 cmv_bw_c[4][4]; + +}IVC1VDEC_TI_MbInfo; + +/** +******************************************************************************** +* @struct IVC1VDEC_Obj +* +* @brief Object defnition of the VC-1 decoder algorithm.This structure +* must be the first field of all VC1VDEC instance objects. +* +* @param fxns: Pointer to the structure defining all the ividdec3 +* interface operations to be performed on the VC-1 decoder +* object. +******************************************************************************** +*/ +typedef struct IVC1VDEC_Obj { + + struct IVC1VDEC_Fxns *fxns; + +} IVC1VDEC_Obj; + +/** +******************************************************************************** +* @struct IVC1VDEC_Handle +* +* @brief Handle to the VC-1 decoder instance object. +* +******************************************************************************** +*/ +typedef struct IVC1VDEC_Obj *IVC1VDEC_Handle; + +/** +******************************************************************************** +* @struct IVC1VDEC_Status +* +* @brief This structure defines parameters that describe the status of the +* VC-1 Decoder and any other implementation specific parameters. +* The status parameters are defined in the XDM data structure, +* IVIDDEC3_Status +* +* @param viddecStatus : XDM Base class status structure (see ividdec3.h) +* +******************************************************************************** +*/ +typedef struct IVC1VDEC_Status +{ + IVIDDEC3_Status viddecStatus; + /*--------------------------------------------------------------------------*/ + /* Extended Error Code0 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode0; + /*--------------------------------------------------------------------------*/ + /* Extended Error Code1 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode1; + /*--------------------------------------------------------------------------*/ + /* Extended Error Code2 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode2; + /*--------------------------------------------------------------------------*/ + /* Extended Error Code3 returned by decoder */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extendedErrorCode3; + /*--------------------------------------------------------------------------*/ + /* Debug trace level configured for the codec */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 debugTraceLevel; + /*--------------------------------------------------------------------------*/ + /* Number of frames for which history information is maintained by the */ + /* codec */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 lastNFramesToLog; + /*--------------------------------------------------------------------------*/ + /* External memory address (as seen by M3) where debug trace information is */ + /* being dumped */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 * extMemoryDebugTraceAddr; + /*--------------------------------------------------------------------------*/ + /* External memory buffer size (in bytes) where debug trace information is */ + /* being dumped */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 extMemoryDebugTraceSize; +} IVC1VDEC_Status; + + +/** +******************************************************************************** +* @struct IVC1VDEC_Params +* +* @brief This structure defines the creation parameters for all VC-1 decoder +* objects. This structure includes the xdm baseclass creation +* parameters and any other implementation specific parameters for +* VC-1 Decoder instance object. +* +* @param viddec3Params: XDM Baselass create time parameters. +* (see ividdec3.h) +* +******************************************************************************** +*/ +typedef struct IVC1VDEC_Params +{ + IVIDDEC3_Params viddecParams; + /*--------------------------------------------------------------------------*/ + /*Enable/Disable Error Concealment */ + /* enumeration 'eFrameErrorConcealment' can be used to set this value */ + /*--------------------------------------------------------------------------*/ + XDAS_Int32 errorConcealmentON; + /*--------------------------------------------------------------------------*/ + /* Flag to indicate that whether the application is providing the frame */ + /* layer data structure in case of simple & main profile */ + /*--------------------------------------------------------------------------*/ + XDAS_Int32 frameLayerDataPresentFlag; + /*--------------------------------------------------------------------------*/ + /* This parameter configures the codec to dump a debug trace log */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 debugTraceLevel; + /*--------------------------------------------------------------------------*/ + /* This parameters configures the codec to maintain history of debug trace */ + /* parameters for last N frames. */ + /*--------------------------------------------------------------------------*/ + XDAS_UInt32 lastNFramesToLog; + +} IVC1VDEC_Params; + +/** +******************************************************************************** +* @struct IH264VDEC_DynamicParams +* +* @brief This structure defines the run-time parameters and any other +* implementation specific parameters for an H.264 instance object. +* The base run-time parameters are defined in the XDM data structure, +* IVIDDEC3_DynamicParams. +* +* @param viddecDynamicParams : XDM Base class dynamic structure +* (see ividdec3.h) +* +* @param outloopDeblocking : Out loop deblocking flag to be enabled +* for simple profile dynamically at frame level +* +* @param calc_sw_workaround: Flag used for switching the CALC software +* work around ON or OFF. +* +******************************************************************************** +*/ +typedef struct IVC1VDEC_DynamicParams +{ + IVIDDEC3_DynamicParams viddecDynamicParams; +} IVC1VDEC_DynamicParams; + + +/** +******************************************************************************** +* @struct IVC1VDEC_InArgs +* +* @brief This structure defines the run-time input arguments for an VC-1 +* decoder process function. +* +* @param viddec3InArgs : XDM Base class InArgs structure (see ividdec3.h) +* +******************************************************************************** +*/ +typedef struct IVC1VDEC_InArgs +{ + IVIDDEC3_InArgs viddecInArgs; +}IVC1VDEC_InArgs; + + +/** +******************************************************************************** +* @struct IVC1VDEC_OutArgs +* +* @brief This structure defines the run time output arguments for VC-1 +* decoder process function. +* +* @param viddecOutArgs : XDM Base class OutArgs structure (see ividdec3.h) +* +******************************************************************************** +*/ +typedef struct IVC1VDEC_OutArgs +{ + IVIDDEC3_OutArgs viddecOutArgs; + +} IVC1VDEC_OutArgs; + +/** +******************************************************************************** +* @struct IVC1VDEC_Fxns +* +* @brief This structure contains pointers to all the XDAIS and XDM interface +* functions +* +* @param ividdec : This structure contains pointers to all the XDAIS and +* XDM interface functions +******************************************************************************** +*/ +typedef struct IVC1VDEC_Fxns +{ + IVIDDEC3_Fxns ividdec; +} IVC1VDEC_Fxns; + + + +/** +******************************************************************************** + * @fn VC1VDEC_TI_decode(IVIDDEC3_Handle handle, + * XDM2_BufDesc *inptr, + * XDM2_BufDesc *outptr, + * IVIDDEC3_InArgs *inargs, + * IVIDDEC3_OutArgs *outargs) + * + * @brief TI's(Texas Instrument) implementation of the process API defined + * by XDM for the VC-1 Decoder.This process function is responsible + * for the decode of a given frame. + * + * @param handle + * Handle to an algorithm instance object + * + * @param *inptr + * Pointer to input buffer structure. + * + * @param *outptr + * Pointer to output buffer structure. + * + * @param *inargs + * Pointer to input arguments structure. + * + * @param *outargs + * Pointer to output arguments structure. + * + * @return XDM_EOK/XDM_EFAIL +******************************************************************************** +*/ +XDAS_Int32 VC1VDEC_TI_decode(IVIDDEC3_Handle handle, + XDM2_BufDesc *inptr, + XDM2_BufDesc *outptr, + IVIDDEC3_InArgs *inargs, + IVIDDEC3_OutArgs *outargs); + + + /** + ******************************************************************************* + * @fn VC1VDEC_TI_control (IVIDDEC3_Handle handle, + * IVIDDEC3_Cmd cmd, + * IVIDDEC3_DynamicParams * params, + * IVIDDEC3_Status * status) + * + * @brief Control API for the VC-1 decoder, to control various object + * parameters.Some of the operations which can be performed by control + * call are, + * i)Get status of various elements defined in the IVC1dec_Status. + * ii)Set the parameters in the structure IVC1dec_DyanmicParams + * iii)Reset the algorithm. + * iV)Set predefined defaults. + * V)Flush buffers held by the system. + * + * @param[in] handle: Pointer to algorithm instance object. + * + * @param[in] cmd: Command specifying the operations to be performed. + * + * @param[in] params: Pointer to the IVIDDEC3_DynamicParams struct. + * + * @param[in] status: Pointer to the IVIDDEC1_Status struct. + * + * @return Pass or Fail (IALG_EOK / IALG_EFAIL) + * + ******************************************************************************* +*/ +XDAS_Int32 VC1VDEC_TI_control (IVIDDEC3_Handle handle, + IVIDDEC3_Cmd cmd, + IVIDDEC3_DynamicParams * params, + IVIDDEC3_Status * status); + + +/** +****************************************************************************** + * ======== IVC1VDEC_Params ======== + * Default Create parameter values for VC1VDEC instance objects +******************************************************************************** +*/ +extern const IVC1VDEC_Params VC1VDEC_TI_PARAMS; +/** +****************************************************************************** + * ======== IVC1VDEC_DynamicParams ======== + * Default DynamicParams values for VC1VDEC instance objects +******************************************************************************** +*/ +extern const IVC1VDEC_DynamicParams VC1VDEC_TI_DYNAMICPARAMS; + +/******************************************************************************* +* EXTERNAL REFERENCE Note: use only if not found in header file +*******************************************************************************/ + + +extern IVC1VDEC_Fxns VC1VDEC_TI_IVC1VDEC; + +extern IVIDDEC3_Fxns VC1VDEC_TI_IVIDDECFUNCTIONS; + + + +#endif /* IVC1VDEC_ */ diff --git a/packages/xdais/ti/xdais/dm/ividdec3.h b/packages/xdais/ti/xdais/dm/ividdec3.h new file mode 100755 index 0000000..938a14c --- /dev/null +++ b/packages/xdais/ti/xdais/dm/ividdec3.h @@ -0,0 +1,1011 @@ +/* + * Copyright (c) 2006-2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file ti/xdais/dm/ividdec3.h + * + * @brief This header defines all types, constants, and functions + * shared by all implementations of the video decoder + * algorithms. + */ +/** + * @defgroup ti_xdais_dm_IVIDDEC3 IVIDDEC3 - XDM Video Decoder Interface + * + * This is the XDM IVIDDEC3 Video Decoder Interface. + */ + +#ifndef ti_xdais_dm_IVIDDEC3_ +#define ti_xdais_dm_IVIDDEC3_ + +#include +#include +#include "xdm.h" +#include "ivideo.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup ti_xdais_dm_IVIDDEC3 */ +/*@{*/ + +#define IVIDDEC3_EOK XDM_EOK /**< @copydoc XDM_EOK */ +#define IVIDDEC3_EFAIL XDM_EFAIL /**< @copydoc XDM_EFAIL */ +#define IVIDDEC3_EUNSUPPORTED XDM_EUNSUPPORTED /**< @copydoc XDM_EUNSUPPORTED */ + +/** + * @brief This must be the first field of all IVIDDEC3 + * instance objects + */ +typedef struct IVIDDEC3_Obj { + struct IVIDDEC3_Fxns *fxns; +} IVIDDEC3_Obj; + + +/** + * @brief Opaque handle to an IVIDDEC3 objects + */ +typedef struct IVIDDEC3_Obj *IVIDDEC3_Handle; + + +/** + * @brief Video decoder output frame order + * + * @enumWarning + * + * @sa IVIDDEC3_Params.displayDelay + * + */ +typedef enum { + IVIDDEC3_DISPLAY_DELAY_AUTO = -1, /**< Decoder decides the display delay */ + IVIDDEC3_DECODE_ORDER = 0, /**< Display frames are in decoded order without delay */ + IVIDDEC3_DISPLAY_DELAY_1 = 1, /**< Display the frames with 1 frame delay */ + IVIDDEC3_DISPLAY_DELAY_2 = 2, /**< Display the frames with 2 frames delay */ + IVIDDEC3_DISPLAY_DELAY_3 = 3, /**< Display the frames with 3 frames delay */ + IVIDDEC3_DISPLAY_DELAY_4 = 4, /**< Display the frames with 4 frames delay */ + IVIDDEC3_DISPLAY_DELAY_5 = 5, /**< Display the frames with 5 frames delay */ + IVIDDEC3_DISPLAY_DELAY_6 = 6, /**< Display the frames with 6 frames delay */ + IVIDDEC3_DISPLAY_DELAY_7 = 7, /**< Display the frames with 7 frames delay */ + IVIDDEC3_DISPLAY_DELAY_8 = 8, /**< Display the frames with 8 frames delay */ + IVIDDEC3_DISPLAY_DELAY_9 = 9, /**< Display the frames with 9 frames delay */ + IVIDDEC3_DISPLAY_DELAY_10 = 10, /**< Display the frames with 10 frames delay */ + IVIDDEC3_DISPLAY_DELAY_11 = 11, /**< Display the frames with 11 frames delay */ + IVIDDEC3_DISPLAY_DELAY_12 = 12, /**< Display the frames with 12 frames delay */ + IVIDDEC3_DISPLAY_DELAY_13 = 13, /**< Display the frames with 13 frames delay */ + IVIDDEC3_DISPLAY_DELAY_14 = 14, /**< Display the frames with 14 frames delay */ + IVIDDEC3_DISPLAY_DELAY_15 = 15, /**< Display the frames with 15 frames delay */ + IVIDDEC3_DISPLAY_DELAY_16 = 16, /**< Display the frames with 16 frames delay */ + IVIDDEC3_DISPLAYDELAY_DEFAULT = IVIDDEC3_DISPLAY_DELAY_AUTO +} IVIDDEC3_displayDelay; + +/** + * @brief Defines the creation time parameters for + * all IVIDDEC3 instance objects + * + * @extensibleStruct + */ +typedef struct IVIDDEC3_Params { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 maxHeight; /**< Maximum video height in pixels. */ + XDAS_Int32 maxWidth; /**< Maximum video width in pixels. */ + XDAS_Int32 maxFrameRate; /**< Maximum frame rate in fps * 1000. + * For example, if max frame rate is 30 + * frames per second, set this field + * to 30000. + */ + XDAS_Int32 maxBitRate; /**< Maximum bit rate, bits per second. + * For example, if bit rate is 10 Mbps, set + * this field to 10000000 + */ + XDAS_Int32 dataEndianness; /**< Endianness of output data. + * + * @sa XDM_DataFormat + */ + XDAS_Int32 forceChromaFormat;/**< @copydoc XDM_ChromaFormat + * + * @sa XDM_ChromaFormat + */ + XDAS_Int32 operatingMode; /**< Video coding mode of operation. + * + * @sa IVIDEO_OperatingMode + */ + XDAS_Int32 displayDelay; /**< @copydoc IVIDDEC3_displayDelay + * + * @sa IVIDDEC3_displayDelay + */ + XDAS_Int32 inputDataMode; /**< Input data mode. + * + * @remarks If a subframe mode is provided, + * the application must call + * IVIDDEC3_Fxns.control() with + * #XDM_SETPARAMS id prior to + * IVIDDEC3_Fxns.process() to + * set + * IVIDDEC3_DynamicParams.getDataFxn() + * and + * IVIDDEC3_DynamicParams.getDataHandle + * (and optionally + * IVIDDEC3_DynamicParams.putBufferFxn(), + * and + * IVIDDEC3_DynamicParams.putBufferHandle). + * Else, the alg can return error. + * + * @sa IVIDEO_DataMode + */ + XDAS_Int32 outputDataMode; /**< Output data mode. + * + * @remarks If a subframe mode is provided, + * the application must call + * IVIDDEC3_Fxns.control() with + * #XDM_SETPARAMS id prior to + * #IVIDDEC3_Fxns.process() to + * set + * IVIDDEC3_DynamicParams.putDataFxn(), + * and + * IVIDDEC3_DynamicParams.putDataHandle. + * Else, the alg can return error. + * + * @sa IVIDEO_DataMode + */ + XDAS_Int32 numInputDataUnits;/**< Number of input slices/rows. + * + * @remarks Units depend on the + * IVIDDEC3_Params.inputDataMode, + * like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if + * IVIDDEC3_Params.inputDataMode + * is set to full frame mode. + */ + XDAS_Int32 numOutputDataUnits;/**< Number of output slices/rows. + * + * @remarks Units depend on the + * IVIDDEC3_Params.outputDataMode, + * like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if + * IVIDDEC3_Params.outputDataMode + * is set to full frame mode. + */ + XDAS_Int32 errorInfoMode; /**< Enable/disable packet error information + * for input and/or output. + * + * @sa IVIDEO_ErrorInfoMode + */ + XDAS_Int32 displayBufsMode; /**< Indicates which mode the displayBufs are + * presented in. + * + * @remarks See the + * IVIDDEC3_DisplayBufsMode enum + * for the values this field may + * contain. + * + * @sa IVIDDEC3_OutArgs.displayBufsMode + * @sa IVIDDEC3_DisplayBufsMode + */ + XDAS_Int32 metadataType[IVIDEO_MAX_NUM_METADATA_PLANES];/**< Type of + * each metadata plane. + * + * @sa IVIDEO_MetadataType + */ + } IVIDDEC3_Params; + + +/** + * @brief This structure defines the algorithm parameters that can be + * modified after creation via IVIDDEC3_Fxns.control() calls + * + * @remarks It is not necessary that a given implementation support all + * dynamic parameters to be configurable at run time. If a + * particular algorithm does not support run-time updates to + * a parameter that the application is attempting to change + * at runtime, it may indicate this as an error. + * + * @extensibleStruct + * + * @sa IVIDDEC3_Fxns::control() + */ +typedef struct IVIDDEC3_DynamicParams { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 decodeHeader; /**< @copydoc XDM_DecMode + * + * @sa XDM_DecMode + */ + XDAS_Int32 displayWidth; /**< Pitch. If set to zero, use the decoded + * image width. Else, use given display + * width in pixels. Display width has to be + * greater than or equal to image width. + */ + XDAS_Int32 frameSkipMode; /**< @copydoc IVIDEO_FrameSkip + * + * @sa IVIDEO_FrameSkip + */ + XDAS_Int32 newFrameFlag; /**< Flag to indicate that the algorithm should + * start a new frame. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + * + * @remarks This is useful for error + * recovery, for example when the + * end of frame cannot be detected + * by the codec but is known to the + * application. + */ + XDM_DataSyncPutFxn putDataFxn; /**< Optional datasync "put data" function. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks This function is provided + * by the app/framework to the + * video decoder. The decoder + * calls this function when + * sub-frame data has been put + * into an output buffer and is + * available. + */ + XDM_DataSyncHandle putDataHandle;/**< Datasync "put data" handle + * + * @remarks This is a handle which the + * codec must provide when + * calling the app-registered + * IVIDDEC3_DynamicParams.putDataFxn(). + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks For an algorithm, this handle + * is read-only; it must not be + * modified when calling + * the app-registered + * IVIDDEC3_DynamicParams.putDataFxn(). + * + * @remarks The app/framework can use + * this handle to differentiate + * callbacks from different + * algorithms. + */ + XDM_DataSyncGetFxn getDataFxn;/**< Datasync "get data" function. + * + * @remarks This function is provided + * by the app/framework to the + * video decoder. The decoder + * calls this function to get + * partial compressed bit-stream + * data from the app/framework. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + */ + XDM_DataSyncHandle getDataHandle;/**< Datasync "get data" handle + * + * @remarks This is a handle which the + * codec must provide when + * calling @c getDataFxn. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks For an algorithm, this handle + * is read-only; it must not be + * modified when calling + * the app-registered + * IVIDDEC3_DynamicParams.getDataFxn(). + * + * @remarks The app/framework can use + * this handle to differentiate + * callbacks from different + * algorithms. + */ + XDM_DataSyncPutBufferFxn putBufferFxn;/**< Datasync "put buffer" function. + * + * @remarks This function is provided + * by the app/framework to the + * video decoder. The decoder + * calls this function to release + * consumed, partial compressed + * bit-stream data buffers to the + * app/framework. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + */ + XDM_DataSyncHandle putBufferHandle;/**< Datasync "put buffer" handle + * + * @remarks This is a handle which the + * codec must provide when + * calling the app-registered + * IVIDDEC3_DynamicParam.putBufferFxn(). + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks For an algorithm, this handle + * is read-only; it must not be + * modified when calling + * the app-registered + * IVIDDEC3_DynamicParams.putBufferFxn(). + * + * @remarks The app/framework can use + * this handle to differentiate + * callbacks from different + * algorithms. + */ + XDAS_Int32 lateAcquireArg; /**< Argument used during late acquire. + * + * @remarks For all control() commands + * other than + * #XDM_SETLATEACQUIREARG, this + * field is ignored and can + * therefore be set by the + * caller to any value. + * + * @remarks This field is used to + * provide the + * 'late acquire' arg required by + * #XDM_SETLATEACQUIREARG. + * + * @remarks Late acquire support is + * an optional feature for + * video decoders. If the + * codec supports late + * acquisition of resources, + * and the application has supplied + * a lateAcquireArg value (via + * #XDM_SETLATEACQUIREARG), then the + * codec must also provide this + * @c lateAcquireArg value when + * requesting resources (i.e. + * during their call to + * acquire() when requesting + * the resource). + */ +} IVIDDEC3_DynamicParams; + + +/** + * @brief Defines the input arguments for all IVIDDEC3 instance + * process function + * + * @extensibleStruct + * + * @sa IVIDDEC3_Fxns::process() + */ +typedef struct IVIDDEC3_InArgs { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 numBytes; /**< Size of input data in bytes, provided + * to the algorithm for decoding. + */ + XDAS_Int32 inputID; /**< The decoder will attach + * this ID with the corresponding output + * frames. + * + * @remarks This is useful when frames + * require re-ordering (e.g. B frames). + * + * @remarks When there is no re-ordering, + * IVIDDEC3_OutArgs#outputID will be same + * as this inputID field. + * + * @remarks Zero (0) is not a supported + * inputID. This value is + * reserved for cases when there + * is no output buffer provided in + * IVIDDEC3_OutArgs::displayBufs. + * + * @sa IVIDDEC3_OutArgs::outputID. + */ +} IVIDDEC3_InArgs; + + +/** + * @brief Defines instance status parameters + * + * @extensibleStruct + * + * @sa IVIDDEC3_Fxns::control() + */ +typedef struct IVIDDEC3_Status { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 extendedError; /**< @extendedErrorField */ + XDM1_SingleBufDesc data; /**< Buffer descriptor for data passing. + * + * @remarks If this field is not used, + * the application must + * set @c data.buf to NULL. + * + * @remarks This buffer can be used as + * either input or output, + * depending on the command. + * + * @remarks The buffer will be provided + * by the application, and + * returned to the application + * upon return of the + * IVIDDEC3_Fxns.control() + * call. The algorithm must + * not retain a pointer to this + * data. + * + * @sa #XDM_GETVERSION + */ + XDAS_Int32 maxNumDisplayBufs;/**< The maximum number of buffers that will + * be required by the codec. + * + * @remarks The maximum number of buffers + * can be IVIDEO2_MAX_IO_BUFFERS. + */ + XDAS_Int32 maxOutArgsDisplayBufs;/**< The maximum number of display + * buffers that can be returned via + * IVIDDEC3_OutArgs.displayBufs. + * + * @remarks If returning display buffers + * embedded into the OutArgs + * struct, this field provides + * the size of the + * OutArgs.displayBufs.bufDesc[] + * array. + */ + XDAS_Int32 outputHeight; /**< Output height in pixels. */ + XDAS_Int32 outputWidth; /**< Output width in pixels. */ + XDAS_Int32 frameRate; /**< Average frame rate in fps * 1000. + * For example, if average frame rate is 30 + * frames per second, this field should be + * 30000. + */ + XDAS_Int32 bitRate; /**< Average bit rate, in bits per second. */ + XDAS_Int32 contentType; /**< @copydoc IVIDEO_ContentType + * + * @sa IVIDEO_ContentType + */ + XDAS_Int32 sampleAspectRatioHeight;/**< Sample aspect ratio height. */ + XDAS_Int32 sampleAspectRatioWidth;/**< Sample aspect ratio width. */ + XDAS_Int32 bitRange; /**< Full 8 bit, CCIR 601 */ + XDAS_Int32 forceChromaFormat;/**< Output chroma format. + * + * @sa XDM_ChromaFormat + */ + XDAS_Int32 operatingMode; /**< Video decoding mode of operation. + * + * @sa IVIDEO_OperatingMode + */ + XDAS_Int32 frameOrder; /**< Frame Order + * + * @remarks This field reflects the value + * provided during creation in + * IVIDDEC3_Params.displayDelay + */ + XDAS_Int32 inputDataMode; /**< Input data mode. + * + * @sa IVIDDEC3_Params.inputDataMode + * @sa IVIDEO_DataMode + */ + XDAS_Int32 outputDataMode; /**< Output data mode. + * + * @sa IVIDDEC3_Params.outputDataMode + * @sa IVIDEO_DataMode + */ + XDM1_AlgBufInfo bufInfo; /**< Input and output buffer information. + * + * @remarks This field provides the + * application with the algorithm's + * buffer requirements. The + * requirements may vary depending + * on the current configuration + * of the algorithm instance. + * + * @sa XDM1_AlgBufInfo + */ + XDAS_Int32 numInputDataUnits;/**< Number of input slices/rows. + * + * @remarks Units depend on the + * IVIDDEC3_Params.inputDataMode, + * like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if + * IVIDDEC3_Params.inputDataMode + * is set to full frame mode. + * + * @sa IVIDDEC3_Params.inputDataMode + */ + XDAS_Int32 numOutputDataUnits;/**< Number of output slices/rows. + * + * @remarks Units depend on the + * @c outputDataMode, like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if + * IVIDDEC3_Params.outputDataMode + * is set to full frame mode. + * + * @sa IVIDDEC3_Params.outputDataMode + */ + XDAS_Int32 configurationID; /**< Configuration ID of given codec. + * + * @remarks This is based on the input + * stream & can be used by the + * framework to optimize the + * save/restore overhead of any + * resources used. + * + * @remarks This can be useful in + * multichannel use case + * scenarios. + */ + XDAS_Int32 metadataType[IVIDEO_MAX_NUM_METADATA_PLANES];/**< Type of + * each metadata plane. + * + * @sa IVIDEO_MetadataType + */ + IVIDDEC3_DynamicParams decDynamicParams;/**< Current values of the + * decoder's dynamic parameters. + * + * @remarks This is the last field in + * the base struct as it can + * be extended. + */ +} IVIDDEC3_Status; + + +/** + * @brief Mode in which display buffers will be returned in + * IVIDDEC3_OutArgs + * + * @remarks Note that we start this enum at '1' to help catch inadvertently + * uninitialized fields. + * + * @enumWarning + */ +typedef enum { + IVIDDEC3_DISPLAYBUFS_EMBEDDED = 1, /**< @c displayBufs details are embedded + * into the struct. + * + * @remarks This mode causes the + * size of the + * IVIDDEC3_OutArgs + * struct to be larger, + * but typically easier to + * manage by both the app + * and the codec. + */ + IVIDDEC3_DISPLAYBUFS_PTRS = 2 /**< @c displayBufs details are returned + * via the provided pointers. + * + * @remarks This mode causes the + * size of the + * IVIDDEC3_OutArgs + * struct to be smaller + * and predictable, + * but makes the usage of + * the struct more + * difficult as the + * app/framework has to + * manage (sometimes many) + * small buffers. On + * multiprocessor systems, + * these extra buffers can + * introduce extra + * overhead related to + * address translation and + * cache maintenance. + */ +} IVIDDEC3_DisplayBufsMode; + + +/** + * @brief Defines the run time output arguments for + * all IVIDDEC3 instance objects + * + * @extensibleStruct + * + * @remarks The size of this struct may vary when + * IVIDDEC3_OutArgs.displayBufsMode is set to + * #IVIDDEC3_DISPLAYBUFS_EMBEDDED (see details in + * IVIDDEC3_OutArgs.displayBufs.bufDesc). + * + * @remarks When IVIDDEC3_OutArgs.displayBufsMode is set to + * #IVIDDEC3_DISPLAYBUFS_EMBEDDED, the number of elements in the + * IVIDDEC3_OutArgs.displayBufs.bufDesc array is a constant (and + * can be acquired by calling IVIDDEC3_Fxns.control() and looking + * in the IVIDDEC3_Status.maxOutArgsDisplayBufs field. Note that + * any extended fields follow the + * IVIDDEC3_OutArgs.displayBufs.bufDesc array. + * + * @sa IVIDDEC3_Fxns.process() + */ +typedef struct IVIDDEC3_OutArgs { + XDAS_Int32 size; /**< @sizeField + * + * @remarks Extra care must be taken when + * setting this field as the + * size of even the base data + * can vary because of the + * #IVIDDEC3_OutArgs.displayBufs + * field. + * + * @sa IVIDDEC3_OutArgs.displayBufs + */ + XDAS_Int32 extendedError; /**< @extendedErrorField */ + XDAS_Int32 bytesConsumed; /**< Number of bytes consumed. */ + XDAS_Int32 outputID[IVIDEO2_MAX_IO_BUFFERS]; /**< Output ID corresponding + * to @c displayBufs[]. + * + * @remarks A value of zero (0) indicates + * an invalid ID. The first zero + * entry in array will indicate + * end of valid outputIDs within + * the array. Hence the + * application can stop reading the + * array when it encounters the + * first zero entry. + * + * @sa IVIDDEC3_OutArgs.displayBufs + * @sa IVIDDEC3_InArgs.inputID + */ + IVIDEO2_BufDesc decodedBufs; /**< The decoder fills this structure with + * buffer pointers to the decoded frame. + * Related information fields for the + * decoded frame are also populated. + * + * When frame decoding is not complete, as + * indicated by + * IVIDDEC3_OutArgs.outBufsInUseFlag, + * the frame data in this structure will be + * incomplete. However, the algorithm will + * provide incomplete decoded frame data + * in case application wants to use + * it for error recovery purposes. + * + * @sa IVIDDEC3_OutArgs.outBufsInUseFlag + */ + XDAS_Int32 freeBufID[IVIDEO2_MAX_IO_BUFFERS]; /**< This is an + * array of inputID's corresponding to the + * buffers that have been unlocked in the + * current process call. + * + * @remarks Buffers returned to the + * application for display (via + * IVIDDEC3_OutArgs.displayBufs) + * continue to be owned by the + * algorithm until they are + * released - indicated by + * the ID being returned in this + * @c freeBuf array. + * + * @remarks The buffers released by the + * algorithm are indicated by + * their non-zero ID (previously + * provided via + * IVIDDEC3_InArgs.inputID). + * + * @remarks 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. + * + * @remarks If no buffer was unlocked in + * the process call, + * @c freeBufID[0] will + * have a value of zero. + * + * @sa IVIDDEC3_InArgs.inputID + * @sa IVIDDEC3_OutArgs.displayBufs + */ + XDAS_Int32 outBufsInUseFlag; /**< Flag to indicate that the @c outBufs + * provided with the IVIDDEC3_Fxns.process() + * call are in use. No @c outBufs are + * required to be supplied with the next + * IVIDDEC3_Fxns.process() call. + * + * @remarks Valid values are #XDAS_TRUE + * and #XDAS_FALSE. + */ + XDAS_Int32 displayBufsMode; /**< Indicates which mode the + * #IVIDDEC3_OutArgs.displayBufs are + * presented in. + * + * @remarks See the + * IVIDDEC3_DisplayBufsMode enum + * for the values this field may + * contain. + * + * @remarks This will be set to the same + * value the application provided + * at creation time via + * #IVIDDEC3_Params.displayBufsMode. + * + * @sa IVIDDEC3_Params.displayBufsMode + * @sa IVIDDEC3_DisplayBufsMode + */ + union { + IVIDEO2_BufDesc bufDesc[1];/**< Array containing display frames + * corresponding to valid ID entries + * in the @c outputID[] array. + * + * @remarks The number of elements in this + * array is not necessarily 1, and + * should be acquired by the app + * via the + * IVIDDEC3_Status.maxNumDisplayBufs + * field - acquired by calling + * IVIDDEC3_Fxns.control() with + * #XDM_GETSTATUS. + * The application should acquire + * this prior to calling + * IVIDDEC3_Fxns.process(). + * + * @remarks Because of the variable size + * of this array, care must be + * taken when setting the + * IVIDDEC3_OutArgs.size field + * to include the complete size of + * this struct. + * + * @remarks Entries in the array + * corresponding to invalid + * ID values (zero) in + * IVIDDEC3_OutArgs.outputID[] will + * set zero value for the following + * fields in the IVIDEO2_BufDesc + * structure: @c numPlanes, + * @c numMetaPlanes. + * + * @remarks Implied by the previous remark, + * as this array corresponds to + * buffer IDs indicated by + * @c outputID[], elements of + * this array are undefined if + * the corresponding @c outputID[] + * element is zero (0). + * + */ + IVIDEO2_BufDesc *pBufDesc[IVIDEO2_MAX_IO_BUFFERS]; /**< Array containing + * pointers to display frames corresponding + * to valid ID entries in the @c outputID[] + * array. + * + * @remarks These buffers must be allocated + * by the application, and provided + * into this "outArgs" + * structure by the app. + */ + } displayBufs; /**< Display Buffers union. + * + * @remarks This field is complex. The + * value in + * #IVIDDEC3_OutArgs.displayBufsMode + * indicates how the user should + * interact with this union field. + * If #IVIDDEC3_OutArgs.displayBufsMode + * is + * #IVIDDEC3_DISPLAYBUFS_EMBEDDED, + * this field should be referenced + * via the + * IVIDDEC3_OutArgs.bufDesc[] array + * who's number of elements is + * determined via the + * #IVIDDEC3_OutArgs.outputID[] + * array. If this field is + * #IVIDDEC3_DISPLAYBUFS_PTRS, + * this field should be referenced + * via the + * IVIDDEC3_OutArgs.pBufDesc[] + * array. + * + * @sa IVIDDEC3_OutArgs.bufDesc + * @sa IVIDDEC3_OutArgs.pBufDesc + */ +} IVIDDEC3_OutArgs; + + +/** + * @brief Defines the control commands for the IVIDDEC3 module + * + * @remarks This ID can be extended in IMOD interface for + * additional controls. + * + * @sa XDM_CmdId + * + * @sa IVIDDEC3_Fxns::control() + */ +typedef IALG_Cmd IVIDDEC3_Cmd; + + +/** + * @brief Defines all of the operations on IVIDDEC3 objects + */ +typedef struct IVIDDEC3_Fxns { + IALG_Fxns ialg; /**< XDAIS algorithm interface. + * + * @sa IALG_Fxns + */ + +/** + * @brief Basic video decoding call + * + * @param[in] handle Handle to an algorithm instance. + * @param[in,out] inBufs Input buffer descriptors. + * @param[in,out] outBufs Output buffer descriptors. The algorithm + * may modify the output buffer pointers. + * @param[in] inArgs Input arguments. This is a required + * parameter. + * @param[out] outArgs Ouput results. This is a required parameter. + * + * @remarks process() is a blocking call. When process() returns, the + * algorithm's processing is complete. + * + * @remarks process() enables codecs to support error resiliency and + * error concealment. As a result, even if #IVIDDEC3_EFAIL + * is returned from process() because the encoded buffer has + * an error, it's possible that decoded buffers + * (@c outArgs->decodedBufs) and display buffers + * (@c outArgs->displayBufs) could still be returned. + * The codec can indicate that buffers are available by + * not setting the #XDM_ISFATALERROR bit + * in the respective @c displayBufs and @c decodedBufs + * @c extendedError field if the buffers contain valid data. + * + * @remarks By extension then, if the @c outArgs->decodedBufs and + * @c outArgs->displayBufs buffers are not valid, even + * if the codec's process() call returns IVIDDEC3_EFAIL, it must + * also be sure to set the #XDM_ISFATALERROR bit in the + * respective @c extendedError fields. Failure to do so may + * result in applications accessing these buffers and causing + * system instability. + * + * @pre @c inArgs must not be NULL, and must point to a valid + * IVIDDEC3_InArgs structure. + * + * @pre @c outArgs must not be NULL, and must point to a valid + * IVIDDEC3_OutArgs structure. + * + * @pre @c inBufs must not be NULL, and must point to a valid + * XDM2_BufDesc structure. + * + * @pre When operating in "fullframe mode" (e.g. not in data sync + * mode), @c inBufs->descs[0].buf must not be NULL, and must + * point to a valid buffer of data that is at least + * @c inBufs->descs[0].bufSize bytes in length. + * + * @pre When created with .inputDataMode (for @c inBufs) or + * .outputDataMode (for @c outBufs) set to operate in + * "subframe mode" (e.g. data sync mode), the appropriate + * .descs[].usageMode field(s)'s XDM_MEMUSAGE_DATASYNC + * bit must be set. See #XDM_MemoryUsageMode for more details. + * + * @pre @c outBufs must not be NULL, and must point to a valid + * XDM2_BufDesc structure. + * + * @pre When operating in "fullframe mode" (e.g. not in data sync + * mode), @c outBufs->buf[0] must not be NULL, and must point to + * a valid buffer of data that is at least + * @c outBufs->bufSizes[0] bytes in length. + * + * @pre Unless used in data sync mode, the buffers in @c inBufs + * and @c outBufs are physically + * contiguous and owned by the calling application. + * + * @post The algorithm must not modify the contents of @c inArgs. + * + * @post The algorithm must not modify the contents of + * @c inBufs, with the exception of @c inBufs.bufDesc[].accessMask. + * That is, the data and buffers pointed to by these parameters + * must be treated as read-only. + * + * @post The algorithm must modify the contents of + * @c inBufs->descs[].accessMask and appropriately indicate the + * mode in which each of the buffers in @c inBufs were read. + * For example, if the algorithm only read from + * @c inBufs.descs[0].buf using the algorithm processor, it + * could utilize #XDM_SETACCESSMODE_READ to update the appropriate + * @c accessMask fields. + * The application may utilize these + * returned values to appropriately manage cache. + * + * @post The buffers in @c inBufs are + * owned by the calling application. + * + * @retval IVIDDEC3_EOK @copydoc IVIDDEC3_EOK + * @retval IVIDDEC3_EFAIL @copydoc IVIDDEC3_EFAIL + * See IVIDDEC3_Status#extendedError + * for more detailed further error + * conditions. + * @retval IVIDDEC3_EUNSUPPORTED @copydoc IVIDDEC3_EUNSUPPORTED + */ + XDAS_Int32 (*process)(IVIDDEC3_Handle handle, XDM2_BufDesc *inBufs, + XDM2_BufDesc *outBufs, IVIDDEC3_InArgs *inArgs, + IVIDDEC3_OutArgs *outArgs); + + +/** + * @brief Control behavior of an algorithm + * + * @param[in] handle Handle to an algorithm instance. + * @param[in] id Command id. See #XDM_CmdId. + * @param[in] params Dynamic parameters. This is a required + * parameter. + * @param[out] status Output results. This is a required parameter. + * + * @pre @c handle must be a valid algorithm instance handle. + * + * @pre @c params must not be NULL, and must point to a valid + * IVIDDEC3_DynamicParams structure. + * + * @pre @c status must not be NULL, and must point to a valid + * IVIDDEC3_Status structure. + * + * @pre If a buffer is provided in the @c status->data field, + * it must be physically contiguous and owned by the calling + * application. + * + * @post The algorithm must not modify the contents of @c params. + * That is, the data pointed to by this parameter must be + * treated as read-only. + * + * @post If a buffer was provided in the @c status->data field, + * it is owned by the calling application. + * + * @retval IVIDDEC3_EOK @copydoc IVIDDEC3_EOK + * @retval IVIDDEC3_EFAIL @copydoc IVIDDEC3_EFAIL + * See IVIDDEC3_Status#extendedError + * for more detailed further error + * conditions. + * @retval IVIDDEC3_EUNSUPPORTED @copydoc IVIDDEC3_EUNSUPPORTED + */ + XDAS_Int32 (*control)(IVIDDEC3_Handle handle, IVIDDEC3_Cmd id, + IVIDDEC3_DynamicParams *params, IVIDDEC3_Status *status); + +} IVIDDEC3_Fxns; + + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/packages/xdais/ti/xdais/dm/ividenc2.h b/packages/xdais/ti/xdais/dm/ividenc2.h new file mode 100755 index 0000000..48314e0 --- /dev/null +++ b/packages/xdais/ti/xdais/dm/ividenc2.h @@ -0,0 +1,937 @@ +/* + * Copyright (c) 2006-2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file ti/xdais/dm/ividenc2.h + * + * @brief This header defines all types, constants, and functions + * shared by all implementations of the video encoder + * algorithms. + */ +/** + * @defgroup ti_xdais_dm_IVIDENC2 IVIDENC2 - XDM Video Encoder Interface + * + * This is the XDM IVIDENC2 Video Encoder Interface. + */ + +#ifndef ti_xdais_dm_IVIDENC2_ +#define ti_xdais_dm_IVIDENC2_ + +#include +#include +#include "xdm.h" +#include "ivideo.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup ti_xdais_dm_IVIDENC2 */ +/*@{*/ + +#define IVIDENC2_EOK XDM_EOK /**< @copydoc XDM_EOK */ +#define IVIDENC2_EFAIL XDM_EFAIL /**< @copydoc XDM_EFAIL */ +#define IVIDENC2_EUNSUPPORTED XDM_EUNSUPPORTED /**< @copydoc XDM_EUNSUPPORTED */ + + +/** + * @brief Enumeration of possible motion vector (MV) accuracy + * + * @enumWarning + */ +typedef enum { + IVIDENC2_MOTIONVECTOR_PIXEL = 0, /**< Motion vectors accuracy is only integer pel. */ + IVIDENC2_MOTIONVECTOR_HALFPEL = 1, /**< Motion vectors accuracy is half pel. */ + IVIDENC2_MOTIONVECTOR_QUARTERPEL = 2,/**< Motion vectors accuracy is quarter pel. */ + IVIDENC2_MOTIONVECTOR_EIGHTHPEL = 3, /**< Motion vectors accuracy is one-eighth pel. */ + IVIDENC2_MOTIONVECTOR_MAX = 4 /**< Motion vectors accuracy is not defined */ +} IVIDENC2_MotionVectorAccuracy; + +/** + * @brief Video frame control + * + * @enumWarning + * + * @extendedEnum + * + * @remarks This enumeration provides the application with some frame + * level control of the video encoder. + * + * @sa IVIDENC2_InArgs.control + */ +typedef enum { + IVIDENC2_CTRL_NONE = 0, /**< No control operations. */ + IVIDENC2_CTRL_FORCESKIP = 1, /**< Skip frame if it is not IDR/I frame. */ + /** Default settings. */ + IVIDENC2_CTRL_DEFAULT = IVIDENC2_CTRL_NONE +} IVIDENC2_Control; + + +/** + * @brief This must be the first field of all IVIDENC2 + * instance objects + */ +typedef struct IVIDENC2_Obj { + struct IVIDENC2_Fxns *fxns; +} IVIDENC2_Obj; + + +/** + * @brief Opaque handle to an IVIDENC2 objects. + */ +typedef struct IVIDENC2_Obj *IVIDENC2_Handle; + +/** + * @brief Default codec profile + * + * @remarks This definition is often used when the a particular codec + * doesn't have a profile, or the application doesn't + * know which profile the codec should use. + * + * @sa IVIDENC2_Params.profile + */ +#define IVIDENC2_DEFAULTPROFILE (-1) + +/** + * @brief Default codec level + * + * @remarks This definition is often used when the a particular codec + * doesn't have a level, or the application doesn't + * know which profile the codec should use. + * + * @sa IVIDENC2_Params.level + */ +#define IVIDENC2_DEFAULTLEVEL (-1) + +/** + * @brief Defines the creation time parameters for + * all IVIDENC2 instance objects + * + * @extensibleStruct + */ +typedef struct IVIDENC2_Params { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 encodingPreset; /**< Encoding preset. */ + XDAS_Int32 rateControlPreset;/**< @copydoc IVIDEO_RateControlPreset + * + * @sa IVIDEO_RateControlPreset + */ + XDAS_Int32 maxHeight; /**< Maximum video height in pixels. */ + XDAS_Int32 maxWidth; /**< Maximum video width in pixels. */ + XDAS_Int32 dataEndianness; /**< Endianness of output data. + * + * @sa XDM_DataFormat + */ + XDAS_Int32 maxInterFrameInterval;/**< I to P frame distance. e.g. = 1 if + * no B frames, 2 to insert one B frame. + * + * @remarks This is used for setting the + * maximum number of B frames + * between two refererence frames. + */ + XDAS_Int32 maxBitRate; /**< Maximum Bit-rate for encoding in bits + * per second + */ + XDAS_Int32 minBitRate; /**< Minumum Bit-rate for encoding in bits + * per second + */ + XDAS_Int32 inputChromaFormat;/**< Chroma format for the input buffer. + * + * @sa XDM_ChromaFormat + */ + XDAS_Int32 inputContentType;/**< Video content type of the buffer being + * encoded. + * + * @sa IVIDEO_ContentType + */ + XDAS_Int32 operatingMode; /**< Video coding mode of operation. + * + * @sa IVIDEO_OperatingMode + */ + XDAS_Int32 profile; /**< Profile indicator of video codec + * + * @remarks Only one default value + * (#IVIDENC2_DEFAULTPROFILE) is + * defined by XDM for this field. + * The reason for not + * defining further values + * is to keep profile values as + * defined by video codec + * standards. + * + * @sa IVIDENC2_Status.profile + */ + XDAS_Int32 level; /**< Level indicator of video codec + * + * @remarks Only one default value + * (#IVIDENC2_DEFAULTLEVEL) is + * defined by XDM for this field. + * The reason for not + * defining further values + * is to keep profile values as + * defined by video codec + * standards. + * + * @sa IVIDENC2_Status.level + */ + XDAS_Int32 inputDataMode; /**< Input data mode. + * + * @remarks If a subframe mode is provided, + * the application must call + * IVIDENC2_Fxns::control() with + * #XDM_SETPARAMS id prior to + * #IVIDENC2_Fxns::process() to + * set the + * IVIDENC2_DynamicParams::getDataFxn + * and + * IVIDENC2_DynamicParams::getDataHandle. + * Else, the alg can return + * error. + * + * @sa IVIDEO_DataMode + */ + XDAS_Int32 outputDataMode; /**< Output data mode. + * + * @remarks If a subframe mode is provided, + * the application must call + * IVIDENC2_Fxns::control() with + * #XDM_SETPARAMS id prior to + * #IVIDENC2_Fxns::process() to + * set the + * IVIDENC2_DynamicParams::putDataFxn, + * IVIDENC2_DynamicParams::putDataHandle + * (and optionally + * IVIDENC2_DynamicParams::getBufferFxn, + * and + * IVIDENC2_DynamicParams::getBufferHandle). + * Else, the alg can return + * error. + * + * @sa IVIDEO_DataMode + */ + XDAS_Int32 numInputDataUnits; /**< Number of input slices/rows. + * + * @remarks Units depend on the + * @c inputDataMode, like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if @c inputDataMode + * is set to full frame mode. + */ + XDAS_Int32 numOutputDataUnits;/**< Number of output slices/rows. + * + * @remarks Units depend on the + * @c outputDataMode, like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if @c outputDataMode + * is set to full frame mode. + */ + XDAS_Int32 metadataType[IVIDEO_MAX_NUM_METADATA_PLANES];/**< Type of + * each metadata plane. + * + * @sa IVIDEO_MetadataType + */ +} IVIDENC2_Params; + + +/** + * @brief This structure defines the algorithm parameters that can be + * modified after creation via control() calls + * + * @remarks It is not necessary that a given implementation support all + * dynamic parameters to be configurable at run time. If a + * particular algorithm does not support run-time updates to + * a parameter that the application is attempting to change + * at runtime, it may indicate this as an error. + * + * @extensibleStruct + * + * @sa IVIDENC2_Fxns::control() + */ +typedef struct IVIDENC2_DynamicParams { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 inputHeight; /**< Input frame height. */ + XDAS_Int32 inputWidth; /**< Input frame width. */ + XDAS_Int32 refFrameRate; /**< Reference, or input, frame rate in + * fps * 1000. + * + * @remarks For example, if ref frame + * rate is 30 frames per second, + * this field will be 30000. + */ + XDAS_Int32 targetFrameRate; /**< Target frame rate in + * fps * 1000. + * + * @remarks For example, if target frame + * rate is 30 frames per second, + * this field will be 30000. + */ + XDAS_Int32 targetBitRate; /**< Target bit rate in bits per second. */ + XDAS_Int32 intraFrameInterval;/**< The number of frames between two I + * frames. For example, 30. + * + * @remarks For example, this field will be: + * - 0 - Only first frame to be intra + * coded. e.g. IPPPPPP... + * - 1 - No inter frames (all intra + * frames). + * - 2 - Consecutive IPIPIP... sequence (if + * no B frames). + * - 3 - IPPIPP... or IPBIPBI... and so on. + */ + XDAS_Int32 generateHeader; /**< @copydoc XDM_EncMode + * + * @sa XDM_EncMode + */ + XDAS_Int32 captureWidth; /**< DEFAULT(0): use imagewidth as + * pitch else use given capture + * width for pitch provided it + * is greater than image width. + */ + XDAS_Int32 forceFrame; /**< Force the current (immediate) frame to be + * encoded as a specific frame type. + * + * @remarks For example, this field will be: + * - IVIDEO_NA_FRAME - No forcing of any + * specific frame type for the frame. + * - IVIDEO_I_FRAME - Force the frame to be + * encoded as I frame. + * - IVIDEO_IDR_FRAME - Force the frame to + * be encoded as an IDR frame (specific + * to H.264 codecs). + * - IVIDEO_P_FRAME - Force the frame to be + * encoded as a P frame. + * - IVIDEO_B_FRAME - Force the frame to be + * encoded as a B frame. + * + * @sa IVIDEO_FrameType. + */ + XDAS_Int32 interFrameInterval;/**< Number of B frames between two reference + * frames; that is, the number of B frames + * between two P frames or I/P frames. + * DEFAULT(0). + * + * @remarks For example, this field will be: + * - 0 - to use maxInterFrameInterval. + * - 1 - 0 B frames between two reference + * frames. + * - 2 - 1 B frame between two reference + * frames. + * - 3 - 2 B frames between two reference + * frames. + * - and so on... + * + * @sa IVIDENC2_Params.maxInterFrameInterval. + */ + XDAS_Int32 mvAccuracy; /**< Pixel Accuracy of the motion vector + * + * @remarks This parameter allows the user + * to tune performance by + * controlling the complexity of + * motion estimation and + * compensation within the video + * encoder. + * + * @sa IVIDENC2_MotionVectorAccuracy + */ + XDAS_Int32 sampleAspectRatioHeight; /**< Sample aspect ratio: Height + * + * @remarks This parameter is used to + * describe the desired aspect + * ratio in the bitstream. + */ + XDAS_Int32 sampleAspectRatioWidth; /**< Sample aspect ratio: Width + * + * @remarks This parameter is used to + * describe the desired aspect + * ratio in the bitstream. + */ + XDAS_Int32 ignoreOutbufSizeFlag; /**< Flag to indicate that the application + * has ignored the output buffer size + * requirement. + * + * @remarks Typically video encoders + * ask for large output buffers + * (compressed bit-streams) + * assuming theoretical worst + * case. But on memory + * constrained systems, the + * application may want to + * allocate less than this + * worst-case size, depending + * upon the use case. + * If the application provides a + * buffer that is smaller than + * the worst-case size, the + * encoder will return an error. + * To prevent the encoder from + * returning an error, the + * application can set this + * @c ignoreOutbufSizeFlag field to + * #XDAS_TRUE. When this flag + * is set to #XDAS_TRUE, the + * encoder shouldn't return an + * error even if the output + * buffer size is less than + * requested by the codec. + * + * @remarks Valid values are #XDAS_TRUE + * and #XDAS_FALSE. + */ + XDM_DataSyncPutFxn putDataFxn; /**< Optional datasync "put data" function. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks This function is provided + * by the app/framework to the + * video encoder. The encoder + * calls this function when data + * has been put into an output + * buffer. + */ + XDM_DataSyncHandle putDataHandle;/**< Datasync "put data" handle + * + * @remarks This is a handle which the + * codec must provide when + * calling the app-registered + * IVIDENC2_DynamicParams.putDataFxn(). + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks For an algorithm, this handle + * is read-only; it must not be + * modified when calling + * the app-registered + * IVIDENC2_DynamicParams.putDataFxn(). + * + * @remarks The app/framework can use + * this handle to differentiate + * callbacks from different + * algorithms. + */ + XDM_DataSyncGetFxn getDataFxn;/**< Datasync "get data" function. + * + * @remarks This function is provided + * by the app/framework to the + * video encoder. The encoder + * calls this function to get + * partial video buffer(s) + * from the app/framework. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + */ + XDM_DataSyncHandle getDataHandle;/**< Datasync "get data" handle + * + * @remarks This is a handle which the + * codec must provide when + * calling @c getDataFxn. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks For an algorithm, this handle + * is read-only; it must not be + * modified when calling + * the app-registered + * IVIDENC2_DynamicParams.getDataFxn(). + * + * @remarks The app/framework can use + * this handle to differentiate + * callbacks from different + * algorithms. + */ + XDM_DataSyncGetBufferFxn getBufferFxn;/**< Datasync "get buffer" function. + * + * @remarks This function is provided + * by the app/framework to the + * video encoder. The encoder + * calls this function to obtain + * partial compressed bit-stream + * data buffers from the + * app/framework. + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + */ + XDM_DataSyncHandle getBufferHandle;/**< Datasync "get buffer" handle + * + * @remarks This is a handle which the + * codec must provide when + * calling the app-registered + * IVIDENC2_DynamicParam.getBufferFxn(). + * + * @remarks Apps/frameworks that don't + * support datasync should set + * this to NULL. + * + * @remarks For an algorithm, this handle + * is read-only; it must not be + * modified when calling + * the app-registered + * IVIDENC2_DynamicParams.getBufferFxn(). + * + * @remarks The app/framework can use + * this handle to differentiate + * callbacks from different + * algorithms. + */ + XDAS_Int32 lateAcquireArg; /**< Argument used during late acquire. + * + * @remarks For all control() commands + * other than + * #XDM_SETLATEACQUIREARG, this + * field is ignored and can + * therefore be set by the + * caller to any value. + * + * @remarks This field is used to + * provide the + * 'late acquire' arg required by + * #XDM_SETLATEACQUIREARG. + * + * @remarks Late acquire support is + * an optional feature for + * video encoders. If the + * codec supports late + * acquisition of resources, + * and the application has supplied + * a lateAcquireArg value (via + * #XDM_SETLATEACQUIREARG), then the + * codec must also provide this + * @c lateAcquireArg value when + * requesting resources (i.e. + * during their call to + * acquire() when requesting + * the resource). + */ +} IVIDENC2_DynamicParams; + + +/** + * @brief Defines the input arguments for all IVIDENC2 instance + * process function + * + * @extensibleStruct + * + * @sa IVIDENC2_Fxns::process() + */ +typedef struct IVIDENC2_InArgs { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 inputID; /**< Identifier to attach with the corresponding + * input frames to be encoded. + * + * @remarks This is useful when frames + * require buffering (e.g. + * B frames), and to support + * buffer management. + * + * @remarks When there is no re-ordering, + * IVIDENC2_OutArgs::outputID will + * be the same as this inputID + * field. + * + * @remarks Zero (0) is not a + * supported inputID. This value + * is reserved for cases when + * there is no input buffer is + * provided. + * + * @sa IVIDENC2_OutArgs::outputID. + */ + XDAS_Int32 control; /**< Encoder control operations + * + * @sa IVIDENC2_Control + */ +} IVIDENC2_InArgs; + + +/** + * @brief Defines instance status parameters + * + * @extensibleStruct + * + * @sa IVIDENC2_Fxns::control() + */ +typedef struct IVIDENC2_Status { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 extendedError; /**< @extendedErrorField */ + XDM1_SingleBufDesc data; /**< Buffer descriptor for data passing. + * + * @remarks If this field is not used, + * the application must + * set @c data.buf to NULL. + * + * @remarks This buffer can be used as + * either input or output, + * depending on the command. + * + * @remarks The buffer will be provided + * by the application, and + * returned to the application + * upon return of the + * IVIDENC2_Fxns.control() + * call. The algorithm must + * not retain a pointer to this + * data. + * + * @sa #XDM_GETVERSION + */ + + XDAS_Int32 encodingPreset; /**< Encoding preset. */ + XDAS_Int32 rateControlPreset;/**< @copydoc IVIDEO_RateControlPreset + * + * @sa IVIDEO_RateControlPreset + */ + XDAS_Int32 maxInterFrameInterval; /**< I to P frame distance. e.g. = 1 if + * no B frames, 2 to insert one B frame. + * + * @remarks This is used for setting the + * maximum number of B frames + * between two refererence frames. + */ + XDAS_Int32 inputChromaFormat;/**< Chroma format for the input buffer. + * + * @sa XDM_ChromaFormat + */ + XDAS_Int32 inputContentType; /**< Video content type of the buffer being + * encoded. + * + * @sa IVIDEO_ContentType + */ + XDAS_Int32 operatingMode; /**< Video encoding mode of operation. + * + * @sa IVIDEO_OperatingMode + */ + XDAS_Int32 profile; /**< Profile indicator of video codec. + * + * @sa IVIDENC2_DEFAULTPROFILE + * @sa IVIDENC2_Params.profile + */ + XDAS_Int32 level; /**< Level indicator of video codec. + * + * @sa IVIDENC2_DEFAULTLEVEL + * @sa IVIDENC2_Params.level + */ + XDAS_Int32 inputDataMode; /**< Input data mode. + * + * @sa IVIDENC2_Params.inputDataMode + * @sa IVIDEO_DataMode + */ + XDAS_Int32 outputDataMode; /**< Output data mode. + * + * @sa IVIDENC2_Params.outputDataMode + * @sa IVIDEO_DataMode + */ + XDAS_Int32 numInputDataUnits; /**< Number of input slices/rows. + * + * @remarks Units depend on the + * IVIDENC2_Params.inputDataMode, + * like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if + * IVIDENC2_Params.inputDataMode + * is set to full frame mode. + * + * @sa IVIDENC2_Params.inputDataMode + */ + XDAS_Int32 numOutputDataUnits;/**< Number of output slices/rows. + * + * @remarks Units depend on the + * @c outputDataMode, like number of + * slices/rows/blocks etc. + * + * @remarks Ignored if + * IVIDENC2_Params.outputDataMode + * is set to full frame mode. + * + * @sa IVIDENC2_Params.outputDataMode + */ + XDAS_Int32 configurationID; /**< Configuration ID of given codec. + * + * @remarks This is used to differentiate + * multiple images of a vendor. + * It can be used by the + * framework to optimize the + * save/restore overhead of any + * resources used. + * + * @remarks This can be useful in + * multichannel use case + * scenarios. + * + */ + XDM1_AlgBufInfo bufInfo; /**< Input and output buffer information. + * + * @remarks This field provides the + * application with the algorithm's + * buffer requirements. The + * requirements may vary depending + * on the current configuration + * of the algorithm instance. + * + * @sa IVIDENC2_Params + * @sa XDM1_AlgBufInfo + * @sa IVIDENC2_Fxns.process() + */ + XDAS_Int32 metadataType[IVIDEO_MAX_NUM_METADATA_PLANES];/**< Type of + * each metadata plane. + * + * @sa IVIDEO_MetadataType + */ + IVIDENC2_DynamicParams encDynamicParams; /**< Video encoder dynamic + * parameters. + * + * @todo Need to better wordsmith this + * section. + * + * @remarks In case of extened dynamic + * Params, alg can check the + * size of status or + * DynamicParams and return + * the parameters accordingly. + */ +} IVIDENC2_Status; + + +/** + * @brief Defines the run time output arguments for all IVIDENC2 + * instance objects + * + * @extensibleStruct + * + * @sa IVIDENC2_Fxns::process() + */ +typedef struct IVIDENC2_OutArgs { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 extendedError; /**< @extendedErrorField */ + XDAS_Int32 bytesGenerated; /**< Number of bytes generated during the + * IVIDENC2_Fxns::process() call. + */ + XDAS_Int32 encodedFrameType;/**< @copydoc IVIDEO_FrameType + * + * @sa IVIDEO_FrameType + */ + XDAS_Int32 inputFrameSkip; /**< @copydoc IVIDEO_SkipMode + * + * @sa IVIDEO_SkipMode + */ + XDAS_Int32 freeBufID[IVIDEO2_MAX_IO_BUFFERS]; /**< This is an + * array of inputID's corresponding to the + * buffers that have been unlocked in the + * current process call. + * + * @remarks The buffers released by the + * algorithm are indicated by + * their non-zero ID (previously + * provided via + * IVIDENC2_InArgs#inputID). + * + * @remarks 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. + * + * @remarks If no buffer was unlocked in + * the process call, + * @c freeBufID[0] will + * have a value of zero. + * + * @sa IVIDENC2_InArgs#inputID + */ + + IVIDEO2_BufDesc reconBufs; /**< Reconstruction frames. */ +} IVIDENC2_OutArgs; + + +/** + * @brief Defines the control commands for the IVIDENC2 module + * + * @remarks This ID can be extended in IMOD interface for + * additional controls. + * + * @sa XDM_CmdId + * + * @sa IVIDENC2_Fxns::control() + */ +typedef IALG_Cmd IVIDENC2_Cmd; + + +/** + * @brief Defines all of the operations on IVIDENC2 objects + */ +typedef struct IVIDENC2_Fxns { + IALG_Fxns ialg; /**< XDAIS algorithm interface. + * + * @sa IALG_Fxns + */ + +/** + * @brief Basic video encoding call + * + * @param[in] handle Handle to an algorithm instance. + * @param[in,out] inBufs Input video buffer descriptors. + * @param[in,out] outBufs Output buffer descriptors. The algorithm + * may modify the output buffer pointers. + * @param[in] inArgs Input arguments. This is a required + * parameter. + * @param[out] outArgs Ouput results. This is a required parameter. + * + * @remarks process() is a blocking call. When process() returns, the + * algorithm's processing is complete. + * + * @pre @c inBufs must not be NULL, and must point to a valid + * IVIDEO2_BufDesc structure. + * + * @pre @c inBufs->numPlanes will indicate the total number of input + * buffers supplied for input frame in the @c inBufs->planeDesc[] + * array. + * + * @pre @c inBufs->numMetaPlanes will indicate the total number of input + * buffers supplied for meta data planes in the + * @c inBufs->metadataPlaneDesc[] array. + * + * @pre @c outBufs must not be NULL, and must point to a valid + * XDM2_BufDesc structure. + * + * @pre @c outBufs->buf[0] must not be NULL, and must point to + * a valid buffer of data that is at least + * @c outBufs->bufSizes[0] bytes in length. + * + * @pre @c inArgs must not be NULL, and must point to a valid + * IVIDENC2_InArgs structure. + * + * @pre @c outArgs must not be NULL, and must point to a valid + * IVIDENC2_OutArgs structure. + * + * @pre The buffers in @c inBuf and @c outBuf are physically + * contiguous and owned by the calling application. + * + * @post The algorithm must not modify the contents of @c inArgs. + * + * @post The algorithm must not modify the contents of + * @c inBufs, with the exception of @c inBufs.bufDesc[].accessMask. + * That is, the data and buffers pointed to by these parameters + * must be treated as read-only. + * + * @post The algorithm must appropriately set/clear the + * IVIDEO2_BufDesc.planeDesc[].accessMask and + * IVIDEO2_BufDesc.metadataPlaneDesc[].accessMask fields in + * @c inBufs to indicate the mode in which each of the respective + * buffers were read. + * For example, if the algorithm only read from + * @c inBufs.planeDesc[0].buf using the algorithm processor, it + * could utilize #XDM_SETACCESSMODE_READ to update the appropriate + * @c accessMask fields. + * The application may utilize these + * returned values to appropriately manage cache. + * + * @post The buffers in @c inBufs are + * owned by the calling application. + * + * @retval #IVIDENC2_EOK @copydoc IVIDENC2_EOK + * @retval #IVIDENC2_EFAIL @copydoc IVIDENC2_EFAIL + * See IVIDENC2_Status.extendedError + * for more detailed further error + * conditions. + * @retval #IVIDENC2_EUNSUPPORTED @copydoc IVIDENC2_EUNSUPPORTED + * + * @todo Need to review these comments. Not sure @c inBufs and + * @c outBufs are correctly described. + */ + XDAS_Int32 (*process)(IVIDENC2_Handle handle, IVIDEO2_BufDesc *inBufs, + XDM2_BufDesc *outBufs, IVIDENC2_InArgs *inArgs, + IVIDENC2_OutArgs *outArgs); + + +/** + * @brief Control behavior of an algorithm + * + * @param[in] handle Handle to an algorithm instance. + * @param[in] id Command id. See #XDM_CmdId. + * @param[in] params Dynamic parameters. This is a required + * parameter. + * @param[out] status Output results. This is a required parameter. + * + * @pre @c handle must be a valid algorithm instance handle. + * + * @pre @c params must not be NULL, and must point to a valid + * IVIDENC2_DynamicParams structure. + * + * @pre @c status must not be NULL, and must point to a valid + * IVIDENC2_Status structure. + * + * @pre If a buffer is provided in the @c status->data field, + * it must be physically contiguous and owned by the calling + * application. + * + * @post The algorithm must not modify the contents of @c params. + * That is, the data pointed to by this parameter must be + * treated as read-only. + * + * @post If a buffer was provided in the @c status->data field, + * it is owned by the calling application. + * + * @retval #IVIDENC2_EOK @copydoc IVIDENC2_EOK + * @retval #IVIDENC2_EFAIL @copydoc IVIDENC2_EFAIL + * See IVIDENC2_Status.extendedError + * for more detailed further error + * conditions. + * @retval #IVIDENC2_EUNSUPPORTED @copydoc IVIDENC2_EUNSUPPORTED + */ + XDAS_Int32 (*control)(IVIDENC2_Handle handle, IVIDENC2_Cmd id, + IVIDENC2_DynamicParams *params, IVIDENC2_Status *status); + +} IVIDENC2_Fxns; + + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/packages/xdais/ti/xdais/dm/ivideo.h b/packages/xdais/ti/xdais/dm/ivideo.h new file mode 100755 index 0000000..5711a39 --- /dev/null +++ b/packages/xdais/ti/xdais/dm/ivideo.h @@ -0,0 +1,829 @@ +/* + * Copyright (c) 2006-2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file ti/xdais/dm/ivideo.h + * + * @brief This header defines all types, constants, enums, and functions + * that are common across the various video codecs. + */ +/** + * @addtogroup ti_xdais_dm_IVIDEO IVIDEO - XDM Video Interface + * + * This is the XDM video interface shared between the various codecs. + */ + +#ifndef ti_xdais_dm_IVIDEO_ +#define ti_xdais_dm_IVIDEO_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup ti_xdais_dm_IVIDEO */ +/*@{*/ + +/** + * @brief Maximum I/O Buffers. + * + * @sa IVIDDEC2_OutArgs + * @sa IVIDDEC3_OutArgs + * @sa IVIDENC2_OutArgs + */ +#define IVIDEO2_MAX_IO_BUFFERS 20 + +/** + * @brief Video frame skip features for video decoder. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_NO_SKIP = 0, /**< Do not skip any frame types. */ + IVIDEO_SKIP_P = 1, /**< Decode the P frame/skip frames internally, + * but do not copy the decoded output to the + * output buffers. This should be indicated + * by setting the output buffers to NULL. + * + * @remarks For example, if a B frame is + * dependant on the + * previously decoded P + * frame, the B frame + * shall be decoded and + * displayed + * successfully. For + * this, the P frame + * needs to be decoded, + * but not copied to the + * output buffer. + */ + IVIDEO_SKIP_B = 2, /**< Skip B, BI frames. For B frames, the + * decoder will decode the frame + * bitstream, and return as soon as the + * frame type is decisively decoded. + * Internally, the algorithm will modify + * its state, so that subsequent + * decoding of other frames is possible. + */ + IVIDEO_SKIP_I = 3, /**< Skip intra coded frame. */ + IVIDEO_SKIP_IP = 4, /**< Skip I and P frame/field(s). */ + IVIDEO_SKIP_IB = 5, /**< Skip I and B frame/field(s). */ + IVIDEO_SKIP_PB = 6, /**< Skip P and B frame/field(s). */ + IVIDEO_SKIP_IPB = 7, /**< Skip I/P/B/BI frames. */ + IVIDEO_SKIP_IDR = 8, /**< Skip IDR Frame. */ + IVIDEO_SKIP_NONREFERENCE = 9, /**< @todo add documentation */ + + /** Default settings. */ + IVIDEO_SKIP_DEFAULT = IVIDEO_NO_SKIP +} IVIDEO_FrameSkip; + +/** + * @brief Video frame types. + * + * @remarks For the various @c IVIDEO_xy_FRAME values, this frame type is + * interlaced where both top and bottom fields are + * provided in a single frame. The first field is an "x" + * frame, the second field is "y" field. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_NA_FRAME = -1, /**< Frame type not available. */ + IVIDEO_I_FRAME = 0, /**< Intra coded frame. */ + IVIDEO_P_FRAME = 1, /**< Forward inter coded frame. */ + IVIDEO_B_FRAME = 2, /**< Bi-directional inter coded frame. */ + IVIDEO_IDR_FRAME = 3, /**< Intra coded frame that can be used for + * refreshing video content. + */ + IVIDEO_II_FRAME = 4, /**< Interlaced Frame, both fields are I frames */ + IVIDEO_IP_FRAME = 5, /**< Interlaced Frame, first field is an I frame, + * second field is a P frame. + */ + IVIDEO_IB_FRAME = 6, /**< Interlaced Frame, first field is an I frame, + * second field is a B frame. + */ + IVIDEO_PI_FRAME = 7, /**< Interlaced Frame, first field is a P frame, + * second field is a I frame. + */ + IVIDEO_PP_FRAME = 8, /**< Interlaced Frame, both fields are P frames. */ + IVIDEO_PB_FRAME = 9, /**< Interlaced Frame, first field is a P frame, + * second field is a B frame. + */ + IVIDEO_BI_FRAME = 10, /**< Interlaced Frame, first field is a B frame, + * second field is an I frame. + */ + IVIDEO_BP_FRAME = 11, /**< Interlaced Frame, first field is a B frame, + * second field is a P frame. + */ + IVIDEO_BB_FRAME = 12, /**< Interlaced Frame, both fields are B frames. */ + IVIDEO_MBAFF_I_FRAME = 13, /**< Intra coded MBAFF frame. */ + IVIDEO_MBAFF_P_FRAME = 14, /**< Forward inter coded MBAFF frame. */ + IVIDEO_MBAFF_B_FRAME = 15, /**< Bi-directional inter coded MBAFF frame.*/ + IVIDEO_MBAFF_IDR_FRAME = 16, /**< Intra coded MBAFF frame that can be used + * for refreshing video content. + */ + /** Default setting. */ + IVIDEO_FRAMETYPE_DEFAULT = IVIDEO_I_FRAME +} IVIDEO_FrameType; + +/** + * @brief Video content types. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_CONTENTTYPE_NA = -1,/**< Frame type is not available. */ + IVIDEO_PROGRESSIVE = 0, /**< Progressive frame. */ + IVIDEO_PROGRESSIVE_FRAME = IVIDEO_PROGRESSIVE, /**< Progressive Frame. */ + IVIDEO_INTERLACED = 1, /**< Interlaced frame. */ + IVIDEO_INTERLACED_FRAME = IVIDEO_INTERLACED, /**< Interlaced frame. */ + IVIDEO_INTERLACED_TOPFIELD = 2, /**< Interlaced picture, top field. */ + IVIDEO_INTERLACED_BOTTOMFIELD = 3, /**< Interlaced picture, bottom field. */ + + /**Default setting. */ + IVIDEO_CONTENTTYPE_DEFAULT = IVIDEO_PROGRESSIVE +} IVIDEO_ContentType; + + +/** + * @brief Video rate control presets. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_LOW_DELAY = 1, /**< CBR rate control for video conferencing. */ + IVIDEO_STORAGE = 2, /**< VBR rate control for local storage (DVD) + * recording. + */ + IVIDEO_TWOPASS = 3, /**< Two pass rate control for non real time + * applications. + */ + IVIDEO_NONE = 4, /**< No configurable video rate control + * mechanism. + */ + IVIDEO_USER_DEFINED = 5,/**< User defined configuration using extended + * parameters. + */ + + /** Default setting. */ + IVIDEO_RATECONTROLPRESET_DEFAULT = IVIDEO_LOW_DELAY +} IVIDEO_RateControlPreset; + + +/** + * @brief Video frame skipping modes. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_FRAME_ENCODED = 0, /**< Input video frame successfully encoded. */ + IVIDEO_FRAME_SKIPPED = 1, /**< Input video frame dropped. There is no + * encoded bitstream corresponding to the + * input frame. + */ + + /** Default setting. */ + IVIDEO_SKIPMODE_DEFAULT = IVIDEO_FRAME_ENCODED +} IVIDEO_SkipMode; + + +/** + * @brief Video output buffer status. + * + * @remarks Ownership of the buffers, either by application or algorithm, + * is conveyed via these values. + * + * @remarks This reflects the status of ALL output buffers. For example, + * if video decoded output is in 4:2:0 format, all the 3 + * output buffers' status is described by this value. + * Similarly, for 4:2:2 formatted buffers, this value + * describes the single buffer's status. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_FRAME_NOERROR = 0, /**< The output buffer is available. + */ + IVIDEO_FRAME_NOTAVAILABLE = 1, /**< The codec doesn't have any output + * buffers. + */ + IVIDEO_FRAME_ERROR = 2, /**< The output buffer is available and + * corrupted. + * + * @remarks For example, if a bitstream + * is erroneous and + * partially decoded, a + * portion of the decoded + * image may be available + * for display. Another + * example is if the + * bitstream for a given + * frame decode may be + * decoded without error, + * but the previously + * decoded dependant + * frames weren't + * successfully decoded. + * This would result in + * an incorrectly decoded + * frame. + */ + IVIDEO_FRAME_OUTPUTSKIP = 3,/**< The video frame was skipped (i.e. not + * decoded). + */ + + /** Default setting. */ + IVIDEO_OUTPUTFRAMESTATUS_DEFAULT = IVIDEO_FRAME_NOERROR +} IVIDEO_OutputFrameStatus; + +/** + * @brief Video Picture types. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_NA_PICTURE = -1, /**< Frame type not available. */ + IVIDEO_I_PICTURE = 0, /**< Intra coded picture. */ + IVIDEO_P_PICTURE = 1, /**< Forward inter coded picture. */ + IVIDEO_B_PICTURE = 2, /**< Bi-directional inter coded picture. */ + /** Default setting. */ + IVIDEO_PICTURE_TYPE_DEFAULT = IVIDEO_I_PICTURE +} IVIDEO_PictureType; + + +/** + * @brief Video Format types. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_MPEG1 = 1, /**< Video format is Mpeg1 stream */ + IVIDEO_MPEG2SP = 2, /**< Video format is Mpeg2/H.262 stream, Simple Profile */ + IVIDEO_MPEG2MP = 3, /**< Video format is Mpeg2/H.262 stream, Main Profile */ + IVIDEO_MPEG2HP = 4, /**< Video format is Mpeg2/H.262 stream, High Profile */ + IVIDEO_MPEG4SP = 5, /**< Video format is Mpeg4 stream, Simple Profile */ + IVIDEO_MPEG4ASP = 6, /**< Video format is Mpeg4 stream, Advanced Simple Profile */ + IVIDEO_H264BP = 7, /**< Video format is H.264 stream, Base Profile */ + IVIDEO_H264MP = 8, /**< Video format is H.264 stream, Main Profile */ + IVIDEO_H264HP = 9, /**< Video format is H.264 stream, High Profile */ + IVIDEO_VC1SP = 10, /**< Video format is VC1/WMV9 stream, Simple Profile */ + IVIDEO_VC1MP = 11, /**< Video format is VC1/WMV9 stream, Main Profile */ + IVIDEO_VC1AP = 12, /**< Video format is VC1 stream, Advanced Profile */ + IVIDEO_H264RCDO = 13, /**< Video format is H.264 stream, Fast profile/RCDO */ + IVIDEO_RV8 = 14, /**< Video format is Real Video 8 stream */ + IVIDEO_RV9 = 15, /**< Video format is Real Video 9 stream */ + IVIDEO_RV10 = IVIDEO_RV9, /**< Video format is Real Video 10 stream, same as RV9 */ + IVIDEO_ON2VP6 = 16, /**< Video format is ON2, VP6.x */ + IVIDEO_ON2VP7 = 17, /**< Video format is ON2, VP7.x */ + IVIDEO_AVS10 = 18, /**< Video format is AVS 1.0 */ + IVIDEO_SORENSONSPARK = 19, /**< Video format is SorensonSpark V0/V1 */ + IVIDEO_H263_PROFILE0 = 20, /**< Video format is H263 Base line profile */ + IVIDEO_H263_PROFILE3 = 21, /**< Video format is H263 and Annex IJKT */ + IVIDEO_H264SVC = 22, /**< Video format is SVC */ + IVIDEO_MULTIVIEW = 23, /**< Video format is Multiview coding */ + IVIDEO_MJPEG = 24 /**< Video format is motion JPEG */ +} IVIDEO_Format; + + +/** + * @brief Buffer descriptor for video buffers. + */ +typedef struct IVIDEO_BufDesc { + XDAS_Int32 numBufs; /**< Number of buffers. */ + XDAS_Int32 width; /**< Added width of a video frame. */ + XDAS_Int8 *bufs[XDM_MAX_IO_BUFFERS]; /**< Pointer to vector + * containing buffer addresses. + */ + XDAS_Int32 bufSizes[XDM_MAX_IO_BUFFERS]; /**< Size of each buffer + * in 8-bit bytes. + */ +} IVIDEO_BufDesc; + +/** + * @brief Buffer descriptor for input video buffers. + */ +typedef struct IVIDEO1_BufDescIn { + XDAS_Int32 numBufs; /**< Number of buffers in bufDesc[]. */ + XDAS_Int32 frameWidth; /**< Width of the video frame. */ + XDAS_Int32 frameHeight; /**< Height of the video frame. */ + XDAS_Int32 framePitch; /**< Frame pitch used to store the frame. + * + * @remarks This field can also be used to + * indicate the padded width. + */ + XDM1_SingleBufDesc bufDesc[XDM_MAX_IO_BUFFERS]; /**< Picture buffers. */ +} IVIDEO1_BufDescIn; + + +/** + * @brief Max YUV buffers - one each for 'Y', 'U', and 'V'. + */ +#define IVIDEO_MAX_YUV_BUFFERS 3 + +/** + * @brief Detailed buffer descriptor for video buffers. + */ +typedef struct IVIDEO1_BufDesc { + XDAS_Int32 numBufs; /**< Number of buffers in bufDesc[]. */ + XDAS_Int32 frameWidth; /**< Width of the video frame. */ + XDAS_Int32 frameHeight; /**< Height of the video frame. */ + XDAS_Int32 framePitch; /**< Frame pitch used to store the frame. + * + * @remarks This field can also be used to + * indicate the padded width. + */ + XDM1_SingleBufDesc bufDesc[IVIDEO_MAX_YUV_BUFFERS]; /**< Picture buffers. */ + XDAS_Int32 extendedError; /**< @extendedErrorField */ + XDAS_Int32 frameType; /**< @copydoc IVIDEO_FrameType + * + * @sa IVIDEO_FrameType + */ + XDAS_Int32 topFieldFirstFlag;/**< Flag to indicate when the application + * should display the top field first. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + * + * @remarks This field is only applicable + * for interlaced content, not + * progressive. + * + * @remarks This field does not apply to + * encoder recon bufs. + */ + XDAS_Int32 repeatFirstFieldFlag;/**< Flag to indicate when the first field + * should be repeated. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + * + * @remarks This field is only applicable + * for interlaced content, not + * progressive. + * + * @remarks This field does not apply to + * encoder recon bufs. + */ + XDAS_Int32 frameStatus; /**< @copydoc IVIDEO_OutputFrameStatus + * + * @sa IVIDEO_OutputFrameStatus + * + * @remarks This field does not apply to + * encoder recon bufs. + */ + XDAS_Int32 repeatFrame; /**< Number of times the display process + * needs to repeat the displayed progressive + * frame. + * + * @remarks This information is useful + * for progressive + * content when the + * decoder expects the + * display process to + * repeat the displayed + * frame for a certain + * number of times. This + * is useful for pulldown + * (frame/field + * repetition by display + * system) support + * where the display + * frame rate is + * increased without + * increasing the decode + * frame rate. + * + * @remarks The default value is 0. + * + * @remarks This field does not apply to + * encoder recon bufs. + */ + XDAS_Int32 contentType; /**< Content type of the buffer. + * + * @remarks This is useful when the + * content is both + * interlaced and + * progressive. The + * display process can + * use this field to + * determine how to + * render the display + * buffer. + * + * @sa IVIDEO_ContentType + */ + XDAS_Int32 chromaFormat; /**< @copydoc XDM_ChromaFormat + * + * @sa XDM_ChromaFormat + */ +} IVIDEO1_BufDesc; + +/** + * @brief Video buffer layout. + * + * @todo Do we need a default value for this enum? + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_FIELD_INTERLEAVED = 0, /**< Buffer layout is interleaved. */ + IVIDEO_FIELD_SEPARATED = 1, /**< Buffer layout is field separated. */ + IVIDEO_TOP_ONLY = 2, /**< Buffer contains only top field. */ + IVIDEO_BOTTOM_ONLY = 3 /**< Buffer contains only bottom field. */ +} IVIDEO_VideoLayout; + +/** + * @brief Video coding mode of operation. + * + * @todo Do we need a default value for this enum? + * + * @todo Should "decode" and "encode" modes change to "process full frame"? + * For example, setting DECODE_ONLY for an encoder is wrong - can we + * make it impossible for codecs/apps to make this error? + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_DECODE_ONLY = 0, /**< Decoding mode. */ + IVIDEO_ENCODE_ONLY = 1, /**< Encoding mode. */ + IVIDEO_TRANSCODE_FRAMELEVEL = 2,/**< Transcode mode of operation + * (encode/decode) which consumes/generates + * transcode information at the frame level. + */ + IVIDEO_TRANSCODE_MBLEVEL = 3, /**< Transcode mode of operation + * (encode/decode) which consumes/generates + * transcode information at the MB level. + */ + IVIDEO_TRANSRATE_FRAMELEVEL = 4,/**< Transrate mode of operation for + * encoder which consumes transrate + * information at the frame level. + */ + IVIDEO_TRANSRATE_MBLEVEL = 5 /**< Transrate mode of operation for + * encoder which consumes transrate + * information at the MB level. + */ +} IVIDEO_OperatingMode; + +/** + * @brief Video bit range + * + * @enumWarning + * + * @extendedEnum + * + * @todo Do we need a default value for this enum? + */ +typedef enum { + IVIDEO_YUVRANGE_FULL = 0, /**< Pixel range for YUV is 0-255. */ + IVIDEO_YUVRANGE_ITU = 1 /**< Pixel range for YUV is as per ITU-T. */ +} IVIDEO_BitRange; + +/** + * @brief input/output data mode + * + * @enumWarning + * + * @extendedEnum + * + * @todo Do we need a default value for this enum? + * + * @todo Request from DM365 team to split IVIDEO_SLICEMODE into + * IVIDEO_SLICEMODE_BYTE and IVIDEO_SLICEMODE_NAL. + */ +typedef enum { + IVIDEO_FIXEDLENGTH = 0, /**< In terms of multiples of 2K */ + IVIDEO_SLICEMODE = 1, /**< Slice mode */ + IVIDEO_NUMROWS = 2, /**< Number of rows, each row is 16 lines of video */ + IVIDEO_ENTIREFRAME = 3 /**< Processing of entire frame data */ +} IVIDEO_DataMode; + + +/** + * @brief Configuration for providing/receiving packet error information + * + * @enumWarning + */ +typedef enum { + IVIDEO_ERRORINFO_OFF = 0, /**< Packet error information is + * unsupported. + */ + IVIDEO_ERRORINFO_ON_INPUT = 1, /**< Packet error information is + * supported for input data. + */ + IVIDEO_ERRORINFO_ON_OUTPUT = 2, /**< Packet error information is + * supported for output data. + */ + IVIDEO_ERRORINFO_ON_BOTH = 3, /**< Packet error information is + * supported for both input and + * output data. + */ + /** Default setting. */ + IVIDEO_ERRORINFO_MODE_DEFAULT = IVIDEO_ERRORINFO_OFF + +} IVIDEO_ErrorInfoMode; + +/** + * @brief Max YUV buffers - one each for 'Y', 'U', and 'V'. + */ +#define IVIDEO_MAX_NUM_PLANES 3 /**< Luma followed by chroma. */ +#define IVIDEO_MAX_NUM_METADATA_PLANES 3 /**< MBINFO , packet error info and + * alpha planes. + * + * @sa IVIDEO_METADATAPLANE_MBINFO + * @sa IVIDEO_METADATAPLANE_EINFO + * @sa IVIDEO_METADATAPLANE_ALPHA + */ + +/* + * @brief Metadata types + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + IVIDEO_METADATAPLANE_NONE = -1, /**< Used to indicate no metadata + * is requested or available. + */ + IVIDEO_METADATAPLANE_MBINFO = 0, /**< Offset into + * IVIDEO_MAX_NUM_METADATA_PLANES + * array for MB Info. + * + * @sa IVIDEO_MAX_NUM_METADATA_PLANES + */ + IVIDEO_METADATAPLANE_EINFO = 1, /**< Offset into + * IVIDEO_MAX_NUM_METADATA_PLANES + * array for Error Info. + * + * @sa IVIDEO_MAX_NUM_METADATA_PLANES + */ + IVIDEO_METADATAPLANE_ALPHA = 2 /**< Offset into + * IVIDEO_MAX_NUM_METADATA_PLANES + * array for Alpha Data. + * + * @sa IVIDEO_MAX_NUM_METADATA_PLANES + */ + +} IVIDEO_MetadataType; + +/** + * @brief Detailed buffer descriptor for video buffers. + */ +typedef struct IVIDEO2_BufDesc { + XDAS_Int32 numPlanes; /**< Number of video planes. + * + * @remarks This must be in the range + * 0 - #IVIDEO_MAX_NUM_PLANES. + * + * @todo Need further description. + */ + XDAS_Int32 numMetaPlanes; /**< Number of meta data planes. + * + * @remarks This must be in the range + * 0 - #IVIDEO_MAX_NUM_METADATA_PLANES. + * + * @todo Need further description. + */ + XDAS_Int32 dataLayout; /**< Field interleaved, field separated. + * + * @todo Need further description. + * Is there an enum we should + * reference for valid values? + * Perhaps IVIDEO_VideoLayout? + */ + XDM2_SingleBufDesc planeDesc[IVIDEO_MAX_NUM_PLANES]; /**< Picture buffers. */ + XDM2_SingleBufDesc metadataPlaneDesc[IVIDEO_MAX_NUM_METADATA_PLANES]; /**< Meta planes. + * + * @remarks For MB Info & alpha blending + * + * @todo Need further description. + */ + XDAS_Int32 secondFieldOffsetWidth[IVIDEO_MAX_NUM_PLANES]; /**< Offset + * for second field (width in pixels). + * + * @remarks Valid only if above pointer + * is not NULL. + * + * @todo Need further description. + * Which "above pointer"? Is + * this relavent to planeDesc + * or metadataPlaneDesc... or + * both? Is the "width in pixels" + * comment correct? + */ + XDAS_Int32 secondFieldOffsetHeight[IVIDEO_MAX_NUM_PLANES]; /**< Offset + * for second field (height in lines). + * + * @remarks Valid only if above pointer + * is not NULL. + * + * @todo Need further description. + * Which "above pointer"? Is + * this relavent to planeDesc + * or metadataPlaneDesc... or + * both? + */ + XDAS_Int32 imagePitch[IVIDEO_MAX_NUM_PLANES]; /**< Image pitch for + * each plane. + */ + XDM_Rect imageRegion; /**< Image region (top left and bottom + * right). + */ + XDM_Rect activeFrameRegion; /**< Active frame region (top left and + * bottom right). + */ + XDAS_Int32 extendedError; /**< @extendedErrorField + * + * @remarks This field is not required + * for encoders. + */ + XDAS_Int32 frameType; /**< @copydoc IVIDEO_FrameType + * + * @remarks This field is not required + * for encoder input buffer. + * + * @sa IVIDEO_FrameType + */ + XDAS_Int32 topFieldFirstFlag;/**< Flag to indicate when the application + * should display the top field first. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + * + * @remarks This field is only app licable + * for interlaced content, not + * progressive. + * + * @remarks This field does not apply to + * encoder recon bufs. + */ + XDAS_Int32 repeatFirstFieldFlag;/**< Flag to indicate when the first field + * should be repeated. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + * + * @remarks This field is only applicable + * for interlaced content, not + * progressive. + * + * @remarks This field does not apply to + * encoder recon bufs. + */ /* not required for encoder input buffer */ + XDAS_Int32 frameStatus; /**< @copydoc IVIDEO_OutputFrameStatus + * + * @sa IVIDEO_OutputFrameStatus + * + * @remarks This field does not apply to + * encoder recon bufs. + */ /* not required for encoder input buffer */ + XDAS_Int32 repeatFrame; /**< Number of times the display process + * needs to repeat the displayed progressive + * frame. + * + * @remarks This information is useful + * for progressive + * content when the + * decoder expects the + * display process to + * repeat the displayed + * frame for a certain + * number of times. This + * is useful for pulldown + * (frame/field + * repetition by display + * system) support + * where the display + * frame rate is + * increased without + * increasing the decode + * frame rate. + * + * @remarks The default value is 0. + * + * @remarks This field does not apply to + * encoder recon bufs. + */ /* not required for encoder input buffer */ + XDAS_Int32 contentType; /**< Content type of the buffer. + * + * @remarks This is useful when the + * content is both + * interlaced and + * progressive. The + * display process can + * use this field to + * determine how to + * render the display + * buffer. + * + * @sa IVIDEO_ContentType + */ + XDAS_Int32 chromaFormat; /**< @copydoc XDM_ChromaFormat + * + * @sa XDM_ColorFormat + */ + XDAS_Int32 scalingWidth; /**< Scaled image width for post processing. + * @remarks This field is not required + * for encoders. + * + * @todo Is this in pixels? + * + * @todo Should this field and + * scalingHeight use a XDM_Rect + * data type? + */ + XDAS_Int32 scalingHeight; /**< Scaled image width for post processing. + * + * @remarks This field is not required + * for encoders. + * + * @todo Is this in pixels? + */ + XDAS_Int32 rangeMappingLuma;/**< Range Mapping Luma + * + * @todo Need further description. + * + * @todo We should explore what we did + * in the speech interfaces and + * perhaps create an ivideo_vc1.h + * with VC1-specific definitions. + */ + XDAS_Int32 rangeMappingChroma;/**< Range Mapping Chroma + * + * @todo Need further description. + * + * @todo We should explore what we did + * in the speech interfaces and + * perhaps create an ivideo_vc1.h + * with VC1-specific definitions. + */ + XDAS_Int32 enableRangeReductionFlag;/**< Flag indicating whether or not + * to enable range reduction. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + * + * @todo We should explore what we did + * in the speech interfaces and + * perhaps create an ivideo_vc1.h + * with VC1-specific definitions. + */ +} IVIDEO2_BufDesc; + + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/packages/xdais/ti/xdais/dm/xdm.h b/packages/xdais/ti/xdais/dm/xdm.h new file mode 100755 index 0000000..4466d3d --- /dev/null +++ b/packages/xdais/ti/xdais/dm/xdm.h @@ -0,0 +1,1367 @@ +/* + * Copyright (c) 2006-2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file ti/xdais/dm/xdm.h + * + * @brief This header defines all types, constants, and functions + * shared across the various XDM classes of algorithms. + */ +/** + * @addtogroup ti_xdais_dm_XDM XDM - Shared XDM Definitions + * + * This is the XDM interface. + */ + +#ifndef ti_xdais_dm_XDM_ +#define ti_xdais_dm_XDM_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup ti_xdais_dm_XDM */ +/*@{*/ + +#define XDM_EOK IALG_EOK /**< Success. */ +#define XDM_EFAIL IALG_EFAIL /**< General failure. */ +#define XDM_EUNSUPPORTED -3 /**< Request is unsupported. */ + + +#ifdef XDM_INCLUDE_DOT9_SUPPORT +/** + * @brief General runtime failure. + * + * @deprecated This is only supported on 0.9 XDM. To use it, you must + * define "XDM_INCLUDE_DOT9_SUPPORT". + * In XDM 1.00+, it is required that codecs return "EFAIL", as + * "ERUNTIME" is not supported. + */ +#define XDM_ERUNTIME -2 +#endif + +#define XDM_MAX_IO_BUFFERS 16 /**< Max I/O Buffers */ + +/** + * @brief Buffer descriptor for multiple buffers. + * + * @dot + * digraph example { + * rankdir=LR; + * node [shape=record]; + * XDM_BufDesc [ style=filled, fillcolor=gray98, label=" XDAS_Int8 **bufs | XDAS_Int32 numBufs | XDAIS_Int32 *bufSizes"]; + * bufArray [ label=" ptr to buf 0 | ptr to buf 1| ptr to buf 2|.\n.\n.\n" ]; + * buf0 [ label=" data buf 0" ]; + * buf1 [ label=" data buf 1" ]; + * buf2 [ label=" data buf 2" ]; + * bufSizes [ label=" size of data buf 0 | size of data buf 1 | size of data buf 2|.\n.\n.\n" ]; + * XDM_BufDesc:bufs -> bufArray:f0; + * bufArray:f0 -> buf0:f0; + * bufArray:f1 -> buf1:f0; + * bufArray:f2 -> buf2:f0; + * XDM_BufDesc:bufSizes -> bufSizes:f0; + * } + * @enddot + * + * @pre @c numBufs can not be larger than #XDM_MAX_IO_BUFFERS. Related, + * @c *bufs and @c *bufSizes will never be indexed beyond + * #XDM_MAX_IO_BUFFERS elements. + * + * @remarks This data type is commonly used to manage input and output + * buffers. + * + * @remarks If @c *bufs is a sparse array, @c *bufSizes will be a similar + * sparse array. The @c NULL indexes in @c bufs will be ignored + * in @c bufSizes. + * + * @remarks @c numBufs describes the number of buffers in this descriptor. + * if @c *bufs is a sparse array, @c numBufs describes + * the number of non-NULL buffers in this descriptor; + * this is not necessarily the maximum index of the last + * buffer pointed to by @c *bufs. + * + * @remarks An example utilizing XDM_BufDesc as a sparse array would be + * the following: + * @code + * XDM_BufDesc outBufs; + * XDAS_Int32 bufSizeArray[XDM_MAX_IO_BUFFERS]; + * XDAS_Int8 *pBuffers[XDM_MAX_IO_BUFFERS]; + * XDAS_Int8 buffer1[4096]; + * XDAS_Int8 buffer2[1024]; + * + * // ensure all pBuffers and bufSizeArray are initially NULL + * memset(pBuffers, 0, sizeof(pBuffers[0]) * XDM_MAX_IO_BUFFERS); + * memset(bufSizeArray, 0, + * sizeof(bufSizeArray[0]) * XDM_MAX_IO_BUFFERS); + * + * pBuffers[0] = buffer1; + * pBuffers[4] = buffer2; + * + * bufSizeArray[0] = 4096; + * bufSizeArray[4] = 1024; + * + * outBufs.bufs = pBuffers; + * outBufs.numBufs = 2; + * outBufs.bufSizes = bufSizeArray; + * @endcode + * + * @remarks The following diagram describes graphically the example above. + * + * @dot + * digraph example { + * rankdir=LR; + * node [shape=record]; + * XDM_BufDesc [ style=filled, fillcolor=gray98, label=" bufs = pBuffers | numBufs = 2 | bufSizes = bufSizeArray"]; + * bufArray [ label=" pBuffers[0] | NULL | NULL| NULL| pBuffers[4]|NULL|NULL|.\n.\n.\n" ]; + * buf0 [ label=" buffer1" ]; + * buf4 [ label=" buffer2" ]; + * bufSizes [ label=" 4096|0|0|0|1024|0|0| .\n.\n.\n" ]; + * XDM_BufDesc:bufs -> bufArray:f0; + * bufArray:f0 -> buf0:f0; + * bufArray:f4 -> buf4:f0; + * XDM_BufDesc:bufSizes -> bufSizes:f0; + * } + * @enddot + * + */ +typedef struct XDM_BufDesc { + XDAS_Int8 **bufs; /**< Pointer to an array containing buffer + * addresses. + */ + XDAS_Int32 numBufs; /**< Number of buffers. */ + XDAS_Int32 *bufSizes; /**< Size of each buffer in 8-bit bytes. */ +} XDM_BufDesc; + + +/** + * @brief Single buffer descriptor. + */ +typedef struct XDM_SingleBufDesc { + XDAS_Int8 *buf; /**< Pointer to a buffer address. */ + XDAS_Int32 bufSize; /**< Size of @c buf in 8-bit bytes. */ +} XDM_SingleBufDesc; + + + +/** + * @brief Single buffer descriptor. + */ +typedef struct XDM1_SingleBufDesc { + XDAS_Int8 *buf; /**< Pointer to a buffer address. */ + XDAS_Int32 bufSize; /**< Size of @c buf in 8-bit bytes. */ + XDAS_Int32 accessMask; /**< Mask filled by the algorithm, declaring + * how the buffer was accessed by the + * algorithm processor. + * + * @remarks If the buffer was not + * accessed by the algorithm + * processor (e.g., it was filled + * via DMA or other hardware + * accelerator that doesn't + * write through the algorithm's + * CPU), then no bits in this mask + * should be set. + * + * @remarks It is acceptible (and + * appropriate!)to set several + * bits in this mask if the + * algorithm accessed the buffer + * in several ways. + * + * @remarks This mask is often used by the + * application and/or framework + * to appropriately manage cache + * on cache-based systems. + * + * @sa XDM_AccessMode + */ +} XDM1_SingleBufDesc; + + +/** + * @brief Union describing a buffer size + * + * @remarks More advanced memory types (e.g. tiled memory) cannot + * indicate buffer size using a simple integer, but rather + * must indicate memory size using a width and height. + */ +typedef union { + struct { + XDAS_Int32 width; /**< Width of @c buf in 8-bit bytes. */ + XDAS_Int32 height; /**< Height of @c buf in 8-bit bytes. */ + } tileMem; + XDAS_Int32 bytes; /**< Size of @c buf in 8-bit bytes. */ +} XDM2_BufSize; + +/** + * @brief Single buffer descriptor + * + * @remarks This buffer descriptor contains a @c memType field, and uses + * the XDM_BufSize union to indicate the size of the buffer. + * As a result, this data type can be used to describe + * complex memory types (e.g. tiled memory). + */ +typedef struct XDM2_SingleBufDesc { + XDAS_Int8 *buf; /**< Pointer to a buffer address. */ + XDAS_Int16 memType; /**< Memory type. + * + * @sa XDM_MemoryType + */ + XDAS_Int16 usageMode; /**< Memory usage descriptor. + * + * @remarks This field is set by the owner + * of the buffer (typically the + * application), and read by users + * of the buffer (including the + * algorithm). + * + * @sa XDM_MemoryUsageMode + */ + XDM2_BufSize bufSize; /**< Buffer size(for tile memory/row memory */ + XDAS_Int32 accessMask; /**< Mask filled by the algorithm, declaring + * how the buffer was accessed by the + * algorithm processor. + * + * @remarks If the buffer was not + * accessed by the algorithm + * processor (e.g., it was filled + * via DMA or other hardware + * accelerator that doesn't + * write through the algorithm's + * CPU), then no bits in this mask + * should be set. + * + * @remarks It is acceptible (and + * appropriate!)to set several + * bits in this mask if the + * algorithm accessed the buffer + * in several ways. + * + * @remarks This mask is often used by the + * application and/or framework + * to appropriately manage cache + * on cache-based systems. + * + * @sa XDM_AccessMode + */ +} XDM2_SingleBufDesc; + + +/** + * @brief Buffer descriptor. + */ +typedef struct XDM1_BufDesc { + XDAS_Int32 numBufs; /**< Number of buffers in @c descs array. + * + * @remarks Must be less than + * #XDM_MAX_IO_BUFFERS. + */ + XDM1_SingleBufDesc descs[XDM_MAX_IO_BUFFERS]; /** Array of buffer + * descriptors. + */ +} XDM1_BufDesc; + +/** + * @brief Buffer descriptor + * + * @remarks This advanced buffer uses the XDM2_SingleBufDesc, and is + * typically used for codecs which must reflect types + * of memory. For example, video codecs may need to indicate + * whether tiled memory is used. + */ +typedef struct XDM2_BufDesc { + XDAS_Int32 numBufs; /**< Number of buffers in @c descs array. + * + * @remarks Must be less than + * #XDM_MAX_IO_BUFFERS. + */ + XDM2_SingleBufDesc descs[XDM_MAX_IO_BUFFERS]; /** Array of buffer + * descriptors. + */ +} XDM2_BufDesc; + + +/** + * @brief Access modes used to declare how the algorithm accessed buffers. + * + * @remarks This indicates how the algorithm's CPU accessed the + * buffer, independent of DMA or other hardware accellerators. + * For example, if the buffer was written to with DMA (as + * opposed to writing to the buffer with the CPU write + * instructions), the algorithm should not set the + * XDM_ACCESSMODE_WRITE bit. + * + * @remarks The value of the enum is the bit offset into a mask. The value + * of the enum is not the value to assign the mask. + * + * + * @enumWarning + * + * @sa XDM1_SingleBufDesc + * @sa XDM1_BufDesc + */ +typedef enum { + XDM_ACCESSMODE_READ = 0, /**< The algorithm read from the + * buffer using the CPU. + * + * @sa XDM_SETACCESSMODE_READ + * @sa XDM_ISACCESSMODE_READ + */ + XDM_ACCESSMODE_WRITE = 1 /**< The algorithm wrote to the + * buffer using the CPU. + * + * @sa XDM_SETACCESSMODE_WRITE + * @sa XDM_ISACCESSMODE_WRITE + */ +} XDM_AccessMode; + + +/** + * @brief Check an access mask for CPU read access. + * + * @param x access mask. + * + * @remarks This is typically used by an application. + * + * @sa XDM1_SingleBufDesc::accessMask + * @sa XDM_ISACCESSMODE_WRITE + */ +#define XDM_ISACCESSMODE_READ(x) (((x) >> XDM_ACCESSMODE_READ) & 0x1) + + +/** + * @brief Check an access mask for CPU write access. + * + * @param x access mask. + * + * @remarks This is typically used by an application. + * + * @sa XDM1_SingleBufDesc::accessMask + * @sa XDM_ISACCESSMODE_READ + */ +#define XDM_ISACCESSMODE_WRITE(x) (((x) >> XDM_ACCESSMODE_WRITE) & 0x1) + + +/** + * @brief Clear the "CPU read access" bit in an access mask. + * + * @param x access mask. + * + * @remarks This is typically used by an algorithm. + * + * @sa XDM_SETACCESSMODE_READ + * @sa XDM1_SingleBufDesc::accessMask + */ +#define XDM_CLEARACCESSMODE_READ(x) ((x) &= (~(0x1 << XDM_ACCESSMODE_READ))) + + +/** + * @brief Clear the "CPU write access" bit in an access mask. + * + * @param x access mask. + * + * @remarks This is typically used by an algorithm. + * + * @sa XDM_SETACCESSMODE_WRITE + * @sa XDM1_SingleBufDesc::accessMask + */ +#define XDM_CLEARACCESSMODE_WRITE(x) ((x) &= (~(0x1 << XDM_ACCESSMODE_WRITE))) + + +/** + * @brief Set the bit to indicate CPU read access in an access mask. + * + * @param x access mask. + * + * @remarks This is typically used by an algorithm. + * + * @sa XDM1_SingleBufDesc::accessMask + */ +#define XDM_SETACCESSMODE_READ(x) ((x) |= (0x1 << XDM_ACCESSMODE_READ)) + + +/** + * @brief Set the bit to indicate CPU write access in an access mask. + * + * @param x access mask. + * + * @remarks This is typically used by an algorithm. + * + * @sa XDM1_SingleBufDesc::accessMask + */ +#define XDM_SETACCESSMODE_WRITE(x) ((x) |= (0x1 << XDM_ACCESSMODE_WRITE)) + + +/** + * @brief Buffer information descriptor for input and output buffers. + */ +typedef struct XDM1_AlgBufInfo { + XDAS_Int32 minNumInBufs; /**< Minimum number of input buffers. */ + XDAS_Int32 minNumOutBufs; /**< Minimum number of output buffers. */ + XDM2_BufSize minInBufSize[XDM_MAX_IO_BUFFERS]; /**< Minimum size required + * for each input buffer. + */ + XDM2_BufSize minOutBufSize[XDM_MAX_IO_BUFFERS]; /**< Minimum size required + * for each output buffer. + */ + XDAS_Int32 inBufMemoryType[XDM_MAX_IO_BUFFERS]; /**< Required memory type + * for each input buffer. + * + * @sa XDM_MemoryType + */ + XDAS_Int32 outBufMemoryType[XDM_MAX_IO_BUFFERS]; /**< Required memory type + * for each output buffer. + * + * @sa XDM_MemoryType + */ + XDAS_Int32 minNumBufSets; /**< Minimum number of buffer sets for + * buffer management. + * + * @todo need more details + */ +} XDM1_AlgBufInfo; + + +/** + * @brief Buffer information descriptor for input and output buffers. + */ +typedef struct XDM_AlgBufInfo { + XDAS_Int32 minNumInBufs; /**< Minimum number of input buffers. */ + XDAS_Int32 minNumOutBufs; /**< Minimum number of output buffers. */ + XDAS_Int32 minInBufSize[XDM_MAX_IO_BUFFERS]; /**< Minimum size, in 8-bit + * bytes, required for each input buffer. + */ + XDAS_Int32 minOutBufSize[XDM_MAX_IO_BUFFERS]; /**< Minimum size, in 8-bit + * bytes, required for each output buffer. + */ +} XDM_AlgBufInfo; + + +/** + * @brief Base of algorithm-specific enum values + * + * @remarks This is provided to ensure that future updates to XDM-defined + * enumerations don't conflict with algorithm-proprietary + * enumerations. + * + * @remarks Custom enumerations should be defined like the following + * (@c USERENUM0 and @c USERENUM1 are simply examples): + * @code + * #define MYMODULE_MYVENDOR_USERENUM0 (XDM_CUSTOMENUMBASE + 0) + * #define MYMODULE_MYVENDOR_USERENUM1 (XDM_CUSTOMENUMBASE + 1) + * @endcode + */ +#define XDM_CUSTOMENUMBASE 0x100 + + +/** + * @brief Base of algorithm-specific commands + * + * @remarks This is provided to ensure that future updates to XDM_CmdId's + * enumeration don't conflict with algorithm-proprietary + * command ID's. + * + * @remarks Custom command ID's should be defined like the following + * (@c USERCMD0 and @c USERCMD1 are simply examples): + * @code + * #define MYMODULE_MYVENDOR_USERCMD0 (XDM_CUSTOMCMDBASE + 0) + * #define MYMODULE_MYVENDOR_USERCMD1 (XDM_CUSTOMCMDBASE + 1) + * @endcode + * + * @sa XDM_CmdId + */ +#define XDM_CUSTOMCMDBASE 0x100 + +/** + * @brief Standard control commands that must be implemented by + * XDM compliant multimedia algorithms. + * + * @remarks If an algorithm receives a command it doesn't handle or + * understand, it must return EUNSUPPORTED. + * + * @remarks XDM_GETCONTEXTINFO need only be implemented by split codecs. + * Standard algorithms should return EUNSUPPORTED if they receive + * the XDM_GETCONTEXTINFO command. + * + * @remarks Any control ID extension in IMOD interface should start + * from XDM_CUSTOMCMDBASE onward. The ID range from 0 to + * XDM_CUSTOMCMDBASE is reserved. + * + * @enumWarning + * + * @sa XDM_CUSTOMCMDBASE + */ +typedef enum { + XDM_GETSTATUS = 0, /**< Query algorithm to fill status structure. + * + * @remarks Some XDM interfaces provide an + * embedded "DynamicParams" struct in + * the base class "Status" struct in + * which the current state of an + * algorithm's dynamic params can be + * returned (e.g. + * #IVIDENC2_Status.encDynamicParams); + * other codec classes do not (and + * algs could provide this via + * an extended Status struct). + */ + XDM_SETPARAMS = 1, /**< Set run time dynamic parameters. */ + XDM_RESET = 2, /**< Reset the algorithm. All fields in the + * internal data structures are reset and all + * internal buffers are flushed. + */ + XDM_SETDEFAULT = 3, /**< Restore the algorithm's internal state + * to its original, default values. + * + * @remarks The application only needs + * to initialize the + * @c dynamicParams.size and + * @c status.size fields + * prior to calling control() + * with XDM_SETDEFAULT. + * + * @remarks The algorithm must only + * write to the + * @c status.extendedError field, + * and potentially algorithm + * specific, extended fields. + * + * @remarks XDM_SETDEFAULT differs from + * XDM_RESET. In addition to + * restoring the algorithm's + * internal state, XDM_RESET + * additionally resets any + * channel related state. + */ + XDM_FLUSH = 4, /**< Handle end of stream conditions. This + * command forces the algorithm to output + * data without additional input. The + * recommended sequence is to call the + * control() function (with XDM_FLUSH) + * followed by repeated calls to the + * process() function until it returns an + * error. + * + * @remarks The algorithm should return + * the appropriate, class-specific + * "EFAIL" error (e.g. + * ISPHDEC1_EFAIL, IVIDENC1_EFAIL, + * etc), when flushing is + * complete. + */ + XDM_GETBUFINFO = 5, /**< Query algorithm instance regarding its + * properties of input and output + * buffers. + * + * @remarks The application only needs + * to initialize the + * @c dynamicParams.size, the + * @c status.size, and set + * any buffer descriptor fields + * (e.g. @c status.data) to + * @c NULL prior to calling + * control() with XDM_GETBUFINFO. + * + */ + XDM_GETVERSION = 6, /**< Query the algorithm's version. The result + * will be returned in the @c data field of the + * respective _Status structure. + * + * @remarks There is no specific format + * defined for version returned by + * the algorithm. + */ + XDM_GETCONTEXTINFO = 7, /**< Query a split codec part for its context + * needs. + * + * @remarks Only split codecs are required + * to implement this command. + */ + XDM_GETDYNPARAMSDEFAULT = 8, /**< Query the algorithm to fill the + * default values for the parameters which + * can be configured dynamically. + * + * @remarks The algorithm provides the + * default dynamic params by + * writing into the @c dynamicParams + * structure. Note that this is + * an exception to the general rule + * that the algorithm should not + * write into @c dynamicParams. + * + * @remarks The application only needs + * to initialize the + * @c dynamicParams.size and + * @c status.size fields + * prior to calling control() + * with #XDM_GETDYNPARAMSDEFAULT. + * + * @remarks Other than the @c .size field, + * values in the @c status struct + * are undefined upon returning + * from this call. + * + * @remarks To get the current value of + * an algorithm instance's dynamic + * parameters, it's recommended that + * the alg provide them via the + * #XDM_GETSTATUS call. + */ + XDM_SETLATEACQUIREARG = 9, /**< Set an algorithm's 'late acquire' argument. + * + * @remarks Handling this command is optional. + * + * @remarks Only algorithms that utilize the + * late acquire IRES feature may + * implement this command. + */ + XDM_MOVEBUFS = 10 /**< Move (replace) data buffers an algorithm is + * currently referencing. + * + * @remarks Handling this command is optional. + * + * @remarks An application can use this command + * to move data buffers that an + * algorithm is currently referencing. + * + * @remarks Only algorithms tracking buffers + * with id's (e.g. IVIDDEC3) can + * implement this command. + * + * @remarks Only algorithms who's @c _Status + * struct includes a @c data field + * (e.g. IVIDDEC3) can implement this + * command. This @c data field is a + * buffer descriptor. When using the + * XDM_MOVEBUFS command, this @c data + * buffer is an IN buffer (read-only + * to the algorithm) which + * contains an array of one or + * more XDM2_MoveBufDesc elements. + * Each element indicates (via the id + * field), a buffer which the + * algorithm is referencing that + * needs to be "moved". + * + * @remarks The application is responsible for + * indicating the number of + * XDM2_MoveBufDesc elements by + * appropriately setting the + * @c _Status.data.bufSize field. + * + * @remarks As with all control() processing, + * the algorithm is responsible for + * appropriately setting the + * @c _Status.data.accessMask field + * indicating if/how the algorithm + * accessed the data buffer. + * Typically for this cmd, the + * algorithm reads from the @c data + * buffer, so it should set the + * #XDM_ACCESSMODE_READ bit in the + * @c _Status.data.accessMask field. + * Frameworks/apps can use this + * to appropriately handle cache for + * that @c data buffer. + * + * @sa XDM2_MoveBufDesc + */ +} XDM_CmdId; + + +/** + * @brief Extended error information. + * + * @remarks When an internal error occurs, the algorithm will return + * an error return value (e.g. EFAIL, EUNSUPPORTED) + * + * @remarks The value of each enum is the bit which is set. + * + * @remarks Bits 31-16 are reserved. Bits 7-0 are codec and + * implementation specific. + * + * @remarks The algorithm can set multiple bits to 1 based on conditions. + * e.g. it will set bits #XDM_FATALERROR (fatal) and + * #XDM_UNSUPPORTEDPARAM (unsupported params) in case + * of unsupported run time parameters. + * + * @enumWarning + */ +typedef enum { + XDM_PARAMSCHANGE = 8, /**< Bit 8 - Sequence Parameters Change. + * + * @remarks This error is applicable + * for transcoders. It is + * set when some key parameter + * of the input sequence changes. + * The transcoder simply + * returns after setting this error + * field and the correct input + * sequence parameters are + * updated in outArgs. + */ + XDM_APPLIEDCONCEALMENT = 9, /**< Bit 9 - Applied concealment. + * + * @remarks This error is applicable + * for decoders. It is + * set when the decoder + * was not able to able + * to decode the + * bitstream, and the + * decoder has concealed + * the bitstream error + * and produced the + * concealed output. + */ + XDM_INSUFFICIENTDATA = 10, /**< Bit 10 - Insufficient input data. + * + * @remarks This error is typically + * applicable for + * decoders. This is set + * when the input data + * provided is not + * sufficient to produce + * of one frame of data. + * This can be also be + * set for encoders when + * the number of valid + * samples in the input + * frame is not + * sufficient to process + * a frame. + */ + XDM_CORRUPTEDDATA = 11, /**< Bit 11 - Data problem/corruption. + * + * @remarks This error is typically + * applicable for + * decoders. This is set + * when the bitstream has + * an error and not + * compliant to the + * standard syntax. + */ + XDM_CORRUPTEDHEADER = 12, /**< Bit 12 - Header problem/corruption. + * + * @remarks This error is typically + * applicable for + * decoders. This is set + * when the header + * information in the + * bitstream is + * incorrect. For example, + * it is set when + * Sequence/Picture/Slice + * etc. are incorrect in + * video decoders. + */ + XDM_UNSUPPORTEDINPUT = 13, /**< Bit 13 - Unsupported feature/parameter + * in input. + * + * @remarks This error is set when the + * algorithm is not able + * process a certain + * input data/bitstream + * format. It can also be + * set when a subset of + * features in a standard + * are not supported by + * the algorithm. + * + * @remarks For example, if a video + * encoder only supports + * 4:2:2 format, it can + * set this error for any + * other type of input + * video format. + */ + XDM_UNSUPPORTEDPARAM = 14, /**< Bit 14 - Unsupported input parameter or + * configuration. + * + * @remarks This error is set when the + * algorithm doesn't + * support certain + * configurable + * parameters. For + * example, if the video + * decoder doesn't + * support the "display + * width" feature, it + * shall return + * XDM_UNSUPPORTEDPARAM + * when the control + * function is called for + * setting the + * @c displayWidth + * attribute. + + */ + XDM_FATALERROR = 15 /**< Bit 15 - Fatal error (stop the codec). + * If there is an error and this + * bit is not set, the error is a + * recoverable one. + * + * @remarks This error is set when the + * algorithm cannot + * recover from the + * current state. It + * informs the system not + * to try the next frame + * and possibly delete + * the multimedia + * algorithm instance. It + * implies the codec + * shall not work when + * reset. + * + * @remarks The user should delete the + * current instance of + * the codec. + */ +} XDM_ErrorBit; + +/** Check for fatal error */ +#define XDM_ISFATALERROR(x) (((x) >> XDM_FATALERROR) & 0x1) +/** Check for unsupported parameter */ +#define XDM_ISUNSUPPORTEDPARAM(x) (((x) >> XDM_UNSUPPORTEDPARAM) & 0x1) +/** Check for unsupported input */ +#define XDM_ISUNSUPPORTEDINPUT(x) (((x) >> XDM_UNSUPPORTEDINPUT) & 0x1) +/** Check for corrupted header */ +#define XDM_ISCORRUPTEDHEADER(x) (((x) >> XDM_CORRUPTEDHEADER) & 0x1) +/** Check for corrupted data */ +#define XDM_ISCORRUPTEDDATA(x) (((x) >> XDM_CORRUPTEDDATA) & 0x1) +/** Check for insufficient data */ +#define XDM_ISINSUFFICIENTDATA(x) (((x) >> XDM_INSUFFICIENTDATA) & 0x1) +/** Check for applied concealment */ +#define XDM_ISAPPLIEDCONCEALMENT(x) (((x) >> XDM_APPLIEDCONCEALMENT) & 0x1) + +/** Set fatal error bit */ +#define XDM_SETFATALERROR(x) ((x) |= (0x1 << XDM_FATALERROR)) +/** Set unsupported parameter bit */ +#define XDM_SETUNSUPPORTEDPARAM(x) ((x) |= (0x1 << XDM_UNSUPPORTEDPARAM)) +/** Set unsupported input bit */ +#define XDM_SETUNSUPPORTEDINPUT(x) ((x) |= (0x1 << XDM_UNSUPPORTEDINPUT)) +/** Set corrupted header bit */ +#define XDM_SETCORRUPTEDHEADER(x) ((x) |= (0x1 << XDM_CORRUPTEDHEADER)) +/** Set corrupted data bit */ +#define XDM_SETCORRUPTEDDATA(x) ((x) |= (0x1 << XDM_CORRUPTEDDATA)) +/** Set insufficient data bit */ +#define XDM_SETINSUFFICIENTDATA(x) ((x) |= (0x1 << XDM_INSUFFICIENTDATA)) +/** Set applied concealment bit */ +#define XDM_SETAPPLIEDCONCEALMENT(x) ((x) |= (0x1 << XDM_APPLIEDCONCEALMENT)) + + +/** + * @brief Endianness of data + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + XDM_BYTE = 1, /**< Big endian stream. */ + XDM_LE_16 = 2, /**< 16 bit little endian stream. */ + XDM_LE_32 = 3, /**< 32 bit little endian stream. */ + XDM_LE_64 = 4, /**< 64 bit little endian stream. */ + XDM_BE_16 = 5, /**< 16 bit big endian stream. */ + XDM_BE_32 = 6, /**< 32 bit big endian stream. */ + XDM_BE_64 = 7 /**< 64 bit big endian stream. */ +} XDM_DataFormat; + + +/** + * @brief Descriptor for a buffer to move. + */ +typedef struct XDM2_MoveBufDesc { + XDAS_Int32 id; /**< Id of the buffer to move */ + XDM2_BufDesc bufDesc; /**< New buffer descriptor */ +} XDM2_MoveBufDesc; + + +/** + * @brief Date and time + */ +typedef struct XDM_Date { + XDAS_Int32 msecsOfDay; /**< Milliseconds of the day */ + XDAS_Int32 month; /**< Month (0 = January, 11 = December) */ + XDAS_Int32 dayOfMonth; /**< Month (1 - 31) */ + XDAS_Int32 dayOfWeek; /**< Day of week (0 = Sunday, 6 = Saturday) */ + XDAS_Int32 year; /**< Year (since 0) */ +} XDM_Date; + + +/** + * @brief 2-dimensional point + */ +typedef struct XDM_Point { + XDAS_Int32 x; + XDAS_Int32 y; +} XDM_Point; + + +/** + * @brief Rectangle + */ +typedef struct XDM_Rect { + XDM_Point topLeft; + XDM_Point bottomRight; +} XDM_Rect; + +/** + * @brief Maximum number of context buffers. + */ +#define XDM_MAX_CONTEXT_BUFFERS 32 + + +/** + * @brief Buffer information descriptor for input and output buffers. + */ +typedef struct XDM_ContextInfo { + XDAS_Int32 minContextSize; /**< Minimum size, in 8-bit bytes, + * required for the alg context. + */ + XDAS_Int32 minIntermediateBufSizes[XDM_MAX_CONTEXT_BUFFERS]; /**< Minimum + * size, in 8-bit bytes, required for each + * intermediate buffer. + * + * @remarks The codec indicates the + * number of intermediate + * buffers required by + * zero-terminating this array. + */ +} XDM_ContextInfo; + + +/** + * @brief Context used by split codecs. + */ +typedef struct XDM_Context { + XDM1_SingleBufDesc algContext; /**< App allocated and provided. + * + * @remarks Split codecs can use this + * for passing scalar data to + * the next part. + */ + + XDAS_Int32 numInBufs; /**< Number of input data buffers */ + XDAS_Int32 numOutBufs; /**< Number of output data buffers */ + XDAS_Int32 numInOutBufs; /**< Number of in/out data buffers */ + XDM1_SingleBufDesc inBufs[XDM_MAX_CONTEXT_BUFFERS]; /**< Input data + * Cbuffers. + * + * @remarks This is a sparse array. + */ + XDM1_SingleBufDesc outBufs[XDM_MAX_CONTEXT_BUFFERS]; /**< Output data + * buffers. + * + * @remarks This is a sparse array. + */ + XDM1_SingleBufDesc inOutBufs[XDM_MAX_CONTEXT_BUFFERS]; /**< Input/Output + * data buffers. + * + * @remarks This is a sparse array. + */ + + XDM1_SingleBufDesc intermediateBufs[XDM_MAX_CONTEXT_BUFFERS]; /**< Intermediate, working buffers. + * + * @remarks For FRONT codec parts, + * these buffers are + * treated as OUT + * buffers (i.e., + * written to by the + * algorithm). For + * BACK codec parts, + * these buffers are + * treated as IN + * buffers (i.e., read + * from by the + * algorithm). For + * MIDDLE codec parts, + * these buffers are + * treated as IN/OUT + * buffers (i.e., the + * codec can read + * from, and write to + * them). + * + * @remarks This is a null-terminated + * array + */ +} XDM_Context; + + +/** + * @brief Encoding presets. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + XDM_DEFAULT = 0, /**< Default setting of encoder. See + * codec specific documentation for its + * encoding behaviour. + */ + XDM_HIGH_QUALITY = 1, /**< High quality encoding. */ + XDM_HIGH_SPEED = 2, /**< High speed encoding. */ + XDM_USER_DEFINED = 3, /**< User defined configuration, using + * advanced parameters. + */ + XDM_HIGH_SPEED_MED_QUALITY = 4, /**< High speed, medium quality + * encoding. + */ + XDM_MED_SPEED_MED_QUALITY = 5, /**< Medium speed, medium quality + * encoding. + */ + XDM_MED_SPEED_HIGH_QUALITY = 6, /**< Medium speed, high quality + * encoding. + */ + + XDM_ENCODING_PRESET_MAX = 7, /**< @todo need to add documentation */ + XDM_PRESET_DEFAULT = XDM_MED_SPEED_MED_QUALITY /**< Default setting of + * encoder. See codec specific + * documentation for its encoding + * behaviour. + */ +} XDM_EncodingPreset; + + +/** + * @brief Decode entire access unit or only header. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + XDM_DECODE_AU = 0, /**< Decode entire access unit, including all + * the headers. + */ + XDM_PARSE_HEADER = 1 /**< Decode only header. */ +} XDM_DecMode; + + +/** + * @brief Encode entire access unit or only header. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + XDM_ENCODE_AU = 0, /**< Encode entire access unit, including the + * headers. + */ + XDM_GENERATE_HEADER = 1 /**< Encode only header. */ +} XDM_EncMode; + + +/** + * @brief Chroma formats. + * + * @enumWarning + * + * @extendedEnum + */ +typedef enum { + XDM_CHROMA_NA = -1, /**< Chroma format not applicable. */ + XDM_YUV_420P = 1, /**< YUV 4:2:0 planer. */ + XDM_YUV_422P = 2, /**< YUV 4:2:2 planer. */ + XDM_YUV_422IBE = 3, /**< YUV 4:2:2 interleaved (big endian). */ + XDM_YUV_422ILE = 4, /**< YUV 4:2:2 interleaved (little endian). */ + XDM_YUV_444P = 5, /**< YUV 4:4:4 planer. */ + XDM_YUV_411P = 6, /**< YUV 4:1:1 planer. */ + XDM_GRAY = 7, /**< Gray format. */ + XDM_RGB = 8, /**< RGB color format. */ + XDM_YUV_420SP = 9, /**< YUV 420 semi_planar format.(Luma 1st plane, + * CbCr interleaved 2nd plane) + */ + XDM_ARGB8888 = 10, /**< Alpha plane. */ + XDM_RGB555 = 11, /**< RGB 555 color format. */ + XDM_RGB565 = 12, /**< RGB 565 color format. */ + XDM_YUV_444ILE = 13, /**< YUV 4:4:4 interleaved (little endian). */ + /** Default setting. */ + XDM_CHROMAFORMAT_DEFAULT = XDM_YUV_422ILE +} XDM_ChromaFormat; + + +/** + * @brief Memory space attributes + * + * @enumWarning + * + * @extendedEnum + */ + typedef enum { + XDM_MEMTYPE_ROW = 0, /**< Linear (standard) memory. + * + * @deprecated The XDM_MEMTYPE_ROW value + * is deprecated. Please use + * #XDM_MEMTYPE_RAW (which, by design, + * has the same underyling value) + * instead. + * + * @remarks XDM_MEMTYPE_ROW may be + * removed in a future + * release. + * + * @sa XDM_MemoryType::XDM_MEMTYPE_RAW + */ + XDM_MEMTYPE_RAW = 0, /**< Linear (standard) memory. + * + * @todo add documentation + */ + XDM_MEMTYPE_TILED8 = 1, /**< @todo add documentation */ + XDM_MEMTYPE_TILED16 = 2, /**< @todo add documentation */ + XDM_MEMTYPE_TILED32 = 3, /**< @todo add documentation */ + XDM_MEMTYPE_TILEDPAGE = 4 /**< @todo add documentation */ +} XDM_MemoryType; + + +/** + * @brief Memory space attributes + * + * @enumWarning + */ + typedef enum { + XDM_MEMUSAGE_DATASYNC = 0 /**< Bit 0 - Data Sync mode + * + * @remarks If this bit is set, + * the memory will be + * used in data sync mode. + * + * @remarks When in data sync mode, the + * algorithm is responsible for + * ensuring any XDAIS rules are + * met for the buffer (e.g. + * managing cache coherency). + * + * @remarks If an algorithm is running in + * mode other than data sync, and + * receives a buffer with this + * bit set, it should return an + * error, likely + * #XDM_UNSUPPORTEDINPUT. + */ +} XDM_MemoryUsageMode; + + +/** + * @brief Descriptor for the chunk of data being + * transferred in one call to putData or getData + */ +typedef struct XDM_DataSyncDesc { + XDAS_Int32 size; /**< @sizeField */ + XDAS_Int32 scatteredBlocksFlag; /**< Flag indicating whether the + * individual data blocks may + * be scattered in memory. + * + * @remarks Note that each individual + * block must be physically + * contiguous. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + * + * @remarks If set to XDAS_FALSE, the + * @c baseAddr field points + * directly to the start of the + * first block, and is not treated + * as a pointer to an array. + * + * @remarks If set to XDAS_TRUE, the + * @c baseAddr array must + * contain the base address of + * each individual block. + */ + XDAS_Int32 *baseAddr; /**< Base address of single data block or + * pointer to an array of + * data block addresses of + * size @c numBlocks. + * + * @remarks If @c scatteredBlocksFlag is + * set to XDAS_FALSE, this + * field points + * directly to the start of the + * first block, and is not treated + * as a pointer to an array. + * + * @remarks If @c scatteredBlocksFlag is + * set to XDAS_TRUE, this + * field points to an array of + * pointers to the data blocks. + */ + XDAS_Int32 numBlocks; /**< Number of blocks available */ + XDAS_Int32 varBlockSizesFlag; /**< Flag indicating whether any of the + * data blocks vary in size. + * + * @remarks Valid values are XDAS_TRUE + * and XDAS_FALSE. + */ + XDAS_Int32 *blockSizes; /**< Variable block sizes array. + * + * @remarks If @c varBlockSizesFlag is + * XDAS_TRUE, this array + * contains the sizes of each + * block. If @c varBlockSizesFlag + * is XDAS_FALSE, this contains + * the size of same-size blocks. + * + * @remarks Memory for this array + * (of size @c numBlocks) has + * to be allocated by the + * caller of the putData API. + */ +} XDM_DataSyncDesc; + + +/** + * @brief Handle that identifies the DataSync FIFO. + * + * @sa XDM_DataSyncPutFxn() + * @sa XDM_DataSyncGetFxn() + * @sa XDM_DataSyncGetBufferFxn() + * @sa XDM_DataSyncPutBufferFxn() + */ +typedef Void * XDM_DataSyncHandle; + + +/** + * @brief Non-blocking API to signal "data ready" to one or more + * consumers. + * + * @param[in] dataSyncHandle Handle to a data sync instance. + * @param[out] dataSyncDesc Full data sync descriptor. This includes one + * or more filled data buffers. + * + * + * @todo Needs review + * + * @sa IVIDDEC3_DynamicParams::putDataFxn() + * @sa IVIDENC2_DynamicParams::putDataFxn() + * @sa IVIDENC2_DynamicParams::getBufferFxn() + * @sa XDM_DataSyncGetBufferFxn + */ +typedef Void (*XDM_DataSyncPutFxn)(XDM_DataSyncHandle dataSyncHandle, + XDM_DataSyncDesc *dataSyncDesc); + +/** + * @brief API to obtain data information from a consumer. + * + * @param[in] dataSyncHandle Handle to a data sync instance. + * @param[out] dataSyncDesc Empty data sync descriptor to be filled by + * the producer. Only the @c size field must + * be initialized by the caller. + * + * @post Upon return, the @c dataSyncDesc will contain details about + * the provided data. + * + * @remarks Given that this is an input buffer, the implementation of this + * fxn must make the provided external or shared memory coherent + * with respect to the algorithm processor's cache. + * + * @todo Needs review + * + * @sa IVIDDEC3_DynamicParams::getDataFxn() + * @sa IVIDDEC3_DynamicParams::putBufferFxn() + * @sa IVIDENC2_DynamicParams::getDataFxn() + * @sa XDM_DataSyncPutBufferFxn + */ +typedef XDAS_Int32 (*XDM_DataSyncGetFxn)(XDM_DataSyncHandle dataSyncHandle, + XDM_DataSyncDesc *dataSyncDesc); + +/** + * @brief API to obtain empty bitstream buffers from an allocator + * to be filled by the algorithm. + * + * @param[in] dataSyncHandle Handle to a data sync instance. + * @param[out] dataSyncDesc Empty data sync descriptor to be filled by + * the allocator. Only the @c size field must + * be initialized by the caller. + * + * @post Upon return, the @c dataSyncDesc will contain details about + * the allocated buffer(s). + * + * @remarks Given that this is an output buffer, the implementation of this + * fxn (i.e., the allocator) must make the provided external or + * shared memory coherent with respect to the algorithm + * processor's cache. This typically implies it must be cache + * invalidated since the alg may fill this buffer via DMA. + * + * @remarks The allocator may not zero-initialize this buffer. If the + * allocator does initialize the buffer, it must ensure the + * cache coherency via writeback-invalidate. + * + * @retval XDM_EOK Allocator is able to provide the buffer or + * is not able to provide the buffer but + * indicates that it can provide the buffers + * in future such calls. + * @retval XDM_EFAIL Allocator is unable to provide the buffer + * and it will not be able to provide the + * buffer in the future. + * + * @sa IVIDENC2_DynamicParams::putDataFxn() + * @sa IVIDENC2_Fxns::process() + */ +typedef XDAS_Int32 (*XDM_DataSyncGetBufferFxn)(XDM_DataSyncHandle dataSyncHandle, + XDM_DataSyncDesc *dataSyncDesc); + + +/** + * @brief API to return consumed bitstream buffers to the original + * provider. + * + * @param[in] dataSyncHandle Handle to a data sync instance. + * @param[out] dataSyncDesc Data sync descriptor. + * + * @todo What cache coherency responsibilities are placed on this + * buffer? + * + * @todo Needs review and further detail + * + * @sa IVIDDEC3_DynamicParams::getDataFxn() + * @sa IVIDDEC3_Fxns::process() + */ +typedef XDAS_Int32 (*XDM_DataSyncPutBufferFxn)(XDM_DataSyncHandle dataSyncHandle, + XDM_DataSyncDesc *dataSyncDesc); + +/*@}*/ + + +#ifdef __cplusplus +} +#endif + +#endif /* ti_xdais_dm_XDM_ */ diff --git a/packages/xdais/ti/xdais/ialg.h b/packages/xdais/ti/xdais/ialg.h new file mode 100755 index 0000000..05aa26f --- /dev/null +++ b/packages/xdais/ti/xdais/ialg.h @@ -0,0 +1,762 @@ +/* + * Copyright (c) 2006-2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file ti/xdais/ialg.h + * + * @brief This header defines all types, constants, and functions + * defined by XDAIS for algorithms. + */ +/** + * @defgroup ti_xdais_IALG IALG - XDAIS Algorithm Interface + * + * This is the XDAIS IALG interface. + */ + +#ifndef ti_xdais_IALG_ +#define ti_xdais_IALG_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup ti_xdais_IALG */ +/*@{*/ + +/*---------------------------*/ +/* TYPES AND CONSTANTS */ +/*---------------------------*/ + +#define IALG_DEFMEMRECS 4 /**< Default number of memory records. */ +#define IALG_OBJMEMREC 0 /**< Memory record index of instance object. */ +#define IALG_SYSCMD 256 /**< Minimum "system" IALG_Cmd value. */ + +#define IALG_EOK 0 /**< Successful return status code. */ +#define IALG_EFAIL (-1) /**< Unspecified error return status code. */ + +#define IALG_CUSTOMFAILBASE (-2048)/**< Algorithm-specific failure code end. + * + * @remarks This is 0xfffff800. + */ +#define IALG_CUSTOMFAILEND (-256) /**< Algorithm-specific failure code base. + * + * @remarks This is 0xffffff00. + */ + +/** + * @brief Memory attributes. + */ +typedef enum IALG_MemAttrs { + IALG_SCRATCH, /**< Scratch memory. */ + IALG_PERSIST, /**< Persistent memory. */ + IALG_WRITEONCE /**< Write-once persistent memory. */ +} IALG_MemAttrs; + +#define IALG_MPROG 0x0008 /**< Program memory space bit. */ +#define IALG_MXTRN 0x0010 /**< External memory space bit. */ + +/** + * @brief Defined memory spaces. + */ +/* + * ======== IALG_MemSpace ======== + */ +typedef enum IALG_MemSpace { + IALG_EPROG = /**< External program memory */ + IALG_MPROG | IALG_MXTRN, + + IALG_IPROG = /**< Internal program memory */ + IALG_MPROG, + + IALG_ESDATA = /**< Off-chip data memory (accessed sequentially) */ + IALG_MXTRN + 0, + + IALG_EXTERNAL = /**< Off-chip data memory (accessed randomly) */ + IALG_MXTRN + 1, + + IALG_DARAM0 = 0, /**< Dual access on-chip data memory */ + IALG_DARAM1 = 1, /**< Block 1, if independant blocks required */ + + IALG_SARAM = 2, /**< Single access on-chip data memory */ + IALG_SARAM0 = 2, /**< Block 0, equivalent to IALG_SARAM */ + IALG_SARAM1 = 3, /**< Block 1, if independant blocks required */ + + IALG_DARAM2 = 4, /**< Block 2, if a 3rd independent block required */ + IALG_SARAM2 = 5 /**< Block 2, if a 3rd independent block required */ +} IALG_MemSpace; + +/* + * ======== IALG_isProg ======== + */ +#define IALG_isProg(s) ( \ + (((int)(s)) & IALG_MPROG) \ +) + +/* + * ======== IALG_isOffChip ======== + */ +#define IALG_isOffChip(s) ( \ + (((int)(s)) & IALG_MXTRN) \ +) + + +/** + * @brief Memory records. + */ +typedef struct IALG_MemRec { + Uns size; /**< Size in MAU of allocation */ + Int alignment; /**< Alignment requirement (MAU) */ + IALG_MemSpace space; /**< Allocation space */ + IALG_MemAttrs attrs; /**< Memory attributes */ + Void *base; /**< Base address of allocated buf */ +} IALG_MemRec; + + +/** + * @brief Algorithm instance object definition. + * + * @remarks All XDAIS algorithm instance objects must have this + * structure as their first element. However, they do not + * need to initialize it; initialization of this sub-structure + * is done by the "framework". + */ +typedef struct IALG_Obj { + struct IALG_Fxns *fxns; /**< Pointer to IALG function table. */ +} IALG_Obj; + + +/** + * @brief Handle to an algorithm instance object. + */ +typedef struct IALG_Obj *IALG_Handle; + + +/** + * @brief Algorithm instance creation parameters. + * + * @remarks All XDAS algorithm parameter structures must have this + * as their first element. + */ +typedef struct IALG_Params { + Int size; /**< Number of MAU in the structure */ +} IALG_Params; + + +/** + * @brief Pointer to algorithm specific status structure. + * + * @remarks All XDAIS algorithm parameter structures must have this + * as their first element. + */ +typedef struct IALG_Status { + Int size; /**< Number of MAU in the structure */ +} IALG_Status; + + +/** + * @brief Algorithm specific command. + * + * @remarks This command is used in conjunction with IALG_Status to get + * and set algorithm specific attributes via the algControl() + * method. + */ +typedef unsigned int IALG_Cmd; + + +/** + * @brief Defines the fields and methods that must be supplied by all + * XDAIS algorithms. + */ +/* + * algAlloc() - apps call this to query the algorithm about + * its memory requirements. Must be non-NULL. + * algControl() - algorithm specific control operations. May be + * NULL; NULL => no operations supported. + * algDeactivate() - notification that current instance is about to + * be "deactivated". May be NULL; NULL => do nothing. + * algFree() - query algorithm for memory to free when removing + * an instance. Must be non-NULL. + * algInit() - apps call this to allow the algorithm to + * initialize memory requested via algAlloc(). Must + * be non-NULL. + * algMoved() - apps call this whenever an algorithms object or + * any pointer parameters are moved in real-time. + * May be NULL; NULL => object can not be moved. + * algNumAlloc() - query algorithm for number of memory requests. + * May be NULL; NULL => number of mem recs is less + * then #IALG_DEFMEMRECS. + */ +typedef struct IALG_Fxns { +/** + * @brief Unique pointer that identifies the module + * implementing this interface. + */ + Void *implementationId; + +/** + * @brief Notification to the algorithm that its memory + * is "active" and algorithm processing methods + * may be called. + * + * @param[in] handle Handle to an algorithm instance. + * + * @remarks algActivate() initializes any of the instance's scratch + * buffers using the persistent memory that is part of the + * algorithm's instance object. + * + * @remarks The implementation of algActivate() (and algDeactivate()) + * is required if the algorithm requests memory of + * type #IALG_SCRATCH. + * + * @remarks The algActivate() method should only be implemented if + * a module wants to factor out initialization code that + * can be executed once prior to processing multiple + * consecutive frames of data. + * + * @remarks If a module does not implement this method, the algActivate() + * field in the module's static function table (of type + * IALG_Fxns) must be set to @c NULL. This is equivalent to + * the following implementation: + * @code + * Void algActivate(IALG_Handle handle) + * { + * } + * @endcode + * + * @pre algActivate() can only be called after a successful return + * from algInit(). + * + * @pre @c handle must be a valid handle for the algorithm's + * instance object. + * + * @pre No other algorithm method is currently being run on this + * instance. This method never preempts any other method on + * the same instance. + * + * @pre If the algorithm has implemented the IDMA2 interface, + * algActivate() can only be called after a successful return + * from dmaInit(). + * + * @post All methods related to the algorithm may now be executed + * by client (subject to algorithm specific restrictions). + * + * @sa algDeactivate(). + */ + Void (*algActivate)(IALG_Handle handle); + +/** + * @brief Apps call this to query the algorithm about + * its memory requirements. Must be non-NULL. + * + * @param[in] params Algorithm specific attributes. + * @param[out] parentFxns Parent algorithm functions. + * @param[out] memTab array of memory records. + * + * @remarks algAlloc() returns a table of memory records that + * describe the size, alignment, type and memory space of + * all buffers required by an algorithm (including the + * algorithm's instance object itself). If successful, + * this function returns a positive non-zero value + * indicating the number of records initialized. This + * function can never initialize more memory records than + * the number returned by algNumAlloc(). + * + * @remarks If algNumAlloc() is not implemented, the maximum number + * of initialized memory records is #IALG_DEFMEMRECS. + * + * @remarks The first argument to algAlloc() is a pointer to the creation + * parameters for the instance of the algorithm object to be + * created. This pointer is algorithm-specific; i.e., it points + * to a structure that is defined by each particular algorithm. + * This pointer may be @c NULL; however, in this case, algAlloc() + * must assume default creation parameters and must not fail. + * + * @remarks The second argument to algAlloc() is an optional parameter. + * algAlloc() may return a pointer to its parent's IALG functions. + * If this output value is assigned a non-NULL value, the client + * must create the parent instance object using the designated + * IALG functions pointer. The parent instance object must then + * be passed to algInit(). + * + * @remarks algAlloc() may be called at any time and it must be idempotent; + * i.e., it can be called repeatedly without any side effects, + * and always returns the same result. + * + * @remarks Algorithms are encouraged to return (and document!) clear, + * algorithm-specific error codes from algAlloc(). Create-time + * failures are a common integration issue, and the clearer a + * return value, the sooner the algorithm integrator can identify + * and resolve the issue. + * + * @pre The number of memory records in the array @c memTab[] is no + * less than the number returned by algNumAlloc(). + * + * @pre @c *parentFxns is a valid pointer to an IALG_Fxns pointer + * variable. + * + * @post If the algorithm needs a parent object to be created, the + * pointer @c *parentFxns is set to a non-NULL value that points + * to a valid IALG_Fxns structure, the parent's IALG + * implementation. Otherwise, this pointer is not set. algAlloc() + * may elect to ignore the @c parentFxns pointer altogether. + * + * @post For each memory descriptor in memTab with an #IALG_WRITEONCE + * attribute, the algorithm has either set the base field to a + * non-NULL value, which is the address of a statically + * allocated and initialized memory buffer of the indicated + * 'size', or has set the base field to @c NULL, thereby + * requiring the memory for the buffer to be provided by the + * client. + * + * @post Exactly @c n elements of the @c memTab[] array are initialized, + * where @c n is the return value from this operation. + * + * @post For each memory descriptor in @c memTab with an #IALG_PERSIST or + * #IALG_SCRATCH attribute, the algorithm does not set its base + * field. + * + * @post @c memTab[0] defines the memory required for the instance's + * object and this object's first field is an IALG_Obj structure. + * + * @post @c memTab[0] is requested as persistent memory. + * + * @sa algFree() + */ + Int (*algAlloc)(const IALG_Params *params, + struct IALG_Fxns **parentFxns, IALG_MemRec *memTab); + +/** + * @brief Algorithm specific control and status. + * + * @param[in] handle Algorithm instance handle. + * @param[in] cmd Algorithm specific command. + * @param[out] status Algorithm specific status. + * + * @remarks algControl() sends an algorithm specific command, @c cmd, and + * an input/output status buffer pointer to an algorithm's + * instance object. + * + * @remarks In preemptive execution environments, algControl() may preempt + * a module's other metods (for example, its processing methods). + * + * @remarks The implementation of algControl() is optional. If a module + * does not implement this method, the algControl() field in + * the module's static function table (of type IALG_Fxns) must + * be set to @c NULL. This is equivalent to the following + * implementation: + * @code + * Void algControl(IALG_Handle handle, IALG_Cmd cmd, IALG_Status *status) + * { + * return (IALG_EFAIL); + * } + * @endcode + * + * @pre algControl() can only be called after a successful return + * from algInit(). + * + * @pre @c handle must be a valid handle for the algorithm's instance + * object. + * + * @pre Algorithm specific @c cmd values are always less than + * #IALG_SYSCMD. + * + * @post If the @c cmd value is not recognized by the algorithm, the + * return value is not equal to IALG_EOK. + * + * @sa algInit() + */ + Int (*algControl)(IALG_Handle handle, IALG_Cmd cmd, + IALG_Status *status); + +/** + * @brief Save all persistent data to non-scratch memory. + * + * @param[in] handle Algorithm instance handle. + * + * @remarks algDeactivate() saves any persistent information to non-scratch + * buffers using the persistent memory that is part of the + * algorithm's instance object. + * + * @remarks @c handle is used by the algorithm to identify the various + * buffers that must be saved prior to the next cycle of + * algActivate() and processing. + * + * @remarks The implementation of algDeactivate() (and algActivate()) + * is required if the algorithm requests memory of + * type #IALG_SCRATCH. + * + * @remarks The algDeactivate() method is only implemented if a + * module wants to factor out initialization code that + * can be executed once prior to processing multiple + * consecutive frames of data. + * + * @remarks If a module does not implement this method, the + * algDeactivate() field in the module's static function table + * (of type IALG_Fxns) must be set to @c NULL. This is + * equivalent to the following implementation: + * @code + * Void algDeactivate(IALG_Handle handle) + * { + * } + * @endcode + * + * @pre algDeactivate() can only be called after a successful return + * from algInit(). + * + * @pre The instance object is currently "active"; i.e., all instance + * memory is active and if an algActivate() method is defined, + * it has been called. + * + * @pre @c handle must be a valid handle for the algorithm's instance + * object. + * + * @pre No other algorithm method is currently being run on this + * instance. This method never preempts any other method on the + * same instance. + * + * @post No methods related to the algorithm may now be executed by + * the client; only algActivate() or algFree() may be called. + * + * @post All instance scratch memory may be safely overwritten. + * + * @sa algActivate() + */ + Void (*algDeactivate)(IALG_Handle handle); + +/** + * @brief Apps call this to allow the algorithm to initialize memory + * requested via algAlloc(). Must be non-NULL. + * + * @param[in] handle Algorithm instance handle. + * @param[out] memTab Output array of memory records. + * + * @remarks algFree() returns a table of memory records that describe + * the base address, size, alignment, type and memory space + * of all buffers previously allocated for the algorithm's + * instance (including the algorithm's instance object itself) + * specified by @c handle. This function always returns a + * positive non-zero value indicating the number of records + * initialized. This function can never initialize more memory + * records than the value returned by algNumAlloc(). + * + * @pre The @c memTab[] array contains at least algNumAlloc() records. + * + * @pre @c handle must be a valid handle for the algorithm's instance + * object. + * + * @pre If the prior call to algAlloc() returned a non-NULL parent + * functions pointer, then the parent instance must be an active + * instance object created via that function pointer. + * + * @pre No other agorithm method is currently being run on this + * instance. This method never preempts any other method on the + * same instance. + * + * @post @c memTab[] contains pointers to all of the memory passed to + * the algorithm via algInit(). + * + * @post The size and alignment fields contain the same values passed + * to the client via algAlloc(); i.e., if the client makes changes + * to the values returned via algAlloc() and passes these new + * values to algInit(), the algorithm is not responsible for + * retaining any such changes. + * + * @sa algAlloc() + */ + Int (*algFree)(IALG_Handle handle, IALG_MemRec *memTab); + +/** + * @brief Initialize an algorithm's instance object. Must be non-NULL. + * + * @param[in] handle Algorithm instance handle. This is a pointer + * to an initialized IALG_Obj structure. Its + * value is identical to the + * memTab[0].base. + * @param[in] memTab Array of allocated buffers. + * @param[in] parent Handle of algorithm's parent instance. + * @param[in] params Pointer to algorithm's instance parameters. + * + * @remarks algInit() performs all initialization necessary to complete the + * run-time creation of an algorithm's instance object. After a + * successful return from algInit(), the algorithm's instance + * object is ready to be used to process data. + * + * @remarks @c handle is a pointer to an initialized IALG_Obj structure. + * Its value is identical to the memTab[0].base. + * + * @remarks @c memTab is a table of memory records that describe the + * base address, size, alignment, type, and memory space + * of all buffers allocated for an algorithm instance + * (including the algorithm's instance object itself). The + * number of initialized records is identical to the + * number returned by a prior call to algAlloc(). + * + * @remarks @c parent is a handle to another algorithm instance object. + * This parameter is often NULL; indicating that no + * parent object exists. This parameter allows clients + * to create a shared algorithm instance object and pass + * it to other algorithm instances. For example, a + * parent instance object might contain global read-only + * tables that are used by several instances of a + * vocoder. + * + * @remarks @c params is a pointer to algorithm-specific parameters that + * are necessary for the creation and initialization of + * the instance object. This pointer points to the same + * parameters passed to the algAlloc() operation. + * However, this pointer may be NULL. In this case, + * algInit(), must assume default creation parameters. + * + * @remarks Algorithms are encouraged to return (and document!) clear, + * algorithm-specific error codes from algInit(). Create-time + * failures are a common integration issue, and the clearer a + * return value, the sooner the algorithm integrator can identify + * and resolve the issue. + * + * @remarks The algorithm must not access any scratch resources, + * memory or otherwise, until it has been activated (see + * algActivate()). A common error is to initialize + * scratch resources during algInit(). This is an error + * as another algorithm, or instance of the same + * algorithm, may be active when this instance's + * algInit() is called. This algorithm must not access + * scratch resources until it is active. + * + * @remarks The client is not required to satisfy the IALG_MemSpace + * attribute of the requested memory. Note however that + * C6000 algorithms that use DMA may strictly require the + * client to satisfy its on-chip memory requirements and + * may not function correctly otherwise. + * + * @remarks The client may allocate the requested #IALG_WRITEONCE + * buffers once (or never, if the algorithm has assigned + * a base address in the prior call to algAlloc) and use + * the same buffers to initialize multiple instances of + * the same algorithm that are created with identical + * parameters. + * + * @par Example: + * + * @code + * typedef struct EncoderObj { + * IALG_Obj ialgObj; + * int workBuf; + * Int workBufLen; + * ... ; + * } EncoderObj; + * + * Int algInit(IALG_Handle handle, IALG_MemRec memTab[], + * IALG_Handle parent, IALG_Params *params) + * { + * EncoderObj *inst = (EncoderObj *)handle; + * EncoderParams *encParams = (EncoderParams *)params; + * + * if (encParams == NULL) { + * encParams = MYDEFAULTPARAMS; + * } + * + * if (IALG_isOffChip(memTab[1].space)) { + * // unsupported off-chip memory, return documented error code + * return (MYMOD_MYVENDOR_EUNSUPPORTEDOFFCHIPWORKBUF); + * } + * + * inst->workBuf = memTab[1].base; + * inst->workBufLen = encParams->frameDuration * 8; + * ... + * + * return (IALG_EOK); + * } + * @endcode + * + * @pre @c memTab contains pointers to non-overlapping buffers with + * the size and alignment requested via a prior call to + * algAlloc(). In addition, the algorithm parameters, + * params, passed to algAlloc() are identical to those + * passed to this operation. + * + * @pre @c handle must be a valid handle for the algorithm's + * instance object; i.e., handle == memTab[0].base and + * @c handle->fxns is initialized to point to the + * appropriate IALG_Fxns structure. + * + * @pre The prior call to algAlloc() using same creation params must + * have returned value > 1. This pre-condition ensures that any + * create-time parameter validation can be done once (in + * algAlloc()), and is not required to be done in algInit(). + * Note that algInit() can, and should, validate any algorithm- + * specific requirements on resources received (e.g. internal + * memory, etc). + * + * @pre If the prior call to algAlloc() has not assigned a non-NULL + * base address to an #IALG_WRITEONCE @c memTab entry, + * the client must provide the memory resource with the + * requested size and alignment. + * + * @pre If the prior call to algAlloc() returned a non-NULL parent + * functions pointer, then the parent handle, @c parent, + * must be a valid handle to an instance object created + * via that function pointer. + * + * @pre No other algorithm method is currently being run on this + * instance. This method never preempts any other method + * on the same instance. + * + * @pre If @c parent is non-NULL, no other method is currently being + * run on the parent instance; i.e., this method never + * preempts any other method on the parent instance. + * + * @pre If the prior call to algAlloc() assigned a non-NULL base + * address to an #IALG_WRITEONCE @c memTab[] entry, the + * client may pass back the same address in the base + * field without allocating additional memory for that + * persistent write-once buffer. Alternatively, the + * client may treat #IALG_WRITEONCE buffers in the same + * way as #IALG_PERSIST buffers; by allocating new memory + * and granting it to the algorithm using the base field. + * + * @pre The buffer pointed to in @c memTab[0] is initialized + * with a pointer to the appropriate IALG_Fxns structure + * followed by all 0s. + * + * @post With the exception of any initialization performed + * by algActivate() and any optional auxilary interface + * initialization functions (such as IRES and IDMA3), + * all of the instance's persistent and write-once memory is + * initialized and the object is ready to be used. + * + * @post All subsequent memory accesses to the #IALG_WRITEONCE + * buffers by this algorithm instance will be read-only. + * + * @post If the algorithm has implemented the IDMA2 interface, + * the dmaGetChannels() operation can be called. + * + * @retval #IALG_EOK @copydoc IALG_EOK + * @retval #IALG_EFAIL @copydoc IALG_EFAIL + * @retval "Custom error" Algorithm-specific error - see + * algorithm's documentation. + * + * @sa algAlloc() + * @sa algMoved() + */ + Int (*algInit)(IALG_Handle handle, const IALG_MemRec *memTab, + IALG_Handle parent, const IALG_Params *params); + +/** + * @brief Notify algorithm instance that instance memory has been + * relocated. + * + * @param[in] handle Algorithm instance handle. + * @param[in] memTab Array of allocated buffers. + * @param[in] parent Handle of algorithm's parent instance. + * @param[in] params Pointer to algorithm's instance parameters. + * + * @remarks algMoved() performs any reinitialization necessary to insure + * that, if an algorithm's instance object has been moved by the + * client, all internal data references are recomputed. + * + * @remarks The implementation of algMoved() is optional. However, it is + * highly recommended that this method be implemented. If a + * module does not implement this method, the algMoved() field + * in the module's static function table (of type IALG_Fxns) must + * be set to @c NULL. This is equivalent to asserting that the + * algorithm's instance objects cannot be moved. + */ + Void (*algMoved)(IALG_Handle handle, const IALG_MemRec *memTab, + IALG_Handle parent, const IALG_Params *params); + +/** + * @brief Number of memory allocation requests required. + * + * @remarks algNumAlloc() returns the maximum number of memory allocation + * requests that the algAlloc() method requires. This operation + * allows clients to allocate sufficient space to call the + * algAlloc() method or fail because insufficient space exists + * to support the creation of the algorithm's instance object. + * algNumAlloc() may be called at any time, and it must be + * idempotent; i.e., it can be called repeatedly without any + * side effects, and always returns the same result. + * + * @remarks algNumAlloc() is optional; if it is not implemented, the + * maximum number of memory records for algAlloc() is assumed + * to be #IALG_DEFMEMRECS. This is equivalent to the following + * implementation: + * @code + * Void algNumAlloc(Void) + * { + * return (IALG_DEFNUMRECS); + * } + * @endcode + * + * @remarks If a module does not implement this method, the algNumAlloc() + * field in the module's static function table (of type IALG_Fxns) + * must be set to @c NULL. + * + * @post The return value from algNumAlloc() is always greater than + * or equal to one and always equals or exceeds the value + * returned by algAlloc(). + * + * @par Example: + * + * @code + * #define NUMBUF 3 + * extern IALG_Fxns *subAlg; + * + * Int algNumAlloc(Void) + * { + * return (NUMBUF + subAlg->algNumAlloc()); + * } + * + * Int algAlloc(const IALG_Params *p, struct IALG_Fxns **pFxns, + * IALG_MemRec memTab) + * { + * Int n; + * + * ... + * + * n = subAlg->algAlloc(0, memTab); + * return (n + NUMBUF); + * } + * @endcode + * + * @sa algAlloc() + */ + Int (*algNumAlloc)(Void); +} IALG_Fxns; + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif /* ti_xdais_IALG_ */ diff --git a/packages/xdais/ti/xdais/xdas.h b/packages/xdais/ti/xdais/xdas.h new file mode 100755 index 0000000..caa8583 --- /dev/null +++ b/packages/xdais/ti/xdais/xdas.h @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2006-2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/** + * @file ti/xdais/xdas.h + * + * @brief This header defines all types and constants used in the + * XDAS interfaces. + * + * @remarks The types are mapped to the types defined in std.h. + */ +/** + * @addtogroup ti_xdais_XDAS XDAIS Types and Constants + */ + +#ifndef ti_xdais_XDAS_ +#define ti_xdais_XDAS_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup ti_xdais_XDAS_ */ +/*@{*/ + + +#define XDAS_TRUE 1 +#define XDAS_FALSE 0 + + +typedef Void XDAS_Void; +typedef Uint8 XDAS_Bool; + + +typedef Int8 XDAS_Int8; /**< Actual size chip dependent. */ +typedef Uint8 XDAS_UInt8; /**< Actual size chip dependent. */ +typedef Int16 XDAS_Int16; /**< Actual size of type is 16 bits. */ +typedef Uint16 XDAS_UInt16; /**< Actual size of type is 16 bits. */ +typedef Int32 XDAS_Int32; /**< Actual size of type is 32 bits. */ +typedef Uint32 XDAS_UInt32; /**< Actual size of type is 32 bits. */ + + +/*@}*/ + + +#ifdef __cplusplus +} +#endif + +#endif /* ti_xdais_XDAS_ */ diff --git a/packages/xdctools/google/targets/arm/std.h b/packages/xdctools/google/targets/arm/std.h new file mode 100644 index 0000000..aa1b5c1 --- /dev/null +++ b/packages/xdctools/google/targets/arm/std.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2011 Texas Instruments and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Texas Instruments - initial implementation + * + * + */ + +/* + * ======== google/targets/arm/std.h ======== + * Standard types for supported Google Bionic Arm compilers + */ + +#ifndef google_targets_arm_STD_ +#define google_targets_arm_STD_ + +/* Define target-specific "portable" macros + * + * The build command-line define xdc_target_name__ to be the value + * of the target's name config parameter. We use this to include the + * target-specific definitions for the required target-independent + * xdc_target* macros. + */ +#ifdef xdc_target_name__ +#include xdc__local_include(xdc_target_name__) +#endif + +/* "inherit" (i.e., include) all google.targets standard types */ +#include + +#endif /* google_targets_arm_STD_ */ + +/* + * @(#) google.targets.arm; 1, 0, 0,111; 6-24-2013 15:21:49; /db/ztree/library/trees/xdctargets/xdctargets-g31x/src/ xlibrary + + */ + diff --git a/packages/xdctools/google/targets/std.h b/packages/xdctools/google/targets/std.h new file mode 100644 index 0000000..5312e79 --- /dev/null +++ b/packages/xdctools/google/targets/std.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2011 Texas Instruments and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Texas Instruments - initial implementation + * + * + */ +/* + * ======== google/targets/std.h ======== + * + */ + +#ifndef google_targets_STD_ +#define google_targets_STD_ + +/* include target-specific "portable" macros */ +#if defined(xdc_target_name__) & !defined(xdc_target_macros_include__) +#include xdc__local_include(xdc_target_name__) +#endif + +/* + * xdc__LONGLONG__ indicates if compiler supports 'long long' type + * xdc__BITS __ indicates if compiler supports 'uint_t' type + */ +#define xdc__LONGLONG__ +#define xdc__BITS8__ +#define xdc__BITS16__ +#define xdc__BITS32__ +#define xdc__BITS64__ +#define xdc__INT64__ + +/* + * ======== [U]Int ======== + */ +typedef signed char xdc_Int8; +typedef unsigned char xdc_UInt8; +typedef short xdc_Int16; +typedef unsigned short xdc_UInt16; +typedef long xdc_Int32; +typedef unsigned long xdc_UInt32; + +__extension__ typedef long long xdc_Int64; +__extension__ typedef unsigned long long xdc_UInt64; + +/* + * ======== Bits ======== + */ +typedef unsigned char xdc_Bits8; +typedef unsigned short xdc_Bits16; +typedef unsigned long xdc_Bits32; +__extension__ typedef unsigned long long xdc_Bits64; + +/* + * ======== [IU]Arg ======== + */ +typedef long xdc_IArg; +typedef unsigned long xdc_UArg; + +#define xdc__ARG__ +typedef xdc_IArg xdc_Arg; /* deprecated, but compatible with BIOS 5.x */ + +/* + * ======== xdc__META ======== + */ +#define xdc__META(n,s) __attribute__ ((section ("xdc.meta"))) const char (n)[] = {s} + +#endif /* google_targets_STD_ */ + +/* + * @(#) google.targets; 1, 0, 0,112; 6-24-2013 15:21:46; /db/ztree/library/trees/xdctargets/xdctargets-g31x/src/ xlibrary + + */ + diff --git a/packages/xdctools/qnx/targets/arm/std.h b/packages/xdctools/qnx/targets/arm/std.h new file mode 100644 index 0000000..4837b15 --- /dev/null +++ b/packages/xdctools/qnx/targets/arm/std.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2011 Texas Instruments and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Texas Instruments - initial implementation + * + * + */ + +/* + * ======== qnx/targets/arm/std.h ======== + * Standard types for supported QNX Arm compilers + */ + +#ifndef qnx_targets_arm_STD_ +#define qnx_targets_arm_STD_ + +/* Define target-specific "portable" macros + * + * The build command-line define xdc_target_name__ to be the value + * of the target's name config parameter. We use this to include the + * target-specific definitions for the required target-independent + * xdc_target* macros. + */ +#ifdef xdc_target_name__ +#include xdc__local_include(xdc_target_name__) +#endif + +/* "inherit" (i.e., include) all gnu.targets standard types */ +#include + +#endif /* qnx_targets_arm_STD_ */ + +/* + * @(#) qnx.targets.arm; 1, 0, 0,101; 6-24-2013 15:21:54; /db/ztree/library/trees/xdctargets/xdctargets-g31x/src/ xlibrary + + */ + diff --git a/packages/xdctools/xdc/std.h b/packages/xdctools/xdc/std.h new file mode 100644 index 0000000..1f751e5 --- /dev/null +++ b/packages/xdctools/xdc/std.h @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2008 Texas Instruments. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License + * v. 1.0 which accompanies this distribution. The Eclipse Public License is + * available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse + * Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Texas Instruments - initial implementation + * */ + +#ifndef xdc_std__include +#define xdc_std__include + +#include +#include + +/* macros to simplify "stringification" and computed includes */ +#define xdc__stringify(a) #a +#define xdc__local_include(a) xdc__stringify(a.h) +#define xdc__system_include(m) + +/* TitleCase standard types */ + +#define xdc_Void void + +typedef char xdc_Char; +typedef unsigned char xdc_UChar; +typedef short xdc_Short; +typedef unsigned short xdc_UShort; +typedef int xdc_Int; +typedef unsigned int xdc_UInt; +typedef long xdc_Long; +typedef unsigned long xdc_ULong; +typedef float xdc_Float; +typedef double xdc_Double; +typedef long double xdc_LDouble; +typedef size_t xdc_SizeT; +typedef va_list xdc_VaList; + +/* Generic Extended Types */ + +typedef unsigned short xdc_Bool; /* boolean flag */ +typedef void *xdc_Ptr; /* data pointer */ +typedef const void *xdc_CPtr; /* data pointer */ +typedef char *xdc_String; /* null terminated string */ +typedef const char *xdc_CString; /* null terminated immutable string */ + +#define xdc__CSTRING__ 1 /* flag that CString is declared */ + +/* we intentionally omit arguments from Fxn to indicate that it can have + * any (or none). Unfortunately this causes gcc to emit warnings when + * -Wstrict-prototypes is used. Newer gcc's (4.6 or later) support a pragma + * that works around this: + * + * #pragma GCC diagnostic ignored "-Wstrict-prototypes" + */ +#ifdef __GNUC__ + #if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-prototypes" + typedef int (*xdc_Fxn)(); /* function pointer */ + #pragma GCC diagnostic pop + #else + typedef int (*xdc_Fxn)(); /* function pointer */ + #endif +#else + typedef int (*xdc_Fxn)(); /* function pointer */ +#endif + +/* + * Import the target-specific std.h + */ +#ifdef xdc_target_types__ +#define xdc_target__ +#endif +#ifdef xdc_target__ +#include xdc_target__ +#else +/* if the user did not supply the required xdc_target* definitions, ask well + * known compiler tool chains to select based on their pre-defined macros + */ +#ifdef __TI_COMPILER_VERSION__ +#include +#else +/* + * 'xdc_target_types__' must be defined to name a target-specific header + * file (e.g., ti/targets/std.h) that has definitions for the basic types: + * xdc_Int8, xdc_Int16, ... + * + * For example, to build for a target in the ti.targets package you should + * add the following option to your compiler's command line: + * -Dxdc_target_types__=ti/targets/std.h + */ +#error xdc_target_types__ must be defined to name a target-specific header containing definitions of xdc_Int8, xdc_Int16, ... + +/* the following definitions are required to keep the compiler from + * complaining about references to these types in the rest of this header; + * some compilers do not stop parsing this file after the #error above. + */ +typedef int xdc_IArg; +typedef unsigned int xdc_UArg; +typedef signed char xdc_Int8; +typedef unsigned char xdc_UInt8; +typedef short xdc_Int16; +typedef unsigned short xdc_UInt16; +typedef int xdc_Int32; +typedef unsigned int xdc_UInt32; +#endif +#endif + +/* Each modules' internal header file defines 'module' as + * xdc__MODOBJADDR__(Module__state__V), where Module__state__V is the actual + * object where the module state is kept. For most targets, the default macro + * given here results in the construct '(&Module__state__V)->field', when the + * expression 'module->field' is used. Compilers then generate the code that + * doesn't dereference a pointer, but puts the address of the field in the + * code. + * The targets that need to do something different can define + * xdc__MODOBJADDR__ in std.h for their target package. + */ +#ifndef xdc__MODOBJADDR__ +#define xdc__MODOBJADDR__(symbol) (&(symbol)) +#endif + +/* Long Long Types */ + +#ifdef xdc__LONGLONG__ +typedef long long xdc_LLong; +typedef unsigned long long xdc_ULLong; + +#else + +#ifndef xdc__INT64__ +/* If the target doesn't support "long long" or a 64-bit integral type, we + * simply use "long". This is done to ensure that the type LLong always + * exists, it's at least as long as a "long", and it's 64-bits wide whenever + * possible. + */ +typedef long xdc_LLong; +typedef unsigned long xdc_ULLong; +#endif + +#endif + +/* Arg to Ptr and Fxn conversion operators + * + * Individual targets may override these definitions in the event + * that compilers issue warnings about shortening of an Arg to a pointer, + * for example. + */ +#ifndef xdc__ARGTOPTR +static inline xdc_Ptr xdc_iargToPtr(xdc_IArg a) { return ((xdc_Ptr)a); } +static inline xdc_Ptr xdc_uargToPtr(xdc_UArg a) { return ((xdc_Ptr)a); } +#endif + +#ifndef xdc__ARGTOFXN +static inline xdc_Fxn xdc_iargToFxn(xdc_IArg a) { return ((xdc_Fxn)a); } +static inline xdc_Fxn xdc_uargToFxn(xdc_UArg a) { return ((xdc_Fxn)a); } +#endif + +#ifndef xdc__ARGTOFLOAT +/* + * functions to efficiently convert a single precision float to an IArg + * and vice-versa while maintaining client type safety + * + * Here the assumption is that sizeof(Float) <= sizeof(IArg); + */ +typedef union { + xdc_Float f; + xdc_IArg a; +} xdc_FloatData; + +static inline xdc_IArg xdc_floatToArg(xdc_Float f) +{ + xdc_FloatData u; + u.f = f; + + return (u.a); +} + +static inline xdc_Float xdc_argToFloat(xdc_IArg a) +{ + xdc_FloatData u; + u.a = a; + + return (u.f); +} +#endif + +/* restrict keyword */ +#ifndef xdc__RESTRICT__ +#define restrict +#endif + +/* Unprefixed Aliases */ + +#ifndef xdc__nolocalnames + +#define iargToPtr(a) xdc_iargToPtr(a) +#define uargToPtr(a) xdc_uargToPtr(a) +#define iargToFxn(a) xdc_iargToFxn(a) +#define uargToFxn(a) xdc_uargToFxn(a) +#define floatToArg(a) xdc_floatToArg(a) +#define argToFloat(a) xdc_argToFloat(a) + +#define Void xdc_Void + +typedef xdc_Char Char; +typedef xdc_UChar UChar; +typedef xdc_Short Short; +typedef xdc_UShort UShort; +typedef xdc_Int Int; +typedef xdc_UInt UInt; +typedef xdc_Long Long; +typedef xdc_ULong ULong; +typedef xdc_LLong LLong; +typedef xdc_ULLong ULLong; +typedef xdc_Float Float; +typedef xdc_Double Double; +typedef xdc_LDouble LDouble; +typedef xdc_SizeT SizeT; +typedef xdc_VaList VaList; + +typedef xdc_IArg IArg; +typedef xdc_UArg UArg; +typedef xdc_Bool Bool; +typedef xdc_Int8 Int8; +typedef xdc_Int16 Int16; +typedef xdc_Int32 Int32; +typedef xdc_Fxn Fxn; +typedef xdc_Ptr Ptr; +typedef xdc_String String; +typedef xdc_CString CString; + +typedef xdc_UInt8 UInt8; +typedef xdc_UInt16 UInt16; +typedef xdc_UInt32 UInt32; + +/* DEPRECATED Aliases */ +#ifndef xdc__strict +#define _TI_STD_TYPES + +/* xdc_Arg is defined only in ti/targets/std.h; use IArg and UArg instead */ +#ifdef xdc__ARG__ +typedef xdc_Arg Arg; +#endif + +typedef xdc_UInt8 Uint8; +typedef xdc_UInt16 Uint16; +typedef xdc_UInt32 Uint32; +typedef xdc_UInt Uns; +#endif + +/* + * ======== optional types ======== + * The following types are not always defined for all targets + */ +#ifdef xdc__INT64__ +typedef xdc_Int64 Int64; +typedef xdc_UInt64 UInt64; +#endif + +/* The following exact size types are not required by C99 and may not be + * supported by some compiler/processor environments. For greater + * portability, use the IntN or UIntN types above. + */ +#ifdef xdc__BITS8__ +typedef xdc_Bits8 Bits8; +#endif + +#ifdef xdc__BITS16__ +typedef xdc_Bits16 Bits16; +#endif + +#ifdef xdc__BITS32__ +typedef xdc_Bits32 Bits32; +#endif + +#ifdef xdc__BITS64__ +typedef xdc_Bits64 Bits64; +#endif + +#endif /* xdc__nolocalnames */ + +/* Standard Constants */ + +/* NULL must be 0 for C++ and is set to 0 in C to allow legacy code to + * compile without warnings. + * + * If xdc__strict is defined, NULL is defined to be a pointer to allow + * maximal type checking in "modern" C sources + */ +#undef NULL +#if defined(__cplusplus) || !defined(xdc__strict) +#define NULL 0 +#else +#define NULL ((void *)0) +#endif + +#undef FALSE +#define FALSE 0 + +#undef TRUE +#define TRUE 1 + +/* Declaration Qualifiers */ + +#ifndef __FAR__ +#define __FAR__ +#endif + +/* + * ======== xdc__CODESECT ======== + * Code-Section Directive + * + * Targets can optionally #define xdc__CODESECT in their specific + * std.h files. This directive is placed in front of all + * "extern" function declarations, and specifies a section-name in + * which to place this function. This approach + * provides more control on combining/organizing groups of + * related functions into a single named sub-section (e.g., + * "init-code") If this macro is not defined by the target, an + * empty definition is used instead. + */ +#ifndef xdc__CODESECT +#define xdc__CODESECT(fn, sn) +#endif + +/* + * ======== xdc__META ======== + * Embed unreferenced string in the current file + * + * Strings emebdded via xdc__META can be placed in a section that is + * _not_ loaded on the target but are, nevertheless, part of the + * executable and available to loaders. + * + * Different targets may define this macro in a way that places these + * strings in an output section that is not loaded (and therefore does + * not takeup space on the target). Unless the target provides a + * definition of xdc__META, the definition below simply defines + * as string constant in the current file. + */ +#ifndef xdc__META +#define xdc__META(n,s) __FAR__ const char (n)[] = {s} +#endif + +#endif /* xdc_std__include */ +/* + * @(#) xdc; 1, 1, 1,426; 6-24-2013 18:59:27; /db/ztree/library/trees/xdc/xdc-z52x/src/packages/ + */ + -- cgit v1.2.3-54-g00ecf