733 lines
33 KiB
C
Executable File
733 lines
33 KiB
C
Executable File
/* Copyright (c) 2006 NVIDIA Corporation. All rights reserved.
|
|
*
|
|
* NVIDIA Corporation and its licensors retain all intellectual property
|
|
* and proprietary rights in and to this software, related documentation
|
|
* and any modifications thereto. Any use, reproduction, disclosure or
|
|
* distribution of this software and related documentation without an
|
|
* express license agreement from NVIDIA Corporation is strictly prohibited.
|
|
*/
|
|
|
|
/** @file GFMxDecVC1.h
|
|
GFSDK VC1 Decode API header file.
|
|
*/
|
|
|
|
#ifndef _GF_MPEG_DEC_VC1__
|
|
#define _GF_MPEG_DEC_VC1__
|
|
|
|
#include "nvtypes.h"
|
|
#include "GFVx.h"
|
|
#include "GFDef.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" { // only need to export C interface if
|
|
// used by C++ source code
|
|
#endif
|
|
|
|
/** @addtogroup groupMxDecVC1 MxDecVC1API VC1 Decode API
|
|
The VC1 decoder API handles WMV simple profile-compliant bit
|
|
streams for this version, but has been defined to handle all of the three
|
|
profiles for future expansion.
|
|
|
|
The VC1 decoder API has two sets of API—a high level API and a low
|
|
level API.
|
|
|
|
<b>Using the High Level API</b>
|
|
|
|
The high level API has a built-in entropy decoder. It decodes the bit stream.
|
|
This high level API calls the low level API internally. When using the high level API, the
|
|
application can ignore the low level API.
|
|
|
|
The MxDecVC1API high level functions include the following:
|
|
- GFMxDecVC1DecSequenceLayer()
|
|
- GFMxDecVC1DecPicture()
|
|
- GFMxDecVC1Set()
|
|
|
|
<b>Using the Low Level API</b>
|
|
|
|
The low level API is essentially a macroblock decoder engine. It decodes
|
|
macroblock by macroblock. When using the low level API, the application
|
|
needs to handle the entropy decoding. The low level
|
|
API assumes that the information passed from caller is correct, and does not
|
|
have any error concealment functionality build in. The application which
|
|
called the low level API must make sure that no macroblocks are missing for
|
|
any picture.
|
|
|
|
The MxDecVC1API low level functions include the following:
|
|
- GFMxDecVC1SetPicture()
|
|
- GFMxDecVC1SetMBs()
|
|
- GFMxDecVC1SetPicture()
|
|
|
|
<ul>
|
|
<li> @ref pageMxDecVC1AppNotes
|
|
<ul>
|
|
<li> @ref pageMxDecVC1AppNotes1
|
|
</ul>
|
|
</ul>
|
|
*/
|
|
/*@{*/
|
|
|
|
// MXDECVC1CapFlags
|
|
|
|
/** MxDecVC1API property flag: Simple profile supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_SIMPLE 0x00000001
|
|
|
|
/** MxDecVC1API property flag: Main profile supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_MAIN 0x00000002
|
|
|
|
/** MxDecVC1API property flag: Extended profile supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_ADVANCE 0x00000004
|
|
|
|
/** MxDecVC1API property flag: Low LEVEL supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_LOWLEVEL 0x00000008
|
|
|
|
/** MxDecVC1API property flag: Medium LEVEL supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_MEDIUMLEVEL 0x00000010
|
|
|
|
/** MxDecVC1API property flag: High LEVEL supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_HIGHLEVEL 0x00000100
|
|
|
|
/** MxDecVC1API property flag: LEVEL 0 supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_LEVEL0 0x00000200
|
|
|
|
/** MxDecVC1API property flag: LEVEL 1 supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_LEVEL1 0x00000400
|
|
|
|
/** MxDecVC1API property flag: LEVEL 2 supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_LEVEL2 0x00000800
|
|
|
|
/** MxDecVC1API property flag: LEVEL 3 supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_LEVEL3 0x00001000
|
|
|
|
/** MxDecVC1API property flag: LEVEL 4 supported.
|
|
@see GFMxDecVC1GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_VC1_CAP_LEVEL4 0x00002000
|
|
|
|
|
|
/**Enable the DSP side profiling */
|
|
//#define GF_ENABLE_PROFILER 1
|
|
|
|
// to divert the code for checking the non-working of hw modules as of now
|
|
#define USE_HW_MODULES
|
|
|
|
/** Parameter structure for MxDecVC1DecSequenceLayer().
|
|
Both input and output parameters are passed via this structure to MxDecVC1DecSequenceLayer().
|
|
@see MxDecVC1DecSequenceLayer()
|
|
*/
|
|
|
|
|
|
typedef struct _GFMXDECVC1DECSEQUENCELAYER
|
|
{
|
|
|
|
NvU32 uiSequenceOption; /**< Input flags, see GFMXDECVC1_DECSEQUENCEOPTION_* */
|
|
NvU8 ucSequenceLayerInfo; /**< SequenceLayerInfo Definition */
|
|
NvU16 usWidth; /**< Horizontal size of the coded picture in pixels */
|
|
NvU16 usHeight; /**< Vertical size of the coded picture in pixels */
|
|
NvU8 ucProfile; /**< Profile of the sequence */
|
|
NvU8 ucLevel; /**< Level of the sequence */
|
|
NvU32 uiHRDRate; /**< Peak transmission rate R in bits per second */
|
|
NvU32 uiHRDBufferSize; /**< Buffer size B in milliseconds. */
|
|
NvU32 uiFrameRate; /**< Rounding frame rate of the encoded clips */
|
|
NvU8* pPreFillBuffer; /**< Input, Pointer bitstream for sequence header to decode */
|
|
NvU32 PreFillBufferLength; /**< Input, Length of bitstream in bytes, must cover the entire sequence header */
|
|
NvU32 PreFillBufferBytesConsumed;/**< Output, Amount of bytes consumed by the component */
|
|
|
|
} GFMXDECVC1DECSEQUENCELAYER, *PGFMXDECVC1DECSEQUENCELAYER;
|
|
|
|
//SequenceLayerInfo:
|
|
#define MXDEC_VC1_CONSTANT_BITRATE 0x00000001 /**< Flag is set when the sequence is encoded at constant bitrate */
|
|
#define MXDEC_VC1_MULTIRESOLUTION 0x00000002 /**< Flag indicating that the frames can be coded at smaller */
|
|
//resolution. Resolution change is allowed only on I pictures.
|
|
//Information of the picture
|
|
|
|
/** GFMXDECVC1DECSEQUENCELAYER::uiSequenceOption input flagbit: Bitstream is passed with GFMxDecVC1DecSequenceLayer().
|
|
If this flag is set bitstream data is passed with the call to GFMxDecVC1DecSequenceLayer()
|
|
instead via the read bitstrem callback. This can be used only with boundary detection
|
|
on application level. The bitstream data is passed via GFMXDECVC1DECSEQUENCELAYER::pPreFillBuffer and
|
|
GFMXDECVC1DECSEQUENCELAYER::PreFillBufferLength.
|
|
*/
|
|
#define GFMXDECVC1_DECSEQUENCEOPTION_PREFILLBUFFER 0x00000001
|
|
|
|
|
|
/** Parameter structure for MxDecVC1DecPicture().
|
|
Both input and output parameters are passed via this structure to MxDecVC1DecPicture().
|
|
@see MxDecVC1DecPicture()
|
|
*/
|
|
typedef struct _GFMXDECVC1DECPICTURE
|
|
{
|
|
/**< the following fields are set by app */
|
|
NvU32 uiPictureOption; /**< Set by application. Set to 0 for this version.*/
|
|
PGFRMSURFACE pRef; /**< Reference Picture Surface */
|
|
PGFRMSURFACE pCur; /**< Current Picture Surface */
|
|
PGFRECT pRefRect; /**< pRefSurfRect specified a rectangular area within
|
|
the pRef surface, and GFMxDecVC1 references the
|
|
image in the pRefSurfRect area of the pRef surface.
|
|
If pRefSurfRect is NULL, entire pRef surface is referred.*/
|
|
|
|
PGFRECT pCurRect; /**pCurSurfRect specified a rectangular area within
|
|
the pCur surface, and GFMxDecVC1 references the
|
|
image in the pCurSurfRect area of the pCur surface.
|
|
If CurSurfRect is NULL, entire pCur surface is referred.
|
|
*/
|
|
|
|
/**< the following fields are set by MxDecVC1DecPicture API */
|
|
NvU32 uiPictureInfo; /**< Current Picture Information. */
|
|
|
|
NvU8* pPreFillBuffer; /**< Input, Pointer bitstream for frame to decode */
|
|
NvU32 PreFillBufferLength; /**< Input, Length of bitstream in bytes, must cover the entire frame */
|
|
NvU32 PreFillBufferBytesConsumed; /**< Output, Amount of bytes consumed by the component */
|
|
|
|
NvU32 uiTimeStamp; /**< Value Specified in Picture Layer Header.*/
|
|
NvU8 * pMBInfo; /**< each element tells the particular MB is wrong or not.*/
|
|
|
|
#ifdef GF_ENABLE_PROFILER
|
|
|
|
NvU32 DSPTimers[10];
|
|
#endif
|
|
|
|
} GFMXDECVC1DECPICTURE, *PGFMXDECVC1DECPICTURE;
|
|
|
|
//PictureInfo:
|
|
#define MXDEC_VC1_DEC_PICTURE_P 0x00000001 //Flag is set when current Picture is P type
|
|
#define MXDEC_VC1_DEC_NOT_CODED 0x00000010 //Flag is set when current picture is not coded.
|
|
|
|
//uiPictureOption
|
|
|
|
/** GFMXDECVC1DECPICTURE::uiPictureOption input flagbit: Use target rectangle.
|
|
If this flag is set, the GFMXDECVC1DECPICTURE::pPictureRect will point to
|
|
a rectangle on the output surface, where the reconstructed frame is placed.
|
|
*/
|
|
#define GF_MXDEC_VC1_DEC_PICTURE_SPECIFY_SURF_RECT 0x00000001
|
|
|
|
/** GFMXDECVC1DECPICTURE::uiPictureOption input flagbit: Bitstream is passed with MxDecVC1DecPicture().
|
|
If this flag is set bitstream data is passed with the call to MxDecVC1DecPicture()
|
|
instead via the read bitstrem callback. This can be used only with frame boundary detection
|
|
on application level. The bitstream data is passed via GFMXDECVC1DECPICTURE::pPreFillBuffer and
|
|
GFMXDECVC1DECPICTURE::PreFillBufferLength.
|
|
*/
|
|
#define GF_MXDEC_VC1_DEC_PICTURE_SPECIFY_PREFILLBUFFER 0x00000002
|
|
|
|
/** GFMXDECVC1DECPICTURE::uiPictureOption input flagbit: If This Flag is Set Reading of
|
|
.rcv wrapper will be skipped for each picture.
|
|
*/
|
|
#define GF_MXDEC_VC1_DEC_PICTURE_SPECIFY_SKIP_RCV_WRAPPER 0x00000004
|
|
|
|
/**Low level API Picture structure
|
|
*/
|
|
typedef struct _GFMXDECVC1PICTURE
|
|
{
|
|
NvU32 PictureInfo; /**< Current Picture Information defined in
|
|
//GFMXDECVC1PICTURE Definitions */
|
|
PGFRMSURFACE pRef; /**< Reference Picture Surface */
|
|
PGFRMSURFACE pCur; /**< Current Picture Surface */
|
|
PGFRECT pRefRect; /**< pRefSurfRect specified a rectangular area
|
|
within the pRef surface, and GFMxDecVC1
|
|
references the image in the pRefSurfRect
|
|
area of the pRef surface. If pRefSurfRect is NULL,
|
|
entire pRef surface is referred. */
|
|
PGFRECT pCurRect; /**< pCurSurfRect specified a rectangular area
|
|
within the pCur surface, and GFMxDecVC1
|
|
references the image in the pCurSurfRect
|
|
area of the pRef surface. If pCurSurfRect is NULL,
|
|
entire pCur surface is referred. */
|
|
|
|
} GFMXDECVC1PICTURE, *PGFMXDECVC1PICTURE;
|
|
//PictureInfo:
|
|
#define MXDEC_VC1_PICTURE_P_PICTURE 0x00000001
|
|
//Indicates a P Picture when set otherwise a I Picture
|
|
#define MXDEC_VC1_PICTURE_SPECIFY_REFSURF_RECT 0x00000002
|
|
//If this Flag is set, pRefSurfRect must be set, and GFMxDecVC1
|
|
//references the image in the pRefSurfRect area of the pRef surface.
|
|
//Otherwise entire pRef surface is referred.
|
|
#define MXDEC_VC1_PICTURE_SPECIFY_CURSURF_RECT 0x00000004
|
|
//If this Flag is set, pCurSurfRect must be set, and GFMxDecVC1 outputs
|
|
//the decoded image in the pCurSurfRect area of the pCur surface.
|
|
//Otherwise entire pCur surface is referred.
|
|
#define MXDEC_VC1_PICTURE_ROUNDING_ONE 0x00000008
|
|
//PICTURE_ROUNDING_TYPE is one
|
|
|
|
|
|
/**motion vector information for current macroblock*/
|
|
|
|
typedef struct _GFMXDECVC1VECTOR
|
|
{
|
|
NvS16 sH_MV_DATA; /**< Horizonal motion vector data. */
|
|
NvS16 sV_MV_DATA; /**< Vertical motion vector data. */
|
|
} GFMXDECVC1VECTOR, *PGFMXDECVC1VECTOR;
|
|
|
|
/**coefficient information for macroblock*/
|
|
|
|
typedef struct _GFMXDECVC1COEF
|
|
{
|
|
NvU8 uiLAST; /**< This last non-zero coefficient in current block */
|
|
NvU8 uiRUN; /**< How many zeroes precede this coefficient */
|
|
NvS16 iLEVEL; /**< This coefficient's level value */
|
|
} GFMXDECVC1COEF, *PGFMXDECVC1COEF;
|
|
|
|
/**macroblock information*/
|
|
|
|
typedef struct _GFMXDECVC1MB
|
|
{
|
|
NvU16 uiX; /**< MB's x position in the picture*/
|
|
NvU16 uiY; /**< MB's y position in the picture*/
|
|
NvU32 uiMBInfo; /**< MacroBlock characteristics*/
|
|
NvU32 uiBlkType[6]; /**< Block characteristics*/
|
|
NvU8 uiBlkCoded[6]; /**< Block characteristics*/
|
|
NvU8 uiBlkNZC[6]; /**< Block characteristics*/
|
|
NvU8 ucFirstCodedBlk; /**< First Coded Block in Macroblock*/
|
|
NvU16 uiQuantiser; /**< current MB's quantiser*/
|
|
GFMXDECVC1VECTOR Vector[4]; /**< motion vector zero ~ three*/
|
|
NvU32 uiNumofCoef; /**< number of GFMXDECVC1COEF //structures for current MB*/
|
|
|
|
} GFMXDECVC1MB, *PGFMXDECVC1MB;
|
|
|
|
//MBInfo:
|
|
#define MXDEC_VC1_MB_TYPE_INTER 0x1 //inter mb
|
|
|
|
/*Quantiser Type of MacroBlock */
|
|
#define MXDEC_VC1_MB_NON_UNIFORM_QUANTISER 0x2 //Non Uniform Quantiser
|
|
|
|
|
|
#define MXDEC_VC1_MB_AC_PRED_ON 0x80 //AC prediction is on
|
|
#define MXDEC_VC1_MB_FIELDTX 0x100
|
|
#define MXDEC_VC1_MB_MV_1_MVS 0x200 //1 motion vector coded
|
|
#define MXDEC_VC1_MB_MV_4_MVS 0x400 //4 motion vector coded
|
|
#define MXDEC_VC1_MB_SKIPPED 0x800 //Macro Block not coded
|
|
|
|
/* Motion vector direction bits [15:14] */
|
|
#define MXDEC_VC1_MB_DIRECT 0x1000
|
|
#define MXDEC_VC1_MB_FORWARD 0x2000
|
|
#define MXDEC_VC1_MB_BACKWARD 0x4000
|
|
|
|
#define MXDEC_VC1_MB_AUTO_DISPLAY 0x8000
|
|
#define MXDEC_VC1_MB_OVERLAP 0x10000
|
|
|
|
|
|
#define MXDEC_VC1_MB_MV_MODE1MV_HALF_PEL_BILINEAR 0x20000
|
|
#define MXDEC_VC1_MB_MV_MODE1MV_HALF_PEL 0x40000
|
|
#define MXDEC_VC1_MB_MV_MODE_MIXED_MV 0x100000
|
|
#define MXDEC_VC1_MB_MV_MODE_INTENSITY_COMP 0x200000
|
|
|
|
#define MXDEC_VC1_MB_MV_RANGE_64_32 0x400000
|
|
#define MXDEC_VC1_MB_MV_RANGE_128_64 0x800000
|
|
#define MXDEC_VC1_MB_MV_RANGE_512_128 0x1000000
|
|
#define MXDEC_VC1_MB_MV_RANGE_1024_256 0x2000000
|
|
|
|
|
|
//uiBlkInfo
|
|
#define MXDEC_VC1_BLK_CODED 0x1
|
|
|
|
|
|
#define MXDEC_VC1_BLK_INTER 0x2
|
|
#define MXDEC_VC1_BLK_INTER8X8 0x4
|
|
#define MXDEC_VC1_BLK_INTER8X4 0x8
|
|
#define MXDEC_VC1_BLK_INTER4X8 0x10
|
|
#define MXDEC_VC1_BLK_INTER4X4 0x20
|
|
#define MXDEC_VC1_BLK_INTER_ANY 0x40
|
|
|
|
#define MXDEC_VC1_BLK_INTRA 0x80
|
|
#define MXDEC_VC1_BLK_INTRA_TOP 0x100
|
|
#define MXDEC_VC1_BLK_INTRA_LEFT 0x200
|
|
|
|
|
|
#define MXDEC_VC1_SUBBLK_0 0x1
|
|
#define MXDEC_VC1_SUBBLK_1 0x2
|
|
#define MXDEC_VC1_SUBBLK_2 0x4
|
|
#define MXDEC_VC1_SUBBLK_3 0x8
|
|
|
|
|
|
|
|
//After GFMX decodes this Macro Block, it will auto trigger video engine to display
|
|
//this VOP if decoder application set auto blt on through GFVxBlt.
|
|
//If MXDEC_MB_AUTO_PP and MXDEC_MA_AUTO_DISPLAY both on, //GFMX will trigger Post Processing first, then trigger display engine.
|
|
|
|
|
|
// definition for attribute
|
|
|
|
/** GFMxDecVC1 Attribute: Application will determine the decoding boundary, this boundary
|
|
means sequence and picture layer boundary.
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 1: APP will determine the decoding boudary
|
|
0: APP will not determine the decoding boundary
|
|
</pre>
|
|
|
|
@see GFMxDecVC1GetAttribute(), GFMxDecVC1SetAttribute()
|
|
*/
|
|
#define GF_MXDEC_VC1_ATTR_PRE_DETERMINED_BOUNDARY 0x00000001
|
|
|
|
/** GFMxDecVC1 Attribute: This attribute only can be used for GFMxDecGetAttribute
|
|
If application wants to set pDestRect in GFMXDECPICTURE or GFMXDECVC1DECPICTURE,
|
|
application must use this attributes to get allignment information and
|
|
align the rectangle top & left corner accordinately.
|
|
*pInfo: top fieled alignment in term of lines
|
|
*/
|
|
#define GF_MXDEC_VC1_ATTR_DEC_PICTURE_RECT_TOP_ALIGNMENT 0x00000010
|
|
|
|
/** GFMxDecVC1 Attribute: This attribute only can be used for GFMxDecVC1GetAttribute
|
|
If application wants to set pDestRect in GFMXDECVC1PICTURE or GFMXDECVC1DECPICTURE,
|
|
application must use those attributes to get allignment information and
|
|
align the rectangle top & left corner accordinately.
|
|
*pInfo: left fieled alignment in term of pixels
|
|
*/
|
|
#define GF_MXDEC_VC1_ATTR_DEC_PICTURE_RECT_LEFT_ALIGNMENT 0x00000011
|
|
|
|
/** GFMxDecVC1 Attribute: Save decoder internal state information. This attribute only can be used for GFMxDecVC1GetAttribute
|
|
*pInfo: state handle
|
|
*/
|
|
#define GF_MXDEC_VC1_ATTR_DEC_SAVE_STATE 0x00000012
|
|
|
|
/** GFMxDecVC1 Attribute: Restore decoder internal state information. This attribute only can be used for GFMxDecVC1SetAttribute
|
|
*pInfo: state handle
|
|
*/
|
|
#define GF_MXDEC_VC1_ATTR_DEC_RESTORE_STATE 0x00000013
|
|
|
|
/** GFMxDecVC1 Attribute: Delete particular state handle. This attribute only can be used for GFMxDecVC1SetAttribute
|
|
*pInfo: state handle
|
|
*/
|
|
#define GF_MXDEC_VC1_ATTR_DEC_DELETE_STATE 0x00000014
|
|
|
|
#define GF_MXDEC_VC1_ATTR_DEC_ENABLE_RAISE_WAIT 0x00000015
|
|
//Use this attribute to enable RaiseWait mechanish. This is required for OpenMax application.
|
|
//Decoder works in FRAME_DONE polling mode by default.This attribute only can be used for GFMxDecVC1SetAttribute
|
|
//*pInfo: state handle.
|
|
|
|
typedef struct _GFMXDECVC1PP
|
|
{
|
|
PGFRMSURFACE* pDestSurf;/**< pointer to an array of surfaces that will
|
|
hold the result from Post Processing
|
|
pointer to an array of surfaces to
|
|
accommodate auto post processing
|
|
*/
|
|
PGFRMSURFACE* pSrcSurf; /**< pointer to an array of surfaces to be //post processed
|
|
pointer to an array of surfaces to
|
|
accommodate auto post processing
|
|
*/
|
|
PGFRECT pRect; /**< Rectangle area to be processed for both
|
|
src and dest surface
|
|
*/
|
|
NvU32 numofDestSurf; /**< If MXDEC_PP_AUTO flag is set, this
|
|
parameter must be filled
|
|
*/
|
|
NvU32 numofSrcSurf; /**< If MXDEC_PP_AUTO flag is set, this
|
|
parameter must be filled
|
|
*/
|
|
NvU8 * lpQuantiser; /**< point to array of QPs for Macro Blocks in
|
|
the source VOP. GFMX automatically saved
|
|
the last two decoded VOP's QP tables,
|
|
Decoder application may not need to reload
|
|
the table if it can make sure the source
|
|
VOP is the one within the last decoded
|
|
VOPs. If MXDEC_PP_RELOAD_QUANTIZER is set,
|
|
this field must be filled.
|
|
*/
|
|
NvU32 PPOption; /**<input*/
|
|
} GFMXDECVC1PP, *PGFMXDECVC1PP;
|
|
|
|
// PPOption
|
|
#define MXDEC_VC1_PP_DB_ON 0x1 //Turn on DeBlocking filter for this frame
|
|
#define MXDEC_VC1_PP_DR_ON 0x2 //Turn on DeRinging filter for this frame
|
|
#define MXDEC_VC1_PP_AUTO 0x4 //Auto trigger Post Processing by Hardware
|
|
#define MXDEC_VC1_PP_RELOAD_QUANTIZER 0x8 //Reload the source VOP's qunantizers
|
|
|
|
|
|
|
|
// Hardware Status
|
|
#define GF_DECODER_FRAME_DONE 0x00000010
|
|
//if hardware decoder is done with one frame
|
|
#define GF_DECODER_PP_FRAME_DONE 0x00000020
|
|
//if post processing engine is done with one frame
|
|
|
|
/** GFMxDecVC1Set() feature ID: Set up read stream callback function.
|
|
\a pInfo is a pointer to a #GFMXDECVC1CALLBACK structure.
|
|
|
|
Set up readbitstream call back function
|
|
pInfo should be a pointer to PGFMXDECVC1CALLBACK
|
|
*/
|
|
#define GF_MXDEC_VC1_SET_READBITSTREAM 1
|
|
|
|
/** GFMxDecVC1Set() feature ID: setup the surface list, including all of the
|
|
ref surface and one reconstructed one
|
|
pInfo should a pointer PGFMXDECVC1SURFLIST
|
|
*/
|
|
#define GF_MXDEC_VC1_SET_SURFACE_LIST 2
|
|
|
|
typedef struct _GFMXDECVC1CALLBACK
|
|
{
|
|
/** Application defined parameter to forward to GFMXDECVC1CALLBACK::pCallBack. */
|
|
void *pPara;
|
|
|
|
/** Callback function, which is called by MxDecVC1 to fetch a portion of bitstream data.
|
|
@param pPara Application defined parameter, forwarded from GFMXDECVC1CALLBACK::pPara
|
|
@param ppBuffer Callback returns address of the next portion of stream data in \a *ppBuffer
|
|
@param pBufferLength Callback returns number of bytes in \a ppBuffer in \a *pBufferLength
|
|
@param uFlag Specifies scan stream direction
|
|
<table>
|
|
<tr><td>GF_MXDEC_VC1_READ_BITSTREAM_FORWARD </td><td>Forward scan</td></tr>
|
|
<tr><td>GF_MXDEC_VC1_READ_BITSTREAM_BACKWARD</td><td>Backward scan</td></tr>
|
|
</table>
|
|
|
|
@return If the #MXDEC_ATTR_PRE_DETERMINED_BOUNDARY attribute is set, the callback
|
|
should return #GF_MXDEC_VC1_BOUNDARY_REACHED when a frame boundary is
|
|
detected, or 0 if no boundary is detected.
|
|
If the #MXDEC_ATTR_PRE_DETERMINED_BOUNDARY attribute is not set, the callback
|
|
should return 0.
|
|
*/
|
|
|
|
/**pPara is a parameter passed from APP,
|
|
and APP wants API to call back with this parameter */
|
|
|
|
NvU32 (*pCallBack)(void * pPara, NvU8 ** ppBuffer, NvS32 * BufferLength, NvU32 uFlag);
|
|
/** If APP set GF_MXDEC_ATTR_PRE_DETERMINED_BOUNDARY,
|
|
APP should return GF_MXDEC_VC1_BOUNDARY_REACHED when the boundary is
|
|
detected.
|
|
If APP does not set GF_MXDEC_ATTR_PRE_DETERMINED_BOUNDARY,
|
|
0 should be returned. */
|
|
|
|
}GFMXDECVC1CALLBACK, *PGFMXDECVC1CALLBACK;
|
|
|
|
/** GFMXDECVC1CALLBACK::pCallBack return code */
|
|
#define GF_MXDEC_VC1_BOUNDARY_REACHED 0x00000001
|
|
/** GFMXDECVC1CALLBACK::pCallBack uFlag value: Stream forward scan. */
|
|
#define GF_MXDEC_VC1_READ_BITSTREAM_FORWARD 0x00000002
|
|
/** GFMXDECVC1CALLBACK::pCallBack uFlag value: Stream backward scan. */
|
|
#define GF_MXDEC_VC1_READ_BITSTREAM_BACKWARD 0x00000003
|
|
|
|
|
|
|
|
typedef enum
|
|
{
|
|
GFMX_DEC_VC1_INTERRUPT_ENABLE,
|
|
GFMX_DEC_VC1_INTERRUPT_DISABLE,
|
|
GFMX_DEC_VC1_INTERRUPT_CLEAR
|
|
} GFMX_DEC_VC1_INTERRUPT_OPERATION_TYPE; // Interrupt operation.
|
|
|
|
typedef enum
|
|
{
|
|
GFMX_DEC_VC1_DECODE_DONE_INTR,
|
|
GFMX_DEC_VC1_POST_PROCESSING_DONE_INTR,
|
|
GFMX_DEC_VC1_DSP_COMMAND_INTR,
|
|
} GFMX_DEC_VC1_INTERRUPT_TYPE;
|
|
|
|
typedef struct _GFMXDECVC1TABLE
|
|
{
|
|
GF_RETTYPE (* MxDecVC1GetProperty)(GFMxDecVC1Handle hMxDecVC1, PGFPROPERTY pMXProp );
|
|
GF_RETTYPE (* MxDecVC1GetStatus)(GFMxDecVC1Handle hMxDecVC1, NvU32 * pStatus);
|
|
GF_RETTYPE (* MxDecVC1DecSequenceLayer)(GFMxDecVC1Handle hMxDecVC1, PGFMXDECVC1DECSEQUENCELAYER pSequenceLayer);
|
|
GF_RETTYPE (* MxDecVC1DecPicture)(GFMxDecVC1Handle hMxDecVC1, PGFMXDECVC1DECPICTURE pPicture);
|
|
GF_RETTYPE (* MxDecVC1SetPicture)(GFMxDecVC1Handle hMxDecVC1, PGFMXDECVC1PICTURE pPicture);
|
|
GF_RETTYPE (* MxDecVC1SetMBs)(GFMxDecVC1Handle hMxDecVC1, PGFMXDECVC1MB pMBs);
|
|
GF_RETTYPE (* MxDecVC1SetAttribute)(GFMxDecVC1Handle hMxDecVC1, NvU32 uiFeature, NvU32* pInfo);
|
|
GF_RETTYPE (* MxDecVC1GetAttribute)(GFMxDecVC1Handle hMxDecVC1, NvU32 uiFeature, NvU32* pInfo);
|
|
GF_RETTYPE (* MxDecVC1Set)(GFMxDecVC1Handle hMxDecVC1, NvU32 uiFeature, void * pInfo);
|
|
GF_RETTYPE (* MxDecVC1InterruptControl)(GFMxDecVC1Handle hMxDecVC1,
|
|
GFMX_DEC_VC1_INTERRUPT_TYPE IntType, GFMX_DEC_VC1_INTERRUPT_OPERATION_TYPE op,
|
|
void * pData);
|
|
GF_RETTYPE (* MxDecVC1InterruptHandler)(GFMxDecVC1Handle hMxDecVC1,
|
|
GFMX_DEC_VC1_INTERRUPT_TYPE IntType, void * pData); // Reserved.
|
|
GF_RETTYPE (* MxDecVC1DecResync)(GFMxDecVC1Handle hMxDecVC1, NvU32 ResyncOption);
|
|
} GFMXDECVC1TABLE, *PGFMXDECVC1TABLE;
|
|
|
|
// Typesafe functions for opening and closing this component
|
|
GF_RETTYPE GFMxDecVC1Open(GFRmHandle hRm, GFMxDecVC1Handle *phMxDecVC1,
|
|
GF_STATE_TYPE state, GFRmChHandle hCh);
|
|
void GFMxDecVC1Close(GFMxDecVC1Handle *phMxDecVC1);
|
|
|
|
#if NVCPU_IS_XTENSA
|
|
#define MXDVC1OFFSET sizeof(GFMXDECVC1TABLE)
|
|
#else
|
|
#define MXDVC1OFFSET 0
|
|
#endif
|
|
|
|
/** #### MxDecVC1 Helper macros. Maybe useful for backward compatible API. ####
|
|
It is a good practice to call this function to query for the API version
|
|
and its capabilities before using the rest of the MxDecVC1API functions.
|
|
|
|
@see GFPROPERTY
|
|
*/
|
|
|
|
#define GFMxDecVC1GetProperty(hMxDecVC1, pMXProp) \
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1GetProperty(hMxDecVC1, pMXProp)
|
|
|
|
#define GFMxDecVC1GetStatus(hMxDecVC1, pStatus) \
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1GetStatus(hMxDecVC1, pStatus)
|
|
|
|
/** Decode sequence header.
|
|
|
|
@param hMxDecVC1 (GFMxDecVC1Handle) Handle to MxDecVC1 component
|
|
@param pSequence (PGFMXDECVC1DECSEQUENCELAYER) Pointer to #GFMXDECVC1DECSEQUENCELAYER parameter structure
|
|
|
|
@retval GF_SUCCESS Sequence header was decoded successfully
|
|
|
|
This function will be called whenever a sequence header is found in the bitstream, decode
|
|
it and return its characteristics.
|
|
|
|
@see GFMXDECVC1DECSEQUENCELAYER
|
|
*/
|
|
#define GFMxDecVC1DecSequenceLayer(hMxDecVC1, pSequenceLayer)\
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1DecSequenceLayer(hMxDecVC1, pSequenceLayer)
|
|
|
|
|
|
//return value
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecSequenceLayer() encountered end of bitstream.
|
|
@see GFMxDecVC1DecSequenceLayer()
|
|
*/
|
|
#define GFMXDECVC1_SEQUENCELAYER_ERROR_END_OF_FILE (GFMXDVC1_ERROR | 0x00000001)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecSequenceLayer() bitstream format not supported.
|
|
The sequence header specifies a bitstream format, that is not supported. Most likely
|
|
reason for this error is that the VC1 profile is not supported.
|
|
@see GFMxDecVC1DecSequenceLayer()
|
|
*/
|
|
#define GFMXDECVC1_SEQUENCELAYER_ERROR_NOT_SUPPORT_FORMAT (GFMXDVC1_ERROR | 0x00000002)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecSequenceLayer() bitstream format is damaged due to
|
|
erroroneous stream.
|
|
@see GFMxDecVC1DecSequenceLayer()
|
|
*/
|
|
#define GFMXDECVC1_SEQUENCELAYER_ERROR_HEADER_DAMAGED (GFMXDVC1_ERROR | 0x00000003)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecSequenceLayer() encountered out of GPU memory error.
|
|
The application can try to free GPU memory and call GFMxDecVC1DecSequenceLayer() again.
|
|
@see GFMxDecVC1DecSequenceLayer()
|
|
*/
|
|
#define GFMXDECVC1_SEQUENCELAYER_ERROR_NOT_ENOUGH_SYSTEM_MEM (GFMXDVC1_ERROR | 0x00000004)
|
|
|
|
|
|
/** Decode a picture.
|
|
|
|
@param GFMxDecVC1 (GFMxDecVC1Handle) Handle to MxDecVC1 component
|
|
@param pPicture (PGFMXDECVC1DECPICTURE) Pointer to #GFMXDECVC1DECPICTURE parameter structure
|
|
|
|
@retval GF_SUCCESS Frame was decoded successfully
|
|
@retval GFMXDECVC1_PICTURE_ERROR_END_OF_FILE End of stream encountered
|
|
@retval GFMXDECVC1_PICTURE_ERROR_CORRUPTED_PICTURE Unrecoverable bitstream error during frame decode
|
|
@retval GFMXDECVC1_PICTURE_ERROR_NOT_ENOUGH_SYSTEM_MEM Out of GPU memory
|
|
@retval GFMXDECVC1_ERROR_RESYNC_END_OF_FILE Resync was found at end of bitstream.
|
|
@retval GFMXDECVC1_ERROR_P_PICTURE_FOUND_AT_START instead of Inter frame, intra was found in beginning.
|
|
@retval GFMXDECVC1_ERROR_DSP_TIMEOUT AVP times out
|
|
|
|
GFMxDecVC1DecPicture decodes one picture from the bit stream. If GFMxDecVC1DecPicture detects an
|
|
error, GFMxDecVC1DecPicture returns the error back to the application.
|
|
If the current stream position is not on the start of a frame, the function scans forward until a frame
|
|
start or sequence header is detected.
|
|
|
|
@see GFMXDECVC1DECPICTURE
|
|
*/
|
|
#define GFMxDecVC1DecPicture(hMxDecVC1, pPicture)\
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1DecPicture(hMxDecVC1, pPicture)
|
|
|
|
//return value
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecPicture() encountered end of bitstream.
|
|
@see GFMxDecVC1DecPicture()
|
|
*/
|
|
#define GFMXDECVC1_PICTURE_ERROR_END_OF_FILE (GFMXDVC1_ERROR | 0x00000005)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecPicture() encountered an unrecoverable bitstream error.
|
|
The application should call GFMxDecVC1DecResync() again, MxDecVC1 will then
|
|
scan for the next frame boundary and try to decode this frame.
|
|
@see GFMxDecVC1DecPicture()
|
|
*/
|
|
#define GFMXDECVC1_PICTURE_ERROR_CORRUPTED_PICTURE (GFMXDVC1_ERROR | 0x00000006)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecPicture() encountered out of GPU memory error.
|
|
System memory is not enough to decode Picture. The application can try to free GPU memory and call
|
|
GFMxDecVC1DecPicture() again.
|
|
@see GFMxDecVC1DecPicture()
|
|
*/
|
|
#define GFMXDECVC1_PICTURE_ERROR_NOT_ENOUGH_SYSTEM_MEM (GFMXDVC1_ERROR | 0x00000007)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecPicture() upon calling GFMxDecVC1DecResync()
|
|
encountered end of bitstream.
|
|
@see GFMxDecVC1DecPicture()
|
|
*/
|
|
#define GFMXDECVC1_ERROR_RESYNC_END_OF_FILE (GFMXDVC1_ERROR | 0x00000008)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecPicture() got a
|
|
"P" frame without it's prior reference frame
|
|
@see GFMxDecVC1DecPicture()
|
|
*/
|
|
#define GFMXDECVC1_ERROR_P_PICTURE_FOUND_AT_START (GFMXDVC1_ERROR | 0x00000009)
|
|
|
|
/** GFMxDecVC1 error code: GFMxDecVC1DecPicture() DSP times out while decoding.
|
|
@see GFMxDecVC1DecPicture()
|
|
*/
|
|
#define GFMXDECVC1_ERROR_DSP_TIMEOUT (GFMXDVC1_ERROR | 0x0000000a) // dsp hang workaround :(
|
|
|
|
#define GFMxDecVC1SetPicture(hMxDecVC1, pPicture)\
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1SetPicture(hMxDecVC1, pPicture)
|
|
|
|
#define GFMxDecVC1SetMBs(hMxDecVC1, pMBs) \
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1SetMBs(hMxDecVC1, pMBs);
|
|
|
|
#define GFMxDecVC1SetAttribute(hMxDecVC1, uiFeature, pInfo) \
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1SetAttribute(hMxDecVC1, uiFeature, pInfo)
|
|
|
|
#define GFMxDecVC1GetAttribute(hMxDecVC1, uiFeature, pInfo) \
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1GetAttribute(hMxDecVC1, uiFeature, pInfo)
|
|
|
|
#define GFMxDecVC1Set(hMxDecVC1, uiFeature, pInfo) \
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1Set(hMxDecVC1, uiFeature, pInfo)
|
|
|
|
#define GFMxDecVC1DecResync(hMxDecVC1, ResyncOption) \
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1DecResync(hMxDecVC1, ResyncOption)
|
|
|
|
#define GFMxDecVC1InterruptControl(hMxDecVC1, IntType, op, pData)\
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1InterruptControl(hMxDecVC1, IntType, op, pData)
|
|
|
|
#define GFMxDecVC1InterruptHandler(hMxDecVC1, IntType, pData)\
|
|
((PGFMXDECVC1TABLE)((NvU32)hMxDecVC1+MXDVC1OFFSET))->MxDecVC1InterruptHandler(hMxDecVC1, IntType, pData)
|
|
|
|
|
|
//resynch value
|
|
#define MXDEC_VC1_RESYNC_FORWARD_NEXT_PICTURE 0x00000001
|
|
// resync to next picture
|
|
#define MXDEC_VC1_RESYNC_FORWARD_NEXT_I_PICTURE 0x00000002
|
|
// resync to next I Picture
|
|
#define MXDEC_VC1_RESYNC_BACKWARD_PREVIOUS_PICTURE 0x00000004
|
|
// resync to next picture
|
|
#define MXDEC_VC1_RESYNC_BACKWARD_PREVIOUS_I_PICTURE 0x00000008
|
|
// resync to next I Picture
|
|
|
|
//return value
|
|
#define VC1DECRESYNC_END_OF_FILE 0x00000002 // end of file whie resync
|
|
|
|
/*@}*/
|
|
|
|
/** @page pageMxDecVC1AppNotes MxDecVC1API Application Notes
|
|
|
|
@section pageMxDecVC1AppNotes1 Programming Sequence
|
|
|
|
Todo
|
|
*/
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} // only need to export C interface if
|
|
// used by C++ source code
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|