vc1_defs.h revision 2befccec034c13d34746a9e87149889d59ac767b
1/*
2 * INTEL CONFIDENTIAL
3 * Copyright 2007 Intel Corporation. All Rights Reserved.
4 * Copyright 2005-2007 Imagination Technologies Limited. All Rights Reserved.
5 *
6 * The source code contained or described herein and all documents related to
7 * the source code ("Material") are owned by Intel Corporation or its suppliers
8 * or licensors. Title to the Material remains with Intel Corporation or its
9 * suppliers and licensors. The Material may contain trade secrets and
10 * proprietary and confidential information of Intel Corporation and its
11 * suppliers and licensors, and is protected by worldwide copyright and trade
12 * secret laws and treaty provisions. No part of the Material may be used,
13 * copied, reproduced, modified, published, uploaded, posted, transmitted,
14 * distributed, or disclosed in any way without Intel's prior express written
15 * permission.
16 *
17 * No license under any patent, copyright, trade secret or other intellectual
18 * property right is granted to or conferred upon you by disclosure or delivery
19 * of the Materials, either expressly, by implication, inducement, estoppel or
20 * otherwise. Any license under such intellectual property rights must be
21 * express and approved by Intel in writing.
22 */
23
24/*
25******************************************************************************
26 Profile calculation masks
27******************************************************************************/
28#define iWMVA_MASK				(0x08)
29#define iWMV9_MASK				(0x80)
30
31/* system environment dependent switches */
32//! Pack decoded bitplane bits into bytes (instead of 1-bit per byte)
33//#define BITPLANE_PACKED_BYTES
34
35//! Generate bitplane test vectors
36#define BITPLANE_TEST_VECTORS   (0)
37
38//! Measure bitplane decode time
39#define BITPLANE_DECODE_TIME	(0)
40
41//! Measure time spent parsing the picture header
42#define	PARSE_HEADER_TIME		(0)
43
44//! Use VC1 reference decoder implementation for bitplane decoding
45#define REFDEC_BITPLANE_DECODER		(0)
46
47//! Interleave individual bitplanes into packed format
48#define VC1_INTERLEAVED_BITPLANE	(1)
49
50//! Use MSVDX hardware for bitplane decoding
51#define VC1_BITPLANE_HARDWARE		(0)
52
53/*****************************************************************************/
54#if VC1_BITPLANE_HARDWARE
55//! VC1_INTERLEAVED_BITPLANE must be set to 0 when using MSVDX hardware for bitplane decoding
56#if VC1_INTERLEAVED_BITPLANE
57	#error VC1_INTERLEAVED_BITPLANE must not be defined together with VC1_BITPLANE_HARDWARE
58#endif
59#endif
60/*****************************************************************************/
61
62/*
63Possible combinations for bitplane decoding operation:
64
65+ To use the hardware bitplane decoder, define VC1_BITPLANE_HARDWARE in the
66preprocessor definitions of um_drivers, set REFDEC_BITPLANE_DECODER to 1 and
67VC1_INTERLEAVED_BITPLANE to 0.
68+ To use the software bitplane decoder, don't define VC1_BITPLANE_HARDWARE.
69There are two implementations of the decoder:
70	- To use the VC1 reference decoder implementation, set
71	REFDEC_BITPLANE_DECODER to 1.
72	- Otherwise, set REFDEC_BITPLANE_DECODER to 0.
73+ When using the software bitplane decoder, the data can be sent to
74the hardware in two formats.
75	- Set VC1_INTERLEAVED_BITPLANE to 1, if using the three-plane
76	interleaved format.
77	- Otherwise, set VC1_INTERLEAVED_BITPLANE to 0.
78*/
79
80/*!
81******************************************************************************
82 This enumeration defines PTYPE [All]
83******************************************************************************/
84typedef enum
85{
86	WMF_PTYPE_I       = 0,	//!< I Picture
87	WMF_PTYPE_P       = 1,	//!< P Picture
88	WMF_PTYPE_B       = 2, 	//!< B Picture
89	WMF_PTYPE_BI      = 3,	//!< BI Picture
90	WMF_PTYPE_SKIPPED = 4	//!< Skipped Picture
91
92} WMF_ePTYPE;
93
94/*!
95******************************************************************************
96 This enumeration defines the stream profile
97******************************************************************************/
98typedef enum
99{
100	WMF_PROFILE_SIMPLE		= 0,	//!< Simple profile
101	WMF_PROFILE_MAIN		= 1,	//!< Main profile
102	WMF_PROFILE_ADVANCED	= 2,	//!< Advanced profile (VC1 Only)
103    WMF_PROFILE_UNDEFINED   = 3,    //!< Undefined profile
104
105} WMF_eProfile;
106
107/*!
108******************************************************************************
109 This enumeration defines MVMODE [All] Tables 46-50 MVMODE and MVMODE2
110******************************************************************************/
111typedef enum
112{
113	WMF_MVMODE_1MV                      = 0,    //!<	1 MV
114	WMF_MVMODE_1MV_HALF_PEL_BILINEAR    = 1,	//!<	1 MV Half-pel bilinear
115	WMF_MVMODE_1MV_HALF_PEL             = 2,	//!<	1 MV Half-pel
116	WMF_MVMODE_MIXED_MV                 = 3,	//!<	Mixed MV
117	WMF_MVMODE_INTENSITY_COMPENSATION   = 4,	//!<	Intensity Compensation
118	WMF_MVMODE_QUARTER_PEL_BICUBIC      = 5,	//!<	Quarter pel bicubic
119
120} WMF_eMVMODE;
121
122/*!
123******************************************************************************
124 This enumeration defines FCM [Advanced Profile Only] Table 41 gFCM_VlcTable
125******************************************************************************/
126typedef enum
127{
128	VC1_FCM_P	    = 0,    //!< 0	Progressive
129	VC1_FCM_FRMI    = 2,	//!< 10	Frame-Interlace
130	VC1_FCM_FLDI    = 3,	//!< 11	Field-Interlace
131
132} VC1_eFCM;
133
134/*!
135******************************************************************************
136 This enumeration defines the BDU Start Code Suffixes \n
137    0x00 - 0x09		SMPTE Reserved \n
138    0x20 - 0x7F		SMPTE Reserved \n
139    0x80  -0xFF		Forbidden
140******************************************************************************/
141typedef enum
142{
143	VC1_SCS_ENDOFSEQU				= 0x0A,		//!< End of sequence
144	VC1_SCS_SLICE					= 0x0B,		//!< Slice
145	VC1_SCS_FIELD					= 0x0C,		//!< Field
146	VC1_SCS_PIC_LAYER				= 0x0D,		//!< Frame
147	VC1_SCS_ENTRYPNT_LAYER			= 0x0E,		//!< Entry-point Header
148	VC1_SCS_SEQ_LAYER				= 0x0F,		//!< Sequence Header
149	VC1_SCS_SLICELVL_USERDATA		= 0x1B,		//!< Slice Level User Data
150	VC1_SCS_FIELDLVL_USERDATA		= 0x1C,		//!< Field Level User Data
151	VC1_SCS_PICLVL_USERDATA			= 0x1D,		//!< Frame Level User Data
152	VC1_SCS_ENTRYPNTLVL_USERDATA	= 0x1E,		//!< Entry-point Level User Data
153	VC1_SCS_SEQLVL_USERDATA			= 0x1F,		//!< Sequence Level User Data
154
155} VC1_eSCS;
156
157/*! Test if picture type is a reference (I or P) */
158#define PIC_TYPE_IS_REF(Type)   ((Type) == WMF_PTYPE_I || (Type) == WMF_PTYPE_P)
159
160/*! Test if picture type is intra (I or BI) */
161#define PIC_TYPE_IS_INTRA(Type) ((Type) == WMF_PTYPE_I || (Type) == WMF_PTYPE_BI)
162
163/*! Test if picture type is inter (P or B) */
164#define PIC_TYPE_IS_INTER(Type) ((Type) == WMF_PTYPE_P || (Type) == WMF_PTYPE_B)
165
166//! Maximum number of VLC tables for MB/block layer decode
167#define MAX_VLC_TABLES  (12)
168
169#define COMPUTE_PULLBACK(s)     (VC1_MB_SIZE*((s+15)/VC1_MB_SIZE)*4 - 4)      /* 8.4.5.8 */
170
171//! VC1 MB Parameter Stride
172#define VC1_MB_PARAM_STRIDE	(128)
173
174#define VC1_MAX_NUM_BITPLANES   (3)
175
176#define CABAC_RAM_WIDTH_IN_BITS (16)
177
178/*
179******************************************************************************
180 Frame Dimension Parameters
181******************************************************************************/
182
183//! Number of pixels in each MB dimension
184#define VC1_MB_SIZE (16)
185
186//! Maximum resolution in frame width (X)
187#define VC1_MAX_X   (4096)      // 1920
188
189//! Maximum resolution in frame height (Y)
190#define VC1_MAX_Y   (2048)		// 1080
191
192//! Maximum resolution of frame
193#define VC1_MAX_RES			(VC1_MAX_X*VC1_MAX_Y)
194
195//! Maximum number of MBs in frame width (X)
196#define VC1_MAX_NO_MBS_X	((VC1_MAX_X + VC1_MB_SIZE - 1)/VC1_MB_SIZE)
197
198//! Maximum number of MBs in frame height (Y)
199#define VC1_MAX_NO_MBS_Y	((VC1_MAX_Y + VC1_MB_SIZE - 1)/VC1_MB_SIZE)
200
201//! Maximum number of MBs in frame
202#define VC1_MAX_NO_MBS		((VC1_MAX_RES + (VC1_MB_SIZE*VC1_MB_SIZE) - 1) /(VC1_MB_SIZE*VC1_MB_SIZE))
203
204//! Maximum number of bytes in bitplane
205#define BITPLANE_BYTES		VC1_MAX_NO_MBS
206
207//! Maximum number of pan/scan windows per frame (VC1 Specification: 7.1.1.20)
208#define VC1_MAX_PANSCAN_WINDOWS (4)
209