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

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

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years 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_scan.h ('k') | source/libvpx/vp9/common/vp9_tile_common.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 #include <assert.h> 11 #include <assert.h>
12 12
13 #include "vp9/common/vp9_scan.h" 13 #include "vp9/common/vp9_scan.h"
14 14
15 DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_4x4[16]) = { 15 DECLARE_ALIGNED(16, static const int16_t, default_scan_4x4[16]) = {
16 0, 4, 1, 5, 16 0, 4, 1, 5,
17 8, 2, 12, 9, 17 8, 2, 12, 9,
18 3, 6, 13, 10, 18 3, 6, 13, 10,
19 7, 14, 11, 15, 19 7, 14, 11, 15,
20 }; 20 };
21 21
22 DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_4x4[16]) = { 22 DECLARE_ALIGNED(16, static const int16_t, col_scan_4x4[16]) = {
23 0, 4, 8, 1, 23 0, 4, 8, 1,
24 12, 5, 9, 2, 24 12, 5, 9, 2,
25 13, 6, 10, 3, 25 13, 6, 10, 3,
26 7, 14, 11, 15, 26 7, 14, 11, 15,
27 }; 27 };
28 28
29 DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_4x4[16]) = { 29 DECLARE_ALIGNED(16, static const int16_t, row_scan_4x4[16]) = {
30 0, 1, 4, 2, 30 0, 1, 4, 2,
31 5, 3, 6, 8, 31 5, 3, 6, 8,
32 9, 7, 12, 10, 32 9, 7, 12, 10,
33 13, 11, 14, 15, 33 13, 11, 14, 15,
34 }; 34 };
35 35
36 DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_8x8[64]) = { 36 DECLARE_ALIGNED(16, static const int16_t, default_scan_8x8[64]) = {
37 0, 8, 1, 16, 9, 2, 17, 24, 37 0, 8, 1, 16, 9, 2, 17, 24,
38 10, 3, 18, 25, 32, 11, 4, 26, 38 10, 3, 18, 25, 32, 11, 4, 26,
39 33, 19, 40, 12, 34, 27, 5, 41, 39 33, 19, 40, 12, 34, 27, 5, 41,
40 20, 48, 13, 35, 42, 28, 21, 6, 40 20, 48, 13, 35, 42, 28, 21, 6,
41 49, 56, 36, 43, 29, 7, 14, 50, 41 49, 56, 36, 43, 29, 7, 14, 50,
42 57, 44, 22, 37, 15, 51, 58, 30, 42 57, 44, 22, 37, 15, 51, 58, 30,
43 45, 23, 52, 59, 38, 31, 60, 53, 43 45, 23, 52, 59, 38, 31, 60, 53,
44 46, 39, 61, 54, 47, 62, 55, 63, 44 46, 39, 61, 54, 47, 62, 55, 63,
45 }; 45 };
46 46
47 DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_8x8[64]) = { 47 DECLARE_ALIGNED(16, static const int16_t, col_scan_8x8[64]) = {
48 0, 8, 16, 1, 24, 9, 32, 17, 48 0, 8, 16, 1, 24, 9, 32, 17,
49 2, 40, 25, 10, 33, 18, 48, 3, 49 2, 40, 25, 10, 33, 18, 48, 3,
50 26, 41, 11, 56, 19, 34, 4, 49, 50 26, 41, 11, 56, 19, 34, 4, 49,
51 27, 42, 12, 35, 20, 57, 50, 28, 51 27, 42, 12, 35, 20, 57, 50, 28,
52 5, 43, 13, 36, 58, 51, 21, 44, 52 5, 43, 13, 36, 58, 51, 21, 44,
53 6, 29, 59, 37, 14, 52, 22, 7, 53 6, 29, 59, 37, 14, 52, 22, 7,
54 45, 60, 30, 15, 38, 53, 23, 46, 54 45, 60, 30, 15, 38, 53, 23, 46,
55 31, 61, 39, 54, 47, 62, 55, 63, 55 31, 61, 39, 54, 47, 62, 55, 63,
56 }; 56 };
57 57
58 DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_8x8[64]) = { 58 DECLARE_ALIGNED(16, static const int16_t, row_scan_8x8[64]) = {
59 0, 1, 2, 8, 9, 3, 16, 10, 59 0, 1, 2, 8, 9, 3, 16, 10,
60 4, 17, 11, 24, 5, 18, 25, 12, 60 4, 17, 11, 24, 5, 18, 25, 12,
61 19, 26, 32, 6, 13, 20, 33, 27, 61 19, 26, 32, 6, 13, 20, 33, 27,
62 7, 34, 40, 21, 28, 41, 14, 35, 62 7, 34, 40, 21, 28, 41, 14, 35,
63 48, 42, 29, 36, 49, 22, 43, 15, 63 48, 42, 29, 36, 49, 22, 43, 15,
64 56, 37, 50, 44, 30, 57, 23, 51, 64 56, 37, 50, 44, 30, 57, 23, 51,
65 58, 45, 38, 52, 31, 59, 53, 46, 65 58, 45, 38, 52, 31, 59, 53, 46,
66 60, 39, 61, 47, 54, 55, 62, 63, 66 60, 39, 61, 47, 54, 55, 62, 63,
67 }; 67 };
68 68
69 DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_16x16[256]) = { 69 DECLARE_ALIGNED(16, static const int16_t, default_scan_16x16[256]) = {
70 0, 16, 1, 32, 17, 2, 48, 33, 18, 3, 64, 34, 49, 19, 65, 80, 70 0, 16, 1, 32, 17, 2, 48, 33, 18, 3, 64, 34, 49, 19, 65, 80,
71 50, 4, 35, 66, 20, 81, 96, 51, 5, 36, 82, 97, 67, 112, 21, 52, 71 50, 4, 35, 66, 20, 81, 96, 51, 5, 36, 82, 97, 67, 112, 21, 52,
72 98, 37, 83, 113, 6, 68, 128, 53, 22, 99, 114, 84, 7, 129, 38, 69, 72 98, 37, 83, 113, 6, 68, 128, 53, 22, 99, 114, 84, 7, 129, 38, 69,
73 100, 115, 144, 130, 85, 54, 23, 8, 145, 39, 70, 116, 101, 131, 160, 146, 73 100, 115, 144, 130, 85, 54, 23, 8, 145, 39, 70, 116, 101, 131, 160, 146,
74 55, 86, 24, 71, 132, 117, 161, 40, 9, 102, 147, 176, 162, 87, 56, 25, 74 55, 86, 24, 71, 132, 117, 161, 40, 9, 102, 147, 176, 162, 87, 56, 25,
75 133, 118, 177, 148, 72, 103, 41, 163, 10, 192, 178, 88, 57, 134, 149, 119, 75 133, 118, 177, 148, 72, 103, 41, 163, 10, 192, 178, 88, 57, 134, 149, 119,
76 26, 164, 73, 104, 193, 42, 179, 208, 11, 135, 89, 165, 120, 150, 58, 194, 76 26, 164, 73, 104, 193, 42, 179, 208, 11, 135, 89, 165, 120, 150, 58, 194,
77 180, 27, 74, 209, 105, 151, 136, 43, 90, 224, 166, 195, 181, 121, 210, 59, 77 180, 27, 74, 209, 105, 151, 136, 43, 90, 224, 166, 195, 181, 121, 210, 59,
78 12, 152, 106, 167, 196, 75, 137, 225, 211, 240, 182, 122, 91, 28, 197, 13, 78 12, 152, 106, 167, 196, 75, 137, 225, 211, 240, 182, 122, 91, 28, 197, 13,
79 226, 168, 183, 153, 44, 212, 138, 107, 241, 60, 29, 123, 198, 184, 227, 169, 79 226, 168, 183, 153, 44, 212, 138, 107, 241, 60, 29, 123, 198, 184, 227, 169,
80 242, 76, 213, 154, 45, 92, 14, 199, 139, 61, 228, 214, 170, 185, 243, 108, 80 242, 76, 213, 154, 45, 92, 14, 199, 139, 61, 228, 214, 170, 185, 243, 108,
81 77, 155, 30, 15, 200, 229, 124, 215, 244, 93, 46, 186, 171, 201, 109, 140, 81 77, 155, 30, 15, 200, 229, 124, 215, 244, 93, 46, 186, 171, 201, 109, 140,
82 230, 62, 216, 245, 31, 125, 78, 156, 231, 47, 187, 202, 217, 94, 246, 141, 82 230, 62, 216, 245, 31, 125, 78, 156, 231, 47, 187, 202, 217, 94, 246, 141,
83 63, 232, 172, 110, 247, 157, 79, 218, 203, 126, 233, 188, 248, 95, 173, 142, 83 63, 232, 172, 110, 247, 157, 79, 218, 203, 126, 233, 188, 248, 95, 173, 142,
84 219, 111, 249, 234, 158, 127, 189, 204, 250, 235, 143, 174, 220, 205, 159, 84 219, 111, 249, 234, 158, 127, 189, 204, 250, 235, 143, 174, 220, 205, 159,
85 251, 85 251,
86 190, 221, 175, 236, 237, 191, 206, 252, 222, 253, 207, 238, 223, 254, 239, 86 190, 221, 175, 236, 237, 191, 206, 252, 222, 253, 207, 238, 223, 254, 239,
87 255, 87 255,
88 }; 88 };
89 89
90 DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_16x16[256]) = { 90 DECLARE_ALIGNED(16, static const int16_t, col_scan_16x16[256]) = {
91 0, 16, 32, 48, 1, 64, 17, 80, 33, 96, 49, 2, 65, 112, 18, 81, 91 0, 16, 32, 48, 1, 64, 17, 80, 33, 96, 49, 2, 65, 112, 18, 81,
92 34, 128, 50, 97, 3, 66, 144, 19, 113, 35, 82, 160, 98, 51, 129, 4, 92 34, 128, 50, 97, 3, 66, 144, 19, 113, 35, 82, 160, 98, 51, 129, 4,
93 67, 176, 20, 114, 145, 83, 36, 99, 130, 52, 192, 5, 161, 68, 115, 21, 93 67, 176, 20, 114, 145, 83, 36, 99, 130, 52, 192, 5, 161, 68, 115, 21,
94 146, 84, 208, 177, 37, 131, 100, 53, 162, 224, 69, 6, 116, 193, 147, 85, 94 146, 84, 208, 177, 37, 131, 100, 53, 162, 224, 69, 6, 116, 193, 147, 85,
95 22, 240, 132, 38, 178, 101, 163, 54, 209, 117, 70, 7, 148, 194, 86, 179, 95 22, 240, 132, 38, 178, 101, 163, 54, 209, 117, 70, 7, 148, 194, 86, 179,
96 225, 23, 133, 39, 164, 8, 102, 210, 241, 55, 195, 118, 149, 71, 180, 24, 96 225, 23, 133, 39, 164, 8, 102, 210, 241, 55, 195, 118, 149, 71, 180, 24,
97 87, 226, 134, 165, 211, 40, 103, 56, 72, 150, 196, 242, 119, 9, 181, 227, 97 87, 226, 134, 165, 211, 40, 103, 56, 72, 150, 196, 242, 119, 9, 181, 227,
98 88, 166, 25, 135, 41, 104, 212, 57, 151, 197, 120, 73, 243, 182, 136, 167, 98 88, 166, 25, 135, 41, 104, 212, 57, 151, 197, 120, 73, 243, 182, 136, 167,
99 213, 89, 10, 228, 105, 152, 198, 26, 42, 121, 183, 244, 168, 58, 137, 229, 99 213, 89, 10, 228, 105, 152, 198, 26, 42, 121, 183, 244, 168, 58, 137, 229,
100 74, 214, 90, 153, 199, 184, 11, 106, 245, 27, 122, 230, 169, 43, 215, 59, 100 74, 214, 90, 153, 199, 184, 11, 106, 245, 27, 122, 230, 169, 43, 215, 59,
101 200, 138, 185, 246, 75, 12, 91, 154, 216, 231, 107, 28, 44, 201, 123, 170, 101 200, 138, 185, 246, 75, 12, 91, 154, 216, 231, 107, 28, 44, 201, 123, 170,
102 60, 247, 232, 76, 139, 13, 92, 217, 186, 248, 155, 108, 29, 124, 45, 202, 102 60, 247, 232, 76, 139, 13, 92, 217, 186, 248, 155, 108, 29, 124, 45, 202,
103 233, 171, 61, 14, 77, 140, 15, 249, 93, 30, 187, 156, 218, 46, 109, 125, 103 233, 171, 61, 14, 77, 140, 15, 249, 93, 30, 187, 156, 218, 46, 109, 125,
104 62, 172, 78, 203, 31, 141, 234, 94, 47, 188, 63, 157, 110, 250, 219, 79, 104 62, 172, 78, 203, 31, 141, 234, 94, 47, 188, 63, 157, 110, 250, 219, 79,
105 126, 204, 173, 142, 95, 189, 111, 235, 158, 220, 251, 127, 174, 143, 205, 105 126, 204, 173, 142, 95, 189, 111, 235, 158, 220, 251, 127, 174, 143, 205,
106 236, 106 236,
107 159, 190, 221, 252, 175, 206, 237, 191, 253, 222, 238, 207, 254, 223, 239, 107 159, 190, 221, 252, 175, 206, 237, 191, 253, 222, 238, 207, 254, 223, 239,
108 255, 108 255,
109 }; 109 };
110 110
111 DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_16x16[256]) = { 111 DECLARE_ALIGNED(16, static const int16_t, row_scan_16x16[256]) = {
112 0, 1, 2, 16, 3, 17, 4, 18, 32, 5, 33, 19, 6, 34, 48, 20, 112 0, 1, 2, 16, 3, 17, 4, 18, 32, 5, 33, 19, 6, 34, 48, 20,
113 49, 7, 35, 21, 50, 64, 8, 36, 65, 22, 51, 37, 80, 9, 66, 52, 113 49, 7, 35, 21, 50, 64, 8, 36, 65, 22, 51, 37, 80, 9, 66, 52,
114 23, 38, 81, 67, 10, 53, 24, 82, 68, 96, 39, 11, 54, 83, 97, 69, 114 23, 38, 81, 67, 10, 53, 24, 82, 68, 96, 39, 11, 54, 83, 97, 69,
115 25, 98, 84, 40, 112, 55, 12, 70, 99, 113, 85, 26, 41, 56, 114, 100, 115 25, 98, 84, 40, 112, 55, 12, 70, 99, 113, 85, 26, 41, 56, 114, 100,
116 13, 71, 128, 86, 27, 115, 101, 129, 42, 57, 72, 116, 14, 87, 130, 102, 116 13, 71, 128, 86, 27, 115, 101, 129, 42, 57, 72, 116, 14, 87, 130, 102,
117 144, 73, 131, 117, 28, 58, 15, 88, 43, 145, 103, 132, 146, 118, 74, 160, 117 144, 73, 131, 117, 28, 58, 15, 88, 43, 145, 103, 132, 146, 118, 74, 160,
118 89, 133, 104, 29, 59, 147, 119, 44, 161, 148, 90, 105, 134, 162, 120, 176, 118 89, 133, 104, 29, 59, 147, 119, 44, 161, 148, 90, 105, 134, 162, 120, 176,
119 75, 135, 149, 30, 60, 163, 177, 45, 121, 91, 106, 164, 178, 150, 192, 136, 119 75, 135, 149, 30, 60, 163, 177, 45, 121, 91, 106, 164, 178, 150, 192, 136,
120 165, 179, 31, 151, 193, 76, 122, 61, 137, 194, 107, 152, 180, 208, 46, 166, 120 165, 179, 31, 151, 193, 76, 122, 61, 137, 194, 107, 152, 180, 208, 46, 166,
121 167, 195, 92, 181, 138, 209, 123, 153, 224, 196, 77, 168, 210, 182, 240, 108, 121 167, 195, 92, 181, 138, 209, 123, 153, 224, 196, 77, 168, 210, 182, 240, 108,
122 197, 62, 154, 225, 183, 169, 211, 47, 139, 93, 184, 226, 212, 241, 198, 170, 122 197, 62, 154, 225, 183, 169, 211, 47, 139, 93, 184, 226, 212, 241, 198, 170,
123 124, 155, 199, 78, 213, 185, 109, 227, 200, 63, 228, 242, 140, 214, 171, 186, 123 124, 155, 199, 78, 213, 185, 109, 227, 200, 63, 228, 242, 140, 214, 171, 186,
124 156, 229, 243, 125, 94, 201, 244, 215, 216, 230, 141, 187, 202, 79, 172, 110, 124 156, 229, 243, 125, 94, 201, 244, 215, 216, 230, 141, 187, 202, 79, 172, 110,
125 157, 245, 217, 231, 95, 246, 232, 126, 203, 247, 233, 173, 218, 142, 111, 125 157, 245, 217, 231, 95, 246, 232, 126, 203, 247, 233, 173, 218, 142, 111,
126 158, 126 158,
127 188, 248, 127, 234, 219, 249, 189, 204, 143, 174, 159, 250, 235, 205, 220, 127 188, 248, 127, 234, 219, 249, 189, 204, 143, 174, 159, 250, 235, 205, 220,
128 175, 128 175,
129 190, 251, 221, 191, 206, 236, 207, 237, 252, 222, 253, 223, 238, 239, 254, 129 190, 251, 221, 191, 206, 236, 207, 237, 252, 222, 253, 223, 238, 239, 254,
130 255, 130 255,
131 }; 131 };
132 132
133 DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_32x32[1024]) = { 133 DECLARE_ALIGNED(16, static const int16_t, default_scan_32x32[1024]) = {
134 0, 32, 1, 64, 33, 2, 96, 65, 34, 128, 3, 97, 66, 160, 134 0, 32, 1, 64, 33, 2, 96, 65, 34, 128, 3, 97, 66, 160,
135 129, 35, 98, 4, 67, 130, 161, 192, 36, 99, 224, 5, 162, 193, 135 129, 35, 98, 4, 67, 130, 161, 192, 36, 99, 224, 5, 162, 193,
136 68, 131, 37, 100, 136 68, 131, 37, 100,
137 225, 194, 256, 163, 69, 132, 6, 226, 257, 288, 195, 101, 164, 38, 137 225, 194, 256, 163, 69, 132, 6, 226, 257, 288, 195, 101, 164, 38,
138 258, 7, 227, 289, 133, 320, 70, 196, 165, 290, 259, 228, 39, 321, 138 258, 7, 227, 289, 133, 320, 70, 196, 165, 290, 259, 228, 39, 321,
139 102, 352, 8, 197, 139 102, 352, 8, 197,
140 71, 134, 322, 291, 260, 353, 384, 229, 166, 103, 40, 354, 323, 292, 140 71, 134, 322, 291, 260, 353, 384, 229, 166, 103, 40, 354, 323, 292,
141 135, 385, 198, 261, 72, 9, 416, 167, 386, 355, 230, 324, 104, 293, 141 135, 385, 198, 261, 72, 9, 416, 167, 386, 355, 230, 324, 104, 293,
142 41, 417, 199, 136, 142 41, 417, 199, 136,
143 262, 387, 448, 325, 356, 10, 73, 418, 231, 168, 449, 294, 388, 105, 143 262, 387, 448, 325, 356, 10, 73, 418, 231, 168, 449, 294, 388, 105,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 1016, 985, 954, 923, 226 1016, 985, 954, 923,
227 892, 861, 830, 799, 1017, 986, 955, 893, 862, 831, 1018, 987, 894, 863, 227 892, 861, 830, 799, 1017, 986, 955, 893, 862, 831, 1018, 987, 894, 863,
228 1019, 895, 924, 956, 925, 988, 957, 926, 1020, 989, 958, 927, 1021, 228 1019, 895, 924, 956, 925, 988, 957, 926, 1020, 989, 958, 927, 1021,
229 990, 959, 1022, 991, 1023, 229 990, 959, 1022, 991, 1023,
230 }; 230 };
231 231
232 // Neighborhood 5-tuples for various scans and blocksizes, 232 // Neighborhood 5-tuples for various scans and blocksizes,
233 // in {top, left, topleft, topright, bottomleft} order 233 // in {top, left, topleft, topright, bottomleft} order
234 // for each position in raster scan order. 234 // for each position in raster scan order.
235 // -1 indicates the neighbor does not exist. 235 // -1 indicates the neighbor does not exist.
236 DECLARE_ALIGNED(16, int16_t, 236 DECLARE_ALIGNED(16, static int16_t,
237 vp9_default_scan_4x4_neighbors[17 * MAX_NEIGHBORS]); 237 default_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
238 DECLARE_ALIGNED(16, int16_t, 238 DECLARE_ALIGNED(16, static int16_t,
239 vp9_col_scan_4x4_neighbors[17 * MAX_NEIGHBORS]); 239 col_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
240 DECLARE_ALIGNED(16, int16_t, 240 DECLARE_ALIGNED(16, static int16_t,
241 vp9_row_scan_4x4_neighbors[17 * MAX_NEIGHBORS]); 241 row_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
242 DECLARE_ALIGNED(16, int16_t, 242 DECLARE_ALIGNED(16, static int16_t,
243 vp9_col_scan_8x8_neighbors[65 * MAX_NEIGHBORS]); 243 col_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
244 DECLARE_ALIGNED(16, int16_t, 244 DECLARE_ALIGNED(16, static int16_t,
245 vp9_row_scan_8x8_neighbors[65 * MAX_NEIGHBORS]); 245 row_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
246 DECLARE_ALIGNED(16, int16_t, 246 DECLARE_ALIGNED(16, static int16_t,
247 vp9_default_scan_8x8_neighbors[65 * MAX_NEIGHBORS]); 247 default_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
248 DECLARE_ALIGNED(16, int16_t, 248 DECLARE_ALIGNED(16, static int16_t,
249 vp9_col_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); 249 col_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
250 DECLARE_ALIGNED(16, int16_t, 250 DECLARE_ALIGNED(16, static int16_t,
251 vp9_row_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); 251 row_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
252 DECLARE_ALIGNED(16, int16_t, 252 DECLARE_ALIGNED(16, static int16_t,
253 vp9_default_scan_16x16_neighbors[257 * MAX_NEIGHBORS]); 253 default_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
254 DECLARE_ALIGNED(16, int16_t, 254 DECLARE_ALIGNED(16, static int16_t,
255 vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]); 255 default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]);
256 256
257 DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_4x4[16]);
258 DECLARE_ALIGNED(16, static int16_t, vp9_col_iscan_4x4[16]);
259 DECLARE_ALIGNED(16, static int16_t, vp9_row_iscan_4x4[16]);
260 DECLARE_ALIGNED(16, static int16_t, vp9_col_iscan_8x8[64]);
261 DECLARE_ALIGNED(16, static int16_t, vp9_row_iscan_8x8[64]);
262 DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_8x8[64]);
263 DECLARE_ALIGNED(16, static int16_t, vp9_col_iscan_16x16[256]);
264 DECLARE_ALIGNED(16, static int16_t, vp9_row_iscan_16x16[256]);
265 DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_16x16[256]);
266 DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_32x32[1024]);
257 267
258 DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_4x4[16]); 268 const scan_order vp9_default_scan_orders[TX_SIZES] = {
259 DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_4x4[16]); 269 {default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
260 DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_4x4[16]); 270 {default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
261 DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_8x8[64]); 271 {default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
262 DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_8x8[64]); 272 {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
263 DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_8x8[64]); 273 };
264 DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_16x16[256]); 274
265 DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_16x16[256]); 275 const scan_order vp9_scan_orders[TX_SIZES][TX_TYPES] = {
266 DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_16x16[256]); 276 { // TX_4X4
267 DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_32x32[1024]); 277 {default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
278 {row_scan_4x4, vp9_row_iscan_4x4, row_scan_4x4_neighbors},
279 {col_scan_4x4, vp9_col_iscan_4x4, col_scan_4x4_neighbors},
280 {default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors}
281 }, { // TX_8X8
282 {default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
283 {row_scan_8x8, vp9_row_iscan_8x8, row_scan_8x8_neighbors},
284 {col_scan_8x8, vp9_col_iscan_8x8, col_scan_8x8_neighbors},
285 {default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors}
286 }, { // TX_16X16
287 {default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
288 {row_scan_16x16, vp9_row_iscan_16x16, row_scan_16x16_neighbors},
289 {col_scan_16x16, vp9_col_iscan_16x16, col_scan_16x16_neighbors},
290 {default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors}
291 }, { // TX_32X32
292 {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
293 {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
294 {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
295 {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
296 }
297 };
268 298
269 static int find_in_scan(const int16_t *scan, int l, int idx) { 299 static int find_in_scan(const int16_t *scan, int l, int idx) {
270 int n, l2 = l * l; 300 int n, l2 = l * l;
271 for (n = 0; n < l2; n++) { 301 for (n = 0; n < l2; n++) {
272 int rc = scan[n]; 302 int rc = scan[n];
273 if (rc == idx) 303 if (rc == idx)
274 return n; 304 return n;
275 } 305 }
276 assert(0); 306 assert(0);
277 return -1; 307 return -1;
278 } 308 }
279 static void init_scan_neighbors(const int16_t *scan, 309
280 int16_t *iscan, 310 static void init_scan_neighbors(const int16_t *scan, int16_t *iscan, int l,
281 int l, int16_t *neighbors) { 311 int16_t *neighbors) {
282 int l2 = l * l; 312 int l2 = l * l;
283 int n, i, j; 313 int n, i, j;
284 314
285 // dc doesn't use this type of prediction 315 // dc doesn't use this type of prediction
286 neighbors[MAX_NEIGHBORS * 0 + 0] = 0; 316 neighbors[MAX_NEIGHBORS * 0 + 0] = 0;
287 neighbors[MAX_NEIGHBORS * 0 + 1] = 0; 317 neighbors[MAX_NEIGHBORS * 0 + 1] = 0;
288 iscan[0] = find_in_scan(scan, l, 0); 318 iscan[0] = find_in_scan(scan, l, 0);
289 for (n = 1; n < l2; n++) { 319 for (n = 1; n < l2; n++) {
290 int rc = scan[n]; 320 int rc = scan[n];
291 iscan[n] = find_in_scan(scan, l, n); 321 iscan[n] = find_in_scan(scan, l, n);
292 i = rc / l; 322 i = rc / l;
293 j = rc % l; 323 j = rc % l;
294 if (i > 0 && j > 0) { 324 if (i > 0 && j > 0) {
295 // col/row scan is used for adst/dct, and generally means that 325 // col/row scan is used for adst/dct, and generally means that
296 // energy decreases to zero much faster in the dimension in 326 // energy decreases to zero much faster in the dimension in
297 // which ADST is used compared to the direction in which DCT 327 // which ADST is used compared to the direction in which DCT
298 // is used. Likewise, we find much higher correlation between 328 // is used. Likewise, we find much higher correlation between
299 // coefficients within the direction in which DCT is used. 329 // coefficients within the direction in which DCT is used.
300 // Therefore, if we use ADST/DCT, prefer the DCT neighbor coeff 330 // Therefore, if we use ADST/DCT, prefer the DCT neighbor coeff
301 // as a context. If ADST or DCT is used in both directions, we 331 // as a context. If ADST or DCT is used in both directions, we
302 // use the combination of the two as a context. 332 // use the combination of the two as a context.
303 int a = (i - 1) * l + j; 333 int a = (i - 1) * l + j;
304 int b = i * l + j - 1; 334 int b = i * l + j - 1;
305 if (scan == vp9_col_scan_4x4 || scan == vp9_col_scan_8x8 || 335 if (scan == col_scan_4x4 || scan == col_scan_8x8 ||
306 scan == vp9_col_scan_16x16) { 336 scan == col_scan_16x16) {
307 // in the col/row scan cases (as well as left/top edge cases), we set 337 // in the col/row scan cases (as well as left/top edge cases), we set
308 // both contexts to the same value, so we can branchlessly do a+b+1>>1 338 // both contexts to the same value, so we can branchlessly do a+b+1>>1
309 // which automatically becomes a if a == b 339 // which automatically becomes a if a == b
310 neighbors[MAX_NEIGHBORS * n + 0] = 340 neighbors[MAX_NEIGHBORS * n + 0] =
311 neighbors[MAX_NEIGHBORS * n + 1] = a; 341 neighbors[MAX_NEIGHBORS * n + 1] = a;
312 } else if (scan == vp9_row_scan_4x4 || scan == vp9_row_scan_8x8 || 342 } else if (scan == row_scan_4x4 || scan == row_scan_8x8 ||
313 scan == vp9_row_scan_16x16) { 343 scan == row_scan_16x16) {
314 neighbors[MAX_NEIGHBORS * n + 0] = 344 neighbors[MAX_NEIGHBORS * n + 0] =
315 neighbors[MAX_NEIGHBORS * n + 1] = b; 345 neighbors[MAX_NEIGHBORS * n + 1] = b;
316 } else { 346 } else {
317 neighbors[MAX_NEIGHBORS * n + 0] = a; 347 neighbors[MAX_NEIGHBORS * n + 0] = a;
318 neighbors[MAX_NEIGHBORS * n + 1] = b; 348 neighbors[MAX_NEIGHBORS * n + 1] = b;
319 } 349 }
320 } else if (i > 0) { 350 } else if (i > 0) {
321 neighbors[MAX_NEIGHBORS * n + 0] = 351 neighbors[MAX_NEIGHBORS * n + 0] =
322 neighbors[MAX_NEIGHBORS * n + 1] = (i - 1) * l + j; 352 neighbors[MAX_NEIGHBORS * n + 1] = (i - 1) * l + j;
323 } else { 353 } else {
324 assert(j > 0); 354 assert(j > 0);
325 neighbors[MAX_NEIGHBORS * n + 0] = 355 neighbors[MAX_NEIGHBORS * n + 0] =
326 neighbors[MAX_NEIGHBORS * n + 1] = i * l + j - 1; 356 neighbors[MAX_NEIGHBORS * n + 1] = i * l + j - 1;
327 } 357 }
328 assert(iscan[neighbors[MAX_NEIGHBORS * n + 0]] < n); 358 assert(iscan[neighbors[MAX_NEIGHBORS * n + 0]] < n);
329 } 359 }
330 // one padding item so we don't have to add branches in code to handle 360 // one padding item so we don't have to add branches in code to handle
331 // calls to get_coef_context() for the token after the final dc token 361 // calls to get_coef_context() for the token after the final dc token
332 neighbors[MAX_NEIGHBORS * l2 + 0] = 0; 362 neighbors[MAX_NEIGHBORS * l2 + 0] = 0;
333 neighbors[MAX_NEIGHBORS * l2 + 1] = 0; 363 neighbors[MAX_NEIGHBORS * l2 + 1] = 0;
334 } 364 }
335 365
336 void vp9_init_neighbors() { 366 void vp9_init_neighbors() {
337 init_scan_neighbors(vp9_default_scan_4x4, vp9_default_iscan_4x4, 4, 367 init_scan_neighbors(default_scan_4x4, vp9_default_iscan_4x4, 4,
338 vp9_default_scan_4x4_neighbors); 368 default_scan_4x4_neighbors);
339 init_scan_neighbors(vp9_row_scan_4x4, vp9_row_iscan_4x4, 4, 369 init_scan_neighbors(row_scan_4x4, vp9_row_iscan_4x4, 4,
340 vp9_row_scan_4x4_neighbors); 370 row_scan_4x4_neighbors);
341 init_scan_neighbors(vp9_col_scan_4x4, vp9_col_iscan_4x4, 4, 371 init_scan_neighbors(col_scan_4x4, vp9_col_iscan_4x4, 4,
342 vp9_col_scan_4x4_neighbors); 372 col_scan_4x4_neighbors);
343 init_scan_neighbors(vp9_default_scan_8x8, vp9_default_iscan_8x8, 8, 373 init_scan_neighbors(default_scan_8x8, vp9_default_iscan_8x8, 8,
344 vp9_default_scan_8x8_neighbors); 374 default_scan_8x8_neighbors);
345 init_scan_neighbors(vp9_row_scan_8x8, vp9_row_iscan_8x8, 8, 375 init_scan_neighbors(row_scan_8x8, vp9_row_iscan_8x8, 8,
346 vp9_row_scan_8x8_neighbors); 376 row_scan_8x8_neighbors);
347 init_scan_neighbors(vp9_col_scan_8x8, vp9_col_iscan_8x8, 8, 377 init_scan_neighbors(col_scan_8x8, vp9_col_iscan_8x8, 8,
348 vp9_col_scan_8x8_neighbors); 378 col_scan_8x8_neighbors);
349 init_scan_neighbors(vp9_default_scan_16x16, vp9_default_iscan_16x16, 16, 379 init_scan_neighbors(default_scan_16x16, vp9_default_iscan_16x16, 16,
350 vp9_default_scan_16x16_neighbors); 380 default_scan_16x16_neighbors);
351 init_scan_neighbors(vp9_row_scan_16x16, vp9_row_iscan_16x16, 16, 381 init_scan_neighbors(row_scan_16x16, vp9_row_iscan_16x16, 16,
352 vp9_row_scan_16x16_neighbors); 382 row_scan_16x16_neighbors);
353 init_scan_neighbors(vp9_col_scan_16x16, vp9_col_iscan_16x16, 16, 383 init_scan_neighbors(col_scan_16x16, vp9_col_iscan_16x16, 16,
354 vp9_col_scan_16x16_neighbors); 384 col_scan_16x16_neighbors);
355 init_scan_neighbors(vp9_default_scan_32x32, vp9_default_iscan_32x32, 32, 385 init_scan_neighbors(default_scan_32x32, vp9_default_iscan_32x32, 32,
356 vp9_default_scan_32x32_neighbors); 386 default_scan_32x32_neighbors);
357 } 387 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_scan.h ('k') | source/libvpx/vp9/common/vp9_tile_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698