1 /*
2 * Copyright (c) 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     codec_def_decode_vp8.h
24 //! \brief    Defines decode VP8 types and macros shared by CodecHal, MHW, and DDI layer
25 //! \details  Applies to VP8 decode only. Should not contain any DDI specific code.
26 //!
27 #ifndef __CODEC_DEF_DECODE_VP8_H__
28 #define __CODEC_DEF_DECODE_VP8_H__
29 
30 #include "codec_def_common.h"
31 
32 #define CODEC_VP8_MVP_COUNT                     19
33 #define CODEC_VP8_MAX_PARTITION_NUMBER          9
34 
35 // VP8 Picture Parameters
36 typedef struct _CODEC_VP8_PIC_PARAMS
37 {
38     CODEC_PICTURE       CurrPic;
39     uint16_t            wFrameWidthInMbsMinus1;
40     uint16_t            wFrameHeightInMbsMinus1;
41     uint32_t            uiFirstPartitionSize;
42     uint8_t             ucCurrPicIndex;
43     uint8_t             ucLastRefPicIndex;
44     uint8_t             ucGoldenRefPicIndex;
45     uint8_t             ucAltRefPicIndex;
46     uint8_t             ucDeblockedPicIndex;
47     uint8_t             ucReserved8Bits;
48 
49     union
50     {
51         uint16_t              wPicFlags;
52         struct
53         {
54             uint16_t              key_frame                   : 1;
55             uint16_t              version                     : 3;
56             uint16_t              segmentation_enabled        : 1;
57             uint16_t              update_mb_segmentation_map  : 1;
58             uint16_t              update_segment_feature_data : 1;
59             uint16_t              mb_segement_abs_delta       : 1;
60             uint16_t              filter_type                 : 1;
61             uint16_t              sign_bias_golden            : 1;
62             uint16_t              sign_bias_alternate         : 1;
63             uint16_t              mb_no_coeff_skip            : 1;
64             uint16_t              mode_ref_lf_delta_update    : 1;
65             uint16_t              CodedCoeffTokenPartition    : 2;
66             uint16_t              LoopFilterDisable           : 1;
67             uint16_t              loop_filter_adj_enable      : 1;
68         };
69     };
70 
71     uint8_t             ucFilterLevel;
72     uint8_t             ucBaseQIndex;
73     char                cY1DcDeltaQ;
74     char                cY2DcDeltaQ;
75     char                cY2AcDeltaQ;
76     char                cUVDcDeltaQ;
77     char                cUVAcDeltaQ;
78 
79     char                cSegmentFeatureData[2][4];
80     uint8_t             ucLoopFilterLevel[4];
81     char                cRefLfDelta[4];
82     char                cModeLfDelta[4];
83     uint8_t             ucSharpnessLevel;
84     char                cMbSegmentTreeProbs[3];
85     uint8_t             ucProbSkipFalse;
86     uint8_t             ucProbIntra;
87     uint8_t             ucProbLast;
88     uint8_t             ucProbGolden;
89     uint8_t             ucYModeProbs[4];
90     uint8_t             ucUvModeProbs[3];
91     uint8_t             ucReserved8Bits1;
92     uint8_t             ucMvUpdateProb[2][CODEC_VP8_MVP_COUNT];      // 2 for decoding row and column components
93     uint8_t             ucP0EntropyCount;
94     uint8_t             ucP0EntropyValue;
95     uint32_t            uiP0EntropyRange;
96     uint32_t            uiFirstMbByteOffset;
97     uint32_t            uiPartitionSize[CODEC_VP8_MAX_PARTITION_NUMBER];
98 
99     uint32_t            uiStatusReportFeedbackNumber;
100 } CODEC_VP8_PIC_PARAMS, *PCODEC_VP8_PIC_PARAMS;
101 
102 // VP8 Slice Parameters
103 typedef struct _CODEC_VP8_SLICE_PARAMS {
104     uint32_t                BSNALunitDataLocation;
105     uint32_t                SliceBytesInBuffer;
106 } CODEC_VP8_SLICE_PARAMS, *PCODEC_VP8_SLICE_PARAMS;
107 
108 // VP8 Inverse Quantization Matrix Buffer
109 typedef struct _CODEC_VP8_IQ_MATRIX_PARAMS
110 {
111     uint16_t              quantization_values[4][6];
112 } CODEC_VP8_IQ_MATRIX_PARAMS, *PCODEC_VP8_IQ_MATRIX_PARAMS;
113 
114 #endif
115 
116