From 68569dee1416593955c1570d638b3d9250b33012 Mon Sep 17 00:00:00 2001 From: trav90 Date: Mon, 15 Oct 2018 21:45:30 -0500 Subject: Import aom library This is the reference implementation for the Alliance for Open Media's av1 video code. The commit used was 4d668d7feb1f8abd809d1bca0418570a7f142a36. --- third_party/aom/av1/common/entropymv.c | 315 +++++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 third_party/aom/av1/common/entropymv.c (limited to 'third_party/aom/av1/common/entropymv.c') diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c new file mode 100644 index 000000000..9c162d2c5 --- /dev/null +++ b/third_party/aom/av1/common/entropymv.c @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2016, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +#include "av1/common/onyxc_int.h" +#include "av1/common/entropymv.h" + +// Integer pel reference mv threshold for use of high-precision 1/8 mv +#define COMPANDED_MVREF_THRESH 8 + +const aom_tree_index av1_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = { + -MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ +}; + +/* clang-format off */ +const aom_tree_index av1_mv_class_tree[TREE_SIZE(MV_CLASSES)] = { + -MV_CLASS_0, 2, + -MV_CLASS_1, 4, + 6, 8, + -MV_CLASS_2, -MV_CLASS_3, + 10, 12, + -MV_CLASS_4, -MV_CLASS_5, + -MV_CLASS_6, 14, + 16, 18, + -MV_CLASS_7, -MV_CLASS_8, + -MV_CLASS_9, -MV_CLASS_10, +}; +/* clang-format on */ + +const aom_tree_index av1_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = { + -0, -1, +}; + +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 }, // joints +#if CONFIG_EC_MULTISYMBOL + { AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768), + 0 }, // joint_cdf +#endif + { { + // Vertical component + 128, // sign + { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class +#if CONFIG_EC_MULTISYMBOL + { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), + AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), + AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf +#endif + { 216 }, // class0 + { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits + { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp + { 64, 96, 64 }, // fp +#if CONFIG_EC_MULTISYMBOL + { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), + 0 } }, // class0_fp_cdf + { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), + 0 }, // fp_cdf +#endif + 160, // class0_hp bit + 128, // hp + }, + { + // Horizontal component + 128, // sign + { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class +#if CONFIG_EC_MULTISYMBOL + { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), + AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), + AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf +#endif + { 208 }, // class0 + { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits + { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp + { 64, 96, 64 }, // fp +#if CONFIG_EC_MULTISYMBOL + { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), + 0 }, + { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), + 0 } }, // class0_fp_cdf + { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), + 0 }, // fp_cdf +#endif + 160, // class0_hp bit + 128, // hp + } }, +}; + +static const uint8_t log_in_base_2[] = { + 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 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9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10 +}; + +#if CONFIG_GLOBAL_MOTION +#if GLOBAL_TRANS_TYPES == 7 // All models +const aom_tree_index av1_global_motion_types_tree[TREE_SIZE( + GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4, + -ROTZOOM, 6, -AFFINE, 8, + -HOMOGRAPHY, 10, -HORTRAPEZOID, -VERTRAPEZOID }; + +static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = + { 224, 128, 192, 192, 32, 128 }; + +#elif GLOBAL_TRANS_TYPES == 6 // Do not allow full homography +const aom_tree_index + av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)] = { + -IDENTITY, 2, -TRANSLATION, 4, -ROTZOOM, 6, -AFFINE, 8, -HORTRAPEZOID, + -VERTRAPEZOID + }; + +static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = + { 224, 128, 192, 192, 128 }; + +#elif GLOBAL_TRANS_TYPES == 4 // Upto Affine +const aom_tree_index av1_global_motion_types_tree[TREE_SIZE( + GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4, -ROTZOOM, -AFFINE }; + +static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = + { 224, 128, 240 }; + +#elif GLOBAL_TRANS_TYPES == 3 // Upto rotation-zoom + +const aom_tree_index av1_global_motion_types_tree[TREE_SIZE( + GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, -ROTZOOM }; + +static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = + { 224, 128 }; +#endif // GLOBAL_TRANS_TYPES +#endif // CONFIG_GLOBAL_MOTION + +static INLINE int mv_class_base(MV_CLASS_TYPE c) { + return c ? CLASS0_SIZE << (c + 2) : 0; +} + +MV_CLASS_TYPE av1_get_mv_class(int z, int *offset) { + const MV_CLASS_TYPE c = (z >= CLASS0_SIZE * 4096) + ? MV_CLASS_10 + : (MV_CLASS_TYPE)log_in_base_2[z >> 3]; + if (offset) *offset = z - mv_class_base(c); + return c; +} + +static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, + int usehp) { + int s, z, c, o, d, e, f; + assert(v != 0); /* should not be zero */ + s = v < 0; + comp_counts->sign[s] += incr; + z = (s ? -v : v) - 1; /* magnitude - 1 */ + + c = av1_get_mv_class(z, &o); + comp_counts->classes[c] += incr; + + d = (o >> 3); /* int mv data */ + f = (o >> 1) & 3; /* fractional pel mv data */ + e = (o & 1); /* high precision mv data */ + + if (c == MV_CLASS_0) { + comp_counts->class0[d] += incr; + comp_counts->class0_fp[d][f] += incr; + if (usehp) comp_counts->class0_hp[e] += incr; + } else { + int i; + int b = c + CLASS0_BITS - 1; // number of bits + for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr; + comp_counts->fp[f] += incr; + if (usehp) comp_counts->hp[e] += incr; + } +} + +void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) { + if (counts != NULL) { + const MV_JOINT_TYPE j = av1_get_mv_joint(mv); + ++counts->joints[j]; + + if (mv_joint_vertical(j)) + inc_mv_component(mv->row, &counts->comps[0], 1, usehp); + + if (mv_joint_horizontal(j)) + inc_mv_component(mv->col, &counts->comps[1], 1, usehp); + } +} + +void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { + int i, j; +#if CONFIG_REF_MV + int idx; + for (idx = 0; idx < NMV_CONTEXTS; ++idx) { + nmv_context *fc = &cm->fc->nmvc[idx]; + const nmv_context *pre_fc = + &cm->frame_contexts[cm->frame_context_idx].nmvc[idx]; + const nmv_context_counts *counts = &cm->counts.mv[idx]; +#else + nmv_context *fc = &cm->fc->nmvc; + const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc; + const nmv_context_counts *counts = &cm->counts.mv; +#endif // CONFIG_REF_MV + aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints, + fc->joints); + for (i = 0; i < 2; ++i) { + nmv_component *comp = &fc->comps[i]; + const nmv_component *pre_comp = &pre_fc->comps[i]; + const nmv_component_counts *c = &counts->comps[i]; + + comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign); + aom_tree_merge_probs(av1_mv_class_tree, pre_comp->classes, c->classes, + comp->classes); + aom_tree_merge_probs(av1_mv_class0_tree, pre_comp->class0, c->class0, + comp->class0); + + for (j = 0; j < MV_OFFSET_BITS; ++j) + comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]); + + for (j = 0; j < CLASS0_SIZE; ++j) + aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j], + c->class0_fp[j], comp->class0_fp[j]); + + aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); + + if (allow_hp) { + comp->class0_hp = + av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp); + comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); + } + } +#if CONFIG_REF_MV + } +#endif // CONFIG_REF_MV +} + +#if CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT +void av1_set_mv_cdfs(nmv_context *ctx) { + int i; + int j; + av1_tree_to_cdf(av1_mv_joint_tree, ctx->joints, ctx->joint_cdf); + + for (i = 0; i < 2; ++i) { + nmv_component *const comp_ctx = &ctx->comps[i]; + av1_tree_to_cdf(av1_mv_class_tree, comp_ctx->classes, comp_ctx->class_cdf); + + for (j = 0; j < CLASS0_SIZE; ++j) { + av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->class0_fp[j], + comp_ctx->class0_fp_cdf[j]); + } + av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->fp, comp_ctx->fp_cdf); + } +} +#endif + +void av1_init_mv_probs(AV1_COMMON *cm) { +#if CONFIG_REF_MV + int i; + for (i = 0; i < NMV_CONTEXTS; ++i) { + // NB: this sets CDFs too + cm->fc->nmvc[i] = default_nmv_context; + } +#else + cm->fc->nmvc = default_nmv_context; +#endif // CONFIG_REF_MV +#if CONFIG_INTRABC + cm->fc->ndvc = default_nmv_context; +#endif // CONFIG_INTRABC +#if CONFIG_GLOBAL_MOTION + av1_copy(cm->fc->global_motion_types_prob, default_global_motion_types_prob); +#endif // CONFIG_GLOBAL_MOTION +} -- cgit v1.2.3 From df9477dfa60ebb5d31bc142e58ce46535c17abce Mon Sep 17 00:00:00 2001 From: trav90 Date: Wed, 17 Oct 2018 05:59:08 -0500 Subject: Update aom to slightly newer commit ID --- third_party/aom/av1/common/entropymv.c | 61 +++++++++++----------------------- 1 file changed, 19 insertions(+), 42 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.c') diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c index 9c162d2c5..954bfec4e 100644 --- a/third_party/aom/av1/common/entropymv.c +++ b/third_party/aom/av1/common/entropymv.c @@ -43,57 +43,47 @@ const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1, static const nmv_context default_nmv_context = { { 32, 64, 96 }, // joints -#if CONFIG_EC_MULTISYMBOL { AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768), 0 }, // joint_cdf -#endif { { // Vertical component 128, // sign { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class -#if CONFIG_EC_MULTISYMBOL { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf -#endif - { 216 }, // class0 - { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits - { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp - { 64, 96, 64 }, // fp -#if CONFIG_EC_MULTISYMBOL + { 216 }, // class0 + { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits + { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp + { 64, 96, 64 }, // fp { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), 0 }, { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), 0 } }, // class0_fp_cdf { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), 0 }, // fp_cdf -#endif - 160, // class0_hp bit - 128, // hp + 160, // class0_hp bit + 128, // hp }, { // Horizontal component 128, // sign { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class -#if CONFIG_EC_MULTISYMBOL { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf -#endif - { 208 }, // class0 - { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits - { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp - { 64, 96, 64 }, // fp -#if CONFIG_EC_MULTISYMBOL + { 208 }, // class0 + { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits + { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp + { 64, 96, 64 }, // fp { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), 0 }, { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), 0 } }, // class0_fp_cdf { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), 0 }, // fp_cdf -#endif - 160, // class0_hp bit - 128, // hp + 160, // class0_hp bit + 128, // hp } }, }; @@ -232,23 +222,16 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) { void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { int i, j; -#if CONFIG_REF_MV int idx; for (idx = 0; idx < NMV_CONTEXTS; ++idx) { - nmv_context *fc = &cm->fc->nmvc[idx]; - const nmv_context *pre_fc = - &cm->frame_contexts[cm->frame_context_idx].nmvc[idx]; + nmv_context *nmvc = &cm->fc->nmvc[idx]; + const nmv_context *pre_nmvc = &cm->pre_fc->nmvc[idx]; const nmv_context_counts *counts = &cm->counts.mv[idx]; -#else - nmv_context *fc = &cm->fc->nmvc; - const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc; - const nmv_context_counts *counts = &cm->counts.mv; -#endif // CONFIG_REF_MV - aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints, - fc->joints); + aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints, + nmvc->joints); for (i = 0; i < 2; ++i) { - nmv_component *comp = &fc->comps[i]; - const nmv_component *pre_comp = &pre_fc->comps[i]; + nmv_component *comp = &nmvc->comps[i]; + const nmv_component *pre_comp = &pre_nmvc->comps[i]; const nmv_component_counts *c = &counts->comps[i]; comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign); @@ -272,12 +255,10 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); } } -#if CONFIG_REF_MV } -#endif // CONFIG_REF_MV } -#if CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT +#if !CONFIG_EC_ADAPT void av1_set_mv_cdfs(nmv_context *ctx) { int i; int j; @@ -297,15 +278,11 @@ void av1_set_mv_cdfs(nmv_context *ctx) { #endif void av1_init_mv_probs(AV1_COMMON *cm) { -#if CONFIG_REF_MV int i; for (i = 0; i < NMV_CONTEXTS; ++i) { // NB: this sets CDFs too cm->fc->nmvc[i] = default_nmv_context; } -#else - cm->fc->nmvc = default_nmv_context; -#endif // CONFIG_REF_MV #if CONFIG_INTRABC cm->fc->ndvc = default_nmv_context; #endif // CONFIG_INTRABC -- cgit v1.2.3 From 7369c7d7a5eed32963d8af37658286617919f91c Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 18 Oct 2018 06:04:57 -0500 Subject: Update aom to commit id f5bdeac22930ff4c6b219be49c843db35970b918 --- third_party/aom/av1/common/entropymv.c | 92 +++++++++------------------------- 1 file changed, 25 insertions(+), 67 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.c') diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c index 954bfec4e..4737915a4 100644 --- a/third_party/aom/av1/common/entropymv.c +++ b/third_party/aom/av1/common/entropymv.c @@ -64,6 +64,11 @@ static const nmv_context default_nmv_context = { 0 }, // fp_cdf 160, // class0_hp bit 128, // hp +#if CONFIG_NEW_MULTISYMBOL + { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, +#endif }, { // Horizontal component @@ -84,6 +89,11 @@ static const nmv_context default_nmv_context = { 0 }, // fp_cdf 160, // class0_hp bit 128, // hp +#if CONFIG_NEW_MULTISYMBOL + { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, +#endif } }, }; @@ -130,43 +140,6 @@ static const uint8_t log_in_base_2[] = { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10 }; -#if CONFIG_GLOBAL_MOTION -#if GLOBAL_TRANS_TYPES == 7 // All models -const aom_tree_index av1_global_motion_types_tree[TREE_SIZE( - GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4, - -ROTZOOM, 6, -AFFINE, 8, - -HOMOGRAPHY, 10, -HORTRAPEZOID, -VERTRAPEZOID }; - -static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = - { 224, 128, 192, 192, 32, 128 }; - -#elif GLOBAL_TRANS_TYPES == 6 // Do not allow full homography -const aom_tree_index - av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)] = { - -IDENTITY, 2, -TRANSLATION, 4, -ROTZOOM, 6, -AFFINE, 8, -HORTRAPEZOID, - -VERTRAPEZOID - }; - -static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = - { 224, 128, 192, 192, 128 }; - -#elif GLOBAL_TRANS_TYPES == 4 // Upto Affine -const aom_tree_index av1_global_motion_types_tree[TREE_SIZE( - GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4, -ROTZOOM, -AFFINE }; - -static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = - { 224, 128, 240 }; - -#elif GLOBAL_TRANS_TYPES == 3 // Upto rotation-zoom - -const aom_tree_index av1_global_motion_types_tree[TREE_SIZE( - GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, -ROTZOOM }; - -static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] = - { 224, 128 }; -#endif // GLOBAL_TRANS_TYPES -#endif // CONFIG_GLOBAL_MOTION - static INLINE int mv_class_base(MV_CLASS_TYPE c) { return c ? CLASS0_SIZE << (c + 2) : 0; } @@ -180,7 +153,7 @@ MV_CLASS_TYPE av1_get_mv_class(int z, int *offset) { } static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, - int usehp) { + MvSubpelPrecision precision) { int s, z, c, o, d, e, f; assert(v != 0); /* should not be zero */ s = v < 0; @@ -196,27 +169,34 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, if (c == MV_CLASS_0) { comp_counts->class0[d] += incr; - comp_counts->class0_fp[d][f] += incr; - if (usehp) comp_counts->class0_hp[e] += incr; +#if CONFIG_INTRABC + if (precision > MV_SUBPEL_NONE) +#endif + comp_counts->class0_fp[d][f] += incr; + if (precision > MV_SUBPEL_LOW_PRECISION) comp_counts->class0_hp[e] += incr; } else { int i; int b = c + CLASS0_BITS - 1; // number of bits for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr; - comp_counts->fp[f] += incr; - if (usehp) comp_counts->hp[e] += incr; +#if CONFIG_INTRABC + if (precision > MV_SUBPEL_NONE) +#endif + comp_counts->fp[f] += incr; + if (precision > MV_SUBPEL_LOW_PRECISION) comp_counts->hp[e] += incr; } } -void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) { +void av1_inc_mv(const MV *mv, nmv_context_counts *counts, + MvSubpelPrecision precision) { if (counts != NULL) { const MV_JOINT_TYPE j = av1_get_mv_joint(mv); ++counts->joints[j]; if (mv_joint_vertical(j)) - inc_mv_component(mv->row, &counts->comps[0], 1, usehp); + inc_mv_component(mv->row, &counts->comps[0], 1, precision); if (mv_joint_horizontal(j)) - inc_mv_component(mv->col, &counts->comps[1], 1, usehp); + inc_mv_component(mv->col, &counts->comps[1], 1, precision); } } @@ -258,25 +238,6 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { } } -#if !CONFIG_EC_ADAPT -void av1_set_mv_cdfs(nmv_context *ctx) { - int i; - int j; - av1_tree_to_cdf(av1_mv_joint_tree, ctx->joints, ctx->joint_cdf); - - for (i = 0; i < 2; ++i) { - nmv_component *const comp_ctx = &ctx->comps[i]; - av1_tree_to_cdf(av1_mv_class_tree, comp_ctx->classes, comp_ctx->class_cdf); - - for (j = 0; j < CLASS0_SIZE; ++j) { - av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->class0_fp[j], - comp_ctx->class0_fp_cdf[j]); - } - av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->fp, comp_ctx->fp_cdf); - } -} -#endif - void av1_init_mv_probs(AV1_COMMON *cm) { int i; for (i = 0; i < NMV_CONTEXTS; ++i) { @@ -286,7 +247,4 @@ void av1_init_mv_probs(AV1_COMMON *cm) { #if CONFIG_INTRABC cm->fc->ndvc = default_nmv_context; #endif // CONFIG_INTRABC -#if CONFIG_GLOBAL_MOTION - av1_copy(cm->fc->global_motion_types_prob, default_global_motion_types_prob); -#endif // CONFIG_GLOBAL_MOTION } -- cgit v1.2.3 From ec910d81405c736a4490383a250299a7837c2e64 Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 18 Oct 2018 21:53:44 -0500 Subject: Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614 --- third_party/aom/av1/common/entropymv.c | 39 ++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.c') diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c index 4737915a4..2d0191366 100644 --- a/third_party/aom/av1/common/entropymv.c +++ b/third_party/aom/av1/common/entropymv.c @@ -68,6 +68,12 @@ static const nmv_context default_nmv_context = { { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, + { { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf #endif }, { @@ -93,6 +99,12 @@ static const nmv_context default_nmv_context = { { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, + { { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf #endif } }, }; @@ -169,7 +181,7 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, if (c == MV_CLASS_0) { comp_counts->class0[d] += incr; -#if CONFIG_INTRABC +#if CONFIG_INTRABC || CONFIG_AMVR if (precision > MV_SUBPEL_NONE) #endif comp_counts->class0_fp[d][f] += incr; @@ -178,7 +190,7 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, int i; int b = c + CLASS0_BITS - 1; // number of bits for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr; -#if CONFIG_INTRABC +#if CONFIG_INTRABC || CONFIG_AMVR if (precision > MV_SUBPEL_NONE) #endif comp_counts->fp[f] += incr; @@ -222,18 +234,23 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { for (j = 0; j < MV_OFFSET_BITS; ++j) comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]); +#if CONFIG_AMVR + if (cm->cur_frame_mv_precision_level == 0) { +#endif + for (j = 0; j < CLASS0_SIZE; ++j) + aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j], + c->class0_fp[j], comp->class0_fp[j]); - for (j = 0; j < CLASS0_SIZE; ++j) - aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j], - c->class0_fp[j], comp->class0_fp[j]); - - aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); + aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); - if (allow_hp) { - comp->class0_hp = - av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp); - comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); + if (allow_hp) { + comp->class0_hp = + av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp); + comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); + } +#if CONFIG_AMVR } +#endif } } } -- cgit v1.2.3 From bbcc64772580c8a979288791afa02d30bc476d2e Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 21:52:15 -0500 Subject: Update aom to v1.0.0 Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0. --- third_party/aom/av1/common/entropymv.c | 227 ++++++--------------------------- 1 file changed, 41 insertions(+), 186 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.c') diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c index 2d0191366..446aa433c 100644 --- a/third_party/aom/av1/common/entropymv.c +++ b/third_party/aom/av1/common/entropymv.c @@ -12,100 +12,51 @@ #include "av1/common/onyxc_int.h" #include "av1/common/entropymv.h" -// Integer pel reference mv threshold for use of high-precision 1/8 mv -#define COMPANDED_MVREF_THRESH 8 - -const aom_tree_index av1_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = { - -MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ -}; - -/* clang-format off */ -const aom_tree_index av1_mv_class_tree[TREE_SIZE(MV_CLASSES)] = { - -MV_CLASS_0, 2, - -MV_CLASS_1, 4, - 6, 8, - -MV_CLASS_2, -MV_CLASS_3, - 10, 12, - -MV_CLASS_4, -MV_CLASS_5, - -MV_CLASS_6, 14, - 16, 18, - -MV_CLASS_7, -MV_CLASS_8, - -MV_CLASS_9, -MV_CLASS_10, -}; -/* clang-format on */ - -const aom_tree_index av1_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = { - -0, -1, -}; - -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 }, // joints - { AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768), - 0 }, // joint_cdf + { AOM_CDF4(4096, 11264, 19328) }, // joints_cdf { { // Vertical component - 128, // sign - { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class - { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), - AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), - AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf - { 216 }, // class0 - { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits - { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp - { 64, 96, 64 }, // fp - { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), - 0 }, - { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), - 0 } }, // class0_fp_cdf - { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), - 0 }, // fp_cdf - 160, // class0_hp bit - 128, // hp -#if CONFIG_NEW_MULTISYMBOL - { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, - { { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf -#endif + { AOM_CDF11(28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, + 32762, 32767) }, // class_cdf // fp + { { AOM_CDF4(16384, 24576, 26624) }, + { AOM_CDF4(12288, 21248, 24128) } }, // class0_fp_cdf + { AOM_CDF4(8192, 17408, 21248) }, // fp_cdf + { AOM_CDF2(128 * 128) }, // sign_cdf + { AOM_CDF2(160 * 128) }, // class0_hp_cdf + { AOM_CDF2(128 * 128) }, // hp_cdf + { AOM_CDF2(216 * 128) }, // class0_cdf + { { AOM_CDF2(128 * 136) }, + { AOM_CDF2(128 * 140) }, + { AOM_CDF2(128 * 148) }, + { AOM_CDF2(128 * 160) }, + { AOM_CDF2(128 * 176) }, + { AOM_CDF2(128 * 192) }, + { AOM_CDF2(128 * 224) }, + { AOM_CDF2(128 * 234) }, + { AOM_CDF2(128 * 234) }, + { AOM_CDF2(128 * 240) } }, // bits_cdf }, { // Horizontal component - 128, // sign - { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class - { AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320), - AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757), - AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf - { 208 }, // class0 - { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits - { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp - { 64, 96, 64 }, // fp - { { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768), - 0 }, - { AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768), - 0 } }, // class0_fp_cdf - { AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768), - 0 }, // fp_cdf - 160, // class0_hp bit - 128, // hp -#if CONFIG_NEW_MULTISYMBOL - { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }, - { AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 }, - { { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 }, - { AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf -#endif + { AOM_CDF11(28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, + 32762, 32767) }, // class_cdf // fp + { { AOM_CDF4(16384, 24576, 26624) }, + { AOM_CDF4(12288, 21248, 24128) } }, // class0_fp_cdf + { AOM_CDF4(8192, 17408, 21248) }, // fp_cdf + { AOM_CDF2(128 * 128) }, // sign_cdf + { AOM_CDF2(160 * 128) }, // class0_hp_cdf + { AOM_CDF2(128 * 128) }, // hp_cdf + { AOM_CDF2(216 * 128) }, // class0_cdf + { { AOM_CDF2(128 * 136) }, + { AOM_CDF2(128 * 140) }, + { AOM_CDF2(128 * 148) }, + { AOM_CDF2(128 * 160) }, + { AOM_CDF2(128 * 176) }, + { AOM_CDF2(128 * 192) }, + { AOM_CDF2(128 * 224) }, + { AOM_CDF2(128 * 234) }, + { AOM_CDF2(128 * 234) }, + { AOM_CDF2(128 * 240) } }, // bits_cdf } }, }; @@ -164,104 +115,8 @@ MV_CLASS_TYPE av1_get_mv_class(int z, int *offset) { return c; } -static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr, - MvSubpelPrecision precision) { - int s, z, c, o, d, e, f; - assert(v != 0); /* should not be zero */ - s = v < 0; - comp_counts->sign[s] += incr; - z = (s ? -v : v) - 1; /* magnitude - 1 */ - - c = av1_get_mv_class(z, &o); - comp_counts->classes[c] += incr; - - d = (o >> 3); /* int mv data */ - f = (o >> 1) & 3; /* fractional pel mv data */ - e = (o & 1); /* high precision mv data */ - - if (c == MV_CLASS_0) { - comp_counts->class0[d] += incr; -#if CONFIG_INTRABC || CONFIG_AMVR - if (precision > MV_SUBPEL_NONE) -#endif - comp_counts->class0_fp[d][f] += incr; - if (precision > MV_SUBPEL_LOW_PRECISION) comp_counts->class0_hp[e] += incr; - } else { - int i; - int b = c + CLASS0_BITS - 1; // number of bits - for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr; -#if CONFIG_INTRABC || CONFIG_AMVR - if (precision > MV_SUBPEL_NONE) -#endif - comp_counts->fp[f] += incr; - if (precision > MV_SUBPEL_LOW_PRECISION) comp_counts->hp[e] += incr; - } -} - -void av1_inc_mv(const MV *mv, nmv_context_counts *counts, - MvSubpelPrecision precision) { - if (counts != NULL) { - const MV_JOINT_TYPE j = av1_get_mv_joint(mv); - ++counts->joints[j]; - - if (mv_joint_vertical(j)) - inc_mv_component(mv->row, &counts->comps[0], 1, precision); - - if (mv_joint_horizontal(j)) - inc_mv_component(mv->col, &counts->comps[1], 1, precision); - } -} - -void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { - int i, j; - int idx; - for (idx = 0; idx < NMV_CONTEXTS; ++idx) { - nmv_context *nmvc = &cm->fc->nmvc[idx]; - const nmv_context *pre_nmvc = &cm->pre_fc->nmvc[idx]; - const nmv_context_counts *counts = &cm->counts.mv[idx]; - aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints, - nmvc->joints); - for (i = 0; i < 2; ++i) { - nmv_component *comp = &nmvc->comps[i]; - const nmv_component *pre_comp = &pre_nmvc->comps[i]; - const nmv_component_counts *c = &counts->comps[i]; - - comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign); - aom_tree_merge_probs(av1_mv_class_tree, pre_comp->classes, c->classes, - comp->classes); - aom_tree_merge_probs(av1_mv_class0_tree, pre_comp->class0, c->class0, - comp->class0); - - for (j = 0; j < MV_OFFSET_BITS; ++j) - comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]); -#if CONFIG_AMVR - if (cm->cur_frame_mv_precision_level == 0) { -#endif - for (j = 0; j < CLASS0_SIZE; ++j) - aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j], - c->class0_fp[j], comp->class0_fp[j]); - - aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp); - - if (allow_hp) { - comp->class0_hp = - av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp); - comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); - } -#if CONFIG_AMVR - } -#endif - } - } -} - void av1_init_mv_probs(AV1_COMMON *cm) { - int i; - for (i = 0; i < NMV_CONTEXTS; ++i) { - // NB: this sets CDFs too - cm->fc->nmvc[i] = default_nmv_context; - } -#if CONFIG_INTRABC + // NB: this sets CDFs too + cm->fc->nmvc = default_nmv_context; cm->fc->ndvc = default_nmv_context; -#endif // CONFIG_INTRABC } -- cgit v1.2.3 From d2499ead93dc4298c0882fe98902acb1b5209f99 Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 23:05:00 -0500 Subject: Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591 --- third_party/aom/av1/common/entropymv.c | 55 ---------------------------------- 1 file changed, 55 deletions(-) (limited to 'third_party/aom/av1/common/entropymv.c') diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c index 446aa433c..491337387 100644 --- a/third_party/aom/av1/common/entropymv.c +++ b/third_party/aom/av1/common/entropymv.c @@ -60,61 +60,6 @@ static const nmv_context default_nmv_context = { } }, }; -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 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10 -}; - -static INLINE int mv_class_base(MV_CLASS_TYPE c) { - return c ? CLASS0_SIZE << (c + 2) : 0; -} - -MV_CLASS_TYPE av1_get_mv_class(int z, int *offset) { - const MV_CLASS_TYPE c = (z >= CLASS0_SIZE * 4096) - ? MV_CLASS_10 - : (MV_CLASS_TYPE)log_in_base_2[z >> 3]; - if (offset) *offset = z - mv_class_base(c); - return c; -} - void av1_init_mv_probs(AV1_COMMON *cm) { // NB: this sets CDFs too cm->fc->nmvc = default_nmv_context; -- cgit v1.2.3