Debian Codegraph @

media_softlet/linux/common/codec/ddi/dec/ddi_decode_vvc_specific.h

raw
1 /*
2 * Copyright (c) 2022-2023, 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 //! \file ddi_decode_vvc_specific.h
24 //! \brief Defines DdiDecodeVvc class for VVC decode
25 //!
26
27 #ifndef __DDI_DECODE_VVC_SPECIFIC_H__
28 #define __DDI_DECODE_VVC_SPECIFIC_H__
29
30 #include <va/va.h>
31 #include <va/va_dec_vvc.h>
32 #include "codec_def_decode_vvc.h"
33 #include "ddi_decode_base_specific.h"
34
35 #define DECODE_ID_VVC "VIDEO_DEC_VVC"
36
37 enum VvcPicEntryType
38 {
39 VvcPicEntryCurrFrame = 0,
40 VvcPicEntryRefFrameList,
41 VvcPicEntryRefPicList
42 };
43
44 typedef struct _DDI_CODEC_BUFFER_PARAM_VVC
45 {
46 // one picture buffer
47 VAPictureParameterBufferVVC PicParamVVC;
48
49 // slice param buffer pointer
50 VASliceParameterBufferVVC *pVASliceParameterBufferVVC;
51 } DDI_CODEC_BUFFER_PARAM_VVC;
52
53 namespace decode
54 {
55
56 //!
57 //! \class DdiDecodeVvc
58 //! \brief Ddi Decode VVC
59 //!
60
61 class DdiDecodeVvc : public DdiDecodeBase
62 {
63 public:
64 //!
65 //! \brief Constructor
66 //!
67 DdiDecodeVvc() : DdiDecodeBase()
68 {
69 subpic_buffer_nums = 0;
70 slice_struct_nums = 0;
71 tile_buffer_nums = 0;
72 alf_buffer_nums = 0;
73 lmcs_buffer_nums = 0;
74 scaling_list_buffer_nums = 0;
75 };
76
77 //!
78 //! \brief Destructor
79 //!
80 virtual ~DdiDecodeVvc() {};
81
82 // inherited virtual functions
83 virtual void DestroyContext(
84 VADriverContextP ctx) override;
85
86 virtual VAStatus RenderPicture(
87 VADriverContextP ctx,
88 VAContextID context,
89 VABufferID *buffers,
90 int32_t numBuffers) override;
91
92 virtual MOS_FORMAT GetFormat() override;
93
94 /*virtual VAStatus EndPicture(
95 VADriverContextP ctx,
96 VAContextID context) override;*/
97
98 virtual void ContextInit(
99 int32_t picWidth,
100 int32_t picHeight) override;
101
102 virtual VAStatus CodecHalInit(
103 DDI_MEDIA_CONTEXT *mediaCtx,
104 void *ptr) override;
105
106 virtual VAStatus AllocSliceControlBuffer(
107 DDI_MEDIA_BUFFER *buf) override;
108
109 virtual uint8_t* GetPicParamBuf(
110 DDI_CODEC_COM_BUFFER_MGR *bufMgr) override;
111
112 virtual VAStatus CreateBuffer(
113 VABufferType type,
114 uint32_t size,
115 uint32_t numElements,
116 void *data,
117 VABufferID *bufId) override;
118
119 VAStatus ParseAlfDatas(
120 DDI_DECODE_CONTEXT *decodeCtx,
121 VAAlfDataVVC *alfDatas,
122 uint32_t numAlfDatas,
123 uint32_t numAlfBuffers);
124 VAStatus ParseLmcsDatas(
125 DDI_DECODE_CONTEXT *decodeCtx,
126 VALmcsDataVVC *LmcsDatas,
127 uint32_t numLmcsDatas,
128 uint32_t numLMCSBuffers);
129 VAStatus ParseWeightedPredInfo(
130 CodecVvcSliceParams* sliceParams,
131 VAWeightedPredInfo* wpInfoParams);
132
133 uint32_t subpic_buffer_nums;
134 uint32_t slice_struct_nums;
135 uint32_t tile_buffer_nums;
136 uint32_t alf_buffer_nums;
137 uint32_t lmcs_buffer_nums;
138 uint32_t scaling_list_buffer_nums;
139 private:
140 //!
141 //! \brief ParseSliceParam for VVC
142 //! \details parse the sliceParam info required by VVC decoding for
143 //! each slice
144 //!
145 //! \param [in] *mediaCtx
146 //! DDI_MEDIA_CONTEXT
147 //! \param [in] *slcParam
148 //! VASliceParameterBufferVVC
149 //! \param [in] numSlices
150 //! uint32_t
151 //!
152 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully.
153 //! else fail reason
154 virtual VAStatus ParseSliceParams(
155 DDI_MEDIA_CONTEXT *mediaCtx,
156 VASliceParameterBufferVVC *slcParam,
157 uint32_t numSlices);
158
159 //! \brief ParsePicParam for VVC
160 //! \details parse the PicParam info required by VVC decoding
161 //!
162 //! \param [in] *mediaCtx
163 //! DDI_MEDIA_CONTEXT
164 //! \param [in] *picParam
165 //! VAPictureParameterBufferVVC
166 //!
167 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully.
168 //! else fail reason
169 virtual VAStatus ParsePicParams(
170 DDI_MEDIA_CONTEXT *mediaCtx,
171 VAPictureParameterBufferVVC *picParam);
172
173 //! \brief ParseSubPicParam for VVC
174 //! \details parse the SubPicParam info required by VVC decoding
175 //!
176 //! \param [in] *mediaCtx
177 //! DDI_MEDIA_CONTEXT
178 //! \param [in] *subPicParam
179 //! VASubPicVVC
180 //! \param [in] numSubPics
181 //! uint32_t
182 //!
183 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully.
184 //! else fail reason
185 virtual VAStatus ParseSubPicParams(
186 DDI_MEDIA_CONTEXT *mediaCtx,
187 VASubPicVVC *subPicParam,
188 uint32_t numSubPics,
189 uint32_t numSubPicbuffers);
190
191 //! \brief ParseTileParam for VVC
192 //! \details parse the TileParam info required by VVC decoding
193 //!
194 //! \param [in] *mediaCtx
195 //! DDI_MEDIA_CONTEXT
196 //! \param [in] *tileParam
197 //! VATileBufferVVC
198 //! \param [in] numTiles
199 //! uint32_t
200 //!
201 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully.
202 //! else fail reason
203 virtual VAStatus ParseTileParams(
204 DDI_MEDIA_CONTEXT *mediaCtx,
205 uint16_t *tileParam,
206 uint32_t numTiles,
207 uint32_t numTileBuffers);
208
209 //! \brief ParseSliceStructParam for VVC
210 //! \details parse the SliceStructParam info required by VVC decoding
211 //!
212 //! \param [in] *mediaCtx
213 //! DDI_MEDIA_CONTEXT
214 //! \param [in] *sliceStructParam
215 //! VASliceStructVVC
216 //! \param [in] numSliceStructs
217 //! uint32_t
218 //!
219 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully.
220 //! else fail reason
221 virtual VAStatus ParseSliceStructParams(
222 DDI_MEDIA_CONTEXT *mediaCtx,
223 VASliceStructVVC *sliceStructParam,
224 uint32_t numSliceStructs,
225 uint32_t slice_struct_nums);
226
227 //! \brief Init Resource buffer for VVC
228 //! \details Initialize and allocate the Resource buffer for VVC
229 //!
230 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully.
231 //! else fail reason
232 VAStatus InitResourceBuffer();
233
234 //! \brief Free Resource buffer for VVC
235 //!
236 void FreeResourceBuffer();
237
238 void FreeResource();
239
240 //! \brief Setup Codec Picture for VVC
241 //!
242 //! \param [in] mediaCtx
243 //! Pointer to DDI_MEDIA_CONTEXT
244 //! \param [in] rtTbl
245 //! Pointer to DDI_CODEC_RENDER_TARGET_TABLE
246 //! \param [in] vaPic
247 //! VVC VAPicture structure
248 //! \param [in] bSurfaceType
249 //! VVC Picture entry type
250 //! \param [out] pCodecHalPic
251 //! Pointer to CODEC_PICTURE
252 //!
253 //! \return void
254 //!
255 void SetupCodecPicture(
256 DDI_MEDIA_CONTEXT *mediaCtx,
257 DDI_CODEC_RENDER_TARGET_TABLE *rtTbl,
258 PCODEC_PICTURE pCodecHalPic,
259 VAPictureVVC vaPic,
260 VvcPicEntryType bSurfaceType);
261
262 //! \brief flag list for VVC reference surfaces
263 uint32_t m_refListFlags[vvcMaxNumRefFrame];
264
265 MEDIA_CLASS_DEFINE_END(decode__DdiDecodeVvc)
266 };
267 }; // namespace decode
268
269 #endif /* __DDI_DECODE_VVC_SPECIFIC_H__ */