1 /*
2  * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3  * Copyright (c) Imagination Technologies Limited, UK
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sub license, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the
14  * next paragraph) shall be included in all copies or substantial portions
15  * of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 #ifndef _REGCONV_H_topaz_vlc_regs_h
27 #define _REGCONV_H_topaz_vlc_regs_h
28 
29 #ifdef __cplusplus
30 #include "img_types.h"
31 #include "systemc_utils.h"
32 #endif
33 
34 
35 /* Register CR_VLC_CONTROL */
36 #define TOPAZ_VLC_CR_VLC_CONTROL    0x0000
37 #define MASK_TOPAZ_VLC_CR_CODEC     0x00000003
38 #define SHIFT_TOPAZ_VLC_CR_CODEC    0
39 #define REGNUM_TOPAZ_VLC_CR_CODEC   0x0000
40 #define SIGNED_TOPAZ_VLC_CR_CODEC   0
41 
42 #define MASK_TOPAZ_VLC_CR_SLICE_CODING_TYPE 0x0000000C
43 #define SHIFT_TOPAZ_VLC_CR_SLICE_CODING_TYPE 2
44 #define REGNUM_TOPAZ_VLC_CR_SLICE_CODING_TYPE 0x0000
45 #define SIGNED_TOPAZ_VLC_CR_SLICE_CODING_TYPE 0
46 
47 #define MASK_TOPAZ_VLC_CR_START     0x00000010
48 #define SHIFT_TOPAZ_VLC_CR_START    4
49 #define REGNUM_TOPAZ_VLC_CR_START   0x0000
50 #define SIGNED_TOPAZ_VLC_CR_START   0
51 
52 #define MASK_TOPAZ_VLC_CR_FLUSH     0x00000020
53 #define SHIFT_TOPAZ_VLC_CR_FLUSH    5
54 #define REGNUM_TOPAZ_VLC_CR_FLUSH   0x0000
55 #define SIGNED_TOPAZ_VLC_CR_FLUSH   0
56 
57 #define MASK_TOPAZ_VLC_CR_FORCE_SKIP 0x00000040
58 #define SHIFT_TOPAZ_VLC_CR_FORCE_SKIP 6
59 #define REGNUM_TOPAZ_VLC_CR_FORCE_SKIP 0x0000
60 #define SIGNED_TOPAZ_VLC_CR_FORCE_SKIP 0
61 
62 #define MASK_TOPAZ_VLC_CR_DISABLE_SKIP 0x00000080
63 #define SHIFT_TOPAZ_VLC_CR_DISABLE_SKIP 7
64 #define REGNUM_TOPAZ_VLC_CR_DISABLE_SKIP 0x0000
65 #define SIGNED_TOPAZ_VLC_CR_DISABLE_SKIP 0
66 
67 #define MASK_TOPAZ_VLC_CR_CABAC_ENABLE 0x00000100
68 #define SHIFT_TOPAZ_VLC_CR_CABAC_ENABLE 8
69 #define REGNUM_TOPAZ_VLC_CR_CABAC_ENABLE 0x0000
70 #define SIGNED_TOPAZ_VLC_CR_CABAC_ENABLE 0
71 
72 #define MASK_TOPAZ_VLC_CR_VLC_FIELD_CODED 0x00000200
73 #define SHIFT_TOPAZ_VLC_CR_VLC_FIELD_CODED 9
74 #define REGNUM_TOPAZ_VLC_CR_VLC_FIELD_CODED 0x0000
75 #define SIGNED_TOPAZ_VLC_CR_VLC_FIELD_CODED 0
76 
77 #define MASK_TOPAZ_VLC_CR_VLC_8X8_TRANSFORM 0x00000400
78 #define SHIFT_TOPAZ_VLC_CR_VLC_8X8_TRANSFORM 10
79 #define REGNUM_TOPAZ_VLC_CR_VLC_8X8_TRANSFORM 0x0000
80 #define SIGNED_TOPAZ_VLC_CR_VLC_8X8_TRANSFORM 0
81 
82 #define MASK_TOPAZ_VLC_CR_VLC_CONSTRAINED_INTRA 0x00000800
83 #define SHIFT_TOPAZ_VLC_CR_VLC_CONSTRAINED_INTRA 11
84 #define REGNUM_TOPAZ_VLC_CR_VLC_CONSTRAINED_INTRA 0x0000
85 #define SIGNED_TOPAZ_VLC_CR_VLC_CONSTRAINED_INTRA 0
86 
87 #define MASK_TOPAZ_VLC_CR_VLC_SPATIAL_DIRECT 0x00001000
88 #define SHIFT_TOPAZ_VLC_CR_VLC_SPATIAL_DIRECT 12
89 #define REGNUM_TOPAZ_VLC_CR_VLC_SPATIAL_DIRECT 0x0000
90 #define SIGNED_TOPAZ_VLC_CR_VLC_SPATIAL_DIRECT 0
91 
92 #define MASK_TOPAZ_VLC_CR_VLC_P_REF_IDX 0x00002000
93 #define SHIFT_TOPAZ_VLC_CR_VLC_P_REF_IDX 13
94 #define REGNUM_TOPAZ_VLC_CR_VLC_P_REF_IDX 0x0000
95 #define SIGNED_TOPAZ_VLC_CR_VLC_P_REF_IDX 0
96 
97 #define MASK_TOPAZ_VLC_CR_DISCARD_CODED_DATA 0x00004000
98 #define SHIFT_TOPAZ_VLC_CR_DISCARD_CODED_DATA 14
99 #define REGNUM_TOPAZ_VLC_CR_DISCARD_CODED_DATA 0x0000
100 #define SIGNED_TOPAZ_VLC_CR_DISCARD_CODED_DATA 0
101 
102 #define MASK_TOPAZ_VLC_CR_FIELD_SELECT 0x00008000
103 #define SHIFT_TOPAZ_VLC_CR_FIELD_SELECT 15
104 #define REGNUM_TOPAZ_VLC_CR_FIELD_SELECT 0x0000
105 #define SIGNED_TOPAZ_VLC_CR_FIELD_SELECT 0
106 
107 #define MASK_TOPAZ_VLC_CR_CODEC_EXTEND 0x10000000
108 #define SHIFT_TOPAZ_VLC_CR_CODEC_EXTEND 28
109 #define REGNUM_TOPAZ_VLC_CR_CODEC_EXTEND 0x0000
110 #define SIGNED_TOPAZ_VLC_CR_CODEC_EXTEND 0
111 
112 /* Register CR_VLC_STATUS */
113 #define TOPAZ_VLC_CR_VLC_STATUS     0x0004
114 #define MASK_TOPAZ_VLC_CR_BUSY      0x00000001
115 #define SHIFT_TOPAZ_VLC_CR_BUSY     0
116 #define REGNUM_TOPAZ_VLC_CR_BUSY    0x0004
117 #define SIGNED_TOPAZ_VLC_CR_BUSY    0
118 
119 #define MASK_TOPAZ_VLC_CR_RECODE_AS_IPCM 0x00000004
120 #define SHIFT_TOPAZ_VLC_CR_RECODE_AS_IPCM 2
121 #define REGNUM_TOPAZ_VLC_CR_RECODE_AS_IPCM 0x0004
122 #define SIGNED_TOPAZ_VLC_CR_RECODE_AS_IPCM 0
123 
124 /* Register CR_VLC_INFO_0 */
125 #define TOPAZ_VLC_CR_VLC_INFO_0     0x0008
126 #define MASK_TOPAZ_VLC_CR_FLUSH_STUFFING_BYTES 0x0003E000
127 #define SHIFT_TOPAZ_VLC_CR_FLUSH_STUFFING_BYTES 13
128 #define REGNUM_TOPAZ_VLC_CR_FLUSH_STUFFING_BYTES 0x0008
129 #define SIGNED_TOPAZ_VLC_CR_FLUSH_STUFFING_BYTES 0
130 
131 /* Register CR_VLC_INFO_1 */
132 #define TOPAZ_VLC_CR_VLC_INFO_1     0x000C
133 #define MASK_TOPAZ_VLC_CR_SKIPPED_MBS_IN_FRAME 0x0000FFFF
134 #define SHIFT_TOPAZ_VLC_CR_SKIPPED_MBS_IN_FRAME 0
135 #define REGNUM_TOPAZ_VLC_CR_SKIPPED_MBS_IN_FRAME 0x000C
136 #define SIGNED_TOPAZ_VLC_CR_SKIPPED_MBS_IN_FRAME 0
137 
138 #define MASK_TOPAZ_VLC_CR_CODED_MBS_IN_FRAME 0xFFFF0000
139 #define SHIFT_TOPAZ_VLC_CR_CODED_MBS_IN_FRAME 16
140 #define REGNUM_TOPAZ_VLC_CR_CODED_MBS_IN_FRAME 0x000C
141 #define SIGNED_TOPAZ_VLC_CR_CODED_MBS_IN_FRAME 0
142 
143 /* Register CR_VLC_INFO_2 */
144 #define TOPAZ_VLC_CR_VLC_INFO_2     0x0010
145 #define MASK_TOPAZ_VLC_CR_INTRA_MBS_IN_FRAME 0x0000FFFF
146 #define SHIFT_TOPAZ_VLC_CR_INTRA_MBS_IN_FRAME 0
147 #define REGNUM_TOPAZ_VLC_CR_INTRA_MBS_IN_FRAME 0x0010
148 #define SIGNED_TOPAZ_VLC_CR_INTRA_MBS_IN_FRAME 0
149 
150 #define MASK_TOPAZ_VLC_CR_INTER_MBS_IN_FRAME 0xFFFF0000
151 #define SHIFT_TOPAZ_VLC_CR_INTER_MBS_IN_FRAME 16
152 #define REGNUM_TOPAZ_VLC_CR_INTER_MBS_IN_FRAME 0x0010
153 #define SIGNED_TOPAZ_VLC_CR_INTER_MBS_IN_FRAME 0
154 
155 /* Register CR_VLC_STUFF_HEAD_CTRL */
156 #define TOPAZ_VLC_CR_VLC_STUFF_HEAD_CTRL 0x0014
157 #define MASK_TOPAZ_VLC_CR_HEADER_ELEMENTS 0x0000001F
158 #define SHIFT_TOPAZ_VLC_CR_HEADER_ELEMENTS 0
159 #define REGNUM_TOPAZ_VLC_CR_HEADER_ELEMENTS 0x0014
160 #define SIGNED_TOPAZ_VLC_CR_HEADER_ELEMENTS 0
161 
162 #define MASK_TOPAZ_VLC_CR_STUFFING_WORDS 0x00003FE0
163 #define SHIFT_TOPAZ_VLC_CR_STUFFING_WORDS 5
164 #define REGNUM_TOPAZ_VLC_CR_STUFFING_WORDS 0x0014
165 #define SIGNED_TOPAZ_VLC_CR_STUFFING_WORDS 0
166 
167 #define MASK_TOPAZ_VLC_CR_CLEAR_HEADER_FIFO 0x80000000
168 #define SHIFT_TOPAZ_VLC_CR_CLEAR_HEADER_FIFO 31
169 #define REGNUM_TOPAZ_VLC_CR_CLEAR_HEADER_FIFO 0x0014
170 #define SIGNED_TOPAZ_VLC_CR_CLEAR_HEADER_FIFO 0
171 
172 /* Register CR_VLC_HEADER_FIFO */
173 #define TOPAZ_VLC_CR_VLC_HEADER_FIFO 0x0018
174 #define MASK_TOPAZ_VLC_CR_HEADER_DATA 0xFFFFFFFF
175 #define SHIFT_TOPAZ_VLC_CR_HEADER_DATA 0
176 #define REGNUM_TOPAZ_VLC_CR_HEADER_DATA 0x0018
177 #define SIGNED_TOPAZ_VLC_CR_HEADER_DATA 0
178 
179 /* Register CR_VLC_HEADER_CTRL */
180 #define TOPAZ_VLC_CR_VLC_HEADER_CTRL 0x001C
181 #define MASK_TOPAZ_VLC_CR_HEADER_PREFIX 0x7FFFFFFF
182 #define SHIFT_TOPAZ_VLC_CR_HEADER_PREFIX 0
183 #define REGNUM_TOPAZ_VLC_CR_HEADER_PREFIX 0x001C
184 #define SIGNED_TOPAZ_VLC_CR_HEADER_PREFIX 0
185 
186 #define MASK_TOPAZ_VLC_CR_DISABLE_PREFIX_DETECTION 0x80000000
187 #define SHIFT_TOPAZ_VLC_CR_DISABLE_PREFIX_DETECTION 31
188 #define REGNUM_TOPAZ_VLC_CR_DISABLE_PREFIX_DETECTION 0x001C
189 #define SIGNED_TOPAZ_VLC_CR_DISABLE_PREFIX_DETECTION 0
190 
191 /* Register CR_VLC_HEADER_STATUS */
192 #define TOPAZ_VLC_CR_VLC_HEADER_STATUS 0x0020
193 #define MASK_TOPAZ_VLC_CR_HEADER_FIFO_FULL 0x00000001
194 #define SHIFT_TOPAZ_VLC_CR_HEADER_FIFO_FULL 0
195 #define REGNUM_TOPAZ_VLC_CR_HEADER_FIFO_FULL 0x0020
196 #define SIGNED_TOPAZ_VLC_CR_HEADER_FIFO_FULL 0
197 
198 /* Register CR_VLC_RATE_CTRL_MB_TYPE */
199 #define TOPAZ_VLC_CR_VLC_RATE_CTRL_MB_TYPE 0x0024
200 #define MASK_TOPAZ_VLC_CR_MB_CODING_TYPE_P 0x000000FF
201 #define SHIFT_TOPAZ_VLC_CR_MB_CODING_TYPE_P 0
202 #define REGNUM_TOPAZ_VLC_CR_MB_CODING_TYPE_P 0x0024
203 #define SIGNED_TOPAZ_VLC_CR_MB_CODING_TYPE_P 0
204 
205 #define MASK_TOPAZ_VLC_CR_MB_CODING_TYPE_I 0x0000FF00
206 #define SHIFT_TOPAZ_VLC_CR_MB_CODING_TYPE_I 8
207 #define REGNUM_TOPAZ_VLC_CR_MB_CODING_TYPE_I 0x0024
208 #define SIGNED_TOPAZ_VLC_CR_MB_CODING_TYPE_I 0
209 
210 #define MASK_TOPAZ_VLC_CR_MB_CODING_TYPE_B 0x00FF0000
211 #define SHIFT_TOPAZ_VLC_CR_MB_CODING_TYPE_B 16
212 #define REGNUM_TOPAZ_VLC_CR_MB_CODING_TYPE_B 0x0024
213 #define SIGNED_TOPAZ_VLC_CR_MB_CODING_TYPE_B 0
214 
215 #define MASK_TOPAZ_VLC_CR_MB_CODING_TYPE_SKIP 0xFF000000
216 #define SHIFT_TOPAZ_VLC_CR_MB_CODING_TYPE_SKIP 24
217 #define REGNUM_TOPAZ_VLC_CR_MB_CODING_TYPE_SKIP 0x0024
218 #define SIGNED_TOPAZ_VLC_CR_MB_CODING_TYPE_SKIP 0
219 
220 /* Register CR_VLC_RATE_CTRL_DCBITS */
221 #define TOPAZ_VLC_CR_VLC_RATE_CTRL_DCBITS 0x0028
222 #define MASK_TOPAZ_VLC_CR_DC_BITS   0x0000FFFF
223 #define SHIFT_TOPAZ_VLC_CR_DC_BITS  0
224 #define REGNUM_TOPAZ_VLC_CR_DC_BITS 0x0028
225 #define SIGNED_TOPAZ_VLC_CR_DC_BITS 0
226 
227 #define MASK_TOPAZ_VLC_CR_MB_CODING_IPCM 0xFF000000
228 #define SHIFT_TOPAZ_VLC_CR_MB_CODING_IPCM 24
229 #define REGNUM_TOPAZ_VLC_CR_MB_CODING_IPCM 0x0028
230 #define SIGNED_TOPAZ_VLC_CR_MB_CODING_IPCM 0
231 
232 /* Register CR_VLC_RATE_CTRL_MVBITS */
233 #define TOPAZ_VLC_CR_VLC_RATE_CTRL_MVBITS 0x002C
234 #define MASK_TOPAZ_VLC_CR_MV_BITS   0x00FFFFFF
235 #define SHIFT_TOPAZ_VLC_CR_MV_BITS  0
236 #define REGNUM_TOPAZ_VLC_CR_MV_BITS 0x002C
237 #define SIGNED_TOPAZ_VLC_CR_MV_BITS 0
238 
239 /* Register CR_VLC_RATE_CTRL_MBSYM */
240 #define TOPAZ_VLC_CR_VLC_RATE_CTRL_MBSYM 0x0030
241 #define MASK_TOPAZ_VLC_CR_MB_SYMBOLS_BITS 0x00FFFFFF
242 #define SHIFT_TOPAZ_VLC_CR_MB_SYMBOLS_BITS 0
243 #define REGNUM_TOPAZ_VLC_CR_MB_SYMBOLS_BITS 0x0030
244 #define SIGNED_TOPAZ_VLC_CR_MB_SYMBOLS_BITS 0
245 
246 /* Register CR_VLC_RATE_CTRL_MBRES */
247 #define TOPAZ_VLC_CR_VLC_RATE_CTRL_MBRES 0x0034
248 #define MASK_TOPAZ_VLC_CR_MB_RESIDUAL_BITS 0x00FFFFFF
249 #define SHIFT_TOPAZ_VLC_CR_MB_RESIDUAL_BITS 0
250 #define REGNUM_TOPAZ_VLC_CR_MB_RESIDUAL_BITS 0x0034
251 #define SIGNED_TOPAZ_VLC_CR_MB_RESIDUAL_BITS 0
252 
253 /* Register CR_VLC_SIGNATURE_0 */
254 #define TOPAZ_VLC_CR_VLC_SIGNATURE_0 0x0038
255 #define MASK_TOPAZ_VLC_CR_MB_SIGNATURE 0xFFFFFFFF
256 #define SHIFT_TOPAZ_VLC_CR_MB_SIGNATURE 0
257 #define REGNUM_TOPAZ_VLC_CR_MB_SIGNATURE 0x0038
258 #define SIGNED_TOPAZ_VLC_CR_MB_SIGNATURE 0
259 
260 /* Register CR_VLC_SIGNATURE_1 */
261 #define TOPAZ_VLC_CR_VLC_SIGNATURE_1 0x003C
262 #define MASK_TOPAZ_VLC_CR_BLK_SIGNATURE 0xFFFFFFFF
263 #define SHIFT_TOPAZ_VLC_CR_BLK_SIGNATURE 0
264 #define REGNUM_TOPAZ_VLC_CR_BLK_SIGNATURE 0x003C
265 #define SIGNED_TOPAZ_VLC_CR_BLK_SIGNATURE 0
266 
267 /* Register CR_VLC_SIGNATURE_2 */
268 #define TOPAZ_VLC_CR_VLC_SIGNATURE_2 0x0040
269 #define MASK_TOPAZ_VLC_CR_LOOKUP_SIGNATURE 0xFFFFFFFF
270 #define SHIFT_TOPAZ_VLC_CR_LOOKUP_SIGNATURE 0
271 #define REGNUM_TOPAZ_VLC_CR_LOOKUP_SIGNATURE 0x0040
272 #define SIGNED_TOPAZ_VLC_CR_LOOKUP_SIGNATURE 0
273 
274 /* Register CR_VLC_SIGNATURE_3 */
275 #define TOPAZ_VLC_CR_VLC_SIGNATURE_3 0x0044
276 #define MASK_TOPAZ_VLC_CR_BITSTREAM_SIGNATURE 0xFFFFFFFF
277 #define SHIFT_TOPAZ_VLC_CR_BITSTREAM_SIGNATURE 0
278 #define REGNUM_TOPAZ_VLC_CR_BITSTREAM_SIGNATURE 0x0044
279 #define SIGNED_TOPAZ_VLC_CR_BITSTREAM_SIGNATURE 0
280 
281 /* Register CR_VLC_SIGNATURE_4 */
282 #define TOPAZ_VLC_CR_VLC_SIGNATURE_4 0x0048
283 #define MASK_TOPAZ_VLC_CR_HEADER_SIGNATURE 0xFFFFFFFF
284 #define SHIFT_TOPAZ_VLC_CR_HEADER_SIGNATURE 0
285 #define REGNUM_TOPAZ_VLC_CR_HEADER_SIGNATURE 0x0048
286 #define SIGNED_TOPAZ_VLC_CR_HEADER_SIGNATURE 0
287 
288 /* Register CR_VLC_PERFORMANCE_0 */
289 #define TOPAZ_VLC_CR_VLC_PERFORMANCE_0 0x0050
290 #define MASK_TOPAZ_VLC_CR_WORST_MB_CYCLES 0x0000FFFF
291 #define SHIFT_TOPAZ_VLC_CR_WORST_MB_CYCLES 0
292 #define REGNUM_TOPAZ_VLC_CR_WORST_MB_CYCLES 0x0050
293 #define SIGNED_TOPAZ_VLC_CR_WORST_MB_CYCLES 0
294 
295 #define MASK_TOPAZ_VLC_CR_WORST_MB_TYPE 0x00030000
296 #define SHIFT_TOPAZ_VLC_CR_WORST_MB_TYPE 16
297 #define REGNUM_TOPAZ_VLC_CR_WORST_MB_TYPE 0x0050
298 #define SIGNED_TOPAZ_VLC_CR_WORST_MB_TYPE 0
299 
300 #define MASK_TOPAZ_VLC_CR_WORST_MB_IPCM 0x00040000
301 #define SHIFT_TOPAZ_VLC_CR_WORST_MB_IPCM 18
302 #define REGNUM_TOPAZ_VLC_CR_WORST_MB_IPCM 0x0050
303 #define SIGNED_TOPAZ_VLC_CR_WORST_MB_IPCM 0
304 
305 /* Register CR_VLC_PERFORMANCE_1 */
306 #define TOPAZ_VLC_CR_VLC_PERFORMANCE_1 0x0054
307 #define MASK_TOPAZ_VLC_CR_WORST_MB_NUM 0x003FFFFF
308 #define SHIFT_TOPAZ_VLC_CR_WORST_MB_NUM 0
309 #define REGNUM_TOPAZ_VLC_CR_WORST_MB_NUM 0x0054
310 #define SIGNED_TOPAZ_VLC_CR_WORST_MB_NUM 0
311 
312 /* Register CR_VLC_PERFORMANCE_2 */
313 #define TOPAZ_VLC_CR_VLC_PERFORMANCE_2 0x0058
314 #define MASK_TOPAZ_VLC_CR_WORST_MB_RESET 0x00000001
315 #define SHIFT_TOPAZ_VLC_CR_WORST_MB_RESET 0
316 #define REGNUM_TOPAZ_VLC_CR_WORST_MB_RESET 0x0058
317 #define SIGNED_TOPAZ_VLC_CR_WORST_MB_RESET 0
318 
319 #define MASK_TOPAZ_VLC_CR_DISABLE_COUNTERS 0x00000002
320 #define SHIFT_TOPAZ_VLC_CR_DISABLE_COUNTERS 1
321 #define REGNUM_TOPAZ_VLC_CR_DISABLE_COUNTERS 0x0058
322 #define SIGNED_TOPAZ_VLC_CR_DISABLE_COUNTERS 0
323 
324 /* Register CR_VLC_IPCM_0 */
325 #define TOPAZ_VLC_CR_VLC_IPCM_0     0x005C
326 #define MASK_TOPAZ_VLC_CR_CABAC_DB_MARGIN 0x03FF0000
327 #define SHIFT_TOPAZ_VLC_CR_CABAC_DB_MARGIN 16
328 #define REGNUM_TOPAZ_VLC_CR_CABAC_DB_MARGIN 0x005C
329 #define SIGNED_TOPAZ_VLC_CR_CABAC_DB_MARGIN 0
330 
331 #define MASK_TOPAZ_VLC_CR_CABAC_BIN_FLEX 0x00001FFF
332 #define SHIFT_TOPAZ_VLC_CR_CABAC_BIN_FLEX 0
333 #define REGNUM_TOPAZ_VLC_CR_CABAC_BIN_FLEX 0x005C
334 #define SIGNED_TOPAZ_VLC_CR_CABAC_BIN_FLEX 0
335 
336 /* Register CR_VLC_IPCM_1 */
337 #define TOPAZ_VLC_CR_VLC_IPCM_1     0x0060
338 #define MASK_TOPAZ_VLC_CR_IPCM_THRESHOLD 0x00000FFF
339 #define SHIFT_TOPAZ_VLC_CR_IPCM_THRESHOLD 0
340 #define REGNUM_TOPAZ_VLC_CR_IPCM_THRESHOLD 0x0060
341 #define SIGNED_TOPAZ_VLC_CR_IPCM_THRESHOLD 0
342 
343 #define MASK_TOPAZ_VLC_CR_CABAC_BIN_LIMIT 0x1FFF0000
344 #define SHIFT_TOPAZ_VLC_CR_CABAC_BIN_LIMIT 16
345 #define REGNUM_TOPAZ_VLC_CR_CABAC_BIN_LIMIT 0x0060
346 #define SIGNED_TOPAZ_VLC_CR_CABAC_BIN_LIMIT 0
347 
348 /* Register CR_VLC_MPEG4_CFG */
349 #define TOPAZ_VLC_CR_VLC_MPEG4_CFG  0x0064
350 #define MASK_TOPAZ_VLC_CR_RSIZE     0x00000007
351 #define SHIFT_TOPAZ_VLC_CR_RSIZE    0
352 #define REGNUM_TOPAZ_VLC_CR_RSIZE   0x0064
353 #define SIGNED_TOPAZ_VLC_CR_RSIZE   0
354 
355 /* Register CR_VLC_MB_PARAMS */
356 #define TOPAZ_VLC_CR_VLC_MB_PARAMS  0x0068
357 #define MASK_TOPAZ_VLC_CR_QP        0x0000003F
358 #define SHIFT_TOPAZ_VLC_CR_QP       0
359 #define REGNUM_TOPAZ_VLC_CR_QP      0x0068
360 #define SIGNED_TOPAZ_VLC_CR_QP      0
361 
362 #define MASK_TOPAZ_VLC_CR_QP_CB     0x003F0000
363 #define SHIFT_TOPAZ_VLC_CR_QP_CB    16
364 #define REGNUM_TOPAZ_VLC_CR_QP_CB   0x0068
365 #define SIGNED_TOPAZ_VLC_CR_QP_CB   0
366 
367 #define MASK_TOPAZ_VLC_CR_QP_CR     0x3F000000
368 #define SHIFT_TOPAZ_VLC_CR_QP_CR    24
369 #define REGNUM_TOPAZ_VLC_CR_QP_CR   0x0068
370 #define SIGNED_TOPAZ_VLC_CR_QP_CR   0
371 
372 /* Register CR_VLC_RESET */
373 #define TOPAZ_VLC_CR_VLC_RESET      0x006C
374 #define MASK_TOPAZ_VLC_CR_RESET     0x00000001
375 #define SHIFT_TOPAZ_VLC_CR_RESET    0
376 #define REGNUM_TOPAZ_VLC_CR_RESET   0x006C
377 #define SIGNED_TOPAZ_VLC_CR_RESET   0
378 
379 /* Register CR_VLC_WRITE_ADDR */
380 #define TOPAZ_VLC_CR_VLC_WRITE_ADDR 0x0070
381 #define MASK_TOPAZ_VLC_CR_NEXT_WRITE_ADDR 0xFFFFFFF0
382 #define SHIFT_TOPAZ_VLC_CR_NEXT_WRITE_ADDR 4
383 #define REGNUM_TOPAZ_VLC_CR_NEXT_WRITE_ADDR 0x0070
384 #define SIGNED_TOPAZ_VLC_CR_NEXT_WRITE_ADDR 0
385 
386 /* Register CR_VLC_CHROMA_QP_OFFSET */
387 #define TOPAZ_VLC_CR_VLC_CHROMA_QP_OFFSET 0x0074
388 #define MASK_TOPAZ_VLC_CR_QPCB_OFFSET 0x0000001F
389 #define SHIFT_TOPAZ_VLC_CR_QPCB_OFFSET 0
390 #define REGNUM_TOPAZ_VLC_CR_QPCB_OFFSET 0x0074
391 #define SIGNED_TOPAZ_VLC_CR_QPCB_OFFSET 0
392 
393 #define MASK_TOPAZ_VLC_CR_QPCR_OFFSET 0x00001F00
394 #define SHIFT_TOPAZ_VLC_CR_QPCR_OFFSET 8
395 #define REGNUM_TOPAZ_VLC_CR_QPCR_OFFSET 0x0074
396 #define SIGNED_TOPAZ_VLC_CR_QPCR_OFFSET 0
397 
398 /* Register CR_VLC_RATE_CTRL_QP */
399 #define TOPAZ_VLC_CR_VLC_RATE_CTRL_QP 0x0078
400 #define MASK_TOPAZ_VLC_CR_BU_QPY_INTRA 0x00003FFF
401 #define SHIFT_TOPAZ_VLC_CR_BU_QPY_INTRA 0
402 #define REGNUM_TOPAZ_VLC_CR_BU_QPY_INTRA 0x0078
403 #define SIGNED_TOPAZ_VLC_CR_BU_QPY_INTRA 0
404 
405 #define MASK_TOPAZ_VLC_CR_BU_QPY_INTER 0x3FFF0000
406 #define SHIFT_TOPAZ_VLC_CR_BU_QPY_INTER 16
407 #define REGNUM_TOPAZ_VLC_CR_BU_QPY_INTER 0x0078
408 #define SIGNED_TOPAZ_VLC_CR_BU_QPY_INTER 0
409 
410 /* Register CR_VLC_BU_STAT_UPDATE */
411 #define TOPAZ_VLC_CR_VLC_BU_STAT_UPDATE 0x007C
412 #define MASK_TOPAZ_VLC_CR_FORCE_BU_STAT_UPDATE 0x00000001
413 #define SHIFT_TOPAZ_VLC_CR_FORCE_BU_STAT_UPDATE 0
414 #define REGNUM_TOPAZ_VLC_CR_FORCE_BU_STAT_UPDATE 0x007C
415 #define SIGNED_TOPAZ_VLC_CR_FORCE_BU_STAT_UPDATE 0
416 
417 /* Register CR_VLC_SLICE_HEADER_CTRL */
418 #define TOPAZ_VLC_CR_VLC_SLICE_HEADER_CTRL 0x0080
419 #define MASK_TOPAZ_VLC_CR_SLICE_HEADER_ELEMENTS 0x0000001F
420 #define SHIFT_TOPAZ_VLC_CR_SLICE_HEADER_ELEMENTS 0
421 #define REGNUM_TOPAZ_VLC_CR_SLICE_HEADER_ELEMENTS 0x0080
422 #define SIGNED_TOPAZ_VLC_CR_SLICE_HEADER_ELEMENTS 0
423 
424 #define MASK_TOPAZ_VLC_CR_SLICE_PREFIX_ELEMENTS 0x00001F00
425 #define SHIFT_TOPAZ_VLC_CR_SLICE_PREFIX_ELEMENTS 8
426 #define REGNUM_TOPAZ_VLC_CR_SLICE_PREFIX_ELEMENTS 0x0080
427 #define SIGNED_TOPAZ_VLC_CR_SLICE_PREFIX_ELEMENTS 0
428 
429 #define MASK_TOPAZ_VLC_CR_SLICE_MB_NUM 0x3FFF0000
430 #define SHIFT_TOPAZ_VLC_CR_SLICE_MB_NUM 16
431 #define REGNUM_TOPAZ_VLC_CR_SLICE_MB_NUM 0x0080
432 #define SIGNED_TOPAZ_VLC_CR_SLICE_MB_NUM 0
433 
434 /* Register CR_VLC_SLICE_CTRL_0 */
435 #define TOPAZ_VLC_CR_VLC_SLICE_CTRL_0 0x0084
436 #define MASK_TOPAZ_VLC_CR_SLICE_SIZE_LIMIT 0x00FFFFFF
437 #define SHIFT_TOPAZ_VLC_CR_SLICE_SIZE_LIMIT 0
438 #define REGNUM_TOPAZ_VLC_CR_SLICE_SIZE_LIMIT 0x0084
439 #define SIGNED_TOPAZ_VLC_CR_SLICE_SIZE_LIMIT 0
440 
441 /* Register CR_VLC_SLICE_CTRL_1 */
442 #define TOPAZ_VLC_CR_VLC_SLICE_CTRL_1 0x008C
443 #define MASK_TOPAZ_VLC_CR_SLICE_MBS_LIMIT 0x00003FFF
444 #define SHIFT_TOPAZ_VLC_CR_SLICE_MBS_LIMIT 0
445 #define REGNUM_TOPAZ_VLC_CR_SLICE_MBS_LIMIT 0x008C
446 #define SIGNED_TOPAZ_VLC_CR_SLICE_MBS_LIMIT 0
447 
448 /* Register CR_VLC_RATE_CTRL_HEADERS */
449 #define TOPAZ_VLC_CR_VLC_RATE_CTRL_HEADERS 0x0090
450 #define MASK_TOPAZ_VLC_CR_SLICE_HEADER_BITS 0x00FFFFFF
451 #define SHIFT_TOPAZ_VLC_CR_SLICE_HEADER_BITS 0
452 #define REGNUM_TOPAZ_VLC_CR_SLICE_HEADER_BITS 0x0090
453 #define SIGNED_TOPAZ_VLC_CR_SLICE_HEADER_BITS 0
454 
455 /* Register CR_VLC_SIGNATURE_5 */
456 #define TOPAZ_VLC_CR_VLC_SIGNATURE_5 0x0094
457 #define MASK_TOPAZ_VLC_CR_CABAC_SIGNATURE 0xFFFFFFFF
458 #define SHIFT_TOPAZ_VLC_CR_CABAC_SIGNATURE 0
459 #define REGNUM_TOPAZ_VLC_CR_CABAC_SIGNATURE 0x0094
460 #define SIGNED_TOPAZ_VLC_CR_CABAC_SIGNATURE 0
461 
462 /* Register CR_VLC_SIGNATURE_6 */
463 #define TOPAZ_VLC_CR_VLC_SIGNATURE_6 0x0098
464 #define MASK_TOPAZ_VLC_CR_IPCM_SIGNATURE 0xFFFFFFFF
465 #define SHIFT_TOPAZ_VLC_CR_IPCM_SIGNATURE 0
466 #define REGNUM_TOPAZ_VLC_CR_IPCM_SIGNATURE 0x0098
467 #define SIGNED_TOPAZ_VLC_CR_IPCM_SIGNATURE 0
468 
469 /*
470 	Byte range covering the group TOPAZ_VLC file
471 */
472 
473 #define TOPAZ_VLC_TOPAZ_VLC_REGISTERS_START		0x00000000
474 #define TOPAZ_VLC_TOPAZ_VLC_REGISTERS_END  		0x0000009B
475 
476 /*
477 	Byte range covering the whole register file
478 */
479 
480 #define TOPAZ_VLC_REGISTERS_START		0x00000000
481 #define TOPAZ_VLC_REGISTERS_END  		0x0000009B
482 #define TOPAZ_VLC_REG_DEFAULT_TABLE struct {\
483 			IMG_UINT16 uRegOffset;\
484 			IMG_UINT32 uRegDefault;\
485 			IMG_UINT32 uRegMask;\
486 			bool bReadonly;\
487 			const char* pszName;\
488 		} TOPAZ_VLC_Defaults[] = {\
489 	{0x0000, 0x00000000, 0x1000FFFF, 0, "CR_VLC_CONTROL" } ,\
490 	{0x0004, 0x00000000, 0x00000005, 1, "CR_VLC_STATUS" } ,\
491 	{0x0008, 0x00000000, 0x0003E000, 1, "CR_VLC_INFO_0" } ,\
492 	{0x000C, 0x00000000, 0xFFFFFFFF, 0, "CR_VLC_INFO_1" } ,\
493 	{0x0010, 0x00000000, 0xFFFFFFFF, 0, "CR_VLC_INFO_2" } ,\
494 	{0x0014, 0x00000000, 0x80003FFF, 0, "CR_VLC_STUFF_HEAD_CTRL" } ,\
495 	{0x0018, 0x00000000, 0xFFFFFFFF, 0, "CR_VLC_HEADER_FIFO" } ,\
496 	{0x001C, 0x00000000, 0xFFFFFFFF, 0, "CR_VLC_HEADER_CTRL" } ,\
497 	{0x0020, 0x00000000, 0x00000001, 1, "CR_VLC_HEADER_STATUS" } ,\
498 	{0x0024, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_RATE_CTRL_MB_TYPE" } ,\
499 	{0x0028, 0x00000000, 0xFF00FFFF, 1, "CR_VLC_RATE_CTRL_DCBITS" } ,\
500 	{0x002C, 0x00000000, 0x00FFFFFF, 1, "CR_VLC_RATE_CTRL_MVBITS" } ,\
501 	{0x0030, 0x00000000, 0x00FFFFFF, 1, "CR_VLC_RATE_CTRL_MBSYM" } ,\
502 	{0x0034, 0x00000000, 0x00FFFFFF, 1, "CR_VLC_RATE_CTRL_MBRES" } ,\
503 	{0x0038, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_SIGNATURE_0" } ,\
504 	{0x003C, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_SIGNATURE_1" } ,\
505 	{0x0040, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_SIGNATURE_2" } ,\
506 	{0x0044, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_SIGNATURE_3" } ,\
507 	{0x0048, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_SIGNATURE_4" } ,\
508 	{0x0050, 0x00000000, 0x0007FFFF, 0, "CR_VLC_PERFORMANCE_0" } ,\
509 	{0x0054, 0x00000000, 0x003FFFFF, 0, "CR_VLC_PERFORMANCE_1" } ,\
510 	{0x0058, 0x00000000, 0x00000003, 0, "CR_VLC_PERFORMANCE_2" } ,\
511 	{0x005C, 0x01900000, 0x03FF1FFF, 0, "CR_VLC_IPCM_0" } ,\
512 	{0x0060, 0x00000000, 0x1FFF0FFF, 0, "CR_VLC_IPCM_1" } ,\
513 	{0x0064, 0x00000000, 0x00000007, 0, "CR_VLC_MPEG4_CFG" } ,\
514 	{0x0068, 0x00000000, 0x3F3F003F, 1, "CR_VLC_MB_PARAMS" } ,\
515 	{0x006C, 0x00000000, 0x00000001, 0, "CR_VLC_RESET" } ,\
516 	{0x0070, 0x00000000, 0xFFFFFFF0, 0, "CR_VLC_WRITE_ADDR" } ,\
517 	{0x0074, 0x00000000, 0x00001F1F, 0, "CR_VLC_CHROMA_QP_OFFSET" } ,\
518 	{0x0078, 0x00000000, 0x3FFF3FFF, 1, "CR_VLC_RATE_CTRL_QP" } ,\
519 	{0x007C, 0x00000000, 0x00000001, 0, "CR_VLC_BU_STAT_UPDATE" } ,\
520 	{0x0080, 0x00000000, 0x3FFF1F1F, 0, "CR_VLC_SLICE_HEADER_CTRL" } ,\
521 	{0x0084, 0x00000000, 0x00FFFFFF, 0, "CR_VLC_SLICE_CTRL_0" } ,\
522 	{0x008C, 0x00000000, 0x00003FFF, 0, "CR_VLC_SLICE_CTRL_1" } ,\
523 	{0x0090, 0x00000000, 0x00FFFFFF, 1, "CR_VLC_RATE_CTRL_HEADERS" } ,\
524 	{0x0094, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_SIGNATURE_5" } ,\
525 	{0x0098, 0x00000000, 0xFFFFFFFF, 1, "CR_VLC_SIGNATURE_6" } ,\
526 { 0 }}
527 
528 #define TOPAZ_VLC_REGS_INIT(uBase) \
529 	{ \
530 		int n;\
531 		TOPAZ_VLC_REG_DEFAULT_TABLE;\
532 		for (n = 0; n < sizeof(TOPAZ_VLC_Defaults)/ sizeof(TOPAZ_VLC_Defaults[0] ) -1; n++)\
533 		{\
534 			RegWriteNoTrap(TOPAZ_VLC_Defaults[n].uRegOffset + uBase, TOPAZ_VLC_Defaults[n].uRegDefault); \
535 		}\
536 	}
537 #endif
538