blob: 5bbea5fe52dd5618e956e16e8d123460949bf8f2 [file] [log] [blame]
Jingning Han3ee6db62015-08-05 19:00:31 -07001/*
Lester Lu6bc30d62021-12-16 19:13:21 +00002 * Copyright (c) 2021, Alliance for Open Media. All rights reserved
Jingning Han3ee6db62015-08-05 19:00:31 -07003 *
Lester Lu6bc30d62021-12-16 19:13:21 +00004 * 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 Han3ee6db62015-08-05 19:00:31 -070011 */
12
James Zerne1cbb132018-08-22 14:10:36 -070013#ifndef AOM_AV1_COMMON_TILE_COMMON_H_
14#define AOM_AV1_COMMON_TILE_COMMON_H_
Jingning Han3ee6db62015-08-05 19:00:31 -070015
16#ifdef __cplusplus
17extern "C" {
18#endif
19
Tom Finegan60e653d2018-05-22 11:34:58 -070020#include "config/aom_config.h"
Alex Converse64d7ef62017-03-22 18:09:16 -070021
Yaowu Xuf883b422016-08-30 14:01:10 -070022struct AV1Common;
Urvang Joshi54ffae72020-03-23 13:37:10 -070023struct SequenceHeader;
24struct CommonTileParams;
Jingning Han3ee6db62015-08-05 19:00:31 -070025
Thomas Daviesdbfc4f92017-01-18 16:46:09 +000026#define DEFAULT_MAX_NUM_TG 1
Thomas Davies80188d12016-10-26 16:08:35 -070027
Jingning Han3ee6db62015-08-05 19:00:31 -070028typedef struct TileInfo {
29 int mi_row_start, mi_row_end;
30 int mi_col_start, mi_col_end;
Cherma Rajan Ae4121f62018-04-18 17:30:55 +053031 int tile_row;
32 int tile_col;
Jingning Han3ee6db62015-08-05 19:00:31 -070033} 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 Xuf883b422016-08-30 14:01:10 -070037void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row,
38 int col);
Jingning Han3ee6db62015-08-05 19:00:31 -070039
Yaowu Xuf883b422016-08-30 14:01:10 -070040void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row);
41void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col);
Jingning Han3ee6db62015-08-05 19:00:31 -070042
Ravi Chaudhary73cf15b2018-08-30 10:52:51 +053043int av1_get_sb_rows_in_tile(struct AV1Common *cm, TileInfo tile);
44int av1_get_sb_cols_in_tile(struct AV1Common *cm, TileInfo tile);
45
Johann6b41d4d2018-02-08 14:32:53 -080046typedef struct {
47 int left, top, right, bottom;
48} AV1PixelRect;
Rupert Swarbrick33ed9e62017-10-23 13:32:37 +010049
50// Return the pixel extents of the given tile
51AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info,
52 const struct AV1Common *cm, int is_uv);
53
Dominic Symesdb5d66f2017-08-18 18:11:34 +020054// 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 Barker6cd5a822018-03-05 16:19:28 +000057#define MAX_TILE_WIDTH (4096) // Max Tile width in pixels
Dominic Symesdb5d66f2017-08-18 18:11:34 +020058#define MAX_TILE_AREA (4096 * 2304) // Maximum tile area in pixels
Dominic Symesdb5d66f2017-08-18 18:11:34 +020059
Frederic Barbier96621892018-11-29 14:48:01 +010060void av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h);
Dominic Symesdb5d66f2017-08-18 18:11:34 +020061void av1_get_tile_limits(struct AV1Common *const cm);
Yaowu Xu03442042020-03-26 08:03:27 -070062void av1_calculate_tile_cols(const struct SequenceHeader *const seq_params,
Urvang Joshi54ffae72020-03-23 13:37:10 -070063 int cm_mi_rows, int cm_mi_cols,
Yaowu Xu03442042020-03-26 08:03:27 -070064 struct CommonTileParams *const tiles);
65void av1_calculate_tile_rows(const struct SequenceHeader *const seq_params,
66 int cm_mi_rows,
67 struct CommonTileParams *const tiles);
Dominic Symesdb5d66f2017-08-18 18:11:34 +020068
Debargha Mukherjeea082f762019-03-04 15:05:18 -080069// Checks if the minimum tile_width requirement is satisfied
Yaowu Xu7e450882019-04-30 15:09:18 -070070int av1_is_min_tile_width_satisfied(const struct AV1Common *cm);
Debargha Mukherjeea082f762019-03-04 15:05:18 -080071
Jingning Han3ee6db62015-08-05 19:00:31 -070072#ifdef __cplusplus
73} // extern "C"
74#endif
75
James Zerne1cbb132018-08-22 14:10:36 -070076#endif // AOM_AV1_COMMON_TILE_COMMON_H_