diff options
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/vp9_entropy.c | 29 | ||||
-rw-r--r-- | vp9/common/vp9_treecoder.c | 43 | ||||
-rw-r--r-- | vp9/common/vp9_treecoder.h | 5 | ||||
-rw-r--r-- | vp9/encoder/vp9_treewriter.c | 26 | ||||
-rw-r--r-- | vp9/encoder/vp9_treewriter.h | 4 | ||||
-rw-r--r-- | vp9/vp9_common.mk | 1 |
6 files changed, 46 insertions, 62 deletions
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c index cce05d0e5..d89f70d64 100644 --- a/vp9/common/vp9_entropy.c +++ b/vp9/common/vp9_entropy.c @@ -756,27 +756,30 @@ static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE tx_size, unsigned int count_sat, unsigned int update_factor) { const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; - - vp9_coeff_probs_model *dst_coef_probs = cm->fc.coef_probs[tx_size]; - const vp9_coeff_probs_model *pre_coef_probs = pre_fc->coef_probs[tx_size]; - vp9_coeff_count_model *coef_counts = cm->counts.coef[tx_size]; - unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] = + vp9_coeff_probs_model *const probs = cm->fc.coef_probs[tx_size]; + const vp9_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size]; + vp9_coeff_count_model *counts = cm->counts.coef[tx_size]; + unsigned int (*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] = cm->counts.eob_branch[tx_size]; int i, j, k, l, m; - unsigned int branch_ct[UNCONSTRAINED_NODES][2]; for (i = 0; i < BLOCK_TYPES; ++i) for (j = 0; j < REF_TYPES; ++j) for (k = 0; k < COEF_BANDS; ++k) for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { - vp9_tree_probs_from_distribution(vp9_coefmodel_tree, branch_ct, - coef_counts[i][j][k][l]); - branch_ct[0][1] = eob_branch_count[i][j][k][l] - branch_ct[0][0]; + const int n0 = counts[i][j][k][l][ZERO_TOKEN]; + const int n1 = counts[i][j][k][l][ONE_TOKEN]; + const int n2 = counts[i][j][k][l][TWO_TOKEN]; + const int neob = counts[i][j][k][l][EOB_MODEL_TOKEN]; + const unsigned int branch_ct[UNCONSTRAINED_NODES][2] = { + { neob, eob_counts[i][j][k][l] - neob }, + { n0, n1 + n2 }, + { n1, n2 } + }; for (m = 0; m < UNCONSTRAINED_NODES; ++m) - dst_coef_probs[i][j][k][l][m] = merge_probs( - pre_coef_probs[i][j][k][l][m], - branch_ct[m], - count_sat, update_factor); + probs[i][j][k][l][m] = merge_probs(pre_probs[i][j][k][l][m], + branch_ct[m], + count_sat, update_factor); } } diff --git a/vp9/common/vp9_treecoder.c b/vp9/common/vp9_treecoder.c deleted file mode 100644 index dca3076f3..000000000 --- a/vp9/common/vp9_treecoder.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010 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. - */ - - -#include <assert.h> - -#include "./vpx_config.h" -#include "vp9/common/vp9_treecoder.h" - -static unsigned int convert_distribution(unsigned int i, vp9_tree tree, - unsigned int branch_ct[][2], - const unsigned int num_events[]) { - unsigned int left, right; - - if (tree[i] <= 0) - left = num_events[-tree[i]]; - else - left = convert_distribution(tree[i], tree, branch_ct, num_events); - - if (tree[i + 1] <= 0) - right = num_events[-tree[i + 1]]; - else - right = convert_distribution(tree[i + 1], tree, branch_ct, num_events); - - branch_ct[i >> 1][0] = left; - branch_ct[i >> 1][1] = right; - return left + right; -} - -void vp9_tree_probs_from_distribution(vp9_tree tree, - unsigned int branch_ct[/* n-1 */][2], - const unsigned int num_events[/* n */]) { - convert_distribution(0, tree, branch_ct, num_events); -} - - diff --git a/vp9/common/vp9_treecoder.h b/vp9/common/vp9_treecoder.h index bbe4e8f6a..ed8c74ae0 100644 --- a/vp9/common/vp9_treecoder.h +++ b/vp9/common/vp9_treecoder.h @@ -39,11 +39,6 @@ typedef const vp9_tree_index vp9_tree[]; taken for each node on the tree; this facilitiates decisions as to probability updates. */ -void vp9_tree_probs_from_distribution(vp9_tree tree, - unsigned int branch_ct[ /* n - 1 */ ][2], - const unsigned int num_events[ /* n */ ]); - - static INLINE vp9_prob clip_prob(int p) { return (p > 255) ? 255u : (p < 1) ? 1u : p; } diff --git a/vp9/encoder/vp9_treewriter.c b/vp9/encoder/vp9_treewriter.c index 5b0c17fe7..35e5a8fd0 100644 --- a/vp9/encoder/vp9_treewriter.c +++ b/vp9/encoder/vp9_treewriter.c @@ -57,3 +57,29 @@ void vp9_tokens_from_tree(struct vp9_token *tokens, const vp9_tree_index *tree) { tree2tok(tokens, tree, 0, 0, 0); } + +static unsigned int convert_distribution(unsigned int i, vp9_tree tree, + unsigned int branch_ct[][2], + const unsigned int num_events[]) { + unsigned int left, right; + + if (tree[i] <= 0) + left = num_events[-tree[i]]; + else + left = convert_distribution(tree[i], tree, branch_ct, num_events); + + if (tree[i + 1] <= 0) + right = num_events[-tree[i + 1]]; + else + right = convert_distribution(tree[i + 1], tree, branch_ct, num_events); + + branch_ct[i >> 1][0] = left; + branch_ct[i >> 1][1] = right; + return left + right; +} + +void vp9_tree_probs_from_distribution(vp9_tree tree, + unsigned int branch_ct[/* n-1 */][2], + const unsigned int num_events[/* n */]) { + convert_distribution(0, tree, branch_ct, num_events); +} diff --git a/vp9/encoder/vp9_treewriter.h b/vp9/encoder/vp9_treewriter.h index 94f3eb987..a2f9df139 100644 --- a/vp9/encoder/vp9_treewriter.h +++ b/vp9/encoder/vp9_treewriter.h @@ -75,4 +75,8 @@ static INLINE int treed_cost(vp9_tree tree, const vp9_prob *probs, 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); +void vp9_tree_probs_from_distribution(vp9_tree tree, + unsigned int branch_ct[ /* n - 1 */ ][2], + const unsigned int num_events[ /* n */ ]); + #endif // VP9_ENCODER_VP9_TREEWRITER_H_ diff --git a/vp9/vp9_common.mk b/vp9/vp9_common.mk index f6aebff0c..01c55a4ad 100644 --- a/vp9/vp9_common.mk +++ b/vp9/vp9_common.mk @@ -61,7 +61,6 @@ VP9_COMMON_SRCS-yes += common/vp9_quant_common.c VP9_COMMON_SRCS-yes += common/vp9_reconinter.c VP9_COMMON_SRCS-yes += common/vp9_reconintra.c VP9_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER) += common/vp9_textblit.c -VP9_COMMON_SRCS-yes += common/vp9_treecoder.c VP9_COMMON_SRCS-yes += common/vp9_common_data.c VP9_COMMON_SRCS-yes += common/vp9_common_data.h VP9_COMMON_SRCS-yes += common/vp9_scan.c |