Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license |
michael@0 | 5 | * that can be found in the LICENSE file in the root of the source |
michael@0 | 6 | * tree. An additional intellectual property rights grant can be found |
michael@0 | 7 | * in the file PATENTS. All contributing project authors may |
michael@0 | 8 | * be found in the AUTHORS file in the root of the source tree. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | #include "treewriter.h" |
michael@0 | 13 | |
michael@0 | 14 | static void cost( |
michael@0 | 15 | int *const C, |
michael@0 | 16 | vp8_tree T, |
michael@0 | 17 | const vp8_prob *const P, |
michael@0 | 18 | int i, |
michael@0 | 19 | int c |
michael@0 | 20 | ) |
michael@0 | 21 | { |
michael@0 | 22 | const vp8_prob p = P [i>>1]; |
michael@0 | 23 | |
michael@0 | 24 | do |
michael@0 | 25 | { |
michael@0 | 26 | const vp8_tree_index j = T[i]; |
michael@0 | 27 | const int d = c + vp8_cost_bit(p, i & 1); |
michael@0 | 28 | |
michael@0 | 29 | if (j <= 0) |
michael@0 | 30 | C[-j] = d; |
michael@0 | 31 | else |
michael@0 | 32 | cost(C, T, P, j, d); |
michael@0 | 33 | } |
michael@0 | 34 | while (++i & 1); |
michael@0 | 35 | } |
michael@0 | 36 | void vp8_cost_tokens(int *c, const vp8_prob *p, vp8_tree t) |
michael@0 | 37 | { |
michael@0 | 38 | cost(c, t, p, 0, 0); |
michael@0 | 39 | } |
michael@0 | 40 | void vp8_cost_tokens2(int *c, const vp8_prob *p, vp8_tree t,int start) |
michael@0 | 41 | { |
michael@0 | 42 | cost(c, t, p, start, 0); |
michael@0 | 43 | } |