Debian Codegraph @

media_driver/agnostic/common/codec/hal/codechal_decode_vp8.h

raw
1 /*
2 * Copyright (c) 2012-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 codechal_decode_vp8.h
24 //! \brief Defines the decode interface extension for VP8.
25 //! \details Defines all types, macros, and functions required by CodecHal for VP8 decoding.
26 //! Definitions are not externally facing.
27 //!
28 #ifndef __CODECHAL_DECODER_VP8_H__
29 #define __CODECHAL_DECODER_VP8_H__
30
31 #include "codechal.h"
32 #include "codechal_hw.h"
33 #include "codechal_decoder.h"
34
35 //*------------------------------------------------------------------------------
36 //* Codec Definitions
37 //*------------------------------------------------------------------------------
38
39 //!
40 //! \enum VP8_MB_LVL_FEATURES
41 //! VP8 MB Level Features
42 //!
43 typedef enum
44 {
45 VP8_MB_LVL_ALT_Q = 0,
46 VP8_MB_LVL_ALT_LF = 1,
47 VP8_MB_LVL_MAX = 2
48 } VP8_MB_LVL_FEATURES;
49
50 //!
51 //! \enum VP8_MB_PREDICTION_MODE
52 //! VP8 MB Prediction Mode
53 //!
54 typedef enum
55 {
56 VP8_DC_PRED,
57 VP8_V_PRED,
58 VP8_H_PRED,
59 VP8_TM_PRED,
60 VP8_B_PRED,
61
62 VP8_NEARESTMV,
63 VP8_NEARMV,
64 VP8_ZEROMV,
65 VP8_NEWMV,
66 SPLITMV,
67
68 VP8_MB_MODE_COUNT
69 } VP8_MB_PREDICTION_MODE;
70
71 //!
72 //! \enum VP8_LF_TYPE
73 //! VP8 LF Type
74 //!
75 typedef enum
76 {
77 VP8_NORMAL_LF = 0,
78 VP8_SIMPLE_LF = 1
79 } VP8_LF_TYPE;
80
81 //!
82 //! \enum VP8_TOKEN_PARTITION
83 //! VP8 Token Partition
84 //!
85 typedef enum
86 {
87 VP8_ONE_PARTITION = 0,
88 VP8_TWO_PARTITION = 1,
89 VP8_FOUR_PARTITION = 2,
90 VP8_EIGHT_PARTITION = 3
91 } VP8_TOKEN_PARTITION;
92
93 //!
94 //! \enum VP8_MV_REFERENCE_FRAME
95 //! VP8 MV Reference Frame
96 //!
97 typedef enum
98 {
99 VP8_NONE = -1,
100 VP8_INTRA_FRAME = 0,
101 VP8_LAST_FRAME = 1,
102 VP8_GOLDEN_FRAME = 2,
103 VP8_ALTREF_FRAME = 3,
104 VP8_MAX_REF_FRAMES = 4
105 } VP8_MV_REFERENCE_FRAME;
106
107 //!
108 //! \def VP8_Y_MODES
109 //! VP8 Y Mode Max Index
110 //!
111 #define VP8_Y_MODES (VP8_B_PRED + 1)
112 //!
113 //! \def VP8_UV_MODES
114 //! VP8 UV Mode Max Index
115 //!
116 #define VP8_UV_MODES (VP8_TM_PRED + 1)
117
118 //!
119 //! \def VP8_MAX_MB_SEGMENTS
120 //! Max Index of VP8 MB Segment
121 //!
122 #define VP8_MAX_MB_SEGMENTS 4
123 //!
124 //! \def VP8_MB_SEGMENT_TREE_PROBS
125 //! Max Index of Prob Tree for MB Segment Id
126 //!
127 #define VP8_MB_SEGMENT_TREE_PROBS 3
128
129 //!
130 //! \def VP8_MAX_REF_LF_DELTAS
131 //! Max Index of VP8 Ref LF Deltas
132 //!
133 #define VP8_MAX_REF_LF_DELTAS 4
134 //!
135 //! \def VP8_MAX_MODE_LF_DELTAS
136 //! Max Index of VP8 Mode LF Deltas
137 //!
138 #define VP8_MAX_MODE_LF_DELTAS 4
139
140 //!
141 //! \def VP8_MAX_Q
142 //! VP8 Max Q Index
143 //!
144 #define VP8_MAX_Q 127
145 //!
146 //! \def VP8_Q_INDEX_RANGE
147 //! VP8 Q Index range
148 //!
149 #define VP8_Q_INDEX_RANGE (VP8_MAX_Q + 1)
150
151 //!
152 //! \def VP8_BLOCK_TYPES
153 //! VP8 Block Types Max Index
154 //!
155 #define VP8_BLOCK_TYPES 4
156 //!
157 //! \def VP8_COEF_BANDS
158 //! VP8 Coef Bands Max Index
159 //!
160 #define VP8_COEF_BANDS 8
161 //!
162 //! \def VP8_PREV_COEF_CONTEXTS
163 //! VP8 Prev Coef Context Max Index
164 //!
165 #define VP8_PREV_COEF_CONTEXTS 3
166 //!
167 //! \def VP8_ENTROPY_NODES
168 //! VP8 Entropy Nodes Max Index
169 //!
170 #define VP8_ENTROPY_NODES 11
171
172 //!
173 //! \struct _VP8_FRAME_CONTEXT
174 //! \brief Define variables for VP8 Frame Context
175 //!
176 typedef struct _VP8_FRAME_CONTEXT
177 {
178 uint8_t YModeProb[VP8_Y_MODES - 1];
179 uint8_t UVModeProb[VP8_UV_MODES - 1];
180 uint8_t CoefProbs[VP8_BLOCK_TYPES][VP8_COEF_BANDS][VP8_PREV_COEF_CONTEXTS][VP8_ENTROPY_NODES];
181 MV_CONTEXT MvContext[2];
182 } VP8_FRAME_CONTEXT;
183
184 typedef struct _CODECHAL_DECODE_VP8_FRAME_HEAD CODECHAL_DECODE_VP8_FRAME_HEAD, *PCODECHAL_DECODE_VP8_FRAME_HEAD;
185
186 //!
187 //! \struct _CODECHAL_DECODE_VP8_FRAME_HEAD
188 //! \brief Define variables for VP8 Frame Head
189 //!
190 struct _CODECHAL_DECODE_VP8_FRAME_HEAD
191 {
192
193 int16_t Y1DeQuant[VP8_Q_INDEX_RANGE][2];
194 int16_t Y2DeQuant[VP8_Q_INDEX_RANGE][2];
195 int16_t UVDeQuant[VP8_Q_INDEX_RANGE][2];
196
197 int32_t iNewFrameBufferIdx, iLastFrameBufferIdx, iGoldenFrameBufferIdx, iAltFrameBufferIdx;
198 int32_t iLastFrameBufferCurrIdx, iGoldenFrameBufferCurrIdx, iAltFrameBufferCurrIdx;
199
200 int32_t iFrameType;
201
202 int32_t iShowframe;
203
204 int32_t iMbNoCoeffSkip;
205 int32_t iProbSkipFalse;
206
207 int32_t iBaseQIndex;
208
209 int32_t iY1DcDeltaQ;
210 int32_t iY2DcDeltaQ;
211 int32_t iY2AcDeltaQ;
212 int32_t iUVDcDeltaQ;
213 int32_t iUVAcDeltaQ;
214
215 VP8_LF_TYPE FilterType;
216
217 int32_t iFilterLevel;
218 int32_t iSharpnessLevel;
219
220 int32_t iRefreshLastFrame;
221 int32_t iRefreshGoldenFrame;
222 int32_t iRefreshAltFrame;
223
224 int32_t iCopyBufferToGolden; //!< 0 - None, 1 - Last to Golden, 2 - ALT to Golden
225 int32_t iCopyBufferToAlt; //!< 0 - None, 1 - Last to ALT, 2 - Golden to ALT
226
227 int32_t iRefreshEntropyProbs;
228
229 int32_t RefFrameSignBias[VP8_MAX_REF_FRAMES];
230
231 VP8_FRAME_CONTEXT LastFrameContext;
232 VP8_FRAME_CONTEXT FrameContext;
233
234 int32_t iVersion;
235
236 VP8_TOKEN_PARTITION MultiTokenPartition;
237
238 uint8_t u8SegmentationEnabled;
239
240 uint8_t u8UpdateMbSegmentationMap;
241 uint8_t u8UpdateMbSegmentationData;
242
243 uint8_t u8MbSegementAbsDelta;
244
245 uint8_t MbSegmentTreeProbs[VP8_MB_SEGMENT_TREE_PROBS]; //!< Prob Tree for MB Segment Id
246
247 int8_t SegmentFeatureData[VP8_MB_LVL_MAX][VP8_MAX_MB_SEGMENTS];
248 int8_t LoopFilterLevel[VP8_MAX_MB_SEGMENTS];
249
250 uint8_t u8ModeRefLfDeltaEnabled;
251 uint8_t u8ModeRefLfDeltaUpdate;
252
253 int8_t RefLFDeltas[VP8_MAX_REF_LF_DELTAS]; //!< Intra, Last, Golden, ALT
254 int8_t ModeLFDeltas[VP8_MAX_MODE_LF_DELTAS]; //!< BPRED, ZERO_MV, MV, SPLIT
255
256 uint32_t uiFirstPartitionLengthInBytes;
257
258 uint8_t YModeProbs[4];
259 uint8_t UVModeProbs[3];
260
261 uint8_t ProbIntra;
262 uint8_t ProbLast;
263 uint8_t ProbGf;
264
265 bool bNotFirstCall;
266 };
267
268 //!
269 //! \class Vp8EntropyState
270 //! \brief This class defines the member fields, functions etc used by VP8 entropy decoder to parse frame head.
271 //!
272 class Vp8EntropyState
273 {
274 public:
275 const uint8_t m_keyFrame = 0; //!< VP8 Key Frame Flag
276 const uint8_t m_interFrame = 1; //!< VP8 Inter Frame Flag
277 const uint32_t m_bdValueSize = ((uint32_t)sizeof(uint32_t) * CHAR_BIT); // VP8 BD Value Size
278 const uint32_t m_lotsOfBits = 0x40000000; //!< Offset for parsing frame head
279 const uint8_t m_probHalf = 128; //!< VP8 Half Probability
280
281 //!
282 //! \brief Constructor
283 //!
284 Vp8EntropyState() {};
285 //!
286 //! \brief Destructor
287 //!
288 ~Vp8EntropyState() {};
289
290 //!
291 //! \brief Initialize VP8 entropy state
292 //! \details Initialize VP8 bitstream buffer and related index
293 //! \param [in] vp8FrameHeadIn
294 //! Pointer to VP8 Frame Head
295 //! \param [in] bitstreamBufferIn
296 //! Pointer to VP8 bitstream buffer
297 //! \param [in] bitstreamBufferSizeIn
298 //! VP8 bitstream buffer size
299 //! \return void
300 //!
301 void Initialize(
302 PCODECHAL_DECODE_VP8_FRAME_HEAD vp8FrameHeadIn,
303 uint8_t* bitstreamBufferIn,
304 uint32_t bitstreamBufferSizeIn);
305
306 //!
307 //! \brief Parse VP8 Frame Head
308 //! \details Parse VP8 Frame Head based on VP8 Pic Params
309 //! \param [in] vp8PicParams
310 //! Pointer to VP8 Pic Params
311 //! \return MOS_STATUS
312 //! MOS_STATUS_SUCCESS if success, else fail reason
313 //!
314 MOS_STATUS ParseFrameHead(
315 PCODEC_VP8_PIC_PARAMS vp8PicParams);
316
317 //!
318 //! \brief Update Quant Index in VP8 Frame Head
319 //! \details Update Quant Index in VP8 Frame Head for
320 //! Y/UV based on DeltaQ in VP8 Pic Params
321 //! \param [in] vp8PicParams
322 //! Pointer to VP8 Pic Params
323 //! \return void
324 //!
325 void FrameHeadQuantUpdate(
326 PCODEC_VP8_PIC_PARAMS vp8PicParams);
327
328 protected:
329 //!
330 //! \brief Initialize Frame Head in VP8 Entropy State class
331 //! \details Initialize Frame Head for VP8 Frame Head Parser
332 //! \return void
333 //!
334 void ParseFrameHeadInit();
335
336 //!
337 //! \brief Start Entropy Decode
338 //! \return int32_t
339 //! 1 if Buffer is empty or pointer is nullptr, else call DecodeFill and return 0
340 //!
341 int32_t StartEntropyDecode();
342
343 //!
344 //! \brief Update Segmentation Info in Frame Head
345 //! \details Parse bitstream to update frame head segmentation info
346 //! \return void
347 //!
348 void SegmentationEnabled();
349
350 //!
351 //! \brief Update Mv Contexts in Frame Head
352 //! \details Parse bitstream to update Mv Contexts Info
353 //! \param [out] mvContext
354 //! Pointer to Mv Contexts
355 //! \return void
356 //!
357 void ReadMvContexts(MV_CONTEXT *mvContext);
358
359 PCODECHAL_DECODE_VP8_FRAME_HEAD m_frameHead = nullptr; //!< Pointer to VP8 Frame Head
360 uint8_t * m_bitstreamBuffer = nullptr; //!< Pointer to Bitstream Buffer
361 uint32_t m_bitstreamBufferSize = 0; //!< Size of Bitstream Buffer
362 uint8_t * m_dataBuffer = nullptr; //!< Pointer to Data Buffer
363 uint8_t * m_dataBufferEnd = nullptr; //<! Pointer to Data Buffer End
364
365 private:
366 //!
367 //! \brief Update Entropy Decode State Info
368 //! \details Calculate left bitstream size to update pointer info
369 //! \return void
370 //!
371 void DecodeFill();
372
373 //!
374 //! \brief Update Entropy Decode State according to probability
375 //! \param [in] probability
376 //! Probability to do entropy decode
377 //! \return uint32_t
378 //! return 1 if entropy decode value meets the requirement of probability, else 0
379 //!
380 uint32_t DecodeBool(int32_t probability);
381
382 //!
383 //! \brief Update Entropy Decode State according to Bits Number
384 //! \param [in] bits
385 //! Bits to do entropy decode
386 //! \return int32_t
387 //! return value calculated by DecodeBool using 0x80 as probability
388 //!
389 int32_t DecodeValue(int32_t bits);
390
391 //!
392 //! \brief Update Loop Filter Info in VP8 Frame Header
393 //! \param [in] defaultFilterLvl
394 //! Default Segmentation Level
395 //! \return void
396 //!
397 void LoopFilterInit(int32_t defaultFilterLvl);
398
399 //!
400 //! \brief Update Loop Filter Deltas and Default Loop Filter Level
401 //! \details Parse Loop Filter Deltas and Default Loop Filter Level Info to
402 //! Initialize Loop Filter
403 //! \return void
404 //!
405 void LoopFilterEnabled();
406
407 //!
408 //! \brief Get DeltaQ from Frame Header
409 //! \details Parse Frame Header to Get DeltaQ value Based on
410 //! Current DeltaQ Value and Update info
411 //! \param [in] prevVal
412 //! Previous DeltaQ Value
413 //! \param [in] qupdate
414 //! Pointer to DeltaQ Update Value
415 //! \return int32_t
416 //! Return Calculated DeltaQ Value
417 //!
418 int32_t GetDeltaQ(int32_t prevVal, int32_t * qupdate);
419
420 //!
421 //! \brief Get DC Quant Value from Lookup Table
422 //! \param [in] qindex
423 //! Quant Index
424 //! \param [in] delta
425 //! Quant Index Offset
426 //! \return int32_t
427 //! Return DC Quant Value in Lookup Table with Index and Offset
428 //!
429 int32_t DcQuant(int32_t qindex, int32_t delta);
430
431 //!
432 //! \brief Get Double DC Quant Value from Lookup Table
433 //! \param [in] qindex
434 //! Quant Index
435 //! \param [in] delta
436 //! Quant Index Offset
437 //! \return int32_t
438 //! Return Double DC Quant Value in Lookup Table with Index and Offset
439 //!
440 int32_t Dc2Quant(int32_t qindex, int32_t delta);
441
442 //!
443 //! \brief Get DC Quant Value from Lookup Table for UV
444 //! \param [in] qindex
445 //! Quant Index
446 //! \param [in] delta
447 //! Quant Index Offset
448 //! \return int32_t
449 //! Return DC Quant Value in Lookup Table with Index and Offset for UV
450 //!
451 int32_t DcUVQuant(int32_t qindex, int32_t delta);
452
453 //!
454 //! \brief Get AC Quant Value from Lookup Table for Y
455 //! \param [in] qindex
456 //! Quant Index
457 //! \return int32_t
458 //! Return AC Quant Value in Lookup Table with Index and Offset for Y
459 //!
460 int32_t AcYQuant(int32_t qindex);
461
462 //!
463 //! \brief Get ~Double AC Quant Value from Lookup Table
464 //! \param [in] qindex
465 //! Quant Index
466 //! \param [in] delta
467 //! Quant Index Offset
468 //! \return int32_t
469 //! Return AC Quant Value in Lookup Table with Index and Offset
470 //! Multiplied by 101581 and Then Devided by 2^16 (About 1.55)
471 //!
472 int32_t Ac2Quant(int32_t qindex, int32_t delta);
473
474 //!
475 //! \brief Get AC Quant Value from Lookup Table for UV
476 //! \param [in] qindex
477 //! Quant Index
478 //! \param [in] delta
479 //! Quant Index Offset
480 //! \return int32_t
481 //! Return AC Quant Value in Lookup Table with Index and Offset for UV
482 //!
483 int32_t AcUVQuant(int32_t qindex, int32_t delta);
484
485 //!
486 //! \brief Initialize Quant Table for Y/UV in Frame Head
487 //! \return void
488 //!
489 void QuantInit();
490
491 //!
492 //! \brief Initialize DC/AC DeltaQ Value in Frame Head for Y/UV
493 //! \return void
494 //!
495 void QuantSetup();
496
497 const uint8_t *m_bufferEnd = nullptr; //!< Pointer to Data Buffer End
498 const uint8_t *m_buffer = nullptr; //!< Pointer to Data Buffer
499 int32_t m_count = 0; //!< Bits Count for Bitstream Buffer
500 uint32_t m_value = 0; //!< Entropy Value
501 uint32_t m_range = 0; //!< Entropy Range
502 };
503
504 using PVP8_ENTROPY_STATE = Vp8EntropyState*;
505
506 //!
507 //! \class CodechalDecodeVp8
508 //! \brief This class defines the member fields, functions etc used by VP8 decoder.
509 //!
510 class CodechalDecodeVp8 : public CodechalDecode
511 {
512 public:
513 const int32_t m_codechalDecodeVp8CoeffprobTableSize = 4 * 8 * 3 * 11;
514
515 //!
516 //! \brief Constructor
517 //! \param [in] hwInterface
518 //! Hardware interface
519 //! \param [in] debugInterface
520 //! Debug interface
521 //! \param [in] standardInfo
522 //! The information of decode standard for this instance
523 //!
524 CodechalDecodeVp8(
525 CodechalHwInterface *hwInterface,
526 CodechalDebugInterface* debugInterface,
527 PCODECHAL_STANDARD_INFO standardInfo);
528
529 //!
530 //! \brief Destructor
531 //!
532 ~CodechalDecodeVp8();
533
534 //!
535 //! \brief Allocate and initialize VP8 decoder standard
536 //! \param [in] settings
537 //! Pointer to CodechalSetting
538 //! \return MOS_STATUS
539 //! MOS_STATUS_SUCCESS if success, else fail reason
540 //!
541 MOS_STATUS AllocateStandard(
542 CodechalSetting * settings) override;
543
544 //!
545 //! \brief Set states for each frame to prepare for VP8 decode
546 //! \return MOS_STATUS
547 //! MOS_STATUS_SUCCESS if success, else fail reason
548 //!
549 MOS_STATUS SetFrameStates() override;
550
551 //!
552 //! \brief VP8 decoder state level function
553 //! \details State level function for VP8 decoder
554 //!
555 //! \return MOS_STATUS
556 //! MOS_STATUS_SUCCESS if success, else fail reason
557 //!
558 MOS_STATUS DecodeStateLevel() override;
559
560 //!
561 //! \brief VP9 decoder primitive level function
562 //! \details Primitive level function for GEN specific VP8 decoder
563 //!
564 //! \return MOS_STATUS
565 //! MOS_STATUS_SUCCESS if success, else fail reason
566 //!
567 MOS_STATUS DecodePrimitiveLevel() override;
568
569 MOS_STATUS InitMmcState() override;
570
571 //!
572 //! \brief Allocate fixed sized resources
573 //! \details Allocate fixed sized resources VP8 decode driver
574 //! \return MOS_STATUS
575 //! MOS_STATUS_SUCCESS if success, else fail reason
576 //!
577 MOS_STATUS AllocateResourcesFixedSizes();
578
579 //!
580 //! \brief Allocate variable sized resources
581 //! \details Allocate variable sized resources in VP8 decode driver
582 //! \return MOS_STATUS
583 //! MOS_STATUS_SUCCESS if success, else fail reason
584 //!
585 MOS_STATUS AllocateResourcesVariableSizes();
586
587 // Parameters passed by application
588 uint16_t m_picWidthInMbLastMaxAlloced; //!< Max Picture Width in MB used for buffer allocation in past frames
589 uint16_t m_picHeightInMbLastMaxAlloced; //!< Max Picture Height in MB used for buffer allocation in past frames
590 bool m_shortFormatInUse; //!< Short Format Indicator
591 uint32_t m_dataSize; //!< Data Size in Decode Params
592 uint32_t m_dataOffset; //!< Data Offset in Decode Params
593 PCODEC_VP8_PIC_PARAMS m_vp8PicParams; //!< Pointer to VP8 Pic Params
594 PCODEC_VP8_IQ_MATRIX_PARAMS m_vp8IqMatrixParams; //!< Pointer to VP8 IQ Matrix Params
595 MOS_SURFACE m_destSurface; //!< Pointer to MOS_SURFACE of render surface
596 PMOS_RESOURCE m_presLastRefSurface; //!< Pointer to resource of Last Reference Surface
597 PMOS_RESOURCE m_presGoldenRefSurface; //!< Pointer to resource of Golden Reference Surface
598 PMOS_RESOURCE m_presAltRefSurface; //!< Pointer to resource of Alternate Reference Surface
599 MOS_RESOURCE m_resDataBuffer; //!< Graphics resource of bitstream data surface
600 MOS_RESOURCE m_resCoefProbBuffer; //!< Graphics resource of Coefficient Probability data surface
601
602 // Track for several row store buffer's max picture width in MB used for buffer allocation in past frames
603 uint16_t m_mfdDeblockingFilterRowStoreScratchBufferPicWidthInMb;
604 uint16_t m_mfdIntraRowStoreScratchBufferPicWidthInMb;
605 uint16_t m_bsdMpcRowStoreScratchBufferPicWidthInMb;
606
607 // Internally maintained
608 MOS_RESOURCE m_resTmpBitstreamBuffer; //!< Graphics resource of Bitstream data surface
609 MOS_RESOURCE m_resMfdIntraRowStoreScratchBuffer; //!< Graphics resource of MFD Intra Row Store Scratch data surface
610 MOS_RESOURCE m_resMfdDeblockingFilterRowStoreScratchBuffer; //!< Graphics resource of MFD Deblocking Filter Row Store Scratch data surface
611 MOS_RESOURCE m_resBsdMpcRowStoreScratchBuffer; //!< Graphics resource of BSD/MPC Row Store Scratch data surface
612 MOS_RESOURCE m_resMprRowStoreScratchBuffer; //!< Graphics resource of MPR Row Store Scratch data surface
613 MOS_RESOURCE m_resSegmentationIdStreamBuffer; //!< Graphics resource of Segmentation ID Stream data surface
614 PCODEC_REF_LIST m_vp8RefList[CODECHAL_NUM_UNCOMPRESSED_SURFACE_VP8]; //!< VP8 Reference List
615 MOS_RESOURCE m_resSyncObject; //!< Graphics resource of Sync Object
616 MOS_RESOURCE m_resPrivateInputBuffer; //!< Graphics resource of private surface for bitstream and coeff prob table
617 uint32_t m_privateInputBufferSize; //!< Size of private surface
618 uint32_t m_coeffProbTableOffset; //!< Coefficient Probability Table Offset
619
620 bool m_deblockingEnabled; //!< VP8 Loop Filter Enable Indicator
621
622 // VP8 Frame Head
623 Vp8EntropyState m_vp8EntropyState; //!< VP8 Entropy State class to parse frame head
624 CODECHAL_DECODE_VP8_FRAME_HEAD m_vp8FrameHead; //!< VP8 Frame Head
625
626 // HuC copy related
627 bool m_huCCopyInUse; //!< a sync flag used when huc copy and decoder run in the different VDBOX
628 MOS_RESOURCE m_resSyncObjectWaContextInUse; //!< signals on the video WA context
629 MOS_RESOURCE m_resSyncObjectVideoContextInUse; //!< signals on the video context
630
631 protected:
632 //!
633 //! \brief Parse Frame Head
634 //! \details Parse Frame Head from Bitstream Buffer for VP8
635 //!
636 //! \param [in] bitstreamBuffer
637 //! Pointer to input Bitstream Buffer
638 //! \param [in] bitstreamBufferSize
639 //! Size of Input Bitstream Buffer
640 //! \return MOS_STATUS
641 //! MOS_STATUS_SUCCESS if success, else fail reason
642 //!
643 MOS_STATUS ParseFrameHead(
644 uint8_t* bitstreamBuffer,
645 uint32_t bitstreamBufferSize);
646
647 //!
648 //! \brief Copy Bitstream Buffer
649 //! \details Copy Bitstream Buffer from Source to Destiny
650 //!
651 //! \param [in] srcBitstreamBuffer
652 //! Resource of Source Bitstream Buffer
653 //! \param [in] dstBitstreamBuffer
654 //! Pointer to Resource of Destiny Bitstream Buffer
655 //! \param [in] size
656 //! Size of Bitstream Buffer
657 //! \return MOS_STATUS
658 //! MOS_STATUS_SUCCESS if success, else fail reason
659 //!
660 MOS_STATUS CopyBitstreamBuffer(
661 MOS_RESOURCE srcBitstreamBuffer,
662 PMOS_RESOURCE dstBitstreamBuffer,
663 uint32_t size);
664
665 #if USE_CODECHAL_DEBUG_TOOL
666 MOS_STATUS DumpPicParams(
667 PCODEC_VP8_PIC_PARAMS picParams);
668
669 MOS_STATUS DumpIQParams(
670 PCODEC_VP8_IQ_MATRIX_PARAMS matrixData);
671 #endif
672 };
673
674 #endif // __CODECHAL_DECODER_VP8_H__