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

Side by Side Diff: source/libvpx/vp9/encoder/vp9_treewriter.c

Issue 232133009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 8 months 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
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_treewriter.h ('k') | source/libvpx/vp9/encoder/vp9_vaq.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "vp9/encoder/vp9_treewriter.h" 11 #include "vp9/encoder/vp9_treewriter.h"
12 12
13 static void cost(int *costs, vp9_tree tree, const vp9_prob *probs,
14 int i, int c) {
15 const vp9_prob prob = probs[i / 2];
16 int b;
17
18 for (b = 0; b <= 1; ++b) {
19 const int cc = c + vp9_cost_bit(prob, b);
20 const vp9_tree_index ii = tree[i + b];
21
22 if (ii <= 0)
23 costs[-ii] = cc;
24 else
25 cost(costs, tree, probs, ii, cc);
26 }
27 }
28
29 void vp9_cost_tokens(int *costs, const vp9_prob *probs, vp9_tree tree) {
30 cost(costs, tree, probs, 0, 0);
31 }
32
33 void vp9_cost_tokens_skip(int *costs, const vp9_prob *probs, vp9_tree tree) {
34 assert(tree[0] <= 0 && tree[1] > 0);
35
36 costs[-tree[0]] = vp9_cost_bit(probs[0], 0);
37 cost(costs, tree, probs, 2, 0);
38 }
39
40 static void tree2tok(struct vp9_token *tokens, const vp9_tree_index *tree, 13 static void tree2tok(struct vp9_token *tokens, const vp9_tree_index *tree,
41 int i, int v, int l) { 14 int i, int v, int l) {
42 v += v; 15 v += v;
43 ++l; 16 ++l;
44 17
45 do { 18 do {
46 const vp9_tree_index j = tree[i++]; 19 const vp9_tree_index j = tree[i++];
47 if (j <= 0) { 20 if (j <= 0) {
48 tokens[-j].value = v; 21 tokens[-j].value = v;
49 tokens[-j].len = l; 22 tokens[-j].len = l;
(...skipping 26 matching lines...) Expand all
76 branch_ct[i >> 1][0] = left; 49 branch_ct[i >> 1][0] = left;
77 branch_ct[i >> 1][1] = right; 50 branch_ct[i >> 1][1] = right;
78 return left + right; 51 return left + right;
79 } 52 }
80 53
81 void vp9_tree_probs_from_distribution(vp9_tree tree, 54 void vp9_tree_probs_from_distribution(vp9_tree tree,
82 unsigned int branch_ct[/* n-1 */][2], 55 unsigned int branch_ct[/* n-1 */][2],
83 const unsigned int num_events[/* n */]) { 56 const unsigned int num_events[/* n */]) {
84 convert_distribution(0, tree, branch_ct, num_events); 57 convert_distribution(0, tree, branch_ct, num_events);
85 } 58 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_treewriter.h ('k') | source/libvpx/vp9/encoder/vp9_vaq.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698