blob: 731b1a6dfb576fc0ec8dd8adf91bfeb55617ca98
1 | /* |
2 | * drivers/amvdec_ports/decoder/aml_vp9_parser.h |
3 | * |
4 | * Copyright (C) 2015 Amlogic, Inc. All rights reserved. |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
14 | * more details. |
15 | * |
16 | */ |
17 | |
18 | |
19 | #ifndef AML_VP9_PARSER_H |
20 | #define AML_VP9_PARSER_H |
21 | |
22 | enum BlockPartition { |
23 | PARTITION_NONE, // [ ] <-. |
24 | PARTITION_H, // [-] | |
25 | PARTITION_V, // [|] | |
26 | PARTITION_SPLIT, // [+] --' |
27 | }; |
28 | |
29 | enum InterPredMode { |
30 | NEARESTMV = 10, |
31 | NEARMV = 11, |
32 | ZEROMV = 12, |
33 | NEWMV = 13, |
34 | }; |
35 | |
36 | enum CompPredMode { |
37 | PRED_SINGLEREF, |
38 | PRED_COMPREF, |
39 | PRED_SWITCHABLE, |
40 | }; |
41 | |
42 | enum BlockLevel { |
43 | BL_64X64, |
44 | BL_32X32, |
45 | BL_16X16, |
46 | BL_8X8, |
47 | }; |
48 | |
49 | enum BlockSize { |
50 | BS_64x64, |
51 | BS_64x32, |
52 | BS_32x64, |
53 | BS_32x32, |
54 | BS_32x16, |
55 | BS_16x32, |
56 | BS_16x16, |
57 | BS_16x8, |
58 | BS_8x16, |
59 | BS_8x8, |
60 | BS_8x4, |
61 | BS_4x8, |
62 | BS_4x4, |
63 | N_BS_SIZES, |
64 | }; |
65 | |
66 | enum FilterMode { |
67 | MODE_NONE, |
68 | MODE_INTERLEAVE, |
69 | MODE_DEINTERLEAVE |
70 | }; |
71 | |
72 | enum TxfmMode { |
73 | TX_4X4, |
74 | TX_8X8, |
75 | TX_16X16, |
76 | TX_32X32, |
77 | N_TXFM_SIZES, |
78 | TX_SWITCHABLE = N_TXFM_SIZES, |
79 | N_TXFM_MODES |
80 | }; |
81 | |
82 | enum TxfmType { |
83 | DCT_DCT, |
84 | DCT_ADST, |
85 | ADST_DCT, |
86 | ADST_ADST, |
87 | N_TXFM_TYPES |
88 | }; |
89 | |
90 | enum IntraPredMode { |
91 | VERT_PRED, |
92 | HOR_PRED, |
93 | DC_PRED, |
94 | DIAG_DOWN_LEFT_PRED, |
95 | DIAG_DOWN_RIGHT_PRED, |
96 | VERT_RIGHT_PRED, |
97 | HOR_DOWN_PRED, |
98 | VERT_LEFT_PRED, |
99 | HOR_UP_PRED, |
100 | TM_VP8_PRED, |
101 | LEFT_DC_PRED, |
102 | TOP_DC_PRED, |
103 | DC_128_PRED, |
104 | DC_127_PRED, |
105 | DC_129_PRED, |
106 | N_INTRA_PRED_MODES |
107 | }; |
108 | |
109 | struct VP9BitstreamHeader { |
110 | // bitstream header |
111 | u8 profile; |
112 | u8 bpp; |
113 | u8 keyframe; |
114 | u8 invisible; |
115 | u8 errorres; |
116 | u8 intraonly; |
117 | u8 resetctx; |
118 | u8 refreshrefmask; |
119 | u8 highprecisionmvs; |
120 | enum FilterMode filtermode; |
121 | u8 allowcompinter; |
122 | u8 refreshctx; |
123 | u8 parallelmode; |
124 | u8 framectxid; |
125 | u8 use_last_frame_mvs; |
126 | u8 refidx[3]; |
127 | u8 signbias[3]; |
128 | u8 fixcompref; |
129 | u8 varcompref[2]; |
130 | struct { |
131 | u8 level; |
132 | int8_t sharpness; |
133 | } filter; |
134 | struct { |
135 | u8 enabled; |
136 | u8 updated; |
137 | char mode[2]; |
138 | char ref[4]; |
139 | } lf_delta; |
140 | u8 yac_qi; |
141 | char ydc_qdelta, uvdc_qdelta, uvac_qdelta; |
142 | u8 lossless; |
143 | #define MAX_SEGMENT 8 |
144 | struct { |
145 | u8 enabled; |
146 | u8 temporal; |
147 | u8 absolute_vals; |
148 | u8 update_map; |
149 | u8 prob[7]; |
150 | u8 pred_prob[3]; |
151 | struct { |
152 | u8 q_enabled; |
153 | u8 lf_enabled; |
154 | u8 ref_enabled; |
155 | u8 skip_enabled; |
156 | u8 ref_val; |
157 | s16 q_val; |
158 | char lf_val; |
159 | s16 qmul[2][2]; |
160 | u8 lflvl[4][2]; |
161 | } feat[MAX_SEGMENT]; |
162 | } segmentation; |
163 | enum TxfmMode txfmmode; |
164 | enum CompPredMode comppredmode; |
165 | struct { |
166 | u32 log2_tile_cols, log2_tile_rows; |
167 | u32 tile_cols, tile_rows; |
168 | } tiling; |
169 | |
170 | int uncompressed_header_size; |
171 | int compressed_header_size; |
172 | }; |
173 | |
174 | struct vp9_head_info_t { |
175 | bool parsed; |
176 | struct VP9BitstreamHeader info; |
177 | }; |
178 | |
179 | #endif //AML_VP9_PARSER_H |
180 |