scan.c 292 KB
Newer Older
Jingning Han's avatar
Jingning Han committed
1
/*
Yaowu Xu's avatar
Yaowu Xu committed
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Jingning Han's avatar
Jingning Han committed
3
 *
Yaowu Xu's avatar
Yaowu Xu committed
4 5 6 7 8 9
 * 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.
Jingning Han's avatar
Jingning Han committed
10 11 12 13
 */

#include <assert.h>

14
#include "av1/common/common_data.h"
15
#include "av1/common/scan.h"
Jingning Han's avatar
Jingning Han committed
16 17

DECLARE_ALIGNED(16, static const int16_t, default_scan_4x4[16]) = {
clang-format's avatar
clang-format committed
18
  0, 4, 1, 5, 8, 2, 12, 9, 3, 6, 13, 10, 7, 14, 11, 15,
Jingning Han's avatar
Jingning Han committed
19 20
};

hui su's avatar
hui su committed
21
#if CONFIG_EXT_TX
22
DECLARE_ALIGNED(16, static const int16_t, mcol_scan_4x4[16]) = {
clang-format's avatar
clang-format committed
23
  0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15,
24 25 26
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_4x4[16]) = {
clang-format's avatar
clang-format committed
27
  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
28
};
hui su's avatar
hui su committed
29
#endif  // CONFIG_EXT_TX
30

Jingning Han's avatar
Jingning Han committed
31
DECLARE_ALIGNED(16, static const int16_t, col_scan_4x4[16]) = {
clang-format's avatar
clang-format committed
32
  0, 4, 8, 1, 12, 5, 9, 2, 13, 6, 10, 3, 7, 14, 11, 15,
Jingning Han's avatar
Jingning Han committed
33 34 35
};

DECLARE_ALIGNED(16, static const int16_t, row_scan_4x4[16]) = {
clang-format's avatar
clang-format committed
36
  0, 1, 4, 2, 5, 3, 6, 8, 9, 7, 12, 10, 13, 11, 14, 15,
Jingning Han's avatar
Jingning Han committed
37 38
};

39 40
#if CONFIG_EXT_TX
DECLARE_ALIGNED(16, static const int16_t, default_scan_4x8[32]) = {
clang-format's avatar
clang-format committed
41 42
  0,  1,  4,  5,  2,  8,  6,  9,  10, 3,  12, 7,  13, 11, 14, 16,
  17, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
43 44 45
};

DECLARE_ALIGNED(16, static const int16_t, mcol_scan_4x8[32]) = {
clang-format's avatar
clang-format committed
46 47
  0, 4, 8,  12, 16, 20, 24, 28, 1, 5, 9,  13, 17, 21, 25, 29,
  2, 6, 10, 14, 18, 22, 26, 30, 3, 7, 11, 15, 19, 23, 27, 31,
48 49 50
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_4x8[32]) = {
clang-format's avatar
clang-format committed
51 52
  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
53 54 55
};

DECLARE_ALIGNED(16, static const int16_t, default_scan_8x4[32]) = {
clang-format's avatar
clang-format committed
56 57
  0,  1,  8,  9, 2,  16, 10, 17, 18, 3,  24, 11, 25, 19, 26, 4,
  12, 27, 20, 5, 28, 13, 21, 29, 6,  14, 22, 30, 7,  15, 23, 31,
58 59 60
};

DECLARE_ALIGNED(16, static const int16_t, mcol_scan_8x4[32]) = {
clang-format's avatar
clang-format committed
61 62
  0, 8,  16, 24, 1, 9,  17, 25, 2, 10, 18, 26, 3, 11, 19, 27,
  4, 12, 20, 28, 5, 13, 21, 29, 6, 14, 22, 30, 7, 15, 23, 31,
63 64 65
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_8x4[32]) = {
clang-format's avatar
clang-format committed
66 67
  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
68 69 70
};
#endif  // CONFIG_EXT_TX

Jingning Han's avatar
Jingning Han committed
71
DECLARE_ALIGNED(16, static const int16_t, default_scan_8x8[64]) = {
clang-format's avatar
clang-format committed
72 73 74 75
  0,  8,  1,  16, 9,  2,  17, 24, 10, 3,  18, 25, 32, 11, 4,  26,
  33, 19, 40, 12, 34, 27, 5,  41, 20, 48, 13, 35, 42, 28, 21, 6,
  49, 56, 36, 43, 29, 7,  14, 50, 57, 44, 22, 37, 15, 51, 58, 30,
  45, 23, 52, 59, 38, 31, 60, 53, 46, 39, 61, 54, 47, 62, 55, 63,
Jingning Han's avatar
Jingning Han committed
76 77
};

hui su's avatar
hui su committed
78
#if CONFIG_EXT_TX
79
DECLARE_ALIGNED(16, static const int16_t, mcol_scan_8x8[64]) = {
clang-format's avatar
clang-format committed
80 81 82 83
  0, 8,  16, 24, 32, 40, 48, 56, 1, 9,  17, 25, 33, 41, 49, 57,
  2, 10, 18, 26, 34, 42, 50, 58, 3, 11, 19, 27, 35, 43, 51, 59,
  4, 12, 20, 28, 36, 44, 52, 60, 5, 13, 21, 29, 37, 45, 53, 61,
  6, 14, 22, 30, 38, 46, 54, 62, 7, 15, 23, 31, 39, 47, 55, 63,
84 85 86
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_8x8[64]) = {
clang-format's avatar
clang-format committed
87 88 89 90
  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
91
};
hui su's avatar
hui su committed
92
#endif  // CONFIG_EXT_TX
93

Jingning Han's avatar
Jingning Han committed
94
DECLARE_ALIGNED(16, static const int16_t, col_scan_8x8[64]) = {
clang-format's avatar
clang-format committed
95 96 97 98
  0,  8,  16, 1,  24, 9,  32, 17, 2,  40, 25, 10, 33, 18, 48, 3,
  26, 41, 11, 56, 19, 34, 4,  49, 27, 42, 12, 35, 20, 57, 50, 28,
  5,  43, 13, 36, 58, 51, 21, 44, 6,  29, 59, 37, 14, 52, 22, 7,
  45, 60, 30, 15, 38, 53, 23, 46, 31, 61, 39, 54, 47, 62, 55, 63,
Jingning Han's avatar
Jingning Han committed
99 100 101
};

DECLARE_ALIGNED(16, static const int16_t, row_scan_8x8[64]) = {
clang-format's avatar
clang-format committed
102 103 104 105
  0,  1,  2,  8,  9,  3,  16, 10, 4,  17, 11, 24, 5,  18, 25, 12,
  19, 26, 32, 6,  13, 20, 33, 27, 7,  34, 40, 21, 28, 41, 14, 35,
  48, 42, 29, 36, 49, 22, 43, 15, 56, 37, 50, 44, 30, 57, 23, 51,
  58, 45, 38, 52, 31, 59, 53, 46, 60, 39, 61, 47, 54, 55, 62, 63,
Jingning Han's avatar
Jingning Han committed
106 107
};

108 109
#if CONFIG_EXT_TX
DECLARE_ALIGNED(16, static const int16_t, default_scan_8x16[128]) = {
clang-format's avatar
clang-format committed
110 111 112 113 114 115 116 117
  0,   1,   8,   2,   9,   16,  3,   10,  17,  24,  4,   11,  18,  25,  32,
  5,   12,  19,  26,  33,  40,  6,   13,  20,  27,  34,  41,  48,  7,   14,
  21,  28,  35,  42,  49,  56,  15,  22,  29,  36,  43,  50,  57,  64,  23,
  30,  37,  44,  51,  58,  65,  72,  31,  38,  45,  52,  59,  66,  73,  80,
  39,  46,  53,  60,  67,  74,  81,  88,  47,  54,  61,  68,  75,  82,  89,
  96,  55,  62,  69,  76,  83,  90,  97,  104, 63,  70,  77,  84,  91,  98,
  105, 112, 71,  78,  85,  92,  99,  106, 113, 120, 79,  86,  93,  100, 107,
  114, 121, 87,  94,  101, 108, 115, 122, 95,  102, 109, 116, 123, 103, 110,
118 119 120 121
  117, 124, 111, 118, 125, 119, 126, 127,
};

DECLARE_ALIGNED(16, static const int16_t, default_scan_16x8[128]) = {
clang-format's avatar
clang-format committed
122 123 124 125 126 127 128 129
  0,   1,  16,  2,   17,  32,  3,  18, 33,  48,  4,   19,  34,  49,  64,  5,
  20,  35, 50,  65,  80,  6,   21, 36, 51,  66,  81,  96,  7,   22,  37,  52,
  67,  82, 97,  112, 8,   23,  38, 53, 68,  83,  98,  113, 9,   24,  39,  54,
  69,  84, 99,  114, 10,  25,  40, 55, 70,  85,  100, 115, 11,  26,  41,  56,
  71,  86, 101, 116, 12,  27,  42, 57, 72,  87,  102, 117, 13,  28,  43,  58,
  73,  88, 103, 118, 14,  29,  44, 59, 74,  89,  104, 119, 15,  30,  45,  60,
  75,  90, 105, 120, 31,  46,  61, 76, 91,  106, 121, 47,  62,  77,  92,  107,
  122, 63, 78,  93,  108, 123, 79, 94, 109, 124, 95,  110, 125, 111, 126, 127,
130 131 132
};

DECLARE_ALIGNED(16, static const int16_t, mcol_scan_8x16[128]) = {
clang-format's avatar
clang-format committed
133 134 135 136 137 138 139 140
  0, 8,  16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96,  104, 112, 120,
  1, 9,  17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97,  105, 113, 121,
  2, 10, 18, 26, 34, 42, 50, 58, 66, 74, 82, 90, 98,  106, 114, 122,
  3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99,  107, 115, 123,
  4, 12, 20, 28, 36, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124,
  5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 109, 117, 125,
  6, 14, 22, 30, 38, 46, 54, 62, 70, 78, 86, 94, 102, 110, 118, 126,
  7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127,
141 142 143
};

DECLARE_ALIGNED(16, static const int16_t, mcol_scan_16x8[128]) = {
clang-format's avatar
clang-format committed
144 145 146 147 148 149 150 151
  0,  16, 32, 48, 64, 80, 96,  112, 1,  17, 33, 49, 65, 81, 97,  113,
  2,  18, 34, 50, 66, 82, 98,  114, 3,  19, 35, 51, 67, 83, 99,  115,
  4,  20, 36, 52, 68, 84, 100, 116, 5,  21, 37, 53, 69, 85, 101, 117,
  6,  22, 38, 54, 70, 86, 102, 118, 7,  23, 39, 55, 71, 87, 103, 119,
  8,  24, 40, 56, 72, 88, 104, 120, 9,  25, 41, 57, 73, 89, 105, 121,
  10, 26, 42, 58, 74, 90, 106, 122, 11, 27, 43, 59, 75, 91, 107, 123,
  12, 28, 44, 60, 76, 92, 108, 124, 13, 29, 45, 61, 77, 93, 109, 125,
  14, 30, 46, 62, 78, 94, 110, 126, 15, 31, 47, 63, 79, 95, 111, 127,
152 153 154
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_8x16[128]) = {
clang-format's avatar
clang-format committed
155 156 157 158 159 160 161 162
  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
  90,  91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
163 164 165 166
  120, 121, 122, 123, 124, 125, 126, 127,
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_16x8[128]) = {
clang-format's avatar
clang-format committed
167 168 169 170 171 172 173 174
  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
  90,  91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
175 176 177 178
  120, 121, 122, 123, 124, 125, 126, 127,
};

DECLARE_ALIGNED(16, static const int16_t, default_scan_16x32[512]) = {
clang-format's avatar
clang-format committed
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
  0,   1,   16,  2,   17,  32,  3,   18,  33,  48,  4,   19,  34,  49,  64,
  5,   20,  35,  50,  65,  80,  6,   21,  36,  51,  66,  81,  96,  7,   22,
  37,  52,  67,  82,  97,  112, 8,   23,  38,  53,  68,  83,  98,  113, 128,
  9,   24,  39,  54,  69,  84,  99,  114, 129, 144, 10,  25,  40,  55,  70,
  85,  100, 115, 130, 145, 160, 11,  26,  41,  56,  71,  86,  101, 116, 131,
  146, 161, 176, 12,  27,  42,  57,  72,  87,  102, 117, 132, 147, 162, 177,
  192, 13,  28,  43,  58,  73,  88,  103, 118, 133, 148, 163, 178, 193, 208,
  14,  29,  44,  59,  74,  89,  104, 119, 134, 149, 164, 179, 194, 209, 224,
  15,  30,  45,  60,  75,  90,  105, 120, 135, 150, 165, 180, 195, 210, 225,
  240, 31,  46,  61,  76,  91,  106, 121, 136, 151, 166, 181, 196, 211, 226,
  241, 256, 47,  62,  77,  92,  107, 122, 137, 152, 167, 182, 197, 212, 227,
  242, 257, 272, 63,  78,  93,  108, 123, 138, 153, 168, 183, 198, 213, 228,
  243, 258, 273, 288, 79,  94,  109, 124, 139, 154, 169, 184, 199, 214, 229,
  244, 259, 274, 289, 304, 95,  110, 125, 140, 155, 170, 185, 200, 215, 230,
  245, 260, 275, 290, 305, 320, 111, 126, 141, 156, 171, 186, 201, 216, 231,
  246, 261, 276, 291, 306, 321, 336, 127, 142, 157, 172, 187, 202, 217, 232,
  247, 262, 277, 292, 307, 322, 337, 352, 143, 158, 173, 188, 203, 218, 233,
  248, 263, 278, 293, 308, 323, 338, 353, 368, 159, 174, 189, 204, 219, 234,
  249, 264, 279, 294, 309, 324, 339, 354, 369, 384, 175, 190, 205, 220, 235,
  250, 265, 280, 295, 310, 325, 340, 355, 370, 385, 400, 191, 206, 221, 236,
  251, 266, 281, 296, 311, 326, 341, 356, 371, 386, 401, 416, 207, 222, 237,
  252, 267, 282, 297, 312, 327, 342, 357, 372, 387, 402, 417, 432, 223, 238,
  253, 268, 283, 298, 313, 328, 343, 358, 373, 388, 403, 418, 433, 448, 239,
  254, 269, 284, 299, 314, 329, 344, 359, 374, 389, 404, 419, 434, 449, 464,
  255, 270, 285, 300, 315, 330, 345, 360, 375, 390, 405, 420, 435, 450, 465,
  480, 271, 286, 301, 316, 331, 346, 361, 376, 391, 406, 421, 436, 451, 466,
  481, 496, 287, 302, 317, 332, 347, 362, 377, 392, 407, 422, 437, 452, 467,
  482, 497, 303, 318, 333, 348, 363, 378, 393, 408, 423, 438, 453, 468, 483,
  498, 319, 334, 349, 364, 379, 394, 409, 424, 439, 454, 469, 484, 499, 335,
  350, 365, 380, 395, 410, 425, 440, 455, 470, 485, 500, 351, 366, 381, 396,
  411, 426, 441, 456, 471, 486, 501, 367, 382, 397, 412, 427, 442, 457, 472,
  487, 502, 383, 398, 413, 428, 443, 458, 473, 488, 503, 399, 414, 429, 444,
  459, 474, 489, 504, 415, 430, 445, 460, 475, 490, 505, 431, 446, 461, 476,
  491, 506, 447, 462, 477, 492, 507, 463, 478, 493, 508, 479, 494, 509, 495,
  510, 511,
214 215 216
};

DECLARE_ALIGNED(16, static const int16_t, default_scan_32x16[512]) = {
clang-format's avatar
clang-format committed
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
  0,   1,   32,  2,   33,  64,  3,   34,  65,  96,  4,   35,  66,  97,  128,
  5,   36,  67,  98,  129, 160, 6,   37,  68,  99,  130, 161, 192, 7,   38,
  69,  100, 131, 162, 193, 224, 8,   39,  70,  101, 132, 163, 194, 225, 256,
  9,   40,  71,  102, 133, 164, 195, 226, 257, 288, 10,  41,  72,  103, 134,
  165, 196, 227, 258, 289, 320, 11,  42,  73,  104, 135, 166, 197, 228, 259,
  290, 321, 352, 12,  43,  74,  105, 136, 167, 198, 229, 260, 291, 322, 353,
  384, 13,  44,  75,  106, 137, 168, 199, 230, 261, 292, 323, 354, 385, 416,
  14,  45,  76,  107, 138, 169, 200, 231, 262, 293, 324, 355, 386, 417, 448,
  15,  46,  77,  108, 139, 170, 201, 232, 263, 294, 325, 356, 387, 418, 449,
  480, 16,  47,  78,  109, 140, 171, 202, 233, 264, 295, 326, 357, 388, 419,
  450, 481, 17,  48,  79,  110, 141, 172, 203, 234, 265, 296, 327, 358, 389,
  420, 451, 482, 18,  49,  80,  111, 142, 173, 204, 235, 266, 297, 328, 359,
  390, 421, 452, 483, 19,  50,  81,  112, 143, 174, 205, 236, 267, 298, 329,
  360, 391, 422, 453, 484, 20,  51,  82,  113, 144, 175, 206, 237, 268, 299,
  330, 361, 392, 423, 454, 485, 21,  52,  83,  114, 145, 176, 207, 238, 269,
  300, 331, 362, 393, 424, 455, 486, 22,  53,  84,  115, 146, 177, 208, 239,
  270, 301, 332, 363, 394, 425, 456, 487, 23,  54,  85,  116, 147, 178, 209,
  240, 271, 302, 333, 364, 395, 426, 457, 488, 24,  55,  86,  117, 148, 179,
  210, 241, 272, 303, 334, 365, 396, 427, 458, 489, 25,  56,  87,  118, 149,
  180, 211, 242, 273, 304, 335, 366, 397, 428, 459, 490, 26,  57,  88,  119,
  150, 181, 212, 243, 274, 305, 336, 367, 398, 429, 460, 491, 27,  58,  89,
  120, 151, 182, 213, 244, 275, 306, 337, 368, 399, 430, 461, 492, 28,  59,
  90,  121, 152, 183, 214, 245, 276, 307, 338, 369, 400, 431, 462, 493, 29,
  60,  91,  122, 153, 184, 215, 246, 277, 308, 339, 370, 401, 432, 463, 494,
  30,  61,  92,  123, 154, 185, 216, 247, 278, 309, 340, 371, 402, 433, 464,
  495, 31,  62,  93,  124, 155, 186, 217, 248, 279, 310, 341, 372, 403, 434,
  465, 496, 63,  94,  125, 156, 187, 218, 249, 280, 311, 342, 373, 404, 435,
  466, 497, 95,  126, 157, 188, 219, 250, 281, 312, 343, 374, 405, 436, 467,
  498, 127, 158, 189, 220, 251, 282, 313, 344, 375, 406, 437, 468, 499, 159,
  190, 221, 252, 283, 314, 345, 376, 407, 438, 469, 500, 191, 222, 253, 284,
  315, 346, 377, 408, 439, 470, 501, 223, 254, 285, 316, 347, 378, 409, 440,
  471, 502, 255, 286, 317, 348, 379, 410, 441, 472, 503, 287, 318, 349, 380,
  411, 442, 473, 504, 319, 350, 381, 412, 443, 474, 505, 351, 382, 413, 444,
  475, 506, 383, 414, 445, 476, 507, 415, 446, 477, 508, 447, 478, 509, 479,
  510, 511,
252 253 254
};

DECLARE_ALIGNED(16, static const int16_t, mcol_scan_16x32[512]) = {
clang-format's avatar
clang-format committed
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
  0,   16,  32,  48,  64,  80,  96,  112, 128, 144, 160, 176, 192, 208, 224,
  240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400, 416, 432, 448, 464,
  480, 496, 1,   17,  33,  49,  65,  81,  97,  113, 129, 145, 161, 177, 193,
  209, 225, 241, 257, 273, 289, 305, 321, 337, 353, 369, 385, 401, 417, 433,
  449, 465, 481, 497, 2,   18,  34,  50,  66,  82,  98,  114, 130, 146, 162,
  178, 194, 210, 226, 242, 258, 274, 290, 306, 322, 338, 354, 370, 386, 402,
  418, 434, 450, 466, 482, 498, 3,   19,  35,  51,  67,  83,  99,  115, 131,
  147, 163, 179, 195, 211, 227, 243, 259, 275, 291, 307, 323, 339, 355, 371,
  387, 403, 419, 435, 451, 467, 483, 499, 4,   20,  36,  52,  68,  84,  100,
  116, 132, 148, 164, 180, 196, 212, 228, 244, 260, 276, 292, 308, 324, 340,
  356, 372, 388, 404, 420, 436, 452, 468, 484, 500, 5,   21,  37,  53,  69,
  85,  101, 117, 133, 149, 165, 181, 197, 213, 229, 245, 261, 277, 293, 309,
  325, 341, 357, 373, 389, 405, 421, 437, 453, 469, 485, 501, 6,   22,  38,
  54,  70,  86,  102, 118, 134, 150, 166, 182, 198, 214, 230, 246, 262, 278,
  294, 310, 326, 342, 358, 374, 390, 406, 422, 438, 454, 470, 486, 502, 7,
  23,  39,  55,  71,  87,  103, 119, 135, 151, 167, 183, 199, 215, 231, 247,
  263, 279, 295, 311, 327, 343, 359, 375, 391, 407, 423, 439, 455, 471, 487,
  503, 8,   24,  40,  56,  72,  88,  104, 120, 136, 152, 168, 184, 200, 216,
  232, 248, 264, 280, 296, 312, 328, 344, 360, 376, 392, 408, 424, 440, 456,
  472, 488, 504, 9,   25,  41,  57,  73,  89,  105, 121, 137, 153, 169, 185,
  201, 217, 233, 249, 265, 281, 297, 313, 329, 345, 361, 377, 393, 409, 425,
  441, 457, 473, 489, 505, 10,  26,  42,  58,  74,  90,  106, 122, 138, 154,
  170, 186, 202, 218, 234, 250, 266, 282, 298, 314, 330, 346, 362, 378, 394,
  410, 426, 442, 458, 474, 490, 506, 11,  27,  43,  59,  75,  91,  107, 123,
  139, 155, 171, 187, 203, 219, 235, 251, 267, 283, 299, 315, 331, 347, 363,
  379, 395, 411, 427, 443, 459, 475, 491, 507, 12,  28,  44,  60,  76,  92,
  108, 124, 140, 156, 172, 188, 204, 220, 236, 252, 268, 284, 300, 316, 332,
  348, 364, 380, 396, 412, 428, 444, 460, 476, 492, 508, 13,  29,  45,  61,
  77,  93,  109, 125, 141, 157, 173, 189, 205, 221, 237, 253, 269, 285, 301,
  317, 333, 349, 365, 381, 397, 413, 429, 445, 461, 477, 493, 509, 14,  30,
  46,  62,  78,  94,  110, 126, 142, 158, 174, 190, 206, 222, 238, 254, 270,
  286, 302, 318, 334, 350, 366, 382, 398, 414, 430, 446, 462, 478, 494, 510,
  15,  31,  47,  63,  79,  95,  111, 127, 143, 159, 175, 191, 207, 223, 239,
  255, 271, 287, 303, 319, 335, 351, 367, 383, 399, 415, 431, 447, 463, 479,
  495, 511,
290 291 292
};

DECLARE_ALIGNED(16, static const int16_t, mcol_scan_32x16[512]) = {
clang-format's avatar
clang-format committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
  0,  32, 64, 96,  128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480,
  1,  33, 65, 97,  129, 161, 193, 225, 257, 289, 321, 353, 385, 417, 449, 481,
  2,  34, 66, 98,  130, 162, 194, 226, 258, 290, 322, 354, 386, 418, 450, 482,
  3,  35, 67, 99,  131, 163, 195, 227, 259, 291, 323, 355, 387, 419, 451, 483,
  4,  36, 68, 100, 132, 164, 196, 228, 260, 292, 324, 356, 388, 420, 452, 484,
  5,  37, 69, 101, 133, 165, 197, 229, 261, 293, 325, 357, 389, 421, 453, 485,
  6,  38, 70, 102, 134, 166, 198, 230, 262, 294, 326, 358, 390, 422, 454, 486,
  7,  39, 71, 103, 135, 167, 199, 231, 263, 295, 327, 359, 391, 423, 455, 487,
  8,  40, 72, 104, 136, 168, 200, 232, 264, 296, 328, 360, 392, 424, 456, 488,
  9,  41, 73, 105, 137, 169, 201, 233, 265, 297, 329, 361, 393, 425, 457, 489,
  10, 42, 74, 106, 138, 170, 202, 234, 266, 298, 330, 362, 394, 426, 458, 490,
  11, 43, 75, 107, 139, 171, 203, 235, 267, 299, 331, 363, 395, 427, 459, 491,
  12, 44, 76, 108, 140, 172, 204, 236, 268, 300, 332, 364, 396, 428, 460, 492,
  13, 45, 77, 109, 141, 173, 205, 237, 269, 301, 333, 365, 397, 429, 461, 493,
  14, 46, 78, 110, 142, 174, 206, 238, 270, 302, 334, 366, 398, 430, 462, 494,
  15, 47, 79, 111, 143, 175, 207, 239, 271, 303, 335, 367, 399, 431, 463, 495,
  16, 48, 80, 112, 144, 176, 208, 240, 272, 304, 336, 368, 400, 432, 464, 496,
  17, 49, 81, 113, 145, 177, 209, 241, 273, 305, 337, 369, 401, 433, 465, 497,
  18, 50, 82, 114, 146, 178, 210, 242, 274, 306, 338, 370, 402, 434, 466, 498,
  19, 51, 83, 115, 147, 179, 211, 243, 275, 307, 339, 371, 403, 435, 467, 499,
  20, 52, 84, 116, 148, 180, 212, 244, 276, 308, 340, 372, 404, 436, 468, 500,
  21, 53, 85, 117, 149, 181, 213, 245, 277, 309, 341, 373, 405, 437, 469, 501,
  22, 54, 86, 118, 150, 182, 214, 246, 278, 310, 342, 374, 406, 438, 470, 502,
  23, 55, 87, 119, 151, 183, 215, 247, 279, 311, 343, 375, 407, 439, 471, 503,
  24, 56, 88, 120, 152, 184, 216, 248, 280, 312, 344, 376, 408, 440, 472, 504,
  25, 57, 89, 121, 153, 185, 217, 249, 281, 313, 345, 377, 409, 441, 473, 505,
  26, 58, 90, 122, 154, 186, 218, 250, 282, 314, 346, 378, 410, 442, 474, 506,
  27, 59, 91, 123, 155, 187, 219, 251, 283, 315, 347, 379, 411, 443, 475, 507,
  28, 60, 92, 124, 156, 188, 220, 252, 284, 316, 348, 380, 412, 444, 476, 508,
  29, 61, 93, 125, 157, 189, 221, 253, 285, 317, 349, 381, 413, 445, 477, 509,
  30, 62, 94, 126, 158, 190, 222, 254, 286, 318, 350, 382, 414, 446, 478, 510,
  31, 63, 95, 127, 159, 191, 223, 255, 287, 319, 351, 383, 415, 447, 479, 511,
325 326 327
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_16x32[512]) = {
clang-format's avatar
clang-format committed
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
  90,  91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
  120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
  150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
  165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
  180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
  195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
  210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
  225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
  255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
  270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
  300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
  315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
  330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
  345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
  360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
  375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389,
  390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
  405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419,
  420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434,
  435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449,
  450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464,
  465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479,
  480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
  495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509,
  510, 511,
363 364 365
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_32x16[512]) = {
clang-format's avatar
clang-format committed
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
  90,  91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
  120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
  150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
  165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
  180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
  195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
  210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
  225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
  255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
  270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
  300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
  315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
  330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
  345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
  360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
  375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389,
  390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
  405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419,
  420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434,
  435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449,
  450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464,
  465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479,
  480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
  495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509,
  510, 511,
401 402 403
};
#endif  // CONFIG_EXT_TX

Jingning Han's avatar
Jingning Han committed
404
DECLARE_ALIGNED(16, static const int16_t, default_scan_16x16[256]) = {
clang-format's avatar
clang-format committed
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
  0,   16,  1,   32,  17,  2,   48,  33,  18,  3,   64,  34,  49,  19,  65,
  80,  50,  4,   35,  66,  20,  81,  96,  51,  5,   36,  82,  97,  67,  112,
  21,  52,  98,  37,  83,  113, 6,   68,  128, 53,  22,  99,  114, 84,  7,
  129, 38,  69,  100, 115, 144, 130, 85,  54,  23,  8,   145, 39,  70,  116,
  101, 131, 160, 146, 55,  86,  24,  71,  132, 117, 161, 40,  9,   102, 147,
  176, 162, 87,  56,  25,  133, 118, 177, 148, 72,  103, 41,  163, 10,  192,
  178, 88,  57,  134, 149, 119, 26,  164, 73,  104, 193, 42,  179, 208, 11,
  135, 89,  165, 120, 150, 58,  194, 180, 27,  74,  209, 105, 151, 136, 43,
  90,  224, 166, 195, 181, 121, 210, 59,  12,  152, 106, 167, 196, 75,  137,
  225, 211, 240, 182, 122, 91,  28,  197, 13,  226, 168, 183, 153, 44,  212,
  138, 107, 241, 60,  29,  123, 198, 184, 227, 169, 242, 76,  213, 154, 45,
  92,  14,  199, 139, 61,  228, 214, 170, 185, 243, 108, 77,  155, 30,  15,
  200, 229, 124, 215, 244, 93,  46,  186, 171, 201, 109, 140, 230, 62,  216,
  245, 31,  125, 78,  156, 231, 47,  187, 202, 217, 94,  246, 141, 63,  232,
  172, 110, 247, 157, 79,  218, 203, 126, 233, 188, 248, 95,  173, 142, 219,
  111, 249, 234, 158, 127, 189, 204, 250, 235, 143, 174, 220, 205, 159, 251,
Jingning Han's avatar
Jingning Han committed
421 422 423 424
  190, 221, 175, 236, 237, 191, 206, 252, 222, 253, 207, 238, 223, 254, 239,
  255,
};

hui su's avatar
hui su committed
425
#if CONFIG_EXT_TX
426
DECLARE_ALIGNED(16, static const int16_t, mcol_scan_16x16[256]) = {
clang-format's avatar
clang-format committed
427 428 429 430 431 432 433 434 435 436
  0,  16, 32, 48, 64, 80, 96,  112, 128, 144, 160, 176, 192, 208, 224, 240,
  1,  17, 33, 49, 65, 81, 97,  113, 129, 145, 161, 177, 193, 209, 225, 241,
  2,  18, 34, 50, 66, 82, 98,  114, 130, 146, 162, 178, 194, 210, 226, 242,
  3,  19, 35, 51, 67, 83, 99,  115, 131, 147, 163, 179, 195, 211, 227, 243,
  4,  20, 36, 52, 68, 84, 100, 116, 132, 148, 164, 180, 196, 212, 228, 244,
  5,  21, 37, 53, 69, 85, 101, 117, 133, 149, 165, 181, 197, 213, 229, 245,
  6,  22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214, 230, 246,
  7,  23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215, 231, 247,
  8,  24, 40, 56, 72, 88, 104, 120, 136, 152, 168, 184, 200, 216, 232, 248,
  9,  25, 41, 57, 73, 89, 105, 121, 137, 153, 169, 185, 201, 217, 233, 249,
437 438 439 440 441 442 443 444 445
  10, 26, 42, 58, 74, 90, 106, 122, 138, 154, 170, 186, 202, 218, 234, 250,
  11, 27, 43, 59, 75, 91, 107, 123, 139, 155, 171, 187, 203, 219, 235, 251,
  12, 28, 44, 60, 76, 92, 108, 124, 140, 156, 172, 188, 204, 220, 236, 252,
  13, 29, 45, 61, 77, 93, 109, 125, 141, 157, 173, 189, 205, 221, 237, 253,
  14, 30, 46, 62, 78, 94, 110, 126, 142, 158, 174, 190, 206, 222, 238, 254,
  15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255,
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_16x16[256]) = {
clang-format's avatar
clang-format committed
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
  90,  91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
  120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
  150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
  165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
  180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
  195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
  210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
  225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
  255,
464
};
hui su's avatar
hui su committed
465
#endif  // CONFIG_EXT_TX
466

Jingning Han's avatar
Jingning Han committed
467
DECLARE_ALIGNED(16, static const int16_t, col_scan_16x16[256]) = {
clang-format's avatar
clang-format committed
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
  0,   16,  32,  48,  1,   64,  17,  80,  33,  96,  49,  2,   65,  112, 18,
  81,  34,  128, 50,  97,  3,   66,  144, 19,  113, 35,  82,  160, 98,  51,
  129, 4,   67,  176, 20,  114, 145, 83,  36,  99,  130, 52,  192, 5,   161,
  68,  115, 21,  146, 84,  208, 177, 37,  131, 100, 53,  162, 224, 69,  6,
  116, 193, 147, 85,  22,  240, 132, 38,  178, 101, 163, 54,  209, 117, 70,
  7,   148, 194, 86,  179, 225, 23,  133, 39,  164, 8,   102, 210, 241, 55,
  195, 118, 149, 71,  180, 24,  87,  226, 134, 165, 211, 40,  103, 56,  72,
  150, 196, 242, 119, 9,   181, 227, 88,  166, 25,  135, 41,  104, 212, 57,
  151, 197, 120, 73,  243, 182, 136, 167, 213, 89,  10,  228, 105, 152, 198,
  26,  42,  121, 183, 244, 168, 58,  137, 229, 74,  214, 90,  153, 199, 184,
  11,  106, 245, 27,  122, 230, 169, 43,  215, 59,  200, 138, 185, 246, 75,
  12,  91,  154, 216, 231, 107, 28,  44,  201, 123, 170, 60,  247, 232, 76,
  139, 13,  92,  217, 186, 248, 155, 108, 29,  124, 45,  202, 233, 171, 61,
  14,  77,  140, 15,  249, 93,  30,  187, 156, 218, 46,  109, 125, 62,  172,
  78,  203, 31,  141, 234, 94,  47,  188, 63,  157, 110, 250, 219, 79,  126,
  204, 173, 142, 95,  189, 111, 235, 158, 220, 251, 127, 174, 143, 205, 236,
Jingning Han's avatar
Jingning Han committed
484 485 486 487 488
  159, 190, 221, 252, 175, 206, 237, 191, 253, 222, 238, 207, 254, 223, 239,
  255,
};

DECLARE_ALIGNED(16, static const int16_t, row_scan_16x16[256]) = {
clang-format's avatar
clang-format committed
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
  0,   1,   2,   16,  3,   17,  4,   18,  32,  5,   33,  19,  6,   34,  48,
  20,  49,  7,   35,  21,  50,  64,  8,   36,  65,  22,  51,  37,  80,  9,
  66,  52,  23,  38,  81,  67,  10,  53,  24,  82,  68,  96,  39,  11,  54,
  83,  97,  69,  25,  98,  84,  40,  112, 55,  12,  70,  99,  113, 85,  26,
  41,  56,  114, 100, 13,  71,  128, 86,  27,  115, 101, 129, 42,  57,  72,
  116, 14,  87,  130, 102, 144, 73,  131, 117, 28,  58,  15,  88,  43,  145,
  103, 132, 146, 118, 74,  160, 89,  133, 104, 29,  59,  147, 119, 44,  161,
  148, 90,  105, 134, 162, 120, 176, 75,  135, 149, 30,  60,  163, 177, 45,
  121, 91,  106, 164, 178, 150, 192, 136, 165, 179, 31,  151, 193, 76,  122,
  61,  137, 194, 107, 152, 180, 208, 46,  166, 167, 195, 92,  181, 138, 209,
  123, 153, 224, 196, 77,  168, 210, 182, 240, 108, 197, 62,  154, 225, 183,
  169, 211, 47,  139, 93,  184, 226, 212, 241, 198, 170, 124, 155, 199, 78,
  213, 185, 109, 227, 200, 63,  228, 242, 140, 214, 171, 186, 156, 229, 243,
  125, 94,  201, 244, 215, 216, 230, 141, 187, 202, 79,  172, 110, 157, 245,
  217, 231, 95,  246, 232, 126, 203, 247, 233, 173, 218, 142, 111, 158, 188,
  248, 127, 234, 219, 249, 189, 204, 143, 174, 159, 250, 235, 205, 220, 175,
Jingning Han's avatar
Jingning Han committed
505 506 507 508
  190, 251, 221, 191, 206, 236, 207, 237, 252, 222, 253, 223, 238, 239, 254,
  255,
};

hui su's avatar
hui su committed
509
#if CONFIG_EXT_TX
510
DECLARE_ALIGNED(16, static const int16_t, mcol_scan_32x32[1024]) = {
clang-format's avatar
clang-format committed
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
  0,   32,   64,  96,   128, 160,  192, 224,  256, 288,  320, 352,  384, 416,
  448, 480,  512, 544,  576, 608,  640, 672,  704, 736,  768, 800,  832, 864,
  896, 928,  960, 992,  1,   33,   65,  97,   129, 161,  193, 225,  257, 289,
  321, 353,  385, 417,  449, 481,  513, 545,  577, 609,  641, 673,  705, 737,
  769, 801,  833, 865,  897, 929,  961, 993,  2,   34,   66,  98,   130, 162,
  194, 226,  258, 290,  322, 354,  386, 418,  450, 482,  514, 546,  578, 610,
  642, 674,  706, 738,  770, 802,  834, 866,  898, 930,  962, 994,  3,   35,
  67,  99,   131, 163,  195, 227,  259, 291,  323, 355,  387, 419,  451, 483,
  515, 547,  579, 611,  643, 675,  707, 739,  771, 803,  835, 867,  899, 931,
  963, 995,  4,   36,   68,  100,  132, 164,  196, 228,  260, 292,  324, 356,
  388, 420,  452, 484,  516, 548,  580, 612,  644, 676,  708, 740,  772, 804,
  836, 868,  900, 932,  964, 996,  5,   37,   69,  101,  133, 165,  197, 229,
  261, 293,  325, 357,  389, 421,  453, 485,  517, 549,  581, 613,  645, 677,
  709, 741,  773, 805,  837, 869,  901, 933,  965, 997,  6,   38,   70,  102,
  134, 166,  198, 230,  262, 294,  326, 358,  390, 422,  454, 486,  518, 550,
  582, 614,  646, 678,  710, 742,  774, 806,  838, 870,  902, 934,  966, 998,
  7,   39,   71,  103,  135, 167,  199, 231,  263, 295,  327, 359,  391, 423,
  455, 487,  519, 551,  583, 615,  647, 679,  711, 743,  775, 807,  839, 871,
  903, 935,  967, 999,  8,   40,   72,  104,  136, 168,  200, 232,  264, 296,
  328, 360,  392, 424,  456, 488,  520, 552,  584, 616,  648, 680,  712, 744,
  776, 808,  840, 872,  904, 936,  968, 1000, 9,   41,   73,  105,  137, 169,
  201, 233,  265, 297,  329, 361,  393, 425,  457, 489,  521, 553,  585, 617,
  649, 681,  713, 745,  777, 809,  841, 873,  905, 937,  969, 1001, 10,  42,
  74,  106,  138, 170,  202, 234,  266, 298,  330, 362,  394, 426,  458, 490,
  522, 554,  586, 618,  650, 682,  714, 746,  778, 810,  842, 874,  906, 938,
  970, 1002, 11,  43,   75,  107,  139, 171,  203, 235,  267, 299,  331, 363,
  395, 427,  459, 491,  523, 555,  587, 619,  651, 683,  715, 747,  779, 811,
  843, 875,  907, 939,  971, 1003, 12,  44,   76,  108,  140, 172,  204, 236,
  268, 300,  332, 364,  396, 428,  460, 492,  524, 556,  588, 620,  652, 684,
  716, 748,  780, 812,  844, 876,  908, 940,  972, 1004, 13,  45,   77,  109,
  141, 173,  205, 237,  269, 301,  333, 365,  397, 429,  461, 493,  525, 557,
  589, 621,  653, 685,  717, 749,  781, 813,  845, 877,  909, 941,  973, 1005,
  14,  46,   78,  110,  142, 174,  206, 238,  270, 302,  334, 366,  398, 430,
  462, 494,  526, 558,  590, 622,  654, 686,  718, 750,  782, 814,  846, 878,
  910, 942,  974, 1006, 15,  47,   79,  111,  143, 175,  207, 239,  271, 303,
  335, 367,  399, 431,  463, 495,  527, 559,  591, 623,  655, 687,  719, 751,
  783, 815,  847, 879,  911, 943,  975, 1007, 16,  48,   80,  112,  144, 176,
  208, 240,  272, 304,  336, 368,  400, 432,  464, 496,  528, 560,  592, 624,
  656, 688,  720, 752,  784, 816,  848, 880,  912, 944,  976, 1008, 17,  49,
  81,  113,  145, 177,  209, 241,  273, 305,  337, 369,  401, 433,  465, 497,
  529, 561,  593, 625,  657, 689,  721, 753,  785, 817,  849, 881,  913, 945,
  977, 1009, 18,  50,   82,  114,  146, 178,  210, 242,  274, 306,  338, 370,
  402, 434,  466, 498,  530, 562,  594, 626,  658, 690,  722, 754,  786, 818,
  850, 882,  914, 946,  978, 1010, 19,  51,   83,  115,  147, 179,  211, 243,
  275, 307,  339, 371,  403, 435,  467, 499,  531, 563,  595, 627,  659, 691,
  723, 755,  787, 819,  851, 883,  915, 947,  979, 1011, 20,  52,   84,  116,
  148, 180,  212, 244,  276, 308,  340, 372,  404, 436,  468, 500,  532, 564,
  596, 628,  660, 692,  724, 756,  788, 820,  852, 884,  916, 948,  980, 1012,
  21,  53,   85,  117,  149, 181,  213, 245,  277, 309,  341, 373,  405, 437,
  469, 501,  533, 565,  597, 629,  661, 693,  725, 757,  789, 821,  853, 885,
  917, 949,  981, 1013, 22,  54,   86,  118,  150, 182,  214, 246,  278, 310,
  342, 374,  406, 438,  470, 502,  534, 566,  598, 630,  662, 694,  726, 758,
  790, 822,  854, 886,  918, 950,  982, 1014, 23,  55,   87,  119,  151, 183,
  215, 247,  279, 311,  343, 375,  407, 439,  471, 503,  535, 567,  599, 631,
  663, 695,  727, 759,  791, 823,  855, 887,  919, 951,  983, 1015, 24,  56,
  88,  120,  152, 184,  216, 248,  280, 312,  344, 376,  408, 440,  472, 504,
  536, 568,  600, 632,  664, 696,  728, 760,  792, 824,  856, 888,  920, 952,
  984, 1016, 25,  57,   89,  121,  153, 185,  217, 249,  281, 313,  345, 377,
  409, 441,  473, 505,  537, 569,  601, 633,  665, 697,  729, 761,  793, 825,
  857, 889,  921, 953,  985, 1017, 26,  58,   90,  122,  154, 186,  218, 250,
  282, 314,  346, 378,  410, 442,  474, 506,  538, 570,  602, 634,  666, 698,
  730, 762,  794, 826,  858, 890,  922, 954,  986, 1018, 27,  59,   91,  123,
  155, 187,  219, 251,  283, 315,  347, 379,  411, 443,  475, 507,  539, 571,
  603, 635,  667, 699,  731, 763,  795, 827,  859, 891,  923, 955,  987, 1019,
  28,  60,   92,  124,  156, 188,  220, 252,  284, 316,  348, 380,  412, 444,
  476, 508,  540, 572,  604, 636,  668, 700,  732, 764,  796, 828,  860, 892,
  924, 956,  988, 1020, 29,  61,   93,  125,  157, 189,  221, 253,  285, 317,
  349, 381,  413, 445,  477, 509,  541, 573,  605, 637,  669, 701,  733, 765,
  797, 829,  861, 893,  925, 957,  989, 1021, 30,  62,   94,  126,  158, 190,
  222, 254,  286, 318,  350, 382,  414, 446,  478, 510,  542, 574,  606, 638,
  670, 702,  734, 766,  798, 830,  862, 894,  926, 958,  990, 1022, 31,  63,
  95,  127,  159, 191,  223, 255,  287, 319,  351, 383,  415, 447,  479, 511,
  543, 575,  607, 639,  671, 703,  735, 767,  799, 831,  863, 895,  927, 959,
  991, 1023,
585 586 587
};

DECLARE_ALIGNED(16, static const int16_t, mrow_scan_32x32[1024]) = {
clang-format's avatar
clang-format committed
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666
  0,    1,    2,    3,    4,    5,    6,    7,    8,    9,    10,   11,   12,
  13,   14,   15,   16,   17,   18,   19,   20,   21,   22,   23,   24,   25,
  26,   27,   28,   29,   30,   31,   32,   33,   34,   35,   36,   37,   38,
  39,   40,   41,   42,   43,   44,   45,   46,   47,   48,   49,   50,   51,
  52,   53,   54,   55,   56,   57,   58,   59,   60,   61,   62,   63,   64,
  65,   66,   67,   68,   69,   70,   71,   72,   73,   74,   75,   76,   77,
  78,   79,   80,   81,   82,   83,   84,   85,   86,   87,   88,   89,   90,
  91,   92,   93,   94,   95,   96,   97,   98,   99,   100,  101,  102,  103,
  104,  105,  106,  107,  108,  109,  110,  111,  112,  113,  114,  115,  116,
  117,  118,  119,  120,  121,  122,  123,  124,  125,  126,  127,  128,  129,
  130,  131,  132,  133,  134,  135,  136,  137,  138,  139,  140,  141,  142,
  143,  144,  145,  146,  147,  148,  149,  150,  151,  152,  153,  154,  155,
  156,  157,  158,  159,  160,  161,  162,  163,  164,  165,  166,  167,  168,
  169,  170,  171,  172,  173,  174,  175,  176,  177,  178,  179,  180,  181,
  182,  183,  184,  185,  186,  187,  188,  189,  190,  191,  192,  193,  194,
  195,  196,  197,  198,  199,  200,  201,  202,  203,  204,  205,  206,  207,
  208,  209,  210,  211,  212,  213,  214,  215,  216,  217,  218,  219,  220,
  221,  222,  223,  224,  225,  226,  227,  228,  229,  230,  231,  232,  233,
  234,  235,  236,  237,  238,  239,  240,  241,  242,  243,  244,  245,  246,
  247,  248,  249,  250,  251,  252,  253,  254,  255,  256,  257,  258,  259,
  260,  261,  262,  263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
  273,  274,  275,  276,  277,  278,  279,  280,  281,  282,  283,  284,  285,
  286,  287,  288,  289,  290,  291,  292,  293,  294,  295,  296,  297,  298,
  299,  300,  301,  302,  303,  304,  305,  306,  307,  308,  309,  310,  311,
  312,  313,  314,  315,  316,  317,  318,  319,  320,  321,  322,  323,  324,
  325,  326,  327,  328,  329,  330,  331,  332,  333,  334,  335,  336,  337,
  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
  351,  352,  353,  354,  355,  356,  357,  358,  359,  360,  361,  362,  363,
  364,  365,  366,  367,  368,  369,  370,  371,  372,  373,  374,  375,  376,
  377,  378,  379,  380,  381,  382,  383,  384,  385,  386,  387,  388,  389,
  390,  391,  392,  393,  394,  395,  396,  397,  398,  399,  400,  401,  402,
  403,  404,  405,  406,  407,  408,  409,  410,  411,  412,  413,  414,  415,
  416,  417,  418,  419,  420,  421,  422,  423,  424,  425,  426,  427,  428,
  429,  430,  431,  432,  433,  434,  435,  436,  437,  438,  439,  440,  441,
  442,  443,  444,  445,  446,  447,  448,  449,  450,  451,  452,  453,  454,
  455,  456,  457,  458,  459,  460,  461,  462,  463,  464,  465,  466,  467,
  468,  469,  470,  471,  472,  473,  474,  475,  476,  477,  478,  479,  480,
  481,  482,  483,  484,  485,  486,  487,  488,  489,  490,  491,  492,  493,
  494,  495,  496,  497,  498,  499,  500,  501,  502,  503,  504,  505,  506,
  507,  508,  509,  510,  511,  512,  513,  514,  515,  516,  517,  518,  519,
  520,  521,  522,  523,  524,  525,  526,  527,  528,  529,  530,  531,  532,
  533,  534,  535,  536,  537,  538,  539,  540,  541,  542,  543,  544,  545,
  546,  547,  548,  549,  550,  551,  552,  553,  554,  555,  556,  557,  558,
  559,  560,  561,  562,  563,  564,  565,  566,  567,  568,  569,  570,  571,
  572,  573,  574,  575,  576,  577,  578,  579,  580,  581,  582,  583,  584,
  585,  586,  587,  588,  589,  590,  591,  592,  593,  594,  595,  596,  597,
  598,  599,  600,  601,  602,  603,  604,  605,  606,  607,  608,  609,  610,
  611,  612,  613,  614,  615,  616,  617,  618,  619,  620,  621,  622,  623,
  624,  625,  626,  627,  628,  629,  630,  631,  632,  633,  634,  635,  636,
  637,  638,  639,  640,  641,  642,  643,  644,  645,  646,  647,  648,  649,
  650,  651,  652,  653,  654,  655,  656,  657,  658,  659,  660,  661,  662,
  663,  664,  665,  666,  667,  668,  669,  670,  671,  672,  673,  674,  675,
  676,  677,  678,  679,  680,  681,  682,  683,  684,  685,  686,  687,  688,
  689,  690,  691,  692,  693,  694,  695,  696,  697,  698,  699,  700,  701,
  702,  703,  704,  705,  706,  707,  708,  709,  710,  711,  712,  713,  714,
  715,  716,  717,  718,  719,  720,  721,  722,  723,  724,  725,  726,  727,
  728,  729,  730,  731,  732,  733,  734,  735,  736,  737,  738,  739,  740,
  741,  742,  743,  744,  745,  746,  747,  748,  749,  750,  751,  752,  753,
  754,  755,  756,  757,  758,  759,  760,  761,  762,  763,  764,  765,  766,
  767,  768,  769,  770,  771,  772,  773,  774,  775,  776,  777,  778,  779,
  780,  781,  782,  783,  784,  785,  786,  787,  788,  789,  790,  791,  792,
  793,  794,  795,  796,  797,  798,  799,  800,  801,  802,  803,  804,  805,
  806,  807,  808,  809,  810,  811,  812,  813,  814,  815,  816,  817,  818,
  819,  820,  821,  822,  823,  824,  825,  826,  827,  828,  829,  830,  831,
  832,  833,  834,  835,  836,  837,  838,  839,  840,  841,  842,  843,  844,
  845,  846,  847,  848,  849,  850,  851,  852,  853,  854,  855,  856,  857,
  858,  859,  860,  861,  862,  863,  864,  865,  866,  867,  868,  869,  870,
  871,  872,  873,  874,  875,  876,  877,  878,  879,  880,  881,  882,  883,
  884,  885,  886,  887,  888,  889,  890,  891,  892,  893,  894,  895,  896,
  897,  898,  899,  900,  901,  902,  903,  904,  905,  906,  907,  908,  909,
  910,  911,  912,  913,  914,  915,  916,  917,  918,  919,  920,  921,  922,
  923,  924,  925,  926,  927,  928,  929,  930,  931,  932,  933,  934,  935,
  936,  937,  938,  939,  940,  941,  942,  943,  944,  945,  946,  947,  948,
  949,  950,  951,  952,  953,  954,  955,  956,  957,  958,  959,  960,  961,
  962,  963,  964,  965,  966,  967,  968,  969,  970,  971,  972,  973,  974,
  975,  976,  977,  978,  979,  980,  981,  982,  983,  984,  985,  986,  987,
  988,  989,  990,  991,  992,  993,  994,  995,  996,  997,  998,  999,  1000,
  1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013,
  1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023,
667
};
hui su's avatar
hui su committed
668
#endif  // CONFIG_EXT_TX
669

Jingning Han's avatar
Jingning Han committed
670
DECLARE_ALIGNED(16, static const int16_t, default_scan_32x32[1024]) = {
clang-format's avatar
clang-format committed
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
  0,    32,   1,    64,  33,   2,    96,   65,   34,   128,  3,    97,   66,
  160,  129,  35,   98,  4,    67,   130,  161,  192,  36,   99,   224,  5,
  162,  193,  68,   131, 37,   100,  225,  194,  256,  163,  69,   132,  6,
  226,  257,  288,  195, 101,  164,  38,   258,  7,    227,  289,  133,  320,
  70,   196,  165,  290, 259,  228,  39,   321,  102,  352,  8,    197,  71,
  134,  322,  291,  260, 353,  384,  229,  166,  103,  40,   354,  323,  292,
  135,  385,  198,  261, 72,   9,    416,  167,  386,  355,  230,  324,  104,
  293,  41,   417,  199, 136,  262,  387,  448,  325,  356,  10,   73,   418,
  231,  168,  449,  294, 388,  105,  419,  263,  42,   200,  357,  450,  137,
  480,  74,   326,  232, 11,   389,  169,  295,  420,  106,  451,  481,  358,
  264,  327,  201,  43,  138,  512,  482,  390,  296,  233,  170,  421,  75,
  452,  359,  12,   513, 265,  483,  328,  107,  202,  514,  544,  422,  391,
  453,  139,  44,   234, 484,  297,  360,  171,  76,   515,  545,  266,  329,
  454,  13,   423,  203, 108,  546,  485,  576,  298,  235,  140,  361,  330,
  172,  547,  45,   455, 267,  577,  486,  77,   204,  362,  608,  14,   299,
  578,  109,  236,  487, 609,  331,  141,  579,  46,   15,   173,  610,  363,
  78,   205,  16,   110, 237,  611,  142,  47,   174,  79,   206,  17,   111,
  238,  48,   143,  80,  175,  112,  207,  49,   18,   239,  81,   113,  19,
  50,   82,   114,  51,  83,   115,  640,  516,  392,  268,  144,  20,   672,
  641,  548,  517,  424, 393,  300,  269,  176,  145,  52,   21,   704,  673,
  642,  580,  549,  518, 456,  425,  394,  332,  301,  270,  208,  177,  146,
  84,   53,   22,   736, 705,  674,  643,  612,  581,  550,  519,  488,  457,
  426,  395,  364,  333, 302,  271,  240,  209,  178,  147,  116,  85,   54,
  23,   737,  706,  675, 613,  582,  551,  489,  458,  427,  365,  334,  303,
  241,  210,  179,  117, 86,   55,   738,  707,  614,  583,  490,  459,  366,
  335,  242,  211,  118, 87,   739,  615,  491,  367,  243,  119,  768,  644,
  520,  396,  272,  148, 24,   800,  769,  676,  645,  552,  521,  428,  397,
  304,  273,  180,  149, 56,   25,   832,  801,  770,  708,  677,  646,  584,
  553,  522,  460,  429, 398,  336,  305,  274,  212,  181,  150,  88,   57,
  26,   864,  833,  802, 771,  740,  709,  678,  647,  616,  585,  554,  523,
  492,  461,  430,  399, 368,  337,  306,  275,  244,  213,  182,  151,  120,
  89,   58,   27,   865, 834,  803,  741,  710,  679,  617,  586,  555,  493,
  462,  431,  369,  338, 307,  245,  214,  183,  121,  90,   59,   866,  835,
  742,  711,  618,  587, 494,  463,  370,  339,  246,  215,  122,  91,   867,
  743,  619,  495,  371, 247,  123,  896,  772,  648,  524,  400,  276,  152,
  28,   928,  897,  804, 773,  680,  649,  556,  525,  432,  401,  308,  277,
  184,  153,  60,   29,  960,  929,  898,  836,  805,  774,  712,  681,  650,
  588,  557,  526,  464, 433,  402,  340,  309,  278,  216,  185,  154,  92,
  61,   30,   992,  961, 930,  899,  868,  837,  806,  775,  744,  713,  682,
  651,  620,  589,  558, 527,  496,  465,  434,  403,  372,  341,  310,  279,
  248,  217,  186,  155, 124,  93,   62,   31,   993,  962,  931,  869,  838,
  807,  745,  714,  683, 621,  590,  559,  497,  466,  435,  373,  342,  311,
  249,  218,  187,  125, 94,   63,   994,  963,  870,  839,  746,  715,  622,
  591,  498,  467,  374, 343,  250,  219,  126,  95,   995,  871,  747,  623,
  499,  375,  251,  127, 900,  776,  652,  528,  404,  280,  156,  932,  901,
  808,  777,  684,  653, 560,  529,  436,  405,  312,  281,  188,  157,  964,
  933,  902,  840,  809, 778,  716,  685,  654,  592,  561,  530,  468,  437,
  406,  344,  313,  282, 220,  189,  158,  996,  965,  934,  903,  872,  841,
  810,  779,  748,  717, 686,  655,  624,  593,  562,  531,  500,  469,  438,
  407,  376,  345,  314, 283,  252,  221,  190,  159,  997,  966,  935,  873,
  842,  811,  749,  718, 687,  625,  594,  563,  501,  470,  439,  377,  346,
  315,  253,  222,  191, 998,  967,  874,  843,  750,  719,  626,  595,  502,
  471,  378,  347,  254, 223,  999,  875,  751,  627,  503,  379,  255,  904,
  780,  656,  532,  408, 284,  936,  905,  812,  781,  688,  657,  564,  533,
  440,  409,  316,  285, 968,  937,  906,  844,  813,  782,  720,  689,  658,
  596,  565,  534,  472, 441,  410,  348,  317,  286,  1000, 969,  938,  907,
  876,  845,  814,  783, 752,  721,  690,  659,  628,  597,  566,  535,  504,
  473,  442,  411,  380, 349,  318,  287,  1001, 970,  939,  877,  846,  815,
  753,  722,  691,  629, 598,  567,  505,  474,  443,  381,  350,  319,  1002,
  971,  878,  847,  754, 723,  630,  599,  506,  475,  382,  351,  1003, 879,
  755,  631,  507,  383, 908,  784,  660,  536,  412,  940,  909,  816,  785,
  692,  661,  568,  537, 444,  413,  972,  941,  910,  848,  817,  786,  724,
  693,  662,  600,  569, 538,  476,  445,  414,  1004, 973,  942,  911,  880,
  849,  818,  787,  756, 725,  694,  663,  632,  601,  570,  539,  508,  477,
  446,  415,  1005, 974, 943,  881,  850,  819,  757,  726,  695,  633,  602,
  571,  509,  478,  447, 1006, 975,  882,  851,  758,  727,  634,  603,  510,
  479,  1007, 883,  759, 635,  511,  912,  788,  664,  540,  944,  913,  820,
  789,  696,  665,  572, 541,  976,  945,  914,  852,  821,  790,  728,  697,
  666,  604,  573,  542, 1008, 977,  946,  915,  884,  853,  822,  791,  760,
  729,  698,  667,  636, 605,  574,  543,  1009, 978,  947,  885,  854,  823,
  761,  730,  699,  637, 606,  575,  1010, 979,  886,  855,  762,  731,  638,
  607,  1011, 887,  763, 639,  916,  792,  668,  948,  917,  824,  793,  700,
  669,  980,  949,  918, 856,  825,  794,  732,  701,  670,  1012, 981,  950,
  919,  888,  857,  826, 795,  764,  733,  702,  671,  1013, 982,  951,  889,
  858,  827,  765,  734, 703,  1014, 983,  890,  859,  766,  735,  1015, 891,
  767,  920,  796,  952, 921,  828,  797,  984,  953,  922,  860,  829,  798,
  1016, 985,  954,  923, 892,  861,  830,  799,  1017, 986,  955,  893,  862,
  831,  1018, 987,  894, 863,  1019, 895,  924,  956,  925,  988,  957,  926,
  1020, 989,  958,  927, 1021, 990,  959,  1022, 991,  1023,
Jingning Han's avatar
Jingning Han committed
750 751
};

752 753 754
#if CONFIG_EXT_TX
// Scan over two rectangular vertical partitions one after the other
DECLARE_ALIGNED(16, static const int16_t, v2_scan_32x32[1024]) = {
clang-format's avatar
clang-format committed
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
  0,    1,    32,   33,   2,    64,   34,   65,   66,   3,    96,   35,   97,
  67,   98,   4,    128,  36,   129,  99,   68,   130,  5,    100,  131,  160,
  37,   161,  69,   162,  132,  101,  163,  6,    192,  38,   193,  70,   194,
  133,  164,  102,  195,  7,    224,  39,   165,  225,  134,  196,  71,   226,
  103,  227,  166,  197,  8,    256,  40,   135,  228,  257,  72,   258,  198,
  104,  259,  167,  229,  136,  260,  9,    288,  41,   289,  73,   199,  230,
  290,  168,  261,  105,  291,  137,  292,  231,  10,   200,  262,  320,  42,
  321,  74,   322,  169,  293,  106,  323,  232,  263,  138,  324,  201,  294,
  11,   352,  43,   353,  75,   170,  325,  354,  264,  107,  233,  295,  355,
  202,  326,  139,  356,  12,   384,  44,   265,  296,  385,  171,  357,  76,
  386,  234,  327,  108,  387,  203,  358,  140,  388,  297,  266,  328,  13,
  172,  389,  416,  45,   235,  359,  417,  77,   418,  109,  419,  204,  390,
  298,  329,  141,  267,  360,  420,  236,  391,  173,  421,  14,   448,  46,
  449,  78,   330,  450,  299,  361,  110,  205,  422,  451,  268,  392,  142,
  452,  237,  423,  174,  331,  362,  453,  15,   300,  393,  480,  47,   481,
  79,   482,  206,  454,  269,  424,  111,  483,  143,  484,  363,  332,  394,
  238,  455,  175,  301,  425,  485,  512,  513,  270,  456,  514,  207,  486,
  364,  395,  515,  333,  426,  516,  239,  487,  302,  457,  517,  396,  271,
  488,  544,  365,  427,  545,  518,  546,  334,  458,  547,  519,  548,  303,
  489,  397,  428,  549,  366,  459,  520,  576,  335,  490,  550,  577,  578,
  579,  521,  429,  551,  398,  460,  580,  367,  491,  581,  552,  522,  582,
  608,  609,  430,  461,  610,  399,  492,  553,  611,  583,  523,  612,  613,
  584,  554,  462,  431,  493,  614,  524,  640,  641,  642,  585,  643,  555,
  615,  644,  463,  494,  586,  525,  616,  645,  556,  646,  672,  617,  673,
  587,  674,  647,  495,  675,  526,  676,  557,  618,  648,  677,  588,  678,
  527,  649,  619,  704,  558,  705,  706,  679,  589,  707,  650,  708,  620,
  680,  709,  559,  590,  710,  651,  681,  736,  621,  737,  711,  738,  739,
  682,  652,  740,  712,  591,  741,  622,  683,  713,  742,  653,  768,  769,
  743,  770,  714,  684,  771,  623,  772,  744,  654,  773,  715,  685,  745,
  774,  655,  775,  800,  801,  716,  746,  802,  803,  686,  776,  804,  747,
  805,  717,  777,  806,  687,  748,  807,  778,  832,  833,  718,  834,  835,
  808,  836,  779,  749,  837,  809,  719,  838,  780,  750,  810,  839,  864,
  865,  866,  867,  840,  781,  868,  811,  751,  869,  841,  870,  812,  782,
  842,  871,  896,  897,  898,  872,  899,  813,  843,  900,  783,  901,  873,
  844,  902,  814,  874,  903,  928,  929,  845,  930,  904,  815,  875,  931,
  932,  905,  933,  846,  876,  934,  906,  935,  877,  960,  847,  961,  962,
  907,  936,  963,  964,  937,  878,  965,  908,  966,  938,  967,  909,  879,
  992,  939,  993,  968,  994,  995,  996,  910,  969,  940,  997,  998,  970,
  911,  941,  999,  971,  1000, 942,  1001, 972,  1002, 943,  973,  1003, 974,
  1004, 975,  1005, 1006, 1007, 16,   48,   80,   112,  144,  176,  17,   49,
  208,  81,   113,  145,  240,  177,  272,  18,   50,   209,  82,   114,  304,
  241,  146,  178,  273,  336,  210,  19,   51,   83,   115,  305,  242,  147,
  368,  179,  274,  337,  211,  20,   400,  52,   84,   306,  116,  243,  369,
  148,  338,  180,  275,  432,  401,  212,  21,   53,   307,  85,   370,  244,
  117,  464,  149,  433,  339,  276,  181,  402,  213,  308,  496,  371,  22,
  54,   465,  86,   245,  118,  434,  150,  340,  277,  403,  182,  528,  497,
  214,  466,  372,  309,  23,   55,   435,  87,   246,  119,  341,  404,  151,
  529,  560,  278,  498,  183,  467,  373,  215,  310,  436,  24,   56,   247,
  561,  88,   530,  592,  342,  120,  405,  499,  152,  279,  468,  184,  374,
  311,  437,  216,  562,  593,  531,  624,  25,   248,  500,  57,   406,  89,
  343,  121,  469,  280,  153,  594,  185,  375,  563,  625,  438,  532,  656,
  312,  217,  501,  407,  249,  26,   344,  58,   90,   470,  122,  595,  626,
  281,  564,  657,  154,  376,  533,  688,  439,  186,  313,  502,  218,  408,
  627,  596,  658,  250,  345,  471,  27,   59,   565,  689,  91,   123,  282,
  534,  720,  155,  440,  377,  187,  503,  314,  628,  659,  219,  597,  690,
  409,  472,  566,  721,  346,  251,  28,   60,   535,  752,  92,   124,  283,
  441,  378,  156,  660,  504,  629,  691,  598,  722,  188,  315,  567,  753,
  220,  410,  473,  347,  536,  784,  252,  29,   661,  692,  61,   93,   442,
  630,  723,  284,  125,  379,  505,  599,  754,  157,  316,  568,  785,  189,
  474,  411,  221,  537,  816,  693,  348,  662,  724,  253,  631,  755,  443,
  30,   600,  786,  62,   506,  94,   285,  380,  126,  569,  817,  158,  317,
  190,  475,  694,  725,  412,  663,  756,  538,  848,  222,  632,  787,  349,
  254,  601,  818,  444,  507,  31,   63,   381,  286,  95,   570,  849,  726,
  127,  695,  757,  664,  788,  159,  476,  318,  413,  539,  880,  191,  633,
  819,  223,  350,  602,  850,  508,  255,  445,  727,  758,  696,  789,  571,
  881,  382,  287,  665,  820,  477,  634,  851,  540,  912,  319,  414,  603,
  882,  759,  728,  790,  351,  509,  697,  821,  446,  572,  913,  666,  852,
  383,  635,  883,  478,  541,  944,  415,  760,  791,  604,  914,  729,  822,
  698,  853,  510,  667,  884,  447,  573,  945,  636,  915,  792,  761,  823,
  542,  976,  479,  730,  854,  605,  946,  699,  885,  668,  916,  511,  574,
  977,  793,  824,  637,  947,  762,  855,  731,  886,  543,  1008, 606,  978,
  700,  917,  669,  948,  575,  825,  1009, 794,  856,  763,  887,  638,  979,
  732,  918,  701,  949,  607,  1010, 670,  980,  826,  857,  795,  888,  764,
  919,  639,  1011, 733,  950,  702,  981,  858,  827,  889,  796,  920,  671,
  1012, 765,  951,  734,  982,  703,  1013, 859,  890,  828,  921,  797,  952,
  766,  983,  735,  1014, 891,  860,  922,  829,  953,  798,  984,  767,  1015,
  892,  923,  861,  954,  830,  985,  799,  1016, 924,  893,  955,  862,  986,
  831,  1017, 925,  956,  894,  987,  863,  1018, 957,  926,  988,  895,  1019,
  958,  989,  927,  1020, 990,  959,  1021, 991,  1022, 1023,
834 835 836 837
};

// Scan over two rectangular horizontal partitions one after the other
DECLARE_ALIGNED(16, static const int16_t, h2_scan_32x32[1024]) = {
clang-format's avatar
clang-format committed
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916
  0,    1,    32,   33,   2,    64,   34,   65,   66,   3,    96,   35,   97,
  67,   98,   4,    128,  36,   129,  99,   68,   130,  5,    100,  131,  160,
  37,   161,  69,   162,  132,  101,  163,  6,    192,  38,   193,  70,   194,
  133,  164,  102,  195,  7,    224,  39,   165,  225,  134,  196,  71,   226,
  103,  227,  166,  197,  8,    256,  40,   135,  228,  257,  72,   258,  198,
  104,  259,  167,  229,  136,  260,  9,    288,  41,   289,  73,   199,  230,
  290,  168,  261,  105,  291,  137,  292,  231,  10,   200,  262,  320,  42,
  321,  74,   322,  169,  293,  106,  323,  232,  263,  138,  324,  201,  294,
  11,   352,  43,   353,  75,   170,  325,  354,  264,  107,  233,  295,  355,
  202,  326,  139,  356,  12,   384,  44,   265,  296,  385,  171,  357,  76,
  386,  234,  327,  108,  387,  203,  358,  140,  388,  297,  266,  328,  13,
  172,  389,  416,  45,   235,  359,  417,  77,   418,  109,  419,  204,  390,
  298,  329,  141,  267,  360,  420,  236,  391,  173,  421,  14,   448,  46,
  449,  78,   330,  450,  299,  361,  110,  205,  422,  451,  268,  392,  142,
  452,  237,  423,  174,  331,  362,  453,  15,   300,  393,  480,  47,   481,
  79,   482,  206,  454,  269,  424,  111,  483,  143,  484,  363,  332,  394,
  238,  455,  175,  301,  425,  485,  16,   48,   80,   270,  456,  207,  486,
  112,  364,  395,  333,  426,  144,  239,  487,  302,  457,  176,  396,  17,
  271,  488,  49,   365,  427,  208,  81,   334,  458,  113,  145,  240,  303,
  489,  397,  428,  177,  366,  459,  272,  18,   50,   209,  335,  490,  82,
  114,  304,  241,  429,  146,  398,  460,  367,  491,  178,  273,  336,  210,
  19,   51,   83,   430,  461,  399,  492,  115,  305,  242,  147,  368,  179,
  274,  337,  462,  431,  493,  211,  20,   400,  52,   84,   306,  116,  243,
  369,  148,  463,  494,  338,  180,  275,  432,  401,  212,  21,   53,   307,
  85,   370,  244,  117,  495,  464,  149,  433,  339,  276,  181,  402,  213,
  308,  496,  371,  22,   54,   465,  86,   245,  118,  434,  150,  340,  277,
  403,  182,  497,  214,  466,  372,  309,  23,   55,   435,  87,   246,  119,
  341,  404,  151,  278,  498,  183,  467,  373,  215,  310,  436,  24,   56,
  247,  88,   342,  120,  405,  499,  152,  279,  468,  184,  374,  311,  437,
  216,  25,   248,  500,  57,   406,  89,   343,  121,  469,  280,  153,  185,
  375,  438,  312,  217,  501,  407,  249,  26,   344,  58,   90,   470,  122,
  281,  154,  376,  439,  186,  313,  502,  218,  408,  250,  345,  471,  27,
  59,   91,   123,  282,  155,  440,  377,  187,  503,  314,  219,  409,  472,
  346,  251,  28,   60,   92,   124,  283,  441,  378,  156,  504,  188,  315,
  220,  410,  473,  347,  252,  29,   61,   93,   442,  284,  125,  379,  505,
  157,  316,  189,  474,  411,  221,  348,  253,  443,  30,   62,   506,  94,
  285,  380,  126,  158,  317,  190,  475,  412,  222,  349,  254,  444,  507,
  31,   63,   381,  286,  95,   127,  159,  476,  318,  413,  191,  223,  350,
  508,  255,  445,  382,  287,  477,  319,  414,  351,  509,  446,  383,  478,
  415,  510,  447,  479,  511,  512,  513,  514,  515,  516,  517,  544,  545,
  518,  546,  547,  519,  548,  549,  520,  576,  550,  577,  578,  579,  521,
  551,  580,  581,  552,  522,  582,  608,  609,  610,  553,  611,  583,  523,
  612,  613,  584,  554,  614,  524,  640,  641,  642,  585,  643,  555,  615,
  644,  586,  525,  616,  645,  556,  646,  672,  617,  673,  587,  674,  647,
  675,  526,  676,  557,  618,  648,  677,  588,  678,  527,  649,  619,  704,
  558,  705,  706,  679,  589,  707,  650,  708,  620,  680,  709,  528,  559,
  590,  710,  651,  681,  736,  621,  737,  711,  738,  739,  682,  652,  529,
  560,  740,  712,  591,  741,  622,  683,  713,  742,  653,  768,  769,  561,
  743,  530,  592,  770,  714,  684,  771,  623,  772,  744,  654,  773,  715,
  685,  745,  774,  562,  593,  531,  624,  655,  775,  800,  801,  716,  746,
  802,  803,  686,  776,  804,  594,  563,  625,  747,  805,  717,  532,  656,
  777,  806,  687,  748,  807,  778,  832,  833,  718,  834,  595,  626,  835,
  564,  657,  808,  836,  533,  688,  779,  749,  837,  809,  719,  838,  780,
  627,  596,  658,  750,  810,  839,  864,  565,  689,  865,  866,  867,  534,
  720,  840,  781,  868,  811,  751,  869,  841,  628,  659,  597,  690,  870,
  812,  782,  566,  721,  842,  871,  896,  535,  752,  897,  898,  872,  899,
  813,  843,  660,  900,  783,  629,  691,  598,  722,  901,  873,  567,  753,
  844,  902,  814,  874,  536,  784,  903,  661,  692,  928,  929,  630,  723,
  845,  930,  904,  815,  875,  931,  599,  754,  932,  568,  785,  905,  933,
  846,  876,  934,  537,  816,  693,  662,  724,  906,  631,  755,  935,  877,
  600,  786,  960,  847,  961,  962,  907,  936,  963,  569,  817,  964,  937,
  694,  725,  878,  965,  908,  663,  756,  538,  848,  966,  632,  787,  938,
  601,  818,  967,  909,  879,  992,  939,  993,  968,  570,  849,  994,  726,
  695,  757,  995,  664,  788,  996,  910,  969,  539,  880,  940,  633,  819,
  997,  998,  602,  850,  970,  911,  941,  999,  727,  758,  696,  789,  571,
  881,  971,  665,  820,  1000, 634,  851,  942,  540,  912,  1001, 972,  603,
  882,  759,  728,  790,  1002, 697,  821,  943,  973,  572,  913,  666,  852,
  1003, 635,  883,  974,  541,  944,  760,  791,  1004, 604,  914,  729,  822,
  698,  853,  975,  667,  884,  573,  945,  1005, 636,  915,  792,  761,  823,
  542,  976,  1006, 730,  854,  605,  946,  699,  885,  668,  916,  1007, 574,
  977,  793,  824,  637,  947,  762,  855,  731,  886,  543,  1008, 606,  978,
  700,  917,  669,  948,  575,  825,  1009, 794,  856,  763,  887,  638,  979,
  732,  918,  701,  949,  607,  1010, 670,  980,  826,  857,  795,  888,  764,
  919,  639,  1011, 733,  950,  702,  981,  858,  827,  889,  796,  920,  671,
  1012, 765,  951,  734,  982,  703,  1013, 859,  890,  828,  921,  797,  952,
  766,  983,  735,  1014, 891,  860,  922,  829,  953,  798,  984,  767,  1015,
  892,  923,  861,  954,  830,  985,  799,  1016, 924,  893,  955,  862,  986,
  831,  1017, 925,  956,  894,  987,  863,  1018, 957,  926,  988,  895,  1019,
  958,  989,  927,  1020, 990,  959,  1021, 991,  1022, 1023,
917 918 919 920
};

// Scan where the top left quarter is scanned first
DECLARE_ALIGNED(16, static const int16_t, qtr_scan_32x32[1024]) = {
clang-format's avatar
clang-format committed
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999
  0,    1,    32,   33,   2,    64,   34,   65,   66,   3,    96,   35,   97,
  67,   98,   4,    128,  36,   129,  99,   68,   130,  5,    100,  131,  160,
  37,   161,  69,   162,  132,  101,  163,  6,    192,  38,   193,  70,   194,
  133,  164,  102,  195,  7,    224,  39,   165,  225,  134,  196,  71,   226,
  103,  227,  166,  197,  8,    256,  40,   135,  228,  257,  72,   258,  198,
  104,  259,  167,  229,  136,  260,  9,    288,  41,   289,  73,   199,  230,
  290,  168,  261,  105,  291,  137,  292,  231,  10,   200,  262,  320,  42,
  321,  74,   322,  169,  293,  106,  323,  232,  263,  138,  324,  201,  294,
  11,   352,  43,   353,  75,   170,  325,  354,  264,  107,  233,  295,  355,
  202,  326,  139,  356,  12,   384,  44,   265,  296,  385,  171,  357,  76,
  386,  234,  327,  108,  387,  203,  358,  140,  388,  297,  266,  328,  13,
  172,  389,  416,  45,   235,  359,  417,  77,   418,  109,  419,  204,  390,
  298,  329,  141,  267,  360,  420,  236,  391,  173,  421,  14,   448,  46,
  449,  78,   330,  450,  299,  361,  110,  205,  422,  451,  268,  392,  142,
  452,  237,  423,  174,  331,  362,  453,  15,   300,  393,  480,  47,   481,
  79,   482,  206,  454,  269,  424,  111,  483,  143,  484,  363,  332,  394,
  238,  455,  175,  301,  425,  485,  270,  456,  207,  486,  364,  395,  333,
  426,  239,  487,  302,  457,  396,  271,  488,  365,  427,  334,  458,  303,
  489,  397,  428,  366,  459,  335,  490,  429,  398,  460,  367,  491,  430,
  461,  399,  492,  462,  431,  493,  463,  494,  495,  16,   512,  48,   513,
  80,   514,  112,  515,  144,  516,  176,  517,  17,   544,  49,   545,  208,
  518,  81,   546,  113,  547,  145,  240,  519,  548,  177,  549,  272,  520,
  18,   576,  50,   209,  550,  577,  82,   578,  114,  579,  304,  521,  241,
  551,  146,  580,  178,  581,  273,  552,  336,  522,  210,  582,  19,   608,
  51,   609,  83,   610,  115,  305,  553,  611,  242,  583,  147,  368,  523,
  612,  179,  613,  274,  584,  337,  554,  211,  614,  20,   400,  524,  640,
  52,   641,  84,   642,  306,  585,  116,  643,  243,  369,  555,  615,  148,
  644,  338,  586,  180,  275,  432,  525,  616,  645,  401,  556,  212,  646,
  21,   672,  53,   307,  617,  673,  85,   370,  587,  674,  244,  647,  117,
  675,  464,  526,  149,  676,  433,  557,  339,  618,  276,  648,  181,  677,
  402,  588,  213,  678,  308,  496,  527,  649,  371,  619,  22,   704,  54,
  465,  558,  705,  86,   706,  245,  679,  118,  434,  589,  707,  150,  340,
  650,  708,  277,  403,  620,  680,  182,  709,  528,  497,  559,  214,  466,
  590,  710,  372,  651,  309,  681,  23,   736,  55,   435,  621,  737,  87,
  246,  711,  738,  119,  739,  341,  682,  404,  652,  151,  529,  560,  740,
  278,  712,  498,  591,  183,  741,  467,  622,  373,  683,  215,  310,  713,
  742,  436,  653,  24,   768,  56,   769,  247,  561,  743,  88,   530,  592,
  770,  342,  714,  120,  405,  684,  771,  499,  623,  152,  772,  279,  744,
  468,  654,  184,  773,  374,  715,  311,  437,  685,  745,  216,  774,  562,
  593,  531,  624,  25,   248,  500,  655,  775,  800,  57,   801,  406,  716,
  89,   343,  746,  802,  121,  803,  469,  686,  280,  776,  153,  804,  594,
  185,  375,  563,  625,  747,  805,  438,  717,  532,  656,  312,  777,  217,
  806,  501,  687,  407,  748,  249,  807,  26,   344,  778,  832,  58,   833,
  90,   470,  718,  834,  122,  595,  626,  835,  281,  564,  657,  808,  154,
  836,  376,  533,  688,  779,  439,  749,  186,  837,  313,  809,  502,  719,
  218,  838,  408,  780,  627,  596,  658,  250,  345,  471,  750,  810,  839,
  27,   864,  59,   565,  689,  865,  91,   866,  123,  867,  282,  534,  720,
  840,  155,  440,  781,  868,  377,  811,  187,  503,  751,  869,  314,  841,
  628,  659,  219,  597,  690,  870,  409,  812,  472,  782,  566,  721,  346,
  842,  251,  871,  28,   896,  60,   535,  752,  897,  92,   898,  124,  283,
  872,  899,  441,  813,  378,  843,  156,  660,  900,  504,  783,  629,  691,
  598,  722,  188,  901,  315,  873,  567,  753,  220,  410,  844,  902,  473,
  814,  347,  874,  536,  784,  252,  903,  29,   661,  692,  928,  61,   929,
  93,   442,  630,  723,  845,  930,  284,  904,  125,  379,  505,  815,  875,
  931,  599,  754,  157,  932,  316,  568,  785,  905,  189,  933,  474,  846,
  411,  876,  221,  934,  537,  816,  693,  348,  662,  724,  906,  253,  631,
  755,  935,  443,  877,  30,   600,  786,  960,  62,   506,  847,  961,  94,
  962,  285,  380,  907,  936,  126,  963,  569,  817,  158,  964,  317,  937,
  190,  475,  694,  725,  878,  965,  412,  908,  663,  756,  538,  848,  222,
  966,  632,  787,  349,  938,  254,  601,  818,  967,  444,  909,  507,  879,
  31,   992,  63,   381,  939,  993,  286,  968,  95,   570,  849,  994,  726,
  127,  695,  757,  995,  664,  788,  159,  996,  476,  910,  318,  969,  413,
  539,  880,  940,  191,  633,  819,  997,  223,  998,  350,  602,  850,  970,
  508,  911,  255,  445,  941,  999,  727,  758,  696,  789,  571,  881,  382,
  971,  287,  665,  820,  1000, 477,  634,  851,  942,  540,  912,  319,  1001,
  414,  972,  603,  882,  759,  728,  790,  351,  1002, 509,  697,  821,  943,
  446,  973,  572,  913,  666,  852,  383,  1003, 635,  883,  478,  974,  541,
  944,  415,  760,  791,  1004, 604,  914,  729,  822,  698,  853,  510,  975,
  667,  884,  447,  573,  945,  1005, 636,  915,  792,  761,  823,  542,  976,
  479,  1006, 730,  854,  605,  946,  699,  885,  668,  916,  511,  1007, 574,
  977,  793,  824,  637,  947,  762,  855,  731,  886,  543,  1008, 606,  978,
  700,  917,  669,  948,  575,  825,  1009, 794,  856,  763,  887,  638,  979,
  732,  918,  701,  949,  607,  1010, 670,  980,  826,  857,  795,  888,  764,
  919,  639,  1011, 733,  950,  702,  981,  858,  827,  889,  796,  920,  671,
  1012, 765,  951,  734,  982,  703,  1013, 859,  890,  828,  921,  797,  952,
  766,  983,  735,  1014, 891,  860,  922,  829,  953,  798,  984,  767,  1015,
  892,  923,  861,  954,  830,  985,  799,  1016, 924,  893,  955,  862,  986,
  831,  1017, 925,  956,  894,  987,  863,  1018, 957,  926,  988,  895,  1019,
  958,  989,  927,  1020, 990,  959,  1021, 991,  1022, 1023,
1000 1001 1002
};
#endif  // CONFIG_EXT_TX

1003 1004
// Neighborhood 2-tuples for various scans and blocksizes,
// in {top, left} order for each position in corresponding scan order.
Jingning Han's avatar
Jingning Han committed
1005 1006
DECLARE_ALIGNED(16, static const int16_t,
                default_scan_4x4_neighbors[17 * MAX_NEIGHBORS]) = {
clang-format's avatar
clang-format committed
1007 1008
  0, 0, 0, 0, 4,  0, 1, 4, 4, 5,  5,  1, 8,  8,  5,  8, 2,
  2, 2, 5, 9, 12, 6, 9, 3, 6, 10, 13, 7, 10, 11, 14, 0, 0,
Jingning Han's avatar
Jingning Han committed
1009 1010
};

hui su's avatar
hui su committed
1011
#if CONFIG_EXT_TX
1012 1013
DECLARE_ALIGNED(16, static const int16_t,
                mcol_scan_4x4_neighbors[17 * MAX_NEIGHBORS]) = {
clang-format's avatar
clang-format committed
1014 1015
  0, 0, 0, 0, 4, 4,  8,  8, 0, 0, 1, 4, 5,  8,  9,  12, 1,
  1, 2, 5, 6, 9, 10, 13, 2, 2, 3, 6, 7, 10, 11, 14, 0,  0,
1016 1017 1018 1019
};

DECLARE_ALIGNED(16, static const int16_t,
                mrow_scan_4x4_neighbors[17 * MAX_NEIGHBORS]) = {
clang-format's avatar
clang-format committed
1020 1021
  0, 0, 0, 0, 1, 1, 2,  2, 0, 0, 1,  4,  2,  5,  3,  6, 4,
  4, 5, 8, 6, 9, 7, 10, 8, 8, 9, 12, 10, 13, 11, 14, 0, 0,