/* ******************************************************************************** * C64+ Based VC1 (SMPTE421M) Decoder * * "C64+ Based VC1 (SMPTE421M) Decoder" is a software module * developed for TI's c64x+ based SOCs. This module is capable of generating a * raw 4:2:0 video data by de-compressing/decoding VC1 bit-streams based on * SMPTE 421M. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ * ALL RIGHTS RESERVED ******************************************************************************** */ /** ******************************************************************************** * @file vc1vdec_ti_huffdec_wmv.c * * @brief This File contains functions related to Huffman table decoding. * * @version 1.0 : Base version Created * * @version 1.1 (8th Oct 2003) : Added performing VLD function for intra MB's * (I and P frames) * @author S. Shirdhonkar * * @version 1.2 (April 2011) : Coding guidelines and commenting * @author Rama Mohana Reddy * ******************************************************************************* */ /****************************************************************************** * INCLUDE FILES ******************************************************************************/ /*-------------------------------program files ------------------------------*/ /* ******************************************************************************** * Generic Common Data Types * * "Common Data types " is software a module developed for TI's c64x+ based SOCs. * This module provides type casted name spaces for the decoder. * * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ * ALL RIGHTS RESERVED ******************************************************************************** */ /** ******************************************************************************** * @file Genericcomdatatype.h * * @brief This file defines the data type definations that are used in the * C64x+ DSP projects * * @author Prasad RSV * * @version 0.0 (Feb 2010) : Created [Prasad RSV] * ******************************************************************************** */ /* ---------------------- compilation control switches -----------------------*/ /******************************************************************************* * INCLUDE FILES *******************************************************************************/ /* ---------------------- system and platform files ------------------------- */ /* * 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 * */ /*****************************************************************************/ /* stdarg.h v7.2.2 */ /* */ /* Copyright (c) 1993-2011 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* 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. */ /* */ /*****************************************************************************/ typedef char *va_list; /*****************************************************************************/ /* VA_END - Reclaim resources used by varargs handling. */ /* */ /* No action needed */ /*****************************************************************************/ /*****************************************************************************/ /* VA_START - Set up the va_list pointer. */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* ELF ABI convention: */ /* - va_list pointer points one byte beyond the last argument. */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /* VA_ARG - Return the next argument, adjust va_list pointer */ /* */ /* Some arguments passed by value are turned into pass-by-reference by */ /* making a temporary object and passing a pointer to this temporary. For */ /* such an argument (indicated by __va_argref(_type)) the actual argument */ /* passed is a pointer, so it must be dealt with specially. */ /* */ /* When an argument is larger than the maximum alignment (8 bytes for double */ /* or long long), we only align to 8 bytes. */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* What happens on every va_arg(_ap, _type) call is: */ /* 1) Align the value of _ap (the va_list pointer) appropriately for _type */ /* (the requested type). */ /* 2) Increment _ap appropriately for _type. */ /* 3) Return the value desired by dereferencing _ap. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* 1) Align _ap to satisfy alignment of _type. */ /* 2) Increment _ap by sizeof(_type) */ /* 3) return *(ap-sizeof(_type)) */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* The big- and little-endian variants are different only because we are */ /* trying to support the case of the user asking for "char" or "short", */ /* which is actually undefined behavior (See ISO/IEC 9899:1999 7.15.1.1), */ /* but we are trying to be friendly. */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /* stddef.h v7.2.2 */ /* */ /* Copyright (c) 1993-2011 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* 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. */ /* */ /*****************************************************************************/ typedef int ptrdiff_t; typedef unsigned size_t; typedef unsigned short wchar_t; /* macros to simplify "stringification" and computed includes */ /* TitleCase standard types */ 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; typedef void *xdc_Ptr; /* data pointer */ typedef char *xdc_String; /* null terminated string */ /* 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 support a pragma that * may work around this: * * #pragma GCC diagnostic ignored "-Wstrict-prototype" */ typedef int (*xdc_Fxn)(); /* function pointer */ /* * Import the target-specific std.h */ /* * Copyright (c) 2008 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 * * */ /* * ======== ti/targets/std.h ======== * Standard types for supported TI compilers * */ /* include target-specific "portable" macros */ /* * Copyright 2010 by Texas Instruments Incorporated. * */ /* * ======== C64P.h ======== * DO NOT MODIFY: This header is generated from stddef.xdt * * This header contains target-specific definitions of target-independent * macros required by the ITarget interface. These definitions allow C/C++ * sources to portably compile for multiple targets (using #ifdef ...). */ /* * ======== ti_targets_C64P ======== * This macro identifies the specific target being used. This macro should * probably be avoided in portable sources. */ /* * ======== xdc_target__isaCompatible_* macros ======== * The following definitions enable clients to conditionally compile for any * compatible subset of the actual target ISA. */ /* * ======== xdc_target__isa_64P ======== * This macro identifies the specific target ISA for which we are being * compiled. */ /* * ======== xdc_target__{big|little}Endian ======== * The following macro enables clients to portably compile for big or little * endian targets. */ /* * ======== xdc_target__os_undefined ======== * The following macro enables clients to portably compile for target specific * OS; e.g., Linux, Solaris, Windows, undefined. */ /* * ======== xdc_target__sizeof_ ======== * The following macros enable clients to portably determine type sizes * within #ifdef blocks; sizeof() can't be used and the definitions in * stdint.h are not available to C++ clients (unless the special macro * __STDC_LIMIT_MACROS is defined). */ /* * ======== xdc_target__alignof_ ======== * The following macros enable clients to portably determine type alignment * within #ifdef blocks; even if provided by the compiler, alignof() can't * be used in pre-processor statements. */ /* * ======== xdc_target__bitsPerChar ======== * The number of bits in a char. This macro allow one to determine the * precise number of bits in any of the standard types (whose sizes are * expressed as a number of chars). */ /* * @(#) ti.targets; 1, 0, 3,399; 8-4-2010 16:21:18; /db/ztree/library/trees/xdctargets/xdctargets-c27x/src/ */ /*****************************************************************************/ /* STDINT.H v7.2.2 */ /* */ /* Copyright (c) 2002-2011 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* 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. */ /* */ /*****************************************************************************/ /* 7.18.1.1 Exact-width integer types */ typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef __int40_t int40_t; typedef unsigned __int40_t uint40_t; typedef long long int64_t; typedef unsigned long long uint64_t; /* 7.18.1.2 Minimum-width integer types */ typedef int8_t int_least8_t; typedef uint8_t uint_least8_t; typedef int16_t int_least16_t; typedef uint16_t uint_least16_t; typedef int32_t int_least32_t; typedef uint32_t uint_least32_t; typedef int40_t int_least40_t; typedef uint40_t uint_least40_t; typedef int64_t int_least64_t; typedef uint64_t uint_least64_t; /* 7.18.1.3 Fastest minimum-width integer types */ typedef int32_t int_fast8_t; typedef uint32_t uint_fast8_t; typedef int32_t int_fast16_t; typedef uint32_t uint_fast16_t; typedef int32_t int_fast32_t; typedef uint32_t uint_fast32_t; typedef int40_t int_fast40_t; typedef uint40_t uint_fast40_t; typedef int64_t int_fast64_t; typedef uint64_t uint_fast64_t; /* 7.18.1.4 Integer types capable of holding object pointers */ typedef int intptr_t; typedef unsigned int uintptr_t; /* 7.18.1.5 Greatest-width integer types */ typedef long long intmax_t; typedef unsigned long long uintmax_t; /* According to footnotes in the 1999 C standard, "C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before is included." */ /* 7.18.2 Limits of specified width integer types */ /* 7.18.3 Limits of other integer types */ /* 7.18.4.1 Macros for minimum-width integer constants */ /* There is a defect report filed against the C99 standard concerning how the (U)INTN_C macros should be implemented. Please refer to -- http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_209.htm for more information. These macros are implemented according to the suggestion given at this web site. */ /* 7.18.4.2 Macros for greatest-width integer constants */ typedef int xdc_Arg; /* deprecated, but compatible with BIOS 5.x */ /* * xdc__LONGLONG__ indicates if compiler supports 'long long' type * xdc__BITS __ indicates if compiler supports 'uint_t' type */ /* * int40_t types are supported for ELF in 7.2.0A10197 and later. * This ifdef should be removed when the cut over to 7.2 is complete. */ /* * ======== [U]Int ======== */ typedef int_least8_t xdc_Int8; typedef uint_least8_t xdc_UInt8; typedef int_least16_t xdc_Int16; typedef uint_least16_t xdc_UInt16; typedef int_least32_t xdc_Int32; typedef uint_least32_t xdc_UInt32; typedef int_least64_t xdc_Int64; typedef int_least64_t xdc_UInt64; typedef int_least40_t xdc_Int40; typedef uint_least40_t xdc_UInt40; /* the following unqualified names are here because 40-bit types are not * supported by xdc/std.h */ typedef xdc_Int40 Int40; typedef xdc_UInt40 UInt40; /* * ======== Bits ======== */ typedef uint8_t xdc_Bits8; typedef uint16_t xdc_Bits16; typedef uint32_t xdc_Bits32; typedef uint64_t xdc_Bits64; /* * ======== [UI]Arg ======== */ typedef intptr_t xdc_IArg; typedef uintptr_t xdc_UArg; /* * ======== restrict ======== */ /* * ======== ti_targets_mkPragma ======== */ /* * ======== xdc__META ======== */ /* * ======== __ti__ ======== * These symbols are used by RTSC tools to indicate presence/absence of * assorted #pragma options in TI compiler. */ /* * @(#) ti.targets; 1, 0, 3,399; 8-4-2010 16:21:20; /db/ztree/library/trees/xdctargets/xdctargets-c27x/src/ */ /* 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. */ /* Long Long Types */ typedef long long xdc_LLong; typedef unsigned long long xdc_ULLong; /* 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. */ 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); } 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); } /* * functions to convert a single precision float to an arg * Here assumption is that sizeof(Float) <= sizeof(IArg); */ typedef union xdc_FloatData { 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); } /* restrict keyword */ /* Unprefixed Aliases */ 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_UInt8 UInt8; typedef xdc_UInt16 UInt16; typedef xdc_UInt32 UInt32; /* DEPRECATED Aliases */ /* xdc_Arg is defined only in ti/targets/std.h; use IArg and UArg instead */ typedef xdc_Arg Arg; typedef xdc_UInt8 Uint8; typedef xdc_UInt16 Uint16; typedef xdc_UInt32 Uint32; typedef xdc_UInt Uns; /* * ======== optional types ======== * The following types are not always defined for all targets */ typedef xdc_Int64 Int64; typedef xdc_UInt64 UInt64; /* 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. */ typedef xdc_Bits8 Bits8; typedef xdc_Bits16 Bits16; typedef xdc_Bits32 Bits32; typedef xdc_Bits64 Bits64; /* Standard Constants */ /* Declaration Qualifiers */ /* Code-Section Directive */ /* * ======== xdc__CODESECT ======== * 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 * will give folks 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. */ /* * ======== 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. */ /* * @(#) xdc; 1, 1, 1,291; 8-20-2010 17:20:38; /db/ztree/library/trees/xdc/xdc-v48x/src/packages/ */ /* --------------------------- program files -------------------------------- */ /******************************************************************************* * EXTERNAL REFERENCES NOTE : only use if not found in header file *******************************************************************************/ /* -------------------------- data declarations ----------------------------- */ /* ------------------------- function prototypes ---------------------------- */ /******************************************************************************* * PUBLIC DECLARATIONS Defined here, used elsewhere *******************************************************************************/ /* ------------------------- data declarations ------------------------------ */ /* ------------------------ function prototypes ----------------------------- */ /******************************************************************************* * PRIVATE DECLARATIONS Defined here, used only here *******************************************************************************/ /* ------------------------------ macros ------------------------------------ */ /* ------------------------ data declarations ------------------------------- */ /** * @brief Creates a type name signed char */ typedef xdc_Char S8; /** * @brief Creates a type name signed 16 bit value */ typedef xdc_Short S16; /** * @brief Creates a type name signed 32 bit value */ typedef xdc_Int S32; /** * brief Creates a type name signed 64 bit value */ typedef xdc_LLong S64; /** * @brief Creates a type name unsigned 8 bit value */ typedef xdc_UChar U8; /** * @brief Creates a type name unsigned 16 bit value */ typedef xdc_UShort U16; /** * @brief Creates a type name unsigned 32 bit value */ typedef xdc_UInt U32; /** * @brief Creates a type name unsigned 64 bit value */ typedef xdc_ULLong U64; /** * @brief Creates a type name void variables */ typedef void V; /** * @brief Creates a type name to signed 8 bit value pointer */ typedef xdc_Char* pS8; /** * @brief Creates a type name to signed 16 bit value pointer */ typedef xdc_Short* pS16; /** * @brief Creates a type name to signed 32 bit value pointer */ typedef xdc_Int* pS32; /** * @brief Creates a type name to signed 64 bit value pointer */ typedef xdc_LLong* pS64; /** * @brief Creates a type name to unsigned 8 bit value pointer */ typedef xdc_UChar* pU8; /** * @brief Creates a type name to unsigned 16 bit value pointer */ typedef xdc_UShort* pU16; /** * @brief Creates a type name to unsigned 32 bit value pointer */ typedef xdc_UInt* pU32; /** * @brief Creates a type name to unsigned 64 bit value pointer */ typedef xdc_ULLong* pU64; /** * @brief Creates a type name to void pointer */ typedef void * pV; /* ----------------------- function prototypes ------------------------------ */ //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** //****************************************************************************** // Embedded TMS320C6400 platform //# define _EMB_WMV2_ this turns on some unfriendly features, so let it be // off for a while. //# define __STREAMING_MODE_DECODE_ //# define _DEBUG_TRACE typedef unsigned short WORD; typedef void* LPVOID; typedef void* HANDLE; typedef char TCHAR; //DH typedef unsigned char BOOL; typedef unsigned int DWORD; typedef struct _tagBITMAPFILEHEADER { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER, *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER; //#define _SUPPORT_POST_FILTERS_ //****************************************************************************** // memcpy of aligned U32_WMV with cbSiz = number of bytes to copy // assumes pDst and pSrc are aligned, but casts them in case they are actually // byte or short pointers. // memset of aligned U32_WMV with cbSiz = number of bytes to copy // replicate a byte 4 times in an U32_WMV. // memset of aligned U32_WMV with a replicated U8_WMV constant // Average of 8 bytes // Sum of 8 bytes (takes 13 ops + 2 reads) //**************************************************************************** //****************************************************************************** // Some winCE platforms do not support printf. //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** /************************************************************************* Copyright (c) 2000 - 2001 Microsoft Corporation Module Name: wmvdec_api.h Abstract: Decoder API's for WMV. decodes WMV2, WMV1, MMIDRATE43, MMIDRATE42, MMIDRATE4S Author: Revision History: *************************************************************************/ // basic types typedef void* HWMVDecoder; typedef void Void_WMV; //typedef long I32_WMV; typedef int I32_WMV; typedef unsigned int U32_WMV; typedef signed short I16_WMV; typedef unsigned short U16_WMV; typedef unsigned short U16Char_WMV; typedef signed char I8_WMV; typedef unsigned char U8_WMV; typedef signed int Bool_WMV; typedef double Double_WMV; typedef float Float_WMV; typedef enum tagWMVDecodeStatus { WMV_Succeeded = 0, WMV_Failed, WMV_BadMemory, WMV_NoKeyFrameDecoded, WMV_CorruptedBits, WMV_UnSupportedOutputPixelFormat, WMV_UnSupportedCompressedFormat, WMV_InValidArguments, WMV_BadSource, WMV_NoMoreOutput, WMV_EndOfFrame, WMV_BrokenFrame, WMV_InvalidDecoderObject, WMV_StartCodeNotFound, WMV_InvalidStartcode, WMV_UnSupportedMode, WMV_FlushBitNotFound } tWMVDecodeStatus; typedef enum tagWMVDecodeDispRotateDegree { WMV_DispRotate0 = 0, WMV_DispRotate90, WMV_DispFlip, WMV_DispRotate270 } tWMVDecodeDispRotateDegree; // *** *** *** *** *** *** // Handle_WMV, tWMVAsyncRect, tagWMVDecodeState are needed only for the // Asynchronous Interface extension // However, they can be used with a synchronous interface typedef void* Handle_WMV; typedef struct tagWMVRect { I32_WMV left; I32_WMV top; I32_WMV right; I32_WMV bottom; } tWMVRect; typedef enum tagWMVAsyncDecodeState { // The codec is uninitialized or in an undefined state. CodecState_None, // Please notice an asynchronously reported error. CodecState_AsyncError, // The codec is ready and waiting for us to give it a compressed buffer. CodecState_ReadyToDecode, // The codec is asynchronous, and is still processing the buffer. CodecState_Decoding, /* The buffer has been decoded (synchronously or asynchronously), and the finished frame is ready for us to get from the codec. We should only see this state if the codec doesn't do its own rendering and expects the player to render the result instead. */ CodecState_Decoded, /* The buffer has been decoded and is being held internally for rendering by the codec. */ CodecState_ReadyToRender, // The codec renderer is asynchronous, and is still rendering. CodecState_Rendering } tWMVAsyncDecodeState; // *** *** *** *** *** *** // GUID definiton //// SHOULD MERGE WITH WMF_TYPES.H /******* video output type guids, in preference order *****/ //Added defination for advanced profile (Anirban Basu) /***********************************************************/ /******* video intput type guids, in preference order *****/ /***********************************************************/ /******* frame types ***************************************/ tWMVDecodeStatus WMVideoDecClose (HWMVDecoder phWMVDecoder); /* This function should be called before a seek to the next key frame is /performed. It will reset the internal state of the decoder to the beginning of the stream */ tWMVDecodeStatus WMVideoDecResetBState( HWMVDecoder hWMVDecoder) ; // *** *** *** *** *** *** // WMVideoDecAsyncSetup, WMVideoDecAsyncGetRenderLatencyMS, //WMVideoDecAsyncGetCodecState, WMVideoDecAsyncRenderDirect // are only needed for the Asynchronous extension to the WMVideoDec INterface. // WMVideoDecAsyncSetup function is called after WMVideoDecInit() succeeds // SetEvent(hSyncEvent) is to be called by any function implemented in an //asynchronous fashion (DecodeData, RenderDirect, or GetOutput) // when that asynchronous function competes its task (changes the codec state). // A codec that is completely synchronous (never reports an async codec state) // does not need to SetEvent(hSyncEvent). // WMVideoDecAsyncRenderDirect() will be called after DecodeData to see if the //implementation is able to directly // render. Note that DecodeData might be synchronous and Rendering still be // asynchornous, or they both might be asynchronous. // The rendering process can be characterized as a clip, followed by a rotation, // followed by a scaling. // The decoded WMV file has characteristic source dimensions which might be // clipped by rectSrcClipRect. // Then the picture might be rotate (0, 90, 180, 270). // Then the picture might be scaled to fit a screen area. // return WMV_Failed if implementation cannot render directly // WMVideoDecAsyncGetRenderLatencyMS() returns the expect average render latency // from call to image display // return -1 this time is unknown or if this implementation can not render direct // Returns Decode state in *piDecodeState. // If the returned state is CodecState_AsyncError, then the return value // represents an error detected by an asnchronously // part of the decoder such errors are only returned once. // *** *** *** *** *** *** //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** /************************************************************************* Copyright (c) Microsoft Corporation 1996 - 1999 Module Name: typedef.h Abstract: Basic types: CVector2D, CPixel, CMotionVector, Author: Ming-Chieh Lee (mingcl@microsoft.com) 20-March-1996 Wei-ge Chen (wchen@microsoft.com) 20-March-1996 Bruce Lin (blin@microsoft.com) 14-April-1996 Chuang Gu (chuanggu@microsoft.com) 5-June-1996 Revision History: *************************************************************************/ //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** /************************************************************************* Copyright (C) Microsoft Corporation, 1996 - 1998 Module Name: header.h Abstract: define number of bits and some information for encoder/decoder Author: Ming-Chieh Lee (mingcl@microsoft.com) 20-March-1996 Revision History: *************************************************************************/ // for motion // macroblock // block // distinguish from const /*Use for forcing pred. direction for left edge blocks for AP*/ // Common Values // Colour Primaies values // Colour Transfer Characteristics // Colour Matrix Coefficients /** ================================================================== * @file toolset.h * * @path $(PROJ)\include * * @desc This File contains the switches for enabling among the various * options available to the WMV decoder * ===================================================================== * Copyright (c) Texas Instruments Inc 2002, 2003 * * Use of this software is controlled by the terms and conditions found in the license agreement under which this software has been supplied * =====================================================================*/ // Defining AP specific tools ///////////////////////////////////////////// // // Typedefs for basic types // ///////////////////////////////////////////// typedef I32_WMV CoordI; typedef I32_WMV Wide; typedef U32_WMV UWide; typedef I32_WMV PixelI32; typedef U32_WMV Time; typedef enum {MMIDRATE4S, MPG4, MMIDRATE42, MMIDRATE43, WMV1, WMV2, WMV3, WMVA} CodecVersion; // define MB type typedef enum {DIRECT = 1, INTERPOLATE, BACKWARD, FORWARD, INTRAMBT} MBType; typedef enum{ PROGRESSIVE = 0, INTERLACE_FRAME=1, INTERLACE_FIELD=2 }tFrameCodingType; typedef enum{ NONE = -1, LEFT_PREDICTION = 0, TOP_PREDICTION }tAcPredDirType; /* return / error types */ typedef enum { WMVDEC_invalidBitstreamAddress = 0x00000001, WMVDEC_nullBitstreamAddress, WMVDEC_insufficientData, WMVDEC_corruptedHeader, WMVDEC_corruptedBitStream, WMVDEC_duringInitialization, WMVDEC_invalidCodecVersion, /* only WMV9 streams are supported */ WMVDEC_allocFailure, WMVDEC_systemError, WMVDEC_initSuccess, WMVDEC_noError, WMVDEC_skippedFrame_USF, /* USF - unsupported feature */ WMVDEC_unsupported_BS, /* WMV9-Beta or < WMV9 */ WMVDEC_internalErrorBBOR, /* internal errors */ WMVDEC_internalErrorMBDec1, /* see error code for more details */ WMVDEC_internalErrorMBDec2, /* see error code for more details */ WMVDEC_nullWmvDecObject, WMVDEC_wrongExtSizeInBitStream, WMVDEC_insufficientMemoryDuringInit, WMVDEC_needMoreMemoryForRcvData, WMVDEC_internalErrorHWFE1, WMVDEC_internalErrorHWFE2, WMVDEC_internalErrorNoIFD, WMVDEC_unsupportedFeature, WMVDEC_internalErrorHDC, WMVDEC_internalErrorWVIMB, WMVDEC_internalErrorWQ, WMVDEC_unsupportedFeatureInterlace, WMVDEC_unsupportedFeatureSprite, WMVDEC_unsupportedFeatureX8IIntra, WMVDEC_unsupportedFeatureMultiRes, WMVDEC_unsupportedFeatureBFrames, WMVDEC_unsupportedFeatureBeta, WMVDEC_unsupportedFeatureComplex, WMVDEC_startCodeNotFound, WMVDEC_invalidStartcode, WMVDEC_flushBitNotFound } WMVDEC_STATUS; enum {XFORMMODE_8x8, XFORMMODE_8x4, XFORMMODE_4x8, XFORMMODE_MBSWITCH/* pseudo-mode */, XFORMMODE_4x4}; typedef enum BlockNum { ALL_Y_BLOCKS = 0, Y_BLOCK1 = 1, Y_BLOCK2 = 2, Y_BLOCK3 = 3, Y_BLOCK4 = 4, U_BLOCK = 5, V_BLOCK = 6, A_BLOCK1 = 7, A_BLOCK2 = 8, A_BLOCK3 = 9, A_BLOCK4 = 10, ALL_A_BLOCKS = 11 } BlockNum; ///////////////////////////////////////////// // Control flag for varius compiler // ///////////////////////////////////////////// //some platforms might not support inline assemb ///////////////////////////////////////////// // // Motion Vectors // ///////////////////////////////////////////// union Buffer { I16_WMV i16[64]; I32_WMV i32[64]; }; typedef struct tagCVector { I8_WMV x; I8_WMV y; } CVector; /* 0 - 8x8 Xform, 1 - 8x4 Xform * 2 - 4x8 Xform ,3 - 4x4 Xform */ typedef struct mb_info__{ /* All bit-arrays used in this structure follow * the same pattern. i.e., Least Significant Bit * of the flag will have the information for 0th( First) * block of the MB. But for I frame flow, bits will be * arranged in opposite direction. */ unsigned char cbp; unsigned char intra; unsigned char m_iQP; unsigned int bOverlap : 1; // Added by Anirban Basu unsigned int xform_switch_on : 1; unsigned int skip_mb : 1; unsigned int mb_type : 4; // B frames. FORWARD == 4. unsigned int bFieldMB : 1; // Added by Anirban Basu unsigned int bAcPred : 1; // Added by Anirban Basu unsigned int mv_mode : 3; // 0:1 MV, 1:4 MV, 3: INTRA, // 4:1 MV FIELD, 5: 4 MV FIELD unsigned int bMVP : 4; // Added by Anirban Basu unsigned char iDCStep; unsigned char ubMvsw; unsigned short usLumBinIds; // Added by Anirban Basu unsigned short usChromBinIds; // Added by Anirban Basu /* These definitions have to be moved to another place. XXX FIXME */ unsigned char frm_mb_xform_arr[6]; /* IDCT_info data for multiple IDCT */ unsigned char num8x8; unsigned char num8x4; unsigned char num4x8; unsigned char num4x4; unsigned char all_8x8; /* Each block type info */ unsigned char top_left_mb_intra_blk_info; //topleft cr3(7,6) top cr32(5,4,3) left cr31(2,1,0) /* motion vector data for each MB */ unsigned int luma_4MV_array[4]; unsigned int chroma_4MV_array[4]; unsigned int ref_MV_array[2]; }mb_info; /* * Structure for bitplane information. */ typedef struct bit_plane__{ unsigned int skip_mb; //Bit plane decoding }bit_plane; /* Create a small structure to return all the information * decoded from MB header. * - Maintain the size of this struct 8 bytes. * (Else modify code setting this struct to 0. => headdec.c) */ typedef struct mb_hdr_info__{ unsigned char ac_pred_on; unsigned char mb_xform_mode; unsigned char mb_subblk_pat; /* These are unused, since no VLD table change within frame. */ unsigned char vld_tab_changed; unsigned char vld_tab_idx; /* Padding to make size of struct 8 bytes. */ unsigned char pad1, pad2, pad3; } mb_hdr_info; typedef struct tagPackHuffmanCode_WMV { U32_WMV code; U8_WMV length; } tPackHuffmanCode_WMV; typedef struct { unsigned int m_uiScaleOppYX; unsigned int m_uiScaleSame1YX; unsigned int m_uiScaleSame2YX; unsigned int m_iScaleZone1YX; unsigned int m_iZone1OffsetYX; }tMvPredScale_WMV; typedef struct { unsigned int uiSizeySizeX; unsigned int iMvsPerMB; unsigned int uiApFlag; unsigned int *MvArrayPtr[2]; void *pPredArray; }tIntraVldData; typedef struct { unsigned int uiTotalBBoxArea; unsigned int uiMaxAllocatedArea; unsigned int uiTopLeftUV; unsigned int uiValidBins; unsigned int uiAreaOpenLumBins[4]; unsigned int uiAreaOpenChromBins[4]; unsigned short uiTotalLumReferenceArea; unsigned short uiTotalChromReferenceArea; unsigned char ubCurLumBBoxId[4]; unsigned char ubCurChromBBoxId[4]; unsigned char ubNextFreeBBoxId; unsigned char ubCurChannelId; }tBoundingBoxParamsStruct; typedef struct { unsigned int uiTopLeft; unsigned int uiBottomRight; unsigned int uiStartMbyMbx; unsigned int uiTotalArea; unsigned int uiBinPitch; unsigned char *pReferenceData; unsigned char *pReferenceData2; unsigned char ubDataType; }tBoundingBoxArrayStruct; /*****************************************************************************/ /* STDIO.H v7.2.2 */ /* */ /* Copyright (c) 1993-2011 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* 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. */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* linkage.h v7.2.2 */ /* */ /* Copyright (c) 1998-2011 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* 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. */ /* */ /*****************************************************************************/ /*--------------------------------------------------------------------------*/ /* Define _CODE_ACCESS ==> how to call RTS functions */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* Define _DATA_ACCESS ==> how to access RTS global or static data */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* Define _DATA_ACCESS_NEAR ==> some C6000 RTS data must always be near */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* Define _IDECL ==> how inline functions are declared */ /*--------------------------------------------------------------------------*/ /*****************************************************************************/ /* stdarg.h v7.2.2 */ /* */ /* Copyright (c) 1993-2011 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* 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. */ /* */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Attributes are only available in relaxed ANSI mode. */ /*---------------------------------------------------------------------------*/ /****************************************************************************/ /* TYPES THAT ANSI REQUIRES TO BE DEFINED */ /****************************************************************************/ typedef struct { int fd; /* File descriptor */ unsigned char* buf; /* Pointer to start of buffer */ unsigned char* pos; /* Position in buffer */ unsigned char* bufend; /* Pointer to end of buffer */ unsigned char* buff_stop; /* Pointer to last read char in buffer */ unsigned int flags; /* File status flags (see below) */ } FILE; typedef int fpos_t; /****************************************************************************/ /* DEVICE AND STREAM RELATED MACROS */ /****************************************************************************/ /****************************************************************************/ /* MACROS THAT DEFINE AND USE FILE STATUS FLAGS */ /****************************************************************************/ /****************************************************************************/ /* MACROS THAT ANSI REQUIRES TO BE DEFINED */ /****************************************************************************/ /******** END OF ANSI MACROS ************************************************/ /****************************************************************************/ /* DEVICE AND STREAM RELATED DATA STRUCTURES AND MACROS */ /****************************************************************************/ extern far FILE _ftable[10]; extern far char _tmpnams[10][16]; /****************************************************************************/ /* FUNCTION DEFINITIONS - ANSI */ /****************************************************************************/ /****************************************************************************/ /* OPERATIONS ON FILES */ /****************************************************************************/ extern int remove(const char *_file); extern int rename(const char *_old, const char *_new); extern FILE *tmpfile(void); extern char *tmpnam(char *_s); /****************************************************************************/ /* FILE ACCESS FUNCTIONS */ /****************************************************************************/ extern int fclose(FILE *_fp); extern FILE *fopen(const char *_fname, const char *_mode); extern FILE *freopen(const char *_fname, const char *_mode, register FILE *_fp); extern void setbuf(register FILE *_fp, char *_buf); extern int setvbuf(register FILE *_fp, register char *_buf, register int _type, register size_t _size); extern int fflush(register FILE *_fp); /****************************************************************************/ /* FORMATTED INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern int fprintf(FILE *_fp, const char *_format, ...) ; extern int fscanf(FILE *_fp, const char *_fmt, ...) ; extern int printf(const char *_format, ...) ; extern int scanf(const char *_fmt, ...) ; extern int sprintf(char *_string, const char *_format, ...) ; extern int snprintf(char *_string, size_t _n, const char *_format, ...) ; extern int sscanf(const char *_str, const char *_fmt, ...) ; extern int vfprintf(FILE *_fp, const char *_format, va_list _ap) ; extern int vprintf(const char *_format, va_list _ap) ; extern int vsprintf(char *_string, const char *_format, va_list _ap) ; extern int vsnprintf(char *_string, size_t _n, const char *_format, va_list _ap) ; /****************************************************************************/ /* CHARACTER INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern int fgetc(register FILE *_fp); extern char *fgets(char *_ptr, register int _size, register FILE *_fp); extern int fputc(int _c, register FILE *_fp); extern int fputs(const char *_ptr, register FILE *_fp); extern int getc(FILE *_p); extern int getchar(void); extern char *gets(char *_ptr); extern int putc(int _x, FILE *_fp); extern int putchar(int _x); extern int puts(const char *_ptr); extern int ungetc(int _c, register FILE *_fp); /****************************************************************************/ /* DIRECT INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern size_t fread(void *_ptr, size_t _size, size_t _count, FILE *_fp); extern size_t fwrite(const void *_ptr, size_t _size, size_t _count, register FILE *_fp); /****************************************************************************/ /* FILE POSITIONING FUNCTIONS */ /****************************************************************************/ extern int fgetpos(FILE *_fp, fpos_t *_pos); extern int fseek(register FILE *_fp, long _offset, int _ptrname); extern int fsetpos(FILE *_fp, const fpos_t *_pos); extern long ftell(FILE *_fp); extern void rewind(register FILE *_fp); /****************************************************************************/ /* ERROR-HANDLING FUNCTIONS */ /****************************************************************************/ extern void clearerr(FILE *_fp); extern int feof(FILE *_fp); extern int ferror(FILE *_fp); extern void perror(const char *_s); //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** //+------------------------------------------------------------------------- // // Microsoft Windows Media // // Copyright (C) Microsoft Corporation, 1998 - 1998 // // File: huffman.h // //-------------------------------------------------------------------------- /* -*-c++-*- * Sanjeev Mehrotra * 6/19/1998 * Chuang Gu * 2/1/2000 */ typedef enum tagVResultCode { vrNoError = 0, vrFail = 1, vrNotFound = 2, vrExists = 3, vrEof = 4, vrOutOfMemory = 5, vrOutOfResource = 6, vrOutOfBounds = 7, vrBadParam = 8, vrBadInput = 9, vrIOError = 10, vrInterrupted = 11, vrNotSupported = 12, vrNotImplemented = 13, vrDropped = 14, vr_ENDOFALLERRORS } VResultCode; // define stages assuming large memory and cache // Mode Entry Size Max # Symbols Max codeword length // ---------------------------------------------------------------- // LARGE_HUFFMAN 8 bytes Large 32 bits // MED_HUFFMAN 4 bytes 65536 32 bits // SMALL_HUFFMAN 2 bytes 4096 32 bits typedef struct _HuffDecInfo { /* These kind of bitfields are not useful for us. We need speed */ U16_WMV symbol; U16_WMV length; } HuffDecInfo; typedef struct _TableInfo { I32_WMV bits; HuffDecInfo *table; } TableInfo; typedef struct _TableInitInfo { I32_WMV prefix; // the prefix that got you there I32_WMV start, end; // start, end tableNums of children tables I32_WMV bits; // the bits for this table I32_WMV maxBits; // the maximum # of bits of things entering this table } TableInitInfo; //class CVideoObjectDecoder ; //class CDCTTableInfo_Dec; typedef struct _Huffman_WMV { /* Some fields (m_uiUserData for sure) are unused in this structure, but we * can't delete them because ASM files are written assuming the offset with * them. We should come up with a better interface for the ASM structures -NK */ U32_WMV m_uiUserData; // It is critical that encTable be 32 bits and decTable be 16 bits for // the given huffman routines to work I32_WMV m_alphabetSize; I32_WMV m_maxCodeLength; I32_WMV m_numDecEntries, m_allocDecEntries; I32_WMV m_allocTables; const tPackHuffmanCode_WMV *m_encInfo; HuffDecInfo *m_decInfo; TableInfo *m_tableInfo; I32_WMV m_firstLength; TableInitInfo *m_initInfo; I32_WMV stage_size[6]; Void_WMV * pWMVDec; } Huffman_WMV; /* ======================================================================== * Structures for 1MV flow. * Huffman_WMV: structure for static tables. Most of the values fields in * the original struct are not required. * Assumptions: * 1) The TableInfo and TableInfo_TI structures store (32 - bits_per_stage) * instead of "bits_per_stage" stored by MS. */ typedef struct _TableInfo_TI { I32_WMV bits; // (32 - bits_per_stage) unsigned short *table; // Address to packed short table of (length|index). } TableInfo_TI; typedef struct _Huffman_WMV_TI { unsigned short *m_decInfo; const TableInfo_TI *m_tableInfo; }Huffman_WMV_TI; /* ========================================================================== */ /* Sada: Struct fot VLD Kernel. Some parameters are common with * "tWMVDecInternalMember" and will have to be updated at start and end of the * kernel. * This struct is employed to avoid manipulation of the structure "Huffman_WMV" * * WARNING: The relative ordering of the members in this structure cannot be * altered * Any change will affect the VLD kernel. */ typedef struct { const U32_WMV *m_decInfo; // explain. const TableInfo *m_tableInfo; const U8_WMV* puiNotLastNumOfLevelAtRun; const U8_WMV* puiLastNumOfLevelAtRun; const U8_WMV* puiNotLastNumOfRunAtLevel; const U8_WMV* puiLastNumOfRunAtLevel; U8_WMV e3_prefix_len; U8_WMV e3_run_len; U8_WMV e3_lvl_len; U8_WMV first_e3_found; /* Date: 22-03-2004. * Tables and other parameters for block-header decode. */ const U8_WMV* blk_Xform_tab; // Combiled block transform type & sbp VLD table. const U8_WMV* sbp4x4_tab; // 4x4 sbp VLD table. U8_WMV Xform_sbp_index_bits; // number of bits to be used for indexing // in the above two tables. /*The following three pointers have been added for Multisymbol VLD:SN*/ const I32_WMV* DCTAC_MD_Table; const I32_WMV* pNumOfLevelAtRunDCTAC_MD_Table; const I32_WMV* pNumOfRunAtLevelDCTAC_MD_Table; } VLD_info; /* ========================================================================== */ //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** /************************************************************************* Copyright (C) 1996, 1997 Microsoft Corporation Module Name: strmdec.h Abstract: Decoder BitStream Author: Craig Dowell (craigdo@microsoft.com) 10-December-1996 Ming-Chieh Lee (mingcl@microsoft.com) 10-December-1996 Bruce Lin (blin@microsoft.com) 10-December-1996 Chuang Gu (chuanggu@microsoft.com) 2-Feb-2000 Revision History: Bruce Lin (blin@microsoft.com) 02-May-1997 Add getMaxBits() *************************************************************************/ extern int dbg_currbits[0x10000]; extern int dbg_currbits_idx; //Class istream; typedef U32_WMV STRMPARSER_BUFFER; extern const unsigned int GetMask_WMV [33]; typedef struct tagCInputBitStream_WMV { /* Assumptions: * - (For VC only) Always maintain m_BitsLeft > 0 (i.e. not equal to 0, * OK to have 32). * - Relative positions of various members cannot be changed without * corresponding changes in functions accessing this struct. */ U32_WMV m_fullWord; // The full word containing bit-stream, alway left // alligned. U32_WMV *m_pBuffer; // Pointer to bit-stream. (points to the next valid // location). U32_WMV m_fillerWord; // Filler word. Bits from this are used to maintain the // "m_fullWord" full. U32_WMV m_BitsLeft; // un-utilised bits in m_fillerWord. U8_WMV *m_bsEnd_ptr; // Address of last byte in the bit-stream buffer. // (to keep track of remaining bits in bit-stream.) I32_WMV m_fStreamStaus; // Indicates if bit-stream is valid. // (0 => OK, non-zero => bit-stream corrupted. ) }CInputBitStream_WMV; /*==========================================================================* * NAME: getbits_c.c * Bit-stream access function for WMV. * * AUTHOR: * Sadanand Shirdhonkar. * * REVISION HISTORY: * 14-10-2003 Initial version . . . . . . . . Sadanand Shirdhonkar. * * USAGE: * This C callable routine can be called as: * * inline unsigned int BS_getBits * ( CInputBitStream_WMV *bs, * unsigned int dwNumBits * ) * Where: * bs = pointer to the CInputBitStream_WMV struct. * dwNumBits = number of bits to retrive from the bit-stream. * * DESCRIPTION: * Returns next "dwNumBits" bits from the bit-stream and correspondingly * advances the bit-stream pointers. * * ASSUMPTIONS: * - The bit-stream is never read beyond the valid range. * - If the bit-stream is read beyond it's valid range, then garbage, and not * zeros (0), will be returned, as compared to the original code. * - 0 <= dwNumBits <= 32 * - Always maintain BitsLeft > 0 (i.e. not equal to 0, 32 is OK. For VC only) * - Relative positions of various CInputBitStream_WMV structure members * cannot be changed without corresponding changes in (all) functions * accessing this struct. * *==========================================================================*/ __inline U32_WMV BS_getBits (CInputBitStream_WMV *bs, register U32_WMV dwNumBits) { /* Assumptions: * - The bit-stream is never read beyond the valid range. * - If the bit-stream is read beyond it's valid range, then garbage, and not * zeros (0), will be returned, as compared to the original code. * - 0 <= dwNumBits <= 32 * - Always maintain BitsLeft > 0 (i.e. not equal to 0)(For VC only) */ U32_WMV iBitPattern; I32_WMV BitsLeft, bits_consumed; U32_WMV full_word; full_word = bs->m_fullWord; BitsLeft = bs->m_BitsLeft; bits_consumed = 32 - BitsLeft; iBitPattern = full_word >> (32 - dwNumBits); full_word <<= dwNumBits; full_word |= ( (bs->m_fillerWord << bits_consumed) >> (32 - dwNumBits) ); BitsLeft -= dwNumBits; if( BitsLeft <= 0 ) { bs->m_fillerWord = *bs->m_pBuffer++; BitsLeft += 32; full_word |= ( bs->m_fillerWord >> BitsLeft ); } bs->m_fullWord = full_word; bs->m_BitsLeft = BitsLeft; return(iBitPattern); } __inline U32_WMV BS_getBit (CInputBitStream_WMV * pThis) { return( BS_getBits(pThis, 1) ); } /* ========================================================================== */ __inline Bool_WMV BS_invalid (CInputBitStream_WMV * pThis) { return pThis->m_fStreamStaus; } extern U32_WMV BS_finalLoad( CInputBitStream_WMV * pThis, U32_WMV dwRetval, U32_WMV dwBitsToAdd); extern Void_WMV BS_addDataToBuffer( CInputBitStream_WMV * pThis, U8_WMV *pBuffer, U32_WMV dwBuflen, Bool_WMV bNotEndOfFrame ); //peek bits U32_WMV BS_peekBits (CInputBitStream_WMV * pThis, const U32_WMV numBits); U32_WMV BS_peekBitsTillByteAlign(CInputBitStream_WMV * pThis, I32_WMV* pnBitsToPeek); // peek from byte bdry U32_WMV BS_peekBitsFromByteAlign(CInputBitStream_WMV * pThis, I32_WMV numBits); __inline U32_WMV BS_showBitsInline(CInputBitStream_WMV * pThis, register U32_WMV dwNumBits) { /* Assumptions: * - The bit-stream is never read beyond the valid range. * - If the bit-stream is read beyond it's valid range, then garbage, * and not zeros (0), will * be returned, as compared to the original code. * - (0 <= dwNumBits <= 32) */ return( pThis->m_fullWord >> (32 - dwNumBits)); } __inline Void_WMV BS_flushBitsInline(CInputBitStream_WMV * pThis, register U32_WMV dwNumBits) { /* Assumptions: * - The bit-stream is never read beyond the valid range. * - If the bit-stream is read beyond it's valid range, then garbage, * and not zeros (0), will * be returned, as compared to the original code. * - 0 <= dwNumBits <= 32 * - Always maintain BitsLeft > 0 (i.e. not equal to 0)(For VC only) */ I32_WMV BitsLeft, bits_consumed; U32_WMV full_word; full_word = pThis->m_fullWord; BitsLeft = pThis->m_BitsLeft; bits_consumed = 32 - BitsLeft; full_word <<= dwNumBits; full_word |= ( (pThis->m_fillerWord << bits_consumed) >> (32 - dwNumBits) ); BitsLeft -= dwNumBits; if( BitsLeft <= 0 ) { pThis->m_fillerWord = *pThis->m_pBuffer++; BitsLeft += 32; full_word |= ( pThis->m_fillerWord >> BitsLeft ); } pThis->m_fullWord = full_word; pThis->m_BitsLeft = BitsLeft; } /* //============================================================================ // // FILE NAME : IVC1DEC.h // // ALGORITHM : VC1DEC // // VENDOR : TI // // TARGET DSP: C64x // // PURPOSE : IVC1DEC Interface Header // //============================================================================ */ /* ------------------------------------------------------------------------ */ /* This software is protected by certain intellectual property rights of */ /* Microsoft and cannot be used or further distributed without a license */ /* from Microsoft */ /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ /* Copyright (c) 2005 Texas Instruments, Incorporated. */ /* All Rights Reserved. */ /* ======================================================================== */ /* * Copyright (c) 2010, 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 */ /** @ingroup ti_xdais_XDAS_ */ /*@{*/ 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. */ /*@}*/ /* * @(#) ti.xdais; 1, 2.0, 1,12; 5-10-2010 12:31:24; /db/wtree/library/trees/dais/dais.git/src/ */ /* * Copyright (c) 2010, 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. */ /** @ingroup ti_xdais_IALG */ /*@{*/ /*---------------------------*/ /* TYPES AND CONSTANTS */ /*---------------------------*/ /** * @brief Memory attributes. */ typedef enum IALG_MemAttrs { IALG_SCRATCH, /**< Scratch memory. */ IALG_PERSIST, /**< Persistent memory. */ IALG_WRITEONCE /**< Write-once persistent memory. */ } IALG_MemAttrs; /** * @brief Defined memory spaces. */ /* * ======== IALG_MemSpace ======== */ typedef enum IALG_MemSpace { IALG_EPROG = /**< External program memory */ 0x0008 | 0x0010, IALG_IPROG = /**< Internal program memory */ 0x0008, IALG_ESDATA = /**< Off-chip data memory (accessed sequentially) */ 0x0010 + 0, IALG_EXTERNAL = /**< Off-chip data memory (accessed randomly) */ 0x0010 + 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 ======== */ /* * ======== IALG_isOffChip ======== */ /** * @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; /*@}*/ /* * @(#) ti.xdais; 1, 2.0, 1,12; 5-10-2010 12:31:24; /db/wtree/library/trees/dais/dais.git/src/ */ /* * Copyright (c) 2010, 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/ividdec2.h * * @brief This header defines all types, constants, and functions * shared by all implementations of the video decoder * algorithms. */ /** * @defgroup ti_xdais_dm_IVIDDEC2 IVIDDEC2 - XDM Video Decoder Interface * * This is the XDM IVIDDEC2 Video Decoder Interface. */ /* * Copyright (c) 2010, 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. */ /** @ingroup ti_xdais_dm_XDM */ /*@{*/ /** * @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[16]; /** 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[16]; /** 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 */ /** * @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 */ /** * @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 */ /** * @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 */ /** * @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 */ /** * @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 */ /** * @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[16]; /**< Minimum size required * for each input buffer. */ XDM2_BufSize minOutBufSize[16]; /**< Minimum size required * for each output buffer. */ XDAS_Int32 inBufMemoryType[16]; /**< Required memory type * for each input buffer. * * @sa XDM_MemoryType */ XDAS_Int32 outBufMemoryType[16]; /**< 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[16]; /**< Minimum size, in 8-bit * bytes, required for each input buffer. */ XDAS_Int32 minOutBufSize[16]; /**< 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 */ /** * @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 */ /** * @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_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 */ /** Check for unsupported parameter */ /** Check for unsupported input */ /** Check for corrupted header */ /** Check for corrupted data */ /** Check for insufficient data */ /** Check for applied concealment */ /** Set fatal error bit */ /** Set unsupported parameter bit */ /** Set unsupported input bit */ /** Set corrupted header bit */ /** Set corrupted data bit */ /** Set insufficient data bit */ /** Set applied concealment bit */ /** * @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 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. */ /** * @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[32]; /**< 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[32]; /**< Input data * Cbuffers. * * @remarks This is a sparse array. */ XDM1_SingleBufDesc outBufs[32]; /**< Output data * buffers. * * @remarks This is a sparse array. */ XDM1_SingleBufDesc inOutBufs[32]; /**< Input/Output * data buffers. * * @remarks This is a sparse array. */ XDM1_SingleBufDesc intermediateBufs[32]; /**< 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. * * @todo Needs review * * @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); /*@}*/ /* * @(#) ti.xdais.dm; 1, 0, 7,12; 5-10-2010 12:31:25; /db/wtree/library/trees/dais/dais.git/src/ */ /* * Copyright (c) 2010, 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. */ /** @ingroup ti_xdais_dm_IVIDEO */ /*@{*/ /** * @brief Maximum I/O Buffers. * * @sa IVIDDEC2_OutArgs * @sa IVIDDEC3_OutArgs * @sa IVIDENC2_OutArgs */ /** * @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[16]; /**< Pointer to vector * containing buffer addresses. */ XDAS_Int32 bufSizes[16]; /**< 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[16]; /**< Picture buffers. */ } IVIDEO1_BufDescIn; /** * @brief Max YUV buffers - one each for 'Y', 'U', and 'V'. */ /** * @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[3]; /**< 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'. */ /* * @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[3]; /**< Picture buffers. */ XDM2_SingleBufDesc metadataPlaneDesc[3]; /**< Meta planes. * * @remarks For MB Info & alpha blending * * @todo Need further description. */ XDAS_Int32 secondFieldOffsetWidth[3]; /**< 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[3]; /**< 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[3]; /**< 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; /*@}*/ /* * @(#) ti.xdais.dm; 1, 0, 7,12; 5-10-2010 12:31:24; /db/wtree/library/trees/dais/dais.git/src/ */ /** @ingroup ti_xdais_dm_IVIDDEC2 */ /*@{*/ /** * @brief Maximum I/O Buffers. * * @remarks This IVIDDEC2-specific definition has been replaced with * IVIDEO2_MAX_IO_BUFFERS. It has been kept for backward * compatibility, but users are encouraged to use * IVIDEO2_MAX_IO_BUFFERS instead. * * @sa IVIDEO2_MAX_IO_BUFFERS */ /** * @brief This must be the first field of all IVIDDEC2 * instance objects. */ typedef struct IVIDDEC2_Obj { struct IVIDDEC2_Fxns *fxns; } IVIDDEC2_Obj; /** * @brief Opaque handle to an IVIDDEC2 objects. */ typedef struct IVIDDEC2_Obj *IVIDDEC2_Handle; /** * @brief Video decoder output frame order. * * @enumWarning * * @sa IVIDDEC2_DynamicParams::frameOrder */ typedef enum { IVIDDEC2_DISPLAY_ORDER = 0, /**< The decoder provides decoded output in * in the actual order of displaying the * output buffer. The codec assumes the * responsibility of reordering the frames. * * @remarks The output buffer will be * delayed by one frame, * regardless of whether the frame * contains I/P or I/P/B frames. * * @remarks This is the default mode. * * @remarks This mode is required to be * supported by all video decoder * codecs. */ IVIDDEC2_DECODE_ORDER = 1, /**< The decoder provides decoded output in the * the order of decoding. There will be no * delay in the output buffers. * * @remarks It is the application's * responsibility to handle the * frame re-ordering. * * @remarks This mode is optional. If it * is not supported by the * decoder, IVIDDEC_EUNSUPPORTED * will be returned. */ /** Default setting. */ IVIDDEC2_FRAMEORDER_DEFAULT = IVIDDEC2_DISPLAY_ORDER } IVIDDEC2_FrameOrder; /** * @brief Defines the creation time parameters for * all IVIDDEC2 instance objects. * * @extensibleStruct */ typedef struct IVIDDEC2_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 */ } IVIDDEC2_Params; /** * @brief This structure defines the codec 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 IVIDDEC2_Fxns::control() */ typedef struct IVIDDEC2_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. */ XDAS_Int32 frameSkipMode; /**< @copydoc IVIDEO_FrameSkip * * @sa IVIDEO_FrameSkip */ XDAS_Int32 frameOrder; /**< @copydoc IVIDDEC2_FrameOrder * * @sa IVIDDEC2_FrameOrder */ 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. */ XDAS_Int32 mbDataFlag; /**< Flag to indicate that the algorithm should * generate MB Data in addition to decoding * the data. * * @remarks Valid values are XDAS_TRUE * and XDAS_FALSE. * * @sa IVIDDEC2_OutArgs::mbDataBuf */ } IVIDDEC2_DynamicParams; /** * @brief Defines the input arguments for all IVIDDEC2 instance * process function. * * @extensibleStruct * * @sa IVIDDEC2_Fxns::process() */ typedef struct IVIDDEC2_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, * IVIDDEC2_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 * IVIDDEC2_OutArgs::displayBufs. * * @sa IVIDDEC2_OutArgs::outputID. */ } IVIDDEC2_InArgs; /** * @brief Defines instance status parameters. * * @extensibleStruct * * @remarks All fields correspond to latest IVIDDEC2_Fxns::process() call * on the particular instance of the decoder. * * @sa IVIDDEC2_Fxns::control() */ typedef struct IVIDDEC2_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 * IVIDDEC2_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 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 outputChromaFormat; /**< @copydoc XDM_ChromaFormat * * @sa XDM_ChromaFormat */ XDM_AlgBufInfo bufInfo; /**< Input and output buffer information. * * @sa XDM_AlgBufInfo */ } IVIDDEC2_Status; /** * @brief Defines the run time output arguments for * all IVIDDEC2 instance objects. * * @extensibleStruct * * @sa IVIDDEC2_Fxns::process() */ typedef struct IVIDDEC2_OutArgs { XDAS_Int32 size; /**< @sizeField */ XDAS_Int32 bytesConsumed; /**< Number of bytes consumed during the * process() call. */ XDAS_Int32 outputID[20]; /**< Output ID corresponding * to 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 IVIDDEC2_OutArgs#displayBufs * @sa IVIDDEC2_InArgs#inputID */ IVIDEO1_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 @c outBufsInUseFlag, * the frame data in this structure will be * incomplete. However, the algorithm will * provide incomplete decoded frame data * in case application may choose to use * it for error recovery purposes. * * @sa IVIDDEC2_OutArgs#outBufsInUseFlag */ IVIDEO1_BufDesc displayBufs[20]; /**< Array * containing display frames * corresponding to valid ID entries * in the @c outputID[] array. * * @remarks Entries in the array * corresponding to invalid * ID values (zero) in * @c outputID[] will set * zero value for the following * fields in the IVIDEO1_BufDesc * structure: @c numBufs, * @c frameWidth, @c frameHeight, * and @c framePitch. * * @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). */ XDAS_Int32 outputMbDataID; /**< Output ID corresponding with the MB Data * * @remarks This will be set to zero when * there is no MB Data Buffer */ XDM1_SingleBufDesc mbDataBuf; /**< The decoder populates the last buffer * among the buffers supplied within * outBufs->bufs[] with the decoded MB data * generated by the ECD module. The pointer * buffer along with the buffer size is * output via this buffer descriptor. */ XDAS_Int32 freeBufID[20]; /**< 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 * IVIDDEC2_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 * IVIDDEC2_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 IVIDDEC2_InArgs#inputID * @sa IVIDDEC2_OutArgs#displayBufs */ XDAS_Int32 outBufsInUseFlag; /**< Flag to indicate that the @c outBufs * provided with the process() call are in * use. No outBufs are required to be * supplied with the next process() call. * * @remarks Valid values are XDAS_TRUE * and XDAS_FALSE. */ } IVIDDEC2_OutArgs; /** * @brief Defines the control commands for the IVIDDEC2 module. * * @remarks This ID can be extended in IMOD interface for * additional controls. * * @sa XDM_CmdId * * @sa IVIDDEC2_Fxns::control() */ typedef IALG_Cmd IVIDDEC2_Cmd; /** * @brief Defines all of the operations on IVIDDEC2 objects. */ typedef struct IVIDDEC2_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 #IVIDDEC2_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 IVIDDEC2_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 inBufs->numBufs will indicate the total number of input * buffers supplied for input frame, and conditionally, the * encoders MB data buffer. * * @pre If IVIDDEC2_DynamicParams::mbDataFlag was set to #XDAS_FALSE * in a previous control() call, the application only needs to * provide buffers for reconstruction frames. * * @pre If IVIDDEC2_DynamicParams::mbDataFlag was set to #XDAS_TRUE * in a previous control() call, * @c outBufs->bufs[outBufs->numBufs - 1] is a buffer descriptor * into which the algorithm will write MB data for each macro * block. The size of the MB data buffer will vary based on the * decoder type. H.264 may generate N264 bytes per MB, while * Mpeg2 may generate NMP2 bytes. The exact size of the buffers * should be obtained by calling the algorithm's control() method * with XDM_GETBUFINFO. * * @pre @c inArgs must not be NULL, and must point to a valid * IVIDDEC2_InArgs structure. * * @pre @c outArgs must not be NULL, and must point to a valid * IVIDDEC2_OutArgs structure. * * @pre @c inBufs must not be NULL, and must point to a valid * XDM1_BufDesc structure. * * @pre @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 @c outBufs must not be NULL, and must point to a valid * XDM_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 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 IVIDDEC2_EOK @copydoc IVIDDEC2_EOK * @retval IVIDDEC2_EFAIL @copydoc IVIDDEC2_EFAIL * See IVIDDEC2_Status#extendedError * for more detailed further error * conditions. * @retval IVIDDEC2_EUNSUPPORTED @copydoc IVIDDEC2_EUNSUPPORTED */ XDAS_Int32 (*process)(IVIDDEC2_Handle handle, XDM1_BufDesc *inBufs, XDM_BufDesc *outBufs, IVIDDEC2_InArgs *inArgs, IVIDDEC2_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 * IVIDDEC2_DynamicParams structure. * * @pre @c status must not be NULL, and must point to a valid * IVIDDEC2_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 IVIDDEC2_EOK @copydoc IVIDDEC2_EOK * @retval IVIDDEC2_EFAIL @copydoc IVIDDEC2_EFAIL * See IVIDDEC2_Status#extendedError * for more detailed further error * conditions. * @retval IVIDDEC2_EUNSUPPORTED @copydoc IVIDDEC2_EUNSUPPORTED */ XDAS_Int32 (*control)(IVIDDEC2_Handle handle, IVIDDEC2_Cmd id, IVIDDEC2_DynamicParams *params, IVIDDEC2_Status *status); } IVIDDEC2_Fxns; /*@}*/ /* * @(#) ti.xdais.dm; 1, 0, 7,12; 5-10-2010 12:31:24; /db/wtree/library/trees/dais/dais.git/src/ */ /* ******************************************************************************* * * C64x+ SMP M/C Interface definition * * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ * ALL RIGHTS RESERVED ******************************************************************************* */ /** ****************************************************************************** * @file ividmc.h * * @brief Video Codec Multicore Interface Header * * @author * * @version 0.1 - Feb, 3,2010 : Initial Version * ***************************************************************************** */ /** * @defgroup C64x+ Multicore IVIDMC * @ingroup C64P * */ typedef XDAS_Int32 IVIDMC_SPINLOCK; typedef enum { IVIDMC_TASK_MASTER = 0, /* Nonspecific slave task, useful for Symetrical MP */ IVIDMC_TASK_SLAVE = 1, /* Specific task partitioning is possible for Asymetrical MP */ IVIDMC_TASK_SLAVE_1 = 2, IVIDMC_TASK_SLAVE_2 = 3, IVIDMC_TASK_SLAVE_3 = 4, IVIDMC_TASK_SLAVE_4 = 5, IVIDMC_TASK_SLAVE_5 = 6, IVIDMC_TASK_SLAVE_6 = 7, IVIDMC_TASK_SLAVE_7 = 8, IVIDMC_TASK_SLAVE_8 = 9 } IVIDMC_TASK_e; typedef XDAS_Int32 IVIDMC_SWBARR; typedef enum { IVIDMC_SWBARR_FIRST = 0, IVIDMC_SWBARR0 = 0, IVIDMC_SWBARR1 = 1, IVIDMC_SWBARR2 = 2, IVIDMC_SWBARR3 = 3, IVIDMC_SWBARR4 = 4, IVIDMC_SWBARR5 = 5, IVIDMC_SWBARR6 = 6, IVIDMC_SWBARR7 = 7, IVIDMC_SWBARR8 = 8, IVIDMC_SWBARR9 = 9, IVIDMC_SWBARR10 = 10, IVIDMC_SWBARR11 = 11, IVIDMC_SWBARR12 = 12, IVIDMC_SWBARR13 = 13, IVIDMC_SWBARR14 = 14, IVIDMC_SWBARR15 = 15, IVIDMC_SWBARR_LAST = 15, IVIDMC_NUM_BARRIERS = 16 } IVIDMC_SWBARR_e; typedef XDAS_Int32 IVIDMC_SHMEMKEY; typedef XDAS_UInt32 IVIDMC_SHMEM_ATTRS; typedef enum { IVIDMC_SHMEMKEY_FIRST = 0, IVIDMC_SHMEM_KEY_0 = 0, IVIDMC_SHMEM_KEY_1 = 1, IVIDMC_SHMEM_KEY_2 = 2, IVIDMC_SHMEM_KEY_3 = 3, IVIDMC_SHMEM_KEY_4 = 4, IVIDMC_SHMEM_KEY_5 = 5, IVIDMC_SHMEM_KEY_6 = 6, IVIDMC_SHMEM_KEY_7 = 7, IVIDMC_SHMEM_KEY_8 = 8, IVIDMC_SHMEM_KEY_9 = 9, IVIDMC_SHMEM_KEY_10 = 10, IVIDMC_SHMEM_KEY_11 = 11, IVIDMC_SHMEM_KEY_12 = 12, IVIDMC_SHMEM_KEY_13 = 13, IVIDMC_SHMEM_KEY_14 = 14, IVIDMC_SHMEM_KEY_15 = 15, IVIDMC_SHMEMKEY_LAST = 15, IVIDMC_SHMEM_NUM_KEYS = 16 } IVIDMC_SHMEM_KEY_e; /* Indication that this is unused core. DNUM can not be equal to this value */ /* Indication to writeback invalidate entire cache */ /*Maximum number of cores*/ /* Following data structure is included in static params, provided by the framework in Video Codec creation phase */ typedef struct { /* Function pointers, to be set by the framework */ /* Software barrier - codec generates call-out and sends number (swbarr_cnt) of cores from the team (> 1]; /* Array for storing current and previous left-predictors (DC/AC) and * top-left DC predictors. * 8 * 6 left AC/DC predictors. * 2 * 6 top-left DC predictors. * 8 instead of 6 (TL DC) is used for allignment. */ short AC_pred_topl_left_pred[ ((((2 *(8 * 6) + 8 + 6 + 3) << 1) + 7) & ~7) >> 1]; /* ======================================================================= */ /* These arrays store the prediceted MV values in packed format. * MSB16 = Y mv, LSB16 = X mv. * * Here 4MV space is allocated per MB for Luma MV array. However if the * frame contains only 1MV Mb's then, only 1MV per MB is stored. * i.e. MV's for consecutive Macro-blocks are stored in consecutive words, * thus consuming only 1/4 of the total allocated memory. * In the 4MV case, 4 MV's are stored (consecutively) for each MB,irrespective * of it being 1MV or 4MV macro-block. This scheme is unlike Microsoft scheme * where MV's are stored in rows of blocks and all 4MV's for a MB are not * consecutive. * Here TI_FRAME_WIDTH_Y and TI_FRAME_HEIGHT_Y are controlled by the macro * _HDTV. */ //unsigned int luma_4MV_array1 // [(((TI_FRAME_WIDTH_Y * TI_FRAME_HEIGHT_Y >> 6) + 1) & ~1)]; /* * The memory required for the chrominance motion vectors depends on the * profile of the codec. For the MAIN and SIMPLE profiles, the chrmoinance * blocks can at the most have one MV pair for the chrominance blocks. * For the ADVANCED PROFILE, in cas the interlaced content is present, the * maximum number of MV pairs for a chrominance block can go upto 4. */ /* #if defined(ADVANCED_PROFILE) && defined(AP_INTERLACE) unsigned int chromaMV_dec_info_XY1 [(((TI_FRAME_WIDTH_Y * TI_FRAME_HEIGHT_Y >> 6) + 1) & ~1)]; unsigned int chromaMV_dec_info_XY1 [(((TI_FRAME_WIDTH_Y * TI_FRAME_HEIGHT_Y >> 8) + 1) & ~1)]; /* The following array frm_mb_xform_arr is not a predictor array, but is very * close in usage. So kept here. Each entry in it will be a byte, with least * 4 bitsproviding the Xform type info, and upper 4 bits will indicate the sub * block pattern in raster scan order of the blocks, with first block is * positioned at MSB of the byte. * */ /* These definitions have to be moved to another place. XXX FIXME */ //#define TI_MAX_NUM_MBS_Y ((TI_FRAME_WIDTH_Y * TI_FRAME_HEIGHT_Y) >> 8) //unsigned char frm_mb_xform_arr[(((TI_MAX_NUM_MBS_Y * 6) + 7) & ~7)]; //unsigned int *luma_4MV_array; //unsigned int *chromaMV_dec_info_XY; } predArrayStruct; /* This structure has internal and external (misc. common stuffs -> ext) scratch buffer addresses. */ typedef struct wmvBufAddrStruct { /* Start of the scratch buffer. */ unsigned char *pOnChipScratch; /* Size available in the scratch buffer starting from pOnchipScratch. * Restrict its write status as much as possible for safety reasons. */ unsigned int onChipScratchSize; unsigned char *pOffChipScratch; unsigned int offChipScratchSize; unsigned char *pOffChipScratch_MC; unsigned int offChipScratchSize_MC; unsigned char *pOffChipScratch_DBLK; unsigned int offChipScratchSize_DBLK; /* This buffer is used for dct coeffs etc during MB decode */ unsigned short *pDct8x8Buffer; /* This buffer is used for dct coeffs etc during MB decode. Used when xform * switch cases are present. */ short *pDctXswitchBuffer; /* Double buffered areas where decoded dct values for n MBs are stored during * the predicted frames' decoding */ unsigned char *pErrorNMB[2]; unsigned char *pErrorNMB_MC[2]; /* Overlap transform and loop filter operations can share same memory. * pOvtLastTwoRows points to the memory area where the last two rows of the * current macroblock row is stored for later processing. They are stored as * short because of the unclamped data. 0, 1 and 2 points to Y, U and V resp.*/ short *pOvtLastTwoRows[3]; /* This array is for storing the last block of the current chunck and the * edge array, * (short, vertical + horizontal). */ short *pOvtLastBlkAndEdgeArray; /* [ ( (MB_SIZE + 2) + 2*(BLOCK_SIZE + 2)) * BLOCK_SIZE + ((2 * TI_ONCHIP_MEM_4_RECON + TI_MAX_OCREC_MBS * 384) / 896) * (6 + 6) ]; */ //unsigned char *pOnChipVLDScratch; unsigned char *pOnChipVLDScratch_MC; /* Size available in the scratch buffer starting from pOnchipVLDScratch. * Restrict its write status as much as possible for safety reasons. */ //unsigned int onChipVLDScratchSize; unsigned int onChipVLDScratchSize_MC; /* This buffer is used for dct coeffs etc during VLD decode */ unsigned short *pVldD8x8Buffer[2]; short *dct_8x8_temp_buf1, *dct_8x8_temp_buf2; unsigned short *pVldD8x8Buffer_MC[2]; /* This buffer is used for dct coeffs etc during MB decode. Used when xform * switch cases are present. */ unsigned short *pVldDctNonIQBuffer[1]; /* This buffer is used for non IQ dct coeffs etc during VLD decode. */ unsigned short *pVldDctNonIQScratchBuf; } wmvBufAddrStruct; /* //============================================================================ // VC1DEC_TI_Obj */ typedef struct VC1DEC_TI_Obj { IALG_Obj alg; /* MUST be first field of all WMV9DEC objs */ XDAS_UInt32 maxWidth; /* maximum width of the frame */ XDAS_UInt32 maxHeight; /* maximum height of the frame */ XDAS_UInt32 Dummy; /* 4 Byte padding to keep pWMVDec //aligned to double-word boundary */ void *memTabBases[ 27]; /* TODO: add custom fields here */ tWMVDecInternalMember *pWMVDec; //tWMVDecInternalMember pWMVDec; tWMVDecInternalMember *pWMVDecExtMem; Err_info *ErrorStructExtMem; onChipTablesStruct *TablesExtMem; wmvBufAddrStruct *AddressStructExtMem; } VC1DEC_TI_Obj; /*deblocking related*/ extern tWMVDecodeStatus VC1VDEC_TI_VideoDecInit ( tWMVDecInternalMember * pWMVDec, U32_WMV uiFOURCCCompressed, Float_WMV fltFrameRate, Float_WMV fltBitRate, I32_WMV iWidthSource, I32_WMV iHeightSource, I32_WMV iPostFilterLevel, U8_WMV *pSequenceHeader, U32_WMV uipSequenceHeaderLength); extern tWMVDecodeStatus VC1VDEC_TI_VideoDecDecodeData( tWMVDecInternalMember * pWMVDec, U8_WMV * pBitStream, U32_WMV streamSize, char * disp_buf_num, void * frm_id); extern tWMVDecodeStatus VC1VDEC_TI_VideoDecDecodeSeqHeader (tWMVDecInternalMember *pWMVDec, U8_WMV *bitStream, U32_WMV streamSize, U32_WMV *uiBytesRead); unsigned int CORE2 (IVIDDEC2_Handle handle); unsigned int CORE3 (IVIDDEC2_Handle handle); unsigned int CORE2n3 (IVIDDEC2_Handle handle); extern tWMVDecodeStatus VC1VDEC_TI_GetMaxFrameSize(unsigned char *pBuffer, unsigned int * piWidth, unsigned int * piHeight); extern void VC1VDEC_TI_flushLastFrame(tWMVDecInternalMember *pWMVDec); //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** // =========================================================================== // private functions // =========================================================================== // inits tWMVDecodeStatus WMVInternalMemberInit ( tWMVDecInternalMember *pWMVDec, U32_WMV uiFOURCCCompressed, Float_WMV fltFrameRate, Float_WMV fltBitRate, I32_WMV iWidthSource, I32_WMV iHeightSource, I32_WMV iPostFilterLevel, tWMVDecodeDispRotateDegree iDispRotateDegree ); extern void VC1DEC_CACHE_wbInvAllL2(CACHE_Wait wait); // destroys tWMVDecodeStatus WMVInternalMemberDestroy (tWMVDecInternalMember *pWMVDec); // Sequence level decoding tWMVDecodeStatus setSliceCode (tWMVDecInternalMember *pWMVDec, I32_WMV iSliceCode); tWMVDecodeStatus decodeVOLHead (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus decodeVOLHead_WMVAdvanced(tWMVDecInternalMember *psWMVDec); tWMVDecodeStatus decodeEntryPointHead(tWMVDecInternalMember *psWmvDec); // frame level decoding Void_WMV WMVideoDecSwapCurrAndRef (tWMVDecInternalMember *pWMVDec, Bool_WMV bSwapPostBuffers); tWMVDecodeStatus WMVideoDecDecodeFrameHead (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeFrameHead_Advanced( tWMVDecInternalMember *psWMVDec,U32_WMV sliceFlag); tWMVDecodeStatus WMVideoDecDecodeIFrameHead(tWMVDecInternalMember *psWMVDec, U32_WMV sliceFlag); tWMVDecodeStatus WMVideoDecDecodePFrameHead(tWMVDecInternalMember *psWMVDec, U32_WMV sliceFlag); tWMVDecodeStatus WMVideoDecDecodeBFrameHead(tWMVDecInternalMember *psWMVDec, U32_WMV sliceFlag); tWMVDecodeStatus WMVideoDecDecodeClipInfo (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeI_X8 (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeI (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP (tWMVDecInternalMember *pWMVDec); // Slice Header decoding tWMVDecodeStatus WMVDEC_decodeSliceHeader(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus g_InitDstTables_WMV (tWMVDecInternalMember *pWMVDec); // defined (OUTPUT_RGB16) || defined (OUTPUT_RGB24) || defined (OUTPUT_RGB32) Void_WMV WMVideoDecUpdateDstPartialMBGRAY4 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBGRAY4 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkGRAY4 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV g_InitDstDitherMap_WMV (); Void_WMV WMVideoDecUpdateDstPartialMBRGB8 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBRGB8 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkRGB8 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBRGB12 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); extern Void_WMV WMVideoDecUpdateDstMBRGB12 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); extern Void_WMV WMVideoDecUpdateDstBlkRGB12 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBRGB16 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstPartialMBRGB15 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBRGB15 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkRGB15 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); extern Void_WMV WMVideoDecUpdateDstMBRGB16 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); extern Void_WMV WMVideoDecUpdateDstBlkRGB16 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBRGB24 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDst411MBRGB24 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDst411PartialMBRGB24 ( tWMVDecInternalMember *pWMVDec, U8_WMV *pBits, const U8_WMV *pucCurrYMB, const U8_WMV *pucCurrUMB, const U8_WMV *pucCurrVMB, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBRGB24 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkRGB24 ( tWMVDecInternalMember *pWMVDec, U8_WMV *pBits, const U8_WMV *pucCurrYMB, const U8_WMV *pucCurrUMB, const U8_WMV *pucCurrVMB, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBRGB32 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBRGB32 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkRGB32 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); // packed YUV formats Void_WMV WMVideoDecUpdateDst411PartialMBYUY2 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDst411MBYUY2 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrYMB, const U8_WMV* pucCurrUMB, const U8_WMV* pucCurrVMB, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBYUY2 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBYUY2 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrYMB, const U8_WMV* pucCurrUMB, const U8_WMV* pucCurrVMB, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkYUY2 ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrYMB, const U8_WMV* pucCurrUMB, const U8_WMV* pucCurrVMB, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBUYVY ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBUYVY ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrYMB, const U8_WMV* pucCurrUMB, const U8_WMV* pucCurrVMB, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkUYVY ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrYMB, const U8_WMV* pucCurrUMB, const U8_WMV* pucCurrVMB, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBYVYU ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iRgbWidth, I32_WMV iRgbHeight ); Void_WMV WMVideoDecUpdateDstMBYVYU ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstBlkYVYU ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBits, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidth ); Void_WMV WMVideoDecUpdateDstPartialMBIYUV ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBitsY, U8_WMV* pBitsU, U8_WMV* pBitsV, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidthY, I32_WMV iBitmapWidthUV, I32_WMV iValidWidthY, I32_WMV iValidHeightY ); Void_WMV WMVideoDecUpdateDstMBIYUV ( tWMVDecInternalMember *pWMVDec, U8_WMV* pBitsY, U8_WMV* pBitsU, U8_WMV* pBitsV, const U8_WMV* pucCurrY, const U8_WMV* pucCurrU, const U8_WMV* pucCurrV, I32_WMV iWidthY, I32_WMV iWidthUV, I32_WMV iBitmapWidthY, I32_WMV iBitmapWidthUV ); //Init routines tWMVDecodeStatus VodecConstruct ( tWMVDecInternalMember *pWMVDec, U32_WMV dwFOURCC, I32_WMV iFrameRate, I32_WMV iWidthSource, I32_WMV iHeightSource, CInputBitStream_WMV *pInputBitstream//, ); tWMVDecodeStatus VodecDestruct (tWMVDecInternalMember *pWMVDec); Void_WMV m_InitFncPtrAndZigzag(tWMVDecInternalMember *pWMVDec); Void_WMV setRefreshPeriod(tWMVDecInternalMember *pWMVDec); Void_WMV decideMMXRoutines (tWMVDecInternalMember *pWMVDec); I32_WMV assignVODataMembers (tWMVDecInternalMember *pWMVDec); U8_WMV * g_InitDecGlobalVars (); tWMVDecodeStatus InitDataMembers ( tWMVDecInternalMember *pWMVDec, I32_WMV iWidthSource, I32_WMV iHeightSource ); Void_WMV DecodeSkipBit(tWMVDecInternalMember *pWMVDec); Void_WMV decodeVOPHead_WMV2 (tWMVDecInternalMember *pWMVDec); Void_WMV UpdateDCStepSize(tWMVDecInternalMember *pWMVDec, I32_WMV iStepSize); // Loopfilter extern Void_WMV g_FilterHorizontalEdge_WMV(U8_WMV* pV, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iNumPixel); extern Void_WMV g_FilterVerticalEdge_WMV(U8_WMV* pV, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iNumPixel); Void_WMV DeblockSLFrame (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxliY, U8_WMV* ppxliU, U8_WMV* ppxliV, Bool_WMV bMultiThread, U32_WMV iThreadID, I32_WMV iMBStartX, I32_WMV iMBEndX, I32_WMV iMBStartY, I32_WMV iMBEndY) ; //Deblocking Void_WMV DeblockFrame (tWMVDecInternalMember *pWMVDec, U32_WMV iMBStartY, U32_WMV iMBEndY); Void_WMV DeblockInterlaceFrame (tWMVDecInternalMember *pWMVDec, U32_WMV iMBStartY, U32_WMV iMBEndY); Void_WMV DecidePostFilterMode (tWMVDecInternalMember *pWMVDec); Void_WMV FilterEdgeShortTagBlockRow (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxlcCenter, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iMBsPerRow, Bool_WMV bFirst, Bool_WMV bLast); Void_WMV FilterEdgeShortTagMBRow (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxlcCenter, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iMBsPerRow, Bool_WMV bFirst, Bool_WMV bLast); Void_WMV FilterEdgeShortTagBlockRow_X4 (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxlcCenter, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iMBsPerRow, Bool_WMV bFirst, Bool_WMV bLast, I8_WMV* pchXformType); Void_WMV FilterEdgeShortTagMBRow_X4 (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxlcCenter, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iMBsPerRow, Bool_WMV bFirst, Bool_WMV bLast, I8_WMV* pchXformType); extern const I32_WMV i_DQScale[]; inline I32_WMV divroundnearest(I32_WMV i, I32_WMV iDenom) { return ((i * i_DQScale[iDenom] + 0x20000) >> 18); } // Block based routines tWMVDecodeStatus DecodeIMBAcPred ( tWMVDecInternalMember *pWMVDec, unsigned int cbp, unsigned int ac_pred_on, U8_WMV* ppxliTextureQMBY, U8_WMV* ppxliTextureQMBU, U8_WMV* ppxliTextureQMBV, I16_WMV* piQuanCoefACPred, I16_WMV** piQuanCoefACPredTable, unsigned int b_flags, int dst_pitch, CDCTTableInfo_Dec* pInterDCTTableInfo_Dec, CDCTTableInfo_Dec* pIntraDCTTableInfo_Dec ); // Decode Coefs tWMVDecodeStatus DecodeInverseInterBlockQuantizeEscCode (tWMVDecInternalMember *pWMVDec, CDCTTableInfo_Dec** ppInterDCTTableInfo_Dec, U8_WMV* pZigzag, I32_WMV iXformMode, DQuantDecParam *pDQ ); tWMVDecodeStatus DecodeInverseInterBlockQuantizeEscCode_MMX ( tWMVDecInternalMember *pWMVDec, CDCTTableInfo_Dec** ppInterDCTTableInfo_Dec, U8_WMV* pZigzag, I32_WMV iXformMode, DQuantDecParam *pDQ ); tWMVDecodeStatus DecodeInverseIntraBlockQuantizeAcPred_MMIDRATE ( tWMVDecInternalMember *pWMVDec, CDCTTableInfo_Dec** ppIntraDCTTableInfo_Dec, Bool_WMV CBP, I16_WMV* pDct, U8_WMV* piZigzagInv); tWMVDecodeStatus DecodeInverseIntraBlockQuantizeAcPred (tWMVDecInternalMember *pWMVDec, CDCTTableInfo_Dec** ppIntraDCTTableInfo_Dec, Bool_WMV CBP, I16_WMV* pDct, U8_WMV* piZigzagInv ); I32_WMV BlkAvgX8(const U8_WMV* ppxlcCurrRecnMB, I32_WMV iWidthPrev, I32_WMV iStepSize); I32_WMV BlkAvgX8_MMX(const U8_WMV* ppxlcCurrRecnMB, I32_WMV iWidthPrev, I32_WMV iStepSize); void VC1VDEC_TI_Huff_WMV_construct(Huffman_WMV * pThis); Void_WMV Huffman_WMV_destruct(Huffman_WMV * pThis); I32_WMV VC1VDEC_TI_Huff_WMV_get(Huffman_WMV * pThis, CInputBitStream_WMV *bs); Void_WMV BS_construct (CInputBitStream_WMV * pThis); Void_WMV BS_reset( CInputBitStream_WMV * pThis, U8_WMV *pBuffer, U32_WMV dwBuflen ); Void_WMV g_EndDstTables_WMV(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus Plane_init (tYUV420Frame_WMV * pFramePlane, I32_WMV iSizeYplane, wmvBuffer *buffer); //interlace I32_WMV PredictFieldTopMV (tWMVDecInternalMember *pWMVDec, I32_WMV *iPredX, I32_WMV *iPredY, I16_WMV* pFieldMvX, I16_WMV* pFieldMvY, Bool_WMV bTopBndry); I32_WMV PredictFieldBotMV (tWMVDecInternalMember *pWMVDec, I32_WMV *iPredX, I32_WMV *iPredY, I16_WMV* pFieldMvX, I16_WMV* pFieldMvY, Bool_WMV bTopBndry); I32_WMV PredictFieldOneMV (tWMVDecInternalMember *pWMVDec, I32_WMV *iPredX, I32_WMV *iPredY, I16_WMV* pFieldMvX, I16_WMV* pFieldMvY, Bool_WMV bTopBndry); Void_WMV InitFieldInterpolation (tWMVDecInternalMember *pWMVDec); Void_WMV RL_ResetLibrary(CReferenceLibrary *); tWMVDecodeStatus RL_SetupReferenceLibrary (CReferenceLibrary *,I32_WMV size_y, I32_WMV size_uv, I32_WMV); Void_WMV RL_CloseReferenceLibrary(CReferenceLibrary *); Void_WMV SetStartOfLibrary(CReferenceLibrary *,I32_WMV iStart); Void_WMV RL_RemoveFrame (CReferenceLibrary *,Void_WMV**, I32_WMV); Void_WMV RL_AddFrame (CReferenceLibrary *,Void_WMV *); I32_WMV RL_GetNextFrame (CReferenceLibrary *,Void_WMV **); Void_WMV InitMultires(tWMVDecInternalMember * pWMVDec); Void_WMV ChangeMultiresFilter(tWMVDecInternalMember *pWMVDec, I32_WMV iFilterIndex); Void_WMV SetupMultiResParams(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus ResetParams_TI(tWMVDecInternalMember *pWMVDec, I32_WMV iResIndex); Void_WMV UpsampleRefFrame(tWMVDecInternalMember *pWMVDec, U8_WMV* pSrcY, U8_WMV* pSrcU, U8_WMV* pSrcV, U8_WMV* pDstY, U8_WMV* pDstU, U8_WMV* pDstV); Void_WMV DownsampleRefFrame(tWMVDecInternalMember *pWMVDec, U8_WMV* pSrcY, U8_WMV* pSrcU, U8_WMV* pSrcV, U8_WMV* pDstY, U8_WMV* pDstU, U8_WMV* pDstV); Void_WMV ResetDecoderParams (); Void_WMV InitDeinterlace(tWMVDecInternalMember * pWMVDec); tWMVDecodeStatus DecodeSkipBitX9 (tWMVDecInternalMember * pWMVDec, I32_WMV iMode); tWMVDecodeStatus decodeVOPHead_WMV3(tWMVDecInternalMember * pWMVDec); tWMVDecodeStatus initMultiThreadVars_Dec (tWMVDecInternalMember * pWMVDec); Void_WMV InitBlockInterpolation (tWMVDecInternalMember * pWMVDec); tWMVDecodeStatus VideoDIDeinterlace(tWMVDecInternalMember * pWMVDec, U8_WMV* pucInput, U8_WMV* pucOutput, I32_WMV iFirstLine, I32_WMV iLastLine, I32_WMV iWidth, I32_WMV iHeight); tWMVDecodeStatus WMVideoDecDecodeP_X9 (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodePFieldInterlace (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_fieldinterlace (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeFieldInterlace_B (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus decodeVOLHead_WMV3(tWMVDecInternalMember * pWMVDec); tWMVDecodeStatus decodeSpriteVOLHead(tWMVDecInternalMember * pWMVDec); Void_WMV ReInitContext(t_CContextWMV *pContext, I32_WMV iCol, I32_WMV iRow); I32_WMV PredictHybridMV (tWMVDecInternalMember *pWMVDec, I32_WMV iX, I32_WMV iY, Bool_WMV b1MV, I32_WMV *iPredX, I32_WMV *iPredY); I32_WMV PredictMV (tWMVDecInternalMember *pWMVDec, I32_WMV iBlockX, I32_WMV iBlockY, I32_WMV iMVMode, I32_WMV iNumBlockX, I32_WMV iNumBlockY, const I16_WMV *pMVX, const I16_WMV *pMVY, I32_WMV *iXMotion, I32_WMV *iYMotion, Bool_WMV bTopBndry); Void_WMV MotionComp_X9 (tWMVDecInternalMember *pWMVDec, U8_WMV *pDst, union Buffer *pError, I32_WMV iBlockX, I32_WMV iBlockY, U8_WMV *pSrc); Void_WMV MotionCompMB_WMV3 (tWMVDecInternalMember *pWMVDec, U8_WMV *pDstY, U8_WMV *pDstU, U8_WMV *pDstV, I32_WMV iBlockX, I32_WMV iBlockY); Void_WMV MotionCompChroma_X9 (tWMVDecInternalMember *pWMVDec, U8_WMV *pDst, union Buffer *pError, I32_WMV iMBindex, U8_WMV *pSrc); Void_WMV InterpolateMB (tWMVDecInternalMember *pWMVDec, const U8_WMV *pSrc, I32_WMV iSrcStride, U8_WMV *pDst, I32_WMV iDstStride, I32_WMV iDX, I32_WMV iDY, I32_WMV iFilterType); Void_WMV DecodeVOPDQuant (tWMVDecInternalMember *pWMVDec); I32_WMV decodeDQuantStepsize(tWMVDecInternalMember *pWMVDec, I32_WMV iShift); Void_WMV CopyCurrToPost (tWMVDecInternalMember *pWMVDec); Void_WMV DeblockIFrame (tWMVDecInternalMember *pWMVDec, U8_WMV * ppxliY, U8_WMV * ppxliU, U8_WMV * ppxliV, U32_WMV iMBStartY, U32_WMV iMBEndY ); Void_WMV DeblockIFrameCurrToPost (tWMVDecInternalMember *pWMVDec, U8_WMV * ppxliSrcY, U8_WMV * ppxliSrcU, U8_WMV * ppxliSrcV, U8_WMV * ppxliDstY, U8_WMV * ppxliDstU, U8_WMV * ppxliDstV, U32_WMV iMBStartY, U32_WMV iMBEndY ); Void_WMV DeblockPFrame (tWMVDecInternalMember *pWMVDec, U8_WMV * ppxliY, U8_WMV * ppxliU, U8_WMV * ppxliV, U32_WMV iMBStartY, U32_WMV iMBEndY ); Void_WMV RenderIFrame (tWMVDecInternalMember *pWMVDec, U8_WMV * ppxliRecnQY, U8_WMV * ppxliRecnQU, U8_WMV * ppxliRecnQV ); Void_WMV RenderPFrame (tWMVDecInternalMember *pWMVDec, U8_WMV * ppxliRecnQY, U8_WMV * ppxliRecnQU, U8_WMV * ppxliRecnQV ); // for multi-threading, have to be public Void_WMV decode0 (tWMVDecInternalMember *pWMVDec); Void_WMV decode1 (tWMVDecInternalMember *pWMVDec); Void_WMV loopfilter0 (tWMVDecInternalMember *pWMVDec); Void_WMV loopfilter1 (tWMVDecInternalMember *pWMVDec); Void_WMV Deblock0 (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxliPostQY, U8_WMV* ppxliPostQU, U8_WMV* ppxliPostQV); Void_WMV Deblock1 (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxliPostQY, U8_WMV* ppxliPostQU, U8_WMV* ppxliPostQV); Void_WMV Deinterlaceprocess0 (tWMVDecInternalMember *pWMVDec); Void_WMV Deinterlaceprocess1 (tWMVDecInternalMember *pWMVDec); Void_WMV Deinterlaceprocess2 (tWMVDecInternalMember *pWMVDec); Void_WMV Deinterlaceprocess3 (tWMVDecInternalMember *pWMVDec); // member functions for X9 I32_WMV PredictHybridMV (tWMVDecInternalMember *pWMVDec, I32_WMV iX, I32_WMV iY, Bool_WMV b1MV, I32_WMV *iPredX, I32_WMV *iPredY); I32_WMV ChromaMV (tWMVDecInternalMember *pWMVDec, I32_WMV iX, I32_WMV iY, Bool_WMV b1MV); Void_WMV InitBlockInterpolation (tWMVDecInternalMember *pWMVDec); Void_WMV InterpolateYMB_X9 (tWMVDecInternalMember *pWMVDec, U8_WMV *pSrc, I32_WMV iSrcStride, U8_WMV *pDst, I32_WMV iDstStride, I32_WMV iX, I32_WMV iY, I32_WMV iFilterType, I32_WMV iRndCtrl); Void_WMV InterpolateBlock (tWMVDecInternalMember *pWMVDec, const U8_WMV *pSrc, I32_WMV iSrcStride, U8_WMV *pDst, I32_WMV iDstStride, I32_WMV iDX, I32_WMV iDY, I32_WMV iFilterType); Void_WMV g_IDCTDec_WMV2_Inter (union Buffer* piDst, union Buffer* piSrc, I32_WMV iOffsetToNextRowForDCT, I32_WMV iDCTHorzFlags); Void_WMV ComputeLoopFilterFlags(); Void_WMV LoopFilterMultiThreads_V9 (); // // Intra 411 // I32_WMV decodeIInterlace411 (tWMVDecInternalMember *pWMVDec); Void_WMV inverseIntraBlockQuantizeInterlace411(tWMVDecInternalMember *pWMVDec, I16_WMV *piCoefRecon, I32_WMV iNumCoef, DQuantDecParam *pDQ); I32_WMV DecodeInverseIntraBlockQuantizeInterlace411 (tWMVDecInternalMember *pWMVDec, CDCTTableInfo_Dec** ppIntraDCTTableInfo_Dec, U8_WMV* piZigzagInv, U32_WMV uiNumCoef); I32_WMV decodeIntraDCInterlace411 (tWMVDecInternalMember *pWMVDec, I16_WMV *piDC, Huffman_WMV * hufDCTDCDec, I32_WMV iTCOEF_ESCAPE, I32_WMV iDCStepSize); Void_WMV RenderFrame_AllMB_Packed_X1_Aligned_Interlace411 ( U8_WMV * ppxliPostY, U8_WMV * ppxliPostU, U8_WMV * ppxliPostV, U8_WMV * pBmpPtr, U32_WMV iMBStartY, U32_WMV iMBEndY ); Void_WMV StoreDCACPredCoefYInterlace411 (tWMVDecInternalMember *pWMVDec, I32_WMV imbY, I32_WMV imbX, I32_WMV iBlk, I16_WMV *piLevelBlk); Void_WMV StoreDCACPredCoefUVInterlace411 (tWMVDecInternalMember *pWMVDec, I32_WMV imbY, I32_WMV imbX, I32_WMV iBlk, I32_WMV iSubblock, I16_WMV *piLevelBlk); // // Inter 411 // I32_WMV decodePInterlace411 (tWMVDecInternalMember *pWMVDec); I32_WMV ComputeFrameMVFromDiffMVInterlace411 (tWMVDecInternalMember *pWMVDec, I32_WMV imbX, I32_WMV imbY, CDiffMV *pInDiffMV); I32_WMV ComputeTopFieldMVFromDiffMVInterlace411 (tWMVDecInternalMember *pWMVDec, I32_WMV imbX, I32_WMV imbY, CDiffMV *pInDiffMV); I32_WMV ComputeBotFieldMVFromDiffMVInterlace411 (tWMVDecInternalMember *pWMVDec,I32_WMV imbX, I32_WMV imbY, CDiffMV *pInDiffMV); Void_WMV ComputeLoopFilterFlags(tWMVDecInternalMember *pWMVDec); Void_WMV DeblockSLFrame_V9 (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxliCurrY, U8_WMV* ppxliCurrU, U8_WMV* ppxliCurrV, U8_WMV* puchFilter8x8RowFlagY, U8_WMV* puchFilter8x8RowFlagU, U8_WMV* puchFilter8x8RowFlagV,U8_WMV* puchFilter8x4RowFlagY, U8_WMV* puchFilter8x4RowFlagU, U8_WMV* puchFilter8x4RowFlagV, U8_WMV* puchFilter8x8ColFlagY, U8_WMV* puchFilter8x8ColFlagU, U8_WMV* puchFilter8x8ColFlagV, U8_WMV* puchFilter4x8ColFlagY, U8_WMV* puchFilter4x8ColFlagU, U8_WMV* puchFilter4x8ColFlagV, LOOPF_FLAG* pLoopFilterFlag, U32_WMV uiMBStart, U32_WMV uiMBEnd); I16_WMV* GetFieldBlockPtr (I16_WMV *ppxliFieldMB, I32_WMV ib); Void_WMV DeblockRows (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxliY, U8_WMV* ppxliU, U8_WMV* ppxliV, I32_WMV iNumRows, U8_WMV* puchFilterFlagY, U8_WMV* puchFilterFlagU, U8_WMV* puchFilterFlagV); Void_WMV DeblockColumns (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxliY, U8_WMV* ppxliU, U8_WMV* ppxliV, I32_WMV iNumCols, I32_WMV iHeight, U8_WMV* puchFilterFlagY, U8_WMV* puchFilterFlagU, U8_WMV* puchFilterFlagV); Void_WMV FilterRow (tWMVDecInternalMember *pWMVDec, U8_WMV* pRow, U8_WMV uchBitField, I32_WMV iPitch, I32_WMV iStepSize); Void_WMV FilterColumn (tWMVDecInternalMember *pWMVDec, U8_WMV* pCol, U8_WMV uchBitField, I32_WMV iPitch, I32_WMV iStepSize); Void_WMV ComputeMBLoopFilterFlags (tWMVDecInternalMember *pWMVDec, I32_WMV iMBX, I32_WMV iMBY, I8_WMV chMBMode, I8_WMV* pBlockXformMode, I8_WMV* pBlockXformModeTop, I8_WMV* pBlockXformModeLeft, U8_WMV *pCBPCurr, U8_WMV *pCBPTop, U8_WMV *pCBPLeft, Bool_WMV bTop, Bool_WMV bLeft); Void_WMV GenerateColumnLoopFilterFlags (tWMVDecInternalMember *pWMVDec, U8_WMV* puchFilterColFlagY, U8_WMV* puchFilterColFlagU, U8_WMV* puchFilterColFlagV, U8_WMV* puchFilterColFlagY2, U8_WMV* puchFilterColFlagU2, U8_WMV* puchFilterColFlagV2, LOOPF_FLAG* pLoopFilterFlag, I32_WMV iMBHeight); Void_WMV GenerateRowLoopFilterFlags (tWMVDecInternalMember *pWMVDec, U8_WMV* puchFilterRowFlagY, U8_WMV* puchFilterRowFlagU, U8_WMV* puchFilterRowFlagV, U8_WMV* puchFilterRowFlagY2, U8_WMV* puchFilterRowFlagU2, U8_WMV* puchFilterRowFlagV2, LOOPF_FLAG* pLoopFilterFlag, I32_WMV iMBYStart, I32_WMV iMBYEnd, Bool_WMV bFirstRow); Void_WMV ClearFieldMBInterlace411 (I16_WMV *ppxliFieldMB, I32_WMV iField); Void_WMV CopyTopFieldToIntraFieldMBInterlace411 ( I16_WMV *ppxliFieldMB, U8_WMV *ppxliFrameMBY, U8_WMV *ppxliFrameMBU, U8_WMV *ppxliFrameMBV); Void_WMV CopyBotFieldToIntraFieldMBInterlace411 ( I16_WMV *ppxliFieldMB, U8_WMV *ppxliFrameMBY, U8_WMV *ppxliFrameMBU, U8_WMV *ppxliFrameMBV); Void_WMV CopyIntraFieldMBtoTopFieldInterlace411 ( I16_WMV *ppxliFieldMB, U8_WMV *ppxliFrameMBY, U8_WMV *ppxliFrameMBU, U8_WMV *ppxliFrameMBV, I32_WMV iOffsetY, I32_WMV iOffsetUV); Void_WMV CopyIntraFieldMBtoBotFieldInterlace411 ( I16_WMV *ppxliFieldMB, U8_WMV *ppxliFrameMBY, U8_WMV *ppxliFrameMBU, U8_WMV *ppxliFrameMBV, I32_WMV iOffsetY, I32_WMV iOffsetUV); // older ones.... Void_WMV CopyFrameMBtoIntraFieldMBInterlace411 ( I16_WMV *ppxliFieldMB, U8_WMV *ppxliFrameMBY, U8_WMV *ppxliFrameMBU, U8_WMV *ppxliFrameMBV); Void_WMV CopyIntraFieldMBtoFrameMBInterlace411 ( I16_WMV *ppxliFieldMB, U8_WMV *ppxliFrameMBY, U8_WMV *ppxliFrameMBU, U8_WMV *ppxliFrameMBV, I32_WMV iOffsetToNextRowY, I32_WMV iOffsetToNextRowUV, Bool_WMV bSeparateField); Void_WMV CopyFrameMBtoInterFieldMBInterlace411 (I16_WMV *ppxliFieldMB, I16_WMV *ppxliFrameMBY, I16_WMV *ppxliFrameMBU, I16_WMV *ppxliFrameMBV); Void_WMV CopyTopFieldMBtoInterFieldMBInterlace411 ( I16_WMV *ppxliFieldMB, I16_WMV *ppxliFrameMBY, I16_WMV *ppxliFrameMBU, I16_WMV *ppxliFrameMBV); Void_WMV CopyBotFieldMBtoInterFieldMBInterlace411 ( I16_WMV *ppxliFieldMB, I16_WMV *ppxliFrameMBY, I16_WMV *ppxliFrameMBU, I16_WMV *ppxliFrameMBV); Void_WMV ChromaMVInterlace411 ( tWMVDecInternalMember *pWMVDec, I32_WMV imbX, I32_WMV imbY, I32_WMV iMvX, I32_WMV iMvY, I32_WMV *iChromaMvX, I32_WMV *iChromaMvY); Void_WMV LoopFilterIFrameInterlace411 (tWMVDecInternalMember *pWMVDec, U8_WMV* ppxliY, U8_WMV* ppxliU, U8_WMV* ppxliV); Void_WMV g_FilterVerticalEdgeV9 (U8_WMV* pVhstart, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iNumPixel); Void_WMV g_FilterHorizontalEdgeV9(U8_WMV* pV5, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iNumPixel); Void_WMV loopfilter8x8rows0 (); Void_WMV loopfilter8x8rows1 (); Void_WMV loopfilter8x4rows0 (); Void_WMV loopfilter8x4rows1 (); Void_WMV loopfilter8x8cols0 (); Void_WMV loopfilter8x8cols1 (); Void_WMV loopfilter4x8cols0 (); Void_WMV loopfilter4x8cols1 (); // set WMV3 profiles Void_WMV SetProfileVariablesWMV3 (); Void_WMV CopyInterFieldMBtoTopFieldMBInterlace411 ( I16_WMV *ppxliFieldMB, I16_WMV *ppxliFrameMBY,I16_WMV *ppxliFrameMBU, I16_WMV *ppxliFrameMBV, I32_WMV iOffsetToNextRowY, I32_WMV iOffsetToNextRowUV); Void_WMV CopyInterFieldMBtoBotFieldMBInterlace411 ( I16_WMV *ppxliFieldMB, I16_WMV *ppxliFrameMBY,I16_WMV *ppxliFrameMBU, I16_WMV *ppxliFrameMBV, I32_WMV iOffsetToNextRowY, I32_WMV iOffsetToNextRowUV); Void_WMV MotionCompFrameInterlace411 (tWMVDecInternalMember *pWMVDec, I32_WMV imbX, I32_WMV imbY, U8_WMV *ppxliRefY, U8_WMV *ppxliRefU, U8_WMV *ppxliRefV, U8_WMV* ppxliReconY, U8_WMV* ppxliReconU, U8_WMV* ppxliReconV); Void_WMV MotionCompTopFieldInterlace411 (tWMVDecInternalMember *pWMVDec, I32_WMV imbX, I32_WMV imbY, U8_WMV *ppxliRefY, U8_WMV *ppxliRefU, U8_WMV *ppxliRefV, U8_WMV* ppxliReconY, U8_WMV* ppxliReconU, U8_WMV* ppxliReconV); Void_WMV MotionCompBotFieldInterlace411 (tWMVDecInternalMember *pWMVDec, I32_WMV imbX, I32_WMV imbY, U8_WMV *ppxliRefY, U8_WMV *ppxliRefU, U8_WMV *ppxliRefV, U8_WMV* ppxliReconY, U8_WMV* ppxliReconU, U8_WMV* ppxliReconV); Void_WMV AddErrorFrameInterlace411 (tWMVDecInternalMember *pWMVDec, I16_WMV *ppxliFieldMB, U8_WMV *ppxlcCurrY, U8_WMV *ppxlcCurrU, U8_WMV *ppxlcCurrV, I32_WMV iOffsetY, I32_WMV iOffsetUV); Void_WMV AddErrorTopFieldInterlace411 (tWMVDecInternalMember *pWMVDec, I16_WMV *ppxliFieldMB, U8_WMV *ppxlcCurrY, U8_WMV *ppxlcCurrU, U8_WMV *ppxlcCurrV, I32_WMV iOffsetY, I32_WMV iOffsetUV); Void_WMV AddErrorBotFieldInterlace411 (tWMVDecInternalMember *pWMVDec, I16_WMV *ppxliFieldMB, U8_WMV *ppxlcCurrY, U8_WMV *ppxlcCurrU, U8_WMV *ppxlcCurrV, I32_WMV iOffsetY, I32_WMV iOffsetUV); Void_WMV SetDefaultDQuantSetting(tWMVDecInternalMember *pWMVDec); Void_WMV dump_minuspadding (tWMVDecInternalMember *pWMVDec, I32_WMV iDumRef) ; Void_WMV UpsampleToDump (tWMVDecInternalMember *pWMVDec); Void_WMV SetMVRangeFlag(tWMVDecInternalMember *pWMVDec, I32_WMV iRangeIndex); Void_WMV m_InitLoopFilterFramebyFrame(); Void_WMV OverlapMBRow (tWMVDecInternalMember * pWMVDec, I32_WMV imbY, U8_WMV *ppxliRecnY, U8_WMV *ppxliRecnU, U8_WMV *ppxliRecnV, I32_WMV iMBYEnd, I32_WMV iMBYStart, I32_WMV iThreadID); Void_WMV Cast8x4Block (I16_WMV *pSrc, I32_WMV iSrcStride, U8_WMV *pDst, I32_WMV iDstStride); Void_WMV OverlapBlockHorizontalEdge (tWMVDecInternalMember * pWMVDec, I16_WMV *pSrcTop, I16_WMV *pSrcCurr, I32_WMV iSrcStride, U8_WMV *pDst, I32_WMV iDstStride, Bool_WMV bTop, Bool_WMV bCurrent, Bool_WMV bWindup); Void_WMV OverlapBlockVerticalEdge ( I16_WMV *pInOut, I32_WMV iStride); int AdjustReconRange (tWMVDecInternalMember *pWMVDec, unsigned char *pRefY, unsigned char *pRefU, unsigned char *pRefV, unsigned char *pDstY, unsigned char *pDstU, unsigned char *pDstV); Void_WMV SwapPostAndPostPrev(tWMVDecInternalMember *pWMVDec); Void_WMV PixelMean (const U8_WMV *pSrc1, I32_WMV iStride1, const U8_WMV *pSrc2, I32_WMV iStride2, U8_WMV *pDst, I32_WMV iDstStride, I32_WMV iWidth, I32_WMV iHeight); Void_WMV DirectModeMV (tWMVDecInternalMember * pWMVDec, I32_WMV iXMotion, I32_WMV iYMotion, Bool_WMV bHpelMode, Bool_WMV bInterlaced, I32_WMV imbX, I32_WMV imbY, I32_WMV *idfx, I32_WMV *idfy, I32_WMV *idbx, I32_WMV *idby ); Void_WMV DirectModeMVFieldInterlace( tWMVDecInternalMember * pWMVDec, I32_WMV iYXMotion, Bool_WMV bHpelMode, I32_WMV *uiMvYXF, I32_WMV *uiMvYXB ); Void_WMV g_FilterHorizontalEdgeV9Long(U8_WMV* ppxlcCenter, I32_WMV iPixelDistance, I32_WMV iStepSize, I32_WMV iNumPixel); Void_WMV g_FilterVerticalEdgeV9Long (U8_WMV* ppxlcCenter, I32_WMV iPixelIncrement, I32_WMV iStepSize, I32_WMV iNumPixel); Bool_WMV PullBackMotionVector (tWMVDecInternalMember *pWMVDec, I32_WMV *iMvX, I32_WMV *iMvY, I32_WMV imbX, I32_WMV imbY); Void_WMV swapRef0Ref1Pointers (tWMVDecInternalMember *pWMVDec); Void_WMV swapCurrRef1Pointers (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus decodeB_Deblock (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus decodeB_entropy (tWMVDecInternalMember *pWMVDec); I32_WMV SliceStartCode(tWMVDecInternalMember *pWMVDec, I32_WMV imbY); Void_WMV SetTransformTypeHuffmanTable (tWMVDecInternalMember *pWMVDec, I32_WMV iStep); void Set_Xform_sbp_tables_TI(VLD_info *, int iStep); I32_WMV decodeSkipP (tWMVDecInternalMember *pWMVDec); Void_WMV SetMotionFieldBFrame (I16_WMV *pMvX, I16_WMV *pMvY, I16_WMV *pFMvX, I16_WMV *pFMvY, I16_WMV *pBMvX, I16_WMV *pBMvY, I32_WMV iTopMvX, I32_WMV iTopMvY, I32_WMV iBotMvX, I32_WMV iBotMvY, I32_WMV iFTopMvX, I32_WMV iFTopMvY, I32_WMV iFBotMvX, I32_WMV iFBotMvY, I32_WMV iBTopMvX, I32_WMV iBTopMvY, I32_WMV iBBotMvX, I32_WMV iBBotMvY, I32_WMV iTopLeftBlkIndex, I32_WMV iBotLeftBlkIndex ); I32_WMV ComputeFrameMVFromDiffMVInterlace411_BFrame (tWMVDecInternalMember *pWMVDec, I32_WMV imbX, I32_WMV imbY, CDiffMV *pInDiffMV, I16_WMV *m_pXTrue, I16_WMV *m_pYTrue, I16_WMV *m_pXPred, I16_WMV *m_pYPred); Void_WMV CopyRefToPrevPost (tWMVDecInternalMember * pWMVDec); Void_WMV HandleResolutionChange (tWMVDecInternalMember * pWMVDec); Void_WMV SwapMultiresAndPost(tWMVDecInternalMember *pWMVDec); Void_WMV ChromaMV_B (tWMVDecInternalMember * pWMVDec, I32_WMV *iX, I32_WMV *iY); unsigned int FrameInterlaceChromaMV_Field(unsigned char ubHalfPel, I32_WMV mvX, I32_WMV mvY); unsigned int FieldInterlaceChromaMV( unsigned int *puiMvArray, unsigned char ubNumMVs, unsigned char ubField, unsigned char ubHalfpel, unsigned char bUVHpelBilinear ); tWMVDecodeStatus VodecConstruct( tWMVDecInternalMember *pWMVDec, U32_WMV dwFOURCC, I32_WMV iFrameRate, I32_WMV iWidthSource, I32_WMV iHeightSource, CInputBitStream_WMV *pInputBitstream); VResultCode VC1VDEC_TI_Huff_WMV_init(tWMVDecInternalMember *pWMVDec, Huffman_WMV * pThis, const tPackHuffmanCode_WMV *huffArray, I32_WMV *maxBits, I32_WMV iMAX_STAGES); I32_WMV decodeDQuantParam_TI ( tWMVDecInternalMember *pWMVDec, mb_info* cur_mb_info, unsigned int mb_YX, unsigned int num_mb_YX ); unsigned int median_4(unsigned int w, unsigned int x, unsigned int y, unsigned int z); unsigned int median_3(unsigned int x, unsigned int y, unsigned int z); unsigned int InitBoundingBoxParams( tBoundingBoxParamsStruct *pBBoxParams, tBoundingBoxArrayStruct *pBBoxArray, unsigned int uiMaxBBAreaPerChannel, unsigned int uiFrameWidth, unsigned char ubIsBFrame ); tWMVDecodeStatus ComputeBoundingBoxParams( tWMVDecInternalMember *pWMVDec, tBoundingBoxParamsStruct *pBBoxParams, tBoundingBoxArrayStruct *pBBoxArray, mb_info *pMBInfo, unsigned int *puiLumMvArray, unsigned int *puiChromMvArray, unsigned int *puiOffsetYXArray, unsigned int *puiBBoxSizeUsed, unsigned int uiSizeYX, unsigned int uiNumLumBlks, unsigned int uiNumChromBlks, unsigned int uiFrameWidthHeight, unsigned char ubPredictionDir, unsigned char ubInterpolType, unsigned char ubFrameType ); tWMVDecodeStatus GetBoundingBoxData( tWMVDecInternalMember *pWMVDec, tBoundingBoxParamsStruct *pBBoxParams, tBoundingBoxArrayStruct *pBBoxArray, unsigned int uiFrameWidth, unsigned char *puiBBoxMemoryStartAddr, unsigned char *puiRefY[4], unsigned char *puiRefU[4], unsigned char *puiRefV[4] ); tWMVDecodeStatus GetBoundingBoxData_2cores( tWMVDecInternalMember *pWMVDec, tBoundingBoxParamsStruct *pBBoxParams, tBoundingBoxArrayStruct *pBBoxArray, unsigned int uiFrameWidth, unsigned char *puiBBoxMemoryStartAddr, unsigned char *puiRefY[4], unsigned char *puiRefU[4], unsigned char *puiRefV[4], short *CoeffDataInDDR_temp, unsigned int errDatSiz, int mcChannel ); void PadBoundingBoxData( tBoundingBoxParamsStruct *pBBoxParams, tBoundingBoxArrayStruct *pBBoxArray, unsigned int uiFrmWidth, unsigned int uiFrmHeight ); void CompleteBoundingBoxDataTransfer(tWMVDecInternalMember *pWMVDec, tBoundingBoxParamsStruct *pBBoxParams, tBoundingBoxArrayStruct *pBBoxArray ); int ConvertToYUV422Interleaved(tWMVDecInternalMember *pWMVDec, unsigned char *pInDataY, unsigned char *pInDataU, unsigned char *pInDataV, unsigned char *pOutDataY, unsigned char *pTempBuffer, unsigned int uiTempBufferSize, unsigned int uiInputWidth, unsigned int uiInputPitch, unsigned int uiHeight, unsigned char ubField ); /* ============================================================================= * Author: Sadanand Shirdhonkar. * Dt: 1-05-2003. * This file contains modified table declerations for 8 bit stage. * Tables generated using decoder labeled "VIP_WMV9DEC_GEN_VLD_TABLES_14JUL2003" * * NOTES: The "bits" field in the TableInfo structure here contain the value * (32 - bits_per_stage) instead of bits_per_stage as used by Microsoft. * The reason is it reduces the critical path in the loop. * ========================================================================== */ //*@@@+++@@@@****************************************************************** // // Microsoft Windows Media // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** extern const U8_WMV grgiZigzagInv_NEW [64+1]; extern const U8_WMV grgiZigzagInv_NEW_I [64+1]; extern const U8_WMV grgiHorizontalZigzagInv_NEW [64]; extern const U8_WMV grgiVerticalZigzagInv_NEW [64]; extern const U8_WMV grgiZigzagInvRotated_NEW [64]; extern const U8_WMV grgi8x4ZigzagInv[33]; extern const U8_WMV grgi4x8ZigzagInv[33]; extern const U8_WMV grgi8x4ZigzagInvRotated[33]; extern const U8_WMV grgi4x8ZigzagInvRotated[33]; extern const U8_WMV grgiZigZagInvInterlaced[64]; extern const U8_WMV grgi4x4ZigzagInv[17]; extern const U8_WMV grgi4x4ZigzagInvRotated[17]; //Anirban Basu: 8x4/AP/Progressive extern const U8_WMV grgi8x4ZigZagInvAP[33]; //Anirban Basu: 8x4/AP/Interlace extern const U8_WMV grgi8x4ZigZagInvInterlaceAP[33]; //Anirban Basu: 4x8/AP/Progressive extern const U8_WMV grgi4x8ZigZagInvAP[33]; //Anirban Basu: 4x8/AP/Interlace extern const U8_WMV grgi4x8ZigZagInvInterlaceAP[33]; //Anirban Basu: 4x4/AP/Interlace extern const U8_WMV grgi4x4ZigzagInvInterlaceAP[17]; /// Tabls for HighMotion extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRunIntraY_HghMt [31]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRunIntraY_HghMt [38]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevelIntraY_HghMt [20]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevelIntraY_HghMt [7]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRun_HghMt [37]; extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRun_HghMt [27]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevel_HghMt [24]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevel_HghMt [10]; /// Tabls for Talking extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRunIntraY_Talking [21]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRunIntraY_Talking [27]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevelIntraY_Talking [17]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevelIntraY_Talking [5]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRun_Talking [44]; extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRun_Talking [30]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevel_Talking [15]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevel_Talking [6]; /// Tabls for MMIDRATE extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRunIntraY_MMIDRATE [15]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRunIntraY_MMIDRATE [21]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevelIntraY_MMIDRATE [28]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevelIntraY_MMIDRATE [9]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRun_MMIDRATE [41]; extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRun_MMIDRATE [27]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevel_MMIDRATE [13]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevel_MMIDRATE [4]; extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRunIntraY_HghRate [15]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRunIntraY_HghRate [17]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevelIntraY_HghRate [57]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevelIntraY_HghRate [5]; extern const U8_WMV sm_rgIfLastNumOfLevelAtRun_HghRate [31]; extern const U8_WMV sm_rgIfNotLastNumOfLevelAtRun_HghRate [25]; extern const I8_WMV sm_rgIfNotLastNumOfRunAtLevel_HghRate [33]; extern const I8_WMV sm_rgIfLastNumOfRunAtLevel_HghRate[5]; extern const tMvPredScale_WMV gFirstFieldMvScaleTab[4]; extern const tMvPredScale_WMV gSecondFieldMvScaleTab[4]; extern const tMvPredScale_WMV gFieldMvScaleTab_B_Backward[4]; /* Function prototype declarations*/ int initVldInfoObject( vldInfoStruct *vldInfoObject); /* Modified VLD tables. */ extern const int HuffDecInfo_DCTAC_MMIDRATE_Intra[844]; extern const int HuffDecInfo_DCTAC_MMIDRATE_Inter[844]; extern const unsigned int HuffDecInfo_DCTAC_HghMt_Intra[5028]; extern const unsigned int HuffDecInfo_DCTAC_HghMt_Inter[4072]; extern const unsigned int HuffDecInfo_DCTAC_HghRate_Intra[3140]; extern const unsigned int HuffDecInfo_DCTAC_HghRate_Inter[4960]; extern const unsigned int HuffDecInfo_DCTAC_Talking_Intra[1556]; extern const unsigned int HuffDecInfo_DCTAC_Talking_Inter[3808]; /* Stage wise indexing tables into the modified VLD tables. */ extern const TableInfo mod_MMIDRATE_Intra_DCTAC_tabInfo[32]; extern const TableInfo mod_MMIDRATE_Inter_DCTAC_tabInfo[32]; extern const TableInfo mod_HghMt_Intra_DCTAC_tabInfo[33]; extern const TableInfo mod_HghMt_Inter_DCTAC_tabInfo[29]; extern const TableInfo mod_HghRate_Intra_DCTAC_tabInfo[38]; extern const TableInfo mod_HghRate_Inter_DCTAC_tabInfo[36]; extern const TableInfo mod_Talking_Intra_DCTAC_tabInfo[34]; extern const TableInfo mod_Talking_Inter_DCTAC_tabInfo[23]; /*zero set buffer to set bitplane buffer to zero*/ extern const bit_plane bitplane_Set[256]; /* ======================================================================= * * Dt: 15-10-2003 * Motion vector VLD tables. * Taken form file ".../build/VLD_Tables/mod_MV_tables.c" generated by the * decoder from "VIP_WMV9DEC_GEN_VLD_TABLES_14JUL2003" label. * * Here we generate two stage tables for MV decode. * These tables are memory optimised for 2 stages. Any other combination of * stage size will give a larger table. * Size comparison with original MS 3 stage tables is as below. * * =========================================================== * |(no. of elements) | bits per stage| Table size | * Table no. | MS | TI | 1 | 2 | ( bytes ) | * =========================================================== * 1 | 206 | 292 | 7 | 7 | 584 | * 2 | 146 | 280 | 7 | 7 | 560 | * 3 | 104 | 160 | 6 | 6 | 320 | * 4 | 164 | 398 | 8 | 7 | 796 | * =========================================================== * * Other overhead (Control structures) = 30 * 8 = 240 bytes. * Total memory required = 2500 bytes. * ======================================================================= */ /* Modified motion-vector VLD table. (2 stage) */ extern const unsigned char MV1_VLD_Table_V9_TI[584]; extern const unsigned char MV2_VLD_Table_V9_TI[560]; extern const unsigned char MV3_VLD_Table_V9_TI[320]; extern const unsigned char MV4_VLD_Table_V9_TI[796]; /* ========================================================================= * * Declaration of the MVBP Tables (2MV and 4MV) * * ========================================================================= */ extern const unsigned char MvBlockPattern_2MV_0[]; extern const unsigned char MvBlockPattern_2MV_1[]; extern const unsigned char MvBlockPattern_2MV_2[]; extern const unsigned char MvBlockPattern_2MV_3[]; extern const unsigned char *MvBlockPattern_2MV_Set[]; extern const unsigned int MvFrameInterlacePFixedLengthVlcTab[4]; extern const unsigned short MVP4Tab_1[]; extern const unsigned short MVP4Tab_2[]; extern const unsigned short MVP4Tab_3[]; extern const unsigned short MVP4Tab_4[]; extern const unsigned short *MVP_4MV_Set[4]; extern const TableInfo_TI MV1_VLD_V9_TI_tabInfo[8]; extern const TableInfo_TI MV2_VLD_V9_TI_tabInfo[10]; extern const TableInfo_TI MV3_VLD_V9_TI_tabInfo[3]; extern const TableInfo_TI MV4_VLD_V9_TI_tabInfo[5]; extern const Huffman_WMV_TI MV1_vld_tab_info; extern const Huffman_WMV_TI MV2_vld_tab_info; extern const Huffman_WMV_TI MV3_vld_tab_info; extern const Huffman_WMV_TI MV4_vld_tab_info; // MB Mode table definations fro P Frame Interlace extern const unsigned short MBModePFrameInterlaceTab_1[]; extern const unsigned short MBModePFrameInterlaceTab_2[]; extern const unsigned short MBModePFrameInterlaceTab_3[]; extern const unsigned short MBModePFrameInterlaceTab_4[]; extern const unsigned short *MBModePFrameInterlaceTab_Set[4]; extern const unsigned short MBMode4MVPFrameInterlaceTab_1[]; extern const unsigned short MBMode4MVPFrameInterlaceTab_2[]; extern const unsigned short MBMode4MVPFrameInterlaceTab_3[]; extern const unsigned short MBMode4MVPFrameInterlaceTab_4[]; extern const unsigned short *MB4MVModePFrameInterlaceTab_Set[4]; // MB Mode Table definations for P Field Interlace extern const unsigned short MBMode1MVPFieldInterlaceTab_1[]; extern const unsigned short MBMode1MVPFieldInterlaceTab_2[]; extern const unsigned short MBMode1MVPFieldInterlaceTab_3[]; extern const unsigned short MBMode1MVPFieldInterlaceTab_4[]; extern const unsigned short MBMode1MVPFieldInterlaceTab_5[]; extern const unsigned short MBMode1MVPFieldInterlaceTab_6[]; extern const unsigned short MBMode1MVPFieldInterlaceTab_7[]; extern const unsigned short MBMode1MVPFieldInterlaceTab_8[]; extern const unsigned short *MB1MVModePFieldInterlaceTab_Set[8]; extern const unsigned short MBMode4MVPFieldInterlaceTab_1[]; extern const unsigned short MBMode4MVPFieldInterlaceTab_2[]; extern const unsigned short MBMode4MVPFieldInterlaceTab_3[]; extern const unsigned short MBMode4MVPFieldInterlaceTab_4[]; extern const unsigned short MBMode4MVPFieldInterlaceTab_5[]; extern const unsigned short MBMode4MVPFieldInterlaceTab_6[]; extern const unsigned short MBMode4MVPFieldInterlaceTab_7[]; extern const unsigned short MBMode4MVPFieldInterlaceTab_8[]; extern const unsigned short *MB4MVModePFieldInterlaceTab_Set[8]; /* ======================================================================= * * Intra DC coefficient tables * ======================================================================= */ /* ======================================================================= */ /* ======================================================================= * * Dt: 19-03-2004 * Block header VLD tables. (sub-block pattern and TTBLK) * * Memory required (Block transform type): * * Memory required (4x4 sub-block pattern): * - Low QP => 64 bytes. * - Mid QP => 32 bytes. * - High QP => 32 bytes. * * Total: 196 bytes. * * ======================================================================= */ /* ======================================================================= * Date: Mar 18 2004, 20:55:34 * Tables generated by: * ~a0875368/kernels/c6400/wmv_vld/Tables/Small_tables/gen_TTBLK_vld_tab.c * * Block transform type tables (TTBLK): * The symbol is a bit-field with following specifications. * - 0-2 => length (3 bits) * - 3-4 => sub-block pattern (2 bits) * sbp convention is "msb|lsb" => "left|right" or "top|bottom" * - 5-7 => Transform type. Compatible with wmv9 code enum. (3 bits) * ie. XFORMMODE_8x8 = 0, XFORMMODE_8x4 = 1, * XFORMMODE_4x8 = 2, XFORMMODE_4x4 = 4. * ======================================================================= */ extern const unsigned char blk_Xform_lowQP_vld_tab [32]; extern const unsigned char blk_Xform_midQP_vld_tab [16]; extern const unsigned char blk_Xform_highQP_vld_tab[16]; /* ======================================================================= * Date: Mar 18 2004, 21:07:01 * Tables generated by "gen_sbp_vld_tab.c" * ~a0875368/kernels/c6400/wmv_vld/Tables/Small_tables/gen_sbp_vld_tab.c * * Description: The decoded symbol is a bit-field, as described below. * 0-3 => length (4 bits) * 4-7 => sub-block pattern (4 bits) * ======================================================================= */ extern const unsigned char sbp4x4_lowQP_vld_tab [64]; extern const unsigned char sbp4x4_midQP_vld_tab [32]; extern const unsigned char sbp4x4_highQP_vld_tab[32]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_1[64]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_2[64]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_3[64]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_4[64]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_5[64]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_6[64]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_7[64]; extern const tPackHuffmanCode_WMV sm_HufCBPCYTable_Interlace_8[64]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Progressive_MV1[]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Progressive_MV2[]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Progressive_MV3[]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Progressive_MV4[]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV1[127]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV2[127]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV3[127]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV4[127]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV5[127]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV6[127]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV7[127]; extern const tPackHuffmanCode_WMV sm_HufMVTable_Interlace_MV8[127]; /* ======================================================================= */ /* #defines and prototypes for for Multisymbol decoding VLD */ /* ======================================================================= */ /* |32 bits|:|num_sym(2bits)|RL1(13bits)|RL2(9bits)|is_last_index(4)|len(4bits)| */ /*To avoid address computation inside the loop*/ /*#define MAX_NUM_LEVEL_AT_RUN MAX_NUM_LEVEL_AT_RUN*/ extern const int DCTAC_NMIDRATEIntraMD_Table[1116]; extern const int DCTAC_NMIDRATEInterMD_Table[1116]; extern const int DCTAC_HighMtIntraMD_Table[1716]; extern const int DCTAC_HighMtInterMD_Table[1596]; extern const int DCTAC_HighRateIntraMD_Table[1494]; extern const int DCTAC_HighRateInterMD_Table[2050]; extern const int DCTAC_TalkingIntraMD_Table[1224]; extern const int DCTAC_TalkingInterMD_Table[1510]; extern const int CT_NumOfLevelAtRunDCTAC_NMIDRATEIntraMD_Table[4][2][57]; extern const int CT_NumOfLevelAtRunDCTAC_HighMtIntraMD_Table[4][2][57]; extern const int CT_NumOfLevelAtRunDCTAC_HighRateIntraMD_Table[4][2][57]; extern const int CT_NumOfLevelAtRunDCTAC_TalkingIntraMD_Table[4][2][57]; extern const int CT_NumOfLevelAtRunDCTAC_NMIDRATEInterMD_Table[4][2][57]; extern const int CT_NumOfLevelAtRunDCTAC_HighMtInterMD_Table[4][2][57]; extern const int CT_NumOfLevelAtRunDCTAC_HighRateInterMD_Table[4][2][57]; extern const int CT_NumOfLevelAtRunDCTAC_TalkingInterMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_NMIDRATEIntraMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_HighMtIntraMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_HighRateIntraMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_TalkingIntraMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_NMIDRATEInterMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_HighMtInterMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_HighRateInterMD_Table[4][2][57]; extern const int CT_NumOfRunAtLevelDCTAC_TalkingInterMD_Table[4][2][57]; /*Structure containing params needed by wmv_vld_intra_8x8*/ typedef struct param_vld_intra_8x8 { /*Arrays for storing prediction values*/ short* top_pred_arr_ptr; short* left_pred_ptr; short* top_left_DC_array; Huffman_WMV* pDCAcPred_tbl_Luma; Huffman_WMV* pDCAcPred_tbl_Chroma; short* pdct_noIQ_buf; short* pdct_IQ_buf; }param_vld_intra_8x8_t; extern const Huffman_WMV mod_DCy_Talking_info; extern const Huffman_WMV mod_DCc_Talking_info; extern const Huffman_WMV mod_DCy_HghMt_info; extern const Huffman_WMV mod_DCc_HghMt_info; /*======================================================================= */ /******************************************************************************* File Name : videoC6x.h Created On : 11th March 2003 Copyright (c) Texas Instruments India, 2002. All right are reserved. Copying or other reproduction of this program except for archival purposes is prohibited without the prior written consent of Texas Instruments India. Texas Instruments India Golfview homes Bangalore India - 560017 Contributors : Nandakumar R, Sadanand Shirdhonkar. Description : c6x routines for the video processing kernels. Revision History: ---------------------- 02-Sep-2003: Added "ZZ scan - AC pred - IQ" kernel for inter and intra blocks. *****************************************************************************/ /* ======================================================================== */ /* NAME */ /* - C64x Intrinsics for host. (Functions for executing C64x intrinsic */ /* code on host.) */ /*S S*/ /*S AUTHOR S*/ /*S Sadanand Shirdhonkar. S*/ /*S S*/ /*S REVISION HISTORY S*/ /*S 17-Oct-2003 Initial revision . . . . . . . Sadanand Shirdhonkar S*/ /* */ /* ASSUMPTIONS */ /* - _int64 datatype is supported on the host. */ /* */ /* NOTES */ /* - The operation of memory intrinsics is not guarantyed, especially */ /* for non-alligned accesses. This is host dependent. */ /* - All memory intrinics are MACROS and not functions. Hence all */ /* considerations for MACRO usage are to be applied here. */ /* The reason for keeping them as MACROS is that it iss not possible to */ /* support memory intrinsice as functions. */ /* */ /* SOURCE */ /* TI TMSC320C64X architecture. */ /* ------------------------------------------------------------------------ */ /* Copyright (c) 2003 Texas Instruments, Incorporated. */ /* All Rights Reserved. */ /* ======================================================================== */ /*********************************************************************/ /*intrinsic.h */ /*********************************************************************/ /*********************************************************************/ /* It has declarations for intrinsic functions which are defined in*/ /* intrinsic.c */ /*********************************************************************/ typedef double Double64x; /* ======================================================================== */ /* End of file: Intrinsics.h */ /* ------------------------------------------------------------------------ */ /* Copyright (c) 2003 Texas Instruments, Incorporated. */ /* All Rights Reserved. */ /* ======================================================================== */ /* Address alignment MACRO for Bounding-Box */ /* data structures and other definitions for MC dataflow strategies */ typedef struct _tRefWindow { unsigned int top_left_Y, bottom_right_Y; unsigned int top_left_UV, bottom_right_UV; unsigned char *pRefY, *pRefU, *pRefV; unsigned char ubLumDataPresent; unsigned char ubChromDataPresent; } RefWindow; /* ========================================================================== */ /* reconstruction buffer: * For an SDTV image one row of reconstructed image * with double buffering will cost us, 34 KB of * on-chip memory. When we go for HDTV FIXME we might * want revisit this and make appropriate * changes. */ // i.e. 1 row of MB's = 1280 >> 4 = 80. typedef struct _tagRecon { unsigned char * bufferY; unsigned char * bufferU; unsigned char * bufferV; } reconOnChip; /* ========================================================================== * Tables and other data structs used. * ========================================================================= */ /* we need memory for error data buffer and reference window onchip. When we double buffer these things, we need double this memory. assuming we have a total of 64 KB memory => */ /* buffer used for keeping error data and reference window data. */ /* memory usage in the common buffer is shown below. _____________________ | | | error data | --------------------- | | | Y ref area | | | --------------------- | | | | U ref | V ref | | | | --------------------- */ /* ======================================================================== * * Kernel Declerations. * ======================================================================== */ void mcAi128( unsigned char * restrict dst, short *idct, unsigned int dWidth); void mcA( const unsigned char * restrict src, unsigned char *dst, unsigned char offset,int sWidth,int dWidth, int rc); void mcB( const unsigned char * restrict src, unsigned char *dst, unsigned char offset,int sWidth,int dWidth, int rc); void mcC( const unsigned char * restrict src, unsigned char *dst, unsigned char offset,int sWidth,int dWidth, int rc); void mcD( const unsigned char * restrict src, unsigned char *dst, unsigned char offset,int sWidth,int dWidth, int rc); /* ========================================================================= * TI Overlap Transform functions. * ========================================================================= */ void overlap_V(short *restrict in, short *restrict pNextEdge, int noOfEdges, int pitch); void overlap_H(short *restrict in, short *restrict pNextEdge, int noOfEdges, int pitch); void mcAi_OVT(unsigned char *restrict dst, unsigned char *restrict src, int d_pitch, int s_pitch, int height); void mcA_OVT( unsigned char * restrict dst, short *idct, unsigned int dWidth, unsigned int height); unsigned char overlap_MB_chunk_TI( tWMVDecInternalMember *pWMVDec, reconOnChip *OVT_bufs, short imbY, short imbYSlice, short imbX, short mbs_to_proc, short mbs_per_row, short mvs_per_mb, mb_info *o_cur_mb_info ); unsigned char overlap_frame_interlace_MB_chunk_TI ( tWMVDecInternalMember *pWMVDec, reconOnChip *OVT_bufs, short imbY, short imbYSlice, short imbX, short mbs_to_proc, short mbs_per_row, short mvs_per_mb, mb_info *o_cur_mb_info ); void saturateOVT_P_TI( tWMVDecInternalMember *pWMVDec, reconOnChip *OVT_bufs, reconOnChip *recon_ptrs, short imbY, short imbX, short mbs_to_proc, short mbs_per_row, short mvs_per_mb, unsigned char *restrict offchip_recon_ptry, unsigned char *restrict offchip_recon_ptru, unsigned char *restrict offchip_recon_ptrv, mb_info *o_cur_mb_info, short o_frame_widthY); void saturateOVT_Interlace_P_TI( tWMVDecInternalMember *pWMVDec, reconOnChip *OVT_bufs, reconOnChip *recon_ptrs, short imbY, short imbX, short mbs_to_proc, short mbs_per_row, short mvs_per_mb ); void saturateOVT_P_TI_INTERLACE( tWMVDecInternalMember *pWMVDec, reconOnChip *OVT_bufs, reconOnChip *recon_ptrs, short imbY, short imbX, short mbs_to_proc, short mbs_per_row, short mvs_per_mb, unsigned char *restrict offchip_recon_ptry, unsigned char *restrict offchip_recon_ptru, unsigned char *restrict offchip_recon_ptrv, mb_info *o_cur_mb_info, short o_frame_widthY ); void mem_copy_2D_YUV(reconOnChip *dst, reconOnChip *src, unsigned int src_dst_pitch_Y, unsigned int src_dst_pitch_UV, unsigned int width_Y__UV, unsigned int height ); extern void wmv9InverseXform8x8(unsigned short *dct_data, unsigned num_dct); typedef void (*_tMcFn)( const unsigned char *src, unsigned char *dst, unsigned char offset, int sWidth, int dWidth, int rc); extern const _tMcFn mcWithoutIdct[]; Bool_WMV TI_decodeDCTPrediction_P_frm ( tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict top_pred_ptr, short *restrict left_pred_arr, short *restrict top_left_arr, I32_WMV blk_no, I32_WMV mb_x, I32_WMV mb_y, I32_WMV *iDirection, I16_WMV *restrict pPredScaled, int mvs_per_mb, unsigned int *mv_arr ); Bool_WMV TI_decodeDCTPrediction_P_frm_fdp ( tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict top_pred_ptr, short *restrict left_pred_arr, short *restrict top_left_arr, I32_WMV blk_no, I32_WMV mb_x, I32_WMV mb_y, I32_WMV *iDirection, I16_WMV *restrict pPredScaled, int mvs_per_mb, mb_info * cur_mb_info_top_row ); Bool_WMV TI_decodeDCTPrediction_B_frm ( tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict top_pred_ptr, short *restrict left_pred_arr, short *restrict top_left_arr, I32_WMV blk_no, I32_WMV mb_x, I32_WMV mb_y, I32_WMV *iDirection, I16_WMV *restrict pPredScaled, int mvs_per_mb, unsigned int *mv_arr ); int getScanDirectionInterlace_P( tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, short sTopDc, short sLeftDc, short *sTopLeftDc, unsigned int uiBlkXOffset, unsigned int uiBlkYOffset, unsigned char ubBlkNo, int mvs_per_mb, unsigned int *mv_arr, signed int *iDcPred ); int getScanDirectionInterlace_B( tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, short sTopDc, short sLeftDc, short *sTopLeftDc, unsigned int uiBlkXOffset, unsigned int uiBlkYOffset, unsigned char ubBlkNo, int mvs_per_mb, unsigned int *mv_arr, signed int *iDcPred ); /* ====================================================================== */ // Sada: VLD kernel decleration. /* Dt: 8-10-2003 * Modified kernel to process more than 1 block per call, provided that * there is no intermediate data between the VLC's of two consecutive * blocks. * * ASSUMPTIONS: * 1) Exhaustive error checking not implemented in favour of performance. * 2) (ESC3 run len + ESC3 lvl len) <= 15 * 3) sizeof(temp_buf) >= 64 words (or (idct_block_size * 4) bytes); * 4) sizeof(pDct) = idct block size. * * 5) If more than 1 block is to be processed, the VLC's for the * corresponding blocks must be contagious. * Notes: To implement this, the first 48 bytes (12 words) of the "index_tab" * are used to store the number of run-level pairs and the number of escape * pairs for each block. 24 (= 48/2) is selected because we can have a max of * 24 4x4 blocks per MB, and the function can be called to decode these 24 * blocks. * In the first 24 bytes, number of RL pairs per block are stored. These * values are later used by the ZZ-scan function. The next 24 values are * for internal use only. * CAUTION: The caller should take care that the array's do not overflow ! * * ====================================================================== */ extern int VC1VDEC_TI_wmv_vld ( CInputBitStream_WMV *bs, VLD_info *vld_tab_info, unsigned int num_blk, unsigned int *pDct, unsigned int *temp_buf, tWMVDecInternalMember *pWMVDec); /* crops from the source and write contigously in destination */ extern int memcpy_2d1d( char *dst, char *src, int chunkWidth, int chunkHeight, int srcWidth); /* contigous chunk in source is written out to a box in destination */ extern int memcpy_1d2d( char *dst, char *src, int chunkWidth, int chunkHeight, int destWidth); /* Motion vector decode functions. */ /*This function is called for 1MV macro-blocks (in mixed MV or all 1 MV frames.)*/ tWMVDecodeStatus decode_MIXED_MB_1MV_OverheadOfPVOP_WMV3 (tWMVDecInternalMember *pWMVDec, mb_info* cur_mb_info, I32_WMV iMBX, I32_WMV iMBY, unsigned char *no_inblk_header, mb_hdr_info * hdr_info, unsigned int MB_flags, mb_info *cur_mb_info_top_row ); /* This function is called for 4MV macro-block header decode*/ tWMVDecodeStatus decodeMB_4MV_OverheadOfPVOP_WMV3 (tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, I32_WMV iMBX, I32_WMV iMBY, unsigned char *no_inblk_header, mb_hdr_info * hdr_info, unsigned int MB_flags, mb_info *cur_mb_info_top_row ); tWMVDecodeStatus decodeMBModePFrameInterlace ( tWMVDecInternalMember *pWMVDec, mb_info *psCurMBInfo ); tWMVDecodeStatus decodeMBModePFieldInterlace ( tWMVDecInternalMember *pWMVDec, mb_info *psCurMBInfo ); tWMVDecodeStatus decodeMB_Intra_OverheadOfPVOP_WMV3 ( tWMVDecInternalMember *pWMVDec, mb_info *psCurMBInfo, mb_hdr_info *psCurMBHdrInfo ); tWMVDecodeStatus decodeMB_IntraOverheadofFieldInterlacePVOP ( tWMVDecInternalMember *pWMVDec, mb_info *psCurMBInfo, mb_hdr_info *psCurMBHdrInfo, unsigned int uiMBX, unsigned int uiMBY ); tWMVDecodeStatus decodeMB_Inter_OverheadOfPVOP_WMV3 ( tWMVDecInternalMember *pWMVDec, mb_info *psCurMBInfo, mb_hdr_info *psCurMBHdrInfo, unsigned char *pubInBlkHdrFlag, unsigned int iMBX, unsigned int iMBY, unsigned char ubHalfPel, mb_info *psTopCurMBInfo ); tWMVDecodeStatus decodeMB_Inter_OverheadofFieldInterlacePVOP ( tWMVDecInternalMember *pWMVDec, mb_info *psCurMBInfo, mb_hdr_info *psCurMBHdrInfo, unsigned char *pubInBlkHdrFlag, unsigned int uiNumMvsPerMB, unsigned int iMBX, unsigned int iMBY, unsigned char ubHalfPel, mb_info *psTopMBInfo ); void perform_multi_idct(IDCT_info *idct_info_ptr); void perform_multi_idct_fdp(IDCT_info *idct_info_ptr,short imbX,short *pError,unsigned short cur_mb_err_siz,int mcChannel,mb_info *cur_mb_info); /* This routine is invoked under the folowing conditions: * * - Intra macro-block * - 4MV macro-blocks with ALL intra blocks. (MS encoder deffeciency/bug) */ tWMVDecodeStatus WMVideoDecDecodeI_entropy (tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeI_MC(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeI_MCnDBLK(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeI_inter_frame_MCnDBLK(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_entropy( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_MC( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_MCnDBLK( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_inter_frame_MCnDBLK( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_fieldinterlace_entropy( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_fieldinterlace_MC( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeP_X9_fieldinterlace_MCnDBLK( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_entropy( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_MC( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_MCnDBLK( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_inter_frame_MCnDBLK( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_fieldinterlace_entropy( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_fieldinterlace_MC(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_fieldinterlace_MCnDBLK(tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus WMVideoDecDecodeB_FieldInterlace( tWMVDecInternalMember *pWMVDec); tWMVDecodeStatus MB_vld_intraMB_FDP_ACIn( tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict pError, unsigned int imb_YX, int mvs_per_mb, mb_info * cur_mb_info_top_row ); typedef tWMVDecodeStatus (* _tMB_vld_fn_fdp)( Err_info * error_info_ptr, IDCT_info * idct_info_ptr, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict pError, unsigned int imb_YX, int mcChannel, mb_info * cur_mb_info_top_row ); int MB_vld_Xform_intra_fdp( Err_info * error_info_ptr, IDCT_info * idct_info_ptr, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict pError, unsigned int imb_YX, int mcChannel, mb_info * cur_mb_info_top_row ); extern int MB_vld_8x8_inter_fdp( Err_info * error_info_ptr, IDCT_info * idct_info_ptr, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict pError, unsigned int imb_YX, int mcChannel, mb_info * cur_mb_info_top_row ); int MB_vld_Xform_fdp( Err_info * error_info_ptr, IDCT_info * idct_info_ptr, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict pError, unsigned int imb_YX, int mcChannel, mb_info * cur_mb_info_top_row ); typedef tWMVDecodeStatus (* _tMB_vld_fn)( Err_info * error_info_ptr, IDCT_info * idct_info_ptr, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict pError, unsigned int imb_YX ); typedef tWMVDecodeStatus (* _tMB_hdr_dec_fn)( tWMVDecInternalMember *pWMVDec, mb_info* cur_mb_info, I32_WMV iMBX, I32_WMV iMBY, unsigned char *no_inblk_header, mb_hdr_info * hdr_info, unsigned int MB_flags, mb_info *cur_mb_info_top_row ); tWMVDecodeStatus TI_WMVideoDecScaleMB(mb_info *psCurMBInfo, int iMBx, int iMBy, unsigned int uiNumMBsX, short *psTopPred, short *psLeftPred, short *psTopLeftDC, short *psTopLeftDC_unscaled ); tWMVDecodeStatus TI_WMVideoDecScaleMB_fdp(mb_info *psCurMBInfo, int iMBx, int iMBy, unsigned int uiNumMBsX, short *psTopPred, short *psLeftPred, short *psTopLeftDC, short *psTopLeftDC_unscaled, mb_info *psCurMBInfo_top_row ); typedef void (* _tMB_MoCom_fn)( tWMVDecInternalMember *pWMVDec, unsigned int CBP, unsigned char *restrict refY, unsigned char *restrict refU, unsigned char *restrict refV, unsigned int *restrict frame_MV_array, unsigned int *piChromMVArray, unsigned int ref_opt_pitch, unsigned int uv_ref_opt_pitch, short *restrict pError, U8_WMV *restrict reconY, U8_WMV *restrict reconU, U8_WMV *restrict reconV, unsigned int rc__filter_type, unsigned int mb_yx, unsigned int fsize_YX, unsigned char ovt_enabled, unsigned char ubPitchDoubled, tBoundingBoxArrayStruct *pBBoxArray, tBoundingBoxParamsStruct *pBBoxParams, mb_info *pCurMBInfo ); unsigned int PullBackInterlaceMV_TI( int uiMvYX, unsigned int uiMbYX, unsigned int uiFrameHeightWidth, unsigned int uiBlkSize, unsigned char ubBlockNum, unsigned char ubFieldMBFlag ); signed int PullBackFieldMV ( signed int iMvYX, unsigned int uiMbYX, unsigned int uiFrameHeightWidth, unsigned char ubCurrentField ); unsigned int pull_back_ChromaMV( int kX, int kY, unsigned int mv_YX, int NumMBX, int NumMBY ); unsigned int pull_back_ChromaMVField(int kX, int kY, unsigned int mv_YX, int dimX, int dimY ); unsigned int pull_back_ChromaMVFrameInterlace( int kX, int kY, int iBlk, unsigned int mvY, unsigned int mvX, unsigned int iIsFieldMB, int dimX, int dimY ); unsigned int pull_back_ChromaMV_WMVA( int kX, int kY, unsigned int mv_YX, int NumMBX, int NumMBY ); /*********************************************************************** PullBackMV_TI: Pull motion vector into repeatpad range - Optimized form of PullBackMotionVector (). ***********************************************************************/ __inline unsigned int PullBackMV_TI(unsigned int mv_yx, unsigned int mbY_mbX, unsigned int fsize_YX) { unsigned int iChord_YX, mv_yx_s, mv_yx_p, iPos_YX; unsigned int C_m16_m16 = 0xfff0fff0; // -16|-16 iChord_YX = mbY_mbX << 4; // pix position. mpy by 16. mv_yx_s = _shr2(mv_yx, 2); // get integer mv. (div by 4) iPos_YX = _add2(mv_yx_s, iChord_YX); // Absolute reference position. /* Limit the absolute ref pos within (-16) to (frame_dim). */ iPos_YX = _max2(C_m16_m16, iPos_YX); iPos_YX = _min2(fsize_YX, iPos_YX); mv_yx_p = _sub2(iPos_YX, iChord_YX); // get the relative MV mv_yx_p = (mv_yx_p << 2) & 0xfffCffff; // mpy by 4; mv_yx_p = mv_yx_p + (mv_yx & 0x00030003); // add sub-pel mv. return(mv_yx_p); } __inline unsigned int PullBackMV_WMVA_TI(unsigned int mv_yx, unsigned int mbY_mbX, unsigned int fsize_YX) { unsigned int iChord_YX, mv_yx_s, mv_yx_p, iPos_YX; unsigned int uiMin_YX = 0xffeeffee; // -18|-18 unsigned int uiMax_YX = fsize_YX; const unsigned int C_one_one = 0x00010001; iChord_YX = mbY_mbX << 4; // pix position. mpy by 16. mv_yx_s = _shr2(mv_yx, 2); // get integer mv. (div by 4) iPos_YX = _add2(mv_yx_s, iChord_YX); // Absolute reference position. if((mv_yx >> 16) & 0x04) { uiMin_YX = _sub2(uiMin_YX, C_one_one); uiMax_YX = _add2(uiMax_YX, C_one_one); } iPos_YX = _max2(uiMin_YX, iPos_YX); iPos_YX = _min2(uiMax_YX, iPos_YX); mv_yx_p = _sub2(iPos_YX, iChord_YX); // get the relative MV mv_yx_p = (mv_yx_p << 2) & 0xfffCffff; // mpy by 4; mv_yx_p = mv_yx_p + (mv_yx & 0x00030003); // add sub-pel mv. return(mv_yx_p); } void repeat_pad_bb(RefWindow *ref_window, int frm_width, int frm_height); /* Motion compensation for 1MV case. Dose-not support 4MV. * Performs bi-cubic as well as bi-linear MC by calling appropriate kernels */ void MotionCompWithError_TI( tWMVDecInternalMember *pWMVDec, unsigned int CBP, unsigned char *restrict refY, unsigned char *restrict refU, unsigned char *restrict refV, unsigned int *restrict frame_MV_array, unsigned int *restrict piChromMVArray, unsigned int ref_opt_pitch, unsigned int uv_ref_opt_pitch, short *restrict pError, U8_WMV *restrict reconY, U8_WMV *restrict reconU, U8_WMV *restrict reconV, unsigned int rc__filter_type, unsigned int mb_yx, unsigned int fsize_YX, unsigned char ovt_enabled, unsigned char ubPitchDoubledFlag, tBoundingBoxArrayStruct *pBBoxArray, tBoundingBoxParamsStruct *pBBoxParams, mb_info *pCurMBInfo ); /* Motion compensation for 4MV case. */ void MotionCompWithError_4MV_TI( tWMVDecInternalMember *pWMVDec, unsigned int CBP, unsigned char *restrict p_ref_block, unsigned char *restrict refU, unsigned char *restrict refV, unsigned int *restrict frame_MV_array, unsigned int *restrict piChromMVArray, unsigned int ref_opt_pitch, unsigned int uv_ref_opt_pitch, short *restrict pError, U8_WMV *restrict reconY, U8_WMV *restrict reconU, U8_WMV *restrict reconV, unsigned int rc__filter_type, unsigned int mb_yx, unsigned int fsize_YX, unsigned char ovt_enabled, unsigned char ubPitchDoubledFlag, tBoundingBoxArrayStruct *pBBoxArray, tBoundingBoxParamsStruct *pBBoxParams, mb_info *pCurMBInfo ); typedef void (* _tFieldInterlaceMC)(unsigned int CBP, unsigned char *restrict refYArray[2], unsigned char *restrict refUArray[2], unsigned char *restrict refVArray[2], unsigned int *restrict frame_MV_array, unsigned int *piChromMVArray, unsigned int ref_opt_pitch[2], unsigned int uv_ref_opt_pitch[2], short *restrict pError, U8_WMV *restrict reconY, U8_WMV *restrict reconU, U8_WMV *restrict reconV, unsigned int rc__filter_type, unsigned int mb_yx, unsigned int fsize_YX, unsigned char ovt_enabled, unsigned char ubHalfPel, tWMVDecInternalMember *pWMVDec, mb_info *pCurMBInfo, tBoundingBoxArrayStruct *pBBoxArray ); void FieldInterlaceMC1MV_TI (unsigned int CBP, unsigned char *restrict refYArray[2], unsigned char *restrict refUArray[2], unsigned char *restrict refVArray[2], unsigned int *restrict frame_MV_array, unsigned int *piChromMVArray, unsigned int ref_opt_pitch[2], unsigned int uv_ref_opt_pitch[2], short *restrict pError, U8_WMV *restrict reconY, U8_WMV *restrict reconU, U8_WMV *restrict reconV, unsigned int rc__filter_type, unsigned int mb_yx, unsigned int fsize_YX, unsigned char ovt_enabled, unsigned char ubHalfpel, tWMVDecInternalMember *pWMVDec, mb_info *pCurMBInfo, tBoundingBoxArrayStruct *pBBoxArray ); void FieldInterlaceMC4MV_TI(unsigned int CBP, unsigned char *restrict refYArray[2], unsigned char *restrict refUArray[2], unsigned char *restrict refV[2], unsigned int *restrict frame_MV_array, unsigned int *piChromMVArray, unsigned int ref_opt_pitch[2], unsigned int uv_ref_opt_pitch[2], short *restrict pError, U8_WMV *restrict reconY, U8_WMV *restrict reconU, U8_WMV *restrict reconV, unsigned int rc__filter_type, unsigned int mb_yx, unsigned int fsize_YX, unsigned char ovt_enabled, unsigned char ubHalfpel, tWMVDecInternalMember *pWMVDec, mb_info *pCurMBInfo, tBoundingBoxArrayStruct *pBBoxArray ); /* Assumptions: * 1) Max 1 row of MB's (ie. the kernel cannot traverse a MB row). * 2) Error data is contagious. (within an MB as well as across MB's) */ unsigned int add_error_nMB(unsigned char *restrict reconY, unsigned char *restrict reconU, unsigned char *restrict reconV, short *pError, mb_info *restrict cur_mb_info, int num_mbs, int pitch_y, int pitch_uv); /* This routine is invoked under the folowing conditions: * * - P frame only: To decode Intra blocks in 4MV MB. * - Can decode 'n' contagious intra blocks. * - Cannot handle both luma and chroma blocks in the same call. * - Size of scratch_buf = tot_blocks * 64 * sizeof(short) * - errBuffer and scratch_buf should be set to zero by the caller. */ int decode_intra_blocks_TI(Err_info * error_info_ptr, mb_info * cur_mb_info, mb_hdr_info * hdr_info, VLD_info * vld_info_ptr, short *restrict errBuffer, short *restrict scratch_buf, unsigned int iMB_YX, short start_blk, short tot_blocks, unsigned int * puiLumMvArray, unsigned int * puiChromMvArray ); void wmv9ACPredAddToACcoeff(Err_info *error_info_ptr, wmvBufAddrStruct *pWmvBufAddrObject, short *pRef_arr[], short *ptop_pred_mb1, const U8_WMV* ZZ_scan_table[], short* DC_coeff_array, short imbX, int mcChannel); tWMVDecodeStatus wmv9ArrangeBlkInto2DArr(wmvBufAddrStruct *pWmvBufAddrObject, tWMVDecInternalMember *pWMVDec, U8_WMV* restrict ppxliTextureQMBY, U8_WMV* restrict ppxliTextureQMBU, U8_WMV* restrict ppxliTextureQMBV, unsigned int dst_pitch_y__uv, mb_info *cur_mb_info, short imbX, int reconChannel, short mbs_in_ocrec_buf ); extern void MB_vld_Xform_intra_pred_ACIn( tWMVDecInternalMember *pWMVDec, mb_info * cur_mb_info, mb_hdr_info * hdr_info, short *restrict pError, unsigned int imb_YX, mb_info *cur_mb_info_top_row ); tWMVDecodeStatus wmv_vld_intra_8x8( unsigned int iCBP,/*|MSB...|b0|b1|b2|b3|b4|b5|*/ Err_info* error_info_ptr, /*Get the DC coefs for each block*/ short* pDC_coeff_array, /*pass all the needed param thru. this struture*/ param_vld_intra_8x8_t* param_vld_intra, /*USe defual scan table if this is set to TRUE*/ int iUse_dflt_scn, short* pRef_arr[], const U8_WMV* pZZ_scan_table[], const unsigned char * pdflt_scn_tbl ); extern S32 VC1VDEC_TI_get_ESC3_rl_len(unsigned int curr_cw, tWMVDecInternalMember *pWMVDec); void switch_acvld_tab_onchip( onChipTablesStruct *pOcTableObject, VLD_info * m_pHufDCTACIntraDec, VLD_info * m_pHufDCTACInterDec); extern int rangeReduction_ap(unsigned char *src, unsigned char *dest, unsigned int size, unsigned int uiRangeMapVal ); extern int doRangeAdjustment_ap( tWMVDecInternalMember *pWMVDec, TI_frame_YUV *src, TI_frame_YUV *dest, unsigned char ubRangeAdjustY, unsigned char ubRangeMapValY, unsigned char ubRangeAdjustUV, unsigned char ubRangeMapValUV, int (* rangeShift) (unsigned char *src, unsigned char *dest, unsigned int numPixels, unsigned int uiRangeVal ) ); extern void endian_swap_buffer(U8_WMV *restrict in_ptr, U8_WMV *restrict opt_ptr, int num_bytes); extern int rangeReduction( unsigned char *src, unsigned char *dest, int size); tWMVDecodeStatus IntensityCompensation ( tWMVDecInternalMember * pWMVDec, unsigned char *restrict pSrcY, unsigned char *restrict pSrcU, unsigned char *restrict pSrcV, unsigned char *restrict pDstY, unsigned char *restrict pDstU, unsigned char *restrict pDstV, int iLuminanceShift, int iLuminanceScale, int iDataReadPitch ); //#define _MCFLOW_DATA /* for enabling efficiency details */ /* used in loops to represent always true condition */ unsigned int MotionCompWithError_B_frm(unsigned char *restrict ref0Y, unsigned char *restrict ref0U, unsigned char *restrict ref0V, unsigned char *restrict ref1Y, unsigned char *restrict ref1U, unsigned char *restrict ref1V, unsigned int *restrict frame_MV_array, unsigned int ref_pitch_0__1, unsigned int uv_ref_pitch_0__1, unsigned int dst_pitch_y__uv, U8_WMV *restrict reconY, U8_WMV *restrict reconU, U8_WMV *restrict reconV, unsigned int rc__filter_type, unsigned int mb_yx, const unsigned int fsize_YX, unsigned int mb_type, unsigned char *cubic_2d_ptrs[], unsigned char *linear_2d_ptrs[], unsigned char *chroma_2d_ptrs[], unsigned char ubField, mb_info *psCurMBInfo, tBoundingBoxArrayStruct *pBBoxArray); tWMVDecodeStatus TI_decodeMBOverheadOfBVOP_WMV3 (tWMVDecInternalMember *pWMVDec, short imbX, short imbY, unsigned char *no_inblk_header, mb_hdr_info *hdr_info, mb_info *cur_mb_info, short mbs_per_row, unsigned int fsize_YX, mb_info *Top_cur_mb_info); tWMVDecodeStatus TI_decodeMBOverheadOfFrameInterlaceBVOP_WMV3( tWMVDecInternalMember *pWMVDec, short imbX, short imbYSlice, unsigned char *no_inblk_header, mb_hdr_info *pMBHdrInfo, mb_info *pMBInfo, short mbs_per_row, unsigned fsize_YX, mb_info *Top_cur_mb_info ); tWMVDecodeStatus TI_decodeMBOverheadOfFieldInterlaceBVOP_WMV3 ( tWMVDecInternalMember *pWMVDec, short imbX, short imbYSlice, unsigned char *no_inblk_header, mb_hdr_info *pMBHdrInfo, mb_info *pMBInfo, short mbs_per_row, unsigned fsize_YX, unsigned char ubMvsPerMB, unsigned char ubHalfPel, mb_info *top_pMBInfo ); void SetCurrAndRefPointersWMVA(tWMVDecInternalMember *pWMVDec, void *frm_id); char rangeAdjustAndDisplayWMVA(tWMVDecInternalMember *pWMVDec); void bilinear_bpred( unsigned char *frame_ptr_arr_cn[], unsigned int pitch_0__1, int dst_pitch, int num_MBs, int h, unsigned R, unsigned char *restrict tmp_buf); void bicubic_bpred(unsigned char *frm_ptr_arr[], unsigned int ref_pitch_0__1, unsigned int dst_pitch, int num_MB, short height, short roundControl, char filter_ptr[3][5], char *restrict shiftArray, short *restrict temp_buf); /* ========================================================================= */ /* ******************************************************************************** * C64+ Based VC1 (SMPTE421M) Decoder * * "C64+ Based VC1 (SMPTE421M) Decoder" is a software module * developed for TI's c64x+ based SOCs. This module is capable of generating a * raw 4:2:0 video data by de-compressing/decoding VC1 bit-streams based on * SMPTE 421M. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ * ALL RIGHTS RESERVED ******************************************************************************** */ /** ******************************************************************************** * @file vc1vdec_ti_huffdec_wmv.h * * @brief This File contains functions related to Huffman table decoding. * * @version 1.0 : Base version Created * * @version 1.1 (8th Oct 2003) : Added performing VLD function for intra MB's * (I and P frames) * @author S. Shirdhonkar * * @version 1.2 (April 2011) : Coding guidelines and commenting * @author Rama Mohana Reddy * ******************************************************************************* */ /* -----------------compilation control switches ----------------------------*/ /* For WMV3 only. */ #pragma CODE_SECTION( VC1VDEC_TI_gen_ESC3_rl_len, ".text:pfrm_dec_loop:VC1VDEC_TI_gen_ESC3_rl_len") #pragma CODE_SECTION(VC1VDEC_TI_Huff_WMV_get, ".text:pfrm_dec_loop:VC1VDEC_TI_Huff_WMV_get"); /** * Check whether allocated memory is out of memory or not */ /****************************************************************************** * INCLUDE FILES ******************************************************************************/ /*-------------------------------program files ------------------------------*/ /** ******************************************************************************** * @fn VC1VDEC_TI_get_ESC3_rl_len (unsigned curr_cw, * tWMVDecInternalMember *pWMVDec) * @brief Generates run and level values. * * @param [in] curr_cw : Current word of bitstream * * @param [out] pWMVDec : Pointer to a tWMVDecInternalMember * * @return Int (returns consumed bits) ******************************************************************************** */ int VC1VDEC_TI_get_ESC3_rl_len (unsigned curr_cw, tWMVDecInternalMember *pWMVDec); /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_construct(Huffman_WMV * pThis) * @brief Initialization of Null values to all decode tables and * huffman table entries. * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * * @return Int (returns consumed bits) ******************************************************************************** */ Void_WMV VC1VDEC_TI_Huff_WMV_construct(Huffman_WMV * pThis); /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_findTables( * tWMVDecInternalMember *pWMVDec, * Huffman_WMV * pThis, * I32_WMV* ptotalTableNum, * I32_WMV *maxBits, * I32_WMV iMAX_STAGES) * @brief This function finds the huffman decode tables. * * @param [in,out] pWMVDec : Pointer to a tWMVDecInternalMember * structure. * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * @param [out] ptotalTableNum : Pointer to a number of Huffman tables * * @param [in] maxBits : Maximum number of bits for each stage * * @param [in] iMAX_STAGES : Maximum number of stages. * * @return Enum type (returns found error or not) ******************************************************************************** */ VResultCode VC1VDEC_TI_Huff_WMV_findTables( tWMVDecInternalMember *pWMVDec, Huffman_WMV * pThis, I32_WMV* ptotalTableNum, I32_WMV *maxBits, I32_WMV iMAX_STAGES); /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_allocTables( * tWMVDecInternalMember * pWMVDec, * Huffman_WMV * pThis, I32_WMV numTables) * @brief This function allocates memory for the huffman decode tables. * * @param [in,out] pWMVDec : Pointer to a tWMVDecInternalMember * structure. * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * @param [in] numTables : Number of huffman tables * * @return Enum type (returns found error or not) ******************************************************************************** */ VResultCode VC1VDEC_TI_Huff_WMV_allocTables( tWMVDecInternalMember * pWMVDec, Huffman_WMV * pThis, I32_WMV numTables); /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_fillEntry(Huffman_WMV * pThis, * I32_WMV cwd, * I32_WMV length, * I32_WMV tableNum, * I32_WMV index, * HuffDecInfo *currDecTable) * @brief This function fills Huffman table entries. * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * @param [in] cwd : Current word from the bitstream * * @param [in] length : Code word length * * @param [in] tableNum : Table number is zero (0 always) * * @param [in] index : Alphabetsize index value. * * @param [out] currDecTable : Pointer to the decoder tables filled with length and indexes. * * @return None ******************************************************************************** */ void VC1VDEC_TI_Huff_WMV_fillEntry(Huffman_WMV * pThis, I32_WMV cwd, I32_WMV length, I32_WMV tableNum, I32_WMV index, HuffDecInfo *currDecTable); /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_init( tWMVDecInternalMember * pWMVDec, * Huffman_WMV * pThis, * const tPackHuffmanCode_WMV huffArray[], * I32_WMV *maxBits, * I32_WMV iMAX_STAGES ) * @brief This function performs initialization of Huffman tables. * * @param [in,out] pWMVDec : Pointer to a tWMVDecInternalMember * structure * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * @param [in] huffArray[] : Array of huffman tables * * @param [in] maxBits : Maximum number of bits for each stage * * @param [in] iMAX_STAGES : Maximum number of stages. * * @return Enum type (returns found error or not) ******************************************************************************** */ VResultCode VC1VDEC_TI_Huff_WMV_init( tWMVDecInternalMember * pWMVDec, Huffman_WMV * pThis, const tPackHuffmanCode_WMV huffArray[], I32_WMV *maxBits, I32_WMV iMAX_STAGES ); /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_get(Huffman_WMV * pThis, * CInputBitStream_WMV *bs) * @brief This function gets the code words form huffman tables. * * @param [in,out] pThis : Pointer to the Huffman_WMV structure * * @param [in] bs : Pointer to the bitstream * * @return Int (returns symbol value) ******************************************************************************** */ I32_WMV VC1VDEC_TI_Huff_WMV_get(Huffman_WMV * pThis, CInputBitStream_WMV *bs); /** ******************************************************************************** * @fn VC1VDEC_TI_getHuffman(CInputBitStream_WMV *bs, * TableInfo *tableInfo, * HuffDecInfo *decTable) * @brief This function gets the code words form huffman tables. * * @param [in] bs : Pointer to the bitstream * * @param [in,out] tableInfo : Pointer to the Huffman Table information * * @param [in,out] decTable : Pointer to the Huffman decode symbol and * length information * * @return Int (returns symbol value) ******************************************************************************** */ U32_WMV VC1VDEC_TI_getHuffman(CInputBitStream_WMV *bs, TableInfo *tableInfo, HuffDecInfo *decTable ); /** * Maximum number of Decode tables */ /** * Uncached stage base */ /** * Multiplication of decode base offset and twice the maximum number of stages */ /*! \struct InitEncInfo * This structure contains all the parameters regarding encoded * code value, length and table information. */ typedef struct { /*! Code word */ U32_WMV code; /*! Number of bits in the code word */ U32_WMV length; /*! Encoded table information */ U32_WMV table; } InitEncInfo; /*---------------------------------------------------------------------------*/ /* End of vc1vdec_ti_huffdec_wmv.h */ /*===========================================================================*/ /* Texas Instruments Incorporated 2010. */ /*---------------------------------------------------------------------------*/ VResultCode VC1VDEC_TI_Huff_WMV_findTables(tWMVDecInternalMember *pWMVDec, Huffman_WMV *pThis, I32_WMV* ptotalTableNum, I32_WMV *maxBits, I32_WMV iMAX_STAGES); VResultCode VC1VDEC_TI_Huff_WMV_allocTables (tWMVDecInternalMember * pWMVDec, Huffman_WMV * pThis, S32 numTables); void VC1VDEC_TI_Huff_WMV_fillEntry(Huffman_WMV * pThis, S32 cwd, S32 length, S32 tableNum, S32 index, HuffDecInfo *currDecTable); #pragma CODE_SECTION( VC1VDEC_TI_get_ESC3_rl_len, ".text:pfrm_dec_loop:VC1VDEC_TI_get_ESC3_rl_len"); U32_WMV uiNum_Bits_array[32] = { 0x1, 0x2, 0x4, 0x8, 0x10,0x20,0x40,0x80, 0x100,0x200,0x400,0x800, 0x1000,0x2000,0x4000,0x8000, 0x10000,0x20000,0x40000,0x80000, 0x100000,0x200000,0x400000,0x800000, 0x1000000,0x2000000,0x4000000,0x8000000, 0x10000000,0x20000000,0x40000000,0x80000000 }; S32 VC1VDEC_TI_get_ESC3_rl_len(unsigned curr_cw, tWMVDecInternalMember *pWMVDec) { S32 bits_consumed = 0, e3_lvl_len = 0, e3_run_len = 0; if(pWMVDec->m_iStepSize >= 8 && (((pWMVDec->m_tFrmType == IVOP || pWMVDec->m_tFrmType == BIVOP) && pWMVDec->m_iWMV3Profile != WMV3_ADVANCED_PROFILE)|| !pWMVDec->m_bDQuantOn)) { S32 iBitsCnt = 0, iBit = 0; while (iBitsCnt < 6 && !iBit) { iBit = (unsigned)curr_cw >> 31; curr_cw <<= 1; iBitsCnt++; } bits_consumed = iBitsCnt; if (iBit) { /* from 2-7 */ e3_lvl_len = iBitsCnt + 1; } else { /* from 2-7 */ e3_lvl_len = 8; } } else { e3_lvl_len = (unsigned)curr_cw >> 29; curr_cw <<= 3; bits_consumed += 3; if (!e3_lvl_len) { e3_lvl_len = 8 + ( (unsigned)curr_cw >> 30); curr_cw <<= 2; bits_consumed += 2; } } e3_run_len = 3 + ( (unsigned)curr_cw >> 30 ); bits_consumed += 2; /*------------------------------------------------------------------------*/ /* Set the run and level length values for all VLD_info structures. */ /*------------------------------------------------------------------------*/ { vldInfoStruct *pVldInfoObject = (vldInfoStruct *)pWMVDec->pVldInfoObject; onChipTablesStruct *pOcTableObject = (onChipTablesStruct *)pWMVDec->pOcTableObject; pVldInfoObject->vld_tab_info_MMIDRATE_Intra.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_MMIDRATE_Inter.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_HghMt_Intra.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_HghMt_Inter.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_HghRate_Intra.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_HghRate_Inter.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_Talking_Intra.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_Talking_Inter.e3_run_len = e3_run_len; pOcTableObject->onchip_accoeffintratab_vldinfo.e3_run_len = e3_run_len; pOcTableObject->onchip_accoeffintertab_vldinfo.e3_run_len = e3_run_len; pVldInfoObject->vld_tab_info_MMIDRATE_Intra.e3_lvl_len = e3_lvl_len; pVldInfoObject->vld_tab_info_MMIDRATE_Inter.e3_lvl_len = e3_lvl_len; pVldInfoObject->vld_tab_info_HghMt_Intra.e3_lvl_len = e3_lvl_len; pVldInfoObject->vld_tab_info_HghMt_Inter.e3_lvl_len = e3_lvl_len; pVldInfoObject->vld_tab_info_HghRate_Intra.e3_lvl_len = e3_lvl_len; pVldInfoObject->vld_tab_info_HghRate_Inter.e3_lvl_len = e3_lvl_len; pVldInfoObject->vld_tab_info_Talking_Intra.e3_lvl_len = e3_lvl_len; pVldInfoObject->vld_tab_info_Talking_Inter.e3_lvl_len = e3_lvl_len; pOcTableObject->onchip_accoeffintratab_vldinfo.e3_lvl_len = e3_lvl_len; pOcTableObject->onchip_accoeffintertab_vldinfo.e3_lvl_len = e3_lvl_len; /*--------------------------------------------------------------------*/ /* Set first ESC3 code found to true. */ /*--------------------------------------------------------------------*/ pVldInfoObject->vld_tab_info_MMIDRATE_Intra.first_e3_found = 1; pVldInfoObject->vld_tab_info_MMIDRATE_Inter.first_e3_found = 1; pVldInfoObject->vld_tab_info_HghMt_Intra.first_e3_found = 1; pVldInfoObject->vld_tab_info_HghMt_Inter.first_e3_found = 1; pVldInfoObject->vld_tab_info_HghRate_Intra.first_e3_found = 1; pVldInfoObject->vld_tab_info_HghRate_Inter.first_e3_found = 1; pVldInfoObject->vld_tab_info_Talking_Intra.first_e3_found = 1; pVldInfoObject->vld_tab_info_Talking_Inter.first_e3_found = 1; pOcTableObject->onchip_accoeffintratab_vldinfo.first_e3_found = 1; pOcTableObject->onchip_accoeffintertab_vldinfo.first_e3_found = 1; } return(bits_consumed); } /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_construct(Huffman_WMV * pThis) * @brief Initialization of Null values to all decode tables and * huffman table entries. * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * * @return Int (returns consumed bits) ******************************************************************************** */ void VC1VDEC_TI_Huff_WMV_construct(Huffman_WMV * pThis) { pThis->m_tableInfo = 0; pThis->m_initInfo = 0; pThis->m_encInfo = 0; pThis->m_decInfo = 0; pThis->m_alphabetSize = 0; pThis->m_maxCodeLength = 0; pThis->m_allocDecEntries=0; pThis->m_allocTables=0; } /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_init( tWMVDecInternalMember * pWMVDec, * Huffman_WMV * pThis, * const tPackHuffmanCode_WMV huffArray[], * I32_WMV *maxBits, * I32_WMV iMAX_STAGES ) * @brief This function performs initialization of Huffman tables. * * @param [in,out] pWMVDec : Pointer to a tWMVDecInternalMember * structure * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * @param [in] huffArray[] : Array of huffman tables * * @param [in] maxBits : Maximum number of bits for each stage * * @param [in] iMAX_STAGES : Maximum number of stages. * * @return Enum type (returns found error or not) ******************************************************************************** */ VResultCode VC1VDEC_TI_Huff_WMV_init(tWMVDecInternalMember * pWMVDec, Huffman_WMV * pThis, const tPackHuffmanCode_WMV *huffArray, I32_WMV *maxBits, I32_WMV iMAX_STAGES) { VResultCode vr; S32 i, j, numTables; pThis->m_maxCodeLength = 0; pThis->m_alphabetSize = huffArray[0].code; huffArray += 1; pThis->m_encInfo = huffArray; pThis->m_maxCodeLength = 0; for (j=0; jm_alphabetSize; j++) { if ((U32)pThis->m_encInfo[j].length > (U32_WMV)pThis->m_maxCodeLength) { pThis->m_maxCodeLength = pThis->m_encInfo[j].length; } } if(pThis->m_alphabetSize > (1<<12)) { return vrFail; } for(i=0;i<6;i++) { pThis->stage_size[i]=0; } { unsigned char *addrBegin; unsigned int allocSize; addrBegin = pWMVDec->buffer[ ((2))]. addr; allocSize = ((sizeof (TableInitInfo) * 1000)); if( pWMVDec->buffer[((2))]. freeSpace < allocSize) { _assert((1) != 0, "Assertion failed, (" "1" "), file " "..\\..\\..\\..\\Src\\Common\\vc1vdec_ti_huffdec_wmv.c" ", line " "262" "\n"); } pThis->m_initInfo = (TableInitInfo*) addrBegin; pWMVDec->buffer[ ((2))]. addr += allocSize; pWMVDec->buffer[ ((2))]. freeSpace -= allocSize; }; /*------------------------------------------------------------------------*/ /* Find the # of decoder tables we will need */ /*------------------------------------------------------------------------*/ vr = VC1VDEC_TI_Huff_WMV_findTables(pWMVDec, pThis, &numTables, maxBits, iMAX_STAGES); if(vr != vrNoError) { goto lerror; } /*------------------------------------------------------------------------*/ /* Allocate tables */ /*------------------------------------------------------------------------*/ vr = VC1VDEC_TI_Huff_WMV_allocTables(pWMVDec,pThis,numTables); if (vr != vrNoError) { goto lerror; } /*------------------------------------------------------------------------*/ /* Now we are done with table info and can delete it */ /*------------------------------------------------------------------------*/ { unsigned int allocSize; allocSize = ((sizeof (TableInitInfo) * 1000)); pWMVDec->buffer[ ((2))]. addr -= allocSize; pThis->m_initInfo = (TableInitInfo*) 0; pWMVDec->buffer[ ((2))]. freeSpace += allocSize; }; for (i=0; im_alphabetSize; i++) { if(pThis->m_decInfo == 0) { return vrFail; } VC1VDEC_TI_Huff_WMV_fillEntry(pThis, pThis->m_encInfo[i].code , pThis->m_encInfo[i].length , 0, i, pThis->m_decInfo); } return vrNoError; lerror: { unsigned int allocSize; allocSize = ((sizeof (TableInitInfo) * 1000)); pWMVDec->buffer[ ((2))]. addr -= allocSize; pThis->m_initInfo = (TableInitInfo*) 0; pWMVDec->buffer[ ((2))]. freeSpace += allocSize; }; return vr; } /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_findTables( * tWMVDecInternalMember *pWMVDec, * Huffman_WMV * pThis, * I32_WMV* ptotalTableNum, * I32_WMV *maxBits, * I32_WMV iMAX_STAGES) * @brief This function finds the huffman decode tables. * * @param [in,out] pWMVDec : Pointer to a tWMVDecInternalMember * structure. * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * @param [out] ptotalTableNum : Pointer to a number of Huffman tables * * @param [in] maxBits : Maximum number of bits for each stage * * @param [in] iMAX_STAGES : Maximum number of stages. * * @return Enum type (returns found error or not) ******************************************************************************** */ static VResultCode VC1VDEC_TI_Huff_WMV_findTables(tWMVDecInternalMember*pWMVDec, Huffman_WMV *pThis, I32_WMV* ptotalTableNum, I32_WMV *maxBits, I32_WMV iMAX_STAGES) { S32 i, j, stage, tableNum, start, end, prefix, excessBits, nextTable; S32 totalTableNum; InitEncInfo *initEncInfo = 0; S32 myMaxBits[10]; S32 found; totalTableNum=0; /*------------------------------------------------------------------------*/ /* Set # of bits for each stage */ /*------------------------------------------------------------------------*/ if (maxBits == 0) { iMAX_STAGES = 3; myMaxBits[0] = 10; myMaxBits[1] = 11; myMaxBits[2] = pThis->m_maxCodeLength - (myMaxBits[0] + myMaxBits[1]); } else { for (i=0; ibuffer[ ((2))]. addr; allocSize = ((sizeof (InitEncInfo) * pThis->m_alphabetSize)); if( pWMVDec->buffer[((2))]. freeSpace < allocSize) { _assert((1) != 0, "Assertion failed, (" "1" "), file " "..\\..\\..\\..\\Src\\Common\\vc1vdec_ti_huffdec_wmv.c" ", line " "360" "\n"); } initEncInfo = (InitEncInfo*) addrBegin; pWMVDec->buffer[ ((2))]. addr += allocSize; pWMVDec->buffer[ ((2))]. freeSpace -= allocSize; }; if(1000 > (1<<16)) { return vrFail; } for (i=0; im_alphabetSize; i++) { initEncInfo[i].code = pThis->m_encInfo[i].code ; initEncInfo[i].length = pThis->m_encInfo[i].length ; initEncInfo[i].table = 0; } pThis->m_initInfo[0].maxBits = pThis->m_maxCodeLength; for (i=1; i<1000; i++) { pThis->m_initInfo[i].maxBits = 0; } totalTableNum = 1; end = 0; for (stage=0; stagestage_size[stage]=totalTableNum; for (tableNum=start; tableNumm_initInfo[tableNum].start = totalTableNum; pThis->m_initInfo[tableNum].end = pThis->m_initInfo[tableNum].start; if (pThis->m_initInfo[tableNum].maxBits <= myMaxBits[stage]) { pThis->m_initInfo[tableNum].bits = pThis->m_initInfo[tableNum].maxBits; continue; } else { pThis->m_initInfo[tableNum].bits = myMaxBits[stage]; } for (i=0; im_alphabetSize; i++) { if (initEncInfo[i].table == (U32_WMV)tableNum) { if (initEncInfo[i].length > (U32_WMV)pThis->m_initInfo[tableNum].bits) { excessBits = initEncInfo[i].length - pThis->m_initInfo[tableNum].bits; prefix = (initEncInfo[i].code >> excessBits); initEncInfo[i].length = excessBits; initEncInfo[i].code &= GetMask_WMV[excessBits]; found = 0; for (j=pThis->m_initInfo[tableNum].start; jm_initInfo[tableNum].end; j++) { if (pThis->m_initInfo[j].prefix == prefix) { found = 1; if (excessBits > pThis->m_initInfo[j].maxBits) { pThis->m_initInfo[j].maxBits = excessBits; } nextTable = j; break; } } if (!found) { if(totalTableNum >= 1000) { return vrFail; } pThis->m_initInfo[tableNum].end++; pThis->m_initInfo[totalTableNum].prefix = prefix; pThis->m_initInfo[totalTableNum].maxBits = excessBits; nextTable = totalTableNum; (totalTableNum)++; } initEncInfo[i].table = nextTable; } } } } } if(initEncInfo != 0) { ; } { unsigned int allocSize; allocSize = ((sizeof (InitEncInfo) * pThis->m_alphabetSize)); pWMVDec->buffer[ ((2))]. addr -= allocSize; initEncInfo = (InitEncInfo*) 0; pWMVDec->buffer[ ((2))]. freeSpace += allocSize; }; *ptotalTableNum = totalTableNum; return vrNoError; } /** ******************************************************************************** * @fn VC1VDEC_TI_Huff_WMV_allocTables( * tWMVDecInternalMember * pWMVDec, * Huffman_WMV * pThis, S32 numTables) * @brief This function allocates memory for the huffman decode tables. * * @param [in,out] pWMVDec : Pointer to a tWMVDecInternalMember * structure. * * @param [in,out] pThis : Pointer to a Huffman_WMV structure * * @param [in] numTables : Number of huffman tables * * @return Enum type (returns found error or not) ******************************************************************************** */ static VResultCode VC1VDEC_TI_Huff_WMV_allocTables( tWMVDecInternalMember *pWMVDec, Huffman_WMV * pThis, S32 numTables) { VResultCode vr; S32 i, j; S32 stage = 0; if (numTables > pThis->m_allocTables) { pThis->m_allocTables = numTables; { unsigned char *addrBegin; unsigned int allocSize; addrBegin = pWMVDec->buffer[ ((3))]. addr; allocSize = ((sizeof (TableInfo) * pThis->m_allocTables)); if( pWMVDec->buffer[((3))]. freeSpace < allocSize) { _assert((1) != 0, "Assertion failed, (" "1" "), file " "..\\..\\..\\..\\Src\\Common\\vc1vdec_ti_huffdec_wmv.c" ", line " "500" "\n"); } pThis->m_tableInfo = (TableInfo*) addrBegin; pWMVDec->buffer[ ((3))]. addr += allocSize; pWMVDec->buffer[ ((3))]. freeSpace -= allocSize; }; } pThis->m_numDecEntries = 0; for (i=0; im_numDecEntries += 1<m_initInfo[i].bits; if((i+1)==pThis->stage_size[stage]) { pThis->stage_size[stage]=pThis->m_numDecEntries; stage++; } } for(i=stage;i<6;i++) { pThis->stage_size[i]=pThis->m_numDecEntries; } if (pThis->m_numDecEntries > pThis->m_allocDecEntries) { /* support reinitialisation */ pThis->m_allocDecEntries = pThis->m_numDecEntries; { unsigned char *addrBegin; unsigned int allocSize; addrBegin = pWMVDec->buffer[ ((3))]. addr; allocSize = ((sizeof (HuffDecInfo) * pThis->m_allocDecEntries)); if( pWMVDec->buffer[((3))]. freeSpace < allocSize) { _assert((1) != 0, "Assertion failed, (" "1" "), file " "..\\..\\..\\..\\Src\\Common\\vc1vdec_ti_huffdec_wmv.c" ", line " "532" "\n"); } pThis->m_decInfo = (HuffDecInfo*) addrBegin; pWMVDec->buffer[ ((3))]. addr += allocSize; pWMVDec->buffer[ ((3))]. freeSpace -= allocSize; }; /*--------------------------------------------------------------------*/ /* set everything to -1 for mpeg4 tables because there are illegal */ /* entries in mpeg4 table, this way, we can detect bad data. */ /*--------------------------------------------------------------------*/ for (i = 0; i < pThis->m_allocDecEntries; i++) { pThis->m_decInfo[i].symbol = 4095; pThis->m_decInfo[i].length = 0; } } pThis->m_numDecEntries = 0; for (i=0; im_tableInfo[i].bits = pThis->m_initInfo[i].bits; pThis->m_tableInfo[i].table = pThis->m_decInfo+pThis->m_numDecEntries; /*--------------------------------------------------------------------*/ /* This part of code will work */ /*--------------------------------------------------------------------*/ #if 0 if(pThis->m_initInfo[i].bits == 1) { pThis->m_numDecEntries += 2; } else if(pThis->m_initInfo[i].bits == 2) { pThis->m_numDecEntries += 4; } else if(pThis->m_initInfo[i].bits == 3) { pThis->m_numDecEntries += 8; } else if(pThis->m_initInfo[i].bits == 4) { pThis->m_numDecEntries += 16; } else if(pThis->m_initInfo[i].bits == 5) { pThis->m_numDecEntries += 32; } else if(pThis->m_initInfo[i].bits == 6) { pThis->m_numDecEntries += 64; } else /* Max number of bits possible is 6 at present */ { pThis->m_numDecEntries += 1<m_initInfo[i].bits; } #else /*--------------------------------------------------------------------*/ /* This part of code will not work */ /*--------------------------------------------------------------------*/ pThis->m_numDecEntries += 1<m_initInfo[i].bits; #endif for (j=pThis->m_initInfo[i].start; jm_initInfo[i].end; j++) { (pThis->m_tableInfo[i].table)[pThis->m_initInfo[j].prefix].symbol = (U16_WMV) j; (pThis->m_tableInfo[i].table)[pThis->m_initInfo[j].prefix].length = 0; } if ( (unsigned)pThis->m_initInfo[i].end >= (1U<<12) ) { if( (unsigned)pThis->m_initInfo[i].end >= (1U<<12)) { return vrFail; } vr = vrOutOfBounds; goto lerror; } } return vrNoError; lerror: return vr; } void VC1VDEC_TI_Huff_WMV_fillEntry(Huffman_WMV * pThis, S32 cwd, S32 length, S32 tableNum, S32 index, HuffDecInfo *currDecTable) { S32 start, end, excessBits, j, prefix; S32 iMaxSymbol = 0, iMaxLength = 0; if (length == 0) { return; } while (1) { if(pThis->m_tableInfo[tableNum].bits >= (1<<4)) { tWMVDecInternalMember *pWMVDec = pThis->pWMVDec; /*----------------------------------------------------------------*/ /* internal error - during Huffman_WMV_fillEntry 1 */ /*----------------------------------------------------------------*/ pWMVDec->errorCode = WMVDEC_internalErrorHWFE1; } if (length <= pThis->m_tableInfo[tableNum].bits) { excessBits = pThis->m_tableInfo[tableNum].bits - length; start = cwd << excessBits; end = start + (1 << excessBits); for (j=start; jm_tableInfo[tableNum].bits; prefix = cwd >> excessBits; if(currDecTable[prefix].length != 0) { tWMVDecInternalMember *pWMVDec = pThis->pWMVDec; /*------------------------------------------------------------*/ /* internal error - during Huffman_WMV_fillEntry 2 */ /*------------------------------------------------------------*/ pWMVDec->errorCode = WMVDEC_internalErrorHWFE2; return ; } tableNum = currDecTable[prefix].symbol; /*----------------------------------------------------------------*/ /* take excessBits LSB's */ /*----------------------------------------------------------------*/ cwd = cwd & GetMask_WMV[excessBits]; length = excessBits; currDecTable = pThis->m_tableInfo[tableNum].table; } } } #pragma CODE_SECTION(VC1VDEC_TI_Huff_WMV_get, ".text:pfrm_dec_loop:VC1VDEC_TI_Huff_WMV_get"); S32 VC1VDEC_TI_Huff_WMV_get(Huffman_WMV * pThis, CInputBitStream_WMV *bs) { S32 index, tableNum = 0; const HuffDecInfo *decTable = pThis->m_decInfo; /*------------------------------------------------------------------------*/ /* Dt: 11-10-2003. Sada: */ /* Assumptions: */ /* - Here we make an assumption that all codewords are less than 32 bits. */ /* Else this function will fail. */ /* - Length will never be negative. */ /* - Number of tables present is alway less than 256. This also has */ /* speculative */ /* load implications (upto pThis->m_tableInfo[255] can be loaded..) */ /*------------------------------------------------------------------------*/ U32 curr_cw, cw2, append_cw1; U32 err_flg = 0, found_sym = 0; S32 len, sym, shift, bs_bits_left, bits_consumed = 0, check_bits; U32 *bs_buffer, next_cw; curr_cw = bs->m_fullWord; cw2 = bs->m_fillerWord; bs_bits_left = bs->m_BitsLeft; bs_buffer = bs->m_pBuffer; while( !found_sym ) { check_bits = pThis->m_tableInfo[tableNum].bits; index = curr_cw >> (32 - check_bits); len = decTable[index].length; sym = decTable[index].symbol; found_sym = len; /*--------------------------------------------------------------------*/ /* For error checking.. Use OR so as not to miss bit-stream error at */ /* any stage. */ /*--------------------------------------------------------------------*/ err_flg |= (sym == 4095); /*--------------------------------------------------------------------*/ /* Speculative execution.. Assuming tableNum is always less than 0xFF. */ /*--------------------------------------------------------------------*/ decTable = pThis->m_tableInfo[sym & 0xFF].table; if(len > 0) { shift = len; } else { shift = check_bits; tableNum = sym; } curr_cw <<= shift; bits_consumed += shift; } append_cw1 = cw2 << (32 - bs_bits_left); bs_bits_left -= bits_consumed; curr_cw |= append_cw1 >> (32 - bits_consumed); next_cw = *bs_buffer++; if( bs_bits_left <= 0 ) { bs->m_fillerWord = next_cw; bs->m_pBuffer = bs_buffer; bs_bits_left += 32; curr_cw |= next_cw >> bs_bits_left; } bs->m_fullWord = curr_cw; bs->m_BitsLeft = bs_bits_left; /*------------------------------------------------------------------------*/ /* Report Error. */ /*------------------------------------------------------------------------*/ if( err_flg ) { bs->m_fStreamStaus = 3; } return(sym); }