Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: source/libvpx/vp9/common/vp9_treecoder.h

Issue 11555023: libvpx: Add VP9 decoder. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
12 #ifndef VP9_COMMON_VP9_TREECODER_H_
13 #define VP9_COMMON_VP9_TREECODER_H_
14
15 typedef unsigned char vp9_prob;
16
17 #define vp9_prob_half ( (vp9_prob) 128)
18
19 typedef signed char vp9_tree_index;
20 struct bool_coder_spec;
21
22 typedef struct bool_coder_spec bool_coder_spec;
23 typedef struct bool_writer bool_writer;
24 typedef struct bool_reader bool_reader;
25
26 typedef const bool_coder_spec c_bool_coder_spec;
27 typedef const bool_writer c_bool_writer;
28 typedef const bool_reader c_bool_reader;
29
30
31
32 # define vp9_complement( x) (255 - x)
33
34
35 /* We build coding trees compactly in arrays.
36 Each node of the tree is a pair of vp9_tree_indices.
37 Array index often references a corresponding probability table.
38 Index <= 0 means done encoding/decoding and value = -Index,
39 Index > 0 means need another bit, specification at index.
40 Nonnegative indices are always even; processing begins at node 0. */
41
42 typedef const vp9_tree_index vp9_tree[], *vp9_tree_p;
43
44
45 typedef const struct vp9_token_struct {
46 int value;
47 int Len;
48 } vp9_token;
49
50 /* Construct encoding array from tree. */
51
52 void vp9_tokens_from_tree(struct vp9_token_struct *, vp9_tree);
53 void vp9_tokens_from_tree_offset(struct vp9_token_struct *, vp9_tree,
54 int offset);
55
56
57 /* Convert array of token occurrence counts into a table of probabilities
58 for the associated binary encoding tree. Also writes count of branches
59 taken for each node on the tree; this facilitiates decisions as to
60 probability updates. */
61
62 void vp9_tree_probs_from_distribution(
63 int n, /* n = size of alphabet */
64 vp9_token tok [ /* n */ ],
65 vp9_tree tree,
66 vp9_prob probs [ /* n-1 */ ],
67 unsigned int branch_ct [ /* n-1 */ ] [2],
68 const unsigned int num_events[ /* n */ ],
69 unsigned int Pfactor,
70 int Round
71 );
72
73 static __inline int clip_prob(int p) {
74 if (p > 255)
75 return 255;
76 else if (p < 1)
77 return 1;
78 return p;
79 }
80
81 vp9_prob vp9_bin_prob_from_distribution(const unsigned int counts[2]);
82
83 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698