Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 1 | /* |
Lester Lu | 6bc30d6 | 2021-12-16 19:13:21 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2021, Alliance for Open Media. All rights reserved |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 3 | * |
Lester Lu | 6bc30d6 | 2021-12-16 19:13:21 +0000 | [diff] [blame^] | 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/. |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 13 | #ifndef AOM_AV1_COMMON_TILE_COMMON_H_ |
| 14 | #define AOM_AV1_COMMON_TILE_COMMON_H_ |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 20 | #include "config/aom_config.h" |
Alex Converse | 64d7ef6 | 2017-03-22 18:09:16 -0700 | [diff] [blame] | 21 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 22 | struct AV1Common; |
Urvang Joshi | 54ffae7 | 2020-03-23 13:37:10 -0700 | [diff] [blame] | 23 | struct SequenceHeader; |
| 24 | struct CommonTileParams; |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 25 | |
Thomas Davies | dbfc4f9 | 2017-01-18 16:46:09 +0000 | [diff] [blame] | 26 | #define DEFAULT_MAX_NUM_TG 1 |
Thomas Davies | 80188d1 | 2016-10-26 16:08:35 -0700 | [diff] [blame] | 27 | |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 28 | typedef struct TileInfo { |
| 29 | int mi_row_start, mi_row_end; |
| 30 | int mi_col_start, mi_col_end; |
Cherma Rajan A | e4121f6 | 2018-04-18 17:30:55 +0530 | [diff] [blame] | 31 | int tile_row; |
| 32 | int tile_col; |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 33 | } TileInfo; |
| 34 | |
| 35 | // initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on |
| 36 | // 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)' |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 37 | void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row, |
| 38 | int col); |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 39 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 40 | void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row); |
| 41 | void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col); |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 42 | |
Ravi Chaudhary | 73cf15b | 2018-08-30 10:52:51 +0530 | [diff] [blame] | 43 | int av1_get_sb_rows_in_tile(struct AV1Common *cm, TileInfo tile); |
| 44 | int av1_get_sb_cols_in_tile(struct AV1Common *cm, TileInfo tile); |
| 45 | |
Johann | 6b41d4d | 2018-02-08 14:32:53 -0800 | [diff] [blame] | 46 | typedef struct { |
| 47 | int left, top, right, bottom; |
| 48 | } AV1PixelRect; |
Rupert Swarbrick | 33ed9e6 | 2017-10-23 13:32:37 +0100 | [diff] [blame] | 49 | |
| 50 | // Return the pixel extents of the given tile |
| 51 | AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info, |
| 52 | const struct AV1Common *cm, int is_uv); |
| 53 | |
Dominic Symes | db5d66f | 2017-08-18 18:11:34 +0200 | [diff] [blame] | 54 | // Define tile maximum width and area |
| 55 | // There is no maximum height since height is limited by area and width limits |
| 56 | // The minimum tile width or height is fixed at one superblock |
David Barker | 6cd5a82 | 2018-03-05 16:19:28 +0000 | [diff] [blame] | 57 | #define MAX_TILE_WIDTH (4096) // Max Tile width in pixels |
Dominic Symes | db5d66f | 2017-08-18 18:11:34 +0200 | [diff] [blame] | 58 | #define MAX_TILE_AREA (4096 * 2304) // Maximum tile area in pixels |
Dominic Symes | db5d66f | 2017-08-18 18:11:34 +0200 | [diff] [blame] | 59 | |
Frederic Barbier | 9662189 | 2018-11-29 14:48:01 +0100 | [diff] [blame] | 60 | void av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h); |
Dominic Symes | db5d66f | 2017-08-18 18:11:34 +0200 | [diff] [blame] | 61 | void av1_get_tile_limits(struct AV1Common *const cm); |
Yaowu Xu | 0344204 | 2020-03-26 08:03:27 -0700 | [diff] [blame] | 62 | void av1_calculate_tile_cols(const struct SequenceHeader *const seq_params, |
Urvang Joshi | 54ffae7 | 2020-03-23 13:37:10 -0700 | [diff] [blame] | 63 | int cm_mi_rows, int cm_mi_cols, |
Yaowu Xu | 0344204 | 2020-03-26 08:03:27 -0700 | [diff] [blame] | 64 | struct CommonTileParams *const tiles); |
| 65 | void av1_calculate_tile_rows(const struct SequenceHeader *const seq_params, |
| 66 | int cm_mi_rows, |
| 67 | struct CommonTileParams *const tiles); |
Dominic Symes | db5d66f | 2017-08-18 18:11:34 +0200 | [diff] [blame] | 68 | |
Debargha Mukherjee | a082f76 | 2019-03-04 15:05:18 -0800 | [diff] [blame] | 69 | // Checks if the minimum tile_width requirement is satisfied |
Yaowu Xu | 7e45088 | 2019-04-30 15:09:18 -0700 | [diff] [blame] | 70 | int av1_is_min_tile_width_satisfied(const struct AV1Common *cm); |
Debargha Mukherjee | a082f76 | 2019-03-04 15:05:18 -0800 | [diff] [blame] | 71 | |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 72 | #ifdef __cplusplus |
| 73 | } // extern "C" |
| 74 | #endif |
| 75 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 76 | #endif // AOM_AV1_COMMON_TILE_COMMON_H_ |