common_data.h 48.4 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
 */

Yaowu Xu's avatar
Yaowu Xu committed
12 13
#ifndef AV1_COMMON_COMMON_DATA_H_
#define AV1_COMMON_COMMON_DATA_H_
Jingning Han's avatar
Jingning Han committed
14

15
#include "av1/common/enums.h"
Yaowu Xu's avatar
Yaowu Xu committed
16 17
#include "aom/aom_integer.h"
#include "aom_dsp/aom_dsp_common.h"
Jingning Han's avatar
Jingning Han committed
18 19 20 21 22

#ifdef __cplusplus
extern "C" {
#endif

23
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
24
#define IF_EXT_PARTITION(...) __VA_ARGS__
25
#else
clang-format's avatar
clang-format committed
26
#define IF_EXT_PARTITION(...)
27 28
#endif

Jingning Han's avatar
Jingning Han committed
29
// Log 2 conversion lookup tables for block width and height
clang-format's avatar
clang-format committed
30
static const uint8_t b_width_log2_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
31 32 33
#if CONFIG_CB4X4
  0, 0, 0,
#endif
clang-format's avatar
clang-format committed
34 35 36
  0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
};
static const uint8_t b_height_log2_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
37 38 39
#if CONFIG_CB4X4
  0, 0, 0,
#endif
clang-format's avatar
clang-format committed
40 41
  0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
};
Jingning Han's avatar
Jingning Han committed
42
// Log 2 conversion lookup tables for modeinfo width and height
clang-format's avatar
clang-format committed
43
static const uint8_t mi_width_log2_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
44
#if CONFIG_CB4X4
45 46
  0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
#else
clang-format's avatar
clang-format committed
47
  0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4)
48
#endif
clang-format's avatar
clang-format committed
49 50
};
static const uint8_t mi_height_log2_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
51
#if CONFIG_CB4X4
52 53
  0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
#else
clang-format's avatar
clang-format committed
54
  0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4)
55
#endif
clang-format's avatar
clang-format committed
56
};
57

58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
static const uint8_t mi_size_wide[BLOCK_SIZES] = {
#if CONFIG_CB4X4
  1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
#else
  1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
#endif
};
static const uint8_t mi_size_high[BLOCK_SIZES] = {
#if CONFIG_CB4X4
  1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
#else
  1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
#endif
};

73
// Width/height lookup tables in units of various block sizes
74
static const uint8_t block_size_wide[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
75 76 77
#if CONFIG_CB4X4
  2, 2, 4,
#endif
78 79
  4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128)
};
80

81
static const uint8_t block_size_high[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
82 83 84
#if CONFIG_CB4X4
  2, 4, 2,
#endif
85 86
  4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128)
};
87

clang-format's avatar
clang-format committed
88
static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
89 90 91
#if CONFIG_CB4X4
  1, 1, 1,
#endif
clang-format's avatar
clang-format committed
92 93 94
  1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
};
static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
95 96 97
#if CONFIG_CB4X4
  1, 1, 1,
#endif
clang-format's avatar
clang-format committed
98 99 100
  1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
};
static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
101 102 103
#if CONFIG_CB4X4
  1, 1, 1,
#endif
clang-format's avatar
clang-format committed
104 105 106
  1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
};
static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
107 108 109
#if CONFIG_CB4X4
  1, 1, 1,
#endif
clang-format's avatar
clang-format committed
110 111 112
  1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
};
static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
113 114 115
#if CONFIG_CB4X4
  1, 1, 1,
#endif
clang-format's avatar
clang-format committed
116 117 118
  1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8)
};
static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
119 120 121
#if CONFIG_CB4X4
  1, 1, 1,
#endif
clang-format's avatar
clang-format committed
122 123
  1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8)
};
Jingning Han's avatar
Jingning Han committed
124

Yaowu Xu's avatar
Yaowu Xu committed
125
// AOMMIN(3, AOMMIN(b_width_log2(bsize), b_height_log2(bsize)))
clang-format's avatar
clang-format committed
126
static const uint8_t size_group_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
127 128 129
#if CONFIG_CB4X4
  0, 0, 0,
#endif
clang-format's avatar
clang-format committed
130 131
  0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, IF_EXT_PARTITION(3, 3, 3)
};
Jingning Han's avatar
Jingning Han committed
132

clang-format's avatar
clang-format committed
133
static const uint8_t num_pels_log2_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
134 135 136
#if CONFIG_CB4X4
  2, 3, 3,
#endif
clang-format's avatar
clang-format committed
137 138
  4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14)
};
Jingning Han's avatar
Jingning Han committed
139

clang-format's avatar
clang-format committed
140
/* clang-format off */
141 142 143
static const PARTITION_TYPE
  partition_lookup[MAX_SB_SIZE_LOG2 - 1][BLOCK_SIZES] = {
  {     // 4X4 ->
Jingning Han's avatar
Jingning Han committed
144 145 146 147
#if CONFIG_CB4X4
    // 2X2,            2X4,               4X2,
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif
148 149 150 151 152 153 154 155 156 157 158 159 160 161
    //                                    4X4
                                          PARTITION_NONE,
    // 4X8,            8X4,               8X8
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
    // 8X16,           16X8,              16X16
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
    // 16X32,          32X16,             32X32
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
    // 32X64,          64X32,             64X64
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#if CONFIG_EXT_PARTITION
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif  // CONFIG_EXT_PARTITION
  }, {  // 8X8 ->
Jingning Han's avatar
Jingning Han committed
162 163 164 165
#if CONFIG_CB4X4
    // 2X2,            2X4,               4X2,
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif
166 167 168 169 170 171 172 173 174
    //                                    4X4
                                          PARTITION_SPLIT,
    // 4X8,            8X4,               8X8
    PARTITION_VERT,    PARTITION_HORZ,    PARTITION_NONE,
    // 8X16,           16X8,              16X16
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
    // 16X32,          32X16,             32X32
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
    // 32X64,          64X32,             64X64
Jingning Han's avatar
Jingning Han committed
175
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
176 177
#if CONFIG_EXT_PARTITION
    // 64x128,         128x64,            128x128
Jingning Han's avatar
Jingning Han committed
178
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
179 180
#endif  // CONFIG_EXT_PARTITION
  }, {  // 16X16 ->
Jingning Han's avatar
Jingning Han committed
181 182 183 184
#if CONFIG_CB4X4
    // 2X2,            2X4,               4X2,
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif
185 186 187 188 189 190 191
    //                                    4X4
                                          PARTITION_SPLIT,
    // 4X8,            8X4,               8X8
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 8X16,           16X8,              16X16
    PARTITION_VERT,    PARTITION_HORZ,    PARTITION_NONE,
    // 16X32,          32X16,             32X32
Jingning Han's avatar
Jingning Han committed
192
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
193
    // 32X64,          64X32,             64X64
Jingning Han's avatar
Jingning Han committed
194
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
195 196
#if CONFIG_EXT_PARTITION
    // 64x128,         128x64,            128x128
Jingning Han's avatar
Jingning Han committed
197
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
198 199
#endif  // CONFIG_EXT_PARTITION
  }, {  // 32X32 ->
Jingning Han's avatar
Jingning Han committed
200 201 202 203
#if CONFIG_CB4X4
    // 2X2,            2X4,               4X2,
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif
204 205 206 207 208 209 210 211 212
    //                                    4X4
                                          PARTITION_SPLIT,
    // 4X8,            8X4,               8X8
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 8X16,           16X8,              16X16
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 16X32,          32X16,             32X32
    PARTITION_VERT,    PARTITION_HORZ,    PARTITION_NONE,
    // 32X64,          64X32,             64X64
Jingning Han's avatar
Jingning Han committed
213
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
214 215 216 217 218
#if CONFIG_EXT_PARTITION
    // 64x128,         128x64,            128x128
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif  // CONFIG_EXT_PARTITION
  }, {  // 64X64 ->
Jingning Han's avatar
Jingning Han committed
219 220 221 222
#if CONFIG_CB4X4
    // 2X2,            2X4,               4X2,
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif
223 224 225 226 227 228 229 230 231 232 233 234 235 236
    //                                    4X4
                                          PARTITION_SPLIT,
    // 4X8,            8X4,               8X8
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 8X16,           16X8,              16X16
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 16X32,          32X16,             32X32
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 32X64,          64X32,             64X64
    PARTITION_VERT,    PARTITION_HORZ,    PARTITION_NONE,
#if CONFIG_EXT_PARTITION
    // 64x128,         128x64,            128x128
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
  }, {  // 128x128 ->
Jingning Han's avatar
Jingning Han committed
237 238 239 240
#if CONFIG_CB4X4
    // 2X2,            2X4,               4X2,
    PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
#endif
241 242 243 244 245 246 247 248 249 250 251 252 253
    //                                    4X4
                                          PARTITION_SPLIT,
    // 4X8,            8X4,               8X8
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 8X16,           16X8,              16X16
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 16X32,          32X16,             32X32
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 32X64,          64X32,             64X64
    PARTITION_SPLIT,   PARTITION_SPLIT,   PARTITION_SPLIT,
    // 64x128,         128x64,            128x128
    PARTITION_VERT,    PARTITION_HORZ,    PARTITION_NONE,
#endif  // CONFIG_EXT_PARTITION
Jingning Han's avatar
Jingning Han committed
254 255 256
  }
};

257
#if CONFIG_EXT_PARTITION_TYPES
258 259 260 261 262
static const BLOCK_SIZE subsize_lookup[EXT_PARTITION_TYPES][BLOCK_SIZES] =
#else
static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] =
#endif  // CONFIG_EXT_PARTITION_TYPES
{
263
  {     // PARTITION_NONE
Jingning Han's avatar
Jingning Han committed
264 265 266 267
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_2X2,     BLOCK_2X4,     BLOCK_4X2,
#endif
268 269 270 271 272 273 274 275 276 277 278 279 280 281
    //                            4X4
                                  BLOCK_4X4,
    // 4X8,        8X4,           8X8
    BLOCK_4X8,     BLOCK_8X4,     BLOCK_8X8,
    // 8X16,       16X8,          16X16
    BLOCK_8X16,    BLOCK_16X8,    BLOCK_16X16,
    // 16X32,      32X16,         32X32
    BLOCK_16X32,   BLOCK_32X16,   BLOCK_32X32,
    // 32X64,      64X32,         64X64
    BLOCK_32X64,   BLOCK_64X32,   BLOCK_64X64,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_64X128,  BLOCK_128X64,  BLOCK_128X128,
#endif  // CONFIG_EXT_PARTITION
282
  }, {  // PARTITION_HORZ
Jingning Han's avatar
Jingning Han committed
283 284 285
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
286 287 288
    //                            4X4
                                  BLOCK_4X2,
#else
289 290
    //                            4X4
                                  BLOCK_INVALID,
291
#endif
292 293 294 295 296 297 298 299 300 301 302 303
    // 4X8,        8X4,           8X8
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X4,
    // 8X16,       16X8,          16X16
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X8,
    // 16X32,      32X16,         32X32
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X16,
    // 32X64,      64X32,         64X64
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X32,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_128X64,
#endif  // CONFIG_EXT_PARTITION
304
  }, {  // PARTITION_VERT
Jingning Han's avatar
Jingning Han committed
305 306 307
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
308 309 310
    //                            4X4
                                  BLOCK_2X4,
#else
311 312
    //                            4X4
                                  BLOCK_INVALID,
313
#endif
314 315 316 317 318 319 320 321 322 323 324 325
    // 4X8,        8X4,           8X8
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_4X8,
    // 8X16,       16X8,          16X16
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X16,
    // 16X32,      32X16,         32X32
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X32,
    // 32X64,      64X32,         64X64
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X64,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X128,
#endif  // CONFIG_EXT_PARTITION
326
  }, {  // PARTITION_SPLIT
Jingning Han's avatar
Jingning Han committed
327 328 329 330
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
#endif
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
    //                            4X4
                                  BLOCK_INVALID,
    // 4X8,        8X4,           8X8
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_4X4,
    // 8X16,       16X8,          16X16
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X8,
    // 16X32,      32X16,         32X32
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X16,
    // 32X64,      64X32,         64X64
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X32,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X64,
#endif  // CONFIG_EXT_PARTITION
#if CONFIG_EXT_PARTITION_TYPES
346
  }, {  // PARTITION_HORZ_A
Jingning Han's avatar
Jingning Han committed
347 348 349 350
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
#endif
351 352 353 354 355 356 357 358 359 360 361 362 363 364
    //                            4X4
                                  BLOCK_INVALID,
    // 4X8,        8X4,           8X8
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X4,
    // 8X16,       16X8,          16X16
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X8,
    // 16X32,      32X16,         32X32
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X16,
    // 32X64,      64X32,         64X64
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X32,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_128X64,
#endif  // CONFIG_EXT_PARTITION
365
  }, {  // PARTITION_HORZ_B
Jingning Han's avatar
Jingning Han committed
366 367 368 369
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
#endif
370 371 372 373 374 375 376 377 378 379 380 381 382 383
    //                            4X4
                                  BLOCK_INVALID,
    // 4X8,        8X4,           8X8
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X4,
    // 8X16,       16X8,          16X16
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X8,
    // 16X32,      32X16,         32X32
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X16,
    // 32X64,      64X32,         64X64
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X32,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_128X64,
#endif  // CONFIG_EXT_PARTITION
384
  }, {  // PARTITION_VERT_A
Jingning Han's avatar
Jingning Han committed
385 386 387 388
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
#endif
389 390 391 392 393 394 395 396 397 398 399 400 401 402
    //                            4X4
                                  BLOCK_INVALID,
    // 4X8,        8X4,           8X8
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_4X8,
    // 8X16,       16X8,          16X16
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X16,
    // 16X32,      32X16,         32X32
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X32,
    // 32X64,      64X32,         64X64
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X64,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X128,
#endif  // CONFIG_EXT_PARTITION
403
  }, {  // PARTITION_VERT_B
Jingning Han's avatar
Jingning Han committed
404 405 406 407
#if CONFIG_CB4X4
    // 2X2,        2X4,           4X2,
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
#endif
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
    //                            4X4
                                  BLOCK_INVALID,
    // 4X8,        8X4,           8X8
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_4X8,
    // 8X16,       16X8,          16X16
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_8X16,
    // 16X32,      32X16,         32X32
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_16X32,
    // 32X64,      64X32,         64X64
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_32X64,
#if CONFIG_EXT_PARTITION
    // 64x128,     128x64,        128x128
    BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X128,
#endif  // CONFIG_EXT_PARTITION
#endif  // CONFIG_EXT_PARTITION_TYPES
Jingning Han's avatar
Jingning Han committed
423 424 425 426
  }
};

static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
427 428 429 430
#if CONFIG_CB4X4
  // 2X2,    2X4,      4X2,
  TX_2X2,    TX_2X2,   TX_2X2,
#endif
431 432 433 434 435 436 437 438
  //                   4X4
                       TX_4X4,
  // 4X8,    8X4,      8X8
  TX_4X4,    TX_4X4,   TX_8X8,
  // 8X16,   16X8,     16X16
  TX_8X8,    TX_8X8,   TX_16X16,
  // 16X32,  32X16,    32X32
  TX_16X16,  TX_16X16, TX_32X32,
439 440 441 442 443 444 445 446 447 448 449 450
  // 32X64,  64X32,
  TX_32X32,  TX_32X32,
#if CONFIG_TX64X64
  // 64X64
  TX_64X64,
#if CONFIG_EXT_PARTITION
  // 64x128, 128x64,   128x128
  TX_64X64,  TX_64X64, TX_64X64,
#endif  // CONFIG_EXT_PARTITION
#else
  // 64X64
  TX_32X32,
451 452 453 454
#if CONFIG_EXT_PARTITION
  // 64x128, 128x64,   128x128
  TX_32X32,  TX_32X32, TX_32X32,
#endif  // CONFIG_EXT_PARTITION
455
#endif  // CONFIG_TX64X64
Jingning Han's avatar
Jingning Han committed
456 457
};

458
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
459
static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
460 461 462
#if CONFIG_CB4X4
  // 2X2,    2X4,      4X2,
  TX_2X2,    TX_2X2,   TX_2X2,
Jingning Han's avatar
Jingning Han committed
463
#endif  // CONFIG_CB4X4
464 465 466 467 468
  //                   4X4
                       TX_4X4,
  // 4X8,    8X4,      8X8
  TX_4X8,    TX_8X4,   TX_8X8,
  // 8X16,   16X8,     16X16
469
  TX_8X16,   TX_16X8,  TX_16X16,
470
  // 16X32,  32X16,    32X32
471
  TX_16X32,  TX_32X16, TX_32X32,
472 473 474 475 476 477 478 479 480 481 482 483
  // 32X64,  64X32,
  TX_32X32,  TX_32X32,
#if CONFIG_TX64X64
  // 64X64
  TX_64X64,
#if CONFIG_EXT_PARTITION
  // 64x128, 128x64,   128x128
  TX_64X64,  TX_64X64, TX_64X64,
#endif  // CONFIG_EXT_PARTITION
#else
  // 64X64
  TX_32X32,
484 485 486 487
#if CONFIG_EXT_PARTITION
  // 64x128, 128x64,   128x128
  TX_32X32,  TX_32X32, TX_32X32,
#endif  // CONFIG_EXT_PARTITION
488
#endif  // CONFIG_TX64X64
489
};
Jingning Han's avatar
Jingning Han committed
490 491
#else
#define max_txsize_rect_lookup max_txsize_lookup
492
#endif  // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
493

494
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
495 496 497
// Same as "max_txsize_lookup[bsize] - TX_8X8", except for rectangular
// block which may use a rectangular transform, in which  case it is
// "(max_txsize_lookup[bsize] + 1) - TX_8X8", invalid for bsize < 8X8
498
static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
499 500 501
#if CONFIG_CB4X4
  // 2X2,             2X4,                4X2,
  INT32_MIN,          INT32_MIN,          INT32_MIN,
502 503 504 505 506
  //                                      4X4,
                                          INT32_MIN,
  // 4X8,             8X4,                8X8,
  TX_8X8 - TX_8X8,    TX_8X8 - TX_8X8,    TX_8X8 - TX_8X8,
#else
507 508 509 510
  //                                      4X4
                                          INT32_MIN,
  // 4X8,             8X4,                8X8
  INT32_MIN,          INT32_MIN,          TX_8X8 - TX_8X8,
511
#endif  // CONFIG_CB4X4
512
  // 8X16,            16X8,               16X16
513
  TX_16X16 - TX_8X8,  TX_16X16 - TX_8X8,  TX_16X16 - TX_8X8,
514
  // 16X32,           32X16,              32X32
515
  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,
516 517 518 519 520 521 522 523 524 525 526 527
  // 32X64,           64X32,
  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,
#if CONFIG_TX64X64
  // 64X64
  TX_64X64 - TX_8X8,
#if CONFIG_EXT_PARTITION
  // 64x128,          128x64,             128x128
  TX_64X64 - TX_8X8,  TX_64X64 - TX_8X8,  TX_64X64 - TX_8X8,
#endif  // CONFIG_EXT_PARTITION
#else
  // 64X64
  TX_32X32 - TX_8X8,
528 529 530 531
#if CONFIG_EXT_PARTITION
  // 64x128,          128x64,             128x128
  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,
#endif  // CONFIG_EXT_PARTITION
532
#endif  // CONFIG_TX64X64
533
};
534 535 536
#else
// Same as "max_txsize_lookup[bsize] - TX_8X8", invalid for bsize < 8X8
static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES] = {
Jingning Han's avatar
Jingning Han committed
537 538 539 540
#if CONFIG_CB4X4
  // 2X2,             2X4,                4X2,
  INT32_MIN,          INT32_MIN,          INT32_MIN,
#endif
541 542 543
  //                                      4X4
                                          INT32_MIN,
  // 4X8,             8X4,                8X8
544
  INT32_MIN,          INT32_MIN,          TX_8X8 - TX_8X8,
545
  // 8X16,            16X8,               16X16
546
  TX_8X8 - TX_8X8,    TX_8X8 - TX_8X8,    TX_16X16 - TX_8X8,
547
  // 16X32,           32X16,              32X32
548
  TX_16X16 - TX_8X8,  TX_16X16 - TX_8X8,  TX_32X32 - TX_8X8,
549 550 551 552 553 554 555 556 557 558 559 560
  // 32X64,           64X32,
  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,
#if CONFIG_TX64X64
  // 64X64
  TX_64X64 - TX_8X8,
#if CONFIG_EXT_PARTITION
  // 64x128,          128x64,             128x128
  TX_64X64 - TX_8X8,  TX_64X64 - TX_8X8,  TX_64X64 - TX_8X8,
#endif  // CONFIG_EXT_PARTITION
#else
  // 64X64
  TX_32X32 - TX_8X8,
561 562 563 564
#if CONFIG_EXT_PARTITION
  // 64x128,          128x64,             128x128
  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,  TX_32X32 - TX_8X8,
#endif  // CONFIG_EXT_PARTITION
565
#endif  // CONFIG_TX64X64
566
};
567
#endif  // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
568

569 570
#define inter_tx_size_cat_lookup intra_tx_size_cat_lookup

clang-format's avatar
clang-format committed
571
/* clang-format on */
572

573 574 575 576 577 578 579 580
static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
  TX_2X2,  // TX_2X2
#endif
  TX_4X4,    // TX_4X4
  TX_4X4,    // TX_8X8
  TX_8X8,    // TX_16X16
  TX_16X16,  // TX_32X32
581 582 583
#if CONFIG_TX64X64
  TX_32X32,  // TX_64X64
#endif       // CONFIG_TX64X64
584 585 586 587 588
  TX_4X4,    // TX_4X8
  TX_4X4,    // TX_8X4
  TX_8X8,    // TX_8X16
  TX_8X8,    // TX_16X8
  TX_16X16,  // TX_16X32
589 590 591 592 593
  TX_16X16,  // TX_32X16
  TX_4X4,    // TX_4X16
  TX_4X4,    // TX_16X4
  TX_8X8,    // TX_8X32
  TX_8X8,    // TX_32X8
594 595
};

596
static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = {
597 598 599
#if CONFIG_CB4X4
  TX_2X2,  // TX_2X2
#endif
600 601 602 603
  TX_4X4,    // TX_4X4
  TX_8X8,    // TX_8X8
  TX_16X16,  // TX_16X16
  TX_32X32,  // TX_32X32
604 605 606
#if CONFIG_TX64X64
  TX_64X64,  // TX_64X64
#endif       // CONFIG_TX64X64
607 608 609 610 611
  TX_4X4,    // TX_4X8
  TX_8X8,    // TX_8X4
  TX_8X8,    // TX_8X16
  TX_16X16,  // TX_16X8
  TX_16X16,  // TX_16X32
612 613 614 615 616
  TX_32X32,  // TX_32X16
  TX_4X4,    // TX_4X16
  TX_16X16,  // TX_16X4
  TX_8X8,    // TX_8X32
  TX_32X32,  // TX_32X8
617 618 619
};

static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
620 621 622
#if CONFIG_CB4X4
  TX_2X2,  // TX_2X2
#endif
623 624 625 626
  TX_4X4,    // TX_4X4
  TX_8X8,    // TX_8X8
  TX_16X16,  // TX_16X16
  TX_32X32,  // TX_32X32
627 628 629
#if CONFIG_TX64X64
  TX_64X64,  // TX_64X64
#endif       // CONFIG_TX64X64
630 631 632 633 634
  TX_8X8,    // TX_4X8
  TX_4X4,    // TX_8X4
  TX_16X16,  // TX_8X16
  TX_8X8,    // TX_16X8
  TX_32X32,  // TX_16X32
635 636 637 638 639
  TX_16X16,  // TX_32X16
  TX_16X16,  // TX_4X16
  TX_4X4,    // TX_16X4
  TX_32X32,  // TX_8X32
  TX_8X8,    // TX_32X8
640 641
};

Angie Chiang's avatar
Angie Chiang committed
642 643 644 645 646 647
#if CONFIG_CB4X4
#define TX_SIZE_W_MIN 2
#else
#define TX_SIZE_W_MIN 4
#endif

648 649
// Transform block width in pixels
static const int tx_size_wide[TX_SIZES_ALL] = {
650 651 652
#if CONFIG_CB4X4
  2,
#endif
653 654 655 656
  4,  8, 16, 32,
#if CONFIG_TX64X64
  64,
#endif  // CONFIG_TX64X64
657
  4,  8, 8,  16, 16, 32, 4, 16, 8, 32
658 659
};

Angie Chiang's avatar
Angie Chiang committed
660 661 662 663 664 665
#if CONFIG_CB4X4
#define TX_SIZE_H_MIN 2
#else
#define TX_SIZE_H_MIN 4
#endif

666 667
// Transform block height in pixels
static const int tx_size_high[TX_SIZES_ALL] = {
668 669 670
#if CONFIG_CB4X4
  2,
#endif
671 672 673 674
  4,  8, 16, 32,
#if CONFIG_TX64X64
  64,
#endif  // CONFIG_TX64X64
675
  8,  4, 16, 8,  32, 16, 16, 4, 32, 8
676 677 678 679
};

// Transform block width in unit
static const int tx_size_wide_unit[TX_SIZES_ALL] = {
680
#if CONFIG_CB4X4
681 682 683 684
  1,  2, 4, 8, 16,
#if CONFIG_TX64X64
  32,
#endif  // CONFIG_TX64X64
685
  2,  4, 4, 8, 8,  16, 2, 8, 4, 16
686
#else  // CONFIG_CB4X4
687 688 689 690
  1,  2, 4, 8,
#if CONFIG_TX64X64
  16,
#endif  // CONFIG_TX64X64
691
  1,  2, 2, 4, 4, 8, 1, 4, 2, 8
692
#endif  // CONFIG_CB4X4
693 694 695 696
};

// Transform block height in unit
static const int tx_size_high_unit[TX_SIZES_ALL] = {
697
#if CONFIG_CB4X4
698 699 700 701
  1,  2, 4, 8, 16,
#if CONFIG_TX64X64
  32,
#endif  // CONFIG_TX64X64
702
  4,  2, 8, 4, 16, 8, 8, 2, 16, 4
703
#else  // CONFIG_CB4X4
704 705 706 707
  1,  2, 4, 8,
#if CONFIG_TX64X64
  16,
#endif  // CONFIG_TX64X64
708
  2,  1, 4, 2, 8, 4, 4, 1, 8, 2
709
#endif  // CONFIG_CB4X4
710
};
Jingning Han's avatar
Jingning Han committed
711

712 713
// Transform block width in log2
static const int tx_size_wide_log2[TX_SIZES_ALL] = {
714
#if CONFIG_CB4X4
715
  1,
716
#endif
717 718 719 720
  2, 3, 4, 5,
#if CONFIG_TX64X64
  6,
#endif  // CONFIG_TX64X64
721
  2, 3, 3, 4, 4, 5, 2, 4, 3, 5
722 723 724 725
};

// Transform block height in log2
static const int tx_size_high_log2[TX_SIZES_ALL] = {
726
#if CONFIG_CB4X4
727
  1,
728
#endif
729 730 731 732
  2, 3, 4, 5,
#if CONFIG_TX64X64
  6,
#endif  // CONFIG_TX64X64
733
  3, 2, 4, 3, 5, 4, 4, 2, 5, 3
734 735
};

736
static const int tx_size_2d[TX_SIZES_ALL] = {
737 738 739
#if CONFIG_CB4X4
  4,
#endif
Yaowu Xu's avatar
Yaowu Xu committed
740
  16,   64, 256, 1024,
741 742 743
#if CONFIG_TX64X64
  4096,
#endif  // CONFIG_TX64X64
744
  32,   32, 128, 128,  512, 512, 64, 64, 256, 256
745
};
Jingning Han's avatar
Jingning Han committed
746

747
static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
748
#if CONFIG_CB4X4
749
  BLOCK_2X2,  // TX_2X2
750
#endif
751 752 753 754
  BLOCK_4X4,    // TX_4X4
  BLOCK_8X8,    // TX_8X8
  BLOCK_16X16,  // TX_16X16
  BLOCK_32X32,  // TX_32X32
755
#if CONFIG_TX64X64
756 757 758 759 760 761 762 763 764 765 766 767
  BLOCK_64X64,    // TX_64X64
#endif            // CONFIG_TX64X64
  BLOCK_4X8,      // TX_4X8
  BLOCK_8X4,      // TX_8X4
  BLOCK_8X16,     // TX_8X16
  BLOCK_16X8,     // TX_16X8
  BLOCK_16X32,    // TX_16X32
  BLOCK_32X16,    // TX_32X16
  BLOCK_INVALID,  // TX_4X16
  BLOCK_INVALID,  // TX_16X4
  BLOCK_INVALID,  // TX_8X32
  BLOCK_INVALID,  // TX_32X8
768 769 770
};

static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
771 772 773
#if CONFIG_CB4X4
  TX_2X2,  // TX_2X2
#endif
774 775 776 777
  TX_4X4,    // TX_4X4
  TX_8X8,    // TX_8X8
  TX_16X16,  // TX_16X16
  TX_32X32,  // TX_32X32
778 779 780
#if CONFIG_TX64X64
  TX_64X64,  // TX_64X64
#endif       // CONFIG_TX64X64
781 782 783 784 785 786
  TX_4X4,    // TX_4X8
  TX_4X4,    // TX_8X4
  TX_8X8,    // TX_8X16
  TX_8X8,    // TX_16X8
  TX_16X16,  // TX_16X32
  TX_16X16,  // TX_32X16
787 788 789 790
  TX_4X4,    // TX_4X16
  TX_4X4,    // TX_16X4
  TX_8X8,    // TX_8X32
  TX_8X8,    // TX_32X8
Jingning Han's avatar
Jingning Han committed
791 792
};

793
static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = {
794 795 796
#if CONFIG_CB4X4
  TX_2X2,  // TX_2X2
#endif
797 798 799 800
  TX_4X4,    // TX_4X4
  TX_8X8,    // TX_8X8
  TX_16X16,  // TX_16X16
  TX_32X32,  // TX_32X32
801 802 803
#if CONFIG_TX64X64
  TX_64X64,  // TX_64X64
#endif       // CONFIG_TX64X64
804 805 806 807 808 809
  TX_8X8,    // TX_4X8
  TX_8X8,    // TX_8X4
  TX_16X16,  // TX_8X16
  TX_16X16,  // TX_16X8
  TX_32X32,  // TX_16X32
  TX_32X32,  // TX_32X16
810 811 812 813
  TX_16X16,  // TX_4X16
  TX_16X16,  // TX_16X4
  TX_32X32,  // TX_8X32
  TX_32X32,  // TX_32X8
814 815
};

816
/* clang-format off */
Jingning Han's avatar
Jingning Han committed
817
static const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
clang-format's avatar
clang-format committed
818 819
  TX_4X4,    // ONLY_4X4
  TX_8X8,    // ALLOW_8X8
Jingning Han's avatar
Jingning Han committed
820 821
  TX_16X16,  // ALLOW_16X16
  TX_32X32,  // ALLOW_32X32
822 823 824 825
#if CONFIG_TX64X64
  TX_64X64,  // ALLOW_64X64
  TX_64X64,  // TX_MODE_SELECT
#else
826
  TX_32X32,  // TX_MODE_SELECT
827
#endif  // CONFIG_TX64X64
Jingning Han's avatar
Jingning Han committed
828
};
829
/* clang-format on */
Jingning Han's avatar
Jingning Han committed
830 831

static const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
Jingning Han's avatar
Jingning Han committed
832 833 834 835 836 837
//  ss_x == 0    ss_x == 0        ss_x == 1      ss_x == 1
//  ss_y == 0    ss_y == 1        ss_y == 0      ss_y == 1
#if CONFIG_CB4X4
  { { BLOCK_2X2, BLOCK_INVALID }, { BLOCK_INVALID, BLOCK_INVALID } },
  { { BLOCK_2X4, BLOCK_INVALID }, { BLOCK_INVALID, BLOCK_INVALID } },
  { { BLOCK_4X2, BLOCK_INVALID }, { BLOCK_INVALID, BLOCK_INVALID } },
838 839 840 841
  { { BLOCK_4X4, BLOCK_4X2 }, { BLOCK_2X4, BLOCK_2X2 } },
  { { BLOCK_4X8, BLOCK_4X4 }, { BLOCK_INVALID, BLOCK_2X4 } },
  { { BLOCK_8X4, BLOCK_INVALID }, { BLOCK_4X4, BLOCK_4X2 } },
#else
clang-format's avatar
clang-format committed
842 843 844
  { { BLOCK_4X4, BLOCK_INVALID }, { BLOCK_INVALID, BLOCK_INVALID } },
  { { BLOCK_4X8, BLOCK_4X4 }, { BLOCK_INVALID, BLOCK_INVALID } },
  { { BLOCK_8X4, BLOCK_INVALID }, { BLOCK_4X4, BLOCK_INVALID } },
845
#endif
clang-format's avatar
clang-format committed
846 847 848 849 850 851 852 853 854 855
  { { BLOCK_8X8, BLOCK_8X4 }, { BLOCK_4X8, BLOCK_4X4 } },
  { { BLOCK_8X16, BLOCK_8X8 }, { BLOCK_INVALID, BLOCK_4X8 } },
  { { BLOCK_16X8, BLOCK_INVALID }, { BLOCK_8X8, BLOCK_8X4 } },
  { { BLOCK_16X16, BLOCK_16X8 }, { BLOCK_8X16, BLOCK_8X8 } },
  { { BLOCK_16X32, BLOCK_16X16 }, { BLOCK_INVALID, BLOCK_8X16 } },
  { { BLOCK_32X16, BLOCK_INVALID }, { BLOCK_16X16, BLOCK_16X8 } },
  { { BLOCK_32X32, BLOCK_32X16 }, { BLOCK_16X32, BLOCK_16X16 } },
  { { BLOCK_32X64, BLOCK_32X32 }, { BLOCK_INVALID, BLOCK_16X32 } },
  { { BLOCK_64X32, BLOCK_INVALID }, { BLOCK_32X32, BLOCK_32X16 } },
  { { BLOCK_64X64, BLOCK_64X32 }, { BLOCK_32X64, BLOCK_32X32 } },
856
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
857 858 859
  { { BLOCK_64X128, BLOCK_64X64 }, { BLOCK_INVALID, BLOCK_32X64 } },
  { { BLOCK_128X64, BLOCK_INVALID }, { BLOCK_64X64, BLOCK_64X32 } },
  { { BLOCK_128X128, BLOCK_128X64 }, { BLOCK_64X128, BLOCK_64X64 } },
860
#endif  // CONFIG_EXT_PARTITION
Jingning Han's avatar
Jingning Han committed
861 862
};

863
static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
Jingning Han's avatar
Jingning Han committed
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
//  ss_x == 0    ss_x == 0        ss_x == 1      ss_x == 1
//  ss_y == 0    ss_y == 1        ss_y == 0      ss_y == 1
#if CONFIG_CB4X4
  {
      // BLOCK_2X2
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#if CONFIG_TX64X64
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#endif  // CONFIG_TX64X64
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
883 884 885 886
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
Jingning Han's avatar
Jingning Han committed
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903
  },
  {
      // BLOCK_2X4
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#if CONFIG_TX64X64
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#endif  // CONFIG_TX64X64
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
904 905 906 907
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
Jingning Han's avatar
Jingning Han committed
908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924
  },
  {
      // BLOCK_2X4
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#if CONFIG_TX64X64
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#endif  // CONFIG_TX64X64
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
925 926 927 928
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
Jingning Han's avatar
Jingning Han committed
929 930
  },
#endif
931
  {
932 933
// BLOCK_4X4
#if CONFIG_CB4X4
934 935 936
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
937
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
938
#endif  // CONFIG_CB4X4
939 940 941
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
942 943 944
#if CONFIG_TX64X64
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif  // CONFIG_TX64X64
945 946 947 948 949 950
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
951 952 953 954
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
955 956
  },
  {
957 958
// BLOCK_4X8
#if CONFIG_CB4X4
959 960 961
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
962 963
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
964 965 966
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
967 968
#if CONFIG_TX64X64
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
969 970 971 972
#endif  // CONFIG_TX64X64
#if CONFIG_CB4X4
      { { TX_4X8, TX_4X4 }, { TX_2X2, TX_2X2 } },  // used
#else
973
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },  // used
974
#endif
975 976
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
977 978 979
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
980 981 982 983
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
984 985
  },
  {
986 987
// BLOCK_8X4
#if CONFIG_CB4X4
988 989 990
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
      { { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
991 992
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
993 994 995
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
996 997 998 999
#if CONFIG_TX64X64
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif  // CONFIG_TX64X64
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
1000 1001 1002
#if CONFIG_CB4X4
      { { TX_8X4, TX_2X2 }, { TX_4X4, TX_2X2 } },  // used
#else
1003
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },  // used
1004
#endif
1005
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
1006 1007 1008
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
1009 1010 1011 1012
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
1013 1014
  },
  {
1015 1016
// BLOCK_8X8
#if CONFIG_CB4X4
1017
      { { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
1018
#endif
1019
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
1020
      { { TX_8X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
1021 1022 1023 1024 1025
      { { TX_8X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_TX64X64
      { { TX_8X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif  // CONFIG_TX64X64
1026 1027 1028 1029 1030 1031
      { { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } },
      { { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
      { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
      { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
      { { TX_8X8, TX_8X4 }, { TX_4X8, TX_4X4 } },
1032 1033 1034 1035
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
1036 1037
  },
  {
1038 1039 1040 1041
// BLOCK_8X16
#if CONFIG_CB4X4
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
1042 1043 1044 1045
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
      { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
      { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
1046 1047 1048
#if CONFIG_TX64X64
      { { TX_8X8, TX_8X8 }, { TX_4X4, TX_4X4 } },
#endif  // CONFIG_TX64X64
1049 1050
      { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
      { { TX_8X4, TX_8X4 }, { TX_4X4, TX_4X4 } },
1051
      { { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },  // used
1052 1053 1054
      { { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
      { { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
      { { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
1055 1056 1057 1058
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
1059 1060
  },
  {
1061 1062 1063 1064
// BLOCK_16X8
#if CONFIG_CB4X4
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
1065 1066
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } },
1067 1068 1069 1070 1071
      { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } },
      { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } },
#if CONFIG_TX64X64
      { { TX_8X8, TX_4X4 }, { TX_8X8, TX_4X4 } },
#endif  // CONFIG_TX64X64
1072 1073
      { { TX_4X8, TX_4X4 }, { TX_4X8, TX_4X4 } },
      { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
1074
      { { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
1075
      { { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },  // used
1076 1077
      { { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
      { { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
1078 1079 1080 1081
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
      { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
1082 1083
  },
  {
1084 1085 1086 1087
// BLOCK_16X16
#if CONFIG_CB4X4
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
1088 1089 1090 1091
      { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
      { { TX_8X8, TX_8X8 }, { TX_8X8, TX_8X8 } },
      { { TX_16X16, TX_8X8 }, { TX_8X8, TX_8X8 } },
      { { TX_16X16, TX_8X8 }, { TX_8X8, TX_8X8 } },
1092 1093 1094
#if CONFIG_TX64X64
      { { TX_16X16, TX_8X8 }, { TX_8X8, TX_8X8 } },
#endif  // CONFIG_TX64X64
1095 1096 1097 1098 1099 1100
      { { TX_4X8, TX_4X8 }, { TX_4X8, TX_4X8 } },
      { { TX_8X4, TX_8X4 }, { TX_8X4, TX_8X4 } },
      { { TX_8X16, TX_8X8 }, { TX_8X16, TX_8X8 } },
      { { TX_16X8, TX_16X8 }, { TX_8X8, TX_8X8 } },
      { { TX_16X16, TX_16X8 }, { TX_8X16, TX_8X8 } },
      { { TX_16X16, TX_16X8 }, { TX_8X16, TX_8X8 } },
1101