blob: 866bdb99bfcb6b44418fad917e4a020876442919 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07004 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
12#include "av1/common/onyxc_int.h"
13#include "av1/common/entropymv.h"
14
15// Integer pel reference mv threshold for use of high-precision 1/8 mv
16#define COMPANDED_MVREF_THRESH 8
17
Yaowu Xuf883b422016-08-30 14:01:10 -070018const aom_tree_index av1_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = {
Yaowu Xuc27fc142016-08-22 16:08:15 -070019 -MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
20};
21
22/* clang-format off */
Yaowu Xuf883b422016-08-30 14:01:10 -070023const aom_tree_index av1_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
Yaowu Xuc27fc142016-08-22 16:08:15 -070024 -MV_CLASS_0, 2,
25 -MV_CLASS_1, 4,
26 6, 8,
27 -MV_CLASS_2, -MV_CLASS_3,
28 10, 12,
29 -MV_CLASS_4, -MV_CLASS_5,
30 -MV_CLASS_6, 14,
31 16, 18,
32 -MV_CLASS_7, -MV_CLASS_8,
33 -MV_CLASS_9, -MV_CLASS_10,
34};
35/* clang-format on */
36
Yaowu Xuf883b422016-08-30 14:01:10 -070037const aom_tree_index av1_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = {
Yaowu Xuc27fc142016-08-22 16:08:15 -070038 -0, -1,
39};
40
Yaowu Xuf883b422016-08-30 14:01:10 -070041const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
42 4, -2, -3 };
Yaowu Xuc27fc142016-08-22 16:08:15 -070043
44static const nmv_context default_nmv_context = {
Nathan E. Egge5f7fd7a2016-09-08 11:22:03 -040045 { 32, 64, 96 }, // joints
Alex Converseaca9feb2016-10-10 11:08:10 -070046#if CONFIG_EC_MULTISYMBOL
Nathan E. Egge5f7fd7a2016-09-08 11:22:03 -040047 { 0, 0, 0, 0 }, // joint_cdf is computed from joints in av1_init_mv_probs()
48#endif
Yaowu Xuc27fc142016-08-22 16:08:15 -070049 { {
50 // Vertical component
51 128, // sign
52 { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class
Alex Converseaca9feb2016-10-10 11:08:10 -070053#if CONFIG_EC_MULTISYMBOL
Nathan E. Egged7b893c2016-09-08 15:08:48 -040054 { 0 }, // class_cdf is computed from class in av1_init_mv_probs()
55#endif
Yaowu Xuc27fc142016-08-22 16:08:15 -070056 { 216 }, // class0
57 { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
58 { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
59 { 64, 96, 64 }, // fp
Alex Converseaca9feb2016-10-10 11:08:10 -070060#if CONFIG_EC_MULTISYMBOL
Nathan E. Egge5f34b612016-09-08 15:59:53 -040061 { { 0 }, { 0 } }, // class0_fp_cdf is computed in av1_init_mv_probs()
62 { 0 }, // fp_cdf is computed from fp in av1_init_mv_probs()
63#endif
Angie Chianga1a753c2016-10-21 17:13:59 -070064 160, // class0_hp bit
65 128, // hp
Yaowu Xuc27fc142016-08-22 16:08:15 -070066 },
67 {
68 // Horizontal component
69 128, // sign
70 { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class
Alex Converseaca9feb2016-10-10 11:08:10 -070071#if CONFIG_EC_MULTISYMBOL
Nathan E. Egged7b893c2016-09-08 15:08:48 -040072 { 0 }, // class_cdf is computed from class in av1_init_mv_probs()
73#endif
Yaowu Xuc27fc142016-08-22 16:08:15 -070074 { 208 }, // class0
75 { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
76 { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
77 { 64, 96, 64 }, // fp
Alex Converseaca9feb2016-10-10 11:08:10 -070078#if CONFIG_EC_MULTISYMBOL
Nathan E. Egge5f34b612016-09-08 15:59:53 -040079 { { 0 }, { 0 } }, // class0_fp_cdf is computed in av1_init_mv_probs()
80 { 0 }, // fp_cdf is computed from fp in av1_init_mv_probs()
81#endif
Angie Chianga1a753c2016-10-21 17:13:59 -070082 160, // class0_hp bit
83 128, // hp
Yaowu Xuc27fc142016-08-22 16:08:15 -070084 } },
85};
86
87static const uint8_t log_in_base_2[] = {
88 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,
89 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,
90 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,
91 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,
92 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,
93 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,
94 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,
121 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,
122 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,
123 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,
124 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,
125 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,
126 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,
127 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10
128};
129
130#if CONFIG_GLOBAL_MOTION
Debargha Mukherjee3fb33f02016-11-12 10:43:50 -0800131#if GLOBAL_TRANS_TYPES == 5
132const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(
Debargha Mukherjee949097c2016-11-15 17:27:38 -0800133 GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4,
134 -ROTZOOM, 6, -AFFINE, -HOMOGRAPHY };
Debargha Mukherjee3fb33f02016-11-12 10:43:50 -0800135
136static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] =
137 { 224, 128, 192, 192 };
138
139#elif GLOBAL_TRANS_TYPES == 4
David Barkercf3d0b02016-11-10 10:14:49 +0000140const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(
141 GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4, -ROTZOOM, -AFFINE };
Yaowu Xuc27fc142016-08-22 16:08:15 -0700142
David Barkercf3d0b02016-11-10 10:14:49 +0000143static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] =
144 { 224, 128, 240 };
145
146#elif GLOBAL_TRANS_TYPES == 3
147
148const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(
149 GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, -ROTZOOM };
150
151static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] =
152 { 224, 128 };
153#endif // GLOBAL_TRANS_TYPES
Yaowu Xuc27fc142016-08-22 16:08:15 -0700154#endif // CONFIG_GLOBAL_MOTION
155
156static INLINE int mv_class_base(MV_CLASS_TYPE c) {
157 return c ? CLASS0_SIZE << (c + 2) : 0;
158}
159
Yaowu Xuf883b422016-08-30 14:01:10 -0700160MV_CLASS_TYPE av1_get_mv_class(int z, int *offset) {
Yaowu Xuc27fc142016-08-22 16:08:15 -0700161 const MV_CLASS_TYPE c = (z >= CLASS0_SIZE * 4096)
162 ? MV_CLASS_10
163 : (MV_CLASS_TYPE)log_in_base_2[z >> 3];
164 if (offset) *offset = z - mv_class_base(c);
165 return c;
166}
167
Yaowu Xuc27fc142016-08-22 16:08:15 -0700168static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr,
169 int usehp) {
170 int s, z, c, o, d, e, f;
171 assert(v != 0); /* should not be zero */
172 s = v < 0;
173 comp_counts->sign[s] += incr;
174 z = (s ? -v : v) - 1; /* magnitude - 1 */
175
Yaowu Xuf883b422016-08-30 14:01:10 -0700176 c = av1_get_mv_class(z, &o);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700177 comp_counts->classes[c] += incr;
178
179 d = (o >> 3); /* int mv data */
180 f = (o >> 1) & 3; /* fractional pel mv data */
181 e = (o & 1); /* high precision mv data */
182
183 if (c == MV_CLASS_0) {
184 comp_counts->class0[d] += incr;
185 comp_counts->class0_fp[d][f] += incr;
186 if (usehp) comp_counts->class0_hp[e] += incr;
187 } else {
188 int i;
189 int b = c + CLASS0_BITS - 1; // number of bits
190 for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr;
191 comp_counts->fp[f] += incr;
192 if (usehp) comp_counts->hp[e] += incr;
193 }
194}
195
Yaowu Xuf883b422016-08-30 14:01:10 -0700196void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
Yaowu Xuc27fc142016-08-22 16:08:15 -0700197 if (counts != NULL) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700198 const MV_JOINT_TYPE j = av1_get_mv_joint(mv);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700199 ++counts->joints[j];
200
201 if (mv_joint_vertical(j))
202 inc_mv_component(mv->row, &counts->comps[0], 1, usehp);
203
204 if (mv_joint_horizontal(j))
205 inc_mv_component(mv->col, &counts->comps[1], 1, usehp);
206 }
207}
208
Yaowu Xuf883b422016-08-30 14:01:10 -0700209void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
Yaowu Xuc27fc142016-08-22 16:08:15 -0700210 int i, j;
211#if CONFIG_REF_MV
212 int idx;
213 for (idx = 0; idx < NMV_CONTEXTS; ++idx) {
214 nmv_context *fc = &cm->fc->nmvc[idx];
215 const nmv_context *pre_fc =
216 &cm->frame_contexts[cm->frame_context_idx].nmvc[idx];
217 const nmv_context_counts *counts = &cm->counts.mv[idx];
218
Yaowu Xuf883b422016-08-30 14:01:10 -0700219 aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700220 fc->joints);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700221 for (i = 0; i < 2; ++i) {
222 nmv_component *comp = &fc->comps[i];
223 const nmv_component *pre_comp = &pre_fc->comps[i];
224 const nmv_component_counts *c = &counts->comps[i];
225
Yaowu Xuf883b422016-08-30 14:01:10 -0700226 comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign);
227 aom_tree_merge_probs(av1_mv_class_tree, pre_comp->classes, c->classes,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700228 comp->classes);
Yaowu Xuf883b422016-08-30 14:01:10 -0700229 aom_tree_merge_probs(av1_mv_class0_tree, pre_comp->class0, c->class0,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700230 comp->class0);
231
232 for (j = 0; j < MV_OFFSET_BITS; ++j)
Yaowu Xuf883b422016-08-30 14:01:10 -0700233 comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700234
235 for (j = 0; j < CLASS0_SIZE; ++j)
Yaowu Xuf883b422016-08-30 14:01:10 -0700236 aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j],
Yaowu Xuc27fc142016-08-22 16:08:15 -0700237 c->class0_fp[j], comp->class0_fp[j]);
238
Yaowu Xuf883b422016-08-30 14:01:10 -0700239 aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700240
241 if (allow_hp) {
242 comp->class0_hp =
Yaowu Xuf883b422016-08-30 14:01:10 -0700243 av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp);
244 comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700245 }
246 }
247 }
248#else
249 nmv_context *fc = &cm->fc->nmvc;
250 const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc;
251 const nmv_context_counts *counts = &cm->counts.mv;
252
Yaowu Xuf883b422016-08-30 14:01:10 -0700253 aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700254 fc->joints);
255
256 for (i = 0; i < 2; ++i) {
257 nmv_component *comp = &fc->comps[i];
258 const nmv_component *pre_comp = &pre_fc->comps[i];
259 const nmv_component_counts *c = &counts->comps[i];
260
Yaowu Xuf883b422016-08-30 14:01:10 -0700261 comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign);
262 aom_tree_merge_probs(av1_mv_class_tree, pre_comp->classes, c->classes,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700263 comp->classes);
Yaowu Xuf883b422016-08-30 14:01:10 -0700264 aom_tree_merge_probs(av1_mv_class0_tree, pre_comp->class0, c->class0,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700265 comp->class0);
266
267 for (j = 0; j < MV_OFFSET_BITS; ++j)
Yaowu Xuf883b422016-08-30 14:01:10 -0700268 comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700269
270 for (j = 0; j < CLASS0_SIZE; ++j)
Yaowu Xuf883b422016-08-30 14:01:10 -0700271 aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j],
Yaowu Xuc27fc142016-08-22 16:08:15 -0700272 c->class0_fp[j], comp->class0_fp[j]);
273
Yaowu Xuf883b422016-08-30 14:01:10 -0700274 aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700275
276 if (allow_hp) {
277 comp->class0_hp =
Yaowu Xuf883b422016-08-30 14:01:10 -0700278 av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp);
279 comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700280 }
281 }
282#endif
283}
284
Thomas Davies6519beb2016-10-19 14:46:07 +0100285#if CONFIG_EC_MULTISYMBOL
286void av1_set_mv_cdfs(nmv_context *ctx) {
287 int i;
288 int j;
289 av1_tree_to_cdf(av1_mv_joint_tree, ctx->joints, ctx->joint_cdf);
290
291 for (i = 0; i < 2; ++i) {
292 nmv_component *const comp_ctx = &ctx->comps[i];
293 av1_tree_to_cdf(av1_mv_class_tree, comp_ctx->classes, comp_ctx->class_cdf);
294
295 for (j = 0; j < CLASS0_SIZE; ++j) {
296 av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->class0_fp[j],
297 comp_ctx->class0_fp_cdf[j]);
298 }
299 av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->fp, comp_ctx->fp_cdf);
300 }
301}
302#endif
303
Yaowu Xuf883b422016-08-30 14:01:10 -0700304void av1_init_mv_probs(AV1_COMMON *cm) {
Yaowu Xuc27fc142016-08-22 16:08:15 -0700305#if CONFIG_REF_MV
306 int i;
307 for (i = 0; i < NMV_CONTEXTS; ++i) cm->fc->nmvc[i] = default_nmv_context;
308#else
309 cm->fc->nmvc = default_nmv_context;
Alex Converseaca9feb2016-10-10 11:08:10 -0700310#if CONFIG_EC_MULTISYMBOL
Thomas Davies6519beb2016-10-19 14:46:07 +0100311 av1_set_mv_cdfs(&cm->fc->nmvc);
Nathan E. Egge5f7fd7a2016-09-08 11:22:03 -0400312#endif
Yaowu Xuc27fc142016-08-22 16:08:15 -0700313#endif
314#if CONFIG_GLOBAL_MOTION
Yaowu Xuf883b422016-08-30 14:01:10 -0700315 av1_copy(cm->fc->global_motion_types_prob, default_global_motion_types_prob);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700316#endif // CONFIG_GLOBAL_MOTION
317}