/* * Copyright (c) 2012 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.
*/
for (i = 0; i < MAX_SEGMENTS; ++i) {
vp9_set_segdata(seg, i, SEG_LVL_ALT_Q, 2 * (i - (MAX_SEGMENTS / 2)));
vp9_enable_segfeature(seg, i, SEG_LVL_ALT_Q);
}
}
vp9_set_segdata(seg, i, SEG_LVL_ALT_Q, target_qindex - base_qindex);
vp9_enable_segfeature(seg, i, SEG_LVL_ALT_Q);
}
}
// Based on set of segment counts calculate a probability tree staticvoid calc_segtree_probs(int *segcounts, vpx_prob *segment_tree_probs) { // Work out probabilities of each segment constint c01 = segcounts[0] + segcounts[1]; constint c23 = segcounts[2] + segcounts[3]; constint c45 = segcounts[4] + segcounts[5]; constint c67 = segcounts[6] + segcounts[7];
staticvoid count_segs(const VP9_COMMON *cm, MACROBLOCKD *xd, const TileInfo *tile, MODE_INFO **mi, int *no_pred_segcounts, int (*temporal_predictor_count)[2], int *t_unpred_seg_counts, int bw, int bh, int mi_row, int mi_col) { int segment_id;
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
// Count the number of hits on each segment with no prediction
no_pred_segcounts[segment_id]++;
// Temporal prediction not allowed on key frames if (cm->frame_type != KEY_FRAME) { const BLOCK_SIZE bsize = xd->mi[0]->sb_type; // Test to see if the segment id matches the predicted value. constint pred_segment_id =
get_segment_id(cm, cm->last_frame_seg_map, bsize, mi_row, mi_col); constint pred_flag = pred_segment_id == segment_id; constint pred_context = vp9_get_pred_context_seg_id(xd);
// Store the prediction status for this mb and update counts // as appropriate
xd->mi[0]->seg_id_predicted = pred_flag;
temporal_predictor_count[pred_context][pred_flag]++;
// Update the "unpredicted" segment count if (!pred_flag) t_unpred_seg_counts[segment_id]++;
}
}
staticvoid count_segs_sb(const VP9_COMMON *cm, MACROBLOCKD *xd, const TileInfo *tile, MODE_INFO **mi, int *no_pred_segcounts, int (*temporal_predictor_count)[2], int *t_unpred_seg_counts, int mi_row, int mi_col,
BLOCK_SIZE bsize) { constint mis = cm->mi_stride; int bw, bh; constint bs = num_8x8_blocks_wide_lookup[bsize], hbs = bs / 2;
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
// Set default state for the segment tree probabilities and the // temporal coding probabilities
memset(seg->tree_probs, 255, sizeof(seg->tree_probs));
memset(seg->pred_probs, 255, sizeof(seg->pred_probs));
// First of all generate stats regarding how well the last segment map // predicts this one for (tile_col = 0; tile_col < 1 << cm->log2_tile_cols; tile_col++) {
TileInfo tile;
MODE_INFO **mi_ptr;
vp9_tile_init(&tile, cm, 0, tile_col);
// Work out probability tree for coding segments without prediction // and the cost.
calc_segtree_probs(no_pred_segcounts, no_pred_tree);
no_pred_cost = cost_segmap(no_pred_segcounts, no_pred_tree);
// Key frames cannot use temporal prediction if (!frame_is_intra_only(cm)) { // Work out probability tree for coding those segments not // predicted using the temporal method and the cost.
calc_segtree_probs(t_unpred_seg_counts, t_pred_tree);
t_pred_cost = cost_segmap(t_unpred_seg_counts, t_pred_tree);
// Add in the cost of the signaling for each prediction context. for (i = 0; i < PREDICTION_PROBS; i++) { constint count0 = temporal_predictor_count[i][0]; constint count1 = temporal_predictor_count[i][1];
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.