Home | History | Annotate | Download | only in encoder
      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
     37 DEFINE(vp8_block_coeff,                         offsetof(BLOCK, coeff));
     38 DEFINE(vp8_block_zbin,                          offsetof(BLOCK, zbin));
     39 DEFINE(vp8_block_round,                         offsetof(BLOCK, round));
     40 DEFINE(vp8_block_quant,                         offsetof(BLOCK, quant));
     41 DEFINE(vp8_block_quant_fast,                    offsetof(BLOCK, quant_fast));
     42 DEFINE(vp8_block_zbin_extra,                    offsetof(BLOCK, zbin_extra));
     43 DEFINE(vp8_block_zrun_zbin_boost,               offsetof(BLOCK, zrun_zbin_boost));
     44 DEFINE(vp8_block_quant_shift,                   offsetof(BLOCK, quant_shift));
     45 
     46 DEFINE(vp8_blockd_qcoeff,                       offsetof(BLOCKD, qcoeff));
     47 DEFINE(vp8_blockd_dequant,                      offsetof(BLOCKD, dequant));
     48 DEFINE(vp8_blockd_dqcoeff,                      offsetof(BLOCKD, dqcoeff));
     49 DEFINE(vp8_blockd_eob,                          offsetof(BLOCKD, eob));
     50 
     51 // subtract
     52 DEFINE(vp8_block_base_src,                      offsetof(BLOCK, base_src));
     53 DEFINE(vp8_block_src,                           offsetof(BLOCK, src));
     54 DEFINE(vp8_block_src_diff,                      offsetof(BLOCK, src_diff));
     55 DEFINE(vp8_block_src_stride,                    offsetof(BLOCK, src_stride));
     56 
     57 DEFINE(vp8_blockd_predictor,                    offsetof(BLOCKD, predictor));
     58 
     59 //pack tokens
     60 DEFINE(vp8_writer_lowvalue,                     offsetof(vp8_writer, lowvalue));
     61 DEFINE(vp8_writer_range,                        offsetof(vp8_writer, range));
     62 DEFINE(vp8_writer_value,                        offsetof(vp8_writer, value));
     63 DEFINE(vp8_writer_count,                        offsetof(vp8_writer, count));
     64 DEFINE(vp8_writer_pos,                          offsetof(vp8_writer, pos));
     65 DEFINE(vp8_writer_buffer,                       offsetof(vp8_writer, buffer));
     66 
     67 DEFINE(tokenextra_token,                        offsetof(TOKENEXTRA, Token));
     68 DEFINE(tokenextra_extra,                        offsetof(TOKENEXTRA, Extra));
     69 DEFINE(tokenextra_context_tree,                 offsetof(TOKENEXTRA, context_tree));
     70 DEFINE(tokenextra_skip_eob_node,                offsetof(TOKENEXTRA, skip_eob_node));
     71 DEFINE(TOKENEXTRA_SZ,                           sizeof(TOKENEXTRA));
     72 
     73 DEFINE(vp8_extra_bit_struct_sz,                 sizeof(vp8_extra_bit_struct));
     74 
     75 DEFINE(vp8_token_value,                         offsetof(vp8_token, value));
     76 DEFINE(vp8_token_len,                           offsetof(vp8_token, Len));
     77 
     78 DEFINE(vp8_extra_bit_struct_tree,               offsetof(vp8_extra_bit_struct, tree));
     79 DEFINE(vp8_extra_bit_struct_prob,               offsetof(vp8_extra_bit_struct, prob));
     80 DEFINE(vp8_extra_bit_struct_len,                offsetof(vp8_extra_bit_struct, Len));
     81 DEFINE(vp8_extra_bit_struct_base_val,           offsetof(vp8_extra_bit_struct, base_val));
     82 
     83 DEFINE(vp8_comp_tplist,                         offsetof(VP8_COMP, tplist));
     84 DEFINE(vp8_comp_common,                         offsetof(VP8_COMP, common));
     85 DEFINE(vp8_comp_bc2,                            offsetof(VP8_COMP, bc2));
     86 
     87 DEFINE(tokenlist_start,                         offsetof(TOKENLIST, start));
     88 DEFINE(tokenlist_stop,                          offsetof(TOKENLIST, stop));
     89 DEFINE(TOKENLIST_SZ,                            sizeof(TOKENLIST));
     90 
     91 DEFINE(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
     96 ct_assert(TOKENEXTRA_SZ, sizeof(TOKENEXTRA) == 8)
     97 ct_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