Commit 924f7eea authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Update joint_cdf table once per frame.

Move computing the joint_cdf table per coded mv joint symbol to
 computing it only when the probabilities are updated.

Change-Id: If5d195f70e6fad7b60f69606c8386ad5e69657d2
parent c5579ea9
......@@ -42,7 +42,10 @@ const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
4, -2, -3 };
static const nmv_context default_nmv_context = {
{ 32, 64, 96 },
{ 32, 64, 96 }, // joints
#if CONFIG_DAALA_EC
{ 0, 0, 0, 0 }, // joint_cdf is computed from joints in av1_init_mv_probs()
#endif
{ {
// Vertical component
128, // sign
......@@ -259,5 +262,9 @@ void av1_init_mv_probs(AV1_COMMON *cm) {
for (i = 0; i < NMV_CONTEXTS; ++i) cm->fc->nmvc[i] = default_nmv_context;
#else
cm->fc->nmvc = default_nmv_context;
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_mv_joint_tree, cm->fc->nmvc.joints,
cm->fc->nmvc.joint_cdf);
#endif
#endif
}
......@@ -95,6 +95,9 @@ typedef struct {
typedef struct {
aom_prob joints[MV_JOINTS - 1];
#if CONFIG_DAALA_EC
aom_cdf_prob joint_cdf[MV_JOINTS];
#endif
nmv_component comps[2];
} nmv_context;
......
......@@ -230,6 +230,9 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) {
int i, j;
update_mv_probs(ctx->joints, MV_JOINTS - 1, r);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_mv_joint_tree, ctx->joints, ctx->joint_cdf);
#endif
for (i = 0; i < 2; ++i) {
nmv_component *const comp_ctx = &ctx->comps[i];
......
......@@ -581,7 +581,11 @@ static INLINE void read_mv(aom_reader *r, MV *mv, const MV *ref,
const nmv_context *ctx, nmv_context_counts *counts,
int allow_hp) {
const MV_JOINT_TYPE joint_type =
#if CONFIG_DAALA_EC
(MV_JOINT_TYPE)aom_read_symbol(r, ctx->joint_cdf, MV_JOINTS, ACCT_STR);
#else
(MV_JOINT_TYPE)aom_read_tree(r, av1_mv_joint_tree, ctx->joints, ACCT_STR);
#endif
const int use_hp = allow_hp && av1_use_mv_hp(ref);
MV diff = { 0, 0 };
......
......@@ -2125,6 +2125,10 @@ static size_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
counts->mv);
#else
&counts->mv);
#endif
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_mv_joint_tree, cm->fc->nmvc.joints,
cm->fc->nmvc.joint_cdf);
#endif
update_ext_tx_probs(cm, header_bc);
}
......
......@@ -245,7 +245,11 @@ void av1_encode_mv(AV1_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
const MV_JOINT_TYPE j = av1_get_mv_joint(&diff);
usehp = usehp && av1_use_mv_hp(ref);
#if CONFIG_DAALA_EC
aom_write_symbol(w, j, mvctx->joint_cdf, MV_JOINTS);
#else
av1_write_token(w, av1_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]);
#endif
if (mv_joint_vertical(j))
encode_mv_component(w, diff.row, &mvctx->comps[0], usehp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment