1/*
2 *  Copyright (c) 2010 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#ifndef VP9_ENCODER_VP9_TOKENIZE_H_
12#define VP9_ENCODER_VP9_TOKENIZE_H_
13
14#include "vp9/common/vp9_entropy.h"
15
16#include "vp9/encoder/vp9_block.h"
17#include "vp9/encoder/vp9_treewriter.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23void vp9_tokenize_initialize();
24
25#define EOSB_TOKEN 127     // Not signalled, encoder only
26
27typedef struct {
28  int16_t token;
29  int16_t extra;
30} TOKENVALUE;
31
32typedef struct {
33  const vp9_prob *context_tree;
34  int16_t         extra;
35  uint8_t         token;
36  uint8_t         skip_eob_node;
37} TOKENEXTRA;
38
39extern const vp9_tree_index vp9_coef_tree[];
40extern const vp9_tree_index vp9_coef_con_tree[];
41extern struct vp9_token vp9_coef_encodings[];
42
43int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
44
45struct VP9_COMP;
46
47void vp9_tokenize_sb(struct VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
48                     BLOCK_SIZE bsize);
49
50extern const int16_t *vp9_dct_value_cost_ptr;
51/* TODO: The Token field should be broken out into a separate char array to
52 *  improve cache locality, since it's needed for costing when the rest of the
53 *  fields are not.
54 */
55extern const TOKENVALUE *vp9_dct_value_tokens_ptr;
56
57#ifdef __cplusplus
58}  // extern "C"
59#endif
60
61#endif  // VP9_ENCODER_VP9_TOKENIZE_H_
62