/src/avm/av2/common/tile_common.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_TILE_COMMON_H_ |
14 | | #define AVM_AV2_COMMON_TILE_COMMON_H_ |
15 | | |
16 | | #ifdef __cplusplus |
17 | | extern "C" { |
18 | | #endif |
19 | | |
20 | | #include "config/avm_config.h" |
21 | | #include "av2/common/enums.h" |
22 | | |
23 | | struct AV2Common; |
24 | | struct SequenceHeader; |
25 | | struct CommonTileParams; |
26 | | struct TileInfoSyntax; |
27 | | |
28 | | #define DEFAULT_MAX_NUM_TG 1 |
29 | | |
30 | | typedef struct TileInfo { |
31 | | int mi_row_start, mi_row_end; |
32 | | int mi_col_start, mi_col_end; |
33 | | int tile_row; |
34 | | int tile_col; |
35 | | int tile_active_mode; |
36 | | } TileInfo; |
37 | | |
38 | | // initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on |
39 | | // 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)' |
40 | | void av2_tile_init(TileInfo *tile, const struct AV2Common *cm, int row, |
41 | | int col); |
42 | | |
43 | | void av2_tile_set_row(TileInfo *tile, const struct AV2Common *cm, int row); |
44 | | void av2_tile_set_col(TileInfo *tile, const struct AV2Common *cm, int col); |
45 | | |
46 | | int av2_get_sb_rows_in_tile(struct AV2Common *cm, TileInfo tile); |
47 | | int av2_get_sb_cols_in_tile(struct AV2Common *cm, TileInfo tile); |
48 | | |
49 | | typedef struct { |
50 | | int left, top, right, bottom; |
51 | | } AV2PixelRect; |
52 | | |
53 | | // Return the pixel extents of the given tile |
54 | | AV2PixelRect av2_get_tile_rect(const TileInfo *tile_info, |
55 | | const struct AV2Common *cm, int is_uv); |
56 | | |
57 | | // Define tile maximum width and area |
58 | | // There is no maximum height since height is limited by area and width limits |
59 | | // The minimum tile width or height is fixed at one superblock |
60 | 11.2k | #define MAX_TILE_WIDTH (4096) // Max Tile width in pixels |
61 | 11.2k | #define MAX_TILE_AREA (4096 * 2304) // Maximum tile area in pixels |
62 | | |
63 | | // Tile width scaling factors for different levels and tiers |
64 | | // [tier][lev] - values are multiplied by MAX_TILE_WIDTH and divided by 4 |
65 | | static const int av2_tile_width_scaling_factor[2][SEQ_LEVEL_MAX] = { |
66 | | // Tier 0 |
67 | | { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
68 | | 4, 4, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 22-30 reserved |
69 | | // Tier 1 |
70 | | { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, |
71 | | 8, 8, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // 22-30 reserved |
72 | | }; |
73 | | |
74 | | // Tile area scaling factors for different levels and tiers |
75 | | // [tier][lev] - values are multiplied by MAX_TILE_AREA and divided by 4 |
76 | | static const int av2_tile_area_scaling_factor[2][SEQ_LEVEL_MAX] = { |
77 | | // Tier 0 |
78 | | { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, |
79 | | 8, 8, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 22-30 reserved |
80 | | // Tier 1 |
81 | | { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, |
82 | | 16, 16, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 22-30 reserved |
83 | | }; |
84 | | |
85 | | void av2_get_uniform_tile_size(const struct AV2Common *cm, int *w, int *h); |
86 | | void av2_get_tile_limits(struct CommonTileParams *const tiles, int cm_mi_rows, |
87 | | int cm_mi_cols, int mib_size_log2, |
88 | | int seq_mib_size_log2, int seq_level_idx, |
89 | | int seq_tier); |
90 | | void av2_get_seq_tile_limits(struct TileInfoSyntax *const tiles, |
91 | | int frame_height, int frame_width, |
92 | | int mib_size_log2, int seq_mib_size_log2, |
93 | | int seq_level_idx, int seq_tier); |
94 | | void av2_calculate_tile_cols(struct CommonTileParams *const tiles); |
95 | | void av2_calculate_tile_rows(struct CommonTileParams *const tiles); |
96 | | |
97 | | // Checks if the minimum tile_width requirement is satisfied |
98 | | int av2_is_min_tile_width_satisfied(const struct AV2Common *cm); |
99 | | |
100 | | // Get tile row or col from mi_row or mi_col respectively |
101 | | int get_tile_row_from_mi_row(const struct CommonTileParams *tiles, int mi_row); |
102 | | int get_tile_col_from_mi_col(const struct CommonTileParams *tiles, int mi_col); |
103 | | |
104 | | // Check if location of a block is on the horz or vert tile boundary |
105 | | int is_horz_tile_boundary(struct CommonTileParams *const tiles, int mi_row); |
106 | | int is_vert_tile_boundary(struct CommonTileParams *const tiles, int mi_col); |
107 | | |
108 | | // Find smallest k>=0 such that (blk_size << k) >= target |
109 | 75.8k | static INLINE int tile_log2(int blk_size, int target) { |
110 | 75.8k | int k; |
111 | 160k | for (k = 0; (blk_size << k) < target; k++) { |
112 | 84.4k | } |
113 | 75.8k | return k; |
114 | 75.8k | } Unexecuted instantiation: av2_dx_iface.c:tile_log2 Unexecuted instantiation: annexF.c:tile_log2 Unexecuted instantiation: decodeframe.c:tile_log2 Unexecuted instantiation: decodemv.c:tile_log2 Unexecuted instantiation: decoder.c:tile_log2 Unexecuted instantiation: decodetxb.c:tile_log2 Unexecuted instantiation: detokenize.c:tile_log2 Unexecuted instantiation: obu_fgm.c:tile_log2 Unexecuted instantiation: obu.c:tile_log2 Unexecuted instantiation: obu_ci.c:tile_log2 Unexecuted instantiation: obu_atlas.c:tile_log2 Unexecuted instantiation: obu_lcr.c:tile_log2 Unexecuted instantiation: obu_ops.c:tile_log2 Unexecuted instantiation: obu_buf.c:tile_log2 Unexecuted instantiation: avm_dsp_rtcd.c:tile_log2 Unexecuted instantiation: av2_rtcd.c:tile_log2 Unexecuted instantiation: blend_a64_hmask.c:tile_log2 Unexecuted instantiation: blend_a64_mask.c:tile_log2 Unexecuted instantiation: blend_a64_vmask.c:tile_log2 Unexecuted instantiation: loopfilter.c:tile_log2 Unexecuted instantiation: binary_codes_reader.c:tile_log2 Unexecuted instantiation: bitreader.c:tile_log2 Unexecuted instantiation: avm_convolve_copy_sse2.c:tile_log2 Unexecuted instantiation: avm_asm_stubs.c:tile_log2 Unexecuted instantiation: highbd_convolve_sse2.c:tile_log2 Unexecuted instantiation: highbd_convolve_ssse3.c:tile_log2 Unexecuted instantiation: blend_a64_hmask_sse4.c:tile_log2 Unexecuted instantiation: blend_a64_mask_sse4.c:tile_log2 Unexecuted instantiation: blend_a64_vmask_sse4.c:tile_log2 Unexecuted instantiation: loopfilter_sse4.c:tile_log2 Unexecuted instantiation: avm_convolve_copy_avx2.c:tile_log2 Unexecuted instantiation: highbd_convolve_avx2.c:tile_log2 Unexecuted instantiation: intrapred_avx2.c:tile_log2 Unexecuted instantiation: blend_a64_mask_avx2.c:tile_log2 Unexecuted instantiation: entdec_avx2.c:tile_log2 Unexecuted instantiation: annexA.c:tile_log2 Unexecuted instantiation: alloccommon.c:tile_log2 Unexecuted instantiation: av2_loopfilter.c:tile_log2 Unexecuted instantiation: av2_txfm.c:tile_log2 Unexecuted instantiation: blockd.c:tile_log2 Unexecuted instantiation: cdef.c:tile_log2 Unexecuted instantiation: gdf.c:tile_log2 Unexecuted instantiation: gdf_block.c:tile_log2 Unexecuted instantiation: cdef_block.c:tile_log2 Unexecuted instantiation: cfl.c:tile_log2 Unexecuted instantiation: convolve.c:tile_log2 Unexecuted instantiation: entropy.c:tile_log2 Unexecuted instantiation: entropymode.c:tile_log2 Unexecuted instantiation: entropymv.c:tile_log2 Unexecuted instantiation: idct.c:tile_log2 Unexecuted instantiation: level.c:tile_log2 Unexecuted instantiation: mvref_common.c:tile_log2 Unexecuted instantiation: pred_common.c:tile_log2 Unexecuted instantiation: quant_common.c:tile_log2 Unexecuted instantiation: reconinter.c:tile_log2 Unexecuted instantiation: reconintra.c:tile_log2 Unexecuted instantiation: restoration.c:tile_log2 Unexecuted instantiation: scale.c:tile_log2 Unexecuted instantiation: scan.c:tile_log2 Unexecuted instantiation: seg_common.c:tile_log2 Unexecuted instantiation: thread_common.c:tile_log2 Line | Count | Source | 109 | 75.8k | static INLINE int tile_log2(int blk_size, int target) { | 110 | 75.8k | int k; | 111 | 160k | for (k = 0; (blk_size << k) < target; k++) { | 112 | 84.4k | } | 113 | 75.8k | return k; | 114 | 75.8k | } |
Unexecuted instantiation: timing.c:tile_log2 Unexecuted instantiation: tip.c:tile_log2 Unexecuted instantiation: txb_common.c:tile_log2 Unexecuted instantiation: warped_motion.c:tile_log2 Unexecuted instantiation: hr_coding.c:tile_log2 Unexecuted instantiation: intra_matrix.c:tile_log2 Unexecuted instantiation: intra_dip.cc:tile_log2(int, int) Unexecuted instantiation: ccso.c:tile_log2 Unexecuted instantiation: bru.c:tile_log2 Unexecuted instantiation: obu_qm.c:tile_log2 Unexecuted instantiation: cdef_block_sse2.c:tile_log2 Unexecuted instantiation: cfl_sse2.c:tile_log2 Unexecuted instantiation: cdef_block_ssse3.c:tile_log2 Unexecuted instantiation: cfl_ssse3.c:tile_log2 Unexecuted instantiation: highbd_convolve_2d_ssse3.c:tile_log2 Unexecuted instantiation: highbd_wiener_convolve_ssse3.c:tile_log2 Unexecuted instantiation: reconinter_ssse3.c:tile_log2 Unexecuted instantiation: cdef_block_sse4.c:tile_log2 Unexecuted instantiation: av2_convolve_horiz_rs_sse4.c:tile_log2 Unexecuted instantiation: av2_convolve_scale_sse4.c:tile_log2 Unexecuted instantiation: highbd_convolve_2d_sse4.c:tile_log2 Unexecuted instantiation: highbd_inv_txfm_sse4.c:tile_log2 Unexecuted instantiation: highbd_jnt_convolve_sse4.c:tile_log2 Unexecuted instantiation: highbd_warp_plane_sse4.c:tile_log2 Unexecuted instantiation: intra_edge_sse4.c:tile_log2 Unexecuted instantiation: optflow_refine_sse4.c:tile_log2 Unexecuted instantiation: reconinter_sse4.c:tile_log2 Unexecuted instantiation: cdef_block_avx2.c:tile_log2 Unexecuted instantiation: affine_optflow_refine_avx2.c:tile_log2 Unexecuted instantiation: bawp_avx2.c:tile_log2 Unexecuted instantiation: cfl_avx2.c:tile_log2 Unexecuted instantiation: highbd_ccso_avx2.c:tile_log2 Unexecuted instantiation: highbd_convolve_2d_avx2.c:tile_log2 Unexecuted instantiation: highbd_inv_txfm_avx2.c:tile_log2 Unexecuted instantiation: highbd_jnt_convolve_avx2.c:tile_log2 Unexecuted instantiation: highbd_wiener_convolve_avx2.c:tile_log2 Unexecuted instantiation: highbd_warp_affine_avx2.c:tile_log2 Unexecuted instantiation: reconinter_avx2.c:tile_log2 Unexecuted instantiation: gdf_block_avx2.c:tile_log2 Unexecuted instantiation: avm_convolve.c:tile_log2 Unexecuted instantiation: intrapred.c:tile_log2 Unexecuted instantiation: sad.c:tile_log2 Unexecuted instantiation: highbd_intrapred_sse2.c:tile_log2 Unexecuted instantiation: av2_inv_txfm2d.c:tile_log2 |
115 | | |
116 | | #ifdef __cplusplus |
117 | | } // extern "C" |
118 | | #endif |
119 | | |
120 | | #endif // AVM_AV2_COMMON_TILE_COMMON_H_ |