• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3   * Copyright (c) Imagination Technologies Limited, UK
4   *
5   * Permission is hereby granted, free of charge, to any person obtaining a
6   * copy of this software and associated documentation files (the
7   * "Software"), to deal in the Software without restriction, including
8   * without limitation the rights to use, copy, modify, merge, publish,
9   * distribute, sub license, and/or sell copies of the Software, and to
10   * permit persons to whom the Software is furnished to do so, subject to
11   * the following conditions:
12   *
13   * The above copyright notice and this permission notice (including the
14   * next paragraph) shall be included in all copies or substantial portions
15   * of the Software.
16   *
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20   * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21   * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22   * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23   * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24   */
25  
26  
27  /*
28  ******************************************************************************
29   Profile calculation masks
30  ******************************************************************************/
31  #define iWMVA_MASK                              (0x08)
32  #define iWMV9_MASK                              (0x80)
33  
34  /* system environment dependent switches */
35  //! Pack decoded bitplane bits into bytes (instead of 1-bit per byte)
36  //#define BITPLANE_PACKED_BYTES
37  
38  //! Generate bitplane test vectors
39  #define BITPLANE_TEST_VECTORS   (0)
40  
41  //! Measure bitplane decode time
42  #define BITPLANE_DECODE_TIME    (0)
43  
44  //! Measure time spent parsing the picture header
45  #define PARSE_HEADER_TIME               (0)
46  
47  //! Use VC1 reference decoder implementation for bitplane decoding
48  #define REFDEC_BITPLANE_DECODER         (0)
49  
50  //! Interleave individual bitplanes into packed format
51  #define VC1_INTERLEAVED_BITPLANE        (1)
52  
53  //! Use MSVDX hardware for bitplane decoding
54  #define VC1_BITPLANE_HARDWARE           (0)
55  
56  /*****************************************************************************/
57  #if VC1_BITPLANE_HARDWARE
58  //! VC1_INTERLEAVED_BITPLANE must be set to 0 when using MSVDX hardware for bitplane decoding
59  #if VC1_INTERLEAVED_BITPLANE
60  #error VC1_INTERLEAVED_BITPLANE must not be defined together with VC1_BITPLANE_HARDWARE
61  #endif
62  #endif
63  /*****************************************************************************/
64  
65  /*
66  Possible combinations for bitplane decoding operation:
67  
68  + To use the hardware bitplane decoder, define VC1_BITPLANE_HARDWARE in the
69  preprocessor definitions of um_drivers, set REFDEC_BITPLANE_DECODER to 1 and
70  VC1_INTERLEAVED_BITPLANE to 0.
71  + To use the software bitplane decoder, don't define VC1_BITPLANE_HARDWARE.
72  There are two implementations of the decoder:
73          - To use the VC1 reference decoder implementation, set
74          REFDEC_BITPLANE_DECODER to 1.
75          - Otherwise, set REFDEC_BITPLANE_DECODER to 0.
76  + When using the software bitplane decoder, the data can be sent to
77  the hardware in two formats.
78          - Set VC1_INTERLEAVED_BITPLANE to 1, if using the three-plane
79          interleaved format.
80          - Otherwise, set VC1_INTERLEAVED_BITPLANE to 0.
81  */
82  
83  /*!
84  ******************************************************************************
85   This enumeration defines PTYPE [All]
86  ******************************************************************************/
87  typedef enum {
88      WMF_PTYPE_I       = 0,      //!< I Picture
89      WMF_PTYPE_P       = 1,      //!< P Picture
90      WMF_PTYPE_B       = 2,      //!< B Picture
91      WMF_PTYPE_BI      = 3,      //!< BI Picture
92      WMF_PTYPE_SKIPPED = 4       //!< Skipped Picture
93  
94  } WMF_ePTYPE;
95  
96  /*!
97  ******************************************************************************
98   This enumeration defines the stream profile
99  ******************************************************************************/
100  typedef enum {
101      WMF_PROFILE_SIMPLE          = 0,    //!< Simple profile
102      WMF_PROFILE_MAIN            = 1,    //!< Main profile
103      WMF_PROFILE_ADVANCED        = 2,    //!< Advanced profile (VC1 Only)
104      WMF_PROFILE_UNDEFINED   = 3,    //!< Undefined profile
105  
106  } WMF_eProfile;
107  
108  /*!
109  ******************************************************************************
110   This enumeration defines MVMODE [All] Tables 46-50 MVMODE and MVMODE2
111  ******************************************************************************/
112  typedef enum {
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  ******************************************************************************/
126  typedef enum {
127      VC1_FCM_P       = 0,    //!< 0      Progressive
128      VC1_FCM_FRMI    = 2,        //!< 10 Frame-Interlace
129      VC1_FCM_FLDI    = 3,        //!< 11 Field-Interlace
130  
131  } VC1_eFCM;
132  
133  /*!
134  ******************************************************************************
135   This enumeration defines the BDU Start Code Suffixes \n
136      0x00 - 0x09         SMPTE Reserved \n
137      0x20 - 0x7F         SMPTE Reserved \n
138      0x80  -0xFF         Forbidden
139  ******************************************************************************/
140  typedef enum {
141      VC1_SCS_ENDOFSEQU                           = 0x0A,         //!< End of sequence
142      VC1_SCS_SLICE                                       = 0x0B,         //!< Slice
143      VC1_SCS_FIELD                                       = 0x0C,         //!< Field
144      VC1_SCS_PIC_LAYER                           = 0x0D,         //!< Frame
145      VC1_SCS_ENTRYPNT_LAYER                      = 0x0E,         //!< Entry-point Header
146      VC1_SCS_SEQ_LAYER                           = 0x0F,         //!< Sequence Header
147      VC1_SCS_SLICELVL_USERDATA           = 0x1B,         //!< Slice Level User Data
148      VC1_SCS_FIELDLVL_USERDATA           = 0x1C,         //!< Field Level User Data
149      VC1_SCS_PICLVL_USERDATA                     = 0x1D,         //!< Frame Level User Data
150      VC1_SCS_ENTRYPNTLVL_USERDATA        = 0x1E,         //!< Entry-point Level User Data
151      VC1_SCS_SEQLVL_USERDATA                     = 0x1F,         //!< Sequence Level User Data
152  
153  } VC1_eSCS;
154  
155  /*! Test if picture type is a reference (I or P) */
156  #define PIC_TYPE_IS_REF(Type)   ((Type) == WMF_PTYPE_I || (Type) == WMF_PTYPE_P)
157  
158  /*! Test if picture type is intra (I or BI) */
159  #define PIC_TYPE_IS_INTRA(Type) ((Type) == WMF_PTYPE_I || (Type) == WMF_PTYPE_BI)
160  
161  /*! Test if picture type is inter (P or B) */
162  #define PIC_TYPE_IS_INTER(Type) ((Type) == WMF_PTYPE_P || (Type) == WMF_PTYPE_B)
163  
164  //! Maximum number of VLC tables for MB/block layer decode
165  #define MAX_VLC_TABLES  (12)
166  
167  #define COMPUTE_PULLBACK(s)     (VC1_MB_SIZE*((s+15)/VC1_MB_SIZE)*4 - 4)      /* 8.4.5.8 */
168  
169  //! VC1 MB Parameter Stride
170  #define VC1_MB_PARAM_STRIDE     (128)
171  
172  #define VC1_MAX_NUM_BITPLANES   (3)
173  
174  #define CABAC_RAM_WIDTH_IN_BITS (16)
175  
176  /*
177  ******************************************************************************
178   Frame Dimension Parameters
179  ******************************************************************************/
180  
181  //! Number of pixels in each MB dimension
182  #define VC1_MB_SIZE (16)
183  
184  //! Maximum resolution in frame width (X)
185  #define VC1_MAX_X   (4096)      // 1920
186  
187  //! Maximum resolution in frame height (Y)
188  #define VC1_MAX_Y   (2048)              // 1080
189  
190  //! Maximum resolution of frame
191  #define VC1_MAX_RES                     (VC1_MAX_X*VC1_MAX_Y)
192  
193  //! Maximum number of MBs in frame width (X)
194  #define VC1_MAX_NO_MBS_X        ((VC1_MAX_X + VC1_MB_SIZE - 1)/VC1_MB_SIZE)
195  
196  //! Maximum number of MBs in frame height (Y)
197  #define VC1_MAX_NO_MBS_Y        ((VC1_MAX_Y + VC1_MB_SIZE - 1)/VC1_MB_SIZE)
198  
199  //! Maximum number of MBs in frame
200  #define VC1_MAX_NO_MBS          ((VC1_MAX_RES + (VC1_MB_SIZE*VC1_MB_SIZE) - 1) /(VC1_MB_SIZE*VC1_MB_SIZE))
201  
202  //! Maximum number of bytes in bitplane
203  #define BITPLANE_BYTES          VC1_MAX_NO_MBS
204  
205  //! Maximum number of pan/scan windows per frame (VC1 Specification: 7.1.1.20)
206  #define VC1_MAX_PANSCAN_WINDOWS (4)
207