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