xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/gen8/codec/hal/codechal_decode_vc1_g8.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2014-2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 
23 //!
24 //! \file     codechal_decode_vc1_g8.h
25 //! \brief    Defines the decode interface extension for Gen8 VC1.
26 //! \details  Defines all types, macros, and functions required by CodecHal for Gen8 VC1 decoding.
27 //!           Definitions are not externally facing.
28 //!
29 
30 #ifndef __CODECHAL_DECODER_VC1_G8_H__
31 #define __CODECHAL_DECODER_VC1_G8_H__
32 
33 #include "codechal.h"
34 #include "codechal_decode_vc1.h"
35 
36 //!
37 //! \struct CODECHAL_DECODE_VC1_KERNEL_HEADER
38 //! \brief Define VC1 Kernel Header
39 //!
40 typedef struct _CODECHAL_DECODE_VC1_KERNEL_HEADER {
41     int nKernelCount;
42 
43     CODECHAL_KERNEL_HEADER Vc1KernelHeader1[30];
44     CODECHAL_KERNEL_HEADER OLP;
45     CODECHAL_KERNEL_HEADER Vc1KernelHeader2[16];
46 } CODECHAL_DECODE_VC1_KERNEL_HEADER, *PCODECHAL_DECODE_VC1_KERNEL_HEADER;
47 
48 //!
49 //! \struct CODECHAL_DECODE_VC1_OLP_STATIC_DATA_G8
50 //! \brief Define VC1 OLP Static Data for gen8
51 //!
52 typedef struct _CODECHAL_DECODE_VC1_OLP_STATIC_DATA_G8
53 {
54     // uint32_t 0
55     union
56     {
57         struct
58         {
59             uint32_t   Reserved                : 32;
60         };
61         struct
62         {
63             uint32_t   Value;
64         };
65     } DW0;
66 
67     // uint32_t 1
68     union
69     {
70         struct
71         {
72             uint32_t   BlockWidth              : 16;   // in byte
73             uint32_t   BlockHeight             : 16;   // in byte
74         };
75         struct
76         {
77             uint32_t   Value;
78         };
79     } DW1;
80 
81     // uint32_t 2
82     union
83     {
84         struct
85         {
86             uint32_t   Profile                         : 1;
87             uint32_t   RangeExpansionFlag              : 1;    // Simple & Main Profile only
88             uint32_t   PictureUpsamplingFlag           : 2;    // 2:H, 3:V
89             uint32_t                                   : 1;
90             uint32_t   InterlaceFieldFlag              : 1;
91             uint32_t                                   : 2;
92             uint32_t   RangeMapUV                      : 3;
93             uint32_t   RangeMapUVFlag                  : 1;
94             uint32_t   RangeMapY                       : 3;
95             uint32_t   RangeMapYFlag                   : 1;
96             uint32_t                                   : 4;
97             uint32_t   ComponentFlag                   : 1;
98             uint32_t                                   : 11;
99         };
100         struct
101         {
102             uint32_t   Value;
103         };
104     } DW2;
105 
106     // uint32_t 3
107     union
108     {
109         struct
110         {
111             uint32_t                                   : 4;
112             uint32_t   ComponentFlag                   : 1;
113             uint32_t                                   : 27;
114         };
115         struct
116         {
117             uint32_t   Value;
118         };
119     } DW3;
120 
121     // uint32_t 4
122     union
123     {
124         struct
125         {
126             uint32_t   Reserved;
127         };
128         struct
129         {
130             uint32_t   Value;
131         };
132     } DW4;
133 
134     // uint32_t 5
135     union
136     {
137         struct
138         {
139             uint32_t   Reserved;
140         };
141         struct
142         {
143             uint32_t   Value;
144         };
145     } DW5;
146 
147     // uint32_t 6
148     union
149     {
150         struct
151         {
152             uint32_t   Reserved;
153         };
154         struct
155         {
156             uint32_t   Value;
157         };
158     } DW6;
159 
160     // uint32_t 7
161     union
162     {
163         struct
164         {
165             uint32_t   Reserved;
166         };
167         struct
168         {
169             uint32_t   Value;
170         };
171     } DW7;
172 
173 } CODECHAL_DECODE_VC1_OLP_STATIC_DATA_G8, *PCODECHAL_DECODE_VC1_OLP_STATIC_DATA_G8;
174 
175 //!
176 //! \struct CODECHAL_DECODE_VC1_OLP_INLINE_DATA_G8
177 //! \brief Define VC1 OLP Inline Data for gen8
178 //!
179 typedef struct _CODECHAL_DECODE_VC1_OLP_INLINE_DATA_G8
180 {
181     // uint32_t 0
182     union
183     {
184         struct
185         {
186             uint32_t   BlockOriginX : 16;  // in Byte
187             uint32_t   BlockOriginY : 16;  // in Byte
188         };
189         struct
190         {
191             uint32_t   Value;
192         };
193     } DW0;
194 
195     // uint32_t 1
196     union
197     {
198         struct
199         {
200             uint32_t                 : 4;
201             uint32_t   ComponentFlag : 1;
202             uint32_t                 : 27;
203         };
204         struct
205         {
206             uint32_t   Value;
207         };
208     } DW1;
209 
210     // uint32_t 2
211     union
212     {
213         struct
214         {
215             uint32_t   SourceDataBindingIndex   : 8;
216             uint32_t   DestDataBindingIndex     : 8;
217             uint32_t                            : 16;
218         };
219         struct
220         {
221             uint32_t   Value;
222         };
223     } DW2;
224 
225     // uint32_t 3 - 7
226     uint32_t Reserved[5];
227 } CODECHAL_DECODE_VC1_OLP_INLINE_DATA_G8, *PCODECHAL_DECODE_VC1_OLP_INLINE_DATA_G8;
228 
229 //!
230 //! \def CODECHAL_DECODE_VC1_CURBE_SIZE_OLP_G8
231 //! VC1 Curbe Size for Gen8 Olp
232 //!
233 #define CODECHAL_DECODE_VC1_CURBE_SIZE_OLP_G8             \
234     (sizeof(CODECHAL_DECODE_VC1_OLP_STATIC_DATA_G8))
235 
236 //!
237 //! \class CodechalDecodeVc1G8
238 //! \brief This class defines the member fields, functions etc used by Gen8 VC1 decoder.
239 //!
240 class CodechalDecodeVc1G8 : public CodechalDecodeVc1
241 {
242 public:
243     //!
244     //! \brief  Constructor
245     //! \param    [in] hwInterface
246     //!           Hardware interface
247     //! \param    [in] debugInterface
248     //!           Debug interface
249     //! \param    [in] standardInfo
250     //!           The information of decode standard for this instance
251     //!
252     CodechalDecodeVc1G8(
253         CodechalHwInterface   *hwInterface,
254         CodechalDebugInterface* debugInterface,
255         PCODECHAL_STANDARD_INFO standardInfo);
256 
257     ~CodechalDecodeVc1G8();
258 
259     MOS_STATUS AllocateResources();
260 
261     MOS_STATUS SetCurbeOlp();
262 
263     //!
264     //! \brief    Add VC1 Olp MediaObjects to a batch buffer
265     //! \details  Populate the OLP Media Objects and adds them to a batch buffer
266     //! \param    [in,out] batchBuffer
267     //!           Pointer of Batch Buffer
268     //! \return   MOS_STATUS
269     //!           MOS_STATUS_SUCCESS if success, else fail reason
270     //!
271     MOS_STATUS AddVc1OlpMediaObjectsBB(
272         PMHW_BATCH_BUFFER               batchBuffer);
273 
274     MOS_STATUS UpdateVc1KernelState();
275 
276     MOS_STATUS AddVc1OlpCmd(
277         PCODECHAL_DECODE_VC1_OLP_PARAMS vc1OlpParams);
278 
279 protected:
280     MHW_BATCH_BUFFER m_olpBatchBuffer;  //!< Olp Batch Buffer
281 };
282 #endif  // __CODECHAL_DECODER_VC1_G8_H__
283