Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: source/libvpx/vp9/common/vp9_entropymv.c

Issue 232133009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/common/vp9_entropymv.h ('k') | source/libvpx/vp9/common/vp9_enums.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11
12 #include "vp9/common/vp9_onyxc_int.h" 11 #include "vp9/common/vp9_onyxc_int.h"
13 #include "vp9/common/vp9_entropymv.h" 12 #include "vp9/common/vp9_entropymv.h"
14 13
15 #define MV_COUNT_SAT 20 14 #define MV_COUNT_SAT 20
16 #define MV_MAX_UPDATE_FACTOR 128 15 #define MV_MAX_UPDATE_FACTOR 128
17 16
18 /* Integer pel reference mv threshold for use of high-precision 1/8 mv */ 17 // Integer pel reference mv threshold for use of high-precision 1/8 mv
19 #define COMPANDED_MVREF_THRESH 8 18 #define COMPANDED_MVREF_THRESH 8
20 19
21 const vp9_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = { 20 const vp9_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = {
22 -MV_JOINT_ZERO, 2, 21 -MV_JOINT_ZERO, 2,
23 -MV_JOINT_HNZVZ, 4, 22 -MV_JOINT_HNZVZ, 4,
24 -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ 23 -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
25 }; 24 };
26 25
27 const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = { 26 const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
28 -MV_CLASS_0, 2, 27 -MV_CLASS_0, 2,
(...skipping 13 matching lines...) Expand all
42 }; 41 };
43 42
44 const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { 43 const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = {
45 -0, 2, 44 -0, 2,
46 -1, 4, 45 -1, 4,
47 -2, -3 46 -2, -3
48 }; 47 };
49 48
50 static const nmv_context default_nmv_context = { 49 static const nmv_context default_nmv_context = {
51 {32, 64, 96}, 50 {32, 64, 96},
52 { // NOLINT 51 {
53 { /* vert component */ // NOLINT 52 { // Vertical component
54 128, /* sign */ 53 128, // sign
55 {224, 144, 192, 168, 192, 176, 192, 198, 198, 245}, /* class */ 54 {224, 144, 192, 168, 192, 176, 192, 198, 198, 245}, // class
56 {216}, /* class0 */ 55 {216}, // class0
57 {136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, /* bits */ 56 {136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, // bits
58 {{128, 128, 64}, {96, 112, 64}}, /* class0_fp */ 57 {{128, 128, 64}, {96, 112, 64}}, // class0_fp
59 {64, 96, 64}, /* fp */ 58 {64, 96, 64}, // fp
60 160, /* class0_hp bit */ 59 160, // class0_hp bit
61 128, /* hp */ 60 128, // hp
62 }, 61 },
63 { /* hor component */ // NOLINT 62 { // Horizontal component
64 128, /* sign */ 63 128, // sign
65 {216, 128, 176, 160, 176, 176, 192, 198, 198, 208}, /* class */ 64 {216, 128, 176, 160, 176, 176, 192, 198, 198, 208}, // class
66 {208}, /* class0 */ 65 {208}, // class0
67 {136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, /* bits */ 66 {136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, // bits
68 {{128, 128, 64}, {96, 112, 64}}, /* class0_fp */ 67 {{128, 128, 64}, {96, 112, 64}}, // class0_fp
69 {64, 96, 64}, /* fp */ 68 {64, 96, 64}, // fp
70 160, /* class0_hp bit */ 69 160, // class0_hp bit
71 128, /* hp */ 70 128, // hp
72 } 71 }
73 }, 72 },
74 }; 73 };
75 74
76 #define mv_class_base(c) ((c) ? (CLASS0_SIZE << (c + 2)) : 0)
77
78 static const uint8_t log_in_base_2[] = { 75 static const uint8_t log_in_base_2[] = {
79 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 76 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
80 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
81 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 78 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
82 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 79 6, 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MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) { 125 MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
125 MV_CLASS_TYPE c = MV_CLASS_0; 126 const MV_CLASS_TYPE c = (z >= CLASS0_SIZE * 4096) ?
126 if (z >= CLASS0_SIZE * 4096) 127 MV_CLASS_10 : (MV_CLASS_TYPE)log_in_base_2[z >> 3];
127 c = MV_CLASS_10;
128 else
129 c = log_in_base_2[z >> 3];
130
131 if (offset) 128 if (offset)
132 *offset = z - mv_class_base(c); 129 *offset = z - mv_class_base(c);
133 return c; 130 return c;
134 } 131 }
135 132
136 int vp9_use_mv_hp(const MV *ref) { 133 int vp9_use_mv_hp(const MV *ref) {
137 return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH && 134 return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH &&
138 (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH; 135 (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH;
139 } 136 }
140 137
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 if (allow_hp) { 224 if (allow_hp) {
228 comp->class0_hp = adapt_prob(pre_comp->class0_hp, c->class0_hp); 225 comp->class0_hp = adapt_prob(pre_comp->class0_hp, c->class0_hp);
229 comp->hp = adapt_prob(pre_comp->hp, c->hp); 226 comp->hp = adapt_prob(pre_comp->hp, c->hp);
230 } 227 }
231 } 228 }
232 } 229 }
233 230
234 void vp9_init_mv_probs(VP9_COMMON *cm) { 231 void vp9_init_mv_probs(VP9_COMMON *cm) {
235 cm->fc.nmvc = default_nmv_context; 232 cm->fc.nmvc = default_nmv_context;
236 } 233 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_entropymv.h ('k') | source/libvpx/vp9/common/vp9_enums.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698