Coverage Report

Created: 2026-10-17 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/avm/av2/common/enums.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2021, Alliance for Open Media. All rights reserved
3
 *
4
 * This source code is subject to the terms of the BSD 3-Clause Clear License
5
 * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
6
 * License was not distributed with this source code in the LICENSE file, you
7
 * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/.  If the
8
 * Alliance for Open Media Patent License 1.0 was not distributed with this
9
 * source code in the PATENTS file, you can obtain it at
10
 * aomedia.org/license/patent-license/.
11
 */
12
13
#ifndef AVM_AV2_COMMON_ENUMS_H_
14
#define AVM_AV2_COMMON_ENUMS_H_
15
16
#include <assert.h>
17
18
#include "config/avm_config.h"
19
20
#include "avm/avm_codec.h"
21
#include "avm/avm_integer.h"
22
#include "avm_ports/mem.h"
23
#include "avm/avm_frame_buffer.h"
24
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
29
/*! @file */
30
31
/*!\cond */
32
33
#undef MAX_SB_SIZE
34
35
442k
#define MAX_PR_NUM 16
36
0
#define MAX_DR_STACK_SIZE 4
37
0
#define MAX_DR_PR_NUM 2
38
39
16.9M
#define MAX_SEQ_NUM 16
40
41
// Macros related to joint shell signaling
42
#define FIRST_SHELL_CLASS 8
43
#define SECOND_SHELL_CLASS 8
44
// Macros related to wedge angle signaling
45
#define WEDGE_QUADS 4
46
0
#define QUAD_WEDGE_ANGLES 5
47
// Macros related to luma and chroma intra mode signaling
48
1.29M
#define LUMA_INTRA_MODE_INDEX_COUNT 8
49
#define LUMA_INTRA_MODE_OFFSET_COUNT 6
50
648k
#define CHROMA_INTRA_MODE_INDEX_COUNT 8
51
// Macro related to EOB position token signaling
52
642k
#define EOB_PT_INDEX_COUNT 8
53
// Macros related Inter tx type signaling
54
4.57k
#define INTER_TX_TYPE_INDEX_COUNT 8
55
#define INTER_TX_TYPE_OFFSET1_COUNT 8
56
#define INTER_TX_TYPE_OFFSET2_COUNT 4
57
#define INTER_TX_TYPE_SIGNALING_SETS 2
58
#define TX_EXT_32_CTXS 2
59
60
300k
#define FGM_ID_BITS 3
61
295k
#define MAX_FGM_NUM (1 << FGM_ID_BITS)
62
63
#define NUM_CTX_IS_JOINT 2
64
#define NUM_OPTIONS_IS_JOINT 2
65
#define NUM_CTX_NON_JOINT_TYPE INTER_MODE_CONTEXTS
66
#define NUM_OPTIONS_NON_JOINT_TYPE 5
67
#define NUM_CTX_JOINT_TYPE 1
68
#define NUM_OPTIONS_JOINT_TYPE 2
69
70
// maximum warp bound boxes.
71
0
#define MAX_WARP_BD_SIZE (1 << (8 - 3))
72
#define MAX_WARP_BD_SQ (MAX_WARP_BD_SIZE * MAX_WARP_BD_SIZE)
73
74
0
#define SUBBLK_REF_EXT_LINES 2
75
76
0
#define SMVR_SEARCH_EXT_LINES 2
77
78
#define WARP_STATS_BUFFER_SIZE \
79
  (MAX_WARP_REF_CANDIDATES * NUM_WARP_PRECISION_MODES)
80
81
0
#define AVG_CDF_WEIGHT_PRIMARY 7
82
0
#define AVG_CDF_WEIGHT_NON_PRIMARY 1
83
84
533k
#define NUM_REF_SAM_CFL 8
85
86
0
#define DEFAULT_IMP_MSK_WT 0  // default implict masked blending weight
87
88
36.5k
#define BAWP_MAX_REF_NUMB 16
89
#if CONFIG_PARAKIT_COLLECT_DATA
90
// @ParaKit: add enum variables to indiciate context groups
91
enum { EOB_FLAG_CDF16, EOB_FLAG_CDF32, MAX_NUM_CTX_GROUPS };
92
#endif
93
94
/*WEDGE_0 is defined in the three o'clock direciton, the angles are defined in
95
 * the anticlockwise.*/
96
enum {
97
  WEDGE_0,
98
  WEDGE_14,
99
  WEDGE_27,
100
  WEDGE_45,
101
  WEDGE_63,
102
  WEDGE_90,
103
  WEDGE_117,
104
  WEDGE_135,
105
  WEDGE_153,
106
  WEDGE_166,
107
  WEDGE_180,
108
  WEDGE_194,
109
  WEDGE_207,
110
  WEDGE_225,
111
  WEDGE_243,
112
  WEDGE_270,
113
  WEDGE_297,
114
  WEDGE_315,
115
  WEDGE_333,
116
  WEDGE_346,
117
  WEDGE_ANGLES
118
} UENUM1BYTE(WedgeDirectionType);
119
120
0
#define H_WEDGE_ANGLES 10
121
#define NUM_WEDGE_DIST 4
122
#define MAX_WEDGE_TYPES 68
123
#define WEDGE_BLD_LUT_SIZE 128
124
125
0
#define REFINEMV_SUBBLOCK_WIDTH 16
126
0
#define REFINEMV_SUBBLOCK_HEIGHT 16
127
128
39.1M
#define IBP_WEIGHT_SIZE_LOG2 4
129
38.7M
#define IBP_WEIGHT_SIZE (1 << IBP_WEIGHT_SIZE_LOG2)
130
131
// Supported scale modes for JOINT_NEWMV
132
0
#define JOINT_NEWMV_SCALE_FACTOR_CNT 5
133
// Supoorted scale modes for JOINT_AMVDNEWMV
134
0
#define JOINT_AMVD_SCALE_FACTOR_CNT 3
135
136
// Max superblock size
137
20.0M
#define MAX_SB_SIZE_LOG2 8
138
359k
#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2)
139
0
#define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
140
#define BLOCK_128_MI_SIZE_LOG2 5
141
142
// Cross-Component Sample Offset (CCSO)
143
2.78M
#define CCSO_BLK_SIZE MAX_SB_SIZE_LOG2
144
124M
#define CCSO_PADDING_SIZE 5
145
3.26k
#define CCSO_BAND_NUM 64
146
82.2k
#define CCSO_NUM_COMPONENTS 3
147
148
#define CFL_MHCCP_SWITCH_NUM 2
149
#define MHCCP_MODE_NUM 3
150
#define MHCCP_CONTEXT_GROUP_SIZE 4
151
// 2 lines of the luma buffer, and 1 line for the chroma buffer
152
98.4M
#define LINE_NUM 1
153
10.7M
#define MHCCP_NUM_PARAMS 3
154
#define MHCCP_WINDOW_SIZE 6
155
#define MHCCP_MAX_REF_SAMPLES \
156
  (2 * MHCCP_WINDOW_SIZE * (2 * MAX_SB_SIZE + MHCCP_WINDOW_SIZE))
157
3.08M
#define MHCCP_DECIM_BITS 16
158
#define MHCCP_DECIM_ROUND (1 << (MHCCP_DECIM_BITS - 1))
159
160
// Min superblock size
161
30.2k
#define MIN_SB_SIZE_LOG2 6
162
163
// Pixels per Mode Info (MI) unit
164
196M
#define MI_SIZE_LOG2 2
165
31.7M
#define MI_SIZE (1 << MI_SIZE_LOG2)
166
167
// 1/8 pels per Mode Info (MI) unit
168
12.1M
#define MI_SUBPEL_SIZE_LOG2 (MI_SIZE_LOG2 + 3)
169
170
// MI-units per max superblock (MI Block - MIB)
171
12.0M
#define MAX_MIB_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2)
172
12.0M
#define MAX_MIB_SIZE (1 << MAX_MIB_SIZE_LOG2)
173
174
#define MAX_MIB_SQUARE (MAX_MIB_SIZE * MAX_MIB_SIZE)
175
176
#if CONFIG_INSPECTION
177
// MI-units per min superblock
178
#define MIN_MIB_SIZE_LOG2 (MIN_SB_SIZE_LOG2 - MI_SIZE_LOG2)
179
#endif  // CONFIG_INSPECTION
180
181
// Mask to extract MI offset within max MIB
182
12.0M
#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
183
184
// The largest block size where we need to construct chroma blocks separately
185
// from luma blocks is 64x32. With the four way partition, we can get 64x4
186
// block sizes. So we only need to track results for 16 mi units.
187
#define MAX_MI_LUMA_SIZE_FOR_SUB_8 (64 >> MI_SIZE_LOG2)
188
0
#define SUB_8_BITMASK_T uint16_t
189
0
#define SUB_8_BITMASK_SIZE (16)
190
0
#define SUB_8_BITMASK_ON (UINT16_MAX)
191
192
// Maximum number of tile rows and tile columns
193
21.6k
#define MAX_TILE_ROWS 64
194
17.9k
#define MAX_TILE_COLS 64
195
196
618k
#define MI_SIZE_64X64 (64 >> MI_SIZE_LOG2)
197
#define MI_SIZE_128X128 (128 >> MI_SIZE_LOG2)
198
#define MI_SIZE_256X256 (256 >> MI_SIZE_LOG2)
199
200
#define MAX_PALETTE_SQUARE (64 * 64)
201
// Maximum number of colors in a palette.
202
64.3M
#define PALETTE_MAX_SIZE 8
203
// Minimum number of colors in a palette.
204
3.52k
#define PALETTE_MIN_SIZE 2
205
206
0
#define FRAME_OFFSET_BITS 5
207
0
#define MAX_FRAME_DISTANCE ((1 << FRAME_OFFSET_BITS) - 1)
208
209
// Multiple reference line selection for intra prediction
210
#define MRL_LINE_NUMBER 4
211
162k
#define FIRST_MODE_COUNT 13
212
162k
#define SECOND_MODE_COUNT 16
213
#define Y_MODE_CONTEXTS 3
214
#define INTRA_MODE_SETS 4
215
430M
#define NON_DIRECTIONAL_MODES_COUNT 5
216
#define UV_MODE_CONTEXTS 2
217
#define CFL_CONTEXTS 3
218
219
// Intra Secondary Transform
220
// - STX_TYPES: number of IST types (including none) to be signaled before
221
//   signaling the IST set index. STX_TYPES-1 is the number of IST kernels
222
//   within each IST set
223
// - IST_SET_SIZE: number of IST sets for 4x4 DCT_DCT, 4x4 ADST_ADST, and 8x8
224
//   DCT_DCT
225
// - IST_REDUCED_SET_SIZE: number of IST sets for 8x8 ADST_ADST
226
// - IST_4x4_SET_SIZE: number of all 4x4 IST sets (DCT_DCT + ADST_ADST)
227
// - IST_8x8_SET_SIZE: number of all 8x8 IST sets (DCT_DCT + ADST_ADST)
228
1
#define STX_TYPES 4
229
#define STX_PRED_CTXS 2
230
60.5k
#define IST_SET_SIZE 7
231
12
#define IST_REDUCED_SET_SIZE 4
232
15
#define IST_4x4_SET_SIZE (IST_SET_SIZE + IST_SET_SIZE)
233
12
#define IST_8x8_SET_SIZE (IST_SET_SIZE + IST_REDUCED_SET_SIZE)
234
235
// - Width: dimension of secondary transform input (and inverse secondary
236
//   transform output).
237
// - Height: dimension of secondary transform output (and inverse secondary
238
//   transform input).
239
61.1k
#define IST_4x4_WIDTH 16
240
152k
#define IST_4x4_HEIGHT 8
241
62.3k
#define IST_8x8_HEIGHT_RED 20
242
#define IST_8x8_WIDTH_MAX 64
243
494k
#define IST_8x8_WIDTH 48
244
1
#define IST_8x8_HEIGHT_MAX 32
245
599k
#define IST_8x8_HEIGHT 32
246
207k
#define IST_ADST_NZ_CNT 20
247
248
#define STX_SYNTAX_DEBUG 0
249
#define STX_COEFF_DEBUG 0
250
251
#define FSC_MODES 2
252
1.05M
#define FSC_MAXWIDTH 32
253
881k
#define FSC_MAXHEIGHT 32
254
786k
#define FSC_MINWIDTH 4
255
786k
#define FSC_MINHEIGHT 4
256
257
322k
#define DIST_PRECISION_BITS 4
258
259
2.33k
#define IBC_TOP_INTERP_BORDER 0
260
2.55k
#define IBC_LEFT_INTERP_BORDER 0
261
2.55k
#define IBC_RIGHT_INTERP_BORDER 1
262
2.33k
#define IBC_BOTTOM_INTERP_BORDER 1
263
264
0
#define SMVR_SEARCH_NUM_NEIGHBORS 24
265
0
#define MULTI_SEQ_CONFIG_BITS 6
266
98.9k
#define PROFILE_BITS 5
267
0
#define CONFIG_BITS 6
268
0
#define INTEROP_BITS 4
269
// Refer to Table A.1 in annexA.c
270
enum {
271
  MAIN_420_10_IP0 = 0,
272
  MAIN_420_10_IP1 = 1,
273
  MAIN_420_10_IP2 = 2,
274
  MAIN_422_10_IP1 = 3,
275
  MAIN_444_10_IP1 = 4,
276
#if CONFIG_12BIT_PROFILE
277
  // 12-bit profile: all chroma formats (4:0:0/4:2:0/4:2:2/4:4:4), IP2
278
  MAIN_444C_12_IP2 = 5,
279
#endif  // CONFIG_12BIT_PROFILE
280
  RESERVED_PROFILES_START,
281
  CONFIGURABLE = 31,
282
  MAX_PROFILES,
283
} SENUM1BYTE(BITSTREAM_PROFILE);
284
285
static_assert(MAX_PROFILES == (1 << PROFILE_BITS), "");
286
287
2.43k
#define BUFFER_POOL_MAX_SIZE 18  // Max VBI slots (16) + 2 extra
288
289
284k
#define MAX_NUM_TLAYERS 4
290
3.86M
#define MAX_NUM_MLAYERS 8
291
1.57M
#define MAX_NUM_XLAYERS 32
292
#define RESERVED_NUM_MLAYERS -1
293
// bits for temporal, embedded, and extended layers
294
1.08M
#define TLAYER_BITS 2  // 2 bits for MAX_NUM_TLAYERS
295
42.4k
#define MLAYER_BITS 3  // 3 bits for MAX_NUM_MLAYERS
296
31.8k
#define XLAYER_BITS 5  // 5 bits for MAX_NUM_XLAYERS
297
0
#define MAX_NUM_OPERATING_POINTS (MAX_NUM_TLAYERS * MAX_NUM_MLAYERS)
298
#define OP_POINTS_CNT_MINUS_1_BITS (TLAYER_BITS + MLAYER_BITS)
299
#define OP_POINTS_IDC_BITS (MAX_NUM_TLAYERS + MAX_NUM_MLAYERS)
300
301
// LCR
302
4.46M
#define LCR_ID_BITS 3
303
4.46M
#define MAX_NUM_LCR (1 << LCR_ID_BITS)
304
#define MAX_LCR_TYPES 2
305
1.87M
#define GLOBAL_XLAYER_ID 31
306
// OPS
307
232k
#define OPS_ID_BITS 4
308
232k
#define MAX_NUM_OPS_ID (1 << OPS_ID_BITS)
309
75
#define OPS_COUNT_BITS 3
310
#define MAX_OPS_COUNT ((1 << OPS_COUNT_BITS) - 1)
311
// Atlas
312
400
#define MAX_ATLAS_REGIONS 64  // maximum number of Atlas regions per dimension
313
294
#define ATLAS_SEG_ID_BITS 3
314
#define MAX_NUM_ATLAS_SEG_ID (1 << ATLAS_SEG_ID_BITS)
315
773
#define ATLAS_LABEL_SEG_ID_BITS 8
316
200
#define MAX_NUM_ATLAS_SEGMENTS (1 << ATLAS_LABEL_SEG_ID_BITS)
317
318
// Enabling this macro removes the prompting in lcr_profile_tier_level() to be
319
// included after profile, tier and level definitions are finalized.
320
// TODO: remove this macro after definition of profile, tier and level
321
#define MULTILAYER_HLS_REMOVE_LOGS 1
322
323
2.16k
#define MAX_NUM_SEQ_LCR_ID 7
324
154k
#define LCR_ID_UNSPECIFIED 0
325
326
enum {
327
  TEXTURE_LAYER = 0,
328
  AUX_LAYER = 1,
329
  STEREO_LAYER = 2,
330
  DEPENDENT_LAYER = 3,
331
  // Reserved: 4-15
332
  LAYER_TYPES = 16
333
};
334
335
enum {
336
  LCR_ALPHA_AUX = 0,
337
  LCR_DEPTH_AUX = 1,
338
  LCR_SEGMENTATION_AUX = 2,
339
  LCR_GAIN_MAP_AUX = 3,
340
  // 4-127: Reserved (for future AOMedia use)
341
  LCR_AUX_TYPE_RESERVED_START = 4,
342
  LCR_AUX_TYPE_RESERVED_END = 127,
343
  // 128-159: Unspecified (interpretation defined through external means)
344
  LCR_AUX_TYPE_UNSPECIFIED_START = 128,
345
  LCR_AUX_TYPE_UNSPECIFIED_END = 159,
346
  // 160-255: Reserved (for future AOMedia use)
347
  LCR_AUX_TYPE_RESERVED2_START = 160,
348
  LCR_AUX_TYPE_RESERVED2_END = 255,
349
};
350
351
enum {
352
  VIEW_UNSPECIFIED = 0,
353
  VIEW_CENTER = 1,
354
  VIEW_LEFT = 2,
355
  VIEW_RIGHT = 3,
356
  VIEW_EXPLICIT = 4,
357
  // Reserved: 5-7
358
  VIEW_TYPES = 8
359
};
360
361
enum {
362
  ENHANCED_ATLAS = 0,
363
  BASIC_ATLAS = 1,
364
  SINGLE_ATLAS = 2,
365
  MULTISTREAM_ATLAS = 3,
366
  MULTISTREAM_ALPHA_ATLAS = 4,
367
  ATLAS_TYPES
368
};
369
370
enum {
371
  UNSPECIFIED_MULTIVIEW,
372
  STEREOSCOPIC_VIEWPORTS,
373
  IMMERSIVE_MULTIPLE_VIEWPORTS,
374
  IMMERSIVE_MULTIPLE_VIEWPORTS_ALPHA,
375
  IMMERSIVE_MULTIPLE_VIEWPORTS_DEPTH,
376
  IMMERSIVE_MULTIPLE_VIEWPORTS_ALPHA_DEPTH,
377
  MULTIVIEW_PLAYBACK,
378
  SUBREGION_PLAYBACK,
379
  GLOBAL_PURPOSE_ID_TYPES
380
};
381
382
// Note: Some enums use the attribute 'packed' to use smallest possible integer
383
// type, so that we can save memory when they are used in structs/arrays.
384
385
typedef enum ATTRIBUTE_PACKED {
386
  BLOCK_4X4,
387
  BLOCK_4X8,
388
  BLOCK_8X4,
389
  BLOCK_8X8,
390
  BLOCK_8X16,
391
  BLOCK_16X8,
392
  BLOCK_16X16,
393
  BLOCK_16X32,
394
  BLOCK_32X16,
395
  BLOCK_32X32,
396
  BLOCK_32X64,
397
  BLOCK_64X32,
398
  BLOCK_64X64,
399
  BLOCK_64X128,
400
  BLOCK_128X64,
401
  BLOCK_128X128,
402
  BLOCK_128X256,
403
  BLOCK_256X128,
404
  BLOCK_256X256,
405
  BLOCK_4X16,
406
  BLOCK_16X4,
407
  BLOCK_8X32,
408
  BLOCK_32X8,
409
  BLOCK_16X64,
410
  BLOCK_64X16,
411
  BLOCK_4X32,
412
  BLOCK_32X4,
413
  BLOCK_8X64,
414
  BLOCK_64X8,
415
  BLOCK_SIZES_ALL,
416
  BLOCK_LARGEST = BLOCK_256X256,
417
  BLOCK_SIZES = BLOCK_4X32,
418
  BLOCK_INVALID = 255,
419
} BLOCK_SIZE;
420
421
0
static AVM_INLINE BLOCK_SIZE get_larger_sqr_bsize(BLOCK_SIZE bsize) {
422
0
  switch (bsize) {
423
0
    case BLOCK_4X4:
424
0
    case BLOCK_4X8:
425
0
    case BLOCK_8X4: return BLOCK_8X8;
426
0
427
0
    case BLOCK_8X8:
428
0
    case BLOCK_8X16:
429
0
    case BLOCK_16X8:
430
0
    case BLOCK_4X16:
431
0
    case BLOCK_16X4: return BLOCK_16X16;
432
0
433
0
    case BLOCK_16X16:
434
0
    case BLOCK_16X32:
435
0
    case BLOCK_32X16:
436
0
    case BLOCK_8X32:
437
0
    case BLOCK_32X8: return BLOCK_32X32;
438
0
439
0
    case BLOCK_32X32:
440
0
    case BLOCK_32X64:
441
0
    case BLOCK_64X32:
442
0
    case BLOCK_16X64:
443
0
    case BLOCK_64X16: return BLOCK_64X64;
444
0
445
0
    case BLOCK_64X64:
446
0
    case BLOCK_64X128:
447
0
    case BLOCK_128X64:
448
0
    case BLOCK_128X128: return BLOCK_128X128;
449
0
    default: return BLOCK_INVALID;
450
0
  }
451
0
}
Unexecuted instantiation: avm_codec.c:get_larger_sqr_bsize
Unexecuted instantiation: avm_decoder.c:get_larger_sqr_bsize
Unexecuted instantiation: av2_dx_iface.c:get_larger_sqr_bsize
Unexecuted instantiation: annexF.c:get_larger_sqr_bsize
Unexecuted instantiation: decodeframe.c:get_larger_sqr_bsize
Unexecuted instantiation: decodemv.c:get_larger_sqr_bsize
Unexecuted instantiation: decoder.c:get_larger_sqr_bsize
Unexecuted instantiation: decodetxb.c:get_larger_sqr_bsize
Unexecuted instantiation: detokenize.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_fgm.c:get_larger_sqr_bsize
Unexecuted instantiation: obu.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_ci.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_atlas.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_lcr.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_ops.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_buf.c:get_larger_sqr_bsize
Unexecuted instantiation: avm_dsp_rtcd.c:get_larger_sqr_bsize
Unexecuted instantiation: av2_rtcd.c:get_larger_sqr_bsize
Unexecuted instantiation: blend_a64_hmask.c:get_larger_sqr_bsize
Unexecuted instantiation: blend_a64_mask.c:get_larger_sqr_bsize
Unexecuted instantiation: blend_a64_vmask.c:get_larger_sqr_bsize
Unexecuted instantiation: loopfilter.c:get_larger_sqr_bsize
Unexecuted instantiation: binary_codes_reader.c:get_larger_sqr_bsize
Unexecuted instantiation: bitreader.c:get_larger_sqr_bsize
Unexecuted instantiation: entdec.c:get_larger_sqr_bsize
Unexecuted instantiation: avm_convolve_copy_sse2.c:get_larger_sqr_bsize
Unexecuted instantiation: avm_asm_stubs.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_convolve_sse2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_convolve_ssse3.c:get_larger_sqr_bsize
Unexecuted instantiation: blend_a64_hmask_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: blend_a64_mask_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: blend_a64_vmask_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: loopfilter_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: avm_convolve_copy_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_convolve_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: intrapred_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: blend_a64_mask_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: entdec_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: yv12config.c:get_larger_sqr_bsize
Unexecuted instantiation: annexA.c:get_larger_sqr_bsize
Unexecuted instantiation: alloccommon.c:get_larger_sqr_bsize
Unexecuted instantiation: av2_loopfilter.c:get_larger_sqr_bsize
Unexecuted instantiation: av2_txfm.c:get_larger_sqr_bsize
Unexecuted instantiation: blockd.c:get_larger_sqr_bsize
Unexecuted instantiation: cdef.c:get_larger_sqr_bsize
Unexecuted instantiation: gdf.c:get_larger_sqr_bsize
Unexecuted instantiation: gdf_block.c:get_larger_sqr_bsize
Unexecuted instantiation: cdef_block.c:get_larger_sqr_bsize
Unexecuted instantiation: cfl.c:get_larger_sqr_bsize
Unexecuted instantiation: convolve.c:get_larger_sqr_bsize
Unexecuted instantiation: entropy.c:get_larger_sqr_bsize
Unexecuted instantiation: entropymode.c:get_larger_sqr_bsize
Unexecuted instantiation: entropymv.c:get_larger_sqr_bsize
Unexecuted instantiation: idct.c:get_larger_sqr_bsize
Unexecuted instantiation: level.c:get_larger_sqr_bsize
Unexecuted instantiation: mvref_common.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_util.c:get_larger_sqr_bsize
Unexecuted instantiation: predefined_qm.c:get_larger_sqr_bsize
Unexecuted instantiation: pred_common.c:get_larger_sqr_bsize
Unexecuted instantiation: quant_common.c:get_larger_sqr_bsize
Unexecuted instantiation: reconinter.c:get_larger_sqr_bsize
Unexecuted instantiation: reconintra.c:get_larger_sqr_bsize
Unexecuted instantiation: restoration.c:get_larger_sqr_bsize
Unexecuted instantiation: scale.c:get_larger_sqr_bsize
Unexecuted instantiation: scan.c:get_larger_sqr_bsize
Unexecuted instantiation: seg_common.c:get_larger_sqr_bsize
Unexecuted instantiation: thread_common.c:get_larger_sqr_bsize
Unexecuted instantiation: tile_common.c:get_larger_sqr_bsize
Unexecuted instantiation: timing.c:get_larger_sqr_bsize
Unexecuted instantiation: tip.c:get_larger_sqr_bsize
Unexecuted instantiation: txb_common.c:get_larger_sqr_bsize
Unexecuted instantiation: warped_motion.c:get_larger_sqr_bsize
Unexecuted instantiation: hr_coding.c:get_larger_sqr_bsize
Unexecuted instantiation: intra_matrix.c:get_larger_sqr_bsize
Unexecuted instantiation: intra_dip.cc:get_larger_sqr_bsize(BLOCK_SIZE)
Unexecuted instantiation: ccso.c:get_larger_sqr_bsize
Unexecuted instantiation: bru.c:get_larger_sqr_bsize
Unexecuted instantiation: obu_qm.c:get_larger_sqr_bsize
Unexecuted instantiation: cdef_block_sse2.c:get_larger_sqr_bsize
Unexecuted instantiation: cfl_sse2.c:get_larger_sqr_bsize
Unexecuted instantiation: cdef_block_ssse3.c:get_larger_sqr_bsize
Unexecuted instantiation: cfl_ssse3.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_convolve_2d_ssse3.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_wiener_convolve_ssse3.c:get_larger_sqr_bsize
Unexecuted instantiation: reconinter_ssse3.c:get_larger_sqr_bsize
Unexecuted instantiation: cdef_block_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: av2_convolve_horiz_rs_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: av2_convolve_scale_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_convolve_2d_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_inv_txfm_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_jnt_convolve_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_warp_plane_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: intra_edge_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: optflow_refine_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: reconinter_sse4.c:get_larger_sqr_bsize
Unexecuted instantiation: cdef_block_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: affine_optflow_refine_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: bawp_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: cfl_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_ccso_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_convolve_2d_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_inv_txfm_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_jnt_convolve_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_wiener_convolve_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_warp_affine_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: reconinter_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: gdf_block_avx2.c:get_larger_sqr_bsize
Unexecuted instantiation: avm_convolve.c:get_larger_sqr_bsize
Unexecuted instantiation: entcode.c:get_larger_sqr_bsize
Unexecuted instantiation: intrapred.c:get_larger_sqr_bsize
Unexecuted instantiation: sad.c:get_larger_sqr_bsize
Unexecuted instantiation: highbd_intrapred_sse2.c:get_larger_sqr_bsize
Unexecuted instantiation: av2_inv_txfm2d.c:get_larger_sqr_bsize
452
453
enum {
454
  SHARED_PART = 0,
455
  LUMA_PART = 1,
456
  CHROMA_PART = 2,
457
  TREES_TYPES,
458
} UENUM1BYTE(TREE_TYPE);
459
460
enum {
461
  INTRA_REGION = 0,
462
  MIXED_INTER_INTRA_REGION = 1,
463
  REGION_TYPES = 2,
464
} UENUM1BYTE(REGION_TYPE);
465
466
//  Partition types.  R: Recursive
467
//
468
//  NONE          HORZ          VERT          SPLIT
469
//  +-------+     +-------+     +---+---+     +---+---+
470
//  |       |     |       |     |   |   |     | R | R |
471
//  |       |     +-------+     |   |   |     +---+---+
472
//  |       |     |       |     |   |   |     | R | R |
473
//  +-------+     +-------+     +---+---+     +---+---+
474
//
475
//  HORZ_3                 VERT_3
476
//  +---------------+       +---+------+---+
477
//  |               |       |   |      |   |
478
//  +---------------+       |   |      |   |
479
//  |       |       |       |   |______|   |
480
//  |       |       |       |   |      |   |
481
//  +---------------+       |   |      |   |
482
//  |               |       |   |      |   |
483
//  +---------------+       +---+------+---+
484
//  HORZ_4A                 HORZ_4B
485
//  +---------------+       +---------------+
486
//  |               |       |               |
487
//  +---------------+       +---------------+
488
//  |               |       |               |
489
//  |               |       |               |
490
//  +---------------+       |               |
491
//  |               |       |               |
492
//  |               |       +---------------+
493
//  |               |       |               |
494
//  |               |       |               |
495
//  +---------------+       +---------------+
496
//  |               |       |               |
497
//  +---------------+       +---------------+
498
//
499
//  VERT_4A                                 VERT_4B
500
//  +-------------------------+          +-------------------------+
501
//  |   |      |          |   |          |   |          |      |   |
502
//  |   |      |          |   |          |   |          |      |   |
503
//  |   |      |          |   |          |   |          |      |   |
504
//  +-------------------------+          +-------------------------+
505
enum {
506
  PARTITION_NONE,
507
  PARTITION_HORZ,
508
  PARTITION_VERT,
509
  PARTITION_HORZ_3,  // 3 horizontal sub-partitions with ratios 4:1, 2:1 and 4:1
510
  PARTITION_VERT_3,  // 3 vertical sub-partitions with ratios 4:1, 2:1 and 4:1
511
  PARTITION_HORZ_4A,  // 4 horizontal uneven sub-partitions (1:2:4:1).
512
  PARTITION_HORZ_4B,  // 4 horizontal uneven sub-partitions (1:4:2:1).
513
  PARTITION_VERT_4A,  // 4 vertical uneven sub-partitions (1:2:4:1).
514
  PARTITION_VERT_4B,  // 4 vertical uneven sub-partitions (1:4:2:1).
515
  PARTITION_SPLIT,
516
  EXT_PARTITION_TYPES = PARTITION_SPLIT,
517
  ALL_PARTITION_TYPES = EXT_PARTITION_TYPES + 1,
518
  PARTITION_TYPES = PARTITION_VERT + 1,
519
  PARTITION_INVALID = 255
520
} UENUM1BYTE(PARTITION_TYPE);
521
522
// Rectangular partition types.
523
enum {
524
  HORZ = 0,
525
  VERT,
526
  NUM_RECT_PARTS,
527
  RECT_INVALID = NUM_RECT_PARTS
528
} UENUM1BYTE(RECT_PART_TYPE);
529
530
// Uneven 4-way partition types.
531
enum {
532
  UNEVEN_4A = 0,
533
  UNEVEN_4B,
534
  NUM_UNEVEN_4WAY_PARTS,
535
} UENUM1BYTE(UNEVEN_4WAY_PART_TYPE);
536
537
typedef char PARTITION_CONTEXT;
538
4.78M
#define PARTITION_PLOFFSET 4  // number of probability models per block size
539
540
#define PARTITION_BLOCK_SIZES BLOCK_SIZES
541
9.07k
#define SQUARE_SPLIT_CONTEXTS (2 * PARTITION_PLOFFSET)
542
543
// Extended SDP is only allowed for block samples >= 64 and <= 1024. The allowed
544
// block size group is 64, 128, 256, 512, 1024, so the number of block size
545
// group is 5 in total.
546
2.52k
#define INTER_SDP_BSIZE_GROUP 4
547
0
#define INTER_SDP_MAX_BLOCK_SIZE 64
548
// block transform size
549
enum {
550
  TX_4X4,             // 4x4 transform
551
  TX_8X8,             // 8x8 transform
552
  TX_16X16,           // 16x16 transform
553
  TX_32X32,           // 32x32 transform
554
  TX_64X64,           // 64x64 transform
555
  TX_4X8,             // 4x8 transform
556
  TX_8X4,             // 8x4 transform
557
  TX_8X16,            // 8x16 transform
558
  TX_16X8,            // 16x8 transform
559
  TX_16X32,           // 16x32 transform
560
  TX_32X16,           // 32x16 transform
561
  TX_32X64,           // 32x64 transform
562
  TX_64X32,           // 64x32 transform
563
  TX_4X16,            // 4x16 transform
564
  TX_16X4,            // 16x4 transform
565
  TX_8X32,            // 8x32 transform
566
  TX_32X8,            // 32x8 transform
567
  TX_16X64,           // 16x64 transform
568
  TX_64X16,           // 64x16 transform
569
  TX_4X32,            // 4x32 transform
570
  TX_32X4,            // 32x4 transform
571
  TX_8X64,            // 8x64 transform
572
  TX_64X8,            // 64x8 transform
573
  TX_4X64,            // 4x64 transform
574
  TX_64X4,            // 64x4 transform
575
  TX_SIZES_ALL,       // Includes rectangular transforms
576
  TX_SIZES = TX_4X8,  // Does NOT include rectangular transforms
577
  TX_SIZES_LARGEST = TX_64X64,
578
  TX_INVALID = 255  // Invalid transform size
579
} UENUM1BYTE(TX_SIZE);
580
581
//  Baseline transform partition types
582
//
583
//  Square:
584
//  NONE           SPLIT
585
//  +-------+      +---+---+
586
//  |       |      |   |   |
587
//  |       |      +---+---+
588
//  |       |      |   |   |
589
//  +-------+      +---+---+
590
//
591
//
592
//  Rectangular:
593
//  NONE                  SPLIT
594
//  +--------------+      +-------+-------+
595
//  |              |      |       |       |
596
//  |              |      +       +       +
597
//  |              |      |       |       |
598
//  +--------------+      +-------+-------+
599
//
600
//  Extended transform partition types (square and rect are the same)
601
//
602
//  NONE           SPLIT
603
//  +-------+      +---+---+
604
//  |       |      |   |   |
605
//  |       |      +---+---+
606
//  |       |      |   |   |
607
//  +-------+      +---+---+
608
//
609
//  HORZ            VERT
610
//  +-------+      +---+---+
611
//  |       |      |   |   |
612
//  +-------+      |   |   |
613
//  |       |      |   |   |
614
//  +-------+      +---+---+
615
//
616
//  HORZ4          VERT4
617
//  +-------+      +--+--+--+--+
618
//  |       |      |  |  |  |  |
619
//  +-------+      |  |  |  |  |
620
//  |       |      |  |  |  |  |
621
//  +-------+      |  |  |  |  |
622
//  |       |      +--+--+--+--+
623
//  +-------+
624
//  |       |
625
//  +-------+
626
//
627
//  HORZ5          VERT5
628
//  +---+---+      +--+----+--+
629
//  |   |   |      |  |    |  |
630
//  +---+---+      +--+    +--+
631
//  |       |      |  |    |  |
632
//  |       |      +--+----+--+
633
//  +---+---+
634
//  |   |   |
635
//  +---+---+
636
enum {
637
  TX_PARTITION_NONE,
638
  TX_PARTITION_SPLIT,
639
  TX_PARTITION_HORZ,
640
  TX_PARTITION_VERT,
641
  TX_PARTITION_HORZ4,
642
  TX_PARTITION_VERT4,
643
  TX_PARTITION_HORZ5,
644
  TX_PARTITION_VERT5,
645
  TX_PARTITION_TYPES,
646
  TX_PARTITION_INVALID = 255
647
} UENUM1BYTE(TX_PARTITION_TYPE);
648
649
#define TX_PARTITION_TYPE_NUM (TX_PARTITION_TYPES - 1)
650
#define TX_PARTITION_TYPE_NUM_VERT_AND_HORZ 14
651
#define TX_PARTITION_TYPE_NUM_VERT_OR_HORZ 3
652
#define TX_PARTITION_DIRS 2  // Horizontal and vertical.
653
654
217k
#define MAX_TX_SIZE_LOG2 (6)
655
217k
#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
656
34.8M
#define MIN_TX_SIZE_LOG2 2
657
158k
#define MIN_TX_SIZE (1 << MIN_TX_SIZE_LOG2)
658
#define MAX_TX_SQUARE (MAX_TX_SIZE * MAX_TX_SIZE)
659
#define MAX_TRELLIS 1024
660
661
63.3M
#define TX_PAD_HOR_LOG2 2
662
7.67M
#define TX_PAD_HOR 4
663
2.63M
#define TX_PAD_LEFT 4
664
4.28M
#define TX_PAD_TOP 4
665
1.16M
#define TX_PAD_BOTTOM 4
666
1.16M
#define TX_PAD_VER (TX_PAD_TOP + TX_PAD_BOTTOM)
667
// Pad 16 extra bytes to avoid reading overflow in SIMD optimization.
668
1.16M
#define TX_PAD_END 16
669
1.16M
#define TX_PAD_2D ((32 + TX_PAD_HOR) * (32 + TX_PAD_VER) + TX_PAD_END)
670
671
// Number of maxium size transform blocks in the maximum size superblock
672
#define MAX_TX_BLOCKS_IN_MAX_SB_LOG2 ((MAX_SB_SIZE_LOG2 - MAX_TX_SIZE_LOG2) * 2)
673
#define MAX_TX_BLOCKS_IN_MAX_SB (1 << MAX_TX_BLOCKS_IN_MAX_SB_LOG2)
674
675
// frame transform mode
676
enum {
677
  ONLY_4X4,         // use only 4x4 transform
678
  TX_MODE_LARGEST,  // transform size is the largest possible for pu size
679
  TX_MODE_SELECT,   // transform specified for each block
680
  TX_MODES,
681
} UENUM1BYTE(TX_MODE);
682
683
// 1D tx types
684
enum {
685
  DCT_1D,
686
  ADST_1D,
687
  FLIPADST_1D,
688
  IDTX_1D,
689
  DDT_1D,
690
  TX_TYPES_1D,
691
} UENUM1BYTE(TX_TYPE_1D);
692
693
enum {
694
  DCT_DCT,            // DCT in both horizontal and vertical
695
  ADST_DCT,           // ADST in vertical, DCT in horizontal
696
  DCT_ADST,           // DCT in vertical, ADST in horizontal
697
  ADST_ADST,          // ADST in both directions
698
  FLIPADST_DCT,       // FLIPADST in vertical, DCT in horizontal
699
  DCT_FLIPADST,       // DCT in vertical, FLIPADST in horizontal
700
  FLIPADST_FLIPADST,  // FLIPADST in both directions
701
  ADST_FLIPADST,      // ADST in vertical, FLIPADST in horizontal
702
  FLIPADST_ADST,      // FLIPADST in vertical, ADST in horizontal
703
  IDTX,               // Identity in both directions
704
  V_DCT,              // DCT in vertical, identity in horizontal
705
  H_DCT,              // Identity in vertical, DCT in horizontal
706
  V_ADST,             // ADST in vertical, identity in horizontal
707
  H_ADST,             // Identity in vertical, ADST in horizontal
708
  V_FLIPADST,         // FLIPADST in vertical, identity in horizontal
709
  H_FLIPADST,         // Identity in vertical, FLIPADST in horizontal
710
  TX_TYPES,
711
  DCT_ADST_TX_MASK = 0x000F,  // Either DCT or ADST in each direction
712
} UENUM2BYTE(TX_TYPE);
713
714
enum {
715
  DCT2,
716
  IDT,
717
  DST7,
718
  DCT8,
719
  DDTX,
720
  FDDT,
721
} UENUM2BYTE(TX1D_TYPE);
722
723
enum {
724
  CCTX_NONE,     // No cross chroma transform
725
  CCTX_45,       // 45 degrees rotation (Haar transform)
726
  CCTX_30,       // 30 degrees rotation
727
  CCTX_60,       // 60 degrees rotation
728
  CCTX_MINUS45,  // -45 degrees rotation
729
  CCTX_MINUS30,  // -30 degrees rotation
730
  CCTX_MINUS60,  // -60 degrees rotation
731
  CCTX_TYPES,
732
  CCTX_START = CCTX_NONE + 1,
733
} UENUM1BYTE(CctxType);
734
735
enum { FWD_TXFM, INV_TXFM, TXFM_DIRECTIONS } UENUM1BYTE(TXFM_DIRECTION);
736
737
enum {
738
  // DCT only
739
  EXT_TX_SET_DCTONLY,
740
  // DCT + Identity only
741
  EXT_TX_SET_DCT_IDTX,
742
  // DCT_DCT + ADST_DCT/DCT_ADST + FLIPADST_DCT/DCT_FLIPADST + H_DCT/V_DCT
743
  EXT_TX_SET_LONG_SIDE_64,
744
  // DCT_DCT + Identity + ADST_DCT/DCT_ADST + FLIPADST_DCT/DCT_FLIPADST +
745
  // H_DCT/V_DCT
746
  EXT_TX_SET_LONG_SIDE_32,
747
748
  // Discrete Trig transforms w/o flip (4) + Identity (1)
749
  EXT_TX_SET_DTT4_IDTX,
750
  // Discrete Trig transforms w/o flip (4) + Identity (1) + 1D Hor/vert DCT (2)
751
  EXT_TX_SET_DTT4_IDTX_1DDCT,
752
  // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver DCT (2)
753
  EXT_TX_SET_DTT9_IDTX_1DDCT,
754
  // Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6)
755
  EXT_TX_SET_ALL16,
756
  EXT_NEW_TX_SET,
757
  // DCT + Identity (1) + 1D Hor/vert DCT (2)
758
  EXT_TX_SET_DCT_IDTX_IDDCT,
759
  EXT_TX_SET_TYPES
760
} UENUM1BYTE(TxSetType);
761
762
#define EOB_TX_CTXS 3
763
#define EXT_TX_SIZES 4  // number of sizes that use extended transforms
764
765
#define EXT_TX_SETS_INTER 5  // Sets of transform selections for INTER
766
#define INTER_TX_SET1 16
767
#define INTER_TX_SET2 12
768
#define INTER_TX_SET3 2
769
#define INTER_TX_SET4 4
770
771
#define EXT_TX_SETS_INTRA 3  // Sets of transform selections for INTRA
772
#define INTRA_TX_SET1 7
773
#define INTRA_TX_SET2 2
774
775
enum { PLANE_TYPE_Y, PLANE_TYPE_UV, PLANE_TYPES } UENUM1BYTE(PLANE_TYPE);
776
777
221k
#define CFL_ALPHABET_SIZE_LOG2 3
778
58.0k
#define CFL_ALPHABET_SIZE (1 << CFL_ALPHABET_SIZE_LOG2)
779
81.9k
#define CFL_IDX_U(idx) (idx >> CFL_ALPHABET_SIZE_LOG2)
780
58.0k
#define CFL_IDX_V(idx) (idx & (CFL_ALPHABET_SIZE - 1))
781
782
enum { CFL_PRED_U, CFL_PRED_V, CFL_PRED_PLANES } UENUM1BYTE(CFL_PRED_TYPE);
783
784
enum {
785
  CFL_SIGN_ZERO,
786
  CFL_SIGN_NEG,
787
  CFL_SIGN_POS,
788
  CFL_SIGNS
789
} UENUM1BYTE(CFL_SIGN_TYPE);
790
791
enum {
792
  CFL_DISALLOWED,
793
  CFL_ALLOWED,
794
  CFL_ALLOWED_TYPES
795
} UENUM1BYTE(CFL_ALLOWED_TYPE);
796
797
enum {
798
  MHCCP_DISALLOWED,
799
  MHCCP_ALLOWED,
800
  MHCCP_ALLOWED_TYPES
801
} UENUM1BYTE(MHCCP_ALLOWED_TYPE);
802
803
enum {
804
  CFL_DISALLOWED_FOR_CHROMA,
805
  CFL_ALLOWED_FOR_CHROMA,
806
  CFL_ALLOWED_TYPES_FOR_SDP
807
} UENUM1BYTE(CFL_ALLOWED_FOR_SDP_TYPE);
808
809
// CFL_SIGN_ZERO,CFL_SIGN_ZERO is invalid
810
#define CFL_JOINT_SIGNS (CFL_SIGNS * CFL_SIGNS - 1)
811
// CFL_SIGN_U is equivalent to (js + 1) / 3 for js in 0 to 8
812
505k
#define CFL_SIGN_U(js) (((js + 1) * 11) >> 5)
813
// CFL_SIGN_V is equivalent to (js + 1) % 3 for js in 0 to 8
814
252k
#define CFL_SIGN_V(js) ((js + 1) - CFL_SIGNS * CFL_SIGN_U(js))
815
816
// There is no context when the alpha for a given plane is zero.
817
// So there are 2 fewer contexts than joint signs.
818
#define CFL_ALPHA_CONTEXTS (CFL_JOINT_SIGNS + 1 - CFL_SIGNS)
819
81.9k
#define CFL_CONTEXT_U(js) (js + 1 - CFL_SIGNS)
820
// Also, the contexts are symmetric under swapping the planes.
821
#define CFL_CONTEXT_V(js) \
822
58.0k
  (CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS)
823
824
enum {
825
  PALETTE_MAP,
826
  COLOR_MAP_TYPES,
827
} UENUM1BYTE(COLOR_MAP_TYPE);
828
829
// Number of colors in a palette are from 2 to 8 inclusive.
830
// Hence total 7 options.
831
4.03k
#define PALETTE_SIZES 7
832
#define PALETTE_COLORS 8
833
834
// Note: All directional predictors must be between V_PRED and D67_PRED (both
835
// inclusive).
836
enum {
837
  DC_PRED,        // Average of above and left pixels
838
  V_PRED,         // Vertical
839
  H_PRED,         // Horizontal
840
  D45_PRED,       // Directional 45  degree
841
  D135_PRED,      // Directional 135 degree
842
  D113_PRED,      // Directional 113 degree
843
  D157_PRED,      // Directional 157 degree
844
  D203_PRED,      // Directional 203 degree
845
  D67_PRED,       // Directional 67  degree
846
  SMOOTH_PRED,    // Combination of horizontal and vertical interpolation
847
  SMOOTH_V_PRED,  // Vertical interpolation
848
  SMOOTH_H_PRED,  // Horizontal interpolation
849
  PAETH_PRED,     // Predict from the direction of smallest gradient
850
  NEARMV,
851
  GLOBALMV,
852
  NEWMV,
853
  WARPMV,      // WARPMV mode (original WARPMV)
854
  WARP_NEWMV,  // WARP_NEWMV mode (original warp modes under NEWMV)
855
               // Compound ref compound modes
856
  NEAR_NEARMV,
857
  NEAR_NEWMV,
858
  NEW_NEARMV,
859
  GLOBAL_GLOBALMV,
860
  NEW_NEWMV,
861
  JOINT_NEWMV,
862
  NEAR_NEARMV_OPTFLOW,
863
  NEAR_NEWMV_OPTFLOW,
864
  NEW_NEARMV_OPTFLOW,
865
  NEW_NEWMV_OPTFLOW,
866
  JOINT_NEWMV_OPTFLOW,
867
  MB_MODE_COUNT,
868
  INTRA_MODE_START = DC_PRED,
869
  INTRA_MODE_END = NEARMV,
870
  DIR_MODE_START = V_PRED,
871
  DIR_MODE_END = D67_PRED + 1,
872
  INTRA_MODE_NUM = INTRA_MODE_END - INTRA_MODE_START,
873
  SINGLE_INTER_MODE_START = NEARMV,
874
  SINGLE_INTER_MODE_END = NEAR_NEARMV,
875
  SINGLE_INTER_MODE_NUM = SINGLE_INTER_MODE_END - SINGLE_INTER_MODE_START,
876
  COMP_INTER_MODE_START = NEAR_NEARMV,
877
  COMP_INTER_MODE_END = MB_MODE_COUNT,
878
  COMP_INTER_MODE_NUM = COMP_INTER_MODE_END - COMP_INTER_MODE_START,
879
  COMP_OPTFLOW_MODE_START = NEAR_NEARMV_OPTFLOW,
880
  INTER_COMPOUND_REF_TYPES = COMP_OPTFLOW_MODE_START - COMP_INTER_MODE_START,
881
  INTER_MODE_START = NEARMV,
882
  INTER_MODE_END = MB_MODE_COUNT,
883
  INTRA_MODES = PAETH_PRED + 1,   // PAETH_PRED has to be the last intra mode.
884
  INTRA_INVALID = MB_MODE_COUNT,  // For uv_mode in inter blocks
885
  MODE_INVALID = 255
886
} UENUM1BYTE(PREDICTION_MODE);
887
888
// TODO(ltrudeau) Do we really want to pack this?
889
// TODO(ltrudeau) Do we match with PREDICTION_MODE?
890
enum {
891
  UV_DC_PRED,        // Average of above and left pixels
892
  UV_V_PRED,         // Vertical
893
  UV_H_PRED,         // Horizontal
894
  UV_D45_PRED,       // Directional 45  degree
895
  UV_D135_PRED,      // Directional 135 degree
896
  UV_D113_PRED,      // Directional 113 degree
897
  UV_D157_PRED,      // Directional 157 degree
898
  UV_D203_PRED,      // Directional 203 degree
899
  UV_D67_PRED,       // Directional 67  degree
900
  UV_SMOOTH_PRED,    // Combination of horizontal and vertical interpolation
901
  UV_SMOOTH_V_PRED,  // Vertical interpolation
902
  UV_SMOOTH_H_PRED,  // Horizontal interpolation
903
  UV_PAETH_PRED,     // Predict from the direction of smallest gradient
904
  UV_CFL_PRED,       // Chroma-from-Luma
905
  UV_INTRA_MODES,
906
  UV_MODE_INVALID,  // For uv_mode in inter blocks
907
} UENUM1BYTE(UV_PREDICTION_MODE);
908
909
enum {
910
  CFL_EXPLICIT,       // av2 cfl
911
  CFL_DERIVED_ALPHA,  // implicit CfL mode with derived scaling factor
912
  CFL_MULTI_PARAM,    // multi hypothesis cross component prediction
913
  CFL_TYPE_COUNT,     // CfL mode type count
914
} UENUM1BYTE(CFL_TYPE);
915
916
// Number of top model rd to store for pruning y modes in intra mode decision
917
#define TOP_INTRA_MODEL_COUNT 6
918
#define TOP_TX_PART_COUNT 4
919
#define TOP_INTER_TX_PART_COUNT 8
920
// Total number of luma intra prediction modes (include both directional and
921
// non-directional modes)
922
255M
#define LUMA_MODE_COUNT 61
923
924
enum {
925
  SIMPLE_TRANSLATION,
926
  INTERINTRA,
927
  WARP_CAUSAL,  // Warp estimation from spatial MVs
928
  WARP_DELTA,   // Directly-signaled warp model
929
  WARP_EXTEND,  // Extension of an existing warp model into another block
930
  MOTION_MODES
931
} UENUM1BYTE(MOTION_MODE);
932
933
#define OPFL_GRAD_UNIT_LOG2 4
934
#define OPFL_GRAD_UNIT (1 << OPFL_GRAD_UNIT_LOG2)
935
936
enum {
937
  II_DC_PRED,
938
  II_V_PRED,
939
  II_H_PRED,
940
  II_SMOOTH_PRED,
941
  INTERINTRA_MODES
942
} UENUM1BYTE(INTERINTRA_MODE);
943
944
enum {
945
  COMPOUND_AVERAGE,
946
  COMPOUND_WEDGE,
947
  COMPOUND_DIFFWTD,
948
  COMPOUND_TYPES,
949
  MASKED_COMPOUND_TYPES = 2,
950
} UENUM1BYTE(COMPOUND_TYPE);
951
952
enum {
953
  SEQ_LEVEL_2_0 = 0,
954
  SEQ_LEVEL_2_1 = 1,
955
  SEQ_LEVEL_3_0 = 2,
956
  SEQ_LEVEL_3_1 = 3,
957
  SEQ_LEVEL_4_0 = 4,
958
  SEQ_LEVEL_4_1 = 5,
959
  SEQ_LEVEL_5_0 = 6,
960
  SEQ_LEVEL_5_1 = 7,
961
  SEQ_LEVEL_5_2 = 8,
962
  SEQ_LEVEL_5_3 = 9,
963
  SEQ_LEVEL_6_0 = 10,
964
  SEQ_LEVEL_6_1 = 11,
965
  SEQ_LEVEL_6_2 = 12,
966
  SEQ_LEVEL_6_3 = 13,
967
  SEQ_LEVEL_7_0 = 14,
968
  SEQ_LEVEL_7_1 = 15,
969
  SEQ_LEVEL_7_2 = 16,
970
  SEQ_LEVEL_7_3 = 17,
971
  SEQ_LEVEL_8_0 = 18,
972
  SEQ_LEVEL_8_1 = 19,
973
  SEQ_LEVEL_8_2 = 20,
974
  SEQ_LEVEL_8_3 = 21,
975
  SEQ_LEVELS,
976
  SEQ_LEVEL_MAX = 31
977
} UENUM1BYTE(AV2_LEVEL);
978
979
98.9k
#define LEVEL_BITS 5
980
981
#define DIRECTIONAL_MODES 8
982
579k
#define MAX_ANGLE_DELTA 3
983
15.3M
#define ANGLE_STEP 3
984
985
// Total delta angles for one nominal directional mode
986
1.15M
#define TOTAL_ANGLE_DELTA_COUNT 7
987
988
// The warpmv and warpmv_new mode is signalled as a separate flag
989
// So the number of remaining modes to be signalled is (SINGLE_INTER_MODE_NUM-2)
990
#define INTER_SINGLE_MODES (SINGLE_INTER_MODE_NUM - 2)
991
992
0
#define SKIP_CONTEXTS 6
993
#define SKIP_MODE_CONTEXTS 3
994
995
#define INTRABC_CONTEXTS 3
996
997
#define NUM_ALLOWED_BV_PRECISIONS 2
998
#define NUM_BV_PRECISION_CONTEXTS 1
999
#define COMP_GROUP_IDX_CONTEXTS 12
1000
1001
31.2k
#define MIN_MAX_DRL_BITS 1
1002
2.07k
#define MAX_MAX_DRL_BITS (MAX_REF_MV_STACK_SIZE - 1)
1003
1004
#define WARPMV_MODE_CONTEXT 5
1005
46.6k
#define MAX_REF_BV_STACK_SIZE 4
1006
110k
#define MIN_MAX_IBC_DRL_BITS 1
1007
46.6k
#define MAX_MAX_IBC_DRL_BITS (MAX_REF_BV_STACK_SIZE - 1)
1008
1009
#define OPFL_MODE_CONTEXTS 2
1010
1011
#define INTER_MODE_CONTEXTS 5
1012
#define DRL_MODE_CONTEXTS INTER_MODE_CONTEXTS
1013
1014
#define INTER_COMPOUND_SAME_REFS_TYPES (INTER_COMPOUND_REF_TYPES - 2)
1015
1016
// Explicit BAWP scaling factor counts
1017
#define EXPLICIT_BAWP_SCALE_CNT 2
1018
// Explicit BAWP scaling factor context counts
1019
#define BAWP_SCALES_CTX_COUNT 3
1020
// The allowed value range for bawp_flag
1021
146k
#define BAWP_REF_LINES 1
1022
#define BAWP_OPTION_CNT 4
1023
1024
#define AMVD_MODE_CONTEXTS 3
1025
#define NUM_AMVD_MODES 9
1026
1027
// Number of supported factors for compound weighted prediction
1028
0
#define MAX_CWP_NUM 5
1029
// maximum value for the supported factors
1030
#define CWP_MAX 20
1031
// minimum value for the supported factors
1032
#define CWP_MIN -4
1033
// Weighting factor for simple averge prediction
1034
1.04M
#define CWP_EQUAL 8
1035
0
#define CWP_WEIGHT_BITS 4
1036
#define MAX_CWP_CONTEXTS 2
1037
1038
// Number of supported factors for TIP weights
1039
#define MAX_TIP_WTD_NUM 8
1040
0
#define TIP_EQUAL_WTD 8
1041
0
#define TIP_SINGLE_WTD 16
1042
#define MAX_AMVD_INDEX 8
1043
1044
96.7k
#define DELTA_Q_SMALL 7
1045
4.87k
#define DELTA_Q_SMALL_MINUS_2 (DELTA_Q_SMALL - 2)
1046
#define DELTA_Q_PROBS (DELTA_Q_SMALL)
1047
#define DEFAULT_DELTA_Q_RES_PERCEPTUAL 4
1048
#define DEFAULT_DELTA_Q_RES_OBJECTIVE 4
1049
1050
107k
#define MAX_MV_REF_CANDIDATES 2
1051
1.38M
#define MAX_REF_MV_STACK_SIZE 6
1052
0
#define USABLE_REF_MV_STACK_SIZE (MAX_REF_MV_STACK_SIZE)
1053
1054
69.5k
#define REF_CAT_LEVEL 0
1055
1056
0
#define MAX_WARP_REF_CANDIDATES 4
1057
#define WARP_REF_CONTEXTS 1
1058
1059
#define INTRA_INTER_CONTEXTS 4
1060
#define COMP_INTER_CONTEXTS 5
1061
#define REF_CONTEXTS 3
1062
1063
// Group size from mapping block size to tx partition context
1064
#define TXFM_SPLIT_GROUP 9
1065
typedef uint16_t TXFM_CONTEXT;
1066
1067
#define TIP_CONTEXTS 3
1068
1069
664k
#define MAX_MFH_NUM 16
1070
#define WARP_CAUSAL_MODE_CTX 4
1071
1072
#define TIP_PRED_MODES 2
1073
#define WARP_EXTEND_CTX 3
1074
1075
311M
#define INTER_REFS_PER_FRAME 7
1076
1077
#define MAX_NUM_LONG_TERM_FRAMES INTER_REFS_PER_FRAME
1078
1079
// log 2 of max 8 references per-frame (7 inter + 1 intra)
1080
// log2(INTER_REFS_PER_FRAME + 1)
1081
0
#define MAX_REFS_PER_FRAME_LOG2 3
1082
1083
423M
#define REF_FRAMES 16
1084
1085
// NOTE: A limited number of unidirectional reference pairs can be signalled for
1086
//       compound prediction. The use of skip mode, on the other hand, makes it
1087
//       possible to have a reference pair not listed for explicit signaling.
1088
#define MODE_CTX_REF_FRAMES                                \
1089
1.88M
  (INTER_REFS_PER_FRAME * (INTER_REFS_PER_FRAME + 3) / 2 + \
1090
1.88M
   2)  // additional combinations for the same reference of compound mode
1091
1092
// With k=INTER_REFS_PER_FRAMES, indices 0 to k-1 represent rank 1 to rank k
1093
// references. The next k(k-1)/2 indices are left for compound reference types
1094
// (there are k choose 2 compound combinations). Then, index for intra frame is
1095
// defined as k+k(k-1)/2.
1096
#define INTRA_FRAME                                    \
1097
167M
  (INTER_REFS_PER_FRAME * (INTER_REFS_PER_FRAME + 3) / \
1098
167M
   2)  // additional combinations for the same reference of compound mode
1099
// Used for indexing into arrays that contain reference data for
1100
// inter and intra.
1101
1.03M
#define INTRA_FRAME_INDEX INTER_REFS_PER_FRAME
1102
4.75M
#define NONE_FRAME INVALID_IDX
1103
#define AVM_REFFRAME_ALL ((1 << INTER_REFS_PER_FRAME) - 1)
1104
1105
// REF_FRAMES for the cm->ref_frame_map array, 1 scratch frame for the new
1106
// frame in cm->cur_frame, INTER_REFS_PER_FRAME for scaled references on the
1107
// encoder in the cpi->scaled_ref_buf array.
1108
// Each substream has its own sub-DPB.
1109
#define FRAME_BUFFERS \
1110
53.3M
  (REF_FRAMES + 1 + INTER_REFS_PER_FRAME) * AVM_MAX_NUM_STREAMS
1111
1112
1.88M
#define TIP_FRAME (MODE_CTX_REF_FRAMES - 1)
1113
#define TIP_FRAME_INDEX (INTER_REFS_PER_FRAME + 1)
1114
0
#define SINGLE_REF_FRAMES (INTER_REFS_PER_FRAME + 2)
1115
#define MAX_COMPOUND_REF_INDEX (SINGLE_REF_FRAMES - 1)
1116
1117
// Note: It includes single and compound references. So, it can take values from
1118
// NONE_FRAME to (MODE_CTX_REF_FRAMES - 1). Hence, it is not defined as an enum.
1119
typedef int8_t MV_REFERENCE_FRAME;
1120
1121
#define MAX_LR_FLEX_SWITCHABLE_BITS 3
1122
1123
/*!\endcond */
1124
1125
/*!\enum RestorationType
1126
 * \brief This enumeration defines various restoration types supported
1127
 */
1128
typedef enum {
1129
  RESTORE_NONE,          /**< No restoration */
1130
  RESTORE_PC_WIENER,     /**< Pixel-classified Wiener restoration */
1131
  RESTORE_WIENER_NONSEP, /**< Nonseparable Wiener restoration */
1132
  RESTORE_SWITCHABLE,    /**< Switchable restoration */
1133
  RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE, /**< Num Switchable types */
1134
  RESTORE_TYPES = RESTORE_SWITCHABLE + 1,        /**< Num Restore types */
1135
} RestorationType;
1136
1137
/*!\cond */
1138
// Picture prediction structures (0-12 are predefined) in scalability metadata.
1139
enum {
1140
  SCALABILITY_L1T2 = 0,
1141
  SCALABILITY_L1T3 = 1,
1142
  SCALABILITY_L2T1 = 2,
1143
  SCALABILITY_L2T2 = 3,
1144
  SCALABILITY_L2T3 = 4,
1145
  SCALABILITY_S2T1 = 5,
1146
  SCALABILITY_S2T2 = 6,
1147
  SCALABILITY_S2T3 = 7,
1148
  SCALABILITY_L2T1h = 8,
1149
  SCALABILITY_L2T2h = 9,
1150
  SCALABILITY_L2T3h = 10,
1151
  SCALABILITY_S2T1h = 11,
1152
  SCALABILITY_S2T2h = 12,
1153
  SCALABILITY_S2T3h = 13,
1154
  SCALABILITY_SS = 14
1155
} UENUM1BYTE(SCALABILITY_STRUCTURES);
1156
1157
31.5M
#define DIV_LUT_PREC_BITS 9
1158
136M
#define DIV_LUT_BITS 7
1159
1160
77.3M
#define DIR_MODES_0_90 17
1161
73.0M
#define IBP_WEIGHT_SHIFT DIV_LUT_BITS
1162
1163
73.0M
#define IBP_WEIGHT_MAX (1 << IBP_WEIGHT_SHIFT)
1164
#define IBP_WEIGHT_REF IBP_WEIGHT_MAX
1165
typedef uint16_t IbpWeightsType;
1166
1167
/*!\enum Warp projection type
1168
 * \brief This enumeration defines various warp projection type supported
1169
 */
1170
typedef enum {
1171
  PROJ_GLOBAL_MOTION,  /**< block is from global motion */
1172
  PROJ_SPATIAL,        /**< Project from spatial neighborhood */
1173
  PROJ_PARAM_BANK,     /**< Project from circular buffer */
1174
  PROJ_DEFAULT,        /**< Default values */
1175
  WARP_PROJ_TYPES = 4, /**< Num projection types */
1176
} WarpProjectionType;
1177
1178
/*!\endcond */
1179
1180
#ifdef __cplusplus
1181
}  // extern "C"
1182
#endif
1183
1184
#endif  // AVM_AV2_COMMON_ENUMS_H_