• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3  *
4  * This source code is subject to the terms of the BSD 2 Clause License and
5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6  * was not distributed with this source code in the LICENSE file, you can
7  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8  * Media Patent License 1.0 was not distributed with this source code in the
9  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10  */
11 
12 #ifndef AOM_AV1_COMMON_TILE_COMMON_H_
13 #define AOM_AV1_COMMON_TILE_COMMON_H_
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include "config/aom_config.h"
20 #include "aom_dsp/rect.h"
21 
22 struct AV1Common;
23 struct SequenceHeader;
24 struct CommonTileParams;
25 
26 #define DEFAULT_MAX_NUM_TG 1
27 
28 typedef struct TileInfo {
29   int mi_row_start, mi_row_end;
30   int mi_col_start, mi_col_end;
31   int tile_row;
32   int tile_col;
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)'
37 void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row,
38                    int col);
39 
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);
42 
43 int av1_get_sb_rows_in_tile(struct AV1Common *cm, const TileInfo *tile);
44 int av1_get_sb_cols_in_tile(struct AV1Common *cm, const TileInfo *tile);
45 
46 // Return the pixel extents of the given tile
47 PixelRect av1_get_tile_rect(const TileInfo *tile_info,
48                             const struct AV1Common *cm, int is_uv);
49 
50 // Define tile maximum width and area
51 // There is no maximum height since height is limited by area and width limits
52 // The minimum tile width or height is fixed at one superblock
53 #define MAX_TILE_WIDTH (4096)        // Max Tile width in pixels
54 #define MAX_TILE_AREA (4096 * 2304)  // Maximum tile area in pixels
55 #define MAX_TILE_AREA_LEVEL_7_AND_ABOVE (4096 * 4608)
56 
57 void av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h);
58 void av1_get_tile_limits(struct AV1Common *const cm);
59 void av1_calculate_tile_cols(const struct SequenceHeader *const seq_params,
60                              int cm_mi_rows, int cm_mi_cols,
61                              struct CommonTileParams *const tiles);
62 void av1_calculate_tile_rows(const struct SequenceHeader *const seq_params,
63                              int cm_mi_rows,
64                              struct CommonTileParams *const tiles);
65 
66 // Checks if the minimum tile_width requirement is satisfied
67 int av1_is_min_tile_width_satisfied(const struct AV1Common *cm);
68 
69 #ifdef __cplusplus
70 }  // extern "C"
71 #endif
72 
73 #endif  // AOM_AV1_COMMON_TILE_COMMON_H_
74