/* * 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.
*/
// High precision bit if (usehp)
vpx_write(w, hp, mv_class == MV_CLASS_0 ? mvcomp->class0_hp : mvcomp->hp);
}
staticvoid build_nmv_component_cost_table(int *mvcost, const nmv_component *const mvcomp, int usehp) { int sign_cost[2], class_cost[MV_CLASSES], class0_cost[CLASS0_SIZE]; int bits_cost[MV_OFFSET_BITS][2]; int class0_fp_cost[CLASS0_SIZE][MV_FP_SIZE], fp_cost[MV_FP_SIZE]; int class0_hp_cost[2], hp_cost[2]; int i; int c, o;
sign_cost[0] = vp9_cost_zero(mvcomp->sign);
sign_cost[1] = vp9_cost_one(mvcomp->sign);
vp9_cost_tokens(class_cost, mvcomp->classes, vp9_mv_class_tree);
vp9_cost_tokens(class0_cost, mvcomp->class0, vp9_mv_class0_tree); for (i = 0; i < MV_OFFSET_BITS; ++i) {
bits_cost[i][0] = vp9_cost_zero(mvcomp->bits[i]);
bits_cost[i][1] = vp9_cost_one(mvcomp->bits[i]);
}
for (i = 0; i < CLASS0_SIZE; ++i)
vp9_cost_tokens(class0_fp_cost[i], mvcomp->class0_fp[i], vp9_mv_fp_tree);
vp9_cost_tokens(fp_cost, mvcomp->fp, vp9_mv_fp_tree);
// Always build the hp costs to avoid an uninitialized warning from gcc
class0_hp_cost[0] = vp9_cost_zero(mvcomp->class0_hp);
class0_hp_cost[1] = vp9_cost_one(mvcomp->class0_hp);
hp_cost[0] = vp9_cost_zero(mvcomp->hp);
hp_cost[1] = vp9_cost_one(mvcomp->hp);
mvcost[0] = 0; // MV_CLASS_0 for (o = 0; o < (CLASS0_SIZE << 3); ++o) { int d, e, f; int cost = class_cost[MV_CLASS_0]; int v = o + 1;
d = (o >> 3); /* int mv data */
f = (o >> 1) & 3; /* fractional pel mv data */
cost += class0_cost[d];
cost += class0_fp_cost[d][f]; if (usehp) {
e = (o & 1); /* high precision mv data */
cost += class0_hp_cost[e];
}
mvcost[v] = cost + sign_cost[0];
mvcost[-v] = cost + sign_cost[1];
} for (c = MV_CLASS_1; c < MV_CLASSES; ++c) { int d; for (d = 0; d < (1 << c); ++d) { int f; int whole_cost = class_cost[c]; int b = c + CLASS0_BITS - 1; /* number of bits */ for (i = 0; i < b; ++i) whole_cost += bits_cost[i][((d >> i) & 1)]; for (f = 0; f < 4; ++f) { int cost = whole_cost + fp_cost[f]; int v = (CLASS0_SIZE << (c + 2)) + d * 8 + f * 2 /* + e */ + 1; if (usehp) {
mvcost[v] = cost + hp_cost[0] + sign_cost[0];
mvcost[-v] = cost + hp_cost[0] + sign_cost[1]; if (v + 1 > MV_MAX) break;
mvcost[v + 1] = cost + hp_cost[1] + sign_cost[0];
mvcost[-v - 1] = cost + hp_cost[1] + sign_cost[1];
} else {
mvcost[v] = cost + sign_cost[0];
mvcost[-v] = cost + sign_cost[1]; if (v + 1 > MV_MAX) break;
mvcost[v + 1] = cost + sign_cost[0];
mvcost[-v - 1] = cost + sign_cost[1];
}
}
}
}
}
vp9_write_token(w, vp9_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]); if (mv_joint_vertical(j))
encode_mv_component(w, diff.row, &mvctx->comps[0], usehp);
if (mv_joint_horizontal(j))
encode_mv_component(w, diff.col, &mvctx->comps[1], usehp);
// If auto_mv_step_size is enabled then keep track of the largest // motion vector component used. if (cpi->sf.mv.auto_mv_step_size) { constunsignedint maxv = VPXMAX(abs(mv->row), abs(mv->col)) >> 3;
*max_mv_magnitude = VPXMAX(maxv, *max_mv_magnitude);
}
}
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.