Debian Codegraph @

media_driver/linux/common/codec/ddi/media_ddi_encode_vp8.h

raw
1 /*
2 * Copyright (c) 2009-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 //! \file media_ddi_encode_vp8.h
24 //! \brief Defines class for DDI media vp8 encode
25 //!
26
27 #include "media_ddi_encode_base.h"
28
29 class DdiEncodeVp8 : public DdiEncodeBase
30 {
31 public:
32 //!
33 //! \brief Constructor
34 //!
35 DdiEncodeVp8(){};
36
37 //!
38 //! \brief Destructor
39 //!
40 ~DdiEncodeVp8();
41
42 //!
43 //! \brief Initialize Encode Context and CodecHal Setting for Vp8
44 //!
45 //! \param [out] codecHalSettings
46 //! Pointer to CodechalSetting *
47 //!
48 //! \return VAStatus
49 //! VA_STATUS_SUCCESS if success, else fail reason
50 //!
51 VAStatus ContextInitialize(
52 CodechalSetting *codecHalSettings) override;
53
54 //!
55 //! \brief Parse buffer to the server.
56 //!
57 //! \param [in] ctx
58 //! Pointer to VADriverContextP
59 //! \param [in] context
60 //! VA context ID
61 //! \param [in] buffers
62 //! Pointer to VABufferID
63 //! \param [in] numBuffers
64 //! Number of buffers
65 //!
66 //! \return VAStatus
67 //! VA_STATUS_SUCCESS if success, else fail reason
68 //!
69 VAStatus RenderPicture(
70 VADriverContextP ctx,
71 VAContextID context,
72 VABufferID *buffers,
73 int32_t numBuffers) override;
74
75 //!
76 //! \brief Report Status for coded buffer.
77 //!
78 //! \param [in] mediaBuf
79 //! Pointer to DDI_MEDIA_BUFFER
80 //! \param [out] buf
81 //! Pointer to buffer
82 //!
83 //! \return VAStatus
84 //! VA_STATUS_SUCCESS if success, else fail reason
85 //!
86 VAStatus StatusReport(
87 DDI_MEDIA_BUFFER *mediaBuf,
88 void **buf) override;
89
90 protected:
91 //!
92 //! \brief Reset Encode Context At Frame Level
93 //!
94 //! \return VAStatus
95 //! VA_STATUS_SUCCESS if success, else fail reason
96 //!
97 VAStatus ResetAtFrameLevel() override;
98
99 //!
100 //! \brief Encode in CodecHal for Vp8
101 //!
102 //! \param [in] numSlices
103 //! Number of slice data structures
104 //!
105 //! \return VAStatus
106 //! VA_STATUS_SUCCESS if success, else fail reason
107 //!
108 VAStatus EncodeInCodecHal(
109 uint32_t numSlices) override;
110
111 //!
112 //! \brief Parse Picture Parameter buffer to Encode Context
113 //!
114 //! \param [in] mediaCtx
115 //! Pointer to DDI_MEDIA_CONTEXT
116 //! \param [in] ptr
117 //! Pointer to Picture Parameter buffer
118 //!
119 //! \return VAStatus
120 //! VA_STATUS_SUCCESS if success, else fail reason
121 //!
122 VAStatus ParsePicParams(
123 DDI_MEDIA_CONTEXT *mediaCtx,
124 void *ptr) override;
125
126 VAStatus InitCompBuffer() override;
127
128 void FreeCompBuffer() override;
129
130 uint32_t getSequenceParameterBufferSize() override;
131
132 uint32_t getPictureParameterBufferSize() override;
133
134 uint32_t getQMatrixBufferSize() override;
135
136 //!
137 //! \brief Parse QMatrix buffer to Encode Context
138 //!
139 //! \param [in] ptr
140 //! Pointer to QMatrix buffer
141 //!
142 //! \return VAStatus
143 //! VA_STATUS_SUCCESS if success, else fail reason
144 //!
145 VAStatus Qmatrix(
146 void *ptr);
147
148 //!
149 //! \brief Parse Sequence Parameter buffer to Encode Context
150 //!
151 //! \param [in] ptr
152 //! Pointer to Sequence Parameter buffer
153 //!
154 //! \return VAStatus
155 //! VA_STATUS_SUCCESS if success, else fail reason
156 //!
157 VAStatus ParseSeqParams(
158 void *ptr);
159
160 //!
161 //! \brief Parse Misc Parameter buffer to Encode Context
162 //!
163 //! \param [in] ptr
164 //! Pointer to Misc Parameter buffer
165 //!
166 //! \return VAStatus
167 //! VA_STATUS_SUCCESS if success, else fail reason
168 //!
169 VAStatus ParseMiscParams(
170 void *ptr);
171
172 //!
173 //! \brief Parse Segment Map Parameter buffer to Encode Context
174 //!
175 //! \param [in] buf
176 //! Pointer to Segment Map Parameter buffer
177 //!
178 //! \return VAStatus
179 //! VA_STATUS_SUCCESS if success, else fail reason
180 //!
181 VAStatus ParseSegMapParams(
182 DDI_MEDIA_BUFFER *buf);
183
184 //!
185 //! \brief Updating VP8StatusReport information
186 //!
187 //! \param [in] buf
188 //! Pointer to Status Report Parameter buffer
189 //! \param [in] size
190 //! Size of Status Report Parameter buffer
191 //!
192 //! \return uint32_t
193 //! The struct size of VAEncMiscParameterVP8Status
194 //!
195 uint32_t AddExtStatusReportParam(
196 DDI_MEDIA_BUFFER *buf,
197 uint32_t size);
198
199 private:
200 //!
201 //! \brief Parse Misc Param Buffer Quality Level to Encode Context
202 //!
203 //! \param [in] data
204 //! Pointer to Misc Param Buffer Quality Level
205 //!
206 //! return void
207 //!
208 void ParseBufferQualityLevel(
209 void *data);
210
211 //!
212 //! \brief Parse Misc Param VBV Data buffer to Encode Context
213 //!
214 //! \param [in] data
215 //! Pointer to Misc Param VBV Data buffer
216 //!
217 //! return void
218 //!
219 void ParseMiscParamVBV(
220 void *data);
221
222 //!
223 //! \brief Parse Misc Param FR Data buffer to Encode Context
224 //!
225 //! \param [in] data
226 //! Pointer to Misc Param FR Data buffer
227 //!
228 //! return void
229 //!
230 void ParseMiscParamFR(
231 void *data);
232
233 //!
234 //! \brief Parse Misc Param RC Data buffer to Encode Context
235 //!
236 //! \param [in] data
237 //! Pointer to Misc Param RC Data buffer
238 //!
239 //! return void
240 //!
241 void ParseMiscParamRC(
242 void *data);
243
244 //!
245 //! \brief Parse Misc Param Private Data buffer to Encode Context
246 //!
247 //! \param [in] data
248 //! Pointer to Misc Param Private Data buffer
249 //!
250 //! return void
251 //!
252 void ParseMiscParamPrivate(
253 void *data);
254
255 //!
256 //! \brief Parse Misc Parameter Temporal Layer Params buffer to Encode Context
257 //!
258 //! \param [in] data
259 //! Pointer to Misc Parameter Temporal Layer Params buffer
260 //!
261 //! return void
262 //!
263 void ParseMiscParameterTemporalLayerParams(
264 void *data);
265
266 //!
267 //! \brief Setup Codec Picture for Vp8
268 //!
269 //! \param [in] mediaCtx
270 //! Pointer to DDI_MEDIA_CONTEXT
271 //! \param [in] rtTbl
272 //! Pointer to DDI_CODEC_RENDER_TARGET_TABLE
273 //! \param [in] surfaceID
274 //! VASurface index
275 //! \param [in] picReference
276 //! Reference picture flag
277 //! \param [out] codecHalPic
278 //! Pointer to CODEC_PICTURE
279 //!
280 //! \return void
281 //!
282 void SetupCodecPicture(
283 DDI_MEDIA_CONTEXT *mediaCtx,
284 DDI_CODEC_RENDER_TARGET_TABLE *rtTbl,
285 CODEC_PICTURE *codecHalPic,
286 VASurfaceID surfaceID,
287 bool picReference);
288
289 uint32_t m_mvOffset = 0; //!< Motion vector offset.
290 uint32_t m_framesPer100Sec = 0;
291 };