1/*
2 *  Copyright (c) 2011 The WebM project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11
12#include "vpx_ports/config.h"
13#include <stddef.h>
14
15#include "block.h"
16#include "vp8/common/blockd.h"
17#include "onyx_int.h"
18#include "treewriter.h"
19#include "tokenize.h"
20
21#define ct_assert(name,cond) \
22    static void assert_##name(void) UNUSED;\
23    static void assert_##name(void) {switch(0){case 0:case !!(cond):;}}
24
25#define DEFINE(sym, val) int sym = val;
26
27/*
28#define BLANK() asm volatile("\n->" : : )
29*/
30
31/*
32 * int main(void)
33 * {
34 */
35
36//regular quantize
37DEFINE(vp8_block_coeff,                         offsetof(BLOCK, coeff));
38DEFINE(vp8_block_zbin,                          offsetof(BLOCK, zbin));
39DEFINE(vp8_block_round,                         offsetof(BLOCK, round));
40DEFINE(vp8_block_quant,                         offsetof(BLOCK, quant));
41DEFINE(vp8_block_quant_fast,                    offsetof(BLOCK, quant_fast));
42DEFINE(vp8_block_zbin_extra,                    offsetof(BLOCK, zbin_extra));
43DEFINE(vp8_block_zrun_zbin_boost,               offsetof(BLOCK, zrun_zbin_boost));
44DEFINE(vp8_block_quant_shift,                   offsetof(BLOCK, quant_shift));
45
46DEFINE(vp8_blockd_qcoeff,                       offsetof(BLOCKD, qcoeff));
47DEFINE(vp8_blockd_dequant,                      offsetof(BLOCKD, dequant));
48DEFINE(vp8_blockd_dqcoeff,                      offsetof(BLOCKD, dqcoeff));
49DEFINE(vp8_blockd_eob,                          offsetof(BLOCKD, eob));
50
51// subtract
52DEFINE(vp8_block_base_src,                      offsetof(BLOCK, base_src));
53DEFINE(vp8_block_src,                           offsetof(BLOCK, src));
54DEFINE(vp8_block_src_diff,                      offsetof(BLOCK, src_diff));
55DEFINE(vp8_block_src_stride,                    offsetof(BLOCK, src_stride));
56
57DEFINE(vp8_blockd_predictor,                    offsetof(BLOCKD, predictor));
58
59//pack tokens
60DEFINE(vp8_writer_lowvalue,                     offsetof(vp8_writer, lowvalue));
61DEFINE(vp8_writer_range,                        offsetof(vp8_writer, range));
62DEFINE(vp8_writer_value,                        offsetof(vp8_writer, value));
63DEFINE(vp8_writer_count,                        offsetof(vp8_writer, count));
64DEFINE(vp8_writer_pos,                          offsetof(vp8_writer, pos));
65DEFINE(vp8_writer_buffer,                       offsetof(vp8_writer, buffer));
66
67DEFINE(tokenextra_token,                        offsetof(TOKENEXTRA, Token));
68DEFINE(tokenextra_extra,                        offsetof(TOKENEXTRA, Extra));
69DEFINE(tokenextra_context_tree,                 offsetof(TOKENEXTRA, context_tree));
70DEFINE(tokenextra_skip_eob_node,                offsetof(TOKENEXTRA, skip_eob_node));
71DEFINE(TOKENEXTRA_SZ,                           sizeof(TOKENEXTRA));
72
73DEFINE(vp8_extra_bit_struct_sz,                 sizeof(vp8_extra_bit_struct));
74
75DEFINE(vp8_token_value,                         offsetof(vp8_token, value));
76DEFINE(vp8_token_len,                           offsetof(vp8_token, Len));
77
78DEFINE(vp8_extra_bit_struct_tree,               offsetof(vp8_extra_bit_struct, tree));
79DEFINE(vp8_extra_bit_struct_prob,               offsetof(vp8_extra_bit_struct, prob));
80DEFINE(vp8_extra_bit_struct_len,                offsetof(vp8_extra_bit_struct, Len));
81DEFINE(vp8_extra_bit_struct_base_val,           offsetof(vp8_extra_bit_struct, base_val));
82
83DEFINE(vp8_comp_tplist,                         offsetof(VP8_COMP, tplist));
84DEFINE(vp8_comp_common,                         offsetof(VP8_COMP, common));
85DEFINE(vp8_comp_bc2,                            offsetof(VP8_COMP, bc2));
86
87DEFINE(tokenlist_start,                         offsetof(TOKENLIST, start));
88DEFINE(tokenlist_stop,                          offsetof(TOKENLIST, stop));
89DEFINE(TOKENLIST_SZ,                            sizeof(TOKENLIST));
90
91DEFINE(vp8_common_mb_rows,                      offsetof(VP8_COMMON, mb_rows));
92
93// These two sizes are used in vp8cx_pack_tokens.  They are hard coded
94// so if the size changes this will have to be adjusted.
95#if HAVE_ARMV5TE
96ct_assert(TOKENEXTRA_SZ, sizeof(TOKENEXTRA) == 8)
97ct_assert(vp8_extra_bit_struct_sz, sizeof(vp8_extra_bit_struct) == 16)
98#endif
99
100//add asserts for any offset that is not supported by assembly code
101//add asserts for any size that is not supported by assembly code
102/*
103 * return 0;
104 * }
105 */
106