/* * 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.
*/
// This function sets up a tree of contexts such that at each square // partition level. There are contexts for none, horizontal, vertical, and // split. Along with a block_size value and a selected block_size which // represents the state of our search. void vp9_setup_pc_tree(VP9_COMMON *cm, ThreadData *td) { int i, j; constint leaf_nodes = 64; constint tree_nodes = 64 + 16 + 4 + 1; int pc_tree_index = 0;
PC_TREE *this_pc;
PICK_MODE_CONTEXT *this_leaf; int square_index = 1; int nodes;
// 4x4 blocks smaller than 8x8 but in the same 8x8 block share the same // context so we only need to allocate 1 for each 8x8 block. for (i = 0; i < leaf_nodes; ++i) alloc_mode_context(cm, 1, &td->leaf_tree[i]);
// Sets up all the leaf nodes in the tree. for (pc_tree_index = 0; pc_tree_index < leaf_nodes; ++pc_tree_index) {
PC_TREE *const tree = &td->pc_tree[pc_tree_index];
tree->block_size = square[0];
alloc_tree_contexts(cm, tree, 4);
tree->u.leaf_split[0] = this_leaf++; for (j = 1; j < 4; j++) tree->u.leaf_split[j] = tree->u.leaf_split[0];
}
// Each node has 4 leaf nodes, fill each block_size level of the tree // from leafs to the root. for (nodes = 16; nodes > 0; nodes >>= 2) { for (i = 0; i < nodes; ++i) {
PC_TREE *const tree = &td->pc_tree[pc_tree_index];
alloc_tree_contexts(cm, tree, 4 << (2 * square_index));
tree->block_size = square[square_index]; for (j = 0; j < 4; j++) tree->u.split[j] = this_pc++;
++pc_tree_index;
}
++square_index;
}
td->pc_root = &td->pc_tree[tree_nodes - 1];
td->pc_root[0].none.best_mode_index = 2;
}
void vp9_free_pc_tree(ThreadData *td) { int i;
if (td == NULL) return;
if (td->leaf_tree != NULL) { // Set up all 4x4 mode contexts for (i = 0; i < 64; ++i) free_mode_context(&td->leaf_tree[i]);
vpx_free(td->leaf_tree);
td->leaf_tree = NULL;
}
if (td->pc_tree != NULL) { constint tree_nodes = 64 + 16 + 4 + 1; // Sets up all the leaf nodes in the tree. for (i = 0; i < tree_nodes; ++i) free_tree_contexts(&td->pc_tree[i]);
vpx_free(td->pc_tree);
td->pc_tree = NULL;
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.