summaryrefslogtreecommitdiffstats
path: root/libvpx/vp9/encoder/vp9_cost.h
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv@google.com>2014-03-10 09:50:31 -0700
committerVignesh Venkatasubramanian <vigneshv@google.com>2014-03-11 10:04:38 -0700
commitb08e2e23eec181e9951df33cd704ac294c5407b6 (patch)
tree8efc1ca8af18169b44e505ea3ac1d224c1d777ab /libvpx/vp9/encoder/vp9_cost.h
parentf0ceed9d146017d218d64ca946d5c2b31356389b (diff)
downloadandroid_external_libvpx-b08e2e23eec181e9951df33cd704ac294c5407b6.tar.gz
android_external_libvpx-b08e2e23eec181e9951df33cd704ac294c5407b6.tar.bz2
android_external_libvpx-b08e2e23eec181e9951df33cd704ac294c5407b6.zip
libvpx: Roll latest libvpx and enable VP9 Encoder
Rolling latest libvpx from upstream and generating configurations with VP9 Encoder enabled. Updating a mistake in UPDATING file. Upstream Hash: 1f08824d6db735e4cacb0419785a789395e42b2b Change-Id: Ie2c45e2253ade4a9ce88ca640cae39a7ece2d8f4
Diffstat (limited to 'libvpx/vp9/encoder/vp9_cost.h')
-rw-r--r--libvpx/vp9/encoder/vp9_cost.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/libvpx/vp9/encoder/vp9_cost.h b/libvpx/vp9/encoder/vp9_cost.h
new file mode 100644
index 0000000..6d2b940
--- /dev/null
+++ b/libvpx/vp9/encoder/vp9_cost.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef VP9_ENCODER_VP9_COST_H_
+#define VP9_ENCODER_VP9_COST_H_
+
+#include "vp9/common/vp9_prob.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const unsigned int vp9_prob_cost[256];
+
+#define vp9_cost_zero(prob) (vp9_prob_cost[prob])
+
+#define vp9_cost_one(prob) vp9_cost_zero(vp9_complement(prob))
+
+#define vp9_cost_bit(prob, bit) vp9_cost_zero((bit) ? vp9_complement(prob) \
+ : (prob))
+
+static INLINE unsigned int cost_branch256(const unsigned int ct[2],
+ vp9_prob p) {
+ return ct[0] * vp9_cost_zero(p) + ct[1] * vp9_cost_one(p);
+}
+
+static INLINE int treed_cost(vp9_tree tree, const vp9_prob *probs,
+ int bits, int len) {
+ int cost = 0;
+ vp9_tree_index i = 0;
+
+ do {
+ const int bit = (bits >> --len) & 1;
+ cost += vp9_cost_bit(probs[i >> 1], bit);
+ i = tree[i + bit];
+ } while (len);
+
+ return cost;
+}
+
+void vp9_cost_tokens(int *costs, const vp9_prob *probs, vp9_tree tree);
+void vp9_cost_tokens_skip(int *costs, const vp9_prob *probs, vp9_tree tree);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // VP9_ENCODER_VP9_COST_H_