/* * 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.
*/
#if CONFIG_ERROR_CONCEALMENT /* Default is that no macroblock is corrupt, therefore we initialize * mvs_corrupt_from_mb to something very big, which we can be sure is
* outside the frame. */
pbi->mvs_corrupt_from_mb = UINT_MAX; #endif /* Read the mb_no_coeff_skip flag */
pbi->common.mb_no_coeff_skip = (int)vp8_read_bit(bc);
staticvoid decode_split_mv(vp8_reader *const bc, MODE_INFO *mi, const MODE_INFO *left_mb, const MODE_INFO *above_mb,
MB_MODE_INFO *mbmi, int_mv best_mv,
MV_CONTEXT *const mvc, int mb_to_left_edge, int mb_to_right_edge, int mb_to_top_edge, int mb_to_bottom_edge) { int s; /* split configuration (16x8, 8x16, 8x8, 4x4) */ /* number of partitions in the split configuration (see vp8_mbsplit_count) */ int num_p; int j = 0;
s = 3;
num_p = 16; if (vp8_read(bc, 110)) {
s = 2;
num_p = 4; if (vp8_read(bc, 111)) {
s = vp8_read(bc, 150);
num_p = 2;
}
}
do/* for each subset j */
{
int_mv leftmv, abovemv;
int_mv blockmv; int k; /* first block in subset j */
const vp8_prob *prob;
k = vp8_mbsplit_offset[s][j];
if (!(k & 3)) { /* On L edge, get from MB to left of us */ if (left_mb->mbmi.mode != SPLITMV) {
leftmv.as_int = left_mb->mbmi.mv.as_int;
} else {
leftmv.as_int = (left_mb->bmi + k + 4 - 1)->mv.as_int;
}
} else {
leftmv.as_int = (mi->bmi + k - 1)->mv.as_int;
}
if (!(k >> 2)) { /* On top edge, get from MB above us */ if (above_mb->mbmi.mode != SPLITMV) {
abovemv.as_int = above_mb->mbmi.mv.as_int;
} else {
abovemv.as_int = (above_mb->bmi + k + 16 - 4)->mv.as_int;
}
} else {
abovemv.as_int = (mi->bmi + k - 4)->mv.as_int;
}
{ /* Fill (uniform) modes, mvs of jth subset. Must do it here because ensuing subsets can
refer back to us via "left" or "above". */ constunsignedchar *fill_offset; unsignedint fill_count = mbsplit_fill_count[s];
if (this_mv.as_int != nmv->as_int) {
(++nmv)->as_int = this_mv.as_int;
++cntx;
}
*cntx += 1;
} else {
cnt[CNT_INTRA] += 1;
}
}
if (vp8_read(bc, vp8_mode_contexts[cnt[CNT_INTRA]][0])) { /* If we have three distinct MV's ... */ /* See if above-left MV can be merged with NEAREST */
cnt[CNT_NEAREST] += ((cnt[CNT_SPLITMV] > 0) &
(nmv->as_int == near_mvs[CNT_NEAREST].as_int));
/* Swap near and nearest if necessary */ if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) { int tmp;
tmp = cnt[CNT_NEAREST];
cnt[CNT_NEAREST] = cnt[CNT_NEAR];
cnt[CNT_NEAR] = tmp;
tmp = (int)near_mvs[CNT_NEAREST].as_int;
near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
near_mvs[CNT_NEAR].as_int = (uint32_t)tmp;
}
if (vp8_read(bc, vp8_mode_contexts[cnt[CNT_NEAREST]][1])) { if (vp8_read(bc, vp8_mode_contexts[cnt[CNT_NEAR]][2])) { int mb_to_top_edge; int mb_to_bottom_edge; int mb_to_left_edge; int mb_to_right_edge;
MV_CONTEXT *const mvc = pbi->common.fc.mvc; int near_index;
/* Don't need to check this on NEARMV and NEARESTMV * modes since those modes clamp the MV. The NEWMV mode * does not, so signal to the prediction stage whether * special handling may be required.
*/
mbmi->need_to_clamp_mvs =
vp8_check_mv_bounds(mbmi_mv, mb_to_left_edge, mb_to_right_edge,
mb_to_top_edge, mb_to_bottom_edge);
mbmi->mode = NEWMV;
}
} else {
mbmi->mode = NEARMV;
mbmi->mv.as_int = near_mvs[CNT_NEAR].as_int;
vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
}
} else {
mbmi->mode = NEARESTMV;
mbmi->mv.as_int = near_mvs[CNT_NEAREST].as_int;
vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
}
} else {
mbmi->mode = ZEROMV;
mbmi->mv.as_int = 0;
}
staticvoid read_mb_features(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x) { /* Is segmentation enabled */ if (x->segmentation_enabled && x->update_mb_segmentation_map) { /* If so then read the segment id. */ if (vp8_read(r, x->mb_segment_tree_probs[0])) {
mi->segment_id =
(unsignedchar)(2 + vp8_read(r, x->mb_segment_tree_probs[2]));
} else {
mi->segment_id =
(unsignedchar)(vp8_read(r, x->mb_segment_tree_probs[1]));
}
}
}
staticvoid decode_mb_mode_mvs(VP8D_COMP *pbi, MODE_INFO *mi) { /* Read the Macroblock segmentation map if it is being updated explicitly * this frame (reset to 0 above by default) * By default on a key frame reset all MBs to segment 0
*/ if (pbi->mb.update_mb_segmentation_map) {
read_mb_features(&pbi->mbc[8], &mi->mbmi, &pbi->mb);
} elseif (pbi->common.frame_type == KEY_FRAME) {
mi->mbmi.segment_id = 0;
}
/* Read the macroblock coeff skip flag if this feature is in use,
* else default to 0 */ if (pbi->common.mb_no_coeff_skip) {
mi->mbmi.mb_skip_coeff = vp8_read(&pbi->mbc[8], pbi->prob_skip_false);
} else {
mi->mbmi.mb_skip_coeff = 0;
}
while (++mb_col < pbi->common.mb_cols) { #if CONFIG_ERROR_CONCEALMENT int mb_num = mb_row * pbi->common.mb_cols + mb_col; #endif
decode_mb_mode_mvs(pbi, mi);
#if CONFIG_ERROR_CONCEALMENT /* look for corruption. set mvs_corrupt_from_mb to the current
* mb_num if the frame is corrupt from this macroblock. */ if (vp8dx_bool_error(&pbi->mbc[8]) &&
mb_num < (int)pbi->mvs_corrupt_from_mb) {
pbi->mvs_corrupt_from_mb = mb_num; /* no need to continue since the partition is corrupt from * here on.
*/ return;
} #endif
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.