• 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 
21 struct AV1Common;
22 struct SequenceHeader;
23 struct CommonTileParams;
24 
25 #define DEFAULT_MAX_NUM_TG 1
26 
27 typedef struct TileInfo {
28   int mi_row_start, mi_row_end;
29   int mi_col_start, mi_col_end;
30   int tile_row;
31   int tile_col;
32 } TileInfo;
33 
34 // initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on
35 // 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)'
36 void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row,
37                    int col);
38 
39 void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row);
40 void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col);
41 
42 int av1_get_sb_rows_in_tile(struct AV1Common *cm, TileInfo tile);
43 int av1_get_sb_cols_in_tile(struct AV1Common *cm, TileInfo tile);
44 
45 typedef struct {
46   int left, top, right, bottom;
47 } AV1PixelRect;
48 
49 // Return the pixel extents of the given tile
50 AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info,
51                                const struct AV1Common *cm, int is_uv);
52 
53 // Define tile maximum width and area
54 // There is no maximum height since height is limited by area and width limits
55 // The minimum tile width or height is fixed at one superblock
56 #define MAX_TILE_WIDTH (4096)        // Max Tile width in pixels
57 #define MAX_TILE_AREA (4096 * 2304)  // Maximum tile area in pixels
58 
59 void av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h);
60 void av1_get_tile_limits(struct AV1Common *const cm);
61 void av1_calculate_tile_cols(const struct SequenceHeader *const seq_params,
62                              int cm_mi_rows, int cm_mi_cols,
63                              struct CommonTileParams *const tiles);
64 void av1_calculate_tile_rows(const struct SequenceHeader *const seq_params,
65                              int cm_mi_rows,
66                              struct CommonTileParams *const tiles);
67 
68 // Checks if the minimum tile_width requirement is satisfied
69 int av1_is_min_tile_width_satisfied(const struct AV1Common *cm);
70 
71 #ifdef __cplusplus
72 }  // extern "C"
73 #endif
74 
75 #endif  // AOM_AV1_COMMON_TILE_COMMON_H_
76