vp9_tokenize.h 2.69 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
 */

11
12
#ifndef VP9_ENCODER_VP9_TOKENIZE_H_
#define VP9_ENCODER_VP9_TOKENIZE_H_
John Koleszar's avatar
John Koleszar committed
13

14
#include "vp9/common/vp9_entropy.h"
15
#include "vp9/encoder/vp9_block.h"
John Koleszar's avatar
John Koleszar committed
16

17
void vp9_tokenize_initialize();
John Koleszar's avatar
John Koleszar committed
18

John Koleszar's avatar
John Koleszar committed
19
typedef struct {
20
21
  int16_t Token;
  int16_t Extra;
22
23
} TOKENVALUE;

John Koleszar's avatar
John Koleszar committed
24
typedef struct {
25
  const vp9_prob *context_tree;
26
27
28
  int16_t         Extra;
  uint8_t         Token;
  uint8_t         skip_eob_node;
John Koleszar's avatar
John Koleszar committed
29
30
} TOKENEXTRA;

John Koleszar's avatar
John Koleszar committed
31
32
typedef int64_t vp9_coeff_accum[COEF_BANDS][PREV_COEF_CONTEXTS]
                               [MAX_ENTROPY_TOKENS];
33

34
extern int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd);
35
extern int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd);
36
extern int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd);
37
38
extern int vp9_mbuv_is_skippable_8x8(MACROBLOCKD *xd);
extern int vp9_mby_is_skippable_16x16(MACROBLOCKD *xd);
39
40
extern int vp9_sby_is_skippable_32x32(MACROBLOCKD *xd);
extern int vp9_sbuv_is_skippable_16x16(MACROBLOCKD *xd);
41

42
43
44
45
struct VP9_COMP;

extern void vp9_tokenize_mb(struct VP9_COMP *cpi, MACROBLOCKD *xd,
                            TOKENEXTRA **t, int dry_run);
46
47
extern void vp9_tokenize_sb(struct VP9_COMP *cpi, MACROBLOCKD *xd,
                            TOKENEXTRA **t, int dry_run);
48
49
50

extern void vp9_stuff_mb(struct VP9_COMP *cpi, MACROBLOCKD *xd,
                         TOKENEXTRA **t, int dry_run);
51
52
extern void vp9_stuff_sb(struct VP9_COMP *cpi, MACROBLOCKD *xd,
                         TOKENEXTRA **t, int dry_run);
53

54
extern void vp9_fix_contexts_sb(MACROBLOCKD *xd);
John Koleszar's avatar
John Koleszar committed
55
56
57
58
#ifdef ENTROPY_STATS
void init_context_counters();
void print_context_counters();

59
60
61
62
63
extern vp9_coeff_accum context_counters_4x4[BLOCK_TYPES_4X4];
extern vp9_coeff_accum context_counters_8x8[BLOCK_TYPES_8X8];
extern vp9_coeff_accum context_counters_16x16[BLOCK_TYPES_16X16];
extern vp9_coeff_accum context_counters_32x32[BLOCK_TYPES_32X32];

64
65
66
extern vp9_coeff_accum hybrid_context_counters_4x4[BLOCK_TYPES_4X4_HYBRID];
extern vp9_coeff_accum hybrid_context_counters_8x8[BLOCK_TYPES_8X8_HYBRID];
extern vp9_coeff_accum hybrid_context_counters_16x16[BLOCK_TYPES_16X16_HYBRID];
Daniel Kang's avatar
Daniel Kang committed
67
68
#endif

69
extern const int *vp9_dct_value_cost_ptr;
70
71
72
73
/* TODO: The Token field should be broken out into a separate char array to
 *  improve cache locality, since it's needed for costing when the rest of the
 *  fields are not.
 */
74
extern const TOKENVALUE *vp9_dct_value_tokens_ptr;
John Koleszar's avatar
John Koleszar committed
75

76
#endif  // VP9_ENCODER_VP9_TOKENIZE_H_