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
This commit is contained in:
Родитель
6ec4d10d3c
Коммит
5f7fd7ab5e
|
@ -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
|
||||
|
@ -262,6 +265,10 @@ 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
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
av1_copy(cm->fc->global_motion_types_prob, default_global_motion_types_prob);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -209,6 +209,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];
|
||||
|
|
|
@ -820,7 +820,11 @@ static INLINE void read_mv(aom_reader *r, MV *mv, const MV *ref,
|
|||
const int use_hp = allow_hp && av1_use_mv_hp(ref);
|
||||
MV diff = { 0, 0 };
|
||||
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
|
||||
|
||||
if (mv_joint_vertical(joint_type))
|
||||
diff.row = read_mv_component(r, &ctx->comps[0], use_hp);
|
||||
|
|
|
@ -3789,6 +3789,10 @@ static uint32_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);
|
||||
#if CONFIG_SUPERTX
|
||||
|
|
|
@ -239,7 +239,11 @@ void av1_encode_mv(AV1_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
|
|||
#if CONFIG_REF_MV
|
||||
(void)is_compound;
|
||||
#endif
|
||||
#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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче