1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vp8/encoder/treewriter.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* 1.5 + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 + 1.15 +#include "treewriter.h" 1.16 + 1.17 +static void cost( 1.18 + int *const C, 1.19 + vp8_tree T, 1.20 + const vp8_prob *const P, 1.21 + int i, 1.22 + int c 1.23 +) 1.24 +{ 1.25 + const vp8_prob p = P [i>>1]; 1.26 + 1.27 + do 1.28 + { 1.29 + const vp8_tree_index j = T[i]; 1.30 + const int d = c + vp8_cost_bit(p, i & 1); 1.31 + 1.32 + if (j <= 0) 1.33 + C[-j] = d; 1.34 + else 1.35 + cost(C, T, P, j, d); 1.36 + } 1.37 + while (++i & 1); 1.38 +} 1.39 +void vp8_cost_tokens(int *c, const vp8_prob *p, vp8_tree t) 1.40 +{ 1.41 + cost(c, t, p, 0, 0); 1.42 +} 1.43 +void vp8_cost_tokens2(int *c, const vp8_prob *p, vp8_tree t,int start) 1.44 +{ 1.45 + cost(c, t, p, start, 0); 1.46 +}